Skip to content

Commit 8f9e567

Browse files
committed
Cleanup
1 parent 28098b3 commit 8f9e567

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

pkg/workloads/lib/context.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ def __init__(self, **kwargs):
7070
self.status_prefix = self.ctx["status_prefix"]
7171
self.app = self.ctx["app"]
7272
self.environment = self.ctx["environment"]
73-
self.python_packages = self.ctx["python_packages"]
74-
self.raw_columns = self.ctx["raw_columns"]
75-
self.transformed_columns = self.ctx["transformed_columns"]
76-
self.transformers = self.ctx["transformers"]
77-
self.aggregators = self.ctx["aggregators"]
78-
self.aggregates = self.ctx["aggregates"]
79-
self.constants = self.ctx["constants"]
80-
self.models = self.ctx["models"]
81-
self.estimators = self.ctx["estimators"]
82-
self.apis = self.ctx["apis"]
73+
self.python_packages = self.ctx["python_packages"] or {}
74+
self.raw_columns = self.ctx["raw_columns"] or {}
75+
self.transformed_columns = self.ctx["transformed_columns"] or {}
76+
self.transformers = self.ctx["transformers"] or {}
77+
self.aggregators = self.ctx["aggregators"] or {}
78+
self.aggregates = self.ctx["aggregates"] or {}
79+
self.constants = self.ctx["constants"] or {}
80+
self.models = self.ctx["models"] or {}
81+
self.estimators = self.ctx["estimators"] or {}
82+
self.apis = self.ctx["apis"] or {}
8383
self.training_datasets = {k: v["dataset"] for k, v in self.models.items()}
8484
self.api_version = self.cortex_config["api_version"]
8585

@@ -99,12 +99,11 @@ def __init__(self, **kwargs):
9999
)
100100
)
101101

102-
if self.environment is not None:
103-
self.columns = util.merge_dicts_overwrite(self.raw_columns, self.transformed_columns)
102+
self.columns = util.merge_dicts_overwrite(self.raw_columns, self.transformed_columns)
104103

105-
self.raw_column_names = list(self.raw_columns.keys())
106-
self.transformed_column_names = list(self.transformed_columns.keys())
107-
self.column_names = list(self.columns.keys())
104+
self.raw_column_names = list(self.raw_columns.keys())
105+
self.transformed_column_names = list(self.transformed_columns.keys())
106+
self.column_names = list(self.columns.keys())
108107

109108
# Internal caches
110109
self._transformer_impls = {}

pkg/workloads/lib/util.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,10 @@ def merge_dicts_no_overwrite(*dicts):
422422
def merge_two_dicts_in_place_overwrite(x, y):
423423
"""Merge y into x, with overwriting. x is updated in place"""
424424
if x is None:
425-
return y
425+
x = {}
426426

427427
if y is None:
428-
return x
429-
430-
if y is None and x is None:
431-
return None
428+
y = {}
432429

433430
for k, v in y.items():
434431
if k in x and isinstance(x[k], dict) and isinstance(y[k], collections.Mapping):

0 commit comments

Comments
 (0)