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

Cleans up dangerous function default variables ([] and {}) #2275

Merged
merged 1 commit into from
Nov 4, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion luigi/contrib/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def table_exists(self, table):

return True

def make_dataset(self, dataset, raise_if_exists=False, body={}):
def make_dataset(self, dataset, raise_if_exists=False, body=dict()):
"""Creates a new dataset with the default permissions.

:param dataset:
Expand Down
4 changes: 2 additions & 2 deletions luigi/contrib/dataproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def submit_job(self, job_config):
self._job_id = self._job['reference']['jobId']
return self._job

def submit_spark_job(self, jars, main_class, job_args=[]):
def submit_spark_job(self, jars, main_class, job_args=list()):
job_config = {"job": {
"placement": {
"clusterName": self.dataproc_cluster_name
Expand All @@ -72,7 +72,7 @@ def submit_spark_job(self, jars, main_class, job_args=[]):
logger.info("Submitted new dataproc job:{} id:{}".format(self._job_name, self._job_id))
return self._job

def submit_pyspark_job(self, job_file, extra_files=[], job_args=[]):
def submit_pyspark_job(self, job_file, extra_files=list(), job_args=list()):
job_config = {"job": {
"placement": {
"clusterName": self.dataproc_cluster_name
Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/esindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ElasticsearchTarget(luigi.Target):

def __init__(self, host, port, index, doc_type, update_id,
marker_index_hist_size=0, http_auth=None, timeout=10,
extra_elasticsearch_args={}):
extra_elasticsearch_args=dict()):
"""
:param host: Elasticsearch server host
:type host: str
Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class InvalidQuery(OpenerError):

class OpenerRegistry(object):

def __init__(self, openers=[]):
def __init__(self, openers=list()):
"""An opener registry that stores a number of opener objects used
to parse Target URIs

Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/sqla.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class SQLAlchemyTarget(luigi.Target):
_engine_dict = {} # dict of sqlalchemy engine instances
Connection = collections.namedtuple("Connection", "engine pid")

def __init__(self, connection_string, target_table, update_id, echo=False, connect_args={}):
def __init__(self, connection_string, target_table, update_id, echo=False, connect_args=dict()):
"""
Constructor for the SQLAlchemyTarget.

Expand Down
2 changes: 1 addition & 1 deletion luigi/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def add_task(self, task_id=None, status=PENDING, runnable=True,
deps=None, new_deps=None, expl=None, resources=None,
priority=0, family='', module=None, params=None,
assistant=False, tracking_url=None, worker=None, batchable=None,
batch_id=None, retry_policy_dict={}, owners=None, **kwargs):
batch_id=None, retry_policy_dict=dict(), owners=None, **kwargs):
"""
* add task identified by task_id if it doesn't exist
* if deps is not None, update dependency list
Expand Down