mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
All: Apply Black coding rules
This commit is contained in:
@ -21,4 +21,3 @@
|
||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -33,10 +33,14 @@ class Command(BaseCommand):
|
||||
help = "Recursively check the file system with respect to the DB"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('ids', metavar='ID', type=int, nargs='+', help="The file IDs to process")
|
||||
parser.add_argument(
|
||||
"ids", metavar="ID", type=int, nargs="+", help="The file IDs to process"
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
root_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
files = SithFile.objects.filter(id__in=options['ids']).all()
|
||||
root_path = os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
)
|
||||
files = SithFile.objects.filter(id__in=options["ids"]).all()
|
||||
for f in files:
|
||||
f._check_fs()
|
||||
|
@ -33,15 +33,13 @@ class Command(BaseCommand):
|
||||
"""
|
||||
Compiles scss in static folder for production
|
||||
"""
|
||||
|
||||
help = "Compile scss files from static folder"
|
||||
|
||||
def compile(self, filename):
|
||||
args = {
|
||||
"filename": filename,
|
||||
"include_paths": settings.STATIC_ROOT,
|
||||
}
|
||||
args = {"filename": filename, "include_paths": settings.STATIC_ROOT}
|
||||
if settings.SASS_PRECISION:
|
||||
args['precision'] = settings.SASS_PRECISION
|
||||
args["precision"] = settings.SASS_PRECISION
|
||||
return sass.compile(**args)
|
||||
|
||||
def is_compilable(self, file, ext_list):
|
||||
@ -54,7 +52,7 @@ class Command(BaseCommand):
|
||||
file = os.path.join(folder, file)
|
||||
if os.path.isdir(file):
|
||||
self.exec_on_folder(file, func)
|
||||
elif self.is_compilable(file, ['.scss']):
|
||||
elif self.is_compilable(file, [".scss"]):
|
||||
to_exec.append(file)
|
||||
|
||||
for file in to_exec:
|
||||
@ -62,7 +60,7 @@ class Command(BaseCommand):
|
||||
|
||||
def compilescss(self, file):
|
||||
print("compiling %s" % file)
|
||||
with(open(file.replace('.scss', '.css'), "w")) as newfile:
|
||||
with (open(file.replace(".scss", ".css"), "w")) as newfile:
|
||||
newfile.write(self.compile(file))
|
||||
|
||||
def removescss(self, file):
|
||||
@ -77,4 +75,6 @@ class Command(BaseCommand):
|
||||
print("---- Removing scss files ----")
|
||||
self.exec_on_folder(settings.STATIC_ROOT, self.removescss)
|
||||
else:
|
||||
print("No static folder avalaible, please use collectstatic before compiling scss")
|
||||
print(
|
||||
"No static folder avalaible, please use collectstatic before compiling scss"
|
||||
)
|
||||
|
@ -27,11 +27,14 @@ from django.core.management.base import BaseCommand
|
||||
|
||||
from core.markdown import markdown
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Output the fully rendered doc/SYNTAX.md file"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
root_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
with open(os.path.join(root_path) + '/doc/SYNTAX.md', 'r') as md:
|
||||
root_path = os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
)
|
||||
with open(os.path.join(root_path) + "/doc/SYNTAX.md", "r") as md:
|
||||
result = markdown(md.read())
|
||||
print(result, end='')
|
||||
print(result, end="")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,10 +33,14 @@ class Command(BaseCommand):
|
||||
help = "Recursively repair the file system with respect to the DB"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('ids', metavar='ID', type=int, nargs='+', help="The file IDs to process")
|
||||
parser.add_argument(
|
||||
"ids", metavar="ID", type=int, nargs="+", help="The file IDs to process"
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
root_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
files = SithFile.objects.filter(id__in=options['ids']).all()
|
||||
root_path = os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
)
|
||||
files = SithFile.objects.filter(id__in=options["ids"]).all()
|
||||
for f in files:
|
||||
f._repair_fs()
|
||||
|
@ -31,22 +31,24 @@ class Command(BaseCommand):
|
||||
help = "Set up a new instance of the Sith AE"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--prod', action="store_true")
|
||||
parser.add_argument("--prod", action="store_true")
|
||||
|
||||
def handle(self, *args, **options):
|
||||
root_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
root_path = os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
)
|
||||
try:
|
||||
os.mkdir(os.path.join(root_path) + '/data')
|
||||
os.mkdir(os.path.join(root_path) + "/data")
|
||||
print("Data dir created")
|
||||
except Exception as e:
|
||||
repr(e)
|
||||
try:
|
||||
os.remove(os.path.join(root_path, 'db.sqlite3'))
|
||||
os.remove(os.path.join(root_path, "db.sqlite3"))
|
||||
print("db.sqlite3 deleted")
|
||||
except Exception as e:
|
||||
repr(e)
|
||||
call_command('migrate')
|
||||
if options['prod']:
|
||||
call_command('populate', '--prod')
|
||||
call_command("migrate")
|
||||
if options["prod"]:
|
||||
call_command("populate", "--prod")
|
||||
else:
|
||||
call_command('populate')
|
||||
call_command("populate")
|
||||
|
Reference in New Issue
Block a user