Skip to content

Commit 03945c2

Browse files
committed
Enable mutable-argument-defaults in ruff, fix two issues from it
1 parent 5989a32 commit 03945c2

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

bolt-code/bolt/code/ruff_defaults.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ extend-select = [
1717
# # "G", # flake8-logging-format
1818
# # "T20", # print
1919
"PT", # pytest
20+
"B006", # mutable-argument-default
2021
]

bolt-worker/bolt/worker/scheduling.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def __eq__(self, other):
4444
return self.values == other.values
4545

4646
@classmethod
47-
def parse(cls, value, min_allowed, max_allowed, str_conversions={}):
47+
def parse(cls, value, min_allowed, max_allowed, str_conversions=None):
48+
if str_conversions is None:
49+
str_conversions = {}
50+
4851
if isinstance(value, int):
4952
if value < min_allowed or value > max_allowed:
5053
raise ValueError(

bolt-worker/bolt/worker/workers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ class Worker:
2121
def __init__(
2222
self,
2323
queues,
24-
jobs_schedule=[],
24+
jobs_schedule=None,
2525
max_processes=None,
2626
max_jobs_per_process=None,
2727
max_pending_per_process=10,
2828
stats_every=None,
2929
):
30+
if jobs_schedule is None:
31+
jobs_schedule = []
32+
3033
self.executor = ProcessPoolExecutor(
3134
max_workers=max_processes,
3235
max_tasks_per_child=max_jobs_per_process,

0 commit comments

Comments
 (0)