mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 22:44:54 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
00a8259a2c
commit
a612144298
|
@ -9,6 +9,7 @@ TODO: restrict Cookiecutter Django project initialization
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
TERMINATOR = "\x1b[0m"
|
TERMINATOR = "\x1b[0m"
|
||||||
|
@ -17,13 +18,16 @@ INFO = "\x1b[1;33m [INFO]: "
|
||||||
HINT = "\x1b[3;33m"
|
HINT = "\x1b[3;33m"
|
||||||
SUCCESS = "\x1b[1;32m [SUCCESS]: "
|
SUCCESS = "\x1b[1;32m [SUCCESS]: "
|
||||||
|
|
||||||
|
|
||||||
def check_project_slug(slug):
|
def check_project_slug(slug):
|
||||||
assert slug.isidentifier(), f"'{slug}' project slug is not a valid Python identifier."
|
assert slug.isidentifier(), f"'{slug}' project slug is not a valid Python identifier."
|
||||||
assert slug == slug.lower(), f"'{slug}' project slug should be all lowercase"
|
assert slug == slug.lower(), f"'{slug}' project slug should be all lowercase"
|
||||||
|
|
||||||
|
|
||||||
def check_author_name(author_name):
|
def check_author_name(author_name):
|
||||||
assert "\\" not in author_name, "Don't include backslashes in author name."
|
assert "\\" not in author_name, "Don't include backslashes in author name."
|
||||||
|
|
||||||
|
|
||||||
def check_python_version(use_docker):
|
def check_python_version(use_docker):
|
||||||
if use_docker.lower() == "n":
|
if use_docker.lower() == "n":
|
||||||
python_major_version = sys.version_info[0]
|
python_major_version = sys.version_info[0]
|
||||||
|
@ -50,16 +54,19 @@ def check_python_version(use_docker):
|
||||||
+ TERMINATOR
|
+ TERMINATOR
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def check_whitenoise_and_cloud_provider(use_whitenoise, cloud_provider):
|
def check_whitenoise_and_cloud_provider(use_whitenoise, cloud_provider):
|
||||||
if use_whitenoise.lower() == "n" and cloud_provider == "None":
|
if use_whitenoise.lower() == "n" and cloud_provider == "None":
|
||||||
print("You should either use Whitenoise or select a Cloud Provider to serve static files")
|
print("You should either use Whitenoise or select a Cloud Provider to serve static files")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def check_mail_service_and_cloud_provider(mail_service, cloud_provider):
|
def check_mail_service_and_cloud_provider(mail_service, cloud_provider):
|
||||||
if mail_service == "Amazon SES" and cloud_provider != "AWS":
|
if mail_service == "Amazon SES" and cloud_provider != "AWS":
|
||||||
print("You should either use AWS or select a different Mail Service for sending emails.")
|
print("You should either use AWS or select a different Mail Service for sending emails.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
project_slug = "{{ cookiecutter.project_slug }}"
|
project_slug = "{{ cookiecutter.project_slug }}"
|
||||||
check_project_slug(project_slug)
|
check_project_slug(project_slug)
|
||||||
|
|
|
@ -3,6 +3,7 @@ import os
|
||||||
import re
|
import re
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import git
|
import git
|
||||||
import github.PullRequest
|
import github.PullRequest
|
||||||
import github.Repository
|
import github.Repository
|
||||||
|
|
Loading…
Reference in New Issue
Block a user