Skip to content

Commit

Permalink
Formatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki committed Nov 22, 2024
1 parent c0ef88e commit 5921a98
Show file tree
Hide file tree
Showing 41 changed files with 132 additions and 98 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

import exasol.bucketfs as bfs # type: ignore[import-untyped]
import exasol.bucketfs as bfs # type: ignore[import-untyped]

from exasol.analytics.query_handler.context.proxy.object_proxy import ObjectProxy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC
from typing import Callable, List, Set

import exasol.bucketfs as bfs # type: ignore[import-untyped]
import exasol.bucketfs as bfs # type: ignore[import-untyped]

from exasol.analytics.query_handler.context.connection_name import (
ConnectionName,
Expand Down
6 changes: 5 additions & 1 deletion exasol/analytics/query_handler/deployment/deploy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import logging

import click
from exasol.python_extension_common.deployment.language_container_deployer_cli import ( CustomizableParameters, language_container_deployer_main, slc_parameter_formatters, ) # type: ignore[import-untyped]
from exasol.python_extension_common.deployment.language_container_deployer_cli import ( # type: ignore[import-untyped]
CustomizableParameters,
language_container_deployer_main,
slc_parameter_formatters,
)

from exasol.analytics.query_handler.deployment import scripts_deployer_cli
from exasol.analytics.query_handler.deployment.slc import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

import pyexasol # type: ignore[import-untyped]
import pyexasol # type: ignore[import-untyped]

from exasol.analytics.query_handler.deployment import constants, utils
from exasol.analytics.query_handler.deployment.aaf_exasol_lua_script_generator import (
Expand Down
5 changes: 4 additions & 1 deletion exasol/analytics/query_handler/deployment/slc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from contextlib import contextmanager

from exasol.python_extension_common.deployment.language_container_builder import ( LanguageContainerBuilder, find_path_backwards, ) # type: ignore[import-untyped]
from exasol.python_extension_common.deployment.language_container_builder import ( # type: ignore[import-untyped]
LanguageContainerBuilder,
find_path_backwards,
)

LANGUAGE_ALIAS = "PYTHON3_AAF"
SLC_NAME = "exasol_advanced_analytics_framework_container"
Expand Down
2 changes: 1 addition & 1 deletion exasol/analytics/query_handler/graph/execution_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import typing
from typing import Generic, List, Set, Tuple, TypeVar

import networkx as nx # type: ignore[import-untyped]
import networkx as nx # type: ignore[import-untyped]

T = TypeVar("T")

Expand Down
8 changes: 4 additions & 4 deletions exasol/analytics/query_handler/graph/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def _configured_new(cls: Type[_T]):
"""This function is called for subclasses of classes that declare _Meta as their metaclass."""
return _new(cls, result_type)

result_type.__new__ = _configured_new # type: ignore
result_type.__init__ = _init # type: ignore
result_type.__setattr__ = _setattr # type: ignore
result_type.__delattr__ = _delattr # type: ignore
result_type.__new__ = _configured_new # type: ignore
result_type.__init__ = _init # type: ignore
result_type.__setattr__ = _setattr # type: ignore
result_type.__delattr__ = _delattr # type: ignore
return result_type


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dataclasses

import exasol.bucketfs as bfs # type: ignore[import-untyped]
import exasol.bucketfs as bfs # type: ignore[import-untyped]

from exasol.analytics.query_handler.graph.stage.sql.input_output import (
SQLStageInputOutput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
self._create_current_query_handler()

def get_current_query_handler(
self
self,
) -> QueryHandler[List[SQLStageInputOutput], SQLStageInputOutput]:
value = self._current_query_handler
if value is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from abc import ABC
from typing import List, Sized

from exasol_bucketfs_utils_python.abstract_bucketfs_location import AbstractBucketFSLocation # type: ignore[import-untyped]
from exasol_bucketfs_utils_python.abstract_bucketfs_location import ( # type: ignore[import-untyped]
AbstractBucketFSLocation,
)

from exasol.analytics.query_handler.graph.stage.sql.input_output import (
SQLStageInputOutput,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, Iterator, List, Optional, Tuple, Union

import pandas as pd # type: ignore[import-untyped]
from exasol_udf_mock_python.column import Column # type: ignore[import-untyped]
import pandas as pd # type: ignore[import-untyped]
from exasol_udf_mock_python.column import Column # type: ignore[import-untyped]

from exasol.analytics.query_handler.query.result.interface import QueryResult, Row

Expand Down Expand Up @@ -52,9 +52,7 @@ def _range(self, num_rows: Union[int, str]) -> range:
return range(num_rows - 1)
if num_rows == "all":
return range(len(self._data) - 1)
raise ValueError(
f'num_rows must be an int or str "all" but is {num_rows}'
)
raise ValueError(f'num_rows must be an int or str "all" but is {num_rows}')

def fetch_as_dataframe(
self, num_rows: Union[int, str], start_col=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def rowcount(self) -> int:

def fetch_as_dataframe(
self, num_rows: Union[str, int], start_col: int = 0
) -> "pandas.DataFrame": # type: ignore
) -> "pandas.DataFrame": # type: ignore
df = self._ctx.get_dataframe(num_rows, start_col=self._start_col)
self._initialized = True
if df is None:
Expand Down
2 changes: 1 addition & 1 deletion exasol/analytics/query_handler/udf/runner/call_udf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from exasol.analytics.query_handler.udf.runner.udf import QueryHandlerRunnerUDF

udf = QueryHandlerRunnerUDF(exa) # type: ignore
udf = QueryHandlerRunnerUDF(exa) # type: ignore


def run(ctx):
Expand Down
25 changes: 11 additions & 14 deletions exasol/analytics/query_handler/udf/runner/udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from io import BytesIO
from typing import Any, List, Optional, Tuple

import exasol.bucketfs as bfs # type: ignore[import-untyped]
import joblib # type: ignore[import-untyped]
import exasol.bucketfs as bfs # type: ignore[import-untyped]
import joblib # type: ignore[import-untyped]

from exasol.analytics.query_handler.context.scope import ScopeQueryHandlerContext
from exasol.analytics.query_handler.udf.interface import UDFQueryHandlerFactory
from exasol.analytics.query_handler.context.top_level_query_handler_context import (
TopLevelQueryHandlerContext,
)
Expand All @@ -21,6 +20,7 @@
from exasol.analytics.query_handler.query.select import SelectQueryWithColumnDefinition
from exasol.analytics.query_handler.result import Continue, Finish, Result
from exasol.analytics.query_handler.udf.connection_lookup import UDFConnectionLookup
from exasol.analytics.query_handler.udf.interface import UDFQueryHandlerFactory
from exasol.analytics.query_handler.udf.runner.state import QueryHandlerRunnerState
from exasol.analytics.schema import (
Column,
Expand Down Expand Up @@ -192,7 +192,9 @@ def handle_query_handler_result_continue(
)
self.release_and_create_query_handler_context_if_input_query(current_state)
if current_state.input_query_query_handler_context is None:
raise UninitializedAttributeError("Current state has no input query handler context.")
raise UninitializedAttributeError(
"Current state has no input query handler context."
)
udf_result.input_query_view, udf_result.input_query = self._wrap_return_query(
current_state.input_query_query_handler_context,
query_handler_result.input_query,
Expand Down Expand Up @@ -230,9 +232,7 @@ def _get_parameter(self, ctx) -> UDFParameter:
)

def _create_bucketfs_location(self) -> bfs.path.PathLike:
bfscon = self.exa.get_connection(
self.parameter.temporary_bfs_location_conn
)
bfscon = self.exa.get_connection(self.parameter.temporary_bfs_location_conn)
bfs_location = create_bucketfs_location_from_conn_object(bfscon)
return bfs_location.joinpath(
self.parameter.temporary_bfs_location_directory
Expand All @@ -249,15 +249,11 @@ def _create_state_or_load_latest_state(self) -> QueryHandlerRunnerState:
def _query_handler_factory(self) -> UDFQueryHandlerFactory:
module_name = self.parameter.python_class_module
if not module_name:
raise ValueError(
"UDFQueryHandler parameters must define a python module"
)
raise ValueError("UDFQueryHandler parameters must define a python module")
module = importlib.import_module(module_name)
class_name = self.parameter.python_class_name
if not class_name:
raise ValueError(
"UDFQueryHandler parameters must define a factory class"
)
raise ValueError("UDFQueryHandler parameters must define a factory class")
factory = getattr(module, class_name)
if not factory:
raise ValueError(
Expand All @@ -277,7 +273,8 @@ def _create_state(self) -> QueryHandlerRunnerState:
)
str_parameter = self.parameter.parameter or ""
query_handler_obj = self._query_handler_factory.create(
str_parameter, context,
str_parameter,
context,
)
query_handler_state = QueryHandlerRunnerState(
top_level_query_handler_context=context,
Expand Down
14 changes: 10 additions & 4 deletions exasol/analytics/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@
from exasol.analytics.schema.column_name_builder import ColumnNameBuilder
from exasol.analytics.schema.column_type import ColumnType
from exasol.analytics.schema.connection_object_name import ConnectionObjectName
from exasol.analytics.schema.connection_object_name_builder import ConnectionObjectNameBuilder
from exasol.analytics.schema.connection_object_name_builder import (
ConnectionObjectNameBuilder,
)
from exasol.analytics.schema.connection_object_name_impl import ConnectionObjectNameImpl
from exasol.analytics.schema.dbobject import DBObject
from exasol.analytics.schema.dbobject_name import DBObjectName
from exasol.analytics.schema.dbobject_name_impl import DBObjectNameImpl
from exasol.analytics.schema.dbobject_name_with_schema import DBObjectNameWithSchema
from exasol.analytics.schema.dbobject_name_with_schema_impl import DBObjectNameWithSchemaImpl
from exasol.analytics.schema.dbobject_name_with_schema_impl import (
DBObjectNameWithSchemaImpl,
)
from exasol.analytics.schema.exasol_identifier import ExasolIdentifier
from exasol.analytics.schema.exasol_identifier_impl import ExasolIdentifierImpl
from exasol.analytics.schema.exasol_identifier_impl import UnicodeCategories
from exasol.analytics.schema.exasol_identifier_impl import (
ExasolIdentifierImpl,
UnicodeCategories,
)
from exasol.analytics.schema.experiment_name import ExperimentName
from exasol.analytics.schema.schema_name import SchemaName
from exasol.analytics.schema.table import Table
Expand Down
4 changes: 2 additions & 2 deletions exasol/analytics/schema/column_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Union

from typeguard import TypeCheckError

from exasol.analytics.schema.column import Column
Expand All @@ -9,8 +10,7 @@
class ColumnBuilder:
def __init__(self, column: Union[Column, None] = None):
self._name, self._type = (
(None, None) if column is None
else (column.name, column.type)
(None, None) if column is None else (column.name, column.type)
)

def with_name(self, name: ColumnName) -> "ColumnBuilder":
Expand Down
7 changes: 4 additions & 3 deletions exasol/analytics/schema/column_name.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from typeguard import typechecked
from typing import Optional

from exasol.analytics.schema.exasol_identifier import ExasolIdentifier
from typeguard import typechecked

from exasol.analytics.schema.exasol_identifier import ExasolIdentifier, qualified_name
from exasol.analytics.schema.exasol_identifier_impl import ExasolIdentifierImpl
from exasol.analytics.schema.table_like_name import TableLikeName
from exasol.analytics.utils.hash_generation_for_object import generate_hash_for_object
from exasol.analytics.utils.repr_generation_for_object import generate_repr_for_object
from exasol.analytics.schema.exasol_identifier import qualified_name


class ColumnName(ExasolIdentifierImpl):
@typechecked
Expand Down
1 change: 1 addition & 0 deletions exasol/analytics/schema/column_name_builder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Optional

from typeguard import TypeCheckError

from exasol.analytics.schema.column_name import ColumnName
from exasol.analytics.schema.table_like_name import TableLikeName

Expand Down
3 changes: 2 additions & 1 deletion exasol/analytics/schema/dbobject_name_impl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typeguard import typechecked
from typing import Optional

from typeguard import typechecked

from exasol.analytics.schema.dbobject_name import DBObjectName
from exasol.analytics.schema.exasol_identifier_impl import ExasolIdentifierImpl
from exasol.analytics.utils.hash_generation_for_object import generate_hash_for_object
Expand Down
2 changes: 1 addition & 1 deletion exasol/analytics/schema/dbobject_name_with_schema_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from exasol.analytics.schema.dbobject_name_impl import DBObjectNameImpl
from exasol.analytics.schema.dbobject_name_with_schema import DBObjectNameWithSchema
from exasol.analytics.schema.exasol_identifier import qualified_name
from exasol.analytics.schema.schema_name import SchemaName
from exasol.analytics.utils.hash_generation_for_object import generate_hash_for_object
from exasol.analytics.utils.repr_generation_for_object import generate_repr_for_object
from exasol.analytics.schema.exasol_identifier import qualified_name


class DBObjectNameWithSchemaImpl(DBObjectNameImpl, DBObjectNameWithSchema):
Expand Down
1 change: 1 addition & 0 deletions exasol/analytics/schema/exasol_identifier.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from abc import ABC, abstractmethod
from typing import Optional


class ExasolIdentifier(ABC):

@property
Expand Down
2 changes: 1 addition & 1 deletion exasol/analytics/schema/exasol_identifier_impl.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unicodedata
from typing import Optional

from typeguard import typechecked
from typing import Optional

from exasol.analytics.schema.exasol_identifier import ExasolIdentifier

Expand Down
8 changes: 3 additions & 5 deletions exasol/analytics/schema/table_builder.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
from typing import List, Union

from typeguard import TypeCheckError

from exasol.analytics.schema.column import Column
from exasol.analytics.schema.table import Table
from exasol.analytics.schema.table_name import TableName
from typeguard import TypeCheckError


class TableBuilder:
def __init__(self, table: Union[Table, None] = None):
self._name, self._columns = (
(table.name, table.columns) if table
else (None, [])
)
self._name, self._columns = (table.name, table.columns) if table else (None, [])

def with_name(self, name: TableName) -> "TableBuilder":
self._name = name
Expand Down
4 changes: 3 additions & 1 deletion exasol/analytics/schema/table_like_name_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from typeguard import typechecked

from exasol.analytics.schema.dbobject_name_with_schema_impl import DBObjectNameWithSchemaImpl
from exasol.analytics.schema.dbobject_name_with_schema_impl import (
DBObjectNameWithSchemaImpl,
)
from exasol.analytics.schema.schema_name import SchemaName
from exasol.analytics.schema.table_like_name import TableLikeName

Expand Down
3 changes: 2 additions & 1 deletion exasol/analytics/schema/table_name_builder.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Optional, Union

from typeguard import TypeCheckError

from exasol.analytics.schema.schema_name import SchemaName
from exasol.analytics.schema.table_name import TableName
from exasol.analytics.schema.table_name_impl import TableNameImpl
from typeguard import TypeCheckError


class TableNameBuilder:
Expand Down
3 changes: 2 additions & 1 deletion exasol/analytics/schema/udf_name_builder.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Optional

from typeguard import TypeCheckError

from exasol.analytics.schema.schema_name import SchemaName
from exasol.analytics.schema.udf_name import UDFName
from exasol.analytics.schema.udf_name_impl import UDFNameImpl
from typeguard import TypeCheckError


class UDFNameBuilder:
Expand Down
4 changes: 3 additions & 1 deletion exasol/analytics/schema/udf_name_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from typeguard import typechecked

from exasol.analytics.schema.dbobject_name_with_schema_impl import DBObjectNameWithSchemaImpl
from exasol.analytics.schema.dbobject_name_with_schema_impl import (
DBObjectNameWithSchemaImpl,
)
from exasol.analytics.schema.schema_name import SchemaName
from exasol.analytics.schema.udf_name import UDFName

Expand Down
3 changes: 2 additions & 1 deletion exasol/analytics/schema/view_name_builder.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Optional

from typeguard import TypeCheckError

from exasol.analytics.schema.schema_name import SchemaName
from exasol.analytics.schema.view_name import ViewName
from exasol.analytics.schema.view_name_impl import ViewNameImpl
from typeguard import TypeCheckError


class ViewNameBuilder:
Expand Down
Loading

0 comments on commit 5921a98

Please sign in to comment.