zrb 1.0.0b9__py3-none-any.whl → 1.0.0b10__py3-none-any.whl

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.
Files changed (61) hide show
  1. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/.coveragerc +11 -0
  2. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/.gitignore +4 -0
  3. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/column/add_column_task.py +4 -4
  4. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/config.py +5 -0
  5. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_task.py +107 -1
  6. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +67 -4
  7. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_create_my_entity.py +53 -0
  8. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_delete_my_entity.py +62 -0
  9. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_read_my_entity.py +65 -0
  10. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_update_my_entity.py +61 -0
  11. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/gateway_subroute.py +57 -13
  12. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +2 -2
  13. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/gateway/subroute/my_module.py +6 -1
  14. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/module_task_definition.py +10 -6
  15. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/task.py +56 -12
  16. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/task_util.py +10 -4
  17. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/base_service.py +136 -52
  18. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/parser.py +1 -1
  19. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/config.py +1 -0
  20. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/versions/3093c7336477_add_auth_tables.py +46 -43
  21. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/versions/8ed025bcc845_create_permissions.py +69 -0
  22. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_db_repository.py +5 -2
  23. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/user_service.py +16 -21
  24. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/subroute/auth.py +193 -43
  25. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/util/auth.py +57 -0
  26. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/requirements.txt +6 -1
  27. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/permission.py +1 -0
  28. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/user.py +9 -0
  29. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/_util/access_token.py +19 -0
  30. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_create_permission.py +59 -0
  31. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_delete_permission.py +68 -0
  32. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_read_permission.py +71 -0
  33. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_update_permission.py +66 -0
  34. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/test_user_session.py +195 -0
  35. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/test_health_and_readiness.py +28 -0
  36. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/test_homepage.py +17 -0
  37. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/test_not_found_error.py +16 -0
  38. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test.sh +7 -0
  39. zrb/task/base_task.py +10 -10
  40. zrb/util/codemod/modification_mode.py +3 -0
  41. zrb/util/codemod/modify_class.py +58 -0
  42. zrb/util/codemod/modify_class_parent.py +68 -0
  43. zrb/util/codemod/modify_class_property.py +128 -0
  44. zrb/util/codemod/modify_dict.py +75 -0
  45. zrb/util/codemod/modify_function.py +65 -0
  46. zrb/util/codemod/modify_function_call.py +68 -0
  47. zrb/util/codemod/modify_method.py +88 -0
  48. zrb/util/codemod/{prepend_code_to_module.py → modify_module.py} +2 -3
  49. zrb/util/file.py +3 -2
  50. {zrb-1.0.0b9.dist-info → zrb-1.0.0b10.dist-info}/METADATA +1 -1
  51. {zrb-1.0.0b9.dist-info → zrb-1.0.0b10.dist-info}/RECORD +53 -36
  52. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/migrate.py +0 -3
  53. zrb/util/codemod/append_code_to_class.py +0 -35
  54. zrb/util/codemod/append_code_to_function.py +0 -38
  55. zrb/util/codemod/append_code_to_method.py +0 -55
  56. zrb/util/codemod/append_key_to_dict.py +0 -51
  57. zrb/util/codemod/append_param_to_function_call.py +0 -39
  58. zrb/util/codemod/prepend_parent_to_class.py +0 -38
  59. zrb/util/codemod/prepend_property_to_class.py +0 -55
  60. {zrb-1.0.0b9.dist-info → zrb-1.0.0b10.dist-info}/WHEEL +0 -0
  61. {zrb-1.0.0b9.dist-info → zrb-1.0.0b10.dist-info}/entry_points.txt +0 -0
@@ -17,28 +17,33 @@ zrb/builtin/md5.py,sha256=0pNlrfZA0wlZlHvFHLgyqN0JZJWGKQIF5oXxO44_OJk,949
17
17
  zrb/builtin/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  zrb/builtin/project/add/fastapp/fastapp_input.py,sha256=fYD6n8-PlrTyz1Kq5GYAt0PQsyUp2qsPKRJ68hINSXE,314
19
19
  zrb/builtin/project/add/fastapp/fastapp_task.py,sha256=mUMZjC413DhZSKqA6donPTxVbd_DnDFqSV_ZTqQnSHs,2697
