Skip to content

Commit 489a254

Browse files
committed
black formatting
1 parent 9cb0205 commit 489a254

File tree

8 files changed

+52
-48
lines changed

8 files changed

+52
-48
lines changed

ads/feature_store/dataset.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,9 +1101,7 @@ def get_statistics(self, job_id: str = None) -> "Statistics":
11011101
feature_statistics = (
11021102
output_details.get("featureStatistics") if output_details else None
11031103
)
1104-
stat_version = (
1105-
output_details.get("version") if output_details else None
1106-
)
1104+
stat_version = output_details.get("version") if output_details else None
11071105
version = stat_version if stat_version is not None else 1
11081106

11091107
return Statistics(feature_statistics, version)

ads/feature_store/execution_strategy/spark/spark_execution.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ def __init__(self, metastore_id: str = None):
7777
self._jvm = self._spark_context._jvm
7878

7979
def ingest_feature_definition(
80-
self,
81-
feature_group: "FeatureGroup",
82-
feature_group_job: FeatureGroupJob,
83-
dataframe,
80+
self,
81+
feature_group: "FeatureGroup",
82+
feature_group_job: FeatureGroupJob,
83+
dataframe,
8484
):
8585
try:
8686
self._save_offline_dataframe(dataframe, feature_group, feature_group_job)
@@ -94,7 +94,7 @@ def ingest_dataset(self, dataset, dataset_job: DatasetJob):
9494
raise SparkExecutionException(e).with_traceback(e.__traceback__)
9595

9696
def delete_feature_definition(
97-
self, feature_group: "FeatureGroup", feature_group_job: FeatureGroupJob
97+
self, feature_group: "FeatureGroup", feature_group_job: FeatureGroupJob
9898
):
9999
"""
100100
Deletes a feature definition from the system.
@@ -188,7 +188,7 @@ def _validate_expectation(expectation_type, validation_output: dict):
188188
raise Exception(error_message)
189189

190190
def _save_offline_dataframe(
191-
self, data_frame, feature_group, feature_group_job: FeatureGroupJob
191+
self, data_frame, feature_group, feature_group_job: FeatureGroupJob
192192
):
193193
"""Ingest dataframe to the feature store system. as now this handles both spark dataframe and pandas
194194
dataframe. in case of pandas after transformation we convert it to spark and write to the delta.
@@ -313,7 +313,7 @@ def _save_offline_dataframe(
313313
"validation_output": str(validation_output) if validation_output else None,
314314
"commit_id": "commit_id",
315315
"feature_statistics": feature_statistics,
316-
"version": version
316+
"version": version,
317317
}
318318

319319
self._update_job_and_parent_details(
@@ -452,7 +452,7 @@ def _save_dataset_input(self, dataset, dataset_job: DatasetJob):
452452
"validation_output": str(validation_output) if validation_output else None,
453453
"commit_id": "commit_id",
454454
"feature_statistics": feature_statistics,
455-
"version": version
455+
"version": version,
456456
}
457457

