add comment warning to package builder static files

This commit is contained in:
Diogo Sousa
2023-07-05 13:27:23 +01:00
parent 37bb543dda
commit 1c801e9789

View File

@@ -69,7 +69,8 @@ class PackageBuilder:
@classmethod
def save_package(cls):
print("\nWriting package __init__...")
code = (
code = "### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###\n"
code += (
"import warnings\n"
+ "warnings.formatwarning = ("
+ "lambda message, category, *args, **kwargs: f'{category.__name__}: {message}'\n"
@@ -79,7 +80,7 @@ class PackageBuilder:
@classmethod
def run_linters(cls):
print("Running linters...")
print("\nRunning linters...")
Linters.black()
Linters.ruff()
Linters.mypy()
@@ -99,7 +100,8 @@ class PackageBuilder:
class ModuleBuilder:
@staticmethod
def build(path: str) -> str:
code = ImportDefinition.build(path=path)
code = "### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###\n"
code += ImportDefinition.build(path=path)
code += ClassDefinition.build(path=path)
return code