fix pylint W0102 (dangerous-default-value)

This commit is contained in:
Pavol Rusnak 2023-01-21 12:16:31 +00:00
parent 906d91bcf1
commit 9fa3e5c6cf
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 8 additions and 9 deletions

View File

@ -89,13 +89,12 @@ def url_for(endpoint: str, external: Optional[bool] = False, **params: Any) -> s
return url
def template_renderer(additional_folders: List = []) -> Jinja2Templates:
def template_renderer(additional_folders: List = None) -> Jinja2Templates:
t = Jinja2Templates(
loader=jinja2.FileSystemLoader(
["lnbits/templates", "lnbits/core/templates", *additional_folders]
)
)
folders = ["lnbits/templates", "lnbits/core/templates"]
if additional_folders:
folders.extend(additional_folders)
t = Jinja2Templates(loader=jinja2.FileSystemLoader(folders))
if settings.lnbits_ad_space_enabled:
t.env.globals["AD_SPACE"] = settings.lnbits_ad_space.split(",")

View File

@ -101,7 +101,7 @@ def insert_to_pg(query, data):
connection.close()
def migrate_core(file: str, exclude_tables: List[str] = []):
def migrate_core(file: str, exclude_tables: List[str] = None):
print(f"Migrating core: {file}")
migrate_db(file, "public", exclude_tables)
print("✅ Migrated core")
@ -115,7 +115,7 @@ def migrate_ext(file: str):
print(f"✅ Migrated ext: {schema}")
def migrate_db(file: str, schema: str, exclude_tables: List[str] = []):
def migrate_db(file: str, schema: str, exclude_tables: List[str] = None):
# first we check if this file exists:
assert os.path.isfile(file), f"{file} does not exist!"
@ -133,7 +133,7 @@ def migrate_db(file: str, schema: str, exclude_tables: List[str] = []):
# hard coded skip for dbversions (already produced during startup)
if tableName == "dbversions":
continue
if tableName in exclude_tables:
if exclude_tables and tableName in exclude_tables:
continue
columns = sq.execute(f"PRAGMA table_info({tableName})").fetchall()