mirror of https://gitlab.com/pamhyr/pamhyr2
pamhyr: Fix pep8.
parent
328f5656bf
commit
5525fff1fe
|
|
@ -75,6 +75,7 @@ class Friction(SQLSubModel):
|
|||
cls._db_update_to_0_1_0(execute, data)
|
||||
|
||||
return cls._update_submodel(execute, version, data)
|
||||
|
||||
@classmethod
|
||||
def _db_update_to_0_1_0(cls, execute, data):
|
||||
table = "friction"
|
||||
|
|
@ -125,7 +126,8 @@ class Friction(SQLSubModel):
|
|||
if int(begin_strickler_pid) != -1:
|
||||
begin_strickler = next(
|
||||
filter(
|
||||
lambda s: s.pamhyr_id == begin_strickler_pid, stricklers
|
||||
lambda s: s.pamhyr_id == begin_strickler_pid,
|
||||
stricklers
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Data(SQLSubModel):
|
|||
@classmethod
|
||||
def _db_create(cls, execute, ext=""):
|
||||
execute(f"""
|
||||
CREATE TABLE initial_conditions(
|
||||
CREATE TABLE initial_conditions{ext} (
|
||||
{cls.create_db_add_pamhyr_id()},
|
||||
ind INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
|
|
|
|||
|
|
@ -251,7 +251,8 @@ class LateralContribution(SQLSubModel):
|
|||
tab = data["tab"]
|
||||
|
||||
table = execute(
|
||||
"SELECT pamhyr_id, name, type, reach, begin_section, end_section " +
|
||||
"SELECT pamhyr_id, name, type, " +
|
||||
"reach, begin_section, end_section " +
|
||||
f"FROM lateral_contribution WHERE tab = '{tab}'"
|
||||
)
|
||||
|
||||
|
|
@ -268,7 +269,12 @@ class LateralContribution(SQLSubModel):
|
|||
lc._end_section = None
|
||||
|
||||
if row[3] != -1:
|
||||
lc.reach = next(filter(lambda e: e.id == row[3], data["edges"]))
|
||||
lc.reach = next(
|
||||
filter(
|
||||
lambda e: e.id == row[3],
|
||||
data["edges"]
|
||||
)
|
||||
)
|
||||
lc._begin_section = lc.reach.profile(row[4])
|
||||
lc._end_section = lc.reach.profile(row[5])
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from Model.Scenario import Scenario
|
|||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class Data(SQLSubModel):
|
||||
_sub_classes = []
|
||||
|
||||
|
|
@ -126,7 +127,6 @@ class Data(SQLSubModel):
|
|||
")"
|
||||
)
|
||||
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self._data[key]
|
||||
|
||||
|
|
@ -175,7 +175,6 @@ class Reservoir(SQLSubModel):
|
|||
|
||||
return cls._update_submodel(execute, version, data)
|
||||
|
||||
|
||||
@classmethod
|
||||
def _db_update_to_0_1_0(cls, execute, data):
|
||||
table = "reservoir"
|
||||
|
|
|
|||
|
|
@ -123,7 +123,8 @@ class RiverNode(Node, SQLSubModel):
|
|||
|
||||
def _db_save(self, execute, data=None):
|
||||
execute(
|
||||
"INSERT OR REPLACE INTO river_node(pamhyr_id, name, x, y) VALUES (" +
|
||||
"INSERT OR REPLACE INTO river_node(pamhyr_id, name, x, y) " +
|
||||
"VALUES (" +
|
||||
f"{self._pamhyr_id}, " +
|
||||
f"'{self._db_format(self.name)}', " +
|
||||
f"{self.x}, {self.y}" +
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ class Scenario(SQLSubModel):
|
|||
if self.parent is not None:
|
||||
parent = self.parent._id
|
||||
|
||||
sql = (
|
||||
execute(
|
||||
"INSERT OR REPLACE INTO " +
|
||||
"scenario(id, name, description, revision, parent_id) " +
|
||||
"VALUES (" +
|
||||
|
|
@ -156,7 +156,6 @@ class Scenario(SQLSubModel):
|
|||
f"{parent}" +
|
||||
")"
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ class SedimentLayer(SQLSubModel):
|
|||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"SL{self.id + 1}"
|
||||
return f"SL #{self.pamhyr_id}"
|
||||
|
||||
return self._name
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue