Skip to content

Commit 76af329

Browse files
committed
Remove unwanted module reloads
Attach dry-run inputs to workflow-dispatch
1 parent df32dca commit 76af329

File tree

11 files changed

+29
-19
lines changed

11 files changed

+29
-19
lines changed

.github/workflows/python-publish.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,26 @@ on:
1212
- master
1313
paths:
1414
- jarvis/**
15-
- 'pyproject.toml'
15+
- pyproject.toml
1616
workflow_dispatch:
17+
inputs:
18+
dry_run:
19+
description: Dry run mode
20+
required: true
21+
options:
22+
- "true"
23+
- "false"
1724

1825
jobs:
1926
pypi-publisher:
2027
runs-on: thevickypedia-lite
2128
steps:
2229
- name: Set dry-run
2330
run: |
24-
if [[ "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
31+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
32+
echo "::notice title=DryRun::Setting dry run to ${{ inputs.dry_run }} for '${{ github.event_name }}' event"
33+
echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_ENV
34+
elif [[ "${{ github.event_name }}" == "push" ]]; then
2535
echo "::notice title=DryRun::Setting dry run to true for '${{ github.event_name }}' event"
2636
echo "dry_run=true" >> $GITHUB_ENV
2737
else

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ threat
3131
alarm
3232
reminder
3333

34+
# pip build
35+
build/
36+
jarvis_ironman.egg-info/
37+
3438
# sphinx docs builder within docs_gen
3539
docs_gen/_build
3640
docs_gen/_static

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

1212
**Platform Supported**
1313

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

269269
[label-askme]: https://img.shields.io/badge/SELECT%20*%20FROM-questions-1abc9c.svg
270+
271+
[label-open-ssf]: https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge
272+
[link-open-ssf]: https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis

docs/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

1212
**Platform Supported**
1313

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

269269
[label-askme]: https://img.shields.io/badge/SELECT%20*%20FROM-questions-1abc9c.svg
270+
271+
[label-open-ssf]: https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge
272+
[link-open-ssf]: https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis

docs/_sources/README.md.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

1212
**Platform Supported**
1313

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

269269
[label-askme]: https://img.shields.io/badge/SELECT%20*%20FROM-questions-1abc9c.svg
270+
271+
[label-open-ssf]: https://api.securityscorecards.dev/projects/github.com/thevickypedia/Jarvis/badge
272+
[link-open-ssf]: https://securityscorecards.dev/viewer/?uri=github.com/thevickypedia/Jarvis

jarvis/api/logger.py

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
- Creates a multiprocessing log wrapper, and adds a filter to include custom process name in the logger format.
1111
"""
1212

13-
import importlib
1413
import logging
1514
import os
1615
import pathlib
@@ -30,7 +29,6 @@
3029
pathlib.Path(api_config.DEFAULT_LOG_FILENAME).touch()
3130

3231
# Configure logging
33-
importlib.reload(module=logging)
3432
dictConfig(config=api_config.LOG_CONFIG)
3533
logging.getLogger(
3634
"uvicorn.access"

jarvis/executors/telegram.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import importlib
2-
import logging
31
import os
42
import time
53
from urllib.parse import urljoin
@@ -11,8 +9,6 @@
119
from jarvis.modules.telegram import bot, webhook
1210
from jarvis.modules.utils import support
1311

14-
importlib.reload(module=logging)
15-
1612
FAILED_CONNECTIONS = {"count": 0}
1713

1814

jarvis/lib/install_darwin.sh

100644100755
File mode changed.

jarvis/modules/database/database.py

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
55
"""
66

7-
import importlib
87
import logging
98
import os
109
import random
@@ -57,8 +56,6 @@ class __TestDatabase:
5756

5857
def __init__(self):
5958
"""Initiates all the imported modules and creates a database file named ``sample``."""
60-
importlib.reload(module=logging)
61-
6259
handler = logging.StreamHandler()
6360
fmt_ = logging.Formatter(
6461
fmt="%(asctime)s - %(levelname)s - [%(module)s:%(lineno)d] - %(funcName)s - %(message)s",

jarvis/modules/logger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
datefmt="%b-%d-%Y %I:%M:%S %p", fmt=DEFAULT_LOG_FORM
1919
)
2020

21-
importlib.reload(module=logging)
2221
dictConfig(
2322
{
2423
"version": 1,
@@ -50,6 +49,7 @@ def multiprocessing_logger(
5049
str:
5150
Actual log filename with datetime converted.
5251
"""
52+
importlib.reload(logging)
5353
logger.propagate = False
5454
# Remove existing handlers
5555
for _handler in logger.handlers:

jarvis/modules/telegram/audio_handler.py

-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
66
"""
77

8-
import importlib
9-
import logging
108
import os
119
from typing import Callable
1210

1311
from pydantic import FilePath
1412

1513
from jarvis.modules.logger import logger
1614

17-
importlib.reload(module=logging)
18-
1915

2016
def audio_converter_mac() -> Callable:
2117
"""Imports transcode from ftransc.

0 commit comments

Comments
 (0)