20
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/.coveragerc,sha256=MsTf0Vlt_pxV-j4mNh-TxSo7sTI_GaVS_oM4tksIykE,181
20
21
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/.flake8,sha256=fgvHmuskgYiCvHZHaFtiyOWW0zasVrs0P-sFHOq3W5U,56
21
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/.gitignore,sha256=1BMFpr_M5OyTs-weCZZlVlf85sWikzdbvmKu86YD7G0,28
22
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/.gitignore,sha256=D-ISOzaKlN_VzeZP5f8aznDSJX4p8PCtaK2JWM5yY1c,61
22
23
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/README.md,sha256=MAo7ZFbg7LLiAfQbXcippMgjJ2-VXMKtiTDEZ3I4AAg,221
23
24
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/column/add_column_task.py,sha256=x7igeeJl8M0vKw9v0VG6zIFk7qAZD2NIH3_uG-VJimY,2868
25
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/config.py,sha256=rllXYH4LRyt-vXAoMLENx1T-01nxjN6CpWf76b_-ppw,580
26
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_task.py,sha256=Ny62k3_23ln6_HplbiHx2X01uJ74wY50k8Skp0XAKe8,6324
27
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py,sha256=gtWMWdc0QC4vbMtzUJi_ZDlY5dZJCTWdJBCPGn0vkso,11962
25
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/column/add_column_task.py,sha256=NYp9_qG8BsAmx7et-zAqGLF3KXV1JsoeFs_6jckZtD4,2860
26
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/config.py,sha256=uviB4q2iZjoU9_fA1O4VrjpuVAqx2gj5hjospJ0Xzeg,885
27
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_task.py,sha256=LPTAW99f4UTJHzXFSsnjpEWdlBtr7JxKenW3gdTCBbI,10048
28
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py,sha256=I71gqR_K13dzGWpce9Z_OD5-FxWJF8dnElf2Lfdc6C4,14152
28
29
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/my_entity_service.py,sha256=PgwTsHMHRiFS7JQeAe6wWmIHk6s-OfIybx_mJfuT_G4,3918
29
30
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/my_entity_service_factory.py,sha256=lnhhpc_AflWnCQbLkYORrshiqIA5wy4SdxDuUxmn7Ts,372
30
31
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/repository/my_entity_db_repository.py,sha256=GrMxMb98-XD7Rue1v14jBu6HRb8Gy5DywBSKnMhN0iY,770
31
32
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/repository/my_entity_repository.py,sha256=QJmQmeXvkuhpnAFWkATJk7zvr-GY1RSyb5U9bSslFn4,1644
32
33
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/repository/my_entity_repository_factory.py,sha256=XKkHHpH_3N_govvyuPY6yn1PBZKKtwstWtxyo7hYJS8,523
33
34
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/schema/my_entity.py,sha256=Xu8ELEI_chPmaX6ks4z_bbYO3ZapdWCXcJlmUnED1-I,1240
35
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_create_my_entity.py,sha256=00aKIcP1_XDsjt2LtOlHYbXbXv3Btpce5rN-0G1UnDw,1815
36
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_delete_my_entity.py,sha256=pGA2Lb7FbrQRvzRbkJ7z_PZUPMRg8tQfYY3jyCbv7OY,2272
37
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_read_my_entity.py,sha256=2a6uikwnEldW6_lxIMIu8A2HYPcBjSsrE0ynGpiTbE0,2337
38
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/test/my_module/my_entity/test_update_my_entity.py,sha256=qaktWwjGUL1C06L7Rf0ZUg9y0lYOHGlVe7bMNBAcAfE,2148
34
39
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/client_method.py,sha256=0Bwn1lamv3o6ti68gk35gPiKxbKUQRysNAnHOlVz9TY,1311
35
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/gateway_subroute.py,sha256=-0-ukhgjiHYZ0vf26Ky4tHeFKeV9fb8Gwj3YCi99BAM,2149
40
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/gateway_subroute.py,sha256=ypRoqIizpF0TPI03yyHm1x_O8if_2x9MxrM-CU9IttM,3850
36
41
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/format_task.py,sha256=8YykCthDgjXT8MFvTrPSWYUXsfhafmoSMG9LH2ZiaD0,431
37
42
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/group.py,sha256=S0sKnnABSGy3YzaExH40xJjm4UsEX6AyDE1u94ewk6A,648
38
43
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/input.py,sha256=NBy_9xwvbFvKWt2bHRyzNQr4zUrP4lUGd6L7k_eA5do,1523
39
44
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_task.py,sha256=mGD3iHocO3TcmFgrBRHEoOgci3qXmwaSmEpVe7jGjvE,3690
40
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py,sha256=2totrFEzt0sEA4U0HHMy5GAsNM-X6uLv9eq8rsrA9XU,7145
41
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/gateway/subroute/my_module.py,sha256=Ks-TtmuhzFy1H5BGQt7FU09ZHBTWwsSVhHFzOXpnSQg,120
45
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py,sha256=sOXaS2IQLda5g-LNDqODM2MRUTKirjxueiOmxlSJIAs,7130
46
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/gateway/subroute/my_module.py,sha256=6WU441lQjeJqtJsKvsj0RY_amCuFcoImprTuivfIdLM,330
42
47
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/alembic.ini,sha256=mgQyBAIwdkZZJWLu_FQWPx1FkyaARCNp6-rLqSVvMbA,3723
43
48
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/my_module_api_client.py,sha256=7Ffk0eF4HX1RLfmacqHvuhNlfWkWAtunUBdF_N-Gq38,186
44
49
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/my_module_client.py,sha256=VIkqW4-PKKGJqpwMzEX_kmN6H31m-W11FzdPK9pNNdU,109
@@ -51,27 +56,26 @@ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/templat
51
56
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/migration_metadata.py,sha256=NbIb5ncy6x5RrFD2TZMDwxBK_wDTyJEIvieMRmNpf9M,55
52
57
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/route.py,sha256=PbWya4KW4OyoJl-5OpZm1gJMLeWOBvyHLlez9r5baOk,960
53
58
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/module_task_definition.py,sha256=avqbX7qgfW5KAB7Q_FDrbKcl5NqxSHBx0Ii5fKV0Oec,907
55
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/task.py,sha256=MCIH7TfGq3KkLp2pLCFyCv7gIWAjwnL8omaBvhkzZx4,4612
56
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/task_util.py,sha256=pSu5NemKWNNgZzU3eVlgBX9jKzCGOpqymYohO8KYBsA,2907
59
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/module_task_definition.py,sha256=KaI2CiMLdzZH-_C_ckHiQpX4NZFefBCWxEQBIeuSgJ8,1024
60
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/task.py,sha256=SgAcqsmJ2bCHWywzFdZRxkl5D_wvKXJH1tcIeOhPjUw,5675
61
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/task_util.py,sha256=n2CgAoTC4213sj5m1E1UHvoG3opIZoSuG94uxQPecrE,3077
57
62
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/util.py,sha256=cyesVckwI4y2IXuvBCI_PNBpXKX07Z-8K-T22SMZDeY,1937
58
63
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/venv_task.py,sha256=ZLS3YnF-bz1AOjMCMHypzjNGX2UHXG-axdYngznC1mk,472
59
64
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
65
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/app_factory.py,sha256=9mEGQSNfGeNNrCziw0Ik4JeJWKwhOcfcWN5-uMin7aw,773
61
66
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/base_db_repository.py,sha256=LjdeLXxn_2yj3b2X56Qa83sF-dM2sgJMgQA_HaLG0go,11818
62
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/base_service.py,sha256=5Z9srxvyvPW8TSc4OpiuNdQ1T00jZe94SPnymzcetpw,8629
67
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/base_service.py,sha256=YGkoJ0PHlbq586XNQXBjIJEduIq-dFg9k_P4CAK4mFk,12164
63
68
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/db_engine_factory.py,sha256=Ku4iowi5DhkXwdWGljCOiHqcC4sI_mTB0hpvmd1_4x0,198
64
69
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/error.py,sha256=MCPn4hkJiCMgtCqVFusK0RHEQ-eABs_JjzHoWpPtvVs,1219
65
70
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/logger_factory.py,sha256=v_glMWbCZfFRtLq6vSu1fWYcubYhnpD4j2nc9NS6-Wo,241
66
71
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/parser_factory.py,sha256=0dsYhxDec4EBDngkLyyPztDOhNUEyDue8DjIPUd5XvM,238
67
72
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/schema.py,sha256=dbRryeP5u7ObGX3GjF9ZID00yXffOp-AxyXu8oVJP0I,82
68
73
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/app.py,sha256=AeLoeMwQBqCLVUw9DaeOfAabKQxa7bT82QPo-1naiA0,1546
69
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/parser.py,sha256=dvS9cBRx1FjerwHO_HOaHKCKEzwWRJ5C7wYimzHp4i8,4035
74
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/parser.py,sha256=xGAXc3dIkstQwPtckDvN_i-PjizgpHaVY53mHpISLIo,4036
70
75
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/user_agent.py,sha256=eOFJ9gnz0iw7XE-1vc53bx-uPST6m5K3cpR_f61T544,1669
71
76
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/view.py,sha256=vrNAr90GMZnu37EMvi2BnTgWoAOpQwJxWCFkZAtFeFA,1161
72
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/config.py,sha256=QssiD5fvMZaklO7m8ORNFg7mSIqLaag4hMZ1z_H3X-0,3109
77
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/config.py,sha256=2k3FsKJrUrR-rTkletVnof1cCJ0lzmnvK85jeCPxUwo,3110
73
78
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/main.py,sha256=ouA4P7f7GDuB-0iPJsOjqh_DGlZaOBnMgBgkUy9Os5A,216
74
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/migrate.py,sha256=K20Seket9IlZVaZpHSrpR0Ijndv71Mtqwiujzunx98w,87
75
79
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
80
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/alembic.ini,sha256=mgQyBAIwdkZZJWLu_FQWPx1FkyaARCNp6-rLqSVvMbA,3723
77
81
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/auth_api_client.py,sha256=T6fcaGobL2A24PhFbNPb7mlJ9Erxufh0Eh-E6K6Qs4I,628
@@ -81,7 +85,8 @@ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/
81
85
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/README,sha256=MVlc9TYmr57RbhXET6QxgyCcwWP7w-vLkEsirENqiIQ,38
82
86
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/env.py,sha256=rtUFa4Gaoz3wmq7YfQ-lY8vYA5aWguwe2yvQQ1OLCL8,3343
83
87
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/script.py.mako,sha256=U9DYBoBRd_ooogMfRydCUGEjIDZ-aV8OsjBiBrdTvy4,680
84
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/versions/3093c7336477_add_auth_tables.py,sha256=GC46G9TDcihsnRU1kR9mbWm88AjqXnXgNN6uy1rZNGQ,8890
88
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/versions/3093c7336477_add_auth_tables.py,sha256=IRCM8ewmNsgLVDUs0FLipIXu5mahgEv0d5f34wB0d3c,8966
89
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/versions/8ed025bcc845_create_permissions.py,sha256=DiGwt4iL1n5A9COUTF8UE2RceVOeeJM7sxnNrTq85QI,2259
85
90
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration_metadata.py,sha256=4eF1sqtd87v9yHGR6N6Ko4LVELr3tYYwQmJwhvz9uXM,653
86
91
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/route.py,sha256=PYW4Wn0yCADI9HwGPxhYzxzRIEJMAT0LwSVs-jC7gJw,1335
87
92
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -98,10 +103,10 @@ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service
98
103
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/role_service.py,sha256=lO-h9ZXq_HSSpUrvz-osbADUnO6zzpfREmT9Bc1rqYw,5143
99
104
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/role_service_factory.py,sha256=TqQfx0jXGZmBDR1UYPyys8-I6tDKhqr1yjWpp-ezkDA,305
100
105
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_db_repository.py,sha256=qrYB1YWYnauuQ56mNh4mxuELs96qnkr9Cf8PyghJHyg,10105
106
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_db_repository.py,sha256=V_SUlkZoXhgfHwsyMNmxFiHgC4aMpbx0iI5v3KqQDwg,10228
102
107
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_repository.py,sha256=GT1N3XI_eN_Kbjc036jTS43ONrwzA9UlR6NMzvQ_9DA,3069
103
108
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_repository_factory.py,sha256=Ea9ykNhzYiWu_IEhfpWsg1OIWeQ9pOTCzbZF9rrsZqU,463
104
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/user_service.py,sha256=uSo1f93BL-kQgnR85OHuJpuSqmxRxM4YmgWWy_QiZp0,12792
109
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/user_service.py,sha256=JigJLQ4zYpNGdoPtSNs0Hf-QYTgCCYGuM58nclUEAfs,12652
105
110
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/user_service_factory.py,sha256=TFqm7_wcU6zDiyV7DSCYc1Q47ppZaIDxlK_R9PmpDI4,1239
106
111
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/alembic.ini,sha256=mgQyBAIwdkZZJWLu_FQWPx1FkyaARCNp6-rLqSVvMbA,3723
107
112
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/migration/README,sha256=MVlc9TYmr57RbhXET6QxgyCcwWP7w-vLkEsirENqiIQ,38
@@ -110,7 +115,8 @@ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/migr
110
115
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/migration/versions/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
111
116
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/migration_metadata.py,sha256=NbIb5ncy6x5RrFD2TZMDwxBK_wDTyJEIvieMRmNpf9M,55
112
117
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/route.py,sha256=5to7rhN3n-N2-7HqRQf9AE9r6OUJQTEyS-g5dPkjV7Q,2015
113
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/subroute/auth.py,sha256=XhY2QiHXx7QKoLgjAtnt2efJlb2dNfIua42ezbwWEDc,8125
118
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/subroute/auth.py,sha256=NW5-cX5xW9RvSEeqcBu1LVIGZVK2MdWKESKnqcbtYwM,14208
119
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/util/auth.py,sha256=NOZkAjH2nhV3ugOz02d2dpxdG8mTldXhigLV5r1Aba4,2265
114
120
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/util/view.py,sha256=mlYSu1xfL_nztJHPbBRuUQuKBT0zCNgsg6bouw5PfG0,2117
115
121
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/content/error.html,sha256=K8jJFW99ORUrJqdybmWf191NK7tCFNoc5VmmNAcWqeo,133
116
122
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/content/homepage.html,sha256=Q8jEwRraYJmn0rJIT1Ct4Dz2NB4S-NWJ1ZrU46oZkkw,126
@@ -138,12 +144,22 @@ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view
138
144
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.yellow.min.css,sha256=mOkvNiE272UAgO8cVewJjU9BYidLxDZ97IcYodW--Ik,82218
139
145
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.zinc.min.css,sha256=s8SdVQv4fX3W0LbfKDgUDczWcCyUfRbZhpyYtLdASC0,82212
140
146
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/template/default.html,sha256=kSQFOLj1urKRbMwVX5S2AHmHUxF1SVjw3NWbt32pYRg,1137
141
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/requirements.txt,sha256=10a4hYLlOgU-Dn3OUbw1Ml2HC_gmslJF4LfpZlnBBas,122
147
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/requirements.txt,sha256=NRd3QLqRXhNwd_YCEHRZ-yzXEQVsUn9D8l9MaxzykhA,194
142
148
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/permission.py,sha256=bMCajbTijzfr0kHqV80OjH7JPmZ7xsT1yM9KP5mbfD4,1364
149
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/permission.py,sha256=95L7B4g5T6a5mgoXGgK2Fb5h2ugRzb5QIbXyRRh9tmE,1385
144
150
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/role.py,sha256=UKXijAUY0ryXJFv74lCzH5ArYGbeuakX0cUbP7ToAQU,3167
145
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/user.py,sha256=z6bujKgcyYrQE-pqtQSc-BU7KhuwqZWkPQbmOfR5S1A,4035
151
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/user.py,sha256=W6c-x0a0xcr3-Gj9CXy8liXM_f8yAYhLGTm9EyJmUgs,4338
146
152
  zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/template.env,sha256=DquDUGa12Jzg24ATq_I6M-TglO-2vDwr5kE768DoJ-w,61
