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

clean up imports #316

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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: 0 additions & 5 deletions src/dx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
from dx.comms import handle_resample_comm
from dx.datatypes import *
from dx.dx import display, show_docs
from dx.formatters import *
from dx.loggers import configure_logging
from dx.settings import *

__version__ = "1.4.0"

Expand Down
1 change: 0 additions & 1 deletion src/dx/comms/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from dx.comms.resample import handle_resample_comm
8 changes: 4 additions & 4 deletions src/dx/comms/resample.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import structlog

from dx.filtering import handle_resample
from dx.types.filters import DEXResampleMessage

logger = structlog.get_logger(__name__)


Expand All @@ -20,7 +17,10 @@ def _recv(msg):
comm.send({"status": "connected", "source": "resampler"})


def handle_resample_comm(msg):
def handle_resample_comm(msg: dict) -> None:
from dx.filtering import handle_resample
from dx.types.filters import DEXResampleMessage

data = msg.get("content", {}).get("data", {})
if not data:
return
Expand Down
6 changes: 0 additions & 6 deletions src/dx/datatypes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
from dx.datatypes.date_time import *
from dx.datatypes.geometry import *
from dx.datatypes.main import *
from dx.datatypes.misc import *
from dx.datatypes.numeric import *
from dx.datatypes.text import *
10 changes: 0 additions & 10 deletions src/dx/datatypes/date_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
settings = get_settings()
logger = structlog.get_logger(__name__)

__all__ = [
"generate_datetime_series",
"generate_datetimetz_series",
"generate_date_series",
"generate_time_series",
"generate_time_period_series",
"generate_time_interval_series",
"generate_time_delta_series",
]


def generate_datetime_series(num_rows: int) -> pd.Series:
"""
Expand Down
8 changes: 0 additions & 8 deletions src/dx/datatypes/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@

logger = structlog.get_logger(__name__)

__all__ = [
"generate_lat_float_series",
"generate_lon_float_series",
"generate_latlon_series",
"generate_filled_geojson_series",
"generate_exterior_bounds_geojson_series",
]


def generate_lat_float_series(num_rows: int):
"""
Expand Down
5 changes: 0 additions & 5 deletions src/dx/datatypes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

logger = structlog.get_logger(__name__)

__all__ = [
"random_dataframe",
"quick_random_dataframe",
"generate_nested_tabular_series",
]

# this is primarily used for testing to match the optional
# data types used for random dataframe generation,
Expand Down
11 changes: 0 additions & 11 deletions src/dx/datatypes/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@

logger = structlog.get_logger(__name__)

__all__ = [
"generate_boolean_series",
"generate_dtype_series",
"generate_dict_series",
"generate_list_series",
"generate_bytes_series",
"generate_ipv4_series",
"generate_ipv6_series",
"generate_uuid4_series",
]


### Generator helper functions ###
def generate_boolean_series(num_rows: int) -> pd.Series:
Expand Down
7 changes: 0 additions & 7 deletions src/dx/datatypes/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@

logger = structlog.get_logger(__name__)

__all__ = [
"generate_integer_series",
"generate_float_series",
"generate_decimal_series",
"generate_complex_number_series",
]


### Generator helper functions ###
def generate_integer_series(
Expand Down
22 changes: 6 additions & 16 deletions src/dx/datatypes/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,8 @@
import pandas as pd
import structlog

try:
from faker import Faker

fake = Faker()
FAKER_INSTALLED = True
except ImportError:
FAKER_INSTALLED = False


logger = structlog.get_logger(__name__)

__all__ = [
"generate_text_series",
"generate_keyword_series",
]


def generate_text_series(num_rows: int) -> pd.Series:
"""
Expand All @@ -31,11 +17,15 @@ def generate_text_series(num_rows: int) -> pd.Series:
num_rows: int
Number of rows to generate
"""
if not FAKER_INSTALLED:
try:
from faker import Faker

except ImportError:
logger.warning("faker is not installed, skipping text_column")
return np.nan

return pd.Series([fake.text() for _ in range(num_rows)])
faker_instance = Faker()
return pd.Series([faker_instance.text() for _ in range(num_rows)])


def generate_keyword_series(num_rows: int, num_letters: int = 2) -> pd.Series:
Expand Down
4 changes: 0 additions & 4 deletions src/dx/formatters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
from dx.formatters.enhanced import register
from dx.formatters.main import handle_format
from dx.formatters.plain import reset
from dx.formatters.simple import deregister
11 changes: 0 additions & 11 deletions src/dx/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@

logger = structlog.get_logger(__name__)

__all__ = [
"get_settings",
"enable_dev_mode",
"disable_dev_mode",
"set_display_mode",
"set_log_level",
"set_option",
"settings_context",
"add_renderable_type",
]


class Settings(BaseSettings):
LOG_LEVEL: Union[int, str] = logging.WARNING
Expand Down
2 changes: 0 additions & 2 deletions src/dx/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
from .filters import *
from .main import *