From f5e6a7a15f0b0a26c8f1bb07c4fff75729b3fe29 Mon Sep 17 00:00:00 2001 From: Daniel Tesfai Date: Mon, 9 Sep 2019 02:10:45 -0400 Subject: [PATCH] removed templates folder as it was used for development purposes --- .gitignore | 4 ++- templates/dir_init.j2 | 3 -- templates/endpoint.j2 | 7 ---- templates/import.j2 | 1 - templates/initialize.j2 | 1 - templates/method_generator.py | 66 ----------------------------------- templates/subdir_init.j2 | 5 --- 7 files changed, 3 insertions(+), 84 deletions(-) delete mode 100644 templates/dir_init.j2 delete mode 100644 templates/endpoint.j2 delete mode 100644 templates/import.j2 delete mode 100644 templates/initialize.j2 delete mode 100644 templates/method_generator.py delete mode 100644 templates/subdir_init.j2 diff --git a/.gitignore b/.gitignore index 5604ef9..461a434 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ lib lib64 share pyvenv.cfg -templates *.egg-info man include @@ -44,3 +43,6 @@ htmlcov* # Visual Studio Code .vscode/ + +# Development +templates/ \ No newline at end of file diff --git a/templates/dir_init.j2 b/templates/dir_init.j2 deleted file mode 100644 index bf178cf..0000000 --- a/templates/dir_init.j2 +++ /dev/null @@ -1,3 +0,0 @@ - @property - def {{method_name}}(self): - return self.{{subdir}}.{{method_name}} \ No newline at end of file diff --git a/templates/endpoint.j2 b/templates/endpoint.j2 deleted file mode 100644 index f9268ed..0000000 --- a/templates/endpoint.j2 +++ /dev/null @@ -1,7 +0,0 @@ -class {{class_name}}(): - def __init__(self, base): - self.method = "{{endpoint}}" - self.base = base - - def fetch(self, params={}): - return self.base.request(self.method, params=params) \ No newline at end of file diff --git a/templates/import.j2 b/templates/import.j2 deleted file mode 100644 index 619af36..0000000 --- a/templates/import.j2 +++ /dev/null @@ -1 +0,0 @@ -from voipms.api.{{category_name}}.{{method_name}} import {{class_name}} \ No newline at end of file diff --git a/templates/initialize.j2 b/templates/initialize.j2 deleted file mode 100644 index 4a1a7b6..0000000 --- a/templates/initialize.j2 +++ /dev/null @@ -1 +0,0 @@ - self._{{method_name}} = None \ No newline at end of file diff --git a/templates/method_generator.py b/templates/method_generator.py deleted file mode 100644 index c290b71..0000000 --- a/templates/method_generator.py +++ /dev/null @@ -1,66 +0,0 @@ -from jinja2 import Environment, FileSystemLoader - -file_loader = FileSystemLoader('.') -env = Environment(loader=file_loader) - -print("Which category does this endpoint fall under?") -subdir_index = int(input("1: accounts, 2: call_detail_records, 3: dids, 4: general, 5: voicemail: ")) -subdir = ("accounts", "call_detail_records", "dids", "general", "voicemail")[subdir_index - 1] - -endpoint = input("endpoint name? ") -method = input("method name? ") - -filename = "../voipms/api/{}/{}.py".format(subdir, method) - -template = env.get_template('endpoint.j2') -method_split = method.split('_') -class_name = ''.join((i.title() for i in method_split)) -output = template.render(endpoint=endpoint, class_name=class_name) - -with open(filename, 'a') as file: - file.writelines(output) - - - -filename = "../voipms/api/{}/__init__.py".format(subdir) -template = env.get_template('import.j2') -method_split = method.split('_') -class_name = ''.join((i.title() for i in method_split)) -output_import = template.render(method_name=method, class_name=class_name, category_name=subdir) - -template = env.get_template('initialize.j2') -output_init = template.render(method_name=method) - -template = env.get_template('subdir_init.j2') -output_property = template.render(method_name=method, class_name=class_name) - -with open(filename, 'r') as file: - contents = file.readlines() - -pos = 0 - -for k, v in enumerate(contents): - if v == "\n": - contents.insert(k, output_import + "\n") - pos = k - break - -for k, v in enumerate(contents[pos+2:], pos+2): - if v == "\n": - contents.insert(k, output_init + "\n") - break - -contents.append("\n\n" + output_property) - -with open(filename, 'w') as file: - file.writelines(contents) - - - -filename = "../voipms/api/__init__.py" - -template = env.get_template('dir_init.j2') -output = template.render(subdir=subdir, method_name=method) - -with open(filename, 'a') as file: - file.writelines("\n\n" + output) \ No newline at end of file diff --git a/templates/subdir_init.j2 b/templates/subdir_init.j2 deleted file mode 100644 index afa0499..0000000 --- a/templates/subdir_init.j2 +++ /dev/null @@ -1,5 +0,0 @@ - @property - def {{method_name}}(self): - if self._{{method_name}} is None: - self._{{method_name}} = {{class_name}}(self.base) - return self._{{method_name}} \ No newline at end of file