Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 8, 2024
1 parent 58553fb commit 9d85447
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 24 deletions.
1 change: 1 addition & 0 deletions pydtk/db/schemas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Schemas."""

import glob
import importlib
import inspect
Expand Down
8 changes: 5 additions & 3 deletions pydtk/db/v1/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def _get_uuid_from_item(self, item):
"""
pre_hash = "".join(
[
"{:.09f}".format(item[c["name"]])
if isinstance(item[c["name"]], float)
else str(item[c["name"]])
(
"{:.09f}".format(item[c["name"]])
if isinstance(item[c["name"]], float)
else str(item[c["name"]])
)
for c in self.columns
if c["name"] in item.keys()
]
Expand Down
12 changes: 6 additions & 6 deletions pydtk/db/v2/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ def _initialize_engine(
engine = (
"postgresql"
if engine == "timescaledb"
else "mysql"
if engine == "mariadb"
else engine
else "mysql" if engine == "mariadb" else engine
)
username_and_password = (
""
Expand Down Expand Up @@ -214,9 +212,11 @@ def _get_uuid_from_item(self, data_in):

pre_hash = "".join(
[
"{:.09f}".format(item[c["name"]])
if isinstance(item[c["name"]], float)
else str(item[c["name"]])
(
"{:.09f}".format(item[c["name"]])
if isinstance(item[c["name"]], float)
else str(item[c["name"]])
)
for c in self.columns
if c["name"] in item.keys()
]
Expand Down
8 changes: 5 additions & 3 deletions pydtk/db/v3/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ def _get_uuid_from_item(self, data_in):

pre_hash = "".join(
[
"{:.09f}".format(item[column])
if isinstance(item[column], float)
else str(item[column])
(
"{:.09f}".format(item[column])
if isinstance(item[column], float)
else str(item[column])
)
for column in hash_target_columns
if column in item.keys()
]
Expand Down
14 changes: 9 additions & 5 deletions pydtk/db/v4/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,15 @@ def _get_uuid_from_item(self, data_in):

pre_hash = "".join(
[
"{:.09f}".format(item[column])
if isinstance(item[column], float)
else str(item[column].keys())
if isinstance(item[column], dict)
else str(item[column])
(
"{:.09f}".format(item[column])
if isinstance(item[column], float)
else (
str(item[column].keys())
if isinstance(item[column], dict)
else str(item[column])
)
)
for column in hash_target_columns
if column in item.keys()
]
Expand Down
12 changes: 6 additions & 6 deletions pydtk/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ def to_dict(self):
elif isinstance(value, dict):
result[attr] = dict(
map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict")
else item,
lambda item: (
(item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item
),
value.items(),
)
)
Expand Down Expand Up @@ -527,9 +527,9 @@ def to_dict(self):
elif isinstance(value, dict):
result[attr] = dict(
map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict")
else item,
lambda item: (
(item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item
),
value.items(),
)
)
Expand Down
1 change: 0 additions & 1 deletion pydtk/utils/imports.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Import utilities."""


import importlib
import importlib.util

Expand Down

0 comments on commit 9d85447

Please sign in to comment.