Skip to content

Commit

Permalink
fix: avoid mutable default argument (#1330)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazanzhy committed Feb 5, 2022
1 parent 1fc6f7b commit 978cc93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions snakemake/linting/__init__.py
Expand Up @@ -61,10 +61,10 @@ def lints(self):


class Lint:
def __init__(self, title, body, links=[]):
def __init__(self, title, body, links=None):
self.title = title
self.body = body
self.links = links
self.links = links or []

def __str__(self):
width, _ = shutil.get_terminal_size()
Expand Down
5 changes: 4 additions & 1 deletion snakemake/logging.py
Expand Up @@ -597,9 +597,12 @@ def job_error():
self.last_msg_was_job_info = False


def format_dict(dict_like, omit_keys=[], omit_values=[]):
def format_dict(dict_like, omit_keys=None, omit_values=None):
from snakemake.io import Namedlist

omit_keys = omit_keys or []
omit_values = omit_values or []

if isinstance(dict_like, Namedlist):
items = dict_like.items()
elif isinstance(dict_like, dict):
Expand Down

0 comments on commit 978cc93

Please sign in to comment.