Skip to content

Commit

Permalink
lint code with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
purificant committed Dec 20, 2023
1 parent 0ce8089 commit 93497ec
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ code-analysis:
mypy paseto tests --ignore-missing-imports
# run static code analysis
pylint paseto tests
ruff check .

# build and test the entire project
build: lock install lint coverage
Expand Down
2 changes: 2 additions & 0 deletions paseto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
"""This module checks if all dependencies are present."""
import pysodium

__all__ = ["pysodium"]
28 changes: 27 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pylint = "^3.0"
pynacl = "^1.5"
pytest = "^7.4"
pytest-benchmark = "^4.0"
ruff = "^0.1.8"

[tool.black]
exclude = '/(submodules)/'
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pysodium==0.7.17 ; python_version >= "3.8" and python_version < "4.0"
pytest-benchmark==4.0.0 ; python_version >= "3.8" and python_version < "4.0"
pytest==7.4.3 ; python_version >= "3.8" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.8" and python_version < "4.0"
ruff==0.1.8 ; python_version >= "3.8" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11"
tomlkit==0.12.3 ; python_version >= "3.8" and python_version < "4.0"
Expand Down
8 changes: 4 additions & 4 deletions tests/paserk/test_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def test_create_symmetric_key() -> None:
"""Test that creating symmetric key returns nonempty bytes."""
key: bytes = _create_symmetric_key(4)
assert type(key) == bytes
assert isinstance(key, bytes)
assert len(key) > 0


Expand All @@ -25,8 +25,8 @@ def test_create_asymmetric_key() -> None:
public_key: bytes
secret_key: bytes
public_key, secret_key = _create_asymmetric_key(4)
assert type(public_key) == bytes
assert type(secret_key) == bytes
assert isinstance(public_key, bytes)
assert isinstance(secret_key, bytes)
assert len(public_key) > 0
assert len(secret_key) > 0

Expand All @@ -35,7 +35,7 @@ def test_create_asymmetric_key() -> None:
def test_serialize_deserialize_key(key: bytes) -> None:
"""Test that serialized key can be deserialized."""
serialized = _serialize_key(version=4, key_type=b".unit_test.", raw_key=key)
assert type(serialized) == bytes
assert isinstance(serialized, bytes)
assert len(serialized) > 0
deserialized = _deserialize_key(serialized)
assert deserialized == key
Expand Down

0 comments on commit 93497ec

Please sign in to comment.