Skip to content

Commit

Permalink
add ruff; fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmncs committed Apr 9, 2024
1 parent 14e1832 commit bdd3da3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 43 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ test:
fmt:
cargo fmt
isort .
black .
ruff format .

.PHONY: lint
lint:
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings --no-deps
flake8 .
ruff .

.PHONY: clean
clean:
Expand Down
5 changes: 1 addition & 4 deletions requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
absl-py
black
flake8
flake8-black
flake8-isort
ruff
isort
maturin
pytest>=7.2
Expand Down
35 changes: 3 additions & 32 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,18 @@ absl-py==1.2.0
# via -r requirements-dev.in
attrs==22.1.0
# via pytest
black==22.6.0
# via
# -r requirements-dev.in
# flake8-black
click==8.1.3
# via black
execnet==1.9.0
# via pytest-xdist
flake8==5.0.4
# via
# -r requirements-dev.in
# flake8-black
# flake8-isort
flake8-black==0.3.3
# via -r requirements-dev.in
flake8-isort==4.2.0
# via -r requirements-dev.in
iniconfig==1.1.1
# via pytest
isort==5.10.1
# via
# -r requirements-dev.in
# flake8-isort
# via -r requirements-dev.in
maturin==0.13.1
# via -r requirements-dev.in
mccabe==0.7.0
# via flake8
mypy-extensions==0.4.3
# via black
packaging==21.3
# via pytest
pathspec==0.9.0
# via black
platformdirs==2.5.2
# via black
pluggy==1.0.0
# via pytest
pycodestyle==2.9.1
# via flake8
pyflakes==2.5.0
# via flake8
pyparsing==3.0.9
# via packaging
pytest==7.2.0
Expand All @@ -57,5 +28,5 @@ pytest==7.2.0
# pytest-xdist
pytest-xdist==3.1.0
# via -r requirements-dev.in
tomli==2.0.1
# via flake8-black
ruff==0.3.5
# via -r requirements-dev.in
11 changes: 7 additions & 4 deletions src/hpke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ impl PyHpke {
enc: &Bound<'p, PyBytes>,
sk_r: &Bound<'p, PyBytes>,
info: &Bound<'p, PyBytes>,
psk: Option<&Bound<'p, PyBytes>,>,
psk_id: Option<&Bound<'p, PyBytes>,>,
pk_s: Option<&Bound<'p, PyBytes>,>,
psk: Option<&Bound<'p, PyBytes>>,
psk_id: Option<&Bound<'p, PyBytes>>,
pk_s: Option<&Bound<'p, PyBytes>>,
) -> PyResult<PyContext> {
let cfg = &self.hpke;

Expand Down Expand Up @@ -333,7 +333,10 @@ impl PyHpke {
}

/// Generate a key-pair according to the KemAlgorithm in this Hpke config
fn generate_key_pair<'p>(&mut self, py: Python<'p>) -> PyResult<(Bound<'p, PyBytes>, Bound<'p, PyBytes>)> {
fn generate_key_pair<'p>(
&mut self,
py: Python<'p>,
) -> PyResult<(Bound<'p, PyBytes>, Bound<'p, PyBytes>)> {
let cfg = &mut self.hpke;
let keypair = cfg.generate_key_pair().map_err(handle_hpke_error)?;
let (sk, pk) = keypair.into_keys();
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ fn build_errors_module(py: Python) -> PyResult<Bound<PyModule>> {
errors_module.add("UnnecessaryPsk", py.get_type_bound::<UnnecessaryPsk>())?;
errors_module.add("InsecurePsk", py.get_type_bound::<InsecurePsk>())?;
errors_module.add("CryptoError", py.get_type_bound::<CryptoError>())?;
errors_module.add("MessageLimitReached", py.get_type_bound::<MessageLimitReached>())?;
errors_module.add(
"MessageLimitReached",
py.get_type_bound::<MessageLimitReached>(),
)?;
errors_module.add(
"InsufficientRandomness",
py.get_type_bound::<InsufficientRandomness>(),
Expand Down

0 comments on commit bdd3da3

Please sign in to comment.