Skip to content

Commit

Permalink
move util func
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Parsons committed Apr 9, 2024
1 parent 21d0bf0 commit 4591a99
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 1 addition & 2 deletions featuretools/feature_discovery/feature_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

from featuretools.feature_discovery.FeatureCollection import FeatureCollection
from featuretools.feature_discovery.LiteFeature import LiteFeature
from featuretools.feature_discovery.utils import column_schema_to_keys
from featuretools.feature_discovery.utils import column_schema_to_keys, flatten_list
from featuretools.primitives.base.primitive_base import PrimitiveBase
from featuretools.tests.testing_utils.generate_fake_dataframe import flatten_list


def _index_column_set(column_set: List[ColumnSchema]) -> List[Tuple[str, int]]:
Expand Down
4 changes: 4 additions & 0 deletions featuretools/feature_discovery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ def get_primitive_return_type(primitive: PrimitiveBase) -> ColumnSchema:
if isinstance(return_type, list):
return_type = return_type[0]
return return_type


def flatten_list(nested_list):
return [item for sublist in nested_list for item in sublist]
6 changes: 2 additions & 4 deletions featuretools/tests/testing_utils/generate_fake_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import woodwork.type_sys.type_system as ww_type_system
from woodwork import logical_types

from featuretools.feature_discovery.utils import flatten_list

logical_type_mapping = {
logical_types.Boolean.__name__: [True, False],
logical_types.BooleanNullable.__name__: [True, False, pd.NA],
Expand All @@ -32,10 +34,6 @@
}


def flatten_list(nested_list):
return [item for sublist in nested_list for item in sublist]


def generate_fake_dataframe(
col_defs=[("f_1", "Numeric"), ("f_2", "Datetime", "time_index")],
n_rows=10,
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ filterwarnings = [
[tool.ruff]
line-length = 88
target-version = "py311"
ignore = ["E501"]
select = [
lint.ignore = ["E501"]
lint.select = [
# Pyflakes
"F",
# Pycodestyle
Expand All @@ -170,10 +170,10 @@ select = [
]
src = ["featuretools"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "I001", "E501"]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["featuretools"]

[tool.coverage.run]
Expand Down

0 comments on commit 4591a99

Please sign in to comment.