Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid mutable default argument #1330

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -596,9 +596,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