458458
self._update_job_and_parent_details(
@@ -464,7 +464,7 @@ def _save_dataset_input(self, dataset, dataset_job: DatasetJob):
464464

465465
@staticmethod
466466
def _update_job_and_parent_details(
467-
parent_entity, job_entity, output_features=None, output_details=None
467+
parent_entity, job_entity, output_features=None, output_details=None
468468
):
469469
"""
470470
Updates the parent and job entities with relevant details.

ads/feature_store/feature_group.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,9 +1348,7 @@ def get_statistics(self, job_id: str = None) -> "Statistics":
13481348
feature_statistics = (
13491349
output_details.get("featureStatistics") if output_details else None
13501350
)
1351-
stat_version = (
1352-
output_details.get("version") if output_details else None
1353-
)
1351+
stat_version = output_details.get("version") if output_details else None
13541352
version = stat_version if stat_version is not None else 1
13551353

13561354
return Statistics(feature_statistics, version)

ads/feature_store/statistics/charts/box_plot.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def __init__(self, q1: float, q2: float, q3: float):
4444
super().__init__()
4545

4646
@classmethod
47-
def __from_json__(cls, json_dict: dict, version: int = 1) -> "BoxPlot.Quartiles":
47+
def __from_json__(
48+
cls, json_dict: dict, version: int = 1
49+
) -> "BoxPlot.Quartiles":
4850
if version == 2:
4951
return cls.__from_json_v2__(json_dict)
5052
return cls(
@@ -56,11 +58,7 @@ def __from_json__(cls, json_dict: dict, version: int = 1) -> "BoxPlot.Quartiles"
5658
@classmethod
5759
def __from_json_v2__(cls, json_dict: dict) -> "BoxPlot.Quartiles":
5860
metric_data = json_dict.get(AbsFeatureValue.CONST_METRIC_DATA)
59-
return cls(
60-
metric_data[0],
61-
metric_data[1],
62-
metric_data[2]
63-
)
61+
return cls(metric_data[0], metric_data[1], metric_data[2])
6462

6563
def __validate__(self):
6664
assert type(self.q1) == type(self.q2) == type(self.q3) == int or float
@@ -139,9 +137,11 @@ def get_box_points_from_frequency_distribution(
139137
def __from_json__(cls, json_dict: dict, version: int = 1) -> "BoxPlot":
140138
quartiles = cls.Quartiles.from_json(json_dict.get(cls.CONST_QUARTILES), version)
141139
return cls(
142-
mean=GenericFeatureValue.from_json(json_dict.get(cls.CONST_MEAN),version).val,
140+
mean=GenericFeatureValue.from_json(
141+
json_dict.get(cls.CONST_MEAN), version
142+
).val,
143143
median=quartiles.q2,
144-
sd=GenericFeatureValue.from_json(json_dict.get(cls.CONST_SD),version).val,
144+
sd=GenericFeatureValue.from_json(json_dict.get(cls.CONST_SD), version).val,
145145
q1=quartiles.q1,
146146
q3=quartiles.q3,
147147
box_points=json_dict.get(cls.CONST_BOX_POINTS),

ads/feature_store/statistics/charts/frequency_distribution.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ def __validate__(self):
3434
assert len(self.bins) > 0
3535

3636
@classmethod
37-
def __from_json__(cls, json_dict: dict, version: int = 1) -> "FrequencyDistribution":
37+
def __from_json__(
38+
cls, json_dict: dict, version: int = 1
39+
) -> "FrequencyDistribution":
3840
if version == 2:
3941
return cls.__from_json_v2__(json_dict)
4042
return FrequencyDistribution(
@@ -45,17 +47,15 @@ def __from_json__(cls, json_dict: dict, version: int = 1) -> "FrequencyDistribut
4547
@classmethod
4648
def __from_json_v2__(cls, json_dict: dict) -> "FrequencyDistribution":
4749
metric_data = json_dict.get(AbsFeatureValue.CONST_METRIC_DATA)
48-
return FrequencyDistribution(
49-
bins=metric_data[0],
50-
frequency=metric_data[1]
51-
)
50+
return FrequencyDistribution(bins=metric_data[0], frequency=metric_data[1])
5251

5352
def add_to_figure(self, fig: Figure, xaxis: int, yaxis: int):
5453
xaxis_str, yaxis_str, x_str, y_str = self.get_x_y_str_axes(xaxis, yaxis)
5554
if (
56-
type(self.frequency) == list
57-
and type(self.bins) == list
58-
and 0 < len(self.frequency) and 0 < len(self.bins)
55+
type(self.frequency) == list
56+
and type(self.bins) == list
57+
and 0 < len(self.frequency)
58+
and 0 < len(self.bins)
5959
):
6060
fig.add_bar(
6161
x=self.bins, y=self.frequency, xaxis=x_str, yaxis=y_str, name=""

ads/feature_store/statistics/charts/probability_distribution.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def __validate__(self):
3333
# assert 0 < len(self.density) == len(self.bins) > 0
3434

3535
@classmethod
36-
def __from_json__(cls, json_dict: dict, version: int = 1) -> "ProbabilityDistribution":
36+
def __from_json__(
37+
cls, json_dict: dict, version: int = 1
38+
) -> "ProbabilityDistribution":
3739
if version == 2:
3840
return cls.__from_json_v2__(json_dict)
3941
return cls(
@@ -44,17 +46,15 @@ def __from_json__(cls, json_dict: dict, version: int = 1) -> "ProbabilityDistrib
4446
@classmethod
4547
def __from_json_v2__(cls, json_dict: dict) -> "ProbabilityDistribution":
4648
metric_data = json_dict.get(AbsFeatureValue.CONST_METRIC_DATA)
47-
return cls(
48-
bins=metric_data[0],
49-
density=metric_data[1]
50-
)
49+
return cls(bins=metric_data[0], density=metric_data[1])
5150

5251
def add_to_figure(self, fig: Figure, xaxis: int, yaxis: int):
5352
xaxis_str, yaxis_str, x_str, y_str = self.get_x_y_str_axes(xaxis, yaxis)
5453
if (
5554
type(self.density) == list
5655
and type(self.bins) == list
57-
and 0 < len(self.density) and 0 < len(self.bins)
56+
and 0 < len(self.density)
57+
and 0 < len(self.bins)
5858
):
5959
fig.add_bar(
6060
x=self.bins,

ads/feature_store/statistics/charts/top_k_frequent_elements.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TopKFrequentElement(AbsFeatureValue):
3030
CONST_UPPER_BOUND = "upper_bound"
3131

3232
def __init__(
33-
self, value: str, estimate: int, lower_bound: int, upper_bound: int
33+
self, value: str, estimate: int, lower_bound: int, upper_bound: int
3434
):
3535
self.value = value
3636
self.estimate = estimate
@@ -68,23 +68,26 @@ def __from_json__(cls, json_dict: dict, version: int = 1) -> "TopKFrequentElemen
6868
if version == 2:
6969
return cls.__from_json_v2__(json_dict)
7070
elements = json_dict.get(cls.CONST_VALUE)
71-
top_k_frequent_elements = [cls.TopKFrequentElement.__from_json__(element) for element in elements]
71+
top_k_frequent_elements = [
72+
cls.TopKFrequentElement.__from_json__(element) for element in elements
73+
]
7274
values = [element.value for element in top_k_frequent_elements]
7375
estimates = [element.estimate for element in top_k_frequent_elements]
7476
return cls(values, estimates)
7577

7678
@classmethod
7779
def __from_json_v2__(cls, json_dict: dict) -> "TopKFrequentElements":
7880
metric_data = json_dict.get(AbsFeatureValue.CONST_METRIC_DATA)
79-
return cls(
80-
values=metric_data[0],
81-
estimates=metric_data[1]
82-
)
81+
return cls(values=metric_data[0], estimates=metric_data[1])
8382

8483
def add_to_figure(self, fig: Figure, xaxis: int, yaxis: int):
8584
xaxis_str, yaxis_str, x_str, y_str = self.get_x_y_str_axes(xaxis, yaxis)
86-
if type(self.values) == list and len(self.values) > 0 and \
87-
type(self.estimates) == list and len(self.estimates) > 0:
85+
if (
86+
type(self.values) == list
87+
and len(self.values) > 0
88+
and type(self.estimates) == list
89+
and len(self.estimates) > 0
90+
):
8891
y_axis = [value for value in self.values]
8992
x_axis = [estimate for estimate in self.estimates]
9093
fig.add_bar(

ads/feature_store/statistics/feature_stat.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ def __init__(
5151
self.box_plot = box_plot
5252

5353
@classmethod
54-
def from_json(cls, feature_name: str, json_dict: dict, version: int) -> "FeatureStatistics":
54+
def from_json(
55+
cls, feature_name: str, json_dict: dict, version: int
56+
) -> "FeatureStatistics":
5557
if json_dict is not None:
5658
frequency_distribution = FrequencyDistribution.from_json(
57-
json_dict.get(cls.CONST_FREQUENCY_DISTRIBUTION), version, ignore_errors=True,
59+
json_dict.get(cls.CONST_FREQUENCY_DISTRIBUTION),
60+
version,
61+
ignore_errors=True,
5862
)
5963

6064
# inject box points for boxplot creation
@@ -70,7 +74,8 @@ def from_json(cls, feature_name: str, json_dict: dict, version: int) -> "Feature
7074
),
7175
frequency_distribution,
7276
ProbabilityDistribution.from_json(
73-
json_dict.get(cls.CONST_PROBABILITY_DISTRIBUTION), version,
77+
json_dict.get(cls.CONST_PROBABILITY_DISTRIBUTION),
78+
version,
7479
ignore_errors=True,
7580
),
7681
BoxPlot.from_json(json_dict, version, ignore_errors=True),

0 commit comments

Comments
 (0)