Skip to content

Commit

Permalink
Merge branch 'master' into feature/otel-prometheus-version
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaspuff committed Dec 14, 2023
2 parents de77eb7 + c6eb580 commit 7570d4c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down
23 changes: 20 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ target-version = "py38"
select = [
"F", # pyflakes
"E", # pycodestyle (erorr)
# "I", # isort
"I", # isort
"W", # pycodestyle (warning)
"C901", # complex-structure
"UP", # pyupgrade
Expand All @@ -178,25 +178,42 @@ select = [
"BLE", # flake8-blind-except
"S", # flake8-bandit
]
extend-select = ["I"]
ignore = [
"UP007", # union type annotations
"UP006", # type instead of Type
"SIM105", # try-catch-pass
"S110", # try-catch-pass (logging)
"BLE001", # blind exception
"SLF001", # private attribute access
"I001", # isort
"I005", # isort
"PLR0913", # too many arguments
"UP037", # type annotation with quotes
]
src = [
"src",
"tomodachi",
"tests",
]

[tool.ruff.lint.isort]
known-first-party = ["tomodachi", "run_test_service_helper", "proto_build"]
known-third-party = ["opentelemetry", "prometheus_client"]


[tool.ruff.per-file-ignores]
"tests/**/*.py" = [
"S101", # assert
"PLR2004", # magic-value-comparison
]
"tomodachi/**/*_pb2.py*" = [
"UP009", # utf-8 encoding
"SLF001", # private member accessed
"E501", # line too long
"I001", # isort
"UP036", # version block outdated
"N802", # camelcase function
"N816", # mixedcase variable
]

[tool.mypy]
pretty = true
Expand Down
12 changes: 10 additions & 2 deletions tomodachi/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,16 @@ def invoker_function_sorter(m: str) -> int:
tasks = [task for task in asyncio.all_tasks()]
for task in tasks:
try:
co_filename = task.get_coro().cr_code.co_filename if hasattr(task, "get_coro") else task._coro.cr_code.co_filename # type: ignore
co_name = task.get_coro().cr_code.co_name if hasattr(task, "get_coro") else task._coro.cr_code.co_name # type: ignore
co_filename = (
cast(Any, task.get_coro()).cr_code.co_filename
if hasattr(task, "get_coro")
else cast(Any, task)._coro.cr_code.co_filename
)
co_name = (
cast(Any, task.get_coro()).cr_code.co_name
if hasattr(task, "get_coro")
else cast(Any, task).cr_code.co_name
)

if "/tomodachi/watcher.py" in co_filename and co_name == "_watch_loop":
continue
Expand Down
8 changes: 1 addition & 7 deletions tomodachi/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,13 +1000,7 @@ def __call__(self, logger: WrappedLogger, method_name: str, event_dict: EventDic

ts = event_dict.pop("timestamp", None)
if ts is not None:
sio.write(
# can be a number if timestamp is UNIXy
_styles.timestamp
+ str(ts)
+ _styles.reset
+ " "
)
sio.write(_styles.timestamp + str(ts) + _styles.reset + " ")
level = event_dict.pop("level", None)
if level is not None:
sio.write(
Expand Down

0 comments on commit 7570d4c

Please sign in to comment.