From 1a8a301cd6b18d942b0467cffe9afc1ea4445d53 Mon Sep 17 00:00:00 2001 From: Seth Michael Larson Date: Thu, 27 Aug 2020 15:19:56 -0500 Subject: [PATCH] Apply Black 20.8b1 formatting --- eland/field_mappings.py | 16 ++++++++-------- eland/ml/imported_ml_model.py | 3 ++- eland/ml/transformers/lightgbm.py | 3 ++- eland/query.py | 7 ++++++- eland/tests/__init__.py | 3 ++- eland/tests/dataframe/test_datetime_pytest.py | 4 ++-- .../tests/field_mappings/test_datetime_pytest.py | 4 ++-- 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/eland/field_mappings.py b/eland/field_mappings.py index 67b9855..dd7757b 100644 --- a/eland/field_mappings.py +++ b/eland/field_mappings.py @@ -464,14 +464,14 @@ class FieldMappings: -------------------------------------------- ``` - Pandas dtype Python type NumPy type Usage - object str string_, unicode_ Text - int64 int int_, int8, int16, int32, int64, uint8, uint16, uint32, uint64 Integer numbers - float64 float float_, float16, float32, float64 Floating point numbers - bool bool bool_ True/False values - datetime64 NA datetime64[ns] Date and time values - timedelta[ns] NA NA Differences between two datetimes - category NA NA Finite list of text values + Pandas dtype Python type NumPy type Usage + object str string_, unicode_ Text + int64 int int_, int8, int16, int32, int64, uint8, uint16, uint32, uint64 Integer numbers + float64 float float_, float16, float32, float64 Floating point numbers + bool bool bool_ True/False values + datetime64 NA datetime64[ns] Date and time values + timedelta[ns] NA NA Differences between two datetimes + category NA NA Finite list of text values ``` """ es_dtype = None diff --git a/eland/ml/imported_ml_model.py b/eland/ml/imported_ml_model.py index 215112a..98f39b7 100644 --- a/eland/ml/imported_ml_model.py +++ b/eland/ml/imported_ml_model.py @@ -218,7 +218,8 @@ class ImportedMLModel(MLModel): body["definition"] = serializer.serialize_model() self._client.ml.put_trained_model( - model_id=self._model_id, body=body, + model_id=self._model_id, + body=body, ) def predict(self, X: Union[List[float], List[List[float]]]) -> np.ndarray: diff --git a/eland/ml/transformers/lightgbm.py b/eland/ml/transformers/lightgbm.py index b3cead2..1328b45 100644 --- a/eland/ml/transformers/lightgbm.py +++ b/eland/ml/transformers/lightgbm.py @@ -93,7 +93,8 @@ class LGBMForestTransformer(ModelTransformer): self, tree_id: int, node_id: int, tree_node_json_obj: Dict[str, Any] ) -> TreeNode: return TreeNode( - node_idx=node_id, leaf_value=[float(tree_node_json_obj["leaf_value"])], + node_idx=node_id, + leaf_value=[float(tree_node_json_obj["leaf_value"])], ) def build_tree(self, tree_id: int, tree_json_obj: Dict[str, Any]) -> Tree: diff --git a/eland/query.py b/eland/query.py index 468d983..30f16b4 100644 --- a/eland/query.py +++ b/eland/query.py @@ -137,7 +137,12 @@ class Query: self._aggs[name] = agg def hist_aggs( - self, name: str, field: str, min_value: Any, max_value: Any, num_bins: int, + self, + name: str, + field: str, + min_value: Any, + max_value: Any, + num_bins: int, ) -> None: """ Add histogram agg e.g. diff --git a/eland/tests/__init__.py b/eland/tests/__init__.py index 44c94c8..eb0b155 100644 --- a/eland/tests/__init__.py +++ b/eland/tests/__init__.py @@ -30,7 +30,8 @@ ELASTICSEARCH_HOST = os.environ.get("ELASTICSEARCH_HOST") or "localhost" TEST_SUITE = os.environ.get("TEST_SUITE", "xpack") if TEST_SUITE == "xpack": ES_TEST_CLIENT = Elasticsearch( - ELASTICSEARCH_HOST, http_auth=("elastic", "changeme"), + ELASTICSEARCH_HOST, + http_auth=("elastic", "changeme"), ) else: ES_TEST_CLIENT = Elasticsearch(ELASTICSEARCH_HOST) diff --git a/eland/tests/dataframe/test_datetime_pytest.py b/eland/tests/dataframe/test_datetime_pytest.py index 7007e2b..b523e56 100644 --- a/eland/tests/dataframe/test_datetime_pytest.py +++ b/eland/tests/dataframe/test_datetime_pytest.py @@ -36,7 +36,7 @@ class TestDataFrameDateTime(TestData): @classmethod def setup_class(cls): - """ setup any state specific to the execution of the given class (which + """setup any state specific to the execution of the given class (which usually contains tests). """ es = ES_TEST_CLIENT @@ -65,7 +65,7 @@ class TestDataFrameDateTime(TestData): @classmethod def teardown_class(cls): - """ teardown any state that was previously setup with a call to + """teardown any state that was previously setup with a call to setup_class. """ diff --git a/eland/tests/field_mappings/test_datetime_pytest.py b/eland/tests/field_mappings/test_datetime_pytest.py index 5840bed..4ce575a 100644 --- a/eland/tests/field_mappings/test_datetime_pytest.py +++ b/eland/tests/field_mappings/test_datetime_pytest.py @@ -29,7 +29,7 @@ class TestDateTime(TestData): @classmethod def setup_class(cls): - """ setup any state specific to the execution of the given class (which + """setup any state specific to the execution of the given class (which usually contains tests). """ es = ES_TEST_CLIENT @@ -58,7 +58,7 @@ class TestDateTime(TestData): @classmethod def teardown_class(cls): - """ teardown any state that was previously setup with a call to + """teardown any state that was previously setup with a call to setup_class. """