fastcodedog 3.2.6__tar.gz → 3.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/PKG-INFO +1 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/common/write_file.py +13 -6
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/config.py +3 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/db.py +21 -6
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_and_schema_to_crud/default_values.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_and_schema_to_crud/queries.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/alias_generator.py +3 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/no_input_fields.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/no_response_fields.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/response_schemas.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/specified_field_types.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/additional_methods.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/additional_relationships.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/case.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/computed_properties.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/copy_methods.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/disable_relationships.py +3 -2
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/specified_class_names.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/specified_relationship_orderby.py +2 -1
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/pyproject.toml +3 -3
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/README.md +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/README_zh.md +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/cli.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/common/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/common/clean_expired.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/common/source_file_path.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/api/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/api/api.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/api/endpoint.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/api/oauth2.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/api/param.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/common/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/common/get_context_object.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/common/get_relationship.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/context.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/contextbase.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/crud/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/crud/column.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/crud/crud.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/crud/default_value.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/crud/join_relationship.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/crud/query.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/additional_method.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/case.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/column.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/computed_property.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/copy_method.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/model.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/parameter.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/model/relationship.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/schema/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/schema/alias_generator.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/schema/field.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/schema/response_schema.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/schema/schema.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/schema/sub_object.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/setting/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/setting/config.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/setting/extend_app.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/setting/listen.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/setting/project.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/setting/source_directory.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/context/setting/tenant.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/api.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/api_function.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/generation.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/main.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/api/oauth2.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/block.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/call.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/class_type.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/file.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/function.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/head_comment.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/line_break.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/location_finder.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/required_import.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/text.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/base/variable.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/configfiles/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/generation.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/main.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/oauthfiles/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/toolfiles/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/utilfiles/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/utilfiles/api_logging.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/utilfiles/case_converter.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/utilfiles/log.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/crud/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/crud/crud.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/crud/crud_functions.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/crud/generation.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/crud/query_functions.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/crud/selectinload.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/additional_method.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/base.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/case.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/column.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/computed_property.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/copy_method.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/generation.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/init.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/model.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/relation_object.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/relationship.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/model/table_args.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/schema/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/schema/field.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/schema/generation.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/schema/response_schema.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/schema/schema.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/schema/sub_object.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/inc/middleware/api_logging.file.in +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_and_schema_to_crud/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_and_schema_to_crud/prepare.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/prepare.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/README.MD +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/before/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/before/additional_foreign_keys.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/before/fill_tenant_id.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/before/specified_column_types.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/before/specified_relationship_names.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/column.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/pdm.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/prepare.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/reference.xml +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/table.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/table.xml +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/endpoint.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/prepare.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/schemas.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/validate_reponse_models.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/__init__.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/case_converter.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/deep_update.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/extractor.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/find_file.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/import_group.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/indent.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/inflect_wrapper.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/make_dirs.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/read_inc.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/singleton.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/stable_sort.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/type_converter.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/valid_name.py +0 -0
- {fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/util/wrap_str_with_quotation.py +0 -0
|
@@ -13,6 +13,11 @@ import subprocess
|
|
|
13
13
|
from fastcodedog.context.context import ctx_instance
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
def normalize_lf(content: str) -> str:
|
|
17
|
+
"""统一换行为 Linux LF(\\n),与最终发布环境一致"""
|
|
18
|
+
return content.replace('\r\n', '\n').replace('\r', '\n')
|
|
19
|
+
|
|
20
|
+
|
|
16
21
|
def write_python_file(path, content, repalce_async=True):
|
|
17
22
|
"""
|
|
18
23
|
写入python文件
|
|
@@ -21,14 +26,14 @@ def write_python_file(path, content, repalce_async=True):
|
|
|
21
26
|
:return:
|
|
22
27
|
"""
|
|
23
28
|
_make_pathon_package(os.path.dirname(path))
|
|
24
|
-
with open(path, 'w', encoding='utf-8') as f:
|
|
25
|
-
f.write(content)
|
|
29
|
+
with open(path, 'w', encoding='utf-8', newline='\n') as f:
|
|
30
|
+
f.write(normalize_lf(content))
|
|
26
31
|
# 调用autopep8格式化文件
|
|
27
32
|
# subprocess.run(['autopep8', '--in-place', '--aggressive', '--max-line-length=120', path], check=True)
|
|
28
33
|
subprocess.run(['autopep8', '--in-place', '--max-line-length=120', path], check=True)
|
|
29
34
|
# 临时版本,把异步支持去掉,把文件中的 `async def` 替换为 `def`
|
|
30
|
-
with open(path, 'r+', encoding='utf-8') as f:
|
|
31
|
-
content = f.read()
|
|
35
|
+
with open(path, 'r+', encoding='utf-8', newline='\n') as f:
|
|
36
|
+
content = normalize_lf(f.read())
|
|
32
37
|
if repalce_async:
|
|
33
38
|
content = content.replace('async def ', 'def ')
|
|
34
39
|
f.seek(0)
|
|
@@ -46,7 +51,9 @@ def _make_pathon_package(directory):
|
|
|
46
51
|
os.makedirs(directory)
|
|
47
52
|
if directory.startswith(ctx_instance.project.directory):
|
|
48
53
|
init_file = os.path.join(directory, '__init__.py')
|
|
49
|
-
|
|
54
|
+
if not os.path.exists(init_file):
|
|
55
|
+
with open(init_file, 'w', encoding='utf-8', newline='\n'):
|
|
56
|
+
pass
|
|
50
57
|
|
|
51
58
|
|
|
52
59
|
def write_json_file(path, data):
|
|
@@ -59,5 +66,5 @@ def write_json_file(path, data):
|
|
|
59
66
|
directory = os.path.dirname(path)
|
|
60
67
|
if os.path.exists(directory) is False:
|
|
61
68
|
os.makedirs(directory)
|
|
62
|
-
with open(path, 'w', encoding='utf-8') as f:
|
|
69
|
+
with open(path, 'w', encoding='utf-8', newline='\n') as f:
|
|
63
70
|
json5.dump(data, f, ensure_ascii=False, indent=4)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
+
from fastcodedog.common.write_file import normalize_lf
|
|
2
3
|
from fastcodedog.context.context import ctx_instance
|
|
3
4
|
from fastcodedog.generation.base.file import File
|
|
4
5
|
from fastcodedog.generation.base.function import Function
|
|
@@ -117,7 +118,8 @@ return result
|
|
|
117
118
|
|
|
118
119
|
def save(self):
|
|
119
120
|
super().save()
|
|
120
|
-
open(self.ini_file, 'w', encoding='utf-8')
|
|
121
|
+
with open(self.ini_file, 'w', encoding='utf-8', newline='\n') as f:
|
|
122
|
+
f.write(normalize_lf(self.ini_content))
|
|
121
123
|
|
|
122
124
|
def _get_ini_content(self):
|
|
123
125
|
content = "; 可以通过ini文件、环境变量和命令行三种方式配置参数,优先级依次递增\n"
|
|
@@ -16,12 +16,27 @@ class Db(File):
|
|
|
16
16
|
self._init_blocks_and_imports()
|
|
17
17
|
|
|
18
18
|
def _init_blocks_and_imports(self):
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
engine_imports = ['from sqlalchemy import create_engine',
|
|
20
|
+
Import('database_url', Config().package),
|
|
21
|
+
Import('pool_size', Config().package),
|
|
22
|
+
Import('max_overflow', Config().package)]
|
|
23
|
+
self.blocks.append(Variable(
|
|
24
|
+
'_connect_args',
|
|
25
|
+
value='{"check_same_thread": False} if database_url.startswith(\'sqlite\') else {}',
|
|
26
|
+
possible_imports=engine_imports,
|
|
27
|
+
))
|
|
28
|
+
self.blocks.append(Variable(
|
|
29
|
+
'engine',
|
|
30
|
+
value="""create_engine(
|
|
31
|
+
database_url,
|
|
32
|
+
pool_size=pool_size,
|
|
33
|
+
max_overflow=max_overflow,
|
|
34
|
+
pool_pre_ping=True,
|
|
35
|
+
pool_recycle=3600,
|
|
36
|
+
connect_args=_connect_args,
|
|
37
|
+
)""",
|
|
38
|
+
possible_imports=engine_imports,
|
|
39
|
+
))
|
|
25
40
|
self.blocks.append(Variable('Session', value='sessionmaker(bind=engine)',
|
|
26
41
|
possible_imports=['from sqlalchemy.orm import sessionmaker']))
|
|
27
42
|
get_session = Function('get_session', comment="""生成器方式获取数据库会话(主要适用于依赖注入场景)。
|
|
@@ -6,6 +6,7 @@ from fastcodedog.context.context import ctx_instance
|
|
|
6
6
|
from fastcodedog.context.crud.crud import Crud
|
|
7
7
|
from fastcodedog.context.model.model import Model
|
|
8
8
|
from fastcodedog.util.find_file import find
|
|
9
|
+
from fastcodedog.common.write_file import write_json_file
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def add_default_value(crud_directory, default_values):
|
|
@@ -31,6 +32,6 @@ def add_default_value(crud_directory, default_values):
|
|
|
31
32
|
if 'default_values' not in data:
|
|
32
33
|
data['default_values'] = {}
|
|
33
34
|
data['default_values'][column_name] = default_value
|
|
34
|
-
|
|
35
|
+
write_json_file(json_file, data)
|
|
35
36
|
|
|
36
37
|
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_and_schema_to_crud/queries.py
RENAMED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import json5
|
|
3
3
|
|
|
4
4
|
from fastcodedog.common.source_file_path import get_crud_file_path
|
|
5
|
+
from fastcodedog.common.write_file import write_json_file
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def add_queries(crud_directory, queries):
|
|
@@ -15,7 +16,7 @@ def add_queries(crud_directory, queries):
|
|
|
15
16
|
data['queries'][query['name']] = query
|
|
16
17
|
# _refill_order_by(data['queries'][query['name']])
|
|
17
18
|
# order_by要改写
|
|
18
|
-
|
|
19
|
+
write_json_file(json_file, data)
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
# def _refill_order_by(query):
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/alias_generator.py
RENAMED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import json5
|
|
3
3
|
import os
|
|
4
4
|
|
|
5
|
+
from fastcodedog.common.write_file import write_json_file
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
def set_alias_generator(schema_directory, alias_generator):
|
|
7
9
|
if not alias_generator:
|
|
@@ -14,4 +16,4 @@ def set_alias_generator(schema_directory, alias_generator):
|
|
|
14
16
|
json_file = os.path.join(root, module, file)
|
|
15
17
|
data = json5.load(open(json_file, 'r', encoding='utf-8'))
|
|
16
18
|
data['alias_generator'] = alias_generator
|
|
17
|
-
|
|
19
|
+
write_json_file(json_file, data)
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/no_input_fields.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import json5
|
|
3
3
|
import os
|
|
4
|
+
from fastcodedog.common.write_file import write_json_file
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
def set_no_input_fields(schema_directory, no_input_fields):
|
|
@@ -17,4 +18,4 @@ def set_no_input_fields(schema_directory, no_input_fields):
|
|
|
17
18
|
for field_name, field in data['fields'].items():
|
|
18
19
|
if field_name in no_input_fields or f'{schema_name}.{field_name}' in no_input_fields:
|
|
19
20
|
field['no_input'] = True
|
|
20
|
-
|
|
21
|
+
write_json_file(json_file, data)
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/no_response_fields.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import json5
|
|
3
3
|
import os
|
|
4
|
+
from fastcodedog.common.write_file import write_json_file
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
def set_no_response_fields(schema_directory, no_response_fields):
|
|
@@ -17,4 +18,4 @@ def set_no_response_fields(schema_directory, no_response_fields):
|
|
|
17
18
|
for field_name, field in data['fields'].items():
|
|
18
19
|
if field_name in no_response_fields or f'{schema_name}.{field_name}' in no_response_fields:
|
|
19
20
|
field['no_response'] = True
|
|
20
|
-
|
|
21
|
+
write_json_file(json_file, data)
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/response_schemas.py
RENAMED
|
@@ -3,6 +3,7 @@ import json5
|
|
|
3
3
|
|
|
4
4
|
from fastcodedog.common.source_file_path import get_schema_file_path
|
|
5
5
|
from fastcodedog.context.common.get_relationship import get_class_type_by_model_and_relationship_name
|
|
6
|
+
from fastcodedog.common.write_file import write_json_file
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def generate_sub_objects(expression, schema_data):
|
|
@@ -57,4 +58,4 @@ def add_response_schemas(response_schemas):
|
|
|
57
58
|
if 'response_schemas' not in data:
|
|
58
59
|
data['response_schemas'] = {}
|
|
59
60
|
data['response_schemas'][name] = schema_data
|
|
60
|
-
|
|
61
|
+
write_json_file(json_file, data)
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_to_schema/specified_field_types.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import json5
|
|
3
3
|
import os
|
|
4
|
+
from fastcodedog.common.write_file import write_json_file
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
def rename_specified_field_types(schema_directory, specified_field_types):
|
|
@@ -19,5 +20,5 @@ def rename_specified_field_types(schema_directory, specified_field_types):
|
|
|
19
20
|
field['pydantic_type'] = field['pydantic_type_with_length'] = specified_field_types[field_name]
|
|
20
21
|
elif f'{schema_name}.{field_name}' in specified_field_types:
|
|
21
22
|
field['pydantic_type'] = field['pydantic_type_with_length'] = specified_field_types[f'{schema_name}.{field_name}']
|
|
22
|
-
|
|
23
|
+
write_json_file(json_file, data)
|
|
23
24
|
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/additional_methods.py
RENAMED
|
@@ -3,6 +3,7 @@ import json5
|
|
|
3
3
|
import os
|
|
4
4
|
|
|
5
5
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
6
|
+
from fastcodedog.common.write_file import write_json_file
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def add_additional_methods(model_directory, additional_methods):
|
|
@@ -15,4 +16,4 @@ def add_additional_methods(model_directory, additional_methods):
|
|
|
15
16
|
if 'additional_methods' not in data:
|
|
16
17
|
data['additional_methods'] = {}
|
|
17
18
|
data['additional_methods'][additional_method['name']] = additional_method
|
|
18
|
-
|
|
19
|
+
write_json_file(json_file, data)
|
|
@@ -4,6 +4,7 @@ import os
|
|
|
4
4
|
import re
|
|
5
5
|
|
|
6
6
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
7
|
+
from fastcodedog.common.write_file import write_json_file
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def add_relationships(model_directory, additional_relationships):
|
|
@@ -19,6 +20,6 @@ def add_relationships(model_directory, additional_relationships):
|
|
|
19
20
|
additional_relationship.pop('module')
|
|
20
21
|
additional_relationship.pop('model_name')
|
|
21
22
|
data['relationships'][name] = additional_relationship
|
|
22
|
-
|
|
23
|
+
write_json_file(json_file, data)
|
|
23
24
|
|
|
24
25
|
|
|
@@ -3,6 +3,7 @@ import json5
|
|
|
3
3
|
import os
|
|
4
4
|
|
|
5
5
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
6
|
+
from fastcodedog.common.write_file import write_json_file
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def add_cases(model_directory, cases):
|
|
@@ -25,5 +26,5 @@ def add_cases(model_directory, cases):
|
|
|
25
26
|
if 'cases' not in data:
|
|
26
27
|
data['cases'] = {}
|
|
27
28
|
data['cases'][name] = case
|
|
28
|
-
|
|
29
|
+
write_json_file(json_file, data)
|
|
29
30
|
|
|
@@ -3,6 +3,7 @@ import json5
|
|
|
3
3
|
import os
|
|
4
4
|
|
|
5
5
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
6
|
+
from fastcodedog.common.write_file import write_json_file
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def add_computed_properties(model_directory, computed_properties):
|
|
@@ -15,4 +16,4 @@ def add_computed_properties(model_directory, computed_properties):
|
|
|
15
16
|
if 'computed_properties' not in data:
|
|
16
17
|
data['computed_properties'] = {}
|
|
17
18
|
data['computed_properties'][computed_property['name']] = computed_property
|
|
18
|
-
|
|
19
|
+
write_json_file(json_file, data)
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/after/copy_methods.py
RENAMED
|
@@ -3,6 +3,7 @@ import json5
|
|
|
3
3
|
import os
|
|
4
4
|
|
|
5
5
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
6
|
+
from fastcodedog.common.write_file import write_json_file
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def add_copy_methods(model_directory, copy_methods):
|
|
@@ -15,4 +16,4 @@ def add_copy_methods(model_directory, copy_methods):
|
|
|
15
16
|
if 'copy_methods' not in data:
|
|
16
17
|
data['copy_methods'] = {}
|
|
17
18
|
data['copy_methods'][copy_method['name']] = copy_method
|
|
18
|
-
|
|
19
|
+
write_json_file(json_file, data)
|
|
@@ -4,6 +4,7 @@ import os
|
|
|
4
4
|
import re
|
|
5
5
|
|
|
6
6
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
7
|
+
from fastcodedog.common.write_file import write_json_file
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def disable_relationships(model_directory, disabled_relationships):
|
|
@@ -22,7 +23,7 @@ def disable_relationships(model_directory, disabled_relationships):
|
|
|
22
23
|
relationship['disabled'] = True
|
|
23
24
|
no_backpopulates.append({'model_directory': model_directory, 'relationship': relationship})
|
|
24
25
|
break
|
|
25
|
-
|
|
26
|
+
write_json_file(json_file, data)
|
|
26
27
|
# 和disable独立执行,防止修改同一个文件时互相覆盖
|
|
27
28
|
for no_backpopulate in no_backpopulates:
|
|
28
29
|
_add_no_backpopulates(no_backpopulate['model_directory'], no_backpopulate['relationship'])
|
|
@@ -38,4 +39,4 @@ def _add_no_backpopulates(model_directory, another_side_relationship):
|
|
|
38
39
|
if name == another_side_relationship['back_populates']:
|
|
39
40
|
relationship['no_back_populates'] = True
|
|
40
41
|
break
|
|
41
|
-
|
|
42
|
+
write_json_file(json_file, data)
|
|
@@ -2,6 +2,7 @@ import json5
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
5
|
+
from fastcodedog.common.write_file import write_json_file
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def add_specified_class_names(pdm, specified_class_name):
|
|
@@ -36,4 +37,4 @@ def add_specified_class_names(pdm, specified_class_name):
|
|
|
36
37
|
# for name, relationship in data['relationships'].items():
|
|
37
38
|
# if name == another_side_relationship['back_populates']:
|
|
38
39
|
# relationship['back_populates_model'] = dst
|
|
39
|
-
#
|
|
40
|
+
# write_json_file(json_file, data)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import json5
|
|
3
3
|
import os
|
|
4
4
|
from fastcodedog.util.case_converter import camel_to_snake
|
|
5
|
+
from fastcodedog.common.write_file import write_json_file
|
|
5
6
|
|
|
6
7
|
def specified_relationship_orderby(model_directory, specified_relationship_by):
|
|
7
8
|
for srb in specified_relationship_by:
|
|
@@ -16,7 +17,7 @@ def specified_relationship_orderby(model_directory, specified_relationship_by):
|
|
|
16
17
|
if 'relationships' not in data or relationship_name not in data['relationships']:
|
|
17
18
|
continue
|
|
18
19
|
data['relationships'][relationship_name]['order_by'] = order_by
|
|
19
|
-
|
|
20
|
+
write_json_file(json_file, data)
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "fastcodedog"
|
|
3
|
-
version = "3.2.
|
|
3
|
+
version = "3.2.8"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["taohoo <taohoo@163.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -13,11 +13,11 @@ json5 = ">=0.9.25"
|
|
|
13
13
|
inflect = ">=7.2.1"
|
|
14
14
|
autopep8 = ">=2.2.0"
|
|
15
15
|
|
|
16
|
-
[tool.poetry.dev
|
|
16
|
+
[tool.poetry.group.dev.dependencies]
|
|
17
17
|
setuptools = ">=70.0.0"
|
|
18
18
|
pytest = ">=8.2.2"
|
|
19
19
|
virtualenv = ">=20.26.0"
|
|
20
|
-
poetry = ">=1.8.3"
|
|
20
|
+
poetry = ">=1.8.3"
|
|
21
21
|
|
|
22
22
|
[build-system]
|
|
23
23
|
requires = ["poetry-core"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/configfiles/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/oauthfiles/__init__.py
RENAMED
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/toolfiles/__init__.py
RENAMED
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/utilfiles/__init__.py
RENAMED
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/generation/commonfiles/utilfiles/api_logging.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_and_schema_to_crud/__init__.py
RENAMED
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/model_and_schema_to_crud/prepare.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/pdm_to_model/before/fill_tenant_id.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/__init__.py
RENAMED
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/endpoint.py
RENAMED
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/prepare.py
RENAMED
|
File without changes
|
{fastcodedog-3.2.6 → fastcodedog-3.2.8}/fastcodedog/prepare/schema_and_crud_to_api/schemas.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|