Skip to content

Commit

Permalink
fixes slots class and test
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed Mar 23, 2024
1 parent e6686db commit 409abae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
6 changes: 1 addition & 5 deletions dlt/extract/hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ class TResourceHints(TypedDict, total=False):


class HintsMeta:
__slots__ = ["hints", "create_table_variant"]

hints: TResourceHints
create_table_variant: bool
__slots__ = ("hints", "create_table_variant")

def __init__(self, hints: TResourceHints, create_table_variant: bool) -> None:
self.hints = hints
Expand Down Expand Up @@ -169,7 +166,6 @@ def compute_table_schema(self, item: TDataItem = None, meta: Any = None) -> TTab
table_template = self._clone_hints(table_template)
if "name" not in table_template:
table_template["name"] = self.name
# table_template["columns"] = copy(self._hints["columns"])

# if table template present and has dynamic hints, the data item must be provided.
if self._table_name_hint_fun and item is None:
Expand Down
9 changes: 2 additions & 7 deletions dlt/extract/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,15 @@ class SourcePipeItem(NamedTuple):


class DataItemWithMeta:
__slots__ = ["meta", "data"]

# meta: Any
# data: TDataItems
__slots__ = ("meta", "data")

def __init__(self, meta: Any, data: TDataItems) -> None:
self.meta = meta
self.data = data


class TableNameMeta:
__slots__ = ["table_name"]

# table_name: str
__slots__ = ("table_name",)

def __init__(self, table_name: str) -> None:
self.table_name = table_name
Expand Down
2 changes: 1 addition & 1 deletion tests/pipeline/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ def items2():
p.extract(items2)
p.normalize()
# c3 was first so goes first
assert list(p.default_schema.get_table_columns("items").keys()) == [
assert list(p.default_schema.get_table_columns("items2").keys()) == [
"c3",
"c1",
"c2",
Expand Down

0 comments on commit 409abae

Please sign in to comment.