mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
Add isort, rename Nox session to 'format'
This commit is contained in:
parent
18fb4af731
commit
05a24cbe0b
@ -160,7 +160,7 @@ currently using a minimum version of PyCharm 2019.2.4.
|
|||||||
- Run `pytest --nbval` to validate install
|
- Run `pytest --nbval` to validate install
|
||||||
- To test specific versions of Python use `nox -s test-3.8`
|
- To test specific versions of Python use `nox -s test-3.8`
|
||||||
- To run the automatic formatter and check for lint issues
|
- To run the automatic formatter and check for lint issues
|
||||||
run `nox -s blacken`
|
run `nox -s format`
|
||||||
|
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
|
|
||||||
# -- Path setup --------------------------------------------------------------
|
# -- Path setup --------------------------------------------------------------
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
#
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath("../sphinxext"))
|
sys.path.insert(0, os.path.abspath("../sphinxext"))
|
||||||
sys.path.extend(
|
sys.path.extend(
|
||||||
|
@ -15,22 +15,22 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from eland._version import ( # noqa: F401
|
from ._version import ( # noqa: F401
|
||||||
__title__,
|
|
||||||
__description__,
|
|
||||||
__url__,
|
|
||||||
__version__,
|
|
||||||
__author__,
|
__author__,
|
||||||
__author_email__,
|
__author_email__,
|
||||||
|
__description__,
|
||||||
__maintainer__,
|
__maintainer__,
|
||||||
__maintainer_email__,
|
__maintainer_email__,
|
||||||
|
__title__,
|
||||||
|
__url__,
|
||||||
|
__version__,
|
||||||
)
|
)
|
||||||
from eland.common import SortOrder
|
from .common import SortOrder
|
||||||
from eland.index import Index
|
from .dataframe import DataFrame
|
||||||
from eland.ndframe import NDFrame
|
from .etl import csv_to_eland, eland_to_pandas, pandas_to_eland, read_csv, read_es
|
||||||
from eland.series import Series
|
from .index import Index
|
||||||
from eland.dataframe import DataFrame
|
from .ndframe import NDFrame
|
||||||
from eland.etl import pandas_to_eland, eland_to_pandas, read_es, read_csv, csv_to_eland
|
from .series import Series
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"DataFrame",
|
"DataFrame",
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import List, Optional, TYPE_CHECKING, Union
|
from typing import TYPE_CHECKING, List, Optional, Union
|
||||||
from eland import SortOrder
|
|
||||||
|
|
||||||
|
from eland import SortOrder
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import pandas as pd # type: ignore
|
import pandas as pd # type: ignore
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from typing import Union, List, TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any, List, Union
|
||||||
|
|
||||||
import numpy as np # type: ignore
|
import numpy as np # type: ignore
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import re
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Union, List, Tuple, cast, Callable, Any, Optional, Dict
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
|
||||||
|
|
||||||
import numpy as np # type: ignore
|
import numpy as np # type: ignore
|
||||||
import pandas as pd # type: ignore
|
import pandas as pd # type: ignore
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import re
|
from typing import List, Optional, Sequence, Tuple, Union
|
||||||
from typing import List, Optional, Sequence, Union, Tuple
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -34,12 +34,12 @@ from pandas.io.formats.printing import pprint_thing
|
|||||||
from pandas.util._validators import validate_bool_kwarg
|
from pandas.util._validators import validate_bool_kwarg
|
||||||
|
|
||||||
import eland.plotting as gfx
|
import eland.plotting as gfx
|
||||||
from eland.ndframe import NDFrame
|
|
||||||
from eland.series import Series
|
|
||||||
from eland.common import DEFAULT_NUM_ROWS_DISPLAYED, docstring_parameter
|
from eland.common import DEFAULT_NUM_ROWS_DISPLAYED, docstring_parameter
|
||||||
from eland.filter import BooleanFilter
|
from eland.filter import BooleanFilter
|
||||||
from eland.utils import deprecated_api, is_valid_attr_name
|
|
||||||
from eland.groupby import GroupByDataFrame
|
from eland.groupby import GroupByDataFrame
|
||||||
|
from eland.ndframe import NDFrame
|
||||||
|
from eland.series import Series
|
||||||
|
from eland.utils import deprecated_api, is_valid_attr_name
|
||||||
|
|
||||||
|
|
||||||
class DataFrame(NDFrame):
|
class DataFrame(NDFrame):
|
||||||
|
@ -16,17 +16,18 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
from typing import Generator, Union, List, Tuple, Optional, Mapping, Dict, Any
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
from typing import Any, Dict, Generator, List, Mapping, Optional, Tuple, Union
|
||||||
|
|
||||||
import pandas as pd # type: ignore
|
import pandas as pd # type: ignore
|
||||||
|
from elasticsearch import Elasticsearch # type: ignore
|
||||||
|
from elasticsearch.helpers import parallel_bulk # type: ignore
|
||||||
from pandas.io.parsers import _c_parser_defaults # type: ignore
|
from pandas.io.parsers import _c_parser_defaults # type: ignore
|
||||||
|
|
||||||
from eland import DataFrame
|
from eland import DataFrame
|
||||||
|
from eland.common import DEFAULT_CHUNK_SIZE, ensure_es_client
|
||||||
from eland.field_mappings import FieldMappings, verify_mapping_compatibility
|
from eland.field_mappings import FieldMappings, verify_mapping_compatibility
|
||||||
from eland.common import ensure_es_client, DEFAULT_CHUNK_SIZE
|
|
||||||
from eland.utils import deprecated_api
|
from eland.utils import deprecated_api
|
||||||
from elasticsearch import Elasticsearch # type: ignore
|
|
||||||
from elasticsearch.helpers import parallel_bulk # type: ignore
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated_api("eland.DataFrame()")
|
@deprecated_api("eland.DataFrame()")
|
||||||
|
@ -16,31 +16,32 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
from typing import (
|
||||||
|
TYPE_CHECKING,
|
||||||
|
Any,
|
||||||
|
Dict,
|
||||||
|
List,
|
||||||
|
Mapping,
|
||||||
|
NamedTuple,
|
||||||
|
Optional,
|
||||||
|
Set,
|
||||||
|
Tuple,
|
||||||
|
)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pandas.core.dtypes.common import (
|
from pandas.core.dtypes.common import (
|
||||||
is_float_dtype,
|
|
||||||
is_bool_dtype,
|
is_bool_dtype,
|
||||||
is_integer_dtype,
|
|
||||||
is_datetime_or_timedelta_dtype,
|
is_datetime_or_timedelta_dtype,
|
||||||
|
is_float_dtype,
|
||||||
|
is_integer_dtype,
|
||||||
is_string_dtype,
|
is_string_dtype,
|
||||||
)
|
)
|
||||||
from pandas.core.dtypes.inference import is_list_like
|
from pandas.core.dtypes.inference import is_list_like
|
||||||
from typing import (
|
|
||||||
NamedTuple,
|
|
||||||
Optional,
|
|
||||||
Mapping,
|
|
||||||
Dict,
|
|
||||||
Any,
|
|
||||||
Tuple,
|
|
||||||
TYPE_CHECKING,
|
|
||||||
List,
|
|
||||||
Set,
|
|
||||||
)
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from elasticsearch import Elasticsearch
|
from elasticsearch import Elasticsearch
|
||||||
|
|
||||||
from eland import DataFrame
|
from eland import DataFrame
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
# Originally based on code in MIT-licensed pandasticsearch filters
|
# Originally based on code in MIT-licensed pandasticsearch filters
|
||||||
|
|
||||||
from typing import Dict, Any, List, Optional, Union, cast
|
from typing import Any, Dict, List, Optional, Union, cast
|
||||||
|
|
||||||
|
|
||||||
class BooleanFilter:
|
class BooleanFilter:
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from typing import List, TYPE_CHECKING
|
from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from eland.query_compiler import QueryCompiler
|
from eland.query_compiler import QueryCompiler
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from typing import Optional, TextIO, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Optional, TextIO
|
||||||
|
|
||||||
from eland.utils import deprecated_api
|
from eland.utils import deprecated_api
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from eland.ml.ml_model import MLModel, ImportedMLModel
|
from eland.ml.ml_model import ImportedMLModel, MLModel
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"MLModel",
|
"MLModel",
|
||||||
|
@ -19,7 +19,7 @@ import base64
|
|||||||
import gzip
|
import gzip
|
||||||
import json
|
import json
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from typing import Sequence, Dict, Any, Optional, List
|
from typing import Any, Dict, List, Optional, Sequence
|
||||||
|
|
||||||
|
|
||||||
def add_if_exists(d: Dict[str, Any], k: str, v: Any) -> None:
|
def add_if_exists(d: Dict[str, Any], k: str, v: Any) -> None:
|
||||||
|
@ -15,31 +15,40 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from typing import List, Union, cast, Optional, Dict, TYPE_CHECKING, Any, Tuple
|
|
||||||
import warnings
|
import warnings
|
||||||
import numpy as np # type: ignore
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast
|
||||||
|
|
||||||
import elasticsearch # type: ignore
|
import elasticsearch # type: ignore
|
||||||
from .common import TYPE_REGRESSION, TYPE_CLASSIFICATION
|
import numpy as np # type: ignore
|
||||||
from .transformers import get_model_transformer
|
|
||||||
from eland.common import ensure_es_client, es_version
|
from eland.common import ensure_es_client, es_version
|
||||||
from eland.utils import deprecated_api
|
from eland.utils import deprecated_api
|
||||||
|
|
||||||
|
from .common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
||||||
|
from .transformers import get_model_transformer
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from elasticsearch import Elasticsearch # noqa: F401
|
from elasticsearch import Elasticsearch # noqa: F401
|
||||||
|
|
||||||
# Try importing each ML lib separately so mypy users don't have to
|
# Try importing each ML lib separately so mypy users don't have to
|
||||||
# have both installed to use type-checking.
|
# have both installed to use type-checking.
|
||||||
try:
|
try:
|
||||||
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor # type: ignore # noqa: F401
|
from sklearn.ensemble import ( # type: ignore # noqa: F401
|
||||||
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor # type: ignore # noqa: F401
|
RandomForestClassifier,
|
||||||
|
RandomForestRegressor,
|
||||||
|
)
|
||||||
|
from sklearn.tree import ( # type: ignore # noqa: F401
|
||||||
|
DecisionTreeClassifier,
|
||||||
|
DecisionTreeRegressor,
|
||||||
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
from xgboost import XGBRegressor, XGBClassifier # type: ignore # noqa: F401
|
from xgboost import XGBClassifier, XGBRegressor # type: ignore # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
from lightgbm import LGBMRegressor, LGBMClassifier # type: ignore # noqa: F401
|
from lightgbm import LGBMClassifier, LGBMRegressor # type: ignore # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
from typing import Any, Dict, Type
|
from typing import Any, Dict, Type
|
||||||
from .base import ModelTransformer
|
|
||||||
|
|
||||||
|
from .base import ModelTransformer
|
||||||
|
|
||||||
__all__ = ["get_model_transformer"]
|
__all__ = ["get_model_transformer"]
|
||||||
_MODEL_TRANSFORMERS: Dict[type, Type[ModelTransformer]] = {}
|
_MODEL_TRANSFORMERS: Dict[type, Type[ModelTransformer]] = {}
|
||||||
@ -42,13 +42,13 @@ def get_model_transformer(model: Any, **kwargs: Any) -> ModelTransformer:
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from .sklearn import _MODEL_TRANSFORMERS as _SKLEARN_MODEL_TRANSFORMERS
|
||||||
from .sklearn import (
|
from .sklearn import (
|
||||||
SKLearnDecisionTreeTransformer,
|
SKLearnDecisionTreeTransformer,
|
||||||
SKLearnForestClassifierTransformer,
|
SKLearnForestClassifierTransformer,
|
||||||
SKLearnForestRegressorTransformer,
|
SKLearnForestRegressorTransformer,
|
||||||
SKLearnForestTransformer,
|
SKLearnForestTransformer,
|
||||||
SKLearnTransformer,
|
SKLearnTransformer,
|
||||||
_MODEL_TRANSFORMERS as _SKLEARN_MODEL_TRANSFORMERS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ += [
|
__all__ += [
|
||||||
@ -63,13 +63,13 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from .xgboost import _MODEL_TRANSFORMERS as _XGBOOST_MODEL_TRANSFORMERS
|
||||||
from .xgboost import (
|
from .xgboost import (
|
||||||
XGBoostClassifierTransformer,
|
|
||||||
XGBClassifier,
|
XGBClassifier,
|
||||||
|
XGBoostClassifierTransformer,
|
||||||
XGBoostForestTransformer,
|
XGBoostForestTransformer,
|
||||||
XGBoostRegressorTransformer,
|
XGBoostRegressorTransformer,
|
||||||
XGBRegressor,
|
XGBRegressor,
|
||||||
_MODEL_TRANSFORMERS as _XGBOOST_MODEL_TRANSFORMERS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ += [
|
__all__ += [
|
||||||
@ -84,13 +84,13 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from .lightgbm import _MODEL_TRANSFORMERS as _LIGHTGBM_MODEL_TRANSFORMERS
|
||||||
from .lightgbm import (
|
from .lightgbm import (
|
||||||
LGBMRegressor,
|
|
||||||
LGBMClassifier,
|
LGBMClassifier,
|
||||||
LGBMForestTransformer,
|
|
||||||
LGBMRegressorTransformer,
|
|
||||||
LGBMClassifierTransformer,
|
LGBMClassifierTransformer,
|
||||||
_MODEL_TRANSFORMERS as _LIGHTGBM_MODEL_TRANSFORMERS,
|
LGBMForestTransformer,
|
||||||
|
LGBMRegressor,
|
||||||
|
LGBMRegressorTransformer,
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ += [
|
__all__ += [
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from typing import Sequence, Optional, Any
|
from typing import Any, Optional, Sequence
|
||||||
|
|
||||||
from .._model_serializer import ModelSerializer
|
from .._model_serializer import ModelSerializer
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,15 +15,16 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from typing import Optional, List, Dict, Any, Type
|
from typing import Any, Dict, List, Optional, Type
|
||||||
from .base import ModelTransformer
|
|
||||||
from .._model_serializer import Ensemble, Tree, TreeNode
|
from .._model_serializer import Ensemble, Tree, TreeNode
|
||||||
from ..common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
|
||||||
from .._optional import import_optional_dependency
|
from .._optional import import_optional_dependency
|
||||||
|
from ..common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
||||||
|
from .base import ModelTransformer
|
||||||
|
|
||||||
import_optional_dependency("lightgbm", on_version="warn")
|
import_optional_dependency("lightgbm", on_version="warn")
|
||||||
|
|
||||||
from lightgbm import Booster, LGBMRegressor, LGBMClassifier # type: ignore
|
from lightgbm import Booster, LGBMClassifier, LGBMRegressor # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def transform_decider(decider: str) -> str:
|
def transform_decider(decider: str) -> str:
|
||||||
|
@ -15,16 +15,21 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from typing import Any, Dict, Optional, Sequence, Tuple, Type, Union
|
||||||
|
|
||||||
import numpy as np # type: ignore
|
import numpy as np # type: ignore
|
||||||
from typing import Optional, Sequence, Union, Dict, Any, Type, Tuple
|
|
||||||
from .base import ModelTransformer
|
|
||||||
from ..common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
|
||||||
from .._optional import import_optional_dependency
|
|
||||||
from .._model_serializer import Ensemble, Tree, TreeNode
|
from .._model_serializer import Ensemble, Tree, TreeNode
|
||||||
|
from .._optional import import_optional_dependency
|
||||||
|
from ..common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
||||||
|
from .base import ModelTransformer
|
||||||
|
|
||||||
import_optional_dependency("sklearn", on_version="warn")
|
import_optional_dependency("sklearn", on_version="warn")
|
||||||
|
|
||||||
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor # type: ignore
|
from sklearn.ensemble import ( # type: ignore
|
||||||
|
RandomForestClassifier,
|
||||||
|
RandomForestRegressor,
|
||||||
|
)
|
||||||
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor # type: ignore
|
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor # type: ignore
|
||||||
from sklearn.utils.validation import check_is_fitted # type: ignore
|
from sklearn.utils.validation import check_is_fitted # type: ignore
|
||||||
|
|
||||||
|
@ -16,16 +16,18 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from typing import Optional, List, Dict, Any, Type
|
from typing import Any, Dict, List, Optional, Type
|
||||||
from .base import ModelTransformer
|
|
||||||
import pandas as pd # type: ignore
|
import pandas as pd # type: ignore
|
||||||
|
|
||||||
from .._model_serializer import Ensemble, Tree, TreeNode
|
from .._model_serializer import Ensemble, Tree, TreeNode
|
||||||
from ..common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
|
||||||
from .._optional import import_optional_dependency
|
from .._optional import import_optional_dependency
|
||||||
|
from ..common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
||||||
|
from .base import ModelTransformer
|
||||||
|
|
||||||
import_optional_dependency("xgboost", on_version="warn")
|
import_optional_dependency("xgboost", on_version="warn")
|
||||||
|
|
||||||
from xgboost import Booster, XGBRegressor, XGBClassifier # type: ignore
|
from xgboost import Booster, XGBClassifier, XGBRegressor # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class XGBoostForestTransformer(ModelTransformer):
|
class XGBoostForestTransformer(ModelTransformer):
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import TYPE_CHECKING, Tuple, Optional
|
from typing import TYPE_CHECKING, Optional, Tuple
|
||||||
import pandas as pd
|
|
||||||
from eland.query_compiler import QueryCompiler
|
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
from eland.query_compiler import QueryCompiler
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from eland.index import Index
|
from eland.index import Index
|
||||||
|
@ -17,49 +17,49 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import warnings
|
import warnings
|
||||||
|
from collections import defaultdict
|
||||||
from typing import (
|
from typing import (
|
||||||
|
TYPE_CHECKING,
|
||||||
|
Any,
|
||||||
|
Dict,
|
||||||
Generator,
|
Generator,
|
||||||
|
List,
|
||||||
Optional,
|
Optional,
|
||||||
Sequence,
|
Sequence,
|
||||||
Tuple,
|
Tuple,
|
||||||
List,
|
|
||||||
Dict,
|
|
||||||
Any,
|
|
||||||
TYPE_CHECKING,
|
|
||||||
Union,
|
Union,
|
||||||
)
|
)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from collections import defaultdict
|
|
||||||
from elasticsearch.helpers import scan
|
from elasticsearch.helpers import scan
|
||||||
|
|
||||||
from eland.index import Index
|
from eland.actions import PostProcessingAction, SortFieldAction
|
||||||
from eland.common import (
|
from eland.common import (
|
||||||
SortOrder,
|
|
||||||
DEFAULT_CSV_BATCH_OUTPUT_SIZE,
|
DEFAULT_CSV_BATCH_OUTPUT_SIZE,
|
||||||
DEFAULT_ES_MAX_RESULT_WINDOW,
|
DEFAULT_ES_MAX_RESULT_WINDOW,
|
||||||
elasticsearch_date_to_pandas_date,
|
|
||||||
build_pd_series,
|
|
||||||
DEFAULT_PAGINATION_SIZE,
|
DEFAULT_PAGINATION_SIZE,
|
||||||
|
SortOrder,
|
||||||
|
build_pd_series,
|
||||||
|
elasticsearch_date_to_pandas_date,
|
||||||
)
|
)
|
||||||
|
from eland.index import Index
|
||||||
from eland.query import Query
|
from eland.query import Query
|
||||||
from eland.actions import PostProcessingAction, SortFieldAction
|
|
||||||
from eland.tasks import (
|
from eland.tasks import (
|
||||||
HeadTask,
|
|
||||||
RESOLVED_TASK_TYPE,
|
RESOLVED_TASK_TYPE,
|
||||||
TailTask,
|
|
||||||
SampleTask,
|
|
||||||
BooleanFilterTask,
|
|
||||||
ArithmeticOpFieldsTask,
|
ArithmeticOpFieldsTask,
|
||||||
QueryTermsTask,
|
BooleanFilterTask,
|
||||||
|
HeadTask,
|
||||||
QueryIdsTask,
|
QueryIdsTask,
|
||||||
|
QueryTermsTask,
|
||||||
|
SampleTask,
|
||||||
SizeTask,
|
SizeTask,
|
||||||
|
TailTask,
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from eland.query_compiler import QueryCompiler
|
|
||||||
from eland.field_mappings import Field
|
from eland.field_mappings import Field
|
||||||
|
from eland.query_compiler import QueryCompiler
|
||||||
|
|
||||||
|
|
||||||
class QueryParams:
|
class QueryParams:
|
||||||
|
@ -22,10 +22,7 @@ Based from https://github.com/pandas-dev/pandas/blob/v0.25.3/pandas/plotting/__i
|
|||||||
but only supporting a subset of plotting methods (for now).
|
but only supporting a subset of plotting methods (for now).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from eland.plotting._core import (
|
from eland.plotting._core import ed_hist_frame, ed_hist_series
|
||||||
ed_hist_frame,
|
|
||||||
ed_hist_series,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"ed_hist_frame",
|
"ed_hist_frame",
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from eland.plotting._matplotlib.hist import hist_series, hist_frame
|
from eland.plotting._matplotlib.hist import hist_frame, hist_series
|
||||||
|
|
||||||
|
|
||||||
def ed_hist_series(
|
def ed_hist_series(
|
||||||
|
@ -22,10 +22,7 @@ Based from https://github.com/pandas-dev/pandas/blob/v0.25.3/pandas/plotting/__i
|
|||||||
but only supporting a subset of plotting methods (for now).
|
but only supporting a subset of plotting methods (for now).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from eland.plotting._matplotlib.hist import (
|
from eland.plotting._matplotlib.hist import hist_frame, hist_series
|
||||||
hist_frame,
|
|
||||||
hist_series,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"hist_frame",
|
"hist_frame",
|
||||||
|
@ -19,6 +19,7 @@ import numpy as np
|
|||||||
from pandas.core.dtypes.generic import ABCIndexClass
|
from pandas.core.dtypes.generic import ABCIndexClass
|
||||||
from pandas.plotting._matplotlib import converter
|
from pandas.plotting._matplotlib import converter
|
||||||
from pandas.plotting._matplotlib.tools import _flatten, _set_ticks_props, _subplots
|
from pandas.plotting._matplotlib.tools import _flatten, _set_ticks_props, _subplots
|
||||||
|
|
||||||
from eland.utils import try_sort
|
from eland.utils import try_sort
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,16 +17,9 @@
|
|||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from typing import Optional, Dict, List, Any
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from eland.filter import (
|
from eland.filter import BooleanFilter, IsIn, IsNull, NotNull, RandomScoreFilter, Rlike
|
||||||
RandomScoreFilter,
|
|
||||||
BooleanFilter,
|
|
||||||
NotNull,
|
|
||||||
IsNull,
|
|
||||||
IsIn,
|
|
||||||
Rlike,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Query:
|
class Query:
|
||||||
|
@ -17,20 +17,20 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Sequence, TYPE_CHECKING, List
|
from typing import TYPE_CHECKING, List, Optional, Sequence
|
||||||
|
|
||||||
import numpy as np # type: ignore
|
import numpy as np # type: ignore
|
||||||
import pandas as pd # type: ignore
|
import pandas as pd # type: ignore
|
||||||
|
|
||||||
from eland.field_mappings import FieldMappings
|
|
||||||
from eland.filter import QueryFilter
|
|
||||||
from eland.operations import Operations
|
|
||||||
from eland.index import Index
|
|
||||||
from eland.common import (
|
from eland.common import (
|
||||||
ensure_es_client,
|
|
||||||
DEFAULT_PROGRESS_REPORTING_NUM_ROWS,
|
DEFAULT_PROGRESS_REPORTING_NUM_ROWS,
|
||||||
elasticsearch_date_to_pandas_date,
|
elasticsearch_date_to_pandas_date,
|
||||||
|
ensure_es_client,
|
||||||
)
|
)
|
||||||
|
from eland.field_mappings import FieldMappings
|
||||||
|
from eland.filter import QueryFilter
|
||||||
|
from eland.index import Index
|
||||||
|
from eland.operations import Operations
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .tasks import ArithmeticOpFieldsTask # noqa: F401
|
from .tasks import ArithmeticOpFieldsTask # noqa: F401
|
||||||
|
@ -35,33 +35,34 @@ import sys
|
|||||||
import warnings
|
import warnings
|
||||||
from collections.abc import Collection
|
from collections.abc import Collection
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from typing import Optional, Union, Sequence, Any, Tuple, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any, Optional, Sequence, Tuple, Union
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pandas.io.common import _expand_user, stringify_path
|
from pandas.io.common import _expand_user, stringify_path
|
||||||
|
|
||||||
import eland.plotting
|
import eland.plotting
|
||||||
from eland import NDFrame
|
from eland.arithmetics import ArithmeticNumber, ArithmeticSeries, ArithmeticString
|
||||||
from eland.arithmetics import ArithmeticSeries, ArithmeticString, ArithmeticNumber
|
|
||||||
from eland.common import DEFAULT_NUM_ROWS_DISPLAYED, docstring_parameter
|
from eland.common import DEFAULT_NUM_ROWS_DISPLAYED, docstring_parameter
|
||||||
from eland.filter import (
|
from eland.filter import (
|
||||||
BooleanFilter,
|
BooleanFilter,
|
||||||
NotFilter,
|
|
||||||
Equal,
|
Equal,
|
||||||
Greater,
|
Greater,
|
||||||
Less,
|
|
||||||
GreaterEqual,
|
GreaterEqual,
|
||||||
LessEqual,
|
|
||||||
ScriptFilter,
|
|
||||||
IsIn,
|
IsIn,
|
||||||
IsNull,
|
IsNull,
|
||||||
|
Less,
|
||||||
|
LessEqual,
|
||||||
|
NotFilter,
|
||||||
NotNull,
|
NotNull,
|
||||||
|
ScriptFilter,
|
||||||
)
|
)
|
||||||
|
from eland.ndframe import NDFrame
|
||||||
from eland.utils import deprecated_api, to_list
|
from eland.utils import deprecated_api, to_list
|
||||||
|
|
||||||
if TYPE_CHECKING: # type: ignore
|
if TYPE_CHECKING: # type: ignore
|
||||||
from elasticsearch import Elasticsearch # noqa: F401
|
from elasticsearch import Elasticsearch # noqa: F401
|
||||||
|
|
||||||
from eland.query_compiler import QueryCompiler # noqa: F401
|
from eland.query_compiler import QueryCompiler # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,18 +16,18 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import TYPE_CHECKING, List, Any, Tuple
|
from typing import TYPE_CHECKING, Any, List, Tuple
|
||||||
|
|
||||||
from eland import SortOrder
|
from eland import SortOrder
|
||||||
from eland.actions import HeadAction, TailAction, SortIndexAction
|
from eland.actions import HeadAction, SortIndexAction, TailAction
|
||||||
from eland.arithmetics import ArithmeticSeries
|
from eland.arithmetics import ArithmeticSeries
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .actions import PostProcessingAction # noqa: F401
|
from .actions import PostProcessingAction # noqa: F401
|
||||||
from .filter import BooleanFilter # noqa: F401
|
from .filter import BooleanFilter # noqa: F401
|
||||||
from .query_compiler import QueryCompiler # noqa: F401
|
|
||||||
from .operations import QueryParams # noqa: F401
|
|
||||||
from .index import Index # noqa: F401
|
from .index import Index # noqa: F401
|
||||||
|
from .operations import QueryParams # noqa: F401
|
||||||
|
from .query_compiler import QueryCompiler # noqa: F401
|
||||||
|
|
||||||
RESOLVED_TASK_TYPE = Tuple["QueryParams", List["PostProcessingAction"]]
|
RESOLVED_TASK_TYPE = Tuple["QueryParams", List["PostProcessingAction"]]
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import os
|
|||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from elasticsearch import Elasticsearch
|
from elasticsearch import Elasticsearch
|
||||||
|
|
||||||
from eland.common import es_version
|
from eland.common import es_version
|
||||||
|
|
||||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -26,12 +26,12 @@ ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|||||||
|
|
||||||
# Create pandas and eland data frames
|
# Create pandas and eland data frames
|
||||||
from eland.tests import (
|
from eland.tests import (
|
||||||
|
ECOMMERCE_DF_FILE_NAME,
|
||||||
|
ECOMMERCE_INDEX_NAME,
|
||||||
ES_TEST_CLIENT,
|
ES_TEST_CLIENT,
|
||||||
FLIGHTS_DF_FILE_NAME,
|
FLIGHTS_DF_FILE_NAME,
|
||||||
FLIGHTS_INDEX_NAME,
|
FLIGHTS_INDEX_NAME,
|
||||||
FLIGHTS_SMALL_INDEX_NAME,
|
FLIGHTS_SMALL_INDEX_NAME,
|
||||||
ECOMMERCE_DF_FILE_NAME,
|
|
||||||
ECOMMERCE_INDEX_NAME,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
_pd_flights = pd.read_json(FLIGHTS_DF_FILE_NAME).sort_index()
|
_pd_flights = pd.read_json(FLIGHTS_DF_FILE_NAME).sort_index()
|
||||||
|
@ -16,22 +16,25 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import pytest
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
import eland as ed
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
|
TestData,
|
||||||
|
_ed_ecommerce,
|
||||||
|
_ed_flights,
|
||||||
|
_ed_flights_small,
|
||||||
|
_pd_ecommerce,
|
||||||
|
_pd_flights,
|
||||||
|
_pd_flights_small,
|
||||||
|
assert_frame_equal,
|
||||||
assert_pandas_eland_frame_equal,
|
assert_pandas_eland_frame_equal,
|
||||||
assert_pandas_eland_series_equal,
|
assert_pandas_eland_series_equal,
|
||||||
assert_frame_equal,
|
|
||||||
assert_series_equal,
|
assert_series_equal,
|
||||||
_ed_flights,
|
|
||||||
_pd_flights,
|
|
||||||
_ed_ecommerce,
|
|
||||||
_pd_ecommerce,
|
|
||||||
_ed_flights_small,
|
|
||||||
_pd_flights_small,
|
|
||||||
TestData,
|
|
||||||
)
|
)
|
||||||
import eland as ed
|
|
||||||
|
|
||||||
|
|
||||||
class SymmetricAPIChecker:
|
class SymmetricAPIChecker:
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pandas.testing import assert_frame_equal, assert_series_equal
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pandas.testing import assert_frame_equal, assert_series_equal
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests.common import ES_TEST_CLIENT
|
from eland.tests.common import ES_TEST_CLIENT, TestData
|
||||||
from eland.tests.common import TestData
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameBigMapping(TestData):
|
class TestDataFrameBigMapping(TestData):
|
||||||
|
@ -24,10 +24,12 @@ from pandas.testing import assert_series_equal
|
|||||||
|
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests.common import ES_TEST_CLIENT
|
from eland.tests.common import (
|
||||||
from eland.tests.common import TestData
|
ES_TEST_CLIENT,
|
||||||
from eland.tests.common import assert_pandas_eland_frame_equal
|
TestData,
|
||||||
from eland.tests.common import assert_pandas_eland_series_equal
|
assert_pandas_eland_frame_equal,
|
||||||
|
assert_pandas_eland_series_equal,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameDateTime(TestData):
|
class TestDataFrameDateTime(TestData):
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from eland.tests.common import assert_series_equal
|
from eland.tests.common import assert_series_equal
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland.tests.common import assert_eland_frame_equal
|
from eland.tests.common import TestData, assert_eland_frame_equal
|
||||||
|
|
||||||
|
|
||||||
class TestDataEsQuery(TestData):
|
class TestDataEsQuery(TestData):
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
import pytest
|
import pytest
|
||||||
from pandas.testing import assert_frame_equal, assert_series_equal
|
from pandas.testing import assert_frame_equal, assert_series_equal
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
class TestGroupbyDataFrame(TestData):
|
class TestGroupbyDataFrame(TestData):
|
||||||
|
@ -17,8 +17,7 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData, assert_pandas_eland_frame_equal
|
||||||
from eland.tests.common import assert_pandas_eland_frame_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameHeadTail(TestData):
|
class TestDataFrameHeadTail(TestData):
|
||||||
|
@ -19,9 +19,7 @@
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
import eland as ed
|
import eland as ed
|
||||||
|
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@ import pytest
|
|||||||
|
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.query_compiler import QueryCompiler
|
from eland.query_compiler import QueryCompiler
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameInit:
|
class TestDataFrameInit:
|
||||||
|
@ -15,11 +15,13 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# File called _pytest for PyCharm compatibility
|
|
||||||
import pytest
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
# File called _pytest for PyCharm compatibility
|
||||||
|
import pytest
|
||||||
from pandas.testing import assert_series_equal
|
from pandas.testing import assert_series_equal
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,9 +20,7 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests.common import ES_TEST_CLIENT
|
from eland.tests.common import ES_TEST_CLIENT, TestData, assert_pandas_eland_frame_equal
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland.tests.common import assert_pandas_eland_frame_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameQuery(TestData):
|
class TestDataFrameQuery(TestData):
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pandas.testing import assert_frame_equal
|
from pandas.testing import assert_frame_equal
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland import eland_to_pandas
|
from eland import eland_to_pandas
|
||||||
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameSample(TestData):
|
class TestDataFrameSample(TestData):
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData, assert_pandas_eland_frame_equal
|
||||||
from eland.tests.common import assert_pandas_eland_frame_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameSelectDTypes(TestData):
|
class TestDataFrameSelectDTypes(TestData):
|
||||||
|
@ -24,10 +24,8 @@ import pandas as pd
|
|||||||
from pandas.testing import assert_frame_equal
|
from pandas.testing import assert_frame_equal
|
||||||
|
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME
|
from eland.tests.common import ROOT_DIR, TestData
|
||||||
from eland.tests.common import ROOT_DIR
|
|
||||||
from eland.tests.common import TestData
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameToCSV(TestData):
|
class TestDataFrameToCSV(TestData):
|
||||||
|
@ -22,8 +22,7 @@ import pandas as pd
|
|||||||
|
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests.common import ES_TEST_CLIENT, assert_pandas_eland_frame_equal
|
from eland.tests.common import ES_TEST_CLIENT, TestData, assert_pandas_eland_frame_equal
|
||||||
from eland.tests.common import TestData
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataFrameUtils(TestData):
|
class TestDataFrameUtils(TestData):
|
||||||
|
@ -16,10 +16,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import pytest
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import pytest
|
||||||
from elasticsearch.helpers import BulkIndexError
|
from elasticsearch.helpers import BulkIndexError
|
||||||
from eland import pandas_to_eland, DataFrame
|
|
||||||
|
from eland import DataFrame, pandas_to_eland
|
||||||
from eland.tests.common import (
|
from eland.tests.common import (
|
||||||
ES_TEST_CLIENT,
|
ES_TEST_CLIENT,
|
||||||
assert_frame_equal,
|
assert_frame_equal,
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests import ES_TEST_CLIENT, ECOMMERCE_INDEX_NAME
|
from eland.tests import ECOMMERCE_INDEX_NAME, ES_TEST_CLIENT
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests.common import ES_TEST_CLIENT
|
from eland.tests.common import ES_TEST_CLIENT, TestData
|
||||||
from eland.tests.common import TestData
|
|
||||||
|
|
||||||
|
|
||||||
class TestDateTime(TestData):
|
class TestDateTime(TestData):
|
||||||
|
@ -21,8 +21,7 @@ from pandas.testing import assert_series_equal
|
|||||||
|
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME, FLIGHTS_MAPPING
|
from eland.tests import FLIGHTS_INDEX_NAME, FLIGHTS_MAPPING
|
||||||
from eland.tests.common import ES_TEST_CLIENT
|
from eland.tests.common import ES_TEST_CLIENT, TestData
|
||||||
from eland.tests.common import TestData
|
|
||||||
|
|
||||||
|
|
||||||
class TestFieldNamePDDType(TestData):
|
class TestFieldNamePDDType(TestData):
|
||||||
|
@ -21,7 +21,7 @@ from pandas.testing import assert_index_equal
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME, ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests import ES_TEST_CLIENT, ECOMMERCE_INDEX_NAME, FLIGHTS_INDEX_NAME
|
from eland.tests import ECOMMERCE_INDEX_NAME, ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from io import StringIO
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from eland.field_mappings import FieldMappings
|
from eland.field_mappings import FieldMappings
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME, ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,16 +15,15 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import pytest
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import pytest
|
||||||
|
|
||||||
from eland.ml import MLModel
|
from eland.ml import MLModel
|
||||||
from eland.tests import ES_TEST_CLIENT, ES_VERSION
|
from eland.tests import ES_TEST_CLIENT, ES_VERSION
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from sklearn import datasets
|
from sklearn import datasets
|
||||||
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
|
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
|
||||||
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
|
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
|
||||||
|
|
||||||
HAS_SKLEARN = True
|
HAS_SKLEARN = True
|
||||||
@ -32,14 +31,14 @@ except ImportError:
|
|||||||
HAS_SKLEARN = False
|
HAS_SKLEARN = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from xgboost import XGBRegressor, XGBClassifier
|
from xgboost import XGBClassifier, XGBRegressor
|
||||||
|
|
||||||
HAS_XGBOOST = True
|
HAS_XGBOOST = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_XGBOOST = False
|
HAS_XGBOOST = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from lightgbm import LGBMRegressor, LGBMClassifier
|
from lightgbm import LGBMClassifier, LGBMRegressor
|
||||||
|
|
||||||
HAS_LIGHTGBM = True
|
HAS_LIGHTGBM = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -16,18 +16,18 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from eland.filter import (
|
from eland.filter import (
|
||||||
|
Equal,
|
||||||
Greater,
|
Greater,
|
||||||
GreaterEqual,
|
GreaterEqual,
|
||||||
Less,
|
|
||||||
LessEqual,
|
|
||||||
Equal,
|
|
||||||
IsIn,
|
IsIn,
|
||||||
IsNull,
|
IsNull,
|
||||||
|
Less,
|
||||||
|
LessEqual,
|
||||||
Like,
|
Like,
|
||||||
Rlike,
|
|
||||||
Startswith,
|
|
||||||
NotNull,
|
NotNull,
|
||||||
|
Rlike,
|
||||||
ScriptFilter,
|
ScriptFilter,
|
||||||
|
Startswith,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from eland.tests.common import TestData, assert_series_equal
|
from eland.tests.common import TestData, assert_series_equal
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import warnings
|
|
||||||
from eland.common import build_pd_series, EMPTY_SERIES_DTYPE
|
from eland.common import EMPTY_SERIES_DTYPE, build_pd_series
|
||||||
from eland.tests.common import assert_series_equal
|
from eland.tests.common import assert_series_equal
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland.tests.common import assert_pandas_eland_series_equal
|
from eland.tests.common import TestData, assert_pandas_eland_series_equal
|
||||||
|
|
||||||
|
|
||||||
class TestSeriesFilter(TestData):
|
class TestSeriesFilter(TestData):
|
||||||
|
@ -17,10 +17,8 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME
|
from eland.tests.common import TestData, assert_pandas_eland_series_equal
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland.tests.common import assert_pandas_eland_series_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestSeriesHeadTail(TestData):
|
class TestSeriesHeadTail(TestData):
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
|
|
||||||
import pytest
|
|
||||||
import pandas as pd
|
|
||||||
import numpy as np
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
import pytest
|
||||||
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from eland import eland_to_pandas
|
from eland import eland_to_pandas
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData, assert_pandas_eland_frame_equal
|
||||||
from eland.tests.common import assert_pandas_eland_frame_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestSeriesNA(TestData):
|
class TestSeriesNA(TestData):
|
||||||
|
@ -17,10 +17,8 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME
|
from eland.tests.common import TestData, assert_pandas_eland_series_equal
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland.tests.common import assert_pandas_eland_series_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestSeriesName(TestData):
|
class TestSeriesName(TestData):
|
||||||
|
@ -17,10 +17,8 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME
|
from eland.tests.common import TestData, assert_pandas_eland_series_equal
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland.tests.common import assert_pandas_eland_series_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestSeriesRename(TestData):
|
class TestSeriesRename(TestData):
|
||||||
|
@ -17,8 +17,7 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatability
|
# File called _pytest for PyCharm compatability
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME
|
|
||||||
from eland.tests.common import TestData
|
from eland.tests.common import TestData
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,10 +17,8 @@
|
|||||||
|
|
||||||
# File called _pytest for PyCharm compatibility
|
# File called _pytest for PyCharm compatibility
|
||||||
import eland as ed
|
import eland as ed
|
||||||
from eland.tests import ES_TEST_CLIENT
|
from eland.tests import ES_TEST_CLIENT, FLIGHTS_INDEX_NAME
|
||||||
from eland.tests import FLIGHTS_INDEX_NAME
|
from eland.tests.common import TestData, assert_pandas_eland_series_equal
|
||||||
from eland.tests.common import TestData
|
|
||||||
from eland.tests.common import assert_pandas_eland_series_equal
|
|
||||||
|
|
||||||
|
|
||||||
class TestSeriesSample(TestData):
|
class TestSeriesSample(TestData):
|
||||||
|
@ -18,25 +18,24 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from elasticsearch import helpers
|
from elasticsearch import helpers
|
||||||
|
|
||||||
|
from eland.common import es_version
|
||||||
from eland.tests import (
|
from eland.tests import (
|
||||||
FLIGHTS_FILE_NAME,
|
|
||||||
FLIGHTS_INDEX_NAME,
|
|
||||||
FLIGHTS_SMALL_FILE_NAME,
|
|
||||||
FLIGHTS_SMALL_INDEX_NAME,
|
|
||||||
FLIGHTS_MAPPING,
|
|
||||||
ECOMMERCE_FILE_NAME,
|
ECOMMERCE_FILE_NAME,
|
||||||
ECOMMERCE_INDEX_NAME,
|
ECOMMERCE_INDEX_NAME,
|
||||||
ECOMMERCE_MAPPING,
|
ECOMMERCE_MAPPING,
|
||||||
|
ELASTICSEARCH_HOST,
|
||||||
|
ES_TEST_CLIENT,
|
||||||
|
FLIGHTS_FILE_NAME,
|
||||||
|
FLIGHTS_INDEX_NAME,
|
||||||
|
FLIGHTS_MAPPING,
|
||||||
|
FLIGHTS_SMALL_FILE_NAME,
|
||||||
|
FLIGHTS_SMALL_INDEX_NAME,
|
||||||
TEST_MAPPING1,
|
TEST_MAPPING1,
|
||||||
TEST_MAPPING1_INDEX_NAME,
|
TEST_MAPPING1_INDEX_NAME,
|
||||||
TEST_NESTED_USER_GROUP_DOCS,
|
TEST_NESTED_USER_GROUP_DOCS,
|
||||||
TEST_NESTED_USER_GROUP_INDEX_NAME,
|
TEST_NESTED_USER_GROUP_INDEX_NAME,
|
||||||
TEST_NESTED_USER_GROUP_MAPPING,
|
TEST_NESTED_USER_GROUP_MAPPING,
|
||||||
ES_TEST_CLIENT,
|
|
||||||
ELASTICSEARCH_HOST,
|
|
||||||
)
|
)
|
||||||
from eland.common import es_version
|
|
||||||
|
|
||||||
|
|
||||||
DATA_LIST = [
|
DATA_LIST = [
|
||||||
(FLIGHTS_FILE_NAME, FLIGHTS_INDEX_NAME, FLIGHTS_MAPPING),
|
(FLIGHTS_FILE_NAME, FLIGHTS_INDEX_NAME, FLIGHTS_MAPPING),
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import re
|
|
||||||
import functools
|
import functools
|
||||||
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Callable, TypeVar, Any, Union, List, cast, Collection, Iterable
|
|
||||||
from collections.abc import Collection as ABCCollection
|
from collections.abc import Collection as ABCCollection
|
||||||
import pandas as pd # type: ignore
|
from typing import Any, Callable, Collection, Iterable, List, TypeVar, Union, cast
|
||||||
|
|
||||||
|
import pandas as pd # type: ignore
|
||||||
|
|
||||||
RT = TypeVar("RT")
|
RT = TypeVar("RT")
|
||||||
|
|
||||||
|
12
noxfile.py
12
noxfile.py
@ -18,9 +18,9 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import nox
|
|
||||||
import elasticsearch
|
|
||||||
|
|
||||||
|
import elasticsearch
|
||||||
|
import nox
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).parent
|
BASE_DIR = Path(__file__).parent
|
||||||
SOURCE_FILES = (
|
SOURCE_FILES = (
|
||||||
@ -57,18 +57,20 @@ TYPED_FILES = (
|
|||||||
|
|
||||||
|
|
||||||
@nox.session(reuse_venv=True)
|
@nox.session(reuse_venv=True)
|
||||||
def blacken(session):
|
def format(session):
|
||||||
session.install("black")
|
session.install("black", "isort")
|
||||||
session.run("python", "utils/license-headers.py", "fix", *SOURCE_FILES)
|
session.run("python", "utils/license-headers.py", "fix", *SOURCE_FILES)
|
||||||
session.run("black", "--target-version=py36", *SOURCE_FILES)
|
session.run("black", "--target-version=py36", *SOURCE_FILES)
|
||||||
|
session.run("isort", *SOURCE_FILES)
|
||||||
lint(session)
|
lint(session)
|
||||||
|
|
||||||
|
|
||||||
@nox.session(reuse_venv=True)
|
@nox.session(reuse_venv=True)
|
||||||
def lint(session):
|
def lint(session):
|
||||||
session.install("black", "flake8", "mypy")
|
session.install("black", "flake8", "mypy", "isort")
|
||||||
session.run("python", "utils/license-headers.py", "check", *SOURCE_FILES)
|
session.run("python", "utils/license-headers.py", "check", *SOURCE_FILES)
|
||||||
session.run("black", "--check", "--target-version=py36", *SOURCE_FILES)
|
session.run("black", "--check", "--target-version=py36", *SOURCE_FILES)
|
||||||
|
session.run("isort", "--check", *SOURCE_FILES)
|
||||||
session.run("flake8", "--ignore=E501,W503,E402,E712,E203", *SOURCE_FILES)
|
session.run("flake8", "--ignore=E501,W503,E402,E712,E203", *SOURCE_FILES)
|
||||||
|
|
||||||
# TODO: When all files are typed we can change this to .run("mypy", "--strict", "eland/")
|
# TODO: When all files are typed we can change this to .run("mypy", "--strict", "eland/")
|
||||||
|
2
setup.py
2
setup.py
@ -20,7 +20,7 @@
|
|||||||
from codecs import open
|
from codecs import open
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
here = path.abspath(path.dirname(__file__))
|
here = path.abspath(path.dirname(__file__))
|
||||||
about = {}
|
about = {}
|
||||||
|
@ -17,12 +17,13 @@
|
|||||||
|
|
||||||
"""Script that is used to create the compatibility matrix in the documentation"""
|
"""Script that is used to create the compatibility matrix in the documentation"""
|
||||||
|
|
||||||
import re
|
|
||||||
import eland
|
|
||||||
import pandas
|
|
||||||
import inspect
|
import inspect
|
||||||
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pandas
|
||||||
|
|
||||||
|
import eland
|
||||||
|
|
||||||
api_docs_dir = Path(__file__).absolute().parent.parent / "docs/source/reference/api"
|
api_docs_dir = Path(__file__).absolute().parent.parent / "docs/source/reference/api"
|
||||||
is_supported = []
|
is_supported = []
|
||||||
|
@ -23,9 +23,8 @@ error out if 'fix' would have changed the file.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from typing import List, Iterator
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
from typing import Iterator, List
|
||||||
|
|
||||||
lines_to_keep = ["# -*- coding: utf-8 -*-\n", "#!/usr/bin/env python\n"]
|
lines_to_keep = ["# -*- coding: utf-8 -*-\n", "#!/usr/bin/env python\n"]
|
||||||
license_header_lines = [
|
license_header_lines = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user