Skip to content

Commit 93497ec

Browse files
committed
lint code with ruff
1 parent 0ce8089 commit 93497ec

File tree

6 files changed

+36
-5
lines changed

6 files changed

+36
-5
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ code-analysis:
6868
mypy paseto tests --ignore-missing-imports
6969
# run static code analysis
7070
pylint paseto tests
71+
ruff check .
7172

7273
# build and test the entire project
7374
build: lock install lint coverage

paseto/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
"""This module checks if all dependencies are present."""
22
import pysodium
3+
4+
__all__ = ["pysodium"]

poetry.lock

Lines changed: 27 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pylint = "^3.0"
3636
pynacl = "^1.5"
3737
pytest = "^7.4"
3838
pytest-benchmark = "^4.0"
39+
ruff = "^0.1.8"
3940

4041
[tool.black]
4142
exclude = '/(submodules)/'

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pysodium==0.7.17 ; python_version >= "3.8" and python_version < "4.0"
3434
pytest-benchmark==4.0.0 ; python_version >= "3.8" and python_version < "4.0"
3535
pytest==7.4.3 ; python_version >= "3.8" and python_version < "4.0"
3636
requests==2.31.0 ; python_version >= "3.8" and python_version < "4.0"
37+
ruff==0.1.8 ; python_version >= "3.8" and python_version < "4.0"
3738
snowballstemmer==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
3839
tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11"
3940
tomlkit==0.12.3 ; python_version >= "3.8" and python_version < "4.0"

tests/paserk/test_keys.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def test_create_symmetric_key() -> None:
1717
"""Test that creating symmetric key returns nonempty bytes."""
1818
key: bytes = _create_symmetric_key(4)
19-
assert type(key) == bytes
19+
assert isinstance(key, bytes)
2020
assert len(key) > 0
2121

2222

@@ -25,8 +25,8 @@ def test_create_asymmetric_key() -> None:
2525
public_key: bytes
2626
secret_key: bytes
2727
public_key, secret_key = _create_asymmetric_key(4)
28-
assert type(public_key) == bytes
29-
assert type(secret_key) == bytes
28+
assert isinstance(public_key, bytes)
29+
assert isinstance(secret_key, bytes)
3030
assert len(public_key) > 0
3131
assert len(secret_key) > 0
3232

@@ -35,7 +35,7 @@ def test_create_asymmetric_key() -> None:
3535
def test_serialize_deserialize_key(key: bytes) -> None:
3636
"""Test that serialized key can be deserialized."""
3737
serialized = _serialize_key(version=4, key_type=b".unit_test.", raw_key=key)
38-
assert type(serialized) == bytes
38+
assert isinstance(serialized, bytes)
3939
assert len(serialized) > 0
4040
deserialized = _deserialize_key(serialized)
4141
assert deserialized == key

0 commit comments

Comments
 (0)