Skip to content

Commit

Permalink
Bump versions of pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Oct 19, 2024
1 parent 3a901de commit 46fd1b3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: mixed-line-ending
args: [--fix=lf]
- repo: https://github.com/crate-ci/typos
rev: v1.18.0
rev: v1.26.0
hooks:
- id: typos
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.14.0
hooks:
- id: pretty-format-ini
args: [--autofix]
Expand All @@ -21,11 +21,11 @@ repos:
- id: pretty-format-toml
args: [--autofix]
- repo: https://github.com/ambv/black
rev: 24.1.1
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.7.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
6 changes: 3 additions & 3 deletions loguru/_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ def env(key, type_, default=None):

val = environ[key]

if type_ == str:
if type_ is str:
return val
if type_ == bool:
if type_ is bool:
if val.lower() in ["1", "true", "yes", "y", "ok", "on"]:
return True
if val.lower() in ["0", "false", "no", "n", "nok", "off"]:
return False
raise ValueError(
"Invalid environment variable '%s' (expected a boolean): '%s'" % (key, val)
)
if type_ == int:
if type_ is int:
try:
return int(val)
except ValueError:
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ testpaths = ["tests"]
[tool.ruff]
exclude = ["tests/exceptions/source/*"]
line-length = 100

[tool.ruff.lint]
# Enforce pyflakes(F), pycodestyle(E, W), isort (I), bugbears (B), and pep8-naming (N) rules.
select = ["F", "E", "W", "I", "B", "N", "RET"]

[tool.ruff.pycodestyle]
[tool.ruff.lint.pycodestyle]
max-doc-length = 100

[tool.typos.default]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_coroutine_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ async def main():
assert "was never retrieved" not in message

exc_type, exc_value, _ = record.exc_info
assert exc_type == ValueError
assert exc_type is ValueError
assert str(exc_value) == "Oh no"


Expand Down Expand Up @@ -411,7 +411,7 @@ async def main():
assert "was never retrieved" not in message

exc_type, exc_value, _ = record.exc_info
assert exc_type == ValueError
assert exc_type is ValueError
assert str(exc_value) == "Oh no"


Expand Down
2 changes: 1 addition & 1 deletion tests/test_exceptions_catch.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def writer(msg):
assert reference == exception
assert not (exception != reference)
assert not (reference != exception)
assert all(t == ZeroDivisionError for t in (t_1, t_2, t_3, t_4))
assert all(t is ZeroDivisionError for t in (t_1, t_2, t_3, t_4))
assert all(isinstance(v, ZeroDivisionError) for v in (v_1, v_2, v_3, v_4))
assert all(isinstance(tb, types.TracebackType) for tb in (tb_1, tb_2, tb_3, tb_4))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_exceptions_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def test_invalid_format_exception_only_indented_error_message(writer, monkeypatc

@pytest.mark.skipif(sys.version_info < (3, 11), reason="No builtin GroupedException")
def test_invalid_grouped_exception_no_exceptions(writer):
error = MagicMock(spec=ExceptionGroup)
error = MagicMock(spec=ExceptionGroup) # noqa: F821
error.__cause__ = None
error.__context__ = None
error.__traceback__ = None
Expand Down

0 comments on commit 46fd1b3

Please sign in to comment.