153
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/_util/access_token.py,sha256=hbSxpc70jaA9nNvVKwUeqFtFr6gtwKwqUD8TED2xvII,605
154
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_create_permission.py,sha256=kY2ZMhj4OZ90d0R54ag6qLDtLemR8jq4XS0fpZyh5-k,2243
155
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_delete_permission.py,sha256=632pQEAj47IJIVXBxJY8riKC4pOmARKeWnB_4mNl40U,2740
156
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_read_permission.py,sha256=mc9QcM3MbCbM05qWAxD4pU5JU9_pklIs4dEfvkEPZn4,2789
157
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/permission/test_update_permission.py,sha256=AHTUIX7cdR5tKkbxs6JVrp5uoeiwIvqaBrhLFGOYoFg,2498
158
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/auth/test_user_session.py,sha256=RITk3KohVSEzdvyoOefzrx2eabHEhAx3eS3opjZwU5k,7096
159
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/test_health_and_readiness.py,sha256=nqbRJtGQdaHsj3MqiFrUPpQteRBRPiyHp9dpdUZcMg0,823
160
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/test_homepage.py,sha256=4lEaqacDTPzf6tjkwO8DUj01r4R9a17tnr-ZAWoI1p4,532
161
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test/test_not_found_error.py,sha256=SBqFRgGUldUtIz-uMf9a5DeWDPFeKbhvnvwiYr-jjns,502
162
+ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/test.sh,sha256=QIwe6InrlEkmxdtj6NTO9JozeECYN0O4vx-x-qid6go,148
147
163
  zrb/builtin/project/add/fastapp/fastapp_util.py,sha256=UVzKfljUDLvlassnKy8pKH4hBP23ZUwEK5Ouh-fr87w,1463
