[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-09-05 11:23:28 +00:00 committed by Emil Stenström
parent 58c7d55256
commit 4f4b81b7a0

View file

@ -10,9 +10,7 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument( parser.add_argument(
"name", "name", type=str, help="The name of the component to create"
type=str,
help="The name of the component to create"
) )
parser.add_argument( parser.add_argument(
"--path", "--path",
@ -68,7 +66,9 @@ class Command(BaseCommand):
verbose = kwargs["verbose"] verbose = kwargs["verbose"]
dry_run = kwargs["dry_run"] dry_run = kwargs["dry_run"]
component_path = os.path.join(path or f"{base_dir}/components", name) component_path = os.path.join(
path or f"{base_dir}/components", name
)
if os.path.exists(component_path): if os.path.exists(component_path):
if force: if force:
@ -102,7 +102,9 @@ class Command(BaseCommand):
) )
f.write(script_content.strip()) f.write(script_content.strip())
with open(os.path.join(component_path, css_filename), "w") as f: with open(
os.path.join(component_path, css_filename), "w"
) as f:
style_content = dedent( style_content = dedent(
f""" f"""
.component-{name} {{ .component-{name} {{
@ -112,7 +114,9 @@ class Command(BaseCommand):
) )
f.write(style_content.strip()) f.write(style_content.strip())
with open(os.path.join(component_path, template_filename), "w") as f: with open(
os.path.join(component_path, template_filename), "w"
) as f:
template_content = dedent( template_content = dedent(
f""" f"""
<div class="component-{name}"> <div class="component-{name}">
@ -122,7 +126,9 @@ class Command(BaseCommand):
) )
f.write(template_content.strip()) f.write(template_content.strip())
with open(os.path.join(component_path, f"{name}.py"), "w") as f: with open(
os.path.join(component_path, f"{name}.py"), "w"
) as f:
py_content = dedent( py_content = dedent(
f""" f"""
from django_components import component from django_components import component