Skip to content

Commit

Permalink
Remove unwanted module reloads
Browse files Browse the repository at this point in the history
Attach dry-run inputs to workflow-dispatch
  • Loading branch information
dormant-user committed Aug 16, 2024
1 parent df32dca commit 76af329
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 19 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,26 @@ on:
- master
paths:
- jarvis/**
- 'pyproject.toml'
- pyproject.toml
workflow_dispatch:
inputs:
dry_run:
description: Dry run mode
required: true
options:
- "true"
- "false"

jobs:
pypi-publisher:
runs-on: thevickypedia-lite
steps:
- name: Set dry-run
run: |
if [[ "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "::notice title=DryRun::Setting dry run to ${{ inputs.dry_run }} for '${{ github.event_name }}' event"
echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo "::notice title=DryRun::Setting dry run to true for '${{ github.event_name }}' event"
echo "dry_run=true" >> $GITHUB_ENV
else
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ threat
alarm
reminder

# pip build
build/
jarvis_ironman.egg-info/

# sphinx docs builder within docs_gen
docs_gen/_build
docs_gen/_static
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

![Python][label-pyversion]
![Pypi-downloads][label-pypi-downloads]
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge)](https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis)
[![OpenSSF Scorecard][label-open-ssf]][link-open-ssf]

**Platform Supported**

Expand Down Expand Up @@ -267,3 +267,6 @@ Licensed under the [MIT License][license]
[label-maintainer]: https://img.shields.io/badge/Maintained%20By-Vignesh%20Rao-blue.svg

[label-askme]: https://img.shields.io/badge/SELECT%20*%20FROM-questions-1abc9c.svg

[label-open-ssf]: https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge
[link-open-ssf]: https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis
5 changes: 4 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

![Python][label-pyversion]
![Pypi-downloads][label-pypi-downloads]
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge)](https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis)
[![OpenSSF Scorecard][label-open-ssf]][link-open-ssf]

**Platform Supported**

Expand Down Expand Up @@ -267,3 +267,6 @@ Licensed under the [MIT License][license]
[label-maintainer]: https://img.shields.io/badge/Maintained%20By-Vignesh%20Rao-blue.svg

[label-askme]: https://img.shields.io/badge/SELECT%20*%20FROM-questions-1abc9c.svg

[label-open-ssf]: https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge
[link-open-ssf]: https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis
5 changes: 4 additions & 1 deletion docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

![Python][label-pyversion]
![Pypi-downloads][label-pypi-downloads]
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge)](https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis)
[![OpenSSF Scorecard][label-open-ssf]][link-open-ssf]

**Platform Supported**

Expand Down Expand Up @@ -267,3 +267,6 @@ Licensed under the [MIT License][license]
[label-maintainer]: https://img.shields.io/badge/Maintained%20By-Vignesh%20Rao-blue.svg

[label-askme]: https://img.shields.io/badge/SELECT%20*%20FROM-questions-1abc9c.svg

[label-open-ssf]: https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge
[link-open-ssf]: https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis
2 changes: 0 additions & 2 deletions jarvis/api/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
- Creates a multiprocessing log wrapper, and adds a filter to include custom process name in the logger format.
"""

import importlib
import logging
import os
import pathlib
Expand All @@ -30,7 +29,6 @@
pathlib.Path(api_config.DEFAULT_LOG_FILENAME).touch()

# Configure logging
importlib.reload(module=logging)
dictConfig(config=api_config.LOG_CONFIG)
logging.getLogger(
"uvicorn.access"
Expand Down
4 changes: 0 additions & 4 deletions jarvis/executors/telegram.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import importlib
import logging
import os
import time
from urllib.parse import urljoin
Expand All @@ -11,8 +9,6 @@
from jarvis.modules.telegram import bot, webhook
from jarvis.modules.utils import support

importlib.reload(module=logging)

FAILED_CONNECTIONS = {"count": 0}


Expand Down
Empty file modified jarvis/lib/install_darwin.sh
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions jarvis/modules/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

import importlib
import logging
import os
import random
Expand Down Expand Up @@ -57,8 +56,6 @@ class __TestDatabase:

def __init__(self):
"""Initiates all the imported modules and creates a database file named ``sample``."""
importlib.reload(module=logging)

handler = logging.StreamHandler()
fmt_ = logging.Formatter(
fmt="%(asctime)s - %(levelname)s - [%(module)s:%(lineno)d] - %(funcName)s - %(message)s",
Expand Down
2 changes: 1 addition & 1 deletion jarvis/modules/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
datefmt="%b-%d-%Y %I:%M:%S %p", fmt=DEFAULT_LOG_FORM
)

importlib.reload(module=logging)
dictConfig(
{
"version": 1,
Expand Down Expand Up @@ -50,6 +49,7 @@ def multiprocessing_logger(
str:
Actual log filename with datetime converted.
"""
importlib.reload(logging)
logger.propagate = False
# Remove existing handlers
for _handler in logger.handlers:
Expand Down
4 changes: 0 additions & 4 deletions jarvis/modules/telegram/audio_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
"""

import importlib
import logging
import os
from typing import Callable

from pydantic import FilePath

from jarvis.modules.logger import logger

importlib.reload(module=logging)


def audio_converter_mac() -> Callable:
"""Imports transcode from ftransc.
Expand Down

0 comments on commit 76af329

Please sign in to comment.