Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move flatten_list util function into feature_discovery #2702

Merged
merged 6 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ Future Release
==============
* Enhancements
* Fixes
* Move ``flatten_list`` util function into ``feature_discovery`` module to fix import bug (:pr:`2702`)
* Changes
* Temporarily restrict Dask version :pr:`2694`
* Temporarily restrict Dask version (:pr:`2694`)
* Documentation Changes
* Testing Changes
* Fix serialization test to work with pytest 8.1.1 :pr:`2694`
* Fix serialization test to work with pytest 8.1.1 (:pr:`2694`)

Thanks to the following people for contributing to this release:
:user:`thehomebrewnerd`
Expand Down
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]
thehomebrewnerd marked this conversation as resolved.
Show resolved Hide resolved
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
Loading