Skip to content

Commit

Permalink
Reformat source code with latest Black (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Apr 30, 2024
2 parents 67cf3b7 + 2c0e9ec commit 9f047a4
Show file tree
Hide file tree
Showing 26 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ ignore_errors = true

[tool.black]
line-length = 120
exclude = '\.git'
exclude = '\.git|version.py'
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2019-09-20 13:04:52.423483
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-03-07 14:55:32.802765
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.automap import automap_base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-10-05 14:51:13.787685
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
branch_labels = None
depends_on = None

LONGTEXT_LENGTH = 2 ** 32 - 1
LONGTEXT_LENGTH = 2**32 - 1


def upgrade():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-03-05 14:04:00.854936
"""

from datetime import datetime, timezone
from alembic import op
import sqlalchemy as sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2019-01-25 15:47:05.100028
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-10-30 17:11:23.316879
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-02-09 06:48:46.585108
"""

from alembic import op
import sqlalchemy as sa
from spinedb_api.helpers import naming_convention
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-01-05 09:18:48.858784
"""

from alembic import op
from spinedb_api.helpers import naming_convention

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-02-15 15:41:06.794006
"""

from alembic import op
from spinedb_api.helpers import naming_convention

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-01-12 09:55:08.934574
"""

from alembic import op
import sqlalchemy as sa
import sqlalchemy.orm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2019-01-24 16:47:21.493240
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-03-14 11:33:13.777028
"""

from alembic import op
from sqlalchemy import MetaData
from sqlalchemy.sql.expression import bindparam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-06-09 21:31:07.912724
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2019-09-17 13:38:53.437119
"""

from datetime import datetime
from alembic import op
import sqlalchemy as sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2019-03-26 15:34:26.550171
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-09-21 14:35:28.867803
"""

from alembic import op
import sqlalchemy as sa
from spinedb_api.compatibility import convert_tool_feature_method_to_entity_alternative
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-09-01 20:12:57.300147
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-01-05 10:40:16.720937
"""

from alembic import op
from sqlalchemy import Text
from spinedb_api.helpers import LONGTEXT_LENGTH, naming_convention
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-01-05 11:00:31.154790
"""

from alembic import op
from spinedb_api.helpers import naming_convention

Expand Down
8 changes: 5 additions & 3 deletions spinedb_api/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ def convert_tool_feature_method_to_active_by_default(conn, use_existing_tool_fea
# where active_by_default is True if the value of 'is_active' is the one from the tool_feature_method specification
entity_class_items_to_update = {
x["entity_class_id"]: {
"active_by_default": False
if x["list_value_id"] is None
else x["list_value_id"] == lv_id_by_pdef_id[x["parameter_definition_id"]],
"active_by_default": (
False
if x["list_value_id"] is None
else x["list_value_id"] == lv_id_by_pdef_id[x["parameter_definition_id"]]
),
}
for x in is_active_default_vals
}
Expand Down
1 change: 1 addition & 0 deletions spinedb_api/db_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ def get_filter_configs(self):
setattr(DatabaseMapping, "remove_" + it + "_item", partialmethod(DatabaseMapping.remove_item, it))
setattr(DatabaseMapping, "restore_" + it + "_item", partialmethod(DatabaseMapping.restore_item, it))


# Astroid transform so DatabaseMapping looks like it has the convenience methods defined above
def _add_convenience_methods(node):
if node.name != "DatabaseMapping":
Expand Down
2 changes: 1 addition & 1 deletion spinedb_api/graph_layout_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def compute_layout(self):
heavy_pos = arr(heavy_pos_list)
if heavy_ind.any():
layout[heavy_ind, :] = heavy_pos
weights = matrix ** self.weight_exp # bus-pair weights (lower for distant buses)
weights = matrix**self.weight_exp # bus-pair weights (lower for distant buses)
maxstep = 1 / np.min(weights[mask])
minstep = 1 / np.max(weights[mask])
lambda_ = np.log(minstep / maxstep) / (self.max_iters - 1) # exponential decay of allowed adjustment
Expand Down
2 changes: 1 addition & 1 deletion spinedb_api/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

model_meta = MetaData(naming_convention=naming_convention)

LONGTEXT_LENGTH = 2 ** 32 - 1
LONGTEXT_LENGTH = 2**32 - 1


def name_from_elements(elements):
Expand Down
2 changes: 1 addition & 1 deletion spinedb_api/spine_io/gdx_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _python_interpreter_bitness():
"""Returns 64 for 64bit Python interpreter or 32 for 32bit interpreter."""
# As recommended in Python's docs:
# https://docs.python.org/3/library/platform.html#cross-platform
return 64 if sys.maxsize > 2 ** 32 else 32
return 64 if sys.maxsize > 2**32 else 32


def _windows_dlls_exist(gams_path):
Expand Down

0 comments on commit 9f047a4

Please sign in to comment.