148
164
  zrb/builtin/project/create/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
149
165
  zrb/builtin/project/create/project-template/README.md,sha256=BHeWF_txdTDzKewWdWfGhO3YOTiW8E3YwTMnd0T1LVA,39
@@ -261,7 +277,7 @@ zrb/session_state_logger/file_session_state_logger.py,sha256=1ue7-Bcwg4wlLn2G_7A
261
277
  zrb/session_state_logger/session_state_logger_factory.py,sha256=wXf2DVmeRmx399MFYYty6uNcPZMcf7iayHBYCLGlhfc,189
262
278
  zrb/task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
263
279
  zrb/task/any_task.py,sha256=9rCdKe-Sayr34Han9AsbhRxFpkbk6Rteg1DOyETulwQ,4917
264
- zrb/task/base_task.py,sha256=ImA0ReyB6neVUfY4nKLnL0h2EMGIJ9wvvNvIAN92-RE,21194
280
+ zrb/task/base_task.py,sha256=SQRf37bylS586KwyW0eYDe9JZ5Hl18FP8kScHae6y3A,21251
265
281
  zrb/task/base_trigger.py,sha256=jC722rDvodaBLeNaFghkTyv1u0QXrK6BLZUUqcmBJ7Q,4581
266
282
  zrb/task/cmd_task.py,sha256=pUKRSR4DZKjbmluB6vi7cxqyhxOLfJ2czSpYeQbiDvo,10705
