diff --git a/src/great_ai/__main__.py b/src/__main__.py similarity index 99% rename from src/great_ai/__main__.py rename to src/__main__.py index 6c3045e..a406903 100644 --- a/src/great_ai/__main__.py +++ b/src/__main__.py @@ -14,12 +14,13 @@ from uvicorn.supervisors.basereload import BaseReload from watchdog.events import FileSystemEvent, PatternMatchingEventHandler from watchdog.observers import Observer +from utilities import get_logger + from .great_ai.constants import SERVER_NAME from .great_ai.context import _is_in_production_mode from .great_ai.deploy import GreatAI from .great_ai.exceptions import ArgumentValidationError, MissingArgumentError from .parse_arguments import parse_arguments -from .utilities import get_logger logger = get_logger(SERVER_NAME) diff --git a/src/great_ai/__init__.py b/src/great_ai/__init__.py index a31d902..04e3e65 100644 --- a/src/great_ai/__init__.py +++ b/src/great_ai/__init__.py @@ -1,3 +1,23 @@ -from .great_ai import * -from .large_file import * -from .utilities import * +from .context import configure +from .deploy import GreatAI +from .exceptions import ( + ArgumentValidationError, + MissingArgumentError, + WrongDecoratorOrderError, +) +from .models import save_model, use_model +from .output_views import ( + ClassificationOutput, + MultiLabelClassificationOutput, + RegressionOutput, +) +from .parameters import log_metric, parameter +from .persistence import MongodbDriver, ParallelTinyDbDriver, TracingDatabaseDriver +from .remote import ( + HttpClient, + RemoteCallError, + call_remote_great_ai, + call_remote_great_ai_async, +) +from .tracing import add_ground_truth, delete_ground_truth, query_ground_truth +from .views import Trace diff --git a/src/great_ai/great_ai/constants.py b/src/great_ai/constants.py similarity index 94% rename from src/great_ai/great_ai/constants.py rename to src/great_ai/constants.py index 3f92f7b..6959826 100644 --- a/src/great_ai/great_ai/constants.py +++ b/src/great_ai/constants.py @@ -1,4 +1,5 @@ -from ..large_file import LargeFileMongo, LargeFileS3 +from large_file import LargeFileMongo, LargeFileS3 + from .persistence.mongodb_driver import MongodbDriver ENV_VAR_KEY = "ENVIRONMENT" diff --git a/src/great_ai/great_ai/context.py b/src/great_ai/context.py similarity index 95% rename from src/great_ai/great_ai/context.py rename to src/great_ai/context.py index e422cef..2aad9c0 100644 --- a/src/great_ai/great_ai/context.py +++ b/src/great_ai/context.py @@ -6,8 +6,9 @@ from typing import Any, Dict, Optional, Type, cast from pydantic import BaseModel -from ..large_file import LargeFile, LargeFileLocal -from ..utilities import get_logger +from large_file import LargeFileBase, LargeFileLocal +from utilities import get_logger + from .constants import ( DEFAULT_LARGE_FILE_CONFIG_PATHS, DEFAULT_TRACING_DATABASE_CONFIG_PATHS, @@ -21,7 +22,7 @@ from .persistence import ParallelTinyDbDriver, TracingDatabaseDriver class Context(BaseModel): tracing_database: TracingDatabaseDriver - large_file_implementation: Type[LargeFile] + large_file_implementation: Type[LargeFileBase] is_production: bool logger: Logger should_log_exception_stack: bool @@ -57,7 +58,7 @@ def configure( log_level: int = DEBUG, seed: int = 42, tracing_database: Optional[Type[TracingDatabaseDriver]] = None, - large_file_implementation: Optional[Type[LargeFile]] = None, + large_file_implementation: Optional[Type[LargeFileBase]] = None, should_log_exception_stack: Optional[bool] = None, prediction_cache_size: int = 512, disable_se4ml_banner: bool = False, @@ -160,8 +161,8 @@ def _initialize_tracing_database( def _initialize_large_file( - selected: Optional[Type[LargeFile]], logger: Logger -) -> Type[LargeFile]: + selected: Optional[Type[LargeFileBase]], logger: Logger +) -> Type[LargeFileBase]: for large_file, paths in DEFAULT_LARGE_FILE_CONFIG_PATHS.items(): if selected is None or selected == large_file: if large_file.initialized: diff --git a/src/great_ai/great_ai/deploy/__init__.py b/src/great_ai/deploy/__init__.py similarity index 100% rename from src/great_ai/great_ai/deploy/__init__.py rename to src/great_ai/deploy/__init__.py diff --git a/src/great_ai/great_ai/deploy/great_ai.py b/src/great_ai/deploy/great_ai.py similarity index 99% rename from src/great_ai/great_ai/deploy/great_ai.py rename to src/great_ai/deploy/great_ai.py index 0f4cde3..a5c8181 100644 --- a/src/great_ai/great_ai/deploy/great_ai.py +++ b/src/great_ai/deploy/great_ai.py @@ -16,7 +16,8 @@ from typing import ( from fastapi import APIRouter, FastAPI, status from pydantic import BaseModel, create_model -from ...utilities import parallel_map +from utilities import parallel_map + from ..constants import DASHBOARD_PATH from ..context import get_context from ..helper import ( diff --git a/src/great_ai/great_ai/deploy/routes/__init__.py b/src/great_ai/deploy/routes/__init__.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/__init__.py rename to src/great_ai/deploy/routes/__init__.py diff --git a/src/great_ai/great_ai/deploy/routes/bootstrap_dashboard.py b/src/great_ai/deploy/routes/bootstrap_dashboard.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/bootstrap_dashboard.py rename to src/great_ai/deploy/routes/bootstrap_dashboard.py diff --git a/src/great_ai/great_ai/deploy/routes/bootstrap_docs_endpoints.py b/src/great_ai/deploy/routes/bootstrap_docs_endpoints.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/bootstrap_docs_endpoints.py rename to src/great_ai/deploy/routes/bootstrap_docs_endpoints.py diff --git a/src/great_ai/great_ai/deploy/routes/bootstrap_feedback_endpoints.py b/src/great_ai/deploy/routes/bootstrap_feedback_endpoints.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/bootstrap_feedback_endpoints.py rename to src/great_ai/deploy/routes/bootstrap_feedback_endpoints.py diff --git a/src/great_ai/great_ai/deploy/routes/bootstrap_trace_endpoints.py b/src/great_ai/deploy/routes/bootstrap_trace_endpoints.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/bootstrap_trace_endpoints.py rename to src/great_ai/deploy/routes/bootstrap_trace_endpoints.py diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/__init__.py b/src/great_ai/deploy/routes/dashboard/__init__.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/__init__.py rename to src/great_ai/deploy/routes/dashboard/__init__.py diff --git a/src/__init__.py b/src/great_ai/deploy/routes/dashboard/assets/__init__.py similarity index 100% rename from src/__init__.py rename to src/great_ai/deploy/routes/dashboard/assets/__init__.py diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/assets/github.png b/src/great_ai/deploy/routes/dashboard/assets/github.png similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/assets/github.png rename to src/great_ai/deploy/routes/dashboard/assets/github.png diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/assets/index.css b/src/great_ai/deploy/routes/dashboard/assets/index.css similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/assets/index.css rename to src/great_ai/deploy/routes/dashboard/assets/index.css diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/create_dash_app.py b/src/great_ai/deploy/routes/dashboard/create_dash_app.py similarity index 99% rename from src/great_ai/great_ai/deploy/routes/dashboard/create_dash_app.py rename to src/great_ai/deploy/routes/dashboard/create_dash_app.py index 6b4c5ed..fe5b70c 100644 --- a/src/great_ai/great_ai/deploy/routes/dashboard/create_dash_app.py +++ b/src/great_ai/deploy/routes/dashboard/create_dash_app.py @@ -8,7 +8,8 @@ from dash import Dash, dcc, html from dash.dependencies import Input, Output from flask import Flask -from .....utilities import unique +from utilities import unique + from ....constants import DASHBOARD_PATH, ONLINE_TAG_NAME from ....context import get_context from ....helper import freeze, snake_case_to_text, text_to_hex_color diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/get_description.py b/src/great_ai/deploy/routes/dashboard/get_description.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/get_description.py rename to src/great_ai/deploy/routes/dashboard/get_description.py diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/get_filter_from_datatable.py b/src/great_ai/deploy/routes/dashboard/get_filter_from_datatable.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/get_filter_from_datatable.py rename to src/great_ai/deploy/routes/dashboard/get_filter_from_datatable.py diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/get_footer.py b/src/great_ai/deploy/routes/dashboard/get_footer.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/get_footer.py rename to src/great_ai/deploy/routes/dashboard/get_footer.py diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/get_traces_table.py b/src/great_ai/deploy/routes/dashboard/get_traces_table.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/get_traces_table.py rename to src/great_ai/deploy/routes/dashboard/get_traces_table.py diff --git a/src/great_ai/great_ai/exceptions/__init__.py b/src/great_ai/exceptions/__init__.py similarity index 100% rename from src/great_ai/great_ai/exceptions/__init__.py rename to src/great_ai/exceptions/__init__.py diff --git a/src/great_ai/great_ai/exceptions/argument_validation_error.py b/src/great_ai/exceptions/argument_validation_error.py similarity index 100% rename from src/great_ai/great_ai/exceptions/argument_validation_error.py rename to src/great_ai/exceptions/argument_validation_error.py diff --git a/src/great_ai/great_ai/exceptions/missing_argument_error.py b/src/great_ai/exceptions/missing_argument_error.py similarity index 100% rename from src/great_ai/great_ai/exceptions/missing_argument_error.py rename to src/great_ai/exceptions/missing_argument_error.py diff --git a/src/great_ai/great_ai/exceptions/wrong_decorator_order_error.py b/src/great_ai/exceptions/wrong_decorator_order_error.py similarity index 100% rename from src/great_ai/great_ai/exceptions/wrong_decorator_order_error.py rename to src/great_ai/exceptions/wrong_decorator_order_error.py diff --git a/src/great_ai/great_ai/__init__.py b/src/great_ai/great_ai/__init__.py deleted file mode 100644 index 04e3e65..0000000 --- a/src/great_ai/great_ai/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -from .context import configure -from .deploy import GreatAI -from .exceptions import ( - ArgumentValidationError, - MissingArgumentError, - WrongDecoratorOrderError, -) -from .models import save_model, use_model -from .output_views import ( - ClassificationOutput, - MultiLabelClassificationOutput, - RegressionOutput, -) -from .parameters import log_metric, parameter -from .persistence import MongodbDriver, ParallelTinyDbDriver, TracingDatabaseDriver -from .remote import ( - HttpClient, - RemoteCallError, - call_remote_great_ai, - call_remote_great_ai_async, -) -from .tracing import add_ground_truth, delete_ground_truth, query_ground_truth -from .views import Trace diff --git a/src/great_ai/great_ai/helper/__init__.py b/src/great_ai/helper/__init__.py similarity index 100% rename from src/great_ai/great_ai/helper/__init__.py rename to src/great_ai/helper/__init__.py diff --git a/src/great_ai/great_ai/helper/assert_function_is_not_finalised.py b/src/great_ai/helper/assert_function_is_not_finalised.py similarity index 100% rename from src/great_ai/great_ai/helper/assert_function_is_not_finalised.py rename to src/great_ai/helper/assert_function_is_not_finalised.py diff --git a/src/great_ai/great_ai/helper/freeze_arguments.py b/src/great_ai/helper/freeze_arguments.py similarity index 100% rename from src/great_ai/great_ai/helper/freeze_arguments.py rename to src/great_ai/helper/freeze_arguments.py diff --git a/src/great_ai/great_ai/helper/get_arguments.py b/src/great_ai/helper/get_arguments.py similarity index 100% rename from src/great_ai/great_ai/helper/get_arguments.py rename to src/great_ai/helper/get_arguments.py diff --git a/src/great_ai/great_ai/helper/get_function_metadata_store.py b/src/great_ai/helper/get_function_metadata_store.py similarity index 100% rename from src/great_ai/great_ai/helper/get_function_metadata_store.py rename to src/great_ai/helper/get_function_metadata_store.py diff --git a/src/great_ai/great_ai/helper/hashable_base_model.py b/src/great_ai/helper/hashable_base_model.py similarity index 100% rename from src/great_ai/great_ai/helper/hashable_base_model.py rename to src/great_ai/helper/hashable_base_model.py diff --git a/src/great_ai/great_ai/helper/snake_case_to_text.py b/src/great_ai/helper/snake_case_to_text.py similarity index 100% rename from src/great_ai/great_ai/helper/snake_case_to_text.py rename to src/great_ai/helper/snake_case_to_text.py diff --git a/src/great_ai/great_ai/helper/strip_lines.py b/src/great_ai/helper/strip_lines.py similarity index 100% rename from src/great_ai/great_ai/helper/strip_lines.py rename to src/great_ai/helper/strip_lines.py diff --git a/src/great_ai/great_ai/helper/text_to_hex_color.py b/src/great_ai/helper/text_to_hex_color.py similarity index 100% rename from src/great_ai/great_ai/helper/text_to_hex_color.py rename to src/great_ai/helper/text_to_hex_color.py diff --git a/src/great_ai/great_ai/helper/use_http_exceptions.py b/src/great_ai/helper/use_http_exceptions.py similarity index 100% rename from src/great_ai/great_ai/helper/use_http_exceptions.py rename to src/great_ai/helper/use_http_exceptions.py diff --git a/src/great_ai/large_file/__init__.py b/src/great_ai/large_file/__init__.py deleted file mode 100644 index 576173b..0000000 --- a/src/great_ai/large_file/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .large_file import LargeFile, LargeFileLocal, LargeFileMongo, LargeFileS3 diff --git a/src/great_ai/great_ai/models/__init__.py b/src/great_ai/models/__init__.py similarity index 100% rename from src/great_ai/great_ai/models/__init__.py rename to src/great_ai/models/__init__.py diff --git a/src/great_ai/great_ai/models/save_model.py b/src/great_ai/models/save_model.py similarity index 100% rename from src/great_ai/great_ai/models/save_model.py rename to src/great_ai/models/save_model.py diff --git a/src/great_ai/great_ai/models/use_model.py b/src/great_ai/models/use_model.py similarity index 100% rename from src/great_ai/great_ai/models/use_model.py rename to src/great_ai/models/use_model.py diff --git a/src/great_ai/great_ai/output_views/__init__.py b/src/great_ai/output_views/__init__.py similarity index 100% rename from src/great_ai/great_ai/output_views/__init__.py rename to src/great_ai/output_views/__init__.py diff --git a/src/great_ai/great_ai/output_views/classification_output.py b/src/great_ai/output_views/classification_output.py similarity index 100% rename from src/great_ai/great_ai/output_views/classification_output.py rename to src/great_ai/output_views/classification_output.py diff --git a/src/great_ai/great_ai/output_views/multi_label_classification_output.py b/src/great_ai/output_views/multi_label_classification_output.py similarity index 100% rename from src/great_ai/great_ai/output_views/multi_label_classification_output.py rename to src/great_ai/output_views/multi_label_classification_output.py diff --git a/src/great_ai/great_ai/output_views/regression_output.py b/src/great_ai/output_views/regression_output.py similarity index 100% rename from src/great_ai/great_ai/output_views/regression_output.py rename to src/great_ai/output_views/regression_output.py diff --git a/src/great_ai/great_ai/output_views/sequence_labeling_output.py b/src/great_ai/output_views/sequence_labeling_output.py similarity index 100% rename from src/great_ai/great_ai/output_views/sequence_labeling_output.py rename to src/great_ai/output_views/sequence_labeling_output.py diff --git a/src/great_ai/great_ai/parameters/__init__.py b/src/great_ai/parameters/__init__.py similarity index 100% rename from src/great_ai/great_ai/parameters/__init__.py rename to src/great_ai/parameters/__init__.py diff --git a/src/great_ai/great_ai/parameters/automatically_decorate_parameters.py b/src/great_ai/parameters/automatically_decorate_parameters.py similarity index 100% rename from src/great_ai/great_ai/parameters/automatically_decorate_parameters.py rename to src/great_ai/parameters/automatically_decorate_parameters.py diff --git a/src/great_ai/great_ai/parameters/log_metric.py b/src/great_ai/parameters/log_metric.py similarity index 100% rename from src/great_ai/great_ai/parameters/log_metric.py rename to src/great_ai/parameters/log_metric.py diff --git a/src/great_ai/great_ai/parameters/parameter.py b/src/great_ai/parameters/parameter.py similarity index 100% rename from src/great_ai/great_ai/parameters/parameter.py rename to src/great_ai/parameters/parameter.py diff --git a/src/great_ai/great_ai/persistence/__init__.py b/src/great_ai/persistence/__init__.py similarity index 100% rename from src/great_ai/great_ai/persistence/__init__.py rename to src/great_ai/persistence/__init__.py diff --git a/src/great_ai/great_ai/persistence/mongodb_driver.py b/src/great_ai/persistence/mongodb_driver.py similarity index 100% rename from src/great_ai/great_ai/persistence/mongodb_driver.py rename to src/great_ai/persistence/mongodb_driver.py diff --git a/src/great_ai/great_ai/persistence/parallel_tinydb_driver.py b/src/great_ai/persistence/parallel_tinydb_driver.py similarity index 100% rename from src/great_ai/great_ai/persistence/parallel_tinydb_driver.py rename to src/great_ai/persistence/parallel_tinydb_driver.py diff --git a/src/great_ai/great_ai/persistence/tracing_database_driver.py b/src/great_ai/persistence/tracing_database_driver.py similarity index 97% rename from src/great_ai/great_ai/persistence/tracing_database_driver.py rename to src/great_ai/persistence/tracing_database_driver.py index e26a8ae..d87622d 100644 --- a/src/great_ai/great_ai/persistence/tracing_database_driver.py +++ b/src/great_ai/persistence/tracing_database_driver.py @@ -3,7 +3,8 @@ from datetime import datetime from pathlib import Path from typing import List, Optional, Sequence, Tuple, Union -from ...utilities import ConfigFile +from utilities import ConfigFile + from ..views import Filter, SortBy, Trace diff --git a/src/great_ai/great_ai/remote/__init__.py b/src/great_ai/remote/__init__.py similarity index 100% rename from src/great_ai/great_ai/remote/__init__.py rename to src/great_ai/remote/__init__.py diff --git a/src/great_ai/great_ai/remote/call_remote_great_ai.py b/src/great_ai/remote/call_remote_great_ai.py similarity index 95% rename from src/great_ai/great_ai/remote/call_remote_great_ai.py rename to src/great_ai/remote/call_remote_great_ai.py index 6b3e436..5fa11f1 100644 --- a/src/great_ai/great_ai/remote/call_remote_great_ai.py +++ b/src/great_ai/remote/call_remote_great_ai.py @@ -3,7 +3,8 @@ from typing import Any, Mapping, Optional, Type, TypeVar from pydantic import BaseModel -from ...utilities import get_logger +from utilities import get_logger + from ..views import Trace from .call_remote_great_ai_async import call_remote_great_ai_async diff --git a/src/great_ai/great_ai/remote/call_remote_great_ai_async.py b/src/great_ai/remote/call_remote_great_ai_async.py similarity index 100% rename from src/great_ai/great_ai/remote/call_remote_great_ai_async.py rename to src/great_ai/remote/call_remote_great_ai_async.py diff --git a/src/great_ai/great_ai/remote/http_client.py b/src/great_ai/remote/http_client.py similarity index 100% rename from src/great_ai/great_ai/remote/http_client.py rename to src/great_ai/remote/http_client.py diff --git a/src/great_ai/great_ai/remote/remote_call_error.py b/src/great_ai/remote/remote_call_error.py similarity index 100% rename from src/great_ai/great_ai/remote/remote_call_error.py rename to src/great_ai/remote/remote_call_error.py diff --git a/src/great_ai/great_ai/tracing/__init__.py b/src/great_ai/tracing/__init__.py similarity index 100% rename from src/great_ai/great_ai/tracing/__init__.py rename to src/great_ai/tracing/__init__.py diff --git a/src/great_ai/great_ai/tracing/add_ground_truth.py b/src/great_ai/tracing/add_ground_truth.py similarity index 100% rename from src/great_ai/great_ai/tracing/add_ground_truth.py rename to src/great_ai/tracing/add_ground_truth.py diff --git a/src/great_ai/great_ai/tracing/delete_ground_truth.py b/src/great_ai/tracing/delete_ground_truth.py similarity index 100% rename from src/great_ai/great_ai/tracing/delete_ground_truth.py rename to src/great_ai/tracing/delete_ground_truth.py diff --git a/src/great_ai/great_ai/tracing/query_ground_truth.py b/src/great_ai/tracing/query_ground_truth.py similarity index 100% rename from src/great_ai/great_ai/tracing/query_ground_truth.py rename to src/great_ai/tracing/query_ground_truth.py diff --git a/src/great_ai/great_ai/tracing/tracing_context.py b/src/great_ai/tracing/tracing_context.py similarity index 100% rename from src/great_ai/great_ai/tracing/tracing_context.py rename to src/great_ai/tracing/tracing_context.py diff --git a/src/great_ai/utilities/external/__init__.py b/src/great_ai/utilities/external/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/great_ai/utilities/unique.py b/src/great_ai/utilities/unique.py deleted file mode 100644 index de3a634..0000000 --- a/src/great_ai/utilities/unique.py +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any, Callable, Iterable, List - - -def unique( - values: Iterable[Any], *, key: Callable[[Any], Any] = lambda v: v -) -> List[Any]: - """Only keep first occurrences and maintain order""" - - key_values = {} - for v in values: - k = key(v) - if k not in key_values: - # dicts maintain insertion order: https://mail.python.org/pipermail/python-dev/2017-December/151283.html - key_values[k] = v - - return list(key_values.values()) diff --git a/src/great_ai/great_ai/views/__init__.py b/src/great_ai/views/__init__.py similarity index 100% rename from src/great_ai/great_ai/views/__init__.py rename to src/great_ai/views/__init__.py diff --git a/src/great_ai/great_ai/views/api_metadata.py b/src/great_ai/views/api_metadata.py similarity index 100% rename from src/great_ai/great_ai/views/api_metadata.py rename to src/great_ai/views/api_metadata.py diff --git a/src/great_ai/great_ai/views/cache_statistics.py b/src/great_ai/views/cache_statistics.py similarity index 100% rename from src/great_ai/great_ai/views/cache_statistics.py rename to src/great_ai/views/cache_statistics.py diff --git a/src/great_ai/great_ai/views/evaluation_feedback_request.py b/src/great_ai/views/evaluation_feedback_request.py similarity index 100% rename from src/great_ai/great_ai/views/evaluation_feedback_request.py rename to src/great_ai/views/evaluation_feedback_request.py diff --git a/src/great_ai/great_ai/views/filter.py b/src/great_ai/views/filter.py similarity index 100% rename from src/great_ai/great_ai/views/filter.py rename to src/great_ai/views/filter.py diff --git a/src/great_ai/great_ai/views/function_metadata.py b/src/great_ai/views/function_metadata.py similarity index 100% rename from src/great_ai/great_ai/views/function_metadata.py rename to src/great_ai/views/function_metadata.py diff --git a/src/great_ai/great_ai/views/health_check_response.py b/src/great_ai/views/health_check_response.py similarity index 100% rename from src/great_ai/great_ai/views/health_check_response.py rename to src/great_ai/views/health_check_response.py diff --git a/src/great_ai/great_ai/views/model.py b/src/great_ai/views/model.py similarity index 100% rename from src/great_ai/great_ai/views/model.py rename to src/great_ai/views/model.py diff --git a/src/great_ai/great_ai/views/operators.py b/src/great_ai/views/operators.py similarity index 100% rename from src/great_ai/great_ai/views/operators.py rename to src/great_ai/views/operators.py diff --git a/src/great_ai/great_ai/views/query.py b/src/great_ai/views/query.py similarity index 100% rename from src/great_ai/great_ai/views/query.py rename to src/great_ai/views/query.py diff --git a/src/great_ai/great_ai/views/sort_by.py b/src/great_ai/views/sort_by.py similarity index 100% rename from src/great_ai/great_ai/views/sort_by.py rename to src/great_ai/views/sort_by.py diff --git a/src/great_ai/great_ai/views/trace.py b/src/great_ai/views/trace.py similarity index 100% rename from src/great_ai/great_ai/views/trace.py rename to src/great_ai/views/trace.py diff --git a/src/large_file/__init__.py b/src/large_file/__init__.py new file mode 100644 index 0000000..707e8e5 --- /dev/null +++ b/src/large_file/__init__.py @@ -0,0 +1 @@ +from .large_file import LargeFileBase, LargeFileLocal, LargeFileMongo, LargeFileS3 diff --git a/src/great_ai/large_file/__main__.py b/src/large_file/__main__.py similarity index 88% rename from src/great_ai/large_file/__main__.py rename to src/large_file/__main__.py index ed3bc14..4182ab0 100644 --- a/src/great_ai/large_file/__main__.py +++ b/src/large_file/__main__.py @@ -4,8 +4,9 @@ from argparse import Namespace from pathlib import Path from typing import Mapping, Type -from ..utilities import get_logger -from .large_file import LargeFile, LargeFileLocal, LargeFileMongo, LargeFileS3 +from large_file import LargeFileBase, LargeFileLocal, LargeFileMongo, LargeFileS3 +from utilities import get_logger + from .parse_arguments import parse_arguments logger = get_logger("large_file") @@ -37,8 +38,8 @@ def main() -> None: large_file(f).delete() -def get_class(args: Namespace) -> Type[LargeFile]: - factory: Mapping[str, Type[LargeFile]] = { +def get_class(args: Namespace) -> Type[LargeFileBase]: + factory: Mapping[str, Type[LargeFileBase]] = { "s3": LargeFileS3, "local": LargeFileLocal, "mongodb": LargeFileMongo, diff --git a/src/great_ai/large_file/helper/__init__.py b/src/large_file/helper/__init__.py similarity index 100% rename from src/great_ai/large_file/helper/__init__.py rename to src/large_file/helper/__init__.py diff --git a/src/great_ai/large_file/helper/bytes_to_megabytes.py b/src/large_file/helper/bytes_to_megabytes.py similarity index 100% rename from src/great_ai/large_file/helper/bytes_to_megabytes.py rename to src/large_file/helper/bytes_to_megabytes.py diff --git a/src/great_ai/large_file/helper/human_readable_to_byte.py b/src/large_file/helper/human_readable_to_byte.py similarity index 100% rename from src/great_ai/large_file/helper/human_readable_to_byte.py rename to src/large_file/helper/human_readable_to_byte.py diff --git a/src/great_ai/large_file/helper/progress_bar.py b/src/large_file/helper/progress_bar.py similarity index 100% rename from src/great_ai/large_file/helper/progress_bar.py rename to src/large_file/helper/progress_bar.py diff --git a/src/great_ai/large_file/large_file/__init__.py b/src/large_file/large_file/__init__.py similarity index 75% rename from src/great_ai/large_file/large_file/__init__.py rename to src/large_file/large_file/__init__.py index 60b5aaf..2752c4e 100644 --- a/src/great_ai/large_file/large_file/__init__.py +++ b/src/large_file/large_file/__init__.py @@ -1,4 +1,4 @@ -from .large_file import LargeFile +from .large_file_base import LargeFileBase from .large_file_local import LargeFileLocal from .large_file_mongo import LargeFileMongo from .large_file_s3 import LargeFileS3 diff --git a/src/great_ai/large_file/large_file/large_file.py b/src/large_file/large_file/large_file_base.py similarity index 98% rename from src/great_ai/large_file/large_file/large_file.py rename to src/large_file/large_file/large_file_base.py index 9ae0564..0855104 100644 --- a/src/great_ai/large_file/large_file/large_file.py +++ b/src/large_file/large_file/large_file_base.py @@ -7,7 +7,8 @@ from pathlib import Path from types import TracebackType from typing import IO, Any, List, Optional, Type, Union, cast -from ...utilities import ConfigFile, get_logger +from utilities import ConfigFile, get_logger + from ..helper import human_readable_to_byte from ..models import DataInstance @@ -19,7 +20,7 @@ COMPRESSION_ALGORITHM = "gztar" ARCHIVE_EXTENSION = ".tar.gz" -class LargeFile(ABC): +class LargeFileBase(ABC): """ Store large files remotely. Use local cache for speed up. @@ -75,7 +76,7 @@ class LargeFile(ABC): self._errors = errors self._newline = newline - LargeFile.cache_path.mkdir(parents=True, exist_ok=True) + LargeFileBase.cache_path.mkdir(parents=True, exist_ok=True) self._find_instances() self._check_mode_and_set_version() diff --git a/src/great_ai/large_file/large_file/large_file_local.py b/src/large_file/large_file/large_file_local.py similarity index 93% rename from src/great_ai/large_file/large_file/large_file_local.py rename to src/large_file/large_file/large_file_local.py index 689ea52..0930e7e 100644 --- a/src/great_ai/large_file/large_file/large_file_local.py +++ b/src/large_file/large_file/large_file_local.py @@ -1,14 +1,15 @@ from pathlib import Path from typing import Any, List, Optional -from ...utilities import get_logger +from utilities import get_logger + from ..models import DataInstance -from .large_file import LargeFile +from .large_file_base import LargeFileBase logger = get_logger("large_file") -class LargeFileLocal(LargeFile): +class LargeFileLocal(LargeFileBase): def __init__( self, name: str, diff --git a/src/great_ai/large_file/large_file/large_file_mongo.py b/src/large_file/large_file/large_file_mongo.py similarity index 97% rename from src/great_ai/large_file/large_file/large_file_mongo.py rename to src/large_file/large_file/large_file_mongo.py index 5dda944..9247f03 100644 --- a/src/great_ai/large_file/large_file/large_file_mongo.py +++ b/src/large_file/large_file/large_file_mongo.py @@ -6,10 +6,11 @@ from typing import Any, List, Mapping from gridfs import DEFAULT_CHUNK_SIZE, Database, GridFSBucket from pymongo import MongoClient -from ...utilities import get_logger +from utilities import get_logger + from ..helper import DownloadProgressBar, UploadProgressBar from ..models import DataInstance -from .large_file import LargeFile +from .large_file_base import LargeFileBase logger = get_logger("large_file") @@ -17,7 +18,7 @@ logger = get_logger("large_file") MONGO_NAME_VERSION_SEPARATOR = "_" -class LargeFileMongo(LargeFile): +class LargeFileMongo(LargeFileBase): mongo_connection_string = None mongo_database = None diff --git a/src/great_ai/large_file/large_file/large_file_s3.py b/src/large_file/large_file/large_file_s3.py similarity index 97% rename from src/great_ai/large_file/large_file/large_file_s3.py rename to src/large_file/large_file/large_file_s3.py index d73493e..9a05f42 100644 --- a/src/great_ai/large_file/large_file/large_file_s3.py +++ b/src/large_file/large_file/large_file_s3.py @@ -4,10 +4,11 @@ from typing import Any, List, Mapping, Optional import boto3 -from ...utilities import get_logger +from utilities import get_logger + from ..helper import DownloadProgressBar, UploadProgressBar from ..models import DataInstance -from .large_file import LargeFile +from .large_file_base import LargeFileBase logger = get_logger("large_file") @@ -15,7 +16,7 @@ logger = get_logger("large_file") S3_NAME_VERSION_SEPARATOR = "/" -class LargeFileS3(LargeFile): +class LargeFileS3(LargeFileBase): """ Store large files in S3. Use local cache for speed up. diff --git a/src/great_ai/large_file/models/__init__.py b/src/large_file/models/__init__.py similarity index 100% rename from src/great_ai/large_file/models/__init__.py rename to src/large_file/models/__init__.py diff --git a/src/great_ai/large_file/models/data_instance.py b/src/large_file/models/data_instance.py similarity index 100% rename from src/great_ai/large_file/models/data_instance.py rename to src/large_file/models/data_instance.py diff --git a/src/great_ai/large_file/parse_arguments.py b/src/large_file/parse_arguments.py similarity index 100% rename from src/great_ai/large_file/parse_arguments.py rename to src/large_file/parse_arguments.py diff --git a/src/great_ai/parse_arguments.py b/src/parse_arguments.py similarity index 100% rename from src/great_ai/parse_arguments.py rename to src/parse_arguments.py diff --git a/src/great_ai/utilities/__init__.py b/src/utilities/__init__.py similarity index 100% rename from src/great_ai/utilities/__init__.py rename to src/utilities/__init__.py diff --git a/src/great_ai/utilities/chunk.py b/src/utilities/chunk.py similarity index 100% rename from src/great_ai/utilities/chunk.py rename to src/utilities/chunk.py diff --git a/src/great_ai/utilities/clean.py b/src/utilities/clean.py similarity index 100% rename from src/great_ai/utilities/clean.py rename to src/utilities/clean.py diff --git a/src/great_ai/utilities/config_file/__init__.py b/src/utilities/config_file/__init__.py similarity index 100% rename from src/great_ai/utilities/config_file/__init__.py rename to src/utilities/config_file/__init__.py diff --git a/src/great_ai/utilities/config_file/config_file.py b/src/utilities/config_file/config_file.py similarity index 100% rename from src/great_ai/utilities/config_file/config_file.py rename to src/utilities/config_file/config_file.py diff --git a/src/great_ai/utilities/config_file/parse_error.py b/src/utilities/config_file/parse_error.py similarity index 100% rename from src/great_ai/utilities/config_file/parse_error.py rename to src/utilities/config_file/parse_error.py diff --git a/src/great_ai/utilities/config_file/pattern.py b/src/utilities/config_file/pattern.py similarity index 100% rename from src/great_ai/utilities/config_file/pattern.py rename to src/utilities/config_file/pattern.py diff --git a/src/great_ai/utilities/data/__init__.py b/src/utilities/data/__init__.py similarity index 100% rename from src/great_ai/utilities/data/__init__.py rename to src/utilities/data/__init__.py diff --git a/src/great_ai/utilities/data/american_spellings.py b/src/utilities/data/american_spellings.py similarity index 100% rename from src/great_ai/utilities/data/american_spellings.py rename to src/utilities/data/american_spellings.py diff --git a/src/great_ai/utilities/data/punctuations.py b/src/utilities/data/punctuations.py similarity index 100% rename from src/great_ai/utilities/data/punctuations.py rename to src/utilities/data/punctuations.py diff --git a/src/great_ai/utilities/evaluate_ranking/__init__.py b/src/utilities/evaluate_ranking/__init__.py similarity index 100% rename from src/great_ai/utilities/evaluate_ranking/__init__.py rename to src/utilities/evaluate_ranking/__init__.py diff --git a/src/great_ai/utilities/evaluate_ranking/draw_f1_iso_lines.py b/src/utilities/evaluate_ranking/draw_f1_iso_lines.py similarity index 100% rename from src/great_ai/utilities/evaluate_ranking/draw_f1_iso_lines.py rename to src/utilities/evaluate_ranking/draw_f1_iso_lines.py diff --git a/src/great_ai/utilities/evaluate_ranking/evaluate_ranking.py b/src/utilities/evaluate_ranking/evaluate_ranking.py similarity index 100% rename from src/great_ai/utilities/evaluate_ranking/evaluate_ranking.py rename to src/utilities/evaluate_ranking/evaluate_ranking.py diff --git a/src/great_ai/great_ai/deploy/routes/dashboard/assets/__init__.py b/src/utilities/external/__init__.py similarity index 100% rename from src/great_ai/great_ai/deploy/routes/dashboard/assets/__init__.py rename to src/utilities/external/__init__.py diff --git a/src/great_ai/utilities/external/pylatexenc/README.md b/src/utilities/external/pylatexenc/README.md similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/README.md rename to src/utilities/external/pylatexenc/README.md diff --git a/src/great_ai/utilities/external/pylatexenc/__init__.py b/src/utilities/external/pylatexenc/__init__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/__init__.py rename to src/utilities/external/pylatexenc/__init__.py diff --git a/src/great_ai/utilities/external/pylatexenc/_util.py b/src/utilities/external/pylatexenc/_util.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/_util.py rename to src/utilities/external/pylatexenc/_util.py diff --git a/src/great_ai/utilities/external/pylatexenc/latex2text/__init__.py b/src/utilities/external/pylatexenc/latex2text/__init__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latex2text/__init__.py rename to src/utilities/external/pylatexenc/latex2text/__init__.py diff --git a/src/great_ai/utilities/external/pylatexenc/latex2text/__main__.py b/src/utilities/external/pylatexenc/latex2text/__main__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latex2text/__main__.py rename to src/utilities/external/pylatexenc/latex2text/__main__.py diff --git a/src/great_ai/utilities/external/pylatexenc/latex2text/_defaultspecs.py b/src/utilities/external/pylatexenc/latex2text/_defaultspecs.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latex2text/_defaultspecs.py rename to src/utilities/external/pylatexenc/latex2text/_defaultspecs.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexencode/__init__.py b/src/utilities/external/pylatexenc/latexencode/__init__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexencode/__init__.py rename to src/utilities/external/pylatexenc/latexencode/__init__.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexencode/__main__.py b/src/utilities/external/pylatexenc/latexencode/__main__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexencode/__main__.py rename to src/utilities/external/pylatexenc/latexencode/__main__.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexencode/_partial_latex_encoder.py b/src/utilities/external/pylatexenc/latexencode/_partial_latex_encoder.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexencode/_partial_latex_encoder.py rename to src/utilities/external/pylatexenc/latexencode/_partial_latex_encoder.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexencode/_uni2latexmap.py b/src/utilities/external/pylatexenc/latexencode/_uni2latexmap.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexencode/_uni2latexmap.py rename to src/utilities/external/pylatexenc/latexencode/_uni2latexmap.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexencode/_uni2latexmap_xml.py b/src/utilities/external/pylatexenc/latexencode/_uni2latexmap_xml.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexencode/_uni2latexmap_xml.py rename to src/utilities/external/pylatexenc/latexencode/_uni2latexmap_xml.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexencode/_unicode_to_latex_encoder.py b/src/utilities/external/pylatexenc/latexencode/_unicode_to_latex_encoder.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexencode/_unicode_to_latex_encoder.py rename to src/utilities/external/pylatexenc/latexencode/_unicode_to_latex_encoder.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexwalker/__init__.py b/src/utilities/external/pylatexenc/latexwalker/__init__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexwalker/__init__.py rename to src/utilities/external/pylatexenc/latexwalker/__init__.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexwalker/__main__.py b/src/utilities/external/pylatexenc/latexwalker/__main__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexwalker/__main__.py rename to src/utilities/external/pylatexenc/latexwalker/__main__.py diff --git a/src/great_ai/utilities/external/pylatexenc/latexwalker/_defaultspecs.py b/src/utilities/external/pylatexenc/latexwalker/_defaultspecs.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/latexwalker/_defaultspecs.py rename to src/utilities/external/pylatexenc/latexwalker/_defaultspecs.py diff --git a/src/great_ai/utilities/external/pylatexenc/macrospec/__init__.py b/src/utilities/external/pylatexenc/macrospec/__init__.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/macrospec/__init__.py rename to src/utilities/external/pylatexenc/macrospec/__init__.py diff --git a/src/great_ai/utilities/external/pylatexenc/macrospec/_argparsers.py b/src/utilities/external/pylatexenc/macrospec/_argparsers.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/macrospec/_argparsers.py rename to src/utilities/external/pylatexenc/macrospec/_argparsers.py diff --git a/src/great_ai/utilities/external/pylatexenc/version.py b/src/utilities/external/pylatexenc/version.py similarity index 100% rename from src/great_ai/utilities/external/pylatexenc/version.py rename to src/utilities/external/pylatexenc/version.py diff --git a/src/great_ai/utilities/get_sentences.py b/src/utilities/get_sentences.py similarity index 100% rename from src/great_ai/utilities/get_sentences.py rename to src/utilities/get_sentences.py diff --git a/src/great_ai/utilities/language/__init__.py b/src/utilities/language/__init__.py similarity index 100% rename from src/great_ai/utilities/language/__init__.py rename to src/utilities/language/__init__.py diff --git a/src/great_ai/utilities/language/english_name_of_language.py b/src/utilities/language/english_name_of_language.py similarity index 100% rename from src/great_ai/utilities/language/english_name_of_language.py rename to src/utilities/language/english_name_of_language.py diff --git a/src/great_ai/utilities/language/is_english.py b/src/utilities/language/is_english.py similarity index 100% rename from src/great_ai/utilities/language/is_english.py rename to src/utilities/language/is_english.py diff --git a/src/great_ai/utilities/language/predict_language.py b/src/utilities/language/predict_language.py similarity index 100% rename from src/great_ai/utilities/language/predict_language.py rename to src/utilities/language/predict_language.py diff --git a/src/great_ai/utilities/logger/__init__.py b/src/utilities/logger/__init__.py similarity index 100% rename from src/great_ai/utilities/logger/__init__.py rename to src/utilities/logger/__init__.py diff --git a/src/great_ai/utilities/logger/colors.py b/src/utilities/logger/colors.py similarity index 100% rename from src/great_ai/utilities/logger/colors.py rename to src/utilities/logger/colors.py diff --git a/src/great_ai/utilities/logger/custom_formatter.py b/src/utilities/logger/custom_formatter.py similarity index 100% rename from src/great_ai/utilities/logger/custom_formatter.py rename to src/utilities/logger/custom_formatter.py diff --git a/src/great_ai/utilities/logger/get_logger.py b/src/utilities/logger/get_logger.py similarity index 100% rename from src/great_ai/utilities/logger/get_logger.py rename to src/utilities/logger/get_logger.py diff --git a/src/great_ai/utilities/match_names/__init__.py b/src/utilities/match_names/__init__.py similarity index 100% rename from src/great_ai/utilities/match_names/__init__.py rename to src/utilities/match_names/__init__.py diff --git a/src/great_ai/utilities/match_names/config.py b/src/utilities/match_names/config.py similarity index 100% rename from src/great_ai/utilities/match_names/config.py rename to src/utilities/match_names/config.py diff --git a/src/great_ai/utilities/match_names/match_names.py b/src/utilities/match_names/match_names.py similarity index 100% rename from src/great_ai/utilities/match_names/match_names.py rename to src/utilities/match_names/match_names.py diff --git a/src/great_ai/utilities/match_names/name_parts.py b/src/utilities/match_names/name_parts.py similarity index 100% rename from src/great_ai/utilities/match_names/name_parts.py rename to src/utilities/match_names/name_parts.py diff --git a/src/great_ai/utilities/parallel_map/__init__.py b/src/utilities/parallel_map/__init__.py similarity index 100% rename from src/great_ai/utilities/parallel_map/__init__.py rename to src/utilities/parallel_map/__init__.py diff --git a/src/great_ai/utilities/parallel_map/get_config.py b/src/utilities/parallel_map/get_config.py similarity index 100% rename from src/great_ai/utilities/parallel_map/get_config.py rename to src/utilities/parallel_map/get_config.py diff --git a/src/great_ai/utilities/parallel_map/manage_communication.py b/src/utilities/parallel_map/manage_communication.py similarity index 100% rename from src/great_ai/utilities/parallel_map/manage_communication.py rename to src/utilities/parallel_map/manage_communication.py diff --git a/src/great_ai/utilities/parallel_map/manage_serial.py b/src/utilities/parallel_map/manage_serial.py similarity index 100% rename from src/great_ai/utilities/parallel_map/manage_serial.py rename to src/utilities/parallel_map/manage_serial.py diff --git a/src/great_ai/utilities/parallel_map/mapper_function.py b/src/utilities/parallel_map/mapper_function.py similarity index 100% rename from src/great_ai/utilities/parallel_map/mapper_function.py rename to src/utilities/parallel_map/mapper_function.py diff --git a/src/great_ai/utilities/parallel_map/parallel_map.py b/src/utilities/parallel_map/parallel_map.py similarity index 100% rename from src/great_ai/utilities/parallel_map/parallel_map.py rename to src/utilities/parallel_map/parallel_map.py diff --git a/src/great_ai/utilities/parallel_map/parallel_map_configuration.py b/src/utilities/parallel_map/parallel_map_configuration.py similarity index 100% rename from src/great_ai/utilities/parallel_map/parallel_map_configuration.py rename to src/utilities/parallel_map/parallel_map_configuration.py diff --git a/src/great_ai/utilities/parallel_map/threaded_parallel_map.py b/src/utilities/parallel_map/threaded_parallel_map.py similarity index 100% rename from src/great_ai/utilities/parallel_map/threaded_parallel_map.py rename to src/utilities/parallel_map/threaded_parallel_map.py diff --git a/src/great_ai/utilities/parallel_map/worker_exception.py b/src/utilities/parallel_map/worker_exception.py similarity index 100% rename from src/great_ai/utilities/parallel_map/worker_exception.py rename to src/utilities/parallel_map/worker_exception.py diff --git a/src/great_ai/utilities/unchunk.py b/src/utilities/unchunk.py similarity index 100% rename from src/great_ai/utilities/unchunk.py rename to src/utilities/unchunk.py diff --git a/src/utilities/unique.py b/src/utilities/unique.py new file mode 100644 index 0000000..58b852c --- /dev/null +++ b/src/utilities/unique.py @@ -0,0 +1,27 @@ +from typing import Any, Callable, Iterable, List + + +def unique( + values: Iterable[Any], *, key: Callable[[Any], Any] = lambda v: v +) -> List[Any]: + """Only keep first occurrences while maintaining original order. + + The equality check used for deduplication can be overridden using the `key` argument. + + Examples: + >>> unique([1, 1, 5, 3, 3]) + [1, 5, 3] + >>> unique([{'a': 1, 'b': 2}, {'a': 1, 'b': 3}], key=lambda v: v['a']) + [{'a': 1, 'b': 2}] + >>> unique([{'a': 1, 'b': 2}, {'a': 1, 'b': 3}], key=lambda v: v['b']) + [{'a': 1, 'b': 3}, {'a': 1, 'b': 3}] + """ + + key_values = {} + for v in values: + k = key(v) + if k not in key_values: + # dicts maintain insertion order: https://mail.python.org/pipermail/python-dev/2017-December/151283.html + key_values[k] = v + + return list(key_values.values()) diff --git a/tests/large_file/test_human_readable_to_byte.py b/tests/large_file/test_human_readable_to_byte.py index cc0e995..a36ab96 100644 --- a/tests/large_file/test_human_readable_to_byte.py +++ b/tests/large_file/test_human_readable_to_byte.py @@ -1,6 +1,6 @@ import unittest -from src.great_ai.large_file.helper import human_readable_to_byte +from src.large_file.helper import human_readable_to_byte class TestHumanReadableToByte(unittest.TestCase): diff --git a/tests/large_file/test_large_file.py b/tests/large_file/test_large_file.py index 929529d..68e4a10 100644 --- a/tests/large_file/test_large_file.py +++ b/tests/large_file/test_large_file.py @@ -8,7 +8,7 @@ import boto3 PATH = Path(__file__).parent.resolve() -from src.great_ai import LargeFileS3 +from src.large_file import LargeFileS3 credentials = { "aws_region_name": "your_region_like_eu-west-2", diff --git a/tests/utilities/test_chunk.py b/tests/utilities/test_chunk.py index 2a80579..1a814d5 100644 --- a/tests/utilities/test_chunk.py +++ b/tests/utilities/test_chunk.py @@ -2,7 +2,7 @@ import unittest import pytest -from src.great_ai.utilities import chunk +from src.utilities import chunk class TestChunk(unittest.TestCase): diff --git a/tests/utilities/test_clean.py b/tests/utilities/test_clean.py index 500cada..dd6595f 100644 --- a/tests/utilities/test_clean.py +++ b/tests/utilities/test_clean.py @@ -1,6 +1,6 @@ import unittest -from src.great_ai.utilities import clean +from src.utilities import clean class TestClean(unittest.TestCase): diff --git a/tests/utilities/test_config_file.py b/tests/utilities/test_config_file.py index 5b55843..dfa8ffd 100644 --- a/tests/utilities/test_config_file.py +++ b/tests/utilities/test_config_file.py @@ -4,7 +4,7 @@ from pathlib import Path import pytest -from src.great_ai.utilities import ConfigFile +from src.utilities import ConfigFile DATA_PATH = Path(__file__).parent.resolve() / "data" diff --git a/tests/utilities/test_evaluate_ranking.py b/tests/utilities/test_evaluate_ranking.py index 60d8226..9b54378 100644 --- a/tests/utilities/test_evaluate_ranking.py +++ b/tests/utilities/test_evaluate_ranking.py @@ -5,7 +5,7 @@ import matplotlib matplotlib.use("Agg") # don't show a window for each test -from src.great_ai.utilities import evaluate_ranking +from src.utilities import evaluate_ranking class TestEvaluateRanking(unittest.TestCase): diff --git a/tests/utilities/test_get_sentences.py b/tests/utilities/test_get_sentences.py index 7d864f3..f26ae0f 100644 --- a/tests/utilities/test_get_sentences.py +++ b/tests/utilities/test_get_sentences.py @@ -1,6 +1,6 @@ import unittest -from src.great_ai.utilities import get_sentences +from src.utilities import get_sentences class TestGetSentences(unittest.TestCase): diff --git a/tests/utilities/test_language.py b/tests/utilities/test_language.py index 7aabac1..67d2bd4 100644 --- a/tests/utilities/test_language.py +++ b/tests/utilities/test_language.py @@ -1,10 +1,6 @@ import unittest -from src.great_ai.utilities import ( - english_name_of_language, - is_english, - predict_language, -) +from src.utilities import english_name_of_language, is_english, predict_language class TestLanguage(unittest.TestCase): diff --git a/tests/utilities/test_match_names.py b/tests/utilities/test_match_names.py index 5ee8d39..2c0c57a 100644 --- a/tests/utilities/test_match_names.py +++ b/tests/utilities/test_match_names.py @@ -1,6 +1,6 @@ import unittest -from src.great_ai.utilities import match_names +from src.utilities import match_names class TestMatchNames(unittest.TestCase): diff --git a/tests/utilities/test_parallel_map.py b/tests/utilities/test_parallel_map.py index 7900d60..0395fdb 100644 --- a/tests/utilities/test_parallel_map.py +++ b/tests/utilities/test_parallel_map.py @@ -2,7 +2,7 @@ import unittest import pytest -from src.great_ai.utilities import WorkerException, parallel_map +from src.utilities import WorkerException, parallel_map COUNT = int(1e5) + 3 diff --git a/tests/utilities/test_threaded_parallel_map.py b/tests/utilities/test_threaded_parallel_map.py index d421e90..485997d 100644 --- a/tests/utilities/test_threaded_parallel_map.py +++ b/tests/utilities/test_threaded_parallel_map.py @@ -2,7 +2,7 @@ import unittest import pytest -from src.great_ai.utilities import WorkerException, threaded_parallel_map +from src.utilities import WorkerException, threaded_parallel_map COUNT = int(1e5) + 3 diff --git a/tests/utilities/test_unique.py b/tests/utilities/test_unique.py index e2204db..f1f82b8 100644 --- a/tests/utilities/test_unique.py +++ b/tests/utilities/test_unique.py @@ -1,6 +1,6 @@ import unittest -from src.great_ai.utilities import unique +from src.utilities import unique original = [ ("a", 1),