Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#148)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0)
- [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.282](astral-sh/ruff-pre-commit@v0.0.276...v0.0.282)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Aug 8, 2023
1 parent 7c8a3ae commit 01328c9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.276
rev: v0.0.282
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion src/argon2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __getattr__(name: str) -> str:
"__url__": "",
"__email__": "",
}
if name not in dunder_to_metadata.keys():
if name not in dunder_to_metadata:
msg = f"module {__name__} has no attribute {name}"
raise AttributeError(msg)

Expand Down
21 changes: 7 additions & 14 deletions src/argon2/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,17 @@ def main(argv: list[str]) -> None:

print("\nMeasuring...")
duration = timeit.timeit(
"ph.verify({hash!r}, {password!r})".format(
hash=hash, password=password
),
setup="""\
f"ph.verify({hash!r}, {password!r})",
setup=f"""\
from argon2 import PasswordHasher, Type
ph = PasswordHasher(
time_cost={time_cost!r},
memory_cost={memory_cost!r},
parallelism={parallelism!r},
hash_len={hash_len!r},
time_cost={args.t!r},
memory_cost={args.m!r},
parallelism={args.p!r},
hash_len={args.l!r},
)
gc.enable()""".format(
time_cost=args.t,
memory_cost=args.m,
parallelism=args.p,
hash_len=args.l,
),
gc.enable()""",
number=args.n,
)
print(f"\n{duration / args.n * 1000:.1f}ms per password verification")
Expand Down
4 changes: 1 addition & 3 deletions src/argon2/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ def _check_types(**kw: Any) -> str | None:
else:
types = types.__name__
errors.append(
"'{name}' must be a {type} (got {actual})".format(
name=name, type=types, actual=type(value).__name__
)
f"'{name}' must be a {types} (got {type(value).__name__})"
)

if errors != []:
Expand Down

0 comments on commit 01328c9

Please sign in to comment.