mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Use black with -l 120 param.
This commit is contained in:
1 parent
f928738bd5
commit
c021e21309
194 files changed
+6034
-4564
No files matched your search
@@ -26,11 +26,9 @@ from sqlalchemy.ext.declarative import as_declarative
|
||||
|
||||
@as_declarative()
|
||||
class Base:
|
||||
|
||||
def asdict(self):
|
||||
|
||||
return {c.key: getattr(self, c.key)
|
||||
for c in inspect(self).mapper.column_attrs}
|
||||
return {c.key: getattr(self, c.key) for c in inspect(self).mapper.column_attrs}
|
||||
|
||||
def asjson(self):
|
||||
|
||||
@@ -47,7 +45,7 @@ class GUID(TypeDecorator):
|
||||
impl = CHAR
|
||||
|
||||
def load_dialect_impl(self, dialect):
|
||||
if dialect.name == 'postgresql':
|
||||
if dialect.name == "postgresql":
|
||||
return dialect.type_descriptor(UUID())
|
||||
else:
|
||||
return dialect.type_descriptor(CHAR(32))
|
||||
@@ -55,7 +53,7 @@ class GUID(TypeDecorator):
|
||||
def process_bind_param(self, value, dialect):
|
||||
if value is None:
|
||||
return value
|
||||
elif dialect.name == 'postgresql':
|
||||
elif dialect.name == "postgresql":
|
||||
return str(value)
|
||||
else:
|
||||
if not isinstance(value, uuid.UUID):
|
||||
@@ -78,9 +76,7 @@ class BaseTable(Base):
|
||||
__abstract__ = True
|
||||
|
||||
created_at = Column(DateTime, default=func.current_timestamp())
|
||||
updated_at = Column(DateTime,
|
||||
default=func.current_timestamp(),
|
||||
onupdate=func.current_timestamp())
|
||||
updated_at = Column(DateTime, default=func.current_timestamp(), onupdate=func.current_timestamp())
|
||||
|
||||
|
||||
def generate_uuid():
|
||||
|
||||
Reference in new issue
Block a user