From 76af3294dbf709eca9cddb3e7efe7c689d32a6c0 Mon Sep 17 00:00:00 2001 From: Vignesh Rao Date: Fri, 16 Aug 2024 18:30:35 -0500 Subject: [PATCH] Remove unwanted module reloads Attach dry-run inputs to workflow-dispatch --- .github/workflows/python-publish.yml | 14 ++++++++++++-- .gitignore | 4 ++++ README.md | 5 ++++- docs/README.md | 5 ++++- docs/_sources/README.md.txt | 5 ++++- jarvis/api/logger.py | 2 -- jarvis/executors/telegram.py | 4 ---- jarvis/lib/install_darwin.sh | 0 jarvis/modules/database/database.py | 3 --- jarvis/modules/logger.py | 2 +- jarvis/modules/telegram/audio_handler.py | 4 ---- 11 files changed, 29 insertions(+), 19 deletions(-) mode change 100644 => 100755 jarvis/lib/install_darwin.sh diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 46240c5a..77d59425 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -12,8 +12,15 @@ 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: @@ -21,7 +28,10 @@ jobs: 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 diff --git a/.gitignore b/.gitignore index 7f1a2a92..60a12d3a 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md index 4996b7c7..5e015549 100644 --- a/README.md +++ b/README.md @@ -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** @@ -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 diff --git a/docs/README.md b/docs/README.md index 4996b7c7..5e015549 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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** @@ -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 diff --git a/docs/_sources/README.md.txt b/docs/_sources/README.md.txt index 4996b7c7..5e015549 100644 --- a/docs/_sources/README.md.txt +++ b/docs/_sources/README.md.txt @@ -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** @@ -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 diff --git a/jarvis/api/logger.py b/jarvis/api/logger.py index 29edffd9..b49e07c6 100644 --- a/jarvis/api/logger.py +++ b/jarvis/api/logger.py @@ -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 @@ -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" diff --git a/jarvis/executors/telegram.py b/jarvis/executors/telegram.py index e9d87682..e4c22fdf 100644 --- a/jarvis/executors/telegram.py +++ b/jarvis/executors/telegram.py @@ -1,5 +1,3 @@ -import importlib -import logging import os import time from urllib.parse import urljoin @@ -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} diff --git a/jarvis/lib/install_darwin.sh b/jarvis/lib/install_darwin.sh old mode 100644 new mode 100755 diff --git a/jarvis/modules/database/database.py b/jarvis/modules/database/database.py index 784dc2a6..cd38ddd6 100644 --- a/jarvis/modules/database/database.py +++ b/jarvis/modules/database/database.py @@ -4,7 +4,6 @@ """ -import importlib import logging import os import random @@ -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", diff --git a/jarvis/modules/logger.py b/jarvis/modules/logger.py index b6bb8355..62d77204 100644 --- a/jarvis/modules/logger.py +++ b/jarvis/modules/logger.py @@ -18,7 +18,6 @@ datefmt="%b-%d-%Y %I:%M:%S %p", fmt=DEFAULT_LOG_FORM ) -importlib.reload(module=logging) dictConfig( { "version": 1, @@ -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: diff --git a/jarvis/modules/telegram/audio_handler.py b/jarvis/modules/telegram/audio_handler.py index 03172b13..16831cbd 100644 --- a/jarvis/modules/telegram/audio_handler.py +++ b/jarvis/modules/telegram/audio_handler.py @@ -5,8 +5,6 @@ """ -import importlib -import logging import os from typing import Callable @@ -14,8 +12,6 @@ from jarvis.modules.logger import logger -importlib.reload(module=logging) - def audio_converter_mac() -> Callable: """Imports transcode from ftransc.