Skip to content

Fix pylint: disable=dangerous-default-value in tests/pipelines/test_train_step.py #6914

@harupy

Description

@harupy

Just fix the following code:

def estimator_fn(estimator_params={}): # pylint: disable=dangerous-default-value
from sklearn.linear_model import SGDRegressor
return SGDRegressor(random_state=42, **estimator_params)

to:

def estimator_fn(estimator_params=None):
    from sklearn.linear_model import SGDRegressor 
 
    return SGDRegressor(random_state=42, **(estimator_params or {})) 

{} is mutable and should not use as a default value for a function argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions