Skip to content

Commit

Permalink
Fix ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jellevos committed Nov 27, 2024
1 parent 38fb0d3 commit 09af955
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions oraqle/add_chains/memoization.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

# Adapted from: https://stackoverflow.com/questions/16463582/memoize-to-disk-python-persistent-memoization
def cache_to_disk(file_name, ignore_args: Set[str]):
"""This decorator caches the calls to this function in a file on disk, ignoring the arguments listed in `ignore_args`."""
"""This decorator caches the calls to this function in a file on disk, ignoring the arguments listed in `ignore_args`.
Returns:
A cached output
"""
d = shelve.open(file_name) # noqa: SIM115

def decorator(func):
Expand All @@ -36,7 +40,7 @@ def wrapped_func(*args, **kwargs):

return wrapped_func

return decorator # noqa: DOC201
return decorator


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions oraqle/add_chains/solving.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def extract_indices(
def solve_with_time_limit(wcnf: WCNF, solver: str, strict_cost_max: Optional[float], timeout_secs: float) -> Optional[List[int]]:
"""This code is adapted from pysat's internal code to stop when we have reached a maximum cost.
Raises: # noqa: DOC502
Raises:
TimeoutError: When a timeout occurs (after `timeout_secs` seconds)
Returns:
Expand Down Expand Up @@ -136,4 +136,4 @@ def timeout_handler(s, f):

return rc2.model
except TimeoutError as err:
raise TimeoutError from err # noqa: DOC501
raise TimeoutError from err
1 change: 1 addition & 0 deletions oraqle/examples/wahc2024_presentation/1_high-level.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Renders a high-level comparison circuit."""
from galois import GF

from oraqle.compiler.circuit import Circuit
Expand Down
1 change: 1 addition & 0 deletions oraqle/examples/wahc2024_presentation/2_arith_step1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Show the first step of arithmetization of a comparison circuit."""
from galois import GF

from oraqle.compiler.boolean.bool_neg import Neg
Expand Down
1 change: 1 addition & 0 deletions oraqle/examples/wahc2024_presentation/3_arith_step2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Show the last step of arithmetization of a comparison circuit."""
from galois import GF

from oraqle.compiler.circuit import Circuit
Expand Down
1 change: 1 addition & 0 deletions oraqle/examples/wahc2024_presentation/5_code_gen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Generates code for the comparison circuit."""
from galois import GF

from oraqle.compiler.circuit import Circuit
Expand Down
1 change: 1 addition & 0 deletions oraqle/examples/wahc2024_presentation/rebalancing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Renders two circuits, one with a balanced product tree and one with an imbalanced tree."""
from galois import GF

from oraqle.compiler.circuit import Circuit
Expand Down

0 comments on commit 09af955

Please sign in to comment.