267
283
  zrb/task/http_check.py,sha256=Gf5rOB2Se2EdizuN9rp65HpGmfZkGc-clIAlHmPVehs,2565
@@ -283,16 +299,17 @@ zrb/util/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
283
299
  zrb/util/cmd/command.py,sha256=XSzZlaAyfMXSErg83CmdrL0pORiZ2O9cd80Ta1GmYsM,3925
284
300
  zrb/util/cmd/remote.py,sha256=VklVORobTmE7FqdtYsVLq9xkSYTR2W5r2Zou0-soidw,710
285
301
  zrb/util/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
286
- zrb/util/codemod/append_code_to_class.py,sha256=5PiGzFqB-q8XQnGnDqWBn4OA4ydSmQWpKQzSr3l6wws,1361
287
- zrb/util/codemod/append_code_to_function.py,sha256=kOCWuaVMoRgyGdyAZOrx8NNUOMUY5scyOegJsqJhUO4,1497
288
- zrb/util/codemod/append_code_to_method.py,sha256=nfTcBkcvPZX0YhQzOb0abqbW3m2EKlbwbb-WRXtMBF4,2368
289
- zrb/util/codemod/append_key_to_dict.py,sha256=ZVaAXCZEXs_j3NrCjvXoOYeDFF0RCLYe7y-dJZIcBvI,2113
290
- zrb/util/codemod/append_param_to_function_call.py,sha256=V8hQor4z0dTSiLzQ7pYOZI2TclUlwc-ZNe5KpqlH7X8,1570
291
- zrb/util/codemod/prepend_code_to_module.py,sha256=O_2PxXdRiIf-aJ3AUAAHuezYzJol83V4Y8TZ2T3-aEE,525
292
- zrb/util/codemod/prepend_parent_to_class.py,sha256=xOcDHv1cXXV_VqLHVifr6jvDoWk_iOLammhNxsWc6r8,1417
293
- zrb/util/codemod/prepend_property_to_class.py,sha256=9L11WaYIUF53Kn_ZMT51ylhm7xTxttNjPp83Mnm9iUQ,2079
302
+ zrb/util/codemod/modification_mode.py,sha256=peqs_Jot9tTEK3HF1P4iD-0LpL2d8oniGEgTnktUCPc,35
303
+ zrb/util/codemod/modify_class.py,sha256=ePZy0QaHfvTdPl5J_n9zezUyA_mXSYkvF-0FjLn0wPc,2396
304
+ zrb/util/codemod/modify_class_parent.py,sha256=Hii1gyTnNqwN5P4DMNXnth-kcUTFmObSLJysmrA8Kt0,2552
305
+ zrb/util/codemod/modify_class_property.py,sha256=WczVHkfcPWc0m8OjTaDgnweFv8YTsdIJiWYCpCekRb0,4707
306
+ zrb/util/codemod/modify_dict.py,sha256=zKRgUmQ2J_lsPjawWFR7tEJHSKOTi-WWyGXe7baiwiY,3119
307
+ zrb/util/codemod/modify_function.py,sha256=hTWaIlaplJ52DRg265V9B0IUKHdMMLWuHsxhuKAxrEw,2584
308
+ zrb/util/codemod/modify_function_call.py,sha256=F7EejY7nzvYVElJPVneMcLIUig_Hj0lLIseD0OhRUFI,2668
309
+ zrb/util/codemod/modify_method.py,sha256=FPPkNtvf2QO2cEfYtiO_GlNDNFOLylEET1NEOqkV7aA,3684
310
+ zrb/util/codemod/modify_module.py,sha256=_P6yq5TA_n72mmZIOrK914zPtv1RrRI8WC3YxpWNsRs,437
294
311
  zrb/util/cron.py,sha256=9fTGatUMYCRgmDFGg-z6_XerT4U5Vq72nD05NnEVUm4,2852
