From 0308e67f077521416470fb9a854f7110f6c46d6a Mon Sep 17 00:00:00 2001
From: derthorsten <derthorstenbeier@gmail.com>
Date: Sun, 1 Dec 2019 15:21:59 +0100
Subject: [PATCH] remove utils

---
 hooks/pre_gen_project.py | 18 +++++++++++-------
 hooks/utils.py           | 19 -------------------
 2 files changed, 11 insertions(+), 26 deletions(-)
 delete mode 100644 hooks/utils.py

diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py
index e0232de2..c73f0030 100644
--- a/hooks/pre_gen_project.py
+++ b/hooks/pre_gen_project.py
@@ -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()
diff --git a/hooks/utils.py b/hooks/utils.py
deleted file mode 100644
index a4580130..00000000
--- a/hooks/utils.py
+++ /dev/null
@@ -1,19 +0,0 @@
-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)
-- 
GitLab