Skip to content

Commit

Permalink
Merge pull request #469 from Der-Henning/dev
Browse files Browse the repository at this point in the history
Bump 1.20.3
  • Loading branch information
Der-Henning authored Feb 24, 2024
2 parents 9ffee8f + da792df commit d7a3b17
Show file tree
Hide file tree
Showing 13 changed files with 232 additions and 238 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:

jobs:
run:
name: Update requirements.txt
name: Update requirements.txt and lock file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -29,8 +29,10 @@ jobs:
poetry-version: ${{ env.POETRY_VERSION }}
python-version: ${{ env.PYTHON_VERSION }}
install-dependencies: false
- name: Run poetry export
run: poetry export -f requirements.txt --output requirements.txt --without-hashes
- name: Update dependencies
run: |
poetry lock --no-update
poetry export -f requirements.txt --output requirements.txt --without-hashes
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default: true

# MD013/line-length - Line length
MD013:
line_length: 120
line_length: 130
tables: false

# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/ambv/black
rev: 23.12.1
rev: 24.2.0
hooks:
- id: black
args: [--line-length, '130', --target-version, py38]
Expand Down Expand Up @@ -42,7 +42,7 @@ repos:
args: [--autofix]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.38.0
rev: v0.39.0
hooks:
- id: markdownlint
args: [--fix]
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
clean:
rm -rf .venv
rm -rf .pytest_cache
rm -rf .tox
rm -rf .mypy_cache
rm -rf .venv .pytest_cache .tox .mypy_cache dist build

install:
poetry install
Expand All @@ -24,8 +21,7 @@ tox:
tox

executable:
rm -r ./build ||:
rm -r ./dist ||:
rm -rf ./build ./dist
poetry run pyinstaller ./scanner.spec
cp ./config.sample.ini ./dist/config.ini
zip -j ./dist/scanner.zip ./dist/*
Expand Down
12 changes: 0 additions & 12 deletions RELEASE_CHECKLIST.md

This file was deleted.

234 changes: 117 additions & 117 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name = "tgtg-scanner"
packages = [{include = "tgtg_scanner"}]
readme = "README.md"
repository = "https://github.com/Der-Henning/tgtg"
version = "1.20.2"
version = "1.20.3"

[tool.poetry.dependencies]
apprise = "^1.4.0"
Expand All @@ -22,11 +22,11 @@ googlemaps = "^4.10.0"
humanize = "^4.7.0"
packaging = "^23.1"
progress = "^1.6"
prometheus-client = "^0.19.0"
prometheus-client = "^0.20.0"
pycron = "^3.0.0"
python = ">=3.9,<3.13"
python-pushsafer = "^1.1"
python-telegram-bot = {extras = ["callback-data"], version = "^20.4"}
python-telegram-bot = {extras = ["callback-data"], version = "^20.8"}
requests = "^2.31.0"

[tool.poetry.group.build.dependencies]
Expand All @@ -37,7 +37,7 @@ pre-commit = "^3.3.3"
pytest = "^8.0.0"
pytest-cov = "^4.1.0"
pytest-mock = "^3.11.1"
responses = "^0.24.1"
responses = "^0.25.0"

[tool.poetry.scripts]
scanner = "tgtg_scanner.__main__:main"
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
anyio==4.2.0 ; python_version >= "3.9" and python_version < "3.13"
anyio==4.3.0 ; python_version >= "3.9" and python_version < "3.13"
apprise==1.7.2 ; python_version >= "3.9" and python_version < "3.13"
cachetools==5.3.2 ; python_version >= "3.9" and python_version < "3.13"
certifi==2023.11.17 ; python_version >= "3.9" and python_version < "3.13"
certifi==2024.2.2 ; python_version >= "3.9" and python_version < "3.13"
charset-normalizer==3.3.2 ; python_version >= "3.9" and python_version < "3.13"
click==8.1.7 ; python_version >= "3.9" and python_version < "3.13"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.13" and (sys_platform == "win32" or platform_system == "Windows")
Expand All @@ -10,23 +10,23 @@ cron-descriptor==1.4.3 ; python_version >= "3.9" and python_version < "3.13"
exceptiongroup==1.2.0 ; python_version >= "3.9" and python_version < "3.11"
googlemaps==4.10.0 ; python_version >= "3.9" and python_version < "3.13"
h11==0.14.0 ; python_version >= "3.9" and python_version < "3.13"
httpcore==1.0.2 ; python_version >= "3.9" and python_version < "3.13"
httpx==0.25.2 ; python_version >= "3.9" and python_version < "3.13"
httpcore==1.0.4 ; python_version >= "3.9" and python_version < "3.13"
httpx==0.26.0 ; python_version >= "3.9" and python_version < "3.13"
humanize==4.9.0 ; python_version >= "3.9" and python_version < "3.13"
idna==3.6 ; python_version >= "3.9" and python_version < "3.13"
importlib-metadata==7.0.1 ; python_version >= "3.9" and python_version < "3.10"
markdown==3.5.2 ; python_version >= "3.9" and python_version < "3.13"
oauthlib==3.2.2 ; python_version >= "3.9" and python_version < "3.13"
packaging==23.2 ; python_version >= "3.9" and python_version < "3.13"
progress==1.6 ; python_version >= "3.9" and python_version < "3.13"
prometheus-client==0.19.0 ; python_version >= "3.9" and python_version < "3.13"
prometheus-client==0.20.0 ; python_version >= "3.9" and python_version < "3.13"
pycron==3.0.0 ; python_version >= "3.9" and python_version < "3.13"
python-pushsafer==1.1 ; python_version >= "3.9" and python_version < "3.13"
python-telegram-bot[callback-data]==20.7 ; python_version >= "3.9" and python_version < "3.13"
python-telegram-bot[callback-data]==20.8 ; python_version >= "3.9" and python_version < "3.13"
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "3.13"
requests-oauthlib==1.3.1 ; python_version >= "3.9" and python_version < "3.13"
requests==2.31.0 ; python_version >= "3.9" and python_version < "3.13"
sniffio==1.3.0 ; python_version >= "3.9" and python_version < "3.13"
typing-extensions==4.9.0 ; python_version >= "3.9" and python_version < "3.11"
urllib3==2.2.0 ; python_version >= "3.9" and python_version < "3.13"
urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.13"
zipp==3.17.0 ; python_version >= "3.9" and python_version < "3.10"
5 changes: 3 additions & 2 deletions tgtg_scanner/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@

SYS_PLATFORM = platform.system()
IS_WINDOWS = SYS_PLATFORM.lower() in {"windows", "cygwin"}
IS_EXECUTABLE = getattr(sys, "_MEIPASS", False)
IS_EXECUTABLE = getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS")
PROG_PATH = Path(sys.executable).parent if IS_EXECUTABLE else Path(os.getcwd())
IS_DOCKER = os.environ.get("DOCKER", "False").lower() in {"true", "1", "t", "y", "yes"}
LOGS_PATH = os.environ.get("LOGS_PATH", PROG_PATH)
LOGS_PATH = Path(os.environ.get("LOGS_PATH", PROG_PATH))


def main():
Expand Down Expand Up @@ -130,6 +130,7 @@ def main():
logging.root.addHandler(stream_handler)

# Define file formatter and handler
args.log_file.parent.mkdir(parents=True, exist_ok=True)
file_handler = logging.FileHandler(args.log_file, mode="w", encoding="utf-8")
file_formatter = logging.Formatter(
fmt=("[%(asctime)s][%(name)s][%(filename)s:%(funcName)s:%(lineno)d][%(levelname)s] %(message)s"),
Expand Down
4 changes: 4 additions & 0 deletions tgtg_scanner/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,12 @@ def __post_init__(self):

self.token_path = environ.get("TGTG_TOKEN_PATH", None)
self._load_tokens()
self.set_locale()

def set_locale(self) -> None:
if self.locale and not self.locale.startswith("en"):
try:
log.debug("Activating locale %s", self.locale)
humanize.i18n.activate(self.locale)
except FileNotFoundError as err:
raise ConfigurationError(f"Invalid locale '{self.locale}' - {err}") from err
Expand Down
2 changes: 2 additions & 0 deletions tgtg_scanner/notifiers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Notifier(ABC):

@abstractmethod
def __init__(self, config: Config, reservations: Reservations, favorites: Favorites):
self.config = config
self.enabled = False
self.reservations = reservations
self.favorites = favorites
Expand All @@ -29,6 +30,7 @@ def name(self):

def _run(self) -> None:
"""Run notifier"""
self.config.set_locale()
while True:
try:
item = self.queue.get()
Expand Down
1 change: 1 addition & 0 deletions tgtg_scanner/notifiers/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ async def _listen_for_items() -> None:
except Exception as exc:
log.warning("Telegram failed stopping polling: %s", exc)

self.config.set_locale()
asyncio.run(_listen_for_items())

def _unmask(self, text: str, item: Item) -> str:
Expand Down
Loading

0 comments on commit d7a3b17

Please sign in to comment.