Skip to content

Commit

Permalink
Enable mutable-argument-defaults in ruff, fix two issues from it
Browse files Browse the repository at this point in the history
  • Loading branch information
davegaeddert committed Jun 4, 2024
1 parent 5989a32 commit 03945c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions bolt-code/bolt/code/ruff_defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ extend-select = [
# # "G", # flake8-logging-format
# # "T20", # print
"PT", # pytest
"B006", # mutable-argument-default
]
5 changes: 4 additions & 1 deletion bolt-worker/bolt/worker/scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def __eq__(self, other):
return self.values == other.values

@classmethod
def parse(cls, value, min_allowed, max_allowed, str_conversions={}):
def parse(cls, value, min_allowed, max_allowed, str_conversions=None):
if str_conversions is None:
str_conversions = {}

if isinstance(value, int):
if value < min_allowed or value > max_allowed:
raise ValueError(
Expand Down
5 changes: 4 additions & 1 deletion bolt-worker/bolt/worker/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ class Worker:
def __init__(
self,
queues,
jobs_schedule=[],
jobs_schedule=None,
max_processes=None,
max_jobs_per_process=None,
max_pending_per_process=10,
stats_every=None,
):
if jobs_schedule is None:
jobs_schedule = []

self.executor = ProcessPoolExecutor(
max_workers=max_processes,
max_tasks_per_child=max_jobs_per_process,
Expand Down

0 comments on commit 03945c2

Please sign in to comment.