Skip to content

Commit

Permalink
refactor: replace dict() with {} outside src
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman authored and Simon Brugman committed Jun 23, 2021
1 parent 8066bc3 commit f61fbdb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 27 deletions.
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -80,16 +80,16 @@ def setup_package() -> None:
],
# files to be shipped with the installation, under: popmon/popmon/
# after installation, these can be found with the functions in resources.py
package_data=dict(
popmon=[
package_data={
"popmon": [
"visualization/templates/*.html",
"visualization/templates/assets/css/*.css",
"visualization/templates/assets/js/*.js",
"test_data/*.csv.gz",
"test_data/*.json*",
"notebooks/popmon*tutorial*.ipynb",
]
),
},
entry_points={
"console_scripts": ["popmon_run = popmon.pipeline.amazing_pipeline:run"]
},
Expand Down
9 changes: 3 additions & 6 deletions tests/popmon/alerting/test_apply_tl_bounds.py
Expand Up @@ -71,8 +71,7 @@ def test_apply_monitoring_business_rules():


def test_apply_dynamic_traffic_light_bounds():
datastore = dict()
datastore["to_profile"] = {"asc_numbers": get_test_data()}
datastore = {"to_profile": {"asc_numbers": get_test_data()}}

conf = {"monitoring_rules": {"*_pull": [7, 4, -4, -7]}}

Expand Down Expand Up @@ -133,8 +132,7 @@ def test_apply_dynamic_traffic_light_bounds():


def test_apply_static_traffic_light_bounds():
datastore = dict()
datastore["to_profile"] = {"asc_numbers": get_test_data()}
datastore = {"to_profile": {"asc_numbers": get_test_data()}}

conf = {"monitoring_rules": {"*_pull": [7, 4, -4, -7]}}

Expand Down Expand Up @@ -226,8 +224,7 @@ def test_rolling_window_funcs():


def test_report_traffic_light_bounds():
datastore = dict()
datastore["to_profile"] = {"asc_numbers": get_test_data()}
datastore = {"to_profile": {"asc_numbers": get_test_data()}}

conf = {
"monitoring_rules": {
Expand Down
21 changes: 7 additions & 14 deletions tests/popmon/analysis/profiling/test_apply_func.py
Expand Up @@ -21,8 +21,7 @@ def get_test_data():


def test_pull():
datastore = dict()
datastore["to_profile"] = {"asc_numbers": get_test_data()}
datastore = {"to_profile": {"asc_numbers": get_test_data()}}

module1 = ApplyFunc(apply_to_key="to_profile")
module1.add_apply_func(np.std, suffix="_std", entire=True)
Expand All @@ -48,8 +47,7 @@ def test_pull():


def test_apply_func_module():
datastore = dict()
datastore["to_profile"] = {"asc_numbers": get_test_data()}
datastore = {"to_profile": {"asc_numbers": get_test_data()}}

def func(x):
return x + 1
Expand All @@ -73,8 +71,7 @@ def func(x):


def test_variance_comparer():
datastore = dict()
datastore["to_profile"] = test_comparer_df
datastore = {"to_profile": test_comparer_df}

module1 = ApplyFunc(
apply_to_key="to_profile", features=["the_feature", "dummy_feature"]
Expand All @@ -101,8 +98,7 @@ def test_variance_comparer():


def test_reference_pull_comparer():
datastore = dict()
datastore["to_profile"] = test_comparer_df
datastore = {"to_profile": test_comparer_df}

mod = ReferencePullCalculator(
reference_key="to_profile",
Expand All @@ -120,8 +116,7 @@ def test_reference_pull_comparer():


def test_median_mad_pull_comparer():
datastore = dict()
datastore["to_profile"] = test_comparer_df
datastore = {"to_profile": test_comparer_df}

mod = RefMedianMadPullCalculator(
reference_key="to_profile",
Expand All @@ -139,8 +134,7 @@ def test_median_mad_pull_comparer():


def test_rolling_pull_comparer():
datastore = dict()
datastore["to_profile"] = test_comparer_df
datastore = {"to_profile": test_comparer_df}

mod = RollingPullCalculator(
read_key="to_profile", features=["the_feature", "dummy_feature"], window=3
Expand All @@ -157,8 +151,7 @@ def test_rolling_pull_comparer():


def test_expanding_pull_comparer():
datastore = dict()
datastore["to_profile"] = test_comparer_df
datastore = {"to_profile": test_comparer_df}

mod = ExpandingPullCalculator(
read_key="to_profile", features=["the_feature", "dummy_feature"]
Expand Down
3 changes: 1 addition & 2 deletions tests/popmon/conftest.py
Expand Up @@ -9,8 +9,7 @@


def get_comparer_data():

test_comparer_df = dict()
test_comparer_df = {}
df = pd.DataFrame(
data={
"mae": [0.1, 0.11, 0.12, 0.2, 0.09],
Expand Down
4 changes: 2 additions & 2 deletions tests/popmon/io/test_file_writer.py
Expand Up @@ -10,7 +10,7 @@


def get_ready_ds():
return copy.deepcopy(dict(my_data=DATA))
return copy.deepcopy({"my_data": DATA})


def to_json(data, **kwargs):
Expand All @@ -36,7 +36,7 @@ def test_file_writer_json_with_kwargument():
def test_file_writer_not_a_func():
datastore = get_ready_ds()
with pytest.raises(TypeError):
FileWriter("my_data", apply_func=dict()).transform(datastore)
FileWriter("my_data", apply_func={}).transform(datastore)


def test_file_writer_df():
Expand Down

0 comments on commit f61fbdb

Please sign in to comment.