295
- zrb/util/file.py,sha256=cBPkIonfcWytoqtG3ScJd6FFK7HVYeCIuLmfAFO1HIQ,791
312
+ zrb/util/file.py,sha256=mgNobIKCr0eIQUlg6W2Yg1fvg943VyuOUF8WMFpJA5A,859
296
313
  zrb/util/git.py,sha256=TShnMxPAk20Tglp25d_XPVZX-q0mvKeqdprVMeXQ5f0,4787
297
314
  zrb/util/git_subtree.py,sha256=zyWl0aUEZJyUJKjfw1uglozB4R1kF9pWtfKjhu8DN44,2658
298
315
  zrb/util/group.py,sha256=Bg7HrSycoK110U5s_Tca6-uUQuZ5CMgb8wxZSrvDQ98,2790
@@ -306,7 +323,7 @@ zrb/util/string/name.py,sha256=8picJfUBXNpdh64GNaHv3om23QHhUZux7DguFLrXHp8,1163
306
323
  zrb/util/todo.py,sha256=1nDdwPc22oFoK_1ZTXyf3638Bg6sqE2yp_U4_-frHoc,16015
307
324
  zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
308
325
  zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
309
- zrb-1.0.0b9.dist-info/METADATA,sha256=NAVGeL01mfAGgkwJEVjrZ1v17XSMJmma7p-nVS2u0IM,4309
310
- zrb-1.0.0b9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
311
- zrb-1.0.0b9.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
312
- zrb-1.0.0b9.dist-info/RECORD,,
326
+ zrb-1.0.0b10.dist-info/METADATA,sha256=D-MjCfRRAchHzgMopg24mUEsGIf06rXXtecvp1or_wo,4310
327
+ zrb-1.0.0b10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
328
+ zrb-1.0.0b10.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
329
+ zrb-1.0.0b10.dist-info/RECORD,,
@@ -1,3 +0,0 @@
1
- from my_app_name.module.auth import migration as auth_migration
2
-
3
- assert auth_migration
@@ -1,35 +0,0 @@
1
- import libcst as cst
2
-
3
-
4
- class ClassCodeAdder(cst.CSTTransformer):
5
- def __init__(self, class_name: str, new_code: str):
6
- self.class_name = class_name
7
- self.new_code = cst.parse_module(new_code).body
8
- self.class_found = False
9
-
10
- def leave_ClassDef(
11
- self, original_node: cst.ClassDef, updated_node: cst.ClassDef
12
- ) -> cst.ClassDef:
13
- # Check if this is the target class
14
- if original_node.name.value == self.class_name:
15
- self.class_found = True
16
- # Add the method to the class body
17
- new_body = updated_node.body.with_changes(
18
- body=updated_node.body.body + tuple(self.new_code)
19
- )
20
- return updated_node.with_changes(body=new_body)
21
- return updated_node
22
-
23
-
24
- def append_code_to_class(original_code: str, class_name: str, new_code: str) -> str:
25
- # Parse the original code into a module
26
- module = cst.parse_module(original_code)
27
- # Initialize transformer with the class name and method code
28
- transformer = ClassCodeAdder(class_name, new_code)
29
- # Apply the transformation
30
- modified_module = module.visit(transformer)
31
- # Check if the class was found
32
- if not transformer.class_found:
33
- raise ValueError(f"Class {class_name} not found in the provided code.")
34
- # Return the modified code
35
- return modified_module.code
@@ -1,38 +0,0 @@
1
- import libcst as cst
2
-
3
-
4
- class FunctionCodeAdder(cst.CSTTransformer):
5
- def __init__(self, function_name: str, new_code: str):
6
- self.function_name = function_name
7
- # Use parse_module to handle multiple statements
8
- self.new_code = cst.parse_module(new_code).body
9
- self.function_found = False
10
-
11
- def leave_FunctionDef(
12
- self, original_node: cst.ClassDef, updated_node: cst.ClassDef
13
- ) -> cst.ClassDef:
14
- # Check if the class matches the target class
15
- if original_node.name.value == self.function_name:
16
- self.function_found = True
17
- # Add the method to the class body
18
- new_body = updated_node.body.with_changes(
19
- body=updated_node.body.body + tuple(self.new_code)
20
- )
21
- return updated_node.with_changes(body=new_body)
22
- return updated_node
23
-
24
-
25
- def append_code_to_function(
26
- original_code: str, function_name: str, new_code: str
27
- ) -> str:
28
- # Parse the original code into a module
29
- module = cst.parse_module(original_code)
30
- # Initialize the transformer with the necessary information
31
- transformer = FunctionCodeAdder(function_name, new_code)
32
- # Apply the transformation
33
- modified_module = module.visit(transformer)
34
- # Error handling: raise an error if the class or function is not found
35
- if not transformer.function_found:
36
- raise ValueError(f"Function {function_name} not found.")
37
- # Return the modified code
38
- return modified_module.code
@@ -1,55 +0,0 @@
1
- import libcst as cst
2
-
3
-
4
- class MethodCodeAdder(cst.CSTTransformer):
5
- def __init__(self, class_name: str, method_name: str, new_code: str):
6
- self.class_name = class_name
7
- self.method_name = method_name
8
- # Use parse_module to handle multiple statements
9
- self.new_code = cst.parse_module(new_code).body
10
- self.class_found = False
11
- self.method_found = False
12
-
13
- def leave_ClassDef(
14
- self, original_node: cst.ClassDef, updated_node: cst.ClassDef
15
- ) -> cst.ClassDef:
16
- # Check if the class matches the target class
17
- if original_node.name.value == self.class_name:
18
- self.class_found = True
19
- # Now, modify function definitions inside this class
20
- new_body = []
21
- for (
22
- item
23
- ) in updated_node.body.body: # Access body.body, not just updated_node.body
24
- if (
25
- isinstance(item, cst.FunctionDef)
26
- and item.name.value == self.method_name
27
- ):
28
- # Modify the target function by adding the new code
29
- body_with_new_code = item.body.with_changes(
30
- body=item.body.body + tuple(self.new_code) # Add the new code
31
- )
32
- new_body.append(item.with_changes(body=body_with_new_code))
33
- self.method_found = True
34
- else:
35
- new_body.append(item)
36
- return updated_node.with_changes(body=cst.IndentedBlock(new_body))
37
- return updated_node
38
-
39
-
40
- def append_code_to_method(
41
- original_code: str, class_name: str, function_name: str, new_code: str
42
- ) -> str:
43
- # Parse the original code into a module
44
- module = cst.parse_module(original_code)
45
- # Initialize the transformer with the necessary information
46
- transformer = MethodCodeAdder(class_name, function_name, new_code)
47
- # Apply the transformation
48
- modified_module = module.visit(transformer)
49
- # Error handling: raise an error if the class or function is not found
50
- if not transformer.class_found:
51
- raise ValueError(f"Class {class_name} not found in the provided code.")
52
- if not transformer.method_found:
53
- raise ValueError(f"Method {function_name} not found in class {class_name}.")
54
- # Return the modified code
55
- return modified_module.code
@@ -1,51 +0,0 @@
1
- import libcst as cst
2
-
3
-
4
- class DictionaryModifier(cst.CSTTransformer):
5
- def __init__(self, dictionary_name: str, new_key: str, new_value: str):
6
- self.dictionary_name = dictionary_name
7
- self.new_key = new_key
8
- self.new_value = new_value
9
- self.found = False
10
-
11
- def leave_Assign(
12
- self, original_node: cst.Assign, updated_node: cst.Assign
13
- ) -> cst.Assign:
14
- # Extract the first target from updated_node, which will be an AssignTarget
15
- target = updated_node.targets[0]
16
- # Check if the target is a Name (which should represent the dictionary)
17
- if (
18
- isinstance(target.target, cst.Name)
19
- and target.target.value == self.dictionary_name
20
- ):
21
- # Check if it's a dictionary initialization (e.g., my_dict = {...})
22
- if isinstance(updated_node.value, cst.Dict):
23
- self.found = True
24
- # Add new key-value pair to the existing dictionary
25
- new_entries = updated_node.value.elements + (
26
- cst.DictElement(
27
- key=cst.SimpleString(f'"{self.new_key}"'),
28
- value=cst.SimpleString(f'"{self.new_value}"'),
29
- ),
30
- )
31
- new_dict = updated_node.value.with_changes(elements=new_entries)
32
- return updated_node.with_changes(value=new_dict)
33
- return updated_node
34
-
35
-
36
- def append_key_to_dict(
37
- original_code: str, dictionary_name: str, new_key: str, new_value: str
38
- ) -> str:
39
- # Parse the original code into a module
40
- module = cst.parse_module(original_code)
41
- # Initialize the transformer with the necessary information
42
- transformer = DictionaryModifier(dictionary_name, new_key, new_value)
43
- # Apply the transformation
44
- modified_module = module.visit(transformer)
45
- # Error handling: raise an error if the dictionary is not found
46
- if not transformer.found:
47
- raise ValueError(
48
- f"Dictionary {dictionary_name} not found in the provided code."
49
- )
50
- # Return the modified code
51
- return modified_module.code
@@ -1,39 +0,0 @@
1
- import libcst as cst
2
-
3
-
4
- class FunctionCallParamAdder(cst.CSTTransformer):
5
- def __init__(self, func_name: str, new_param: str):
6
- self.func_name = func_name
7
- # Parse the new parameter to ensure it’s a valid CST node
8
- self.new_param = cst.parse_expression(new_param)
9
- self.param_added = False
10
-
11
- def leave_Call(self, original_node: cst.Call, updated_node: cst.Call) -> cst.Call:
12
- # Check if the function call name matches the target function
13
- if (
14
- isinstance(original_node.func, cst.Name)
15
- and original_node.func.value == self.func_name
16
- ): # noqa
17
- # Add the new parameter to the function call arguments
18
- new_args = updated_node.args + (cst.Arg(value=self.new_param),)
19
- self.param_added = True
20
- return updated_node.with_changes(args=new_args)
21
- return updated_node
22
-
23
-
24
- def append_param_to_function_call(
25
- original_code: str, func_name: str, new_param: str
26
- ) -> str:
27
- # Parse the original code into a module
28
- module = cst.parse_module(original_code)
29
- # Initialize the transformer with the necessary information
30
- transformer = FunctionCallParamAdder(func_name, new_param)
31
- # Apply the transformation
32
- modified_module = module.visit(transformer)
33
- # Error handling: raise an error if the function call is not found
34
- if not transformer.param_added:
35
- raise ValueError(
36
- f"Function call to {func_name} not found in the provided code."
37
- )
38
- # Return the modified code
39
- return modified_module.code
@@ -1,38 +0,0 @@
1
- import libcst as cst
2
-
3
-
4
- class ParentClassAdder(cst.CSTTransformer):
5
- def __init__(self, class_name: str, parent_class_name: str):
6
- self.class_name = class_name
7
- self.parent_class_name = parent_class_name
8
- self.class_found = False
9
-
10
- def leave_ClassDef(
11
- self, original_node: cst.ClassDef, updated_node: cst.ClassDef
12
- ) -> cst.ClassDef:
13
- # Check if this is the target class
14
- if original_node.name.value == self.class_name:
15
- self.class_found = True
16
- # Add the parent class to the existing bases
17
- new_bases = (
18
- cst.Arg(value=cst.Name(self.parent_class_name)),
19
- *updated_node.bases,
20
- )
21
- return updated_node.with_changes(bases=new_bases)
22
- return updated_node
23
-
24
-
25
- def prepend_parent_class(
26
- original_code: str, class_name: str, parent_class_name: str
27
- ) -> str:
28
- # Parse the original code into a module
29
- module = cst.parse_module(original_code)
30
- # Initialize transformer with the class name and parent class name
31
- transformer = ParentClassAdder(class_name, parent_class_name)
32
- # Apply the transformation
33
- modified_module = module.visit(transformer)
34
- # Check if the class was found
35
- if not transformer.class_found:
36
- raise ValueError(f"Class {class_name} not found in the provided code.")
37
- # Return the modified code
38
- return modified_module.code
@@ -1,55 +0,0 @@
1
- import libcst as cst
2
-
3
-
4
- class ClassPropertyAdder(cst.CSTTransformer):
5
- def __init__(
6
- self, class_name: str, property_name: str, annotation: str, default_value: str
7
- ):
8
- self.class_name = class_name
9
- self.property_name = property_name
10
- self.annotation = cst.Annotation(cst.parse_expression(annotation))
11
- self.default_value = cst.parse_expression(default_value)
12
- self.class_found = False
13
-
14
- def leave_ClassDef(
15
- self, original_node: cst.ClassDef, updated_node: cst.ClassDef
16
- ) -> cst.ClassDef:
17
- # Check if this is the target class
18
- if original_node.name.value == self.class_name:
19
- self.class_found = True
20
- # Create the annotated property with a default value
21
- new_property = cst.SimpleStatementLine(
22
- body=[
23
- cst.AnnAssign(
24
- target=cst.Name(self.property_name),
25
- annotation=self.annotation,
26
- value=self.default_value,
27
- )
28
- ]
29
- )
30
- # Insert the new property at the start of the class body with a newline
31
- new_body = cst.IndentedBlock(body=(new_property,) + updated_node.body.body)
32
- return updated_node.with_changes(body=new_body)
33
- return updated_node
34
-
35
-
36
- def prepend_property_to_class(
37
- original_code: str,
38
- class_name: str,
39
- property_name: str,
40
- annotation: str,
41
- default_value: str,
42
- ) -> str:
43
- # Parse the original code into a module
44
- module = cst.parse_module(original_code)
45
- # Initialize transformer with the class name, property name, annotation, and default value
46
- transformer = ClassPropertyAdder(
47
- class_name, property_name, annotation, default_value
48
- )
49
- # Apply the transformation
50
- modified_module = module.visit(transformer)
51
- # Check if the class was found
52
- if not transformer.class_found:
53
- raise ValueError(f"Class {class_name} not found in the provided code.")
54
- # Return the modified code
55
- return modified_module.code
File without changes