Black all files

This commit is contained in:
David-Wobrock authored and David Wobrock committed 2018-12-30 11:56:21 +01:00
1 parent 03bd7753e5
commit f05b199925
6 files changed
+231 -233

No files matched your search

+12 -14
View File
@@ -21,12 +21,12 @@ from django_migration_linter.constants import MIGRATION_FOLDER_NAME
def is_django_project(path):
django_manage_file = os.path.join(path, 'manage.py')
django_manage_file = os.path.join(path, "manage.py")
return os.path.isfile(django_manage_file)
def is_git_project(path):
git_directory = os.path.join(path, '.git')
git_directory = os.path.join(path, ".git")
return os.path.isdir(git_directory)
@@ -44,33 +44,31 @@ def find_project_settings_module(path):
"""
for root, dirs, files in os.walk(path):
for file_name in files:
if file_name == 'settings.py':
return os.path.join(
root.replace(path, ''),
file_name).replace('/', '.').rstrip('.py')
if file_name == "settings.py":
return (
os.path.join(root.replace(path, ""), file_name)
.replace("/", ".")
.rstrip(".py")
)
def split_path(path):
a, b = os.path.split(path)
return (split_path(a) if (len(a) > 0 and a != '/') else []) + [b]
return (split_path(a) if (len(a) > 0 and a != "/") else []) + [b]
def split_migration_path(migration_path):
decomposed_path = split_path(migration_path)
for i, p in enumerate(decomposed_path):
if p == MIGRATION_FOLDER_NAME:
return (decomposed_path[i-1],
os.path.splitext(decomposed_path[i+1])[0])
return (decomposed_path[i - 1], os.path.splitext(decomposed_path[i + 1])[0])
def compose_migration_path(django_folder, app_name, migration):
return os.path.join(
django_folder,
app_name,
MIGRATION_FOLDER_NAME,
'{0}.py'.format(migration)
django_folder, app_name, MIGRATION_FOLDER_NAME, "{0}.py".format(migration)
)
def clean_bytes_to_str(byte_input):
return byte_input.decode('utf-8').strip()
return byte_input.decode("utf-8").strip()