-
Notifications
You must be signed in to change notification settings - Fork 157
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
Removes futures from required libs #746
Conversation
@@ -3,8 +3,6 @@ | |||
from io import StringIO | |||
from typing import Dict, List, Optional, Union, cast | |||
|
|||
from past.builtins import basestring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer needed
and len(data) | ||
and isinstance(data[0], (str, basestring)) | ||
): | ||
if isinstance(data, list) and len(data) and isinstance(data[0], str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basestring is for py2
@@ -15,6 +15,8 @@ | |||
class AutoSubRegistrationMeta(abc.ABCMeta): | |||
"""For registering subclasses.""" | |||
|
|||
_register_subclass: Callable[[type[AutoSubRegistrationMeta]], None] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper mypy
@@ -93,7 +95,9 @@ def _register_subclass(cls) -> None: | |||
@property | |||
def label_mapping(self) -> dict[str, int]: | |||
"""Return mapping of labels to their encoded values.""" | |||
return copy.deepcopy(self._label_mapping) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potential bug fix
@@ -154,7 +158,7 @@ def get_class(cls, class_name: str) -> type[BaseModel] | None: | |||
|
|||
return cls._BaseModel__subclasses.get(class_name.lower(), None) | |||
|
|||
def get_parameters(self, param_list: list[str] = None) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest in this file are static typing
@@ -189,7 +193,7 @@ def set_params(self, **kwargs: Any) -> None: | |||
for param in kwargs: | |||
self._parameters[param] = kwargs[param] | |||
|
|||
def add_label(self, label: str, same_as: str = None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is static typing
@@ -97,7 +97,7 @@ def help(cls) -> None: | |||
""" | |||
raise NotImplementedError() | |||
|
|||
def get_parameters(self, param_list: list[str] = None) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is static typing
@@ -1,8 +1,10 @@ | |||
"""Contains functions for the data labeler.""" | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is static typing
@@ -10,14 +10,13 @@ | |||
|
|||
import numpy as np | |||
import pandas as pd | |||
from future.utils import with_metaclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a main change to fix the metaclass
@@ -5,7 +5,6 @@ | |||
from collections import OrderedDict | |||
from multiprocessing.pool import Pool | |||
|
|||
from future.utils import with_metaclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main change to fix the metaclass
@@ -1,22 +1,23 @@ | |||
"""Contains helper functions for generating report.""" | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is static typing
@@ -9,7 +9,7 @@ | |||
from .profiler_options import IntOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is static typing
@@ -32,7 +31,7 @@ def __init__(self, function: Callable) -> None: | |||
__isabstractmethod__ = True | |||
|
|||
|
|||
class NumericStatsMixin(with_metaclass(abc.ABCMeta, object)): # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main change here
profile: dict = OrderedDict() # type: ignore[no-redef] | ||
report: OrderedDict = OrderedDict() | ||
if "data_label_profile" not in self.profiles: | ||
dict_order.remove("data_label") | ||
for key in dict_order: | ||
try: | ||
profile[key] = unordered_profile[key] | ||
report[key] = unordered_profile[key] # type: ignore | ||
except KeyError: | ||
profile[key] = None | ||
report[key] = None # type: ignore | ||
|
||
return profile | ||
return report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses report as static typing issues
@@ -944,20 +944,24 @@ def _remove_data_labelers( | |||
|
|||
# get all profiles, unstructured is a single profile and hence needs to | |||
# be in a list, whereas structured is already a list | |||
profilers = [self._profile] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of this file is static typing fixes
[ | ||
col._last_batch_size | ||
for col in self._profile | ||
if col._last_batch_size is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix to skip if None
otherwise min would fail
@@ -1791,6 +1814,15 @@ def _get_and_validate_schema_mapping( | |||
|
|||
return schema_mapping | |||
|
|||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static typing fix
@@ -7,8 +7,9 @@ | |||
from typing import TYPE_CHECKING, List, Union, cast | |||
|
|||
if TYPE_CHECKING: | |||
from dataprofiler.profilers.float_column_profile import FloatColumn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use same relative format
@@ -69,10 +66,11 @@ def plot_histograms( | |||
"column indexes in the profiler" | |||
) | |||
|
|||
profile_list: list[StructuredColProfiler] = profiler.profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static typing fix
@@ -1,6 +1,5 @@ | |||
h5py>=2.10.0 | |||
wheel>=0.33.1 | |||
future>=0.18.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the removal
@@ -15,6 +15,7 @@ line_length=88 | |||
warn_return_any = True | |||
warn_unused_configs = True | |||
ignore_missing_imports = True | |||
disable_error_code = override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to address at a later time, but some mixin / abstraction issues with mypy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document this if it is needed in the future
We are no longer maintaining py2 or <= py3.7. Therefore, this is no longer needed