Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cookiecutter flask
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Remy Mudingay
Cookiecutter flask
Commits
0308e67f
Commit
0308e67f
authored
5 years ago
by
derthorsten
Committed by
James Curtin
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
remove utils
parent
993b7d16
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hooks/pre_gen_project.py
+11
-7
11 additions, 7 deletions
hooks/pre_gen_project.py
hooks/utils.py
+0
-19
0 additions, 19 deletions
hooks/utils.py
with
11 additions
and
26 deletions
hooks/pre_gen_project.py
+
11
−
7
View file @
0308e67f
...
...
@@ -2,14 +2,22 @@ import logging
import
re
import
sys
# Provide ability to import from the `hooks` directory
sys
.
path
.
append
(
"
..
"
)
logging
.
basicConfig
()
LOGGER
=
logging
.
getLogger
(
__name__
)
MODULE_REGEX
=
r
"
^[_a-zA-Z][_a-zA-Z0-9]+$
"
def
log_module_name_warning
(
module_name
,
logger
):
warning
=
(
f
"
\n
{
colorize
(
'
WARNING
'
,
'
WARNING
:
'
)
}
{
colorize
(
'
BOLD
'
,
module_name
)
}
"
"
is not a valid Python module name!
\n
"
"
See https://www.python.org/dev/peps/pep-0008/#package-and-module-names
"
"
for naming standards.
\n
"
)
logger
.
warning
(
warning
)
def
check_python_version
():
python_major_version
=
sys
.
version_info
[
0
]
python_minor_version
=
sys
.
version_info
[
1
]
...
...
@@ -36,8 +44,4 @@ def validate_python_module_name():
if
__name__
==
"
__main__
"
:
check_python_version
()
# Import after validating Python version to prevent confusing SyntaxError
# for users with incompatible Python versions.
from
hooks.utils
import
log_module_name_warning
validate_python_module_name
()
This diff is collapsed.
Click to expand it.
hooks/utils.py
deleted
100644 → 0
+
0
−
19
View file @
993b7d16
class
bcolors
:
WARNING
=
"
\033
[93m
"
ENDC
=
"
\033
[0m
"
BOLD
=
"
\033
[1m
"
def
colorize
(
escape_code
,
text
):
code
=
getattr
(
bcolors
,
escape_code
)
return
f
"
{
code
}{
text
}{
bcolors
.
ENDC
}
"
def
log_module_name_warning
(
module_name
,
logger
):
warning
=
(
f
"
\n
{
colorize
(
'
WARNING
'
,
'
WARNING
:
'
)
}
{
colorize
(
'
BOLD
'
,
module_name
)
}
"
"
is not a valid Python module name!
\n
"
"
See https://www.python.org/dev/peps/pep-0008/#package-and-module-names
"
"
for naming standards.
\n
"
)
logger
.
warning
(
warning
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment