From 5d68f5f3e64aae56512146a284ae81ce183d5bbb Mon Sep 17 00:00:00 2001 From: ydcjeff Date: Tue, 6 Apr 2021 13:56:38 +0630 Subject: [PATCH 1/2] fix: file ext to pyi for image classification --- templates/image_classification/{hubconf.py => hubconf.pyi} | 0 .../image_classification/{__init__.py => __init__.pyi} | 0 .../image_classification/{config.py => config.pyi} | 0 .../image_classification/{datasets.py => datasets.pyi} | 0 .../image_classification/{handlers.py => handlers.pyi} | 0 .../image_classification/{main.py => main.pyi} | 0 .../image_classification/{models.py => models.pyi} | 0 .../image_classification/{trainers.py => trainers.pyi} | 0 .../image_classification/{utils.py => utils.pyi} | 0 templates/image_classification/setup.py | 2 +- .../tests/{test_datasets.py => test_datasets.pyi} | 0 .../tests/{test_handlers.py => test_handlers.pyi} | 0 .../tests/{test_trainers.py => test_trainers.pyi} | 0 .../tests/{test_utils.py => test_utils.pyi} | 0 14 files changed, 1 insertion(+), 1 deletion(-) rename templates/image_classification/{hubconf.py => hubconf.pyi} (100%) rename templates/image_classification/image_classification/{__init__.py => __init__.pyi} (100%) rename templates/image_classification/image_classification/{config.py => config.pyi} (100%) rename templates/image_classification/image_classification/{datasets.py => datasets.pyi} (100%) rename templates/image_classification/image_classification/{handlers.py => handlers.pyi} (100%) rename templates/image_classification/image_classification/{main.py => main.pyi} (100%) rename templates/image_classification/image_classification/{models.py => models.pyi} (100%) rename templates/image_classification/image_classification/{trainers.py => trainers.pyi} (100%) rename templates/image_classification/image_classification/{utils.py => utils.pyi} (100%) rename templates/image_classification/tests/{test_datasets.py => test_datasets.pyi} (100%) rename templates/image_classification/tests/{test_handlers.py => test_handlers.pyi} (100%) rename templates/image_classification/tests/{test_trainers.py => test_trainers.pyi} (100%) rename templates/image_classification/tests/{test_utils.py => test_utils.pyi} (100%) diff --git a/templates/image_classification/hubconf.py b/templates/image_classification/hubconf.pyi similarity index 100% rename from templates/image_classification/hubconf.py rename to templates/image_classification/hubconf.pyi diff --git a/templates/image_classification/image_classification/__init__.py b/templates/image_classification/image_classification/__init__.pyi similarity index 100% rename from templates/image_classification/image_classification/__init__.py rename to templates/image_classification/image_classification/__init__.pyi diff --git a/templates/image_classification/image_classification/config.py b/templates/image_classification/image_classification/config.pyi similarity index 100% rename from templates/image_classification/image_classification/config.py rename to templates/image_classification/image_classification/config.pyi diff --git a/templates/image_classification/image_classification/datasets.py b/templates/image_classification/image_classification/datasets.pyi similarity index 100% rename from templates/image_classification/image_classification/datasets.py rename to templates/image_classification/image_classification/datasets.pyi diff --git a/templates/image_classification/image_classification/handlers.py b/templates/image_classification/image_classification/handlers.pyi similarity index 100% rename from templates/image_classification/image_classification/handlers.py rename to templates/image_classification/image_classification/handlers.pyi diff --git a/templates/image_classification/image_classification/main.py b/templates/image_classification/image_classification/main.pyi similarity index 100% rename from templates/image_classification/image_classification/main.py rename to templates/image_classification/image_classification/main.pyi diff --git a/templates/image_classification/image_classification/models.py b/templates/image_classification/image_classification/models.pyi similarity index 100% rename from templates/image_classification/image_classification/models.py rename to templates/image_classification/image_classification/models.pyi diff --git a/templates/image_classification/image_classification/trainers.py b/templates/image_classification/image_classification/trainers.pyi similarity index 100% rename from templates/image_classification/image_classification/trainers.py rename to templates/image_classification/image_classification/trainers.pyi diff --git a/templates/image_classification/image_classification/utils.py b/templates/image_classification/image_classification/utils.pyi similarity index 100% rename from templates/image_classification/image_classification/utils.py rename to templates/image_classification/image_classification/utils.pyi diff --git a/templates/image_classification/setup.py b/templates/image_classification/setup.py index a57d4ed6..c202bf41 100644 --- a/templates/image_classification/setup.py +++ b/templates/image_classification/setup.py @@ -38,4 +38,4 @@ def dependencies(fname): ), zip_safe=True, install_requires=requirements, -) \ No newline at end of file +) diff --git a/templates/image_classification/tests/test_datasets.py b/templates/image_classification/tests/test_datasets.pyi similarity index 100% rename from templates/image_classification/tests/test_datasets.py rename to templates/image_classification/tests/test_datasets.pyi diff --git a/templates/image_classification/tests/test_handlers.py b/templates/image_classification/tests/test_handlers.pyi similarity index 100% rename from templates/image_classification/tests/test_handlers.py rename to templates/image_classification/tests/test_handlers.pyi diff --git a/templates/image_classification/tests/test_trainers.py b/templates/image_classification/tests/test_trainers.pyi similarity index 100% rename from templates/image_classification/tests/test_trainers.py rename to templates/image_classification/tests/test_trainers.pyi diff --git a/templates/image_classification/tests/test_utils.py b/templates/image_classification/tests/test_utils.pyi similarity index 100% rename from templates/image_classification/tests/test_utils.py rename to templates/image_classification/tests/test_utils.pyi From 27d4139cd64941d2f381a648afcf7581fec6bbd2 Mon Sep 17 00:00:00 2001 From: ydcjeff Date: Tue, 6 Apr 2021 15:59:56 +0630 Subject: [PATCH 2/2] fix: rename to .py --- .github/run_code_style.sh | 10 +++++----- app/codegen.py | 2 +- templates/_base/{_argparse.pyi => _argparse.py} | 0 templates/_base/{_events.pyi => _events.py} | 0 templates/_base/{_handlers.pyi => _handlers.py} | 0 templates/_base/{_hubconf.pyi => _hubconf.py} | 0 templates/gan/gan/{__init__.pyi => __init__.py} | 0 templates/gan/gan/{config.pyi => config.py} | 0 templates/gan/gan/{datasets.pyi => datasets.py} | 0 templates/gan/gan/{handlers.pyi => handlers.py} | 0 templates/gan/gan/{main.pyi => main.py} | 0 templates/gan/gan/{models.pyi => models.py} | 0 templates/gan/gan/{trainers.pyi => trainers.py} | 0 templates/gan/gan/{utils.pyi => utils.py} | 0 templates/gan/{hubconf.pyi => hubconf.py} | 0 templates/gan/requirements.txt | 2 +- .../gan/tests/{test_datasets.pyi => test_datasets.py} | 0 .../gan/tests/{test_handlers.pyi => test_handlers.py} | 0 .../gan/tests/{test_models.pyi => test_models.py} | 0 .../gan/tests/{test_trainers.pyi => test_trainers.py} | 0 templates/gan/tests/{test_utils.pyi => test_utils.py} | 0 .../image_classification/{hubconf.pyi => hubconf.py} | 0 .../image_classification/{__init__.pyi => __init__.py} | 0 .../image_classification/{config.pyi => config.py} | 0 .../image_classification/{datasets.pyi => datasets.py} | 0 .../image_classification/{handlers.pyi => handlers.py} | 0 .../image_classification/{main.pyi => main.py} | 0 .../image_classification/{models.pyi => models.py} | 0 .../image_classification/{trainers.pyi => trainers.py} | 0 .../image_classification/{utils.pyi => utils.py} | 0 .../tests/{test_datasets.pyi => test_datasets.py} | 0 .../tests/{test_handlers.pyi => test_handlers.py} | 0 .../tests/{test_trainers.pyi => test_trainers.py} | 0 .../tests/{test_utils.pyi => test_utils.py} | 0 templates/single/{hubconf.pyi => hubconf.py} | 0 templates/single/single/{__init__.pyi => __init__.py} | 0 templates/single/single/{config.pyi => config.py} | 0 templates/single/single/{datasets.pyi => datasets.py} | 0 templates/single/single/{handlers.pyi => handlers.py} | 0 templates/single/single/{main.pyi => main.py} | 0 templates/single/single/{models.pyi => models.py} | 0 templates/single/single/{trainers.pyi => trainers.py} | 0 templates/single/single/{utils.pyi => utils.py} | 0 .../tests/{test_handlers.pyi => test_handlers.py} | 0 .../tests/{test_trainers.pyi => test_trainers.py} | 0 .../single/tests/{test_utils.pyi => test_utils.py} | 0 46 files changed, 7 insertions(+), 7 deletions(-) rename templates/_base/{_argparse.pyi => _argparse.py} (100%) rename templates/_base/{_events.pyi => _events.py} (100%) rename templates/_base/{_handlers.pyi => _handlers.py} (100%) rename templates/_base/{_hubconf.pyi => _hubconf.py} (100%) rename templates/gan/gan/{__init__.pyi => __init__.py} (100%) rename templates/gan/gan/{config.pyi => config.py} (100%) rename templates/gan/gan/{datasets.pyi => datasets.py} (100%) rename templates/gan/gan/{handlers.pyi => handlers.py} (100%) rename templates/gan/gan/{main.pyi => main.py} (100%) rename templates/gan/gan/{models.pyi => models.py} (100%) rename templates/gan/gan/{trainers.pyi => trainers.py} (100%) rename templates/gan/gan/{utils.pyi => utils.py} (100%) rename templates/gan/{hubconf.pyi => hubconf.py} (100%) rename templates/gan/tests/{test_datasets.pyi => test_datasets.py} (100%) rename templates/gan/tests/{test_handlers.pyi => test_handlers.py} (100%) rename templates/gan/tests/{test_models.pyi => test_models.py} (100%) rename templates/gan/tests/{test_trainers.pyi => test_trainers.py} (100%) rename templates/gan/tests/{test_utils.pyi => test_utils.py} (100%) rename templates/image_classification/{hubconf.pyi => hubconf.py} (100%) rename templates/image_classification/image_classification/{__init__.pyi => __init__.py} (100%) rename templates/image_classification/image_classification/{config.pyi => config.py} (100%) rename templates/image_classification/image_classification/{datasets.pyi => datasets.py} (100%) rename templates/image_classification/image_classification/{handlers.pyi => handlers.py} (100%) rename templates/image_classification/image_classification/{main.pyi => main.py} (100%) rename templates/image_classification/image_classification/{models.pyi => models.py} (100%) rename templates/image_classification/image_classification/{trainers.pyi => trainers.py} (100%) rename templates/image_classification/image_classification/{utils.pyi => utils.py} (100%) rename templates/image_classification/tests/{test_datasets.pyi => test_datasets.py} (100%) rename templates/image_classification/tests/{test_handlers.pyi => test_handlers.py} (100%) rename templates/image_classification/tests/{test_trainers.pyi => test_trainers.py} (100%) rename templates/image_classification/tests/{test_utils.pyi => test_utils.py} (100%) rename templates/single/{hubconf.pyi => hubconf.py} (100%) rename templates/single/single/{__init__.pyi => __init__.py} (100%) rename templates/single/single/{config.pyi => config.py} (100%) rename templates/single/single/{datasets.pyi => datasets.py} (100%) rename templates/single/single/{handlers.pyi => handlers.py} (100%) rename templates/single/single/{main.pyi => main.py} (100%) rename templates/single/single/{models.pyi => models.py} (100%) rename templates/single/single/{trainers.pyi => trainers.py} (100%) rename templates/single/single/{utils.pyi => utils.py} (100%) rename templates/single/tests/{test_handlers.pyi => test_handlers.py} (100%) rename templates/single/tests/{test_trainers.pyi => test_trainers.py} (100%) rename templates/single/tests/{test_utils.pyi => test_utils.py} (100%) diff --git a/.github/run_code_style.sh b/.github/run_code_style.sh index a64003ff..21f56b4c 100755 --- a/.github/run_code_style.sh +++ b/.github/run_code_style.sh @@ -3,12 +3,12 @@ set -xeu if [ $1 == "lint" ]; then - flake8 app templates tests --config .flake8 - isort app templates tests --check --settings pyproject.toml - black app templates tests --check --config pyproject.toml + flake8 app templates/*/_sidebar.py tests --config .flake8 + isort app templates/*/_sidebar.py tests --check --settings pyproject.toml + black app templates/*/_sidebar.py tests --check --config pyproject.toml elif [ $1 == "fmt" ]; then - isort app templates tests --color --settings pyproject.toml - black app templates tests --config pyproject.toml + isort app templates/*/_sidebar.py tests --color --settings pyproject.toml + black app templates/*/_sidebar.py tests --config pyproject.toml elif [ $1 == "install" ]; then pip install flake8 "black==20.8b1" "isort==5.7.0" fi diff --git a/app/codegen.py b/app/codegen.py index 727d46c9..c023c521 100644 --- a/app/codegen.py +++ b/app/codegen.py @@ -25,7 +25,7 @@ def render_templates(self, template_name: str, project_name: str, config: dict): ) for fname in env.list_templates(filter_func=lambda x: not x.startswith("_")): code = env.get_template(fname).render(**config) - fname = fname.replace(".pyi", ".py").replace(template_name, project_name) + fname = fname.replace(template_name, project_name) self.rendered_code[fname] = code yield fname, code diff --git a/templates/_base/_argparse.pyi b/templates/_base/_argparse.py similarity index 100% rename from templates/_base/_argparse.pyi rename to templates/_base/_argparse.py diff --git a/templates/_base/_events.pyi b/templates/_base/_events.py similarity index 100% rename from templates/_base/_events.pyi rename to templates/_base/_events.py diff --git a/templates/_base/_handlers.pyi b/templates/_base/_handlers.py similarity index 100% rename from templates/_base/_handlers.pyi rename to templates/_base/_handlers.py diff --git a/templates/_base/_hubconf.pyi b/templates/_base/_hubconf.py similarity index 100% rename from templates/_base/_hubconf.pyi rename to templates/_base/_hubconf.py diff --git a/templates/gan/gan/__init__.pyi b/templates/gan/gan/__init__.py similarity index 100% rename from templates/gan/gan/__init__.pyi rename to templates/gan/gan/__init__.py diff --git a/templates/gan/gan/config.pyi b/templates/gan/gan/config.py similarity index 100% rename from templates/gan/gan/config.pyi rename to templates/gan/gan/config.py diff --git a/templates/gan/gan/datasets.pyi b/templates/gan/gan/datasets.py similarity index 100% rename from templates/gan/gan/datasets.pyi rename to templates/gan/gan/datasets.py diff --git a/templates/gan/gan/handlers.pyi b/templates/gan/gan/handlers.py similarity index 100% rename from templates/gan/gan/handlers.pyi rename to templates/gan/gan/handlers.py diff --git a/templates/gan/gan/main.pyi b/templates/gan/gan/main.py similarity index 100% rename from templates/gan/gan/main.pyi rename to templates/gan/gan/main.py diff --git a/templates/gan/gan/models.pyi b/templates/gan/gan/models.py similarity index 100% rename from templates/gan/gan/models.pyi rename to templates/gan/gan/models.py diff --git a/templates/gan/gan/trainers.pyi b/templates/gan/gan/trainers.py similarity index 100% rename from templates/gan/gan/trainers.pyi rename to templates/gan/gan/trainers.py diff --git a/templates/gan/gan/utils.pyi b/templates/gan/gan/utils.py similarity index 100% rename from templates/gan/gan/utils.pyi rename to templates/gan/gan/utils.py diff --git a/templates/gan/hubconf.pyi b/templates/gan/hubconf.py similarity index 100% rename from templates/gan/hubconf.pyi rename to templates/gan/hubconf.py diff --git a/templates/gan/requirements.txt b/templates/gan/requirements.txt index c2ba37f1..f95758fe 100644 --- a/templates/gan/requirements.txt +++ b/templates/gan/requirements.txt @@ -3,6 +3,6 @@ torch>=1.7.0 pytorch-ignite>=0.4.4 torchvision>=0.8.0 matplotlib>=3.4.1 -pandas>=1.2.3 +pandas {{ handler_deps }} {{ logger_deps }} diff --git a/templates/gan/tests/test_datasets.pyi b/templates/gan/tests/test_datasets.py similarity index 100% rename from templates/gan/tests/test_datasets.pyi rename to templates/gan/tests/test_datasets.py diff --git a/templates/gan/tests/test_handlers.pyi b/templates/gan/tests/test_handlers.py similarity index 100% rename from templates/gan/tests/test_handlers.pyi rename to templates/gan/tests/test_handlers.py diff --git a/templates/gan/tests/test_models.pyi b/templates/gan/tests/test_models.py similarity index 100% rename from templates/gan/tests/test_models.pyi rename to templates/gan/tests/test_models.py diff --git a/templates/gan/tests/test_trainers.pyi b/templates/gan/tests/test_trainers.py similarity index 100% rename from templates/gan/tests/test_trainers.pyi rename to templates/gan/tests/test_trainers.py diff --git a/templates/gan/tests/test_utils.pyi b/templates/gan/tests/test_utils.py similarity index 100% rename from templates/gan/tests/test_utils.pyi rename to templates/gan/tests/test_utils.py diff --git a/templates/image_classification/hubconf.pyi b/templates/image_classification/hubconf.py similarity index 100% rename from templates/image_classification/hubconf.pyi rename to templates/image_classification/hubconf.py diff --git a/templates/image_classification/image_classification/__init__.pyi b/templates/image_classification/image_classification/__init__.py similarity index 100% rename from templates/image_classification/image_classification/__init__.pyi rename to templates/image_classification/image_classification/__init__.py diff --git a/templates/image_classification/image_classification/config.pyi b/templates/image_classification/image_classification/config.py similarity index 100% rename from templates/image_classification/image_classification/config.pyi rename to templates/image_classification/image_classification/config.py diff --git a/templates/image_classification/image_classification/datasets.pyi b/templates/image_classification/image_classification/datasets.py similarity index 100% rename from templates/image_classification/image_classification/datasets.pyi rename to templates/image_classification/image_classification/datasets.py diff --git a/templates/image_classification/image_classification/handlers.pyi b/templates/image_classification/image_classification/handlers.py similarity index 100% rename from templates/image_classification/image_classification/handlers.pyi rename to templates/image_classification/image_classification/handlers.py diff --git a/templates/image_classification/image_classification/main.pyi b/templates/image_classification/image_classification/main.py similarity index 100% rename from templates/image_classification/image_classification/main.pyi rename to templates/image_classification/image_classification/main.py diff --git a/templates/image_classification/image_classification/models.pyi b/templates/image_classification/image_classification/models.py similarity index 100% rename from templates/image_classification/image_classification/models.pyi rename to templates/image_classification/image_classification/models.py diff --git a/templates/image_classification/image_classification/trainers.pyi b/templates/image_classification/image_classification/trainers.py similarity index 100% rename from templates/image_classification/image_classification/trainers.pyi rename to templates/image_classification/image_classification/trainers.py diff --git a/templates/image_classification/image_classification/utils.pyi b/templates/image_classification/image_classification/utils.py similarity index 100% rename from templates/image_classification/image_classification/utils.pyi rename to templates/image_classification/image_classification/utils.py diff --git a/templates/image_classification/tests/test_datasets.pyi b/templates/image_classification/tests/test_datasets.py similarity index 100% rename from templates/image_classification/tests/test_datasets.pyi rename to templates/image_classification/tests/test_datasets.py diff --git a/templates/image_classification/tests/test_handlers.pyi b/templates/image_classification/tests/test_handlers.py similarity index 100% rename from templates/image_classification/tests/test_handlers.pyi rename to templates/image_classification/tests/test_handlers.py diff --git a/templates/image_classification/tests/test_trainers.pyi b/templates/image_classification/tests/test_trainers.py similarity index 100% rename from templates/image_classification/tests/test_trainers.pyi rename to templates/image_classification/tests/test_trainers.py diff --git a/templates/image_classification/tests/test_utils.pyi b/templates/image_classification/tests/test_utils.py similarity index 100% rename from templates/image_classification/tests/test_utils.pyi rename to templates/image_classification/tests/test_utils.py diff --git a/templates/single/hubconf.pyi b/templates/single/hubconf.py similarity index 100% rename from templates/single/hubconf.pyi rename to templates/single/hubconf.py diff --git a/templates/single/single/__init__.pyi b/templates/single/single/__init__.py similarity index 100% rename from templates/single/single/__init__.pyi rename to templates/single/single/__init__.py diff --git a/templates/single/single/config.pyi b/templates/single/single/config.py similarity index 100% rename from templates/single/single/config.pyi rename to templates/single/single/config.py diff --git a/templates/single/single/datasets.pyi b/templates/single/single/datasets.py similarity index 100% rename from templates/single/single/datasets.pyi rename to templates/single/single/datasets.py diff --git a/templates/single/single/handlers.pyi b/templates/single/single/handlers.py similarity index 100% rename from templates/single/single/handlers.pyi rename to templates/single/single/handlers.py diff --git a/templates/single/single/main.pyi b/templates/single/single/main.py similarity index 100% rename from templates/single/single/main.pyi rename to templates/single/single/main.py diff --git a/templates/single/single/models.pyi b/templates/single/single/models.py similarity index 100% rename from templates/single/single/models.pyi rename to templates/single/single/models.py diff --git a/templates/single/single/trainers.pyi b/templates/single/single/trainers.py similarity index 100% rename from templates/single/single/trainers.pyi rename to templates/single/single/trainers.py diff --git a/templates/single/single/utils.pyi b/templates/single/single/utils.py similarity index 100% rename from templates/single/single/utils.pyi rename to templates/single/single/utils.py diff --git a/templates/single/tests/test_handlers.pyi b/templates/single/tests/test_handlers.py similarity index 100% rename from templates/single/tests/test_handlers.pyi rename to templates/single/tests/test_handlers.py diff --git a/templates/single/tests/test_trainers.pyi b/templates/single/tests/test_trainers.py similarity index 100% rename from templates/single/tests/test_trainers.pyi rename to templates/single/tests/test_trainers.py diff --git a/templates/single/tests/test_utils.pyi b/templates/single/tests/test_utils.py similarity index 100% rename from templates/single/tests/test_utils.pyi rename to templates/single/tests/test_utils.py