supplier-meesho.webflow 1.0.0

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.

Potentially problematic release.


This version of supplier-meesho.webflow might be problematic. Click here for more details.

Files changed (1074) hide show
  1. package/.localized +0 -0
  2. package/2.sh +1 -0
  3. package/Complaince.pdf +0 -0
  4. package/GitRepos/CircleIndicator/.idea/caches/build_file_checksums.ser +0 -0
  5. package/GitRepos/CircleIndicator/.idea/caches/gradle_models.ser +0 -0
  6. package/GitRepos/CircleIndicator/.idea/checkstyle-idea.xml +16 -0
  7. package/GitRepos/CircleIndicator/.idea/compiler.xml +21 -0
  8. package/GitRepos/CircleIndicator/.idea/copyright/profiles_settings.xml +3 -0
  9. package/GitRepos/CircleIndicator/.idea/encodings.xml +6 -0
  10. package/GitRepos/CircleIndicator/.idea/gradle.xml +23 -0
  11. package/GitRepos/CircleIndicator/.idea/misc.xml +93 -0
  12. package/GitRepos/CircleIndicator/.idea/modules.xml +11 -0
  13. package/GitRepos/CircleIndicator/.idea/runConfigurations.xml +12 -0
  14. package/GitRepos/CircleIndicator/.idea/vcs.xml +6 -0
  15. package/GitRepos/CircleIndicator/CHANGELOG.md +62 -0
  16. package/GitRepos/CircleIndicator/LoopingViewPager/README.md +4 -0
  17. package/GitRepos/CircleIndicator/LoopingViewPager/build.gradle +22 -0
  18. package/GitRepos/CircleIndicator/LoopingViewPager/proguard-rules.pro +17 -0
  19. package/GitRepos/CircleIndicator/LoopingViewPager/src/main/AndroidManifest.xml +5 -0
  20. package/GitRepos/CircleIndicator/LoopingViewPager/src/main/java/com/imbryk/viewPager/LoopPagerAdapterWrapper.java +168 -0
  21. package/GitRepos/CircleIndicator/LoopingViewPager/src/main/java/com/imbryk/viewPager/LoopViewPager.java +208 -0
  22. package/GitRepos/CircleIndicator/README.md +73 -0
  23. package/GitRepos/CircleIndicator/apk/sample.apk +0 -0
  24. package/GitRepos/CircleIndicator/build.gradle +20 -0
  25. package/GitRepos/CircleIndicator/circleindicator/build.gradle +30 -0
  26. package/GitRepos/CircleIndicator/circleindicator/gradle.properties +22 -0
  27. package/GitRepos/CircleIndicator/circleindicator/proguard-rules.pro +17 -0
  28. package/GitRepos/CircleIndicator/circleindicator/src/main/AndroidManifest.xml +5 -0
  29. package/GitRepos/CircleIndicator/circleindicator/src/main/java/me/relex/circleindicator/CircleIndicator.java +323 -0
  30. package/GitRepos/CircleIndicator/circleindicator/src/main/java/me/relex/circleindicator/SnackbarBehavior.java +45 -0
  31. package/GitRepos/CircleIndicator/circleindicator/src/main/res/animator/scale_with_alpha.xml +22 -0
  32. package/GitRepos/CircleIndicator/circleindicator/src/main/res/drawable/white_radius.xml +6 -0
  33. package/GitRepos/CircleIndicator/circleindicator/src/main/res/values/attrs.xml +60 -0
  34. package/GitRepos/CircleIndicator/circleindicator/upload-jcenter.gradle +67 -0
  35. package/GitRepos/CircleIndicator/circleindicator/upload-maven.gradle +55 -0
  36. package/GitRepos/CircleIndicator/gradle/wrapper/gradle-wrapper.jar +0 -0
  37. package/GitRepos/CircleIndicator/gradle/wrapper/gradle-wrapper.properties +6 -0
  38. package/GitRepos/CircleIndicator/gradle.properties +18 -0
  39. package/GitRepos/CircleIndicator/gradlew +164 -0
  40. package/GitRepos/CircleIndicator/gradlew.bat +90 -0
  41. package/GitRepos/CircleIndicator/sample/build.gradle +32 -0
  42. package/GitRepos/CircleIndicator/sample/proguard-rules.pro +17 -0
  43. package/GitRepos/CircleIndicator/sample/src/main/AndroidManifest.xml +23 -0
  44. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/SampleActivity.java +158 -0
  45. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/SamplePagerAdapter.java +59 -0
  46. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/fragment/ChangeColorFragment.java +28 -0
  47. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/fragment/CustomAnimationFragment.java +28 -0
  48. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/fragment/DefaultFragment.java +29 -0
  49. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/fragment/DynamicAdapterFragment.java +52 -0
  50. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/fragment/LoopViewPagerFragment.java +28 -0
  51. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/fragment/ResetAdapterFragment.java +41 -0
  52. package/GitRepos/CircleIndicator/sample/src/main/java/me/relex/circleindicator/sample/fragment/SnackbarBehaviorFragment.java +44 -0
  53. package/GitRepos/CircleIndicator/sample/src/main/res/animator/indicator_animator.xml +16 -0
  54. package/GitRepos/CircleIndicator/sample/src/main/res/animator/indicator_animator_reverse.xml +10 -0
  55. package/GitRepos/CircleIndicator/sample/src/main/res/animator/indicator_no_animator.xml +4 -0
  56. package/GitRepos/CircleIndicator/sample/src/main/res/drawable/black_radius.xml +8 -0
  57. package/GitRepos/CircleIndicator/sample/src/main/res/drawable/black_radius_square.xml +7 -0
  58. package/GitRepos/CircleIndicator/sample/src/main/res/drawable/white_radius.xml +6 -0
  59. package/GitRepos/CircleIndicator/sample/src/main/res/drawable-hdpi/ic_launcher.png +0 -0
  60. package/GitRepos/CircleIndicator/sample/src/main/res/drawable-mdpi/ic_launcher.png +0 -0
  61. package/GitRepos/CircleIndicator/sample/src/main/res/drawable-xhdpi/ic_launcher.png +0 -0
  62. package/GitRepos/CircleIndicator/sample/src/main/res/drawable-xxhdpi/ic_launcher.png +0 -0
  63. package/GitRepos/CircleIndicator/sample/src/main/res/layout/activity_sample.xml +22 -0
  64. package/GitRepos/CircleIndicator/sample/src/main/res/layout/fragment_sample_change_color.xml +21 -0
  65. package/GitRepos/CircleIndicator/sample/src/main/res/layout/fragment_sample_custom_animation.xml +26 -0
  66. package/GitRepos/CircleIndicator/sample/src/main/res/layout/fragment_sample_default.xml +18 -0
  67. package/GitRepos/CircleIndicator/sample/src/main/res/layout/fragment_sample_dynamic_adapter.xml +34 -0
  68. package/GitRepos/CircleIndicator/sample/src/main/res/layout/fragment_sample_loop_viewpager.xml +18 -0
  69. package/GitRepos/CircleIndicator/sample/src/main/res/layout/fragment_sample_reset_adapter.xml +27 -0
  70. package/GitRepos/CircleIndicator/sample/src/main/res/layout/fragment_sample_snackbar_behavior.xml +28 -0
  71. package/GitRepos/CircleIndicator/sample/src/main/res/layout/item_view.xml +2 -0
  72. package/GitRepos/CircleIndicator/sample/src/main/res/layout/viewpager_activity.xml +74 -0
  73. package/GitRepos/CircleIndicator/sample/src/main/res/values/array.xml +10 -0
  74. package/GitRepos/CircleIndicator/sample/src/main/res/values/colors.xml +19 -0
  75. package/GitRepos/CircleIndicator/sample/src/main/res/values/ids.xml +17 -0
  76. package/GitRepos/CircleIndicator/sample/src/main/res/values/strings.xml +9 -0
  77. package/GitRepos/CircleIndicator/sample/src/main/res/values/styles.xml +26 -0
  78. package/GitRepos/CircleIndicator/screenshot.gif +0 -0
  79. package/GitRepos/CircleIndicator/settings.gradle +1 -0
  80. package/GitRepos/Time/.travis.yml +14 -0
  81. package/GitRepos/Time/LICENSE.md +22 -0
  82. package/GitRepos/Time/README.md +269 -0
  83. package/GitRepos/Time/build.gradle +23 -0
  84. package/GitRepos/Time/gradle/wrapper/gradle-wrapper.jar +0 -0
  85. package/GitRepos/Time/gradle/wrapper/gradle-wrapper.properties +6 -0
  86. package/GitRepos/Time/gradlew +172 -0
  87. package/GitRepos/Time/gradlew.bat +84 -0
  88. package/GitRepos/Time/settings.gradle +3 -0
  89. package/GitRepos/Time/time/build.gradle +20 -0
  90. package/GitRepos/Time/time/src/main/kotlin/com/kizitonwose/time/Extensions.kt +65 -0
  91. package/GitRepos/Time/time/src/main/kotlin/com/kizitonwose/time/Time.kt +143 -0
  92. package/GitRepos/Time/time/src/test/kotlin/com/kizitonwose/time/TimeTest.kt +110 -0
  93. package/GitRepos/Time/time-android/build.gradle +38 -0
  94. package/GitRepos/Time/time-android/proguard-rules.pro +21 -0
  95. package/GitRepos/Time/time-android/src/main/AndroidManifest.xml +2 -0
  96. package/GitRepos/Time/time-android/src/main/kotlin/com/kizitonwose/timeandroid/AndroidExtensions.kt +15 -0
  97. package/GitRepos/Time/time-android/src/main/res/values/strings.xml +3 -0
  98. package/GitRepos/black/.coveragerc +9 -0
  99. package/GitRepos/black/.flake8 +7 -0
  100. package/GitRepos/black/.github/CODE_OF_CONDUCT.md +11 -0
  101. package/GitRepos/black/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
  102. package/GitRepos/black/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
  103. package/GitRepos/black/.github/ISSUE_TEMPLATE/style_issue.md +29 -0
  104. package/GitRepos/black/.github/workflows/changelog.yml +21 -0
  105. package/GitRepos/black/.github/workflows/doc.yml +30 -0
  106. package/GitRepos/black/.github/workflows/docker.yml +43 -0
  107. package/GitRepos/black/.github/workflows/fuzz.yml +35 -0
  108. package/GitRepos/black/.github/workflows/lint.yml +28 -0
  109. package/GitRepos/black/.github/workflows/primer.yml +47 -0
  110. package/GitRepos/black/.github/workflows/pypi_upload.yml +31 -0
  111. package/GitRepos/black/.github/workflows/test.yml +76 -0
  112. package/GitRepos/black/.github/workflows/upload_binary.yml +51 -0
  113. package/GitRepos/black/.pre-commit-config.yaml +30 -0
  114. package/GitRepos/black/.pre-commit-hooks.yaml +9 -0
  115. package/GitRepos/black/.prettierrc.yaml +3 -0
  116. package/GitRepos/black/.readthedocs.yaml +14 -0
  117. package/GitRepos/black/AUTHORS.md +184 -0
  118. package/GitRepos/black/CHANGES.md +648 -0
  119. package/GitRepos/black/CONTRIBUTING.md +10 -0
  120. package/GitRepos/black/Dockerfile +14 -0
  121. package/GitRepos/black/LICENSE +21 -0
  122. package/GitRepos/black/Pipfile +36 -0
  123. package/GitRepos/black/Pipfile.lock +1308 -0
  124. package/GitRepos/black/README.md +220 -0
  125. package/GitRepos/black/action/Dockerfile +10 -0
  126. package/GitRepos/black/action/entrypoint.sh +9 -0
  127. package/GitRepos/black/action.yml +24 -0
  128. package/GitRepos/black/autoload/black.vim +172 -0
  129. package/GitRepos/black/docs/Makefile +20 -0
  130. package/GitRepos/black/docs/_static/custom.css +38 -0
  131. package/GitRepos/black/docs/_static/license.svg +1 -0
  132. package/GitRepos/black/docs/_static/logo2-readme.png +0 -0
  133. package/GitRepos/black/docs/_static/logo2.png +0 -0
  134. package/GitRepos/black/docs/_static/pypi_template.svg +1 -0
  135. package/GitRepos/black/docs/compatible_configs/flake8/.flake8 +3 -0
  136. package/GitRepos/black/docs/compatible_configs/flake8/setup.cfg +3 -0
  137. package/GitRepos/black/docs/compatible_configs/flake8/tox.ini +3 -0
  138. package/GitRepos/black/docs/compatible_configs/isort/.editorconfig +2 -0
  139. package/GitRepos/black/docs/compatible_configs/isort/.isort.cfg +2 -0
  140. package/GitRepos/black/docs/compatible_configs/isort/pyproject.toml +2 -0
  141. package/GitRepos/black/docs/compatible_configs/isort/setup.cfg +2 -0
  142. package/GitRepos/black/docs/compatible_configs/pylint/pylintrc +5 -0
  143. package/GitRepos/black/docs/compatible_configs/pylint/pyproject.toml +5 -0
  144. package/GitRepos/black/docs/compatible_configs/pylint/setup.cfg +5 -0
  145. package/GitRepos/black/docs/conf.py +227 -0
  146. package/GitRepos/black/docs/contributing/gauging_changes.md +42 -0
  147. package/GitRepos/black/docs/contributing/index.rst +42 -0
  148. package/GitRepos/black/docs/contributing/issue_triage.md +169 -0
  149. package/GitRepos/black/docs/contributing/reference/reference_classes.rst +76 -0
  150. package/GitRepos/black/docs/contributing/reference/reference_exceptions.rst +12 -0
  151. package/GitRepos/black/docs/contributing/reference/reference_functions.rst +178 -0
  152. package/GitRepos/black/docs/contributing/reference/reference_summary.rst +16 -0
  153. package/GitRepos/black/docs/contributing/release_process.md +89 -0
  154. package/GitRepos/black/docs/contributing/the_basics.md +101 -0
  155. package/GitRepos/black/docs/getting_started.md +49 -0
  156. package/GitRepos/black/docs/guides/index.rst +14 -0
  157. package/GitRepos/black/docs/guides/introducing_black_to_your_project.md +50 -0
  158. package/GitRepos/black/docs/guides/using_black_with_other_tools.md +278 -0
  159. package/GitRepos/black/docs/index.rst +120 -0
  160. package/GitRepos/black/docs/integrations/editors.md +326 -0
  161. package/GitRepos/black/docs/integrations/github_actions.md +35 -0
  162. package/GitRepos/black/docs/integrations/index.rst +28 -0
  163. package/GitRepos/black/docs/integrations/source_version_control.md +14 -0
  164. package/GitRepos/black/docs/license.rst +6 -0
  165. package/GitRepos/black/docs/make.bat +36 -0
  166. package/GitRepos/black/docs/requirements.txt +6 -0
  167. package/GitRepos/black/docs/the_black_code_style/current_style.md +456 -0
  168. package/GitRepos/black/docs/the_black_code_style/future_style.md +35 -0
  169. package/GitRepos/black/docs/the_black_code_style/index.rst +19 -0
  170. package/GitRepos/black/docs/usage_and_configuration/black_as_a_server.md +78 -0
  171. package/GitRepos/black/docs/usage_and_configuration/file_collection_and_discovery.md +36 -0
  172. package/GitRepos/black/docs/usage_and_configuration/index.rst +24 -0
  173. package/GitRepos/black/docs/usage_and_configuration/the_basics.md +286 -0
  174. package/GitRepos/black/fuzz.py +85 -0
  175. package/GitRepos/black/gallery/Dockerfile +11 -0
  176. package/GitRepos/black/gallery/README.md +45 -0
  177. package/GitRepos/black/gallery/gallery.py +307 -0
  178. package/GitRepos/black/mypy.ini +39 -0
  179. package/GitRepos/black/plugin/black.vim +60 -0
  180. package/GitRepos/black/profiling/dict_big.py +8001 -0
  181. package/GitRepos/black/profiling/dict_huge.py +41440 -0
  182. package/GitRepos/black/profiling/list_big.py +4000 -0
  183. package/GitRepos/black/profiling/list_huge.py +22431 -0
  184. package/GitRepos/black/profiling/mix_big.py +1002 -0
  185. package/GitRepos/black/profiling/mix_huge.py +7692 -0
  186. package/GitRepos/black/profiling/mix_small.py +102 -0
  187. package/GitRepos/black/pyproject.toml +34 -0
  188. package/GitRepos/black/setup.cfg +2 -0
  189. package/GitRepos/black/setup.py +113 -0
  190. package/GitRepos/black/src/black/__init__.py +1062 -0
  191. package/GitRepos/black/src/black/__main__.py +3 -0
  192. package/GitRepos/black/src/black/brackets.py +334 -0
  193. package/GitRepos/black/src/black/cache.py +83 -0
  194. package/GitRepos/black/src/black/comments.py +269 -0
  195. package/GitRepos/black/src/black/concurrency.py +39 -0
  196. package/GitRepos/black/src/black/const.py +4 -0
  197. package/GitRepos/black/src/black/debug.py +48 -0
  198. package/GitRepos/black/src/black/files.py +243 -0
  199. package/GitRepos/black/src/black/linegen.py +984 -0
  200. package/GitRepos/black/src/black/lines.py +734 -0
  201. package/GitRepos/black/src/black/mode.py +123 -0
  202. package/GitRepos/black/src/black/nodes.py +843 -0
  203. package/GitRepos/black/src/black/numerics.py +65 -0
  204. package/GitRepos/black/src/black/output.py +83 -0
  205. package/GitRepos/black/src/black/parsing.py +215 -0
  206. package/GitRepos/black/src/black/py.typed +1 -0
  207. package/GitRepos/black/src/black/report.py +100 -0
  208. package/GitRepos/black/src/black/rusty.py +28 -0
  209. package/GitRepos/black/src/black/strings.py +216 -0
  210. package/GitRepos/black/src/black/trans.py +1925 -0
  211. package/GitRepos/black/src/black_primer/cli.py +147 -0
  212. package/GitRepos/black/src/black_primer/lib.py +361 -0
  213. package/GitRepos/black/src/black_primer/primer.json +143 -0
  214. package/GitRepos/black/src/blackd/__init__.py +211 -0
  215. package/GitRepos/black/src/blib2to3/Grammar.txt +215 -0
  216. package/GitRepos/black/src/blib2to3/LICENSE +254 -0
  217. package/GitRepos/black/src/blib2to3/PatternGrammar.txt +28 -0
  218. package/GitRepos/black/src/blib2to3/README +16 -0
  219. package/GitRepos/black/src/blib2to3/__init__.py +1 -0
  220. package/GitRepos/black/src/blib2to3/pgen2/__init__.py +4 -0
  221. package/GitRepos/black/src/blib2to3/pgen2/conv.py +256 -0
  222. package/GitRepos/black/src/blib2to3/pgen2/driver.py +253 -0
  223. package/GitRepos/black/src/blib2to3/pgen2/grammar.py +223 -0
  224. package/GitRepos/black/src/blib2to3/pgen2/literals.py +68 -0
  225. package/GitRepos/black/src/blib2to3/pgen2/parse.py +235 -0
  226. package/GitRepos/black/src/blib2to3/pgen2/pgen.py +428 -0
  227. package/GitRepos/black/src/blib2to3/pgen2/token.py +94 -0
  228. package/GitRepos/black/src/blib2to3/pgen2/tokenize.py +681 -0
  229. package/GitRepos/black/src/blib2to3/pygram.py +197 -0
  230. package/GitRepos/black/src/blib2to3/pytree.py +980 -0
  231. package/GitRepos/black/test_requirements.txt +9 -0
  232. package/GitRepos/black/tests/__init__.py +0 -0
  233. package/GitRepos/black/tests/conftest.py +1 -0
  234. package/GitRepos/black/tests/data/async_as_identifier.py +49 -0
  235. package/GitRepos/black/tests/data/beginning_backslash.py +12 -0
  236. package/GitRepos/black/tests/data/blackd_diff.diff +13 -0
  237. package/GitRepos/black/tests/data/blackd_diff.py +6 -0
  238. package/GitRepos/black/tests/data/bracketmatch.py +15 -0
  239. package/GitRepos/black/tests/data/cantfit.py +107 -0
  240. package/GitRepos/black/tests/data/class_blank_parentheses.py +58 -0
  241. package/GitRepos/black/tests/data/class_methods_new_line.py +270 -0
  242. package/GitRepos/black/tests/data/collections.py +174 -0
  243. package/GitRepos/black/tests/data/comment_after_escaped_newline.py +18 -0
  244. package/GitRepos/black/tests/data/comments.py +96 -0
  245. package/GitRepos/black/tests/data/comments2.py +342 -0
  246. package/GitRepos/black/tests/data/comments3.py +47 -0
  247. package/GitRepos/black/tests/data/comments4.py +94 -0
  248. package/GitRepos/black/tests/data/comments5.py +71 -0
  249. package/GitRepos/black/tests/data/comments6.py +118 -0
  250. package/GitRepos/black/tests/data/comments7.py +271 -0
  251. package/GitRepos/black/tests/data/comments_non_breaking_space.py +44 -0
  252. package/GitRepos/black/tests/data/composition.py +181 -0
  253. package/GitRepos/black/tests/data/composition_no_trailing_comma.py +367 -0
  254. package/GitRepos/black/tests/data/debug_visitor.out +810 -0
  255. package/GitRepos/black/tests/data/debug_visitor.py +32 -0
  256. package/GitRepos/black/tests/data/decorators.py +182 -0
  257. package/GitRepos/black/tests/data/docstring.py +377 -0
  258. package/GitRepos/black/tests/data/docstring_no_string_normalization.py +249 -0
  259. package/GitRepos/black/tests/data/empty_lines.py +187 -0
  260. package/GitRepos/black/tests/data/empty_pyproject.toml +2 -0
  261. package/GitRepos/black/tests/data/expression.diff +447 -0
  262. package/GitRepos/black/tests/data/expression.py +630 -0
  263. package/GitRepos/black/tests/data/expression_skip_magic_trailing_comma.diff +428 -0
  264. package/GitRepos/black/tests/data/fmtonoff.py +413 -0
  265. package/GitRepos/black/tests/data/fmtonoff2.py +40 -0
  266. package/GitRepos/black/tests/data/fmtonoff3.py +35 -0
  267. package/GitRepos/black/tests/data/fmtonoff4.py +36 -0
  268. package/GitRepos/black/tests/data/fmtskip.py +3 -0
  269. package/GitRepos/black/tests/data/fmtskip2.py +17 -0
  270. package/GitRepos/black/tests/data/fmtskip3.py +20 -0
  271. package/GitRepos/black/tests/data/fmtskip4.py +13 -0
  272. package/GitRepos/black/tests/data/fmtskip5.py +22 -0
  273. package/GitRepos/black/tests/data/force_py36.py +16 -0
  274. package/GitRepos/black/tests/data/force_pyi.py +65 -0
  275. package/GitRepos/black/tests/data/fstring.py +21 -0
  276. package/GitRepos/black/tests/data/function.py +247 -0
  277. package/GitRepos/black/tests/data/function2.py +58 -0
  278. package/GitRepos/black/tests/data/function_trailing_comma.py +88 -0
  279. package/GitRepos/black/tests/data/import_spacing.py +118 -0
  280. package/GitRepos/black/tests/data/include_exclude_tests/b/.definitely_exclude/a.pie +0 -0
  281. package/GitRepos/black/tests/data/include_exclude_tests/b/.definitely_exclude/a.py +0 -0
  282. package/GitRepos/black/tests/data/include_exclude_tests/b/.definitely_exclude/a.pyi +0 -0
  283. package/GitRepos/black/tests/data/include_exclude_tests/b/dont_exclude/a.pie +0 -0
  284. package/GitRepos/black/tests/data/include_exclude_tests/b/dont_exclude/a.py +0 -0
  285. package/GitRepos/black/tests/data/include_exclude_tests/b/dont_exclude/a.pyi +0 -0
  286. package/GitRepos/black/tests/data/include_exclude_tests/b/exclude/a.pie +0 -0
  287. package/GitRepos/black/tests/data/include_exclude_tests/b/exclude/a.py +0 -0
  288. package/GitRepos/black/tests/data/include_exclude_tests/b/exclude/a.pyi +0 -0
  289. package/GitRepos/black/tests/data/include_exclude_tests/pyproject.toml +3 -0
  290. package/GitRepos/black/tests/data/long_strings.py +589 -0
  291. package/GitRepos/black/tests/data/long_strings__edge_case.py +110 -0
  292. package/GitRepos/black/tests/data/long_strings__regression.py +888 -0
  293. package/GitRepos/black/tests/data/long_strings_flag_disabled.py +289 -0
  294. package/GitRepos/black/tests/data/missing_final_newline.diff +8 -0
  295. package/GitRepos/black/tests/data/missing_final_newline.py +3 -0
  296. package/GitRepos/black/tests/data/nested_gitignore_tests/pyproject.toml +3 -0
  297. package/GitRepos/black/tests/data/nested_gitignore_tests/root/b.py +1 -0
  298. package/GitRepos/black/tests/data/nested_gitignore_tests/root/c.py +1 -0
  299. package/GitRepos/black/tests/data/nested_gitignore_tests/root/child/c.py +1 -0
  300. package/GitRepos/black/tests/data/nested_gitignore_tests/x.py +0 -0
  301. package/GitRepos/black/tests/data/numeric_literals.py +44 -0
  302. package/GitRepos/black/tests/data/numeric_literals_py2.py +16 -0
  303. package/GitRepos/black/tests/data/numeric_literals_skip_underscores.py +23 -0
  304. package/GitRepos/black/tests/data/pep_570.py +44 -0
  305. package/GitRepos/black/tests/data/pep_572.py +47 -0
  306. package/GitRepos/black/tests/data/pep_572_do_not_remove_parens.py +21 -0
  307. package/GitRepos/black/tests/data/pep_572_remove_parens.py +105 -0
  308. package/GitRepos/black/tests/data/percent_precedence.py +41 -0
  309. package/GitRepos/black/tests/data/python2.py +33 -0
  310. package/GitRepos/black/tests/data/python2_print_function.py +16 -0
  311. package/GitRepos/black/tests/data/python2_unicode_literals.py +20 -0
  312. package/GitRepos/black/tests/data/python37.py +65 -0
  313. package/GitRepos/black/tests/data/python38.py +45 -0
  314. package/GitRepos/black/tests/data/python39.py +37 -0
  315. package/GitRepos/black/tests/data/remove_parens.py +142 -0
  316. package/GitRepos/black/tests/data/slices.py +31 -0
  317. package/GitRepos/black/tests/data/string_prefixes.py +18 -0
  318. package/GitRepos/black/tests/data/string_quotes.py +102 -0
  319. package/GitRepos/black/tests/data/stub.pyi +35 -0
  320. package/GitRepos/black/tests/data/trailing_comma_optional_parens1.py +3 -0
  321. package/GitRepos/black/tests/data/trailing_comma_optional_parens2.py +3 -0
  322. package/GitRepos/black/tests/data/trailing_comma_optional_parens3.py +8 -0
  323. package/GitRepos/black/tests/data/tricky_unicode_symbols.py +6 -0
  324. package/GitRepos/black/tests/data/tupleassign.py +23 -0
  325. package/GitRepos/black/tests/empty.toml +1 -0
  326. package/GitRepos/black/tests/optional.py +119 -0
  327. package/GitRepos/black/tests/test.toml +10 -0
  328. package/GitRepos/black/tests/test_black.py +2100 -0
  329. package/GitRepos/black/tests/test_blackd.py +166 -0
  330. package/GitRepos/black/tests/test_format.py +144 -0
  331. package/GitRepos/black/tests/test_primer.py +217 -0
  332. package/GitRepos/black/tests/util.py +74 -0
  333. package/GitRepos/black/tox.ini +28 -0
  334. package/GitRepos/danger-static_analyzer_comments/.idea/inspectionProfiles/Project_Default.xml +6 -0
  335. package/GitRepos/danger-static_analyzer_comments/.idea/modules.xml +8 -0
  336. package/GitRepos/danger-static_analyzer_comments/Gemfile +3 -0
  337. package/GitRepos/danger-static_analyzer_comments/Gemfile.lock +141 -0
  338. package/GitRepos/danger-static_analyzer_comments/Guardfile +19 -0
  339. package/GitRepos/danger-static_analyzer_comments/LICENSE +21 -0
  340. package/GitRepos/danger-static_analyzer_comments/PLUGIN.gemspec.template.cpgz +0 -0
  341. package/GitRepos/danger-static_analyzer_comments/PLUGIN_LICENSE.txt +22 -0
  342. package/GitRepos/danger-static_analyzer_comments/PLUGIN_README.md +20 -0
  343. package/GitRepos/danger-static_analyzer_comments/README.md +2 -0
  344. package/GitRepos/danger-static_analyzer_comments/Rakefile +23 -0
  345. package/GitRepos/danger-static_analyzer_comments/configure +123 -0
  346. package/GitRepos/danger-static_analyzer_comments/danger-static_analyzer_comments.gemspec +49 -0
  347. package/GitRepos/danger-static_analyzer_comments/lib/danger_plugin.rb +73 -0
  348. package/GitRepos/danger-static_analyzer_comments/lib/version.rb +3 -0
  349. package/GitRepos/danger-static_analyzer_comments/spec/danger_static_analyzer_comments_spec.rb +23 -0
  350. package/GitRepos/danger-static_analyzer_comments/spec/spec_helper.rb +65 -0
  351. package/GitRepos/isort/.codecov.yml +10 -0
  352. package/GitRepos/isort/.coveragerc +20 -0
  353. package/GitRepos/isort/.cruft.json +17 -0
  354. package/GitRepos/isort/.deepsource.toml +18 -0
  355. package/GitRepos/isort/.dockerignore +17 -0
  356. package/GitRepos/isort/.editorconfig +19 -0
  357. package/GitRepos/isort/.github/FUNDING.yml +2 -0
  358. package/GitRepos/isort/.github/workflows/integration.yml +35 -0
  359. package/GitRepos/isort/.github/workflows/lint.yml +35 -0
  360. package/GitRepos/isort/.github/workflows/test.yml +64 -0
  361. package/GitRepos/isort/.isort.cfg +5 -0
  362. package/GitRepos/isort/.pre-commit-config.yaml +5 -0
  363. package/GitRepos/isort/.pre-commit-hooks.yaml +9 -0
  364. package/GitRepos/isort/CHANGELOG.md +522 -0
  365. package/GitRepos/isort/Dockerfile +26 -0
  366. package/GitRepos/isort/LICENSE +21 -0
  367. package/GitRepos/isort/MANIFEST.in +4 -0
  368. package/GitRepos/isort/README.md +355 -0
  369. package/GitRepos/isort/art/isort_loves_black.png +0 -0
  370. package/GitRepos/isort/art/logo.png +0 -0
  371. package/GitRepos/isort/art/logo.xcf +0 -0
  372. package/GitRepos/isort/art/logo_5.png +0 -0
  373. package/GitRepos/isort/art/logo_large.png +0 -0
  374. package/GitRepos/isort/art/logo_large.xcf +0 -0
  375. package/GitRepos/isort/art/stylesheets/extra.css +5 -0
  376. package/GitRepos/isort/docs/configuration/action_comments.md +108 -0
  377. package/GitRepos/isort/docs/configuration/add_or_remove_imports.md +28 -0
  378. package/GitRepos/isort/docs/configuration/black_compatibility.md +63 -0
  379. package/GitRepos/isort/docs/configuration/config_files.md +89 -0
  380. package/GitRepos/isort/docs/configuration/custom_sections_and_ordering.md +131 -0
  381. package/GitRepos/isort/docs/configuration/git_hook.md +34 -0
  382. package/GitRepos/isort/docs/configuration/github_action.md +63 -0
  383. package/GitRepos/isort/docs/configuration/multi_line_output_modes.md +121 -0
  384. package/GitRepos/isort/docs/configuration/options.md +1314 -0
  385. package/GitRepos/isort/docs/configuration/pre-commit.md +32 -0
  386. package/GitRepos/isort/docs/configuration/profiles.md +86 -0
  387. package/GitRepos/isort/docs/configuration/setuptools_integration.md +27 -0
  388. package/GitRepos/isort/docs/contributing/1.-contributing-guide.md +81 -0
  389. package/GitRepos/isort/docs/contributing/2.-coding-standard.md +57 -0
  390. package/GitRepos/isort/docs/contributing/3.-code-of-conduct.md +88 -0
  391. package/GitRepos/isort/docs/contributing/4.-acknowledgements.md +259 -0
  392. package/GitRepos/isort/docs/major_releases/introducing_isort_5.md +142 -0
  393. package/GitRepos/isort/docs/major_releases/release_policy.md +46 -0
  394. package/GitRepos/isort/docs/quick_start/0.-try.md +50 -0
  395. package/GitRepos/isort/docs/quick_start/1.-install.md +22 -0
  396. package/GitRepos/isort/docs/quick_start/2.-cli.md +43 -0
  397. package/GitRepos/isort/docs/quick_start/3.-api.md +22 -0
  398. package/GitRepos/isort/docs/quick_start/interactive.css +26 -0
  399. package/GitRepos/isort/docs/quick_start/interactive.js +55 -0
  400. package/GitRepos/isort/docs/quick_start/isort-5.0.0-py3-none-any.whl +0 -0
  401. package/GitRepos/isort/docs/quick_start/isort-5.0.1-py3-none-any.whl +0 -0
  402. package/GitRepos/isort/docs/upgrade_guides/5.0.0.md +97 -0
  403. package/GitRepos/isort/docs/warning_and_error_codes/W0500.md +22 -0
  404. package/GitRepos/isort/example.gif +0 -0
  405. package/GitRepos/isort/example_isort_formatting_plugin/example_isort_formatting_plugin.py +23 -0
  406. package/GitRepos/isort/example_isort_formatting_plugin/poetry.lock +173 -0
  407. package/GitRepos/isort/example_isort_formatting_plugin/pyproject.toml +20 -0
  408. package/GitRepos/isort/example_shared_isort_profile/example_shared_isort_profile.py +7 -0
  409. package/GitRepos/isort/example_shared_isort_profile/poetry.lock +7 -0
  410. package/GitRepos/isort/example_shared_isort_profile/pyproject.toml +18 -0
  411. package/GitRepos/isort/isort/__init__.py +19 -0
  412. package/GitRepos/isort/isort/__main__.py +3 -0
  413. package/GitRepos/isort/isort/_future/__init__.py +12 -0
  414. package/GitRepos/isort/isort/_future/_dataclasses.py +1209 -0
  415. package/GitRepos/isort/isort/_vendored/toml/LICENSE +27 -0
  416. package/GitRepos/isort/isort/_vendored/toml/__init__.py +23 -0
  417. package/GitRepos/isort/isort/_vendored/toml/decoder.py +1053 -0
  418. package/GitRepos/isort/isort/_vendored/toml/encoder.py +295 -0
  419. package/GitRepos/isort/isort/_vendored/toml/ordered.py +13 -0
  420. package/GitRepos/isort/isort/_vendored/toml/tz.py +21 -0
  421. package/GitRepos/isort/isort/_version.py +1 -0
  422. package/GitRepos/isort/isort/api.py +576 -0
  423. package/GitRepos/isort/isort/comments.py +32 -0
  424. package/GitRepos/isort/isort/core.py +455 -0
  425. package/GitRepos/isort/isort/deprecated/__init__.py +0 -0
  426. package/GitRepos/isort/isort/deprecated/finders.py +415 -0
  427. package/GitRepos/isort/isort/exceptions.py +180 -0
  428. package/GitRepos/isort/isort/files.py +41 -0
  429. package/GitRepos/isort/isort/format.py +150 -0
  430. package/GitRepos/isort/isort/hooks.py +86 -0
  431. package/GitRepos/isort/isort/identify.py +206 -0
  432. package/GitRepos/isort/isort/io.py +73 -0
  433. package/GitRepos/isort/isort/literal.py +109 -0
  434. package/GitRepos/isort/isort/logo.py +19 -0
  435. package/GitRepos/isort/isort/main.py +1230 -0
  436. package/GitRepos/isort/isort/output.py +634 -0
  437. package/GitRepos/isort/isort/parse.py +569 -0
  438. package/GitRepos/isort/isort/place.py +145 -0
  439. package/GitRepos/isort/isort/profiles.py +86 -0
  440. package/GitRepos/isort/isort/py.typed +0 -0
  441. package/GitRepos/isort/isort/pylama_isort.py +43 -0
  442. package/GitRepos/isort/isort/sections.py +9 -0
  443. package/GitRepos/isort/isort/settings.py +779 -0
  444. package/GitRepos/isort/isort/setuptools_commands.py +61 -0
  445. package/GitRepos/isort/isort/sorting.py +118 -0
  446. package/GitRepos/isort/isort/stdlibs/__init__.py +2 -0
  447. package/GitRepos/isort/isort/stdlibs/all.py +3 -0
  448. package/GitRepos/isort/isort/stdlibs/py2.py +3 -0
  449. package/GitRepos/isort/isort/stdlibs/py27.py +300 -0
  450. package/GitRepos/isort/isort/stdlibs/py3.py +3 -0
  451. package/GitRepos/isort/isort/stdlibs/py35.py +222 -0
  452. package/GitRepos/isort/isort/stdlibs/py36.py +223 -0
  453. package/GitRepos/isort/isort/stdlibs/py37.py +224 -0
  454. package/GitRepos/isort/isort/stdlibs/py38.py +223 -0
  455. package/GitRepos/isort/isort/stdlibs/py39.py +223 -0
  456. package/GitRepos/isort/isort/utils.py +16 -0
  457. package/GitRepos/isort/isort/wrap.py +139 -0
  458. package/GitRepos/isort/isort/wrap_modes.py +323 -0
  459. package/GitRepos/isort/logo.png +0 -0
  460. package/GitRepos/isort/mkdocs.yml +2 -0
  461. package/GitRepos/isort/poetry.lock +2472 -0
  462. package/GitRepos/isort/pyproject.toml +114 -0
  463. package/GitRepos/isort/rtd/index.md +6 -0
  464. package/GitRepos/isort/scripts/build_config_option_docs.py +214 -0
  465. package/GitRepos/isort/scripts/build_profile_docs.py +42 -0
  466. package/GitRepos/isort/scripts/check_acknowledgments.py +83 -0
  467. package/GitRepos/isort/scripts/clean.sh +7 -0
  468. package/GitRepos/isort/scripts/docker.sh +12 -0
  469. package/GitRepos/isort/scripts/done.sh +5 -0
  470. package/GitRepos/isort/scripts/lint.sh +11 -0
  471. package/GitRepos/isort/scripts/mkstdlibs.py +47 -0
  472. package/GitRepos/isort/scripts/test.sh +6 -0
  473. package/GitRepos/isort/scripts/test_integration.sh +4 -0
  474. package/GitRepos/isort/setup.cfg +28 -0
  475. package/GitRepos/isort/tests/__init__.py +0 -0
  476. package/GitRepos/isort/tests/integration/test_hypothesmith.py +96 -0
  477. package/GitRepos/isort/tests/integration/test_projects_using_isort.py +166 -0
  478. package/GitRepos/isort/tests/integration/test_setting_combinations.py +1869 -0
  479. package/GitRepos/isort/tests/unit/__init__.py +0 -0
  480. package/GitRepos/isort/tests/unit/conftest.py +33 -0
  481. package/GitRepos/isort/tests/unit/example_crlf_file.py +10 -0
  482. package/GitRepos/isort/tests/unit/example_projects/namespaces/almost-implicit/.isort.cfg +2 -0
  483. package/GitRepos/isort/tests/unit/example_projects/namespaces/almost-implicit/root/nested/__init__.py +0 -0
  484. package/GitRepos/isort/tests/unit/example_projects/namespaces/almost-implicit/root/nested/x.py +0 -0
  485. package/GitRepos/isort/tests/unit/example_projects/namespaces/almost-implicit/root/y.py +0 -0
  486. package/GitRepos/isort/tests/unit/example_projects/namespaces/implicit/.isort.cfg +2 -0
  487. package/GitRepos/isort/tests/unit/example_projects/namespaces/implicit/root/nested/__init__.py +0 -0
  488. package/GitRepos/isort/tests/unit/example_projects/namespaces/implicit/root/nested/x.py +0 -0
  489. package/GitRepos/isort/tests/unit/example_projects/namespaces/none/.isort.cfg +2 -0
  490. package/GitRepos/isort/tests/unit/example_projects/namespaces/none/root/__init__.py +0 -0
  491. package/GitRepos/isort/tests/unit/example_projects/namespaces/none/root/nested/__init__.py +0 -0
  492. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkg_resource/.isort.cfg +2 -0
  493. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkg_resource/root/__init__.py +1 -0
  494. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkg_resource/root/nested/__init__.py +0 -0
  495. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkg_resource/root/nested/x.py +0 -0
  496. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkgutil/.isort.cfg +2 -0
  497. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkgutil/root/__init__.py +1 -0
  498. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkgutil/root/nested/__init__.py +0 -0
  499. package/GitRepos/isort/tests/unit/example_projects/namespaces/pkgutil/root/nested/x.py +0 -0
  500. package/GitRepos/isort/tests/unit/profiles/__init__.py +0 -0
  501. package/GitRepos/isort/tests/unit/profiles/test_attrs.py +102 -0
  502. package/GitRepos/isort/tests/unit/profiles/test_black.py +370 -0
  503. package/GitRepos/isort/tests/unit/profiles/test_django.py +122 -0
  504. package/GitRepos/isort/tests/unit/profiles/test_google.py +413 -0
  505. package/GitRepos/isort/tests/unit/profiles/test_hug.py +112 -0
  506. package/GitRepos/isort/tests/unit/profiles/test_open_stack.py +134 -0
  507. package/GitRepos/isort/tests/unit/profiles/test_plone.py +75 -0
  508. package/GitRepos/isort/tests/unit/profiles/test_pycharm.py +55 -0
  509. package/GitRepos/isort/tests/unit/profiles/test_wemake.py +87 -0
  510. package/GitRepos/isort/tests/unit/test_action_comments.py +47 -0
  511. package/GitRepos/isort/tests/unit/test_api.py +108 -0
  512. package/GitRepos/isort/tests/unit/test_comments.py +34 -0
  513. package/GitRepos/isort/tests/unit/test_deprecated_finders.py +210 -0
  514. package/GitRepos/isort/tests/unit/test_exceptions.py +100 -0
  515. package/GitRepos/isort/tests/unit/test_files.py +8 -0
  516. package/GitRepos/isort/tests/unit/test_format.py +121 -0
  517. package/GitRepos/isort/tests/unit/test_hooks.py +101 -0
  518. package/GitRepos/isort/tests/unit/test_identify.py +274 -0
  519. package/GitRepos/isort/tests/unit/test_importable.py +42 -0
  520. package/GitRepos/isort/tests/unit/test_io.py +43 -0
  521. package/GitRepos/isort/tests/unit/test_isort.py +5166 -0
  522. package/GitRepos/isort/tests/unit/test_literal.py +37 -0
  523. package/GitRepos/isort/tests/unit/test_main.py +1087 -0
  524. package/GitRepos/isort/tests/unit/test_output.py +22 -0
  525. package/GitRepos/isort/tests/unit/test_parse.py +82 -0
  526. package/GitRepos/isort/tests/unit/test_place.py +56 -0
  527. package/GitRepos/isort/tests/unit/test_pylama_isort.py +24 -0
  528. package/GitRepos/isort/tests/unit/test_regressions.py +1653 -0
  529. package/GitRepos/isort/tests/unit/test_settings.py +229 -0
  530. package/GitRepos/isort/tests/unit/test_setuptools_command.py +31 -0
  531. package/GitRepos/isort/tests/unit/test_ticketed_features.py +1117 -0
  532. package/GitRepos/isort/tests/unit/test_wrap.py +15 -0
  533. package/GitRepos/isort/tests/unit/test_wrap_modes.py +587 -0
  534. package/GitRepos/isort/tests/unit/utils.py +14 -0
  535. package/GitRepos/kettle/LICENSE.txt +21 -0
  536. package/GitRepos/kettle/README.md +215 -0
  537. package/GitRepos/kettle/bin/kettle-skeleton.php +316 -0
  538. package/GitRepos/kettle/composer.json +33 -0
  539. package/GitRepos/kettle/src/kettle.php +1418 -0
  540. package/GitRepos/mirrors-autoflake/.pre-commit-hooks.yaml +5 -0
  541. package/GitRepos/mirrors-autoflake/.version +1 -0
  542. package/GitRepos/mirrors-autoflake/hooks.yaml +7 -0
  543. package/GitRepos/mirrors-autoflake/setup.py +8 -0
  544. package/GitRepos/razorpay-java/LICENSE.txt +8 -0
  545. package/GitRepos/razorpay-java/README.md +421 -0
  546. package/GitRepos/razorpay-java/pom.xml +153 -0
  547. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Addon.java +10 -0
  548. package/GitRepos/razorpay-java/src/main/java/com/razorpay/AddonClient.java +17 -0
  549. package/GitRepos/razorpay-java/src/main/java/com/razorpay/ApiClient.java +194 -0
  550. package/GitRepos/razorpay-java/src/main/java/com/razorpay/ApiUtils.java +179 -0
  551. package/GitRepos/razorpay-java/src/main/java/com/razorpay/BankTransfer.java +10 -0
  552. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Card.java +10 -0
  553. package/GitRepos/razorpay-java/src/main/java/com/razorpay/CardClient.java +12 -0
  554. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Constants.java +78 -0
  555. package/GitRepos/razorpay-java/src/main/java/com/razorpay/CustomTLSSocketFactory.java +75 -0
  556. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Customer.java +10 -0
  557. package/GitRepos/razorpay-java/src/main/java/com/razorpay/CustomerClient.java +36 -0
  558. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Entity.java +45 -0
  559. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Invoice.java +10 -0
  560. package/GitRepos/razorpay-java/src/main/java/com/razorpay/InvoiceClient.java +32 -0
  561. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Order.java +10 -0
  562. package/GitRepos/razorpay-java/src/main/java/com/razorpay/OrderClient.java +32 -0
  563. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Payment.java +10 -0
  564. package/GitRepos/razorpay-java/src/main/java/com/razorpay/PaymentClient.java +83 -0
  565. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Plan.java +10 -0
  566. package/GitRepos/razorpay-java/src/main/java/com/razorpay/PlanClient.java +28 -0
  567. package/GitRepos/razorpay-java/src/main/java/com/razorpay/RazorpayClient.java +45 -0
  568. package/GitRepos/razorpay-java/src/main/java/com/razorpay/RazorpayException.java +21 -0
  569. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Refund.java +10 -0
  570. package/GitRepos/razorpay-java/src/main/java/com/razorpay/RefundClient.java +28 -0
  571. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Reversal.java +10 -0
  572. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Subscription.java +10 -0
  573. package/GitRepos/razorpay-java/src/main/java/com/razorpay/SubscriptionClient.java +36 -0
  574. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Token.java +10 -0
  575. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Transfer.java +10 -0
  576. package/GitRepos/razorpay-java/src/main/java/com/razorpay/TransferClient.java +36 -0
  577. package/GitRepos/razorpay-java/src/main/java/com/razorpay/Utils.java +62 -0
  578. package/GitRepos/razorpay-java/src/main/java/com/razorpay/VirtualAccount.java +10 -0
  579. package/GitRepos/razorpay-java/src/main/java/com/razorpay/VirtualAccountClient.java +44 -0
  580. package/GitRepos/razorpay-java/src/main/resources/project.properties +1 -0
  581. package/GitRepos/react-data-grid/.babelrc +8 -0
  582. package/GitRepos/react-data-grid/.github/ISSUE_TEMPLATE.md +25 -0
  583. package/GitRepos/react-data-grid/.github/PULL_REQUEST_TEMPLATE.md +38 -0
  584. package/GitRepos/react-data-grid/LICENSE +24 -0
  585. package/GitRepos/react-data-grid/README.md +82 -0
  586. package/GitRepos/react-data-grid/addons.js +1 -0
  587. package/GitRepos/react-data-grid/docs/api/docs.json +6685 -0
  588. package/GitRepos/react-data-grid/docs/markdowns/AdvancedToolbar.md +17 -0
  589. package/GitRepos/react-data-grid/docs/markdowns/AutoCompleteEditor.md +68 -0
  590. package/GitRepos/react-data-grid/docs/markdowns/AutoCompleteFilter.md +22 -0
  591. package/GitRepos/react-data-grid/docs/markdowns/AutoCompleteTokensEditor.md +22 -0
  592. package/GitRepos/react-data-grid/docs/markdowns/Canvas.md +126 -0
  593. package/GitRepos/react-data-grid/docs/markdowns/Cell.md +101 -0
  594. package/GitRepos/react-data-grid/docs/markdowns/CheckboxEditor.md +27 -0
  595. package/GitRepos/react-data-grid/docs/markdowns/ContextMenu.md +12 -0
  596. package/GitRepos/react-data-grid/docs/markdowns/DateRangeEditor.md +24 -0
  597. package/GitRepos/react-data-grid/docs/markdowns/DateRangeFilter.md +42 -0
  598. package/GitRepos/react-data-grid/docs/markdowns/DateRangeFormatter.md +25 -0
  599. package/GitRepos/react-data-grid/docs/markdowns/DragDropContainer.md +17 -0
  600. package/GitRepos/react-data-grid/docs/markdowns/Draggable.md +30 -0
  601. package/GitRepos/react-data-grid/docs/markdowns/DraggableHeaderCell.md +22 -0
  602. package/GitRepos/react-data-grid/docs/markdowns/DropDownEditor.md +12 -0
  603. package/GitRepos/react-data-grid/docs/markdowns/DropDownFormatter.md +17 -0
  604. package/GitRepos/react-data-grid/docs/markdowns/EditorBase.md +32 -0
  605. package/GitRepos/react-data-grid/docs/markdowns/EditorContainer.md +37 -0
  606. package/GitRepos/react-data-grid/docs/markdowns/FilterableHeaderCell.md +17 -0
  607. package/GitRepos/react-data-grid/docs/markdowns/Grid.md +169 -0
  608. package/GitRepos/react-data-grid/docs/markdowns/GroupedColumnButton.md +17 -0
  609. package/GitRepos/react-data-grid/docs/markdowns/GroupedColumnsPanel.md +44 -0
  610. package/GitRepos/react-data-grid/docs/markdowns/Header.md +62 -0
  611. package/GitRepos/react-data-grid/docs/markdowns/HeaderCell.md +40 -0
  612. package/GitRepos/react-data-grid/docs/markdowns/HeaderRow.md +92 -0
  613. package/GitRepos/react-data-grid/docs/markdowns/ImageFormatter.md +12 -0
  614. package/GitRepos/react-data-grid/docs/markdowns/MenuHeader.md +12 -0
  615. package/GitRepos/react-data-grid/docs/markdowns/NumericFilter.md +17 -0
  616. package/GitRepos/react-data-grid/docs/markdowns/ReactDataGrid.md +209 -0
  617. package/GitRepos/react-data-grid/docs/markdowns/Row.md +70 -0
  618. package/GitRepos/react-data-grid/docs/markdowns/RowActionsCell.md +53 -0
  619. package/GitRepos/react-data-grid/docs/markdowns/RowDragLayer.md +42 -0
  620. package/GitRepos/react-data-grid/docs/markdowns/RowGroup.md +57 -0
  621. package/GitRepos/react-data-grid/docs/markdowns/SimpleCellFormatter.md +12 -0
  622. package/GitRepos/react-data-grid/docs/markdowns/SortableHeaderCell.md +27 -0
  623. package/GitRepos/react-data-grid/docs/markdowns/Toolbar.md +44 -0
  624. package/GitRepos/react-data-grid/docs/markdowns/Viewport.md +102 -0
  625. package/GitRepos/react-data-grid/docs/readme.md +38 -0
  626. package/GitRepos/react-data-grid/docs/utils/generalUtils.js +50 -0
  627. package/GitRepos/react-data-grid/docs/utils/generateMarkdown.js +74 -0
  628. package/GitRepos/react-data-grid/index.js +1 -0
  629. package/GitRepos/react-data-grid/package.json +120 -0
  630. package/GitRepos/react-data-grid/themes/DragColumn.PNG +0 -0
  631. package/GitRepos/react-data-grid/themes/daterangepicker-bs3.css +284 -0
  632. package/GitRepos/react-data-grid/themes/drag_column_full.PNG +0 -0
  633. package/GitRepos/react-data-grid/themes/react-data-grid.css +961 -0
  634. package/GitRepos/react-data-grid/themes/react-data-grid.less +629 -0
  635. package/Kali +0 -0
  636. package/MobSF/.dockerignore +26 -0
  637. package/MobSF/.github/CODE_OF_CONDUCT.md +46 -0
  638. package/MobSF/.github/CONTRIBUTING.md +131 -0
  639. package/MobSF/.github/FUNDING.yml +3 -0
  640. package/MobSF/.github/ISSUE_TEMPLATE/bug_report.md +54 -0
  641. package/MobSF/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
  642. package/MobSF/.github/PULL_REQUEST_TEMPLATE.md +20 -0
  643. package/MobSF/.github/SECURITY.md +21 -0
  644. package/MobSF/.github/SUPPORT.md +1 -0
  645. package/MobSF/.github/workflows/auto-comment.yml +22 -0
  646. package/MobSF/.github/workflows/docker-build.yml +35 -0
  647. package/MobSF/.github/workflows/mobsf_test.yml +58 -0
  648. package/MobSF/.github/workflows/python-publish.yml +28 -0
  649. package/MobSF/.gitmodules +3 -0
  650. package/MobSF/.pyup.yml +27 -0
  651. package/MobSF/.sonarcloud.properties +3 -0
  652. package/MobSF/Dockerfile +96 -0
  653. package/MobSF/LICENSE +675 -0
  654. package/MobSF/LICENSES/AdminLTE_theme.txt +8 -0
  655. package/MobSF/LICENSES/AntiEmulator.txt +660 -0
  656. package/MobSF/LICENSES/IP2LOCATION LITE DATA.txt +21 -0
  657. package/MobSF/LICENSES/Rootcloak.txt +13 -0
  658. package/MobSF/LICENSES/ac-pm_tools.txt +341 -0
  659. package/MobSF/LICENSES/androguard.txt +76 -0
  660. package/MobSF/LICENSES/backsmali.txt +29 -0
  661. package/MobSF/LICENSES/class-dump-z.txt +13 -0
  662. package/MobSF/LICENSES/droidmon.txt +624 -0
  663. package/MobSF/LICENSES/exodus-core.txt +661 -0
  664. package/MobSF/LICENSES/frida.txt +50 -0
  665. package/MobSF/LICENSES/ios_binary_analysis_rules.txt +28 -0
  666. package/MobSF/LICENSES/jadx.txt +202 -0
  667. package/MobSF/LICENSES/maltrail_blacklist.txt +21 -0
  668. package/MobSF/MANIFEST.in +12 -0
  669. package/MobSF/README.md +116 -0
  670. package/MobSF/docker-compose.yml +39 -0
  671. package/MobSF/manage.py +18 -0
  672. package/MobSF/mobsf/DynamicAnalyzer/__init__.py +0 -0
  673. package/MobSF/mobsf/DynamicAnalyzer/admin.py +0 -0
  674. package/MobSF/mobsf/DynamicAnalyzer/models.py +0 -0
  675. package/MobSF/mobsf/DynamicAnalyzer/tests.py +0 -0
  676. package/MobSF/mobsf/DynamicAnalyzer/tools/__init__.py +0 -0
  677. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/auxiliary/class_trace.js +126 -0
  678. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/auxiliary/get_loaded_classes.js +15 -0
  679. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/auxiliary/get_methods.js +22 -0
  680. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/auxiliary/search_class_pattern.js +55 -0
  681. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/auxiliary/string_catch.js +10 -0
  682. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/auxiliary/string_compare.js +15 -0
  683. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/default/api_monitor.js +572 -0
  684. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/default/debugger_check_bypass.js +8 -0
  685. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/default/root_bypass.js +260 -0
  686. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/default/ssl_pinning_bypass.js +255 -0
  687. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/aes_key.js +161 -0
  688. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/bypass_flag_secure.js +17 -0
  689. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/bypass_method.js +8 -0
  690. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/default.js +3 -0
  691. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/file_trace.js +455 -0
  692. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/get_android_id.js +9 -0
  693. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/helper.js +16 -0
  694. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/hook_constructor.js +7 -0
  695. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/hook_java_reflection.js +7 -0
  696. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/inputstream_dump.js +34 -0
  697. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/intent_dumper.js +21 -0
  698. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/jni_hook_by_address.js +28 -0
  699. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/jni_trace.js +42 -0
  700. package/MobSF/mobsf/DynamicAnalyzer/tools/frida_scripts/others/webview_enable_debugging.js +12 -0
  701. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/mobsf_agents/ClipDump.apk +0 -0
  702. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/Xposed.apk +0 -0
  703. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/XposedInstaller_3.1.5.apk +0 -0
  704. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/hooks.json +389 -0
  705. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/modules/AndroidBluePill.apk +0 -0
  706. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/modules/Droidmon.apk +0 -0
  707. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/modules/JustTrustMe.apk +0 -0
  708. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/modules/com.devadvance.rootcloak2_v18_c43b61.apk +0 -0
  709. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/modules/hooks.json +389 -0
  710. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/modules/mobi.acpm.proxyon_v1_419b04.apk +0 -0
  711. package/MobSF/mobsf/DynamicAnalyzer/tools/onDevice/xposed/modules/mobi.acpm.sslunpinning_v2_37f44f.apk +0 -0
  712. package/MobSF/mobsf/DynamicAnalyzer/tools/webproxy.py +89 -0
  713. package/MobSF/mobsf/DynamicAnalyzer/views/__init__.py +0 -0
  714. package/MobSF/mobsf/DynamicAnalyzer/views/android/__init__.py +0 -0
  715. package/MobSF/mobsf/DynamicAnalyzer/views/android/analysis.py +285 -0
  716. package/MobSF/mobsf/DynamicAnalyzer/views/android/dynamic_analyzer.py +316 -0
  717. package/MobSF/mobsf/DynamicAnalyzer/views/android/environment.py +698 -0
  718. package/MobSF/mobsf/DynamicAnalyzer/views/android/frida_core.py +168 -0
  719. package/MobSF/mobsf/DynamicAnalyzer/views/android/frida_scripts.py +65 -0
  720. package/MobSF/mobsf/DynamicAnalyzer/views/android/frida_server_download.py +75 -0
  721. package/MobSF/mobsf/DynamicAnalyzer/views/android/operations.py +299 -0
  722. package/MobSF/mobsf/DynamicAnalyzer/views/android/report.py +179 -0
  723. package/MobSF/mobsf/DynamicAnalyzer/views/android/tests_common.py +212 -0
  724. package/MobSF/mobsf/DynamicAnalyzer/views/android/tests_frida.py +339 -0
  725. package/MobSF/mobsf/DynamicAnalyzer/views/android/tests_tls.py +109 -0
  726. package/MobSF/mobsf/DynamicAnalyzer/views/android/tests_xposed.py +194 -0
  727. package/MobSF/mobsf/MalwareAnalyzer/__init__.py +0 -0
  728. package/MobSF/mobsf/MalwareAnalyzer/admin.py +0 -0
  729. package/MobSF/mobsf/MalwareAnalyzer/models.py +0 -0
  730. package/MobSF/mobsf/MalwareAnalyzer/tests.py +0 -0
  731. package/MobSF/mobsf/MalwareAnalyzer/views/MalwareDomainCheck.py +226 -0
  732. package/MobSF/mobsf/MalwareAnalyzer/views/Trackers.py +237 -0
  733. package/MobSF/mobsf/MalwareAnalyzer/views/VirusTotal.py +140 -0
  734. package/MobSF/mobsf/MalwareAnalyzer/views/__init__.py +0 -0
  735. package/MobSF/mobsf/MalwareAnalyzer/views/apkid.py +61 -0
  736. package/MobSF/mobsf/MalwareAnalyzer/views/quark.py +145 -0
  737. package/MobSF/mobsf/MobSF/__init__.py +0 -0
  738. package/MobSF/mobsf/MobSF/forms.py +36 -0
  739. package/MobSF/mobsf/MobSF/init.py +143 -0
  740. package/MobSF/mobsf/MobSF/models.py +0 -0
  741. package/MobSF/mobsf/MobSF/settings.py +411 -0
  742. package/MobSF/mobsf/MobSF/urls.py +145 -0
  743. package/MobSF/mobsf/MobSF/utils.py +598 -0
  744. package/MobSF/mobsf/MobSF/views/__init__.py +0 -0
  745. package/MobSF/mobsf/MobSF/views/api/__init__.py +0 -0
  746. package/MobSF/mobsf/MobSF/views/api/api_dynamic_analysis.py +278 -0
  747. package/MobSF/mobsf/MobSF/views/api/api_middleware.py +47 -0
  748. package/MobSF/mobsf/MobSF/views/api/api_static_analysis.py +186 -0
  749. package/MobSF/mobsf/MobSF/views/apk_downloader.py +163 -0
  750. package/MobSF/mobsf/MobSF/views/helpers.py +94 -0
  751. package/MobSF/mobsf/MobSF/views/home.py +350 -0
  752. package/MobSF/mobsf/MobSF/views/scanning.py +149 -0
  753. package/MobSF/mobsf/MobSF/wsgi.py +24 -0
  754. package/MobSF/mobsf/StaticAnalyzer/__init__.py +0 -0
  755. package/MobSF/mobsf/StaticAnalyzer/admin.py +0 -0
  756. package/MobSF/mobsf/StaticAnalyzer/forms.py +92 -0
  757. package/MobSF/mobsf/StaticAnalyzer/models.py +123 -0
  758. package/MobSF/mobsf/StaticAnalyzer/tests.py +425 -0
  759. package/MobSF/mobsf/StaticAnalyzer/tools/__init__.py +0 -0
  760. package/MobSF/mobsf/StaticAnalyzer/tools/apktool_2.5.0.jar +0 -0
  761. package/MobSF/mobsf/StaticAnalyzer/tools/baksmali-2.5.2.jar +0 -0
  762. package/MobSF/mobsf/StaticAnalyzer/tools/ios/class-dump +0 -0
  763. package/MobSF/mobsf/StaticAnalyzer/tools/ios/class-dump-swift +0 -0
  764. package/MobSF/mobsf/StaticAnalyzer/tools/ios/jtool.ELF64 +0 -0
  765. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/LICENSE +201 -0
  766. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/NOTICE +213 -0
  767. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/README.md +125 -0
  768. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/bin/jadx +185 -0
  769. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/bin/jadx-gui +185 -0
  770. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/bin/jadx-gui.bat +89 -0
  771. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/bin/jadx.bat +89 -0
  772. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/android-29-clst.jar +0 -0
  773. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/android-29-res.jar +0 -0
  774. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/antlr-2.7.7.jar +0 -0
  775. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/antlr-runtime-3.5.2.jar +0 -0
  776. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/apksig-4.0.1.jar +0 -0
  777. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/asm-8.0.1.jar +0 -0
  778. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/baksmali-2.4.0.jar +0 -0
  779. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/checker-qual-2.11.1.jar +0 -0
  780. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/commons-lang3-3.11.jar +0 -0
  781. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/commons-text-1.9.jar +0 -0
  782. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/dexlib2-2.4.0.jar +0 -0
  783. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/dx-1.16.jar +0 -0
  784. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/error_prone_annotations-2.3.4.jar +0 -0
  785. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/failureaccess-1.0.1.jar +0 -0
  786. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/gson-2.8.6.jar +0 -0
  787. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/guava-29.0-jre.jar +0 -0
  788. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/image-viewer-1.2.3.jar +0 -0
  789. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/j2objc-annotations-1.3.jar +0 -0
  790. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jadx-cli-1.2.0.jar +0 -0
  791. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jadx-core-1.2.0.jar +0 -0
  792. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jadx-dex-input-1.2.0.jar +0 -0
  793. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jadx-gui-1.2.0.jar +0 -0
  794. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jadx-java-convert-1.2.0.jar +0 -0
  795. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jadx-plugins-api-1.2.0.jar +0 -0
  796. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jadx-smali-input-1.2.0.jar +0 -0
  797. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jcommander-1.80.jar +0 -0
  798. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jfontchooser-1.0.5.jar +0 -0
  799. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/jsr305-3.0.2.jar +0 -0
  800. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar +0 -0
  801. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/logback-classic-1.2.3.jar +0 -0
  802. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/logback-core-1.2.3.jar +0 -0
  803. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/reactive-streams-1.0.3.jar +0 -0
  804. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/rsyntaxtextarea-3.1.1.jar +0 -0
  805. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/rxjava-2.2.19.jar +0 -0
  806. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/rxjava2-swing-0.3.7.jar +0 -0
  807. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/slf4j-api-1.7.30.jar +0 -0
  808. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/smali-2.4.0.jar +0 -0
  809. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/stringtemplate-3.2.1.jar +0 -0
  810. package/MobSF/mobsf/StaticAnalyzer/tools/jadx/lib/util-2.4.0.jar +0 -0
  811. package/MobSF/mobsf/StaticAnalyzer/tools/strings.py +24 -0
  812. package/MobSF/mobsf/StaticAnalyzer/views/__init__.py +0 -0
  813. package/MobSF/mobsf/StaticAnalyzer/views/android/__init__.py +0 -0
  814. package/MobSF/mobsf/StaticAnalyzer/views/android/android_manifest_desc.py +747 -0
  815. package/MobSF/mobsf/StaticAnalyzer/views/android/binary_analysis.py +255 -0
  816. package/MobSF/mobsf/StaticAnalyzer/views/android/cert_analysis.py +160 -0
  817. package/MobSF/mobsf/StaticAnalyzer/views/android/code_analysis.py +96 -0
  818. package/MobSF/mobsf/StaticAnalyzer/views/android/converter.py +97 -0
  819. package/MobSF/mobsf/StaticAnalyzer/views/android/db_interaction.py +217 -0
  820. package/MobSF/mobsf/StaticAnalyzer/views/android/dvm_permissions.py +278 -0
  821. package/MobSF/mobsf/StaticAnalyzer/views/android/find.py +75 -0
  822. package/MobSF/mobsf/StaticAnalyzer/views/android/generate_downloads.py +53 -0
  823. package/MobSF/mobsf/StaticAnalyzer/views/android/icon_analysis.py +134 -0
  824. package/MobSF/mobsf/StaticAnalyzer/views/android/manifest_analysis.py +908 -0
  825. package/MobSF/mobsf/StaticAnalyzer/views/android/manifest_view.py +64 -0
  826. package/MobSF/mobsf/StaticAnalyzer/views/android/network_security.py +243 -0
  827. package/MobSF/mobsf/StaticAnalyzer/views/android/playstore.py +76 -0
  828. package/MobSF/mobsf/StaticAnalyzer/views/android/rules/android_apis.yaml +425 -0
  829. package/MobSF/mobsf/StaticAnalyzer/views/android/rules/android_niap.yaml +356 -0
  830. package/MobSF/mobsf/StaticAnalyzer/views/android/rules/android_rules.yaml +683 -0
  831. package/MobSF/mobsf/StaticAnalyzer/views/android/source_tree.py +79 -0
  832. package/MobSF/mobsf/StaticAnalyzer/views/android/static_analyzer.py +660 -0
  833. package/MobSF/mobsf/StaticAnalyzer/views/android/strings.py +64 -0
  834. package/MobSF/mobsf/StaticAnalyzer/views/android/view_source.py +78 -0
  835. package/MobSF/mobsf/StaticAnalyzer/views/android/win_fixes.py +53 -0
  836. package/MobSF/mobsf/StaticAnalyzer/views/android/xapk.py +57 -0
  837. package/MobSF/mobsf/StaticAnalyzer/views/comparer.py +234 -0
  838. package/MobSF/mobsf/StaticAnalyzer/views/ios/__init__.py +0 -0
  839. package/MobSF/mobsf/StaticAnalyzer/views/ios/app_transport_security.py +222 -0
  840. package/MobSF/mobsf/StaticAnalyzer/views/ios/appstore.py +54 -0
  841. package/MobSF/mobsf/StaticAnalyzer/views/ios/binary_analysis.py +119 -0
  842. package/MobSF/mobsf/StaticAnalyzer/views/ios/binary_rule_matcher.py +58 -0
  843. package/MobSF/mobsf/StaticAnalyzer/views/ios/classdump.py +112 -0
  844. package/MobSF/mobsf/StaticAnalyzer/views/ios/code_analysis.py +103 -0
  845. package/MobSF/mobsf/StaticAnalyzer/views/ios/db_interaction.py +177 -0
  846. package/MobSF/mobsf/StaticAnalyzer/views/ios/file_analysis.py +85 -0
  847. package/MobSF/mobsf/StaticAnalyzer/views/ios/file_recon.py +63 -0
  848. package/MobSF/mobsf/StaticAnalyzer/views/ios/icon_analysis.py +73 -0
  849. package/MobSF/mobsf/StaticAnalyzer/views/ios/macho_analysis.py +255 -0
  850. package/MobSF/mobsf/StaticAnalyzer/views/ios/permission_analysis.py +90 -0
  851. package/MobSF/mobsf/StaticAnalyzer/views/ios/plist_analysis.py +150 -0
  852. package/MobSF/mobsf/StaticAnalyzer/views/ios/rules/__init__.py +0 -0
  853. package/MobSF/mobsf/StaticAnalyzer/views/ios/rules/ios_apis.yaml +85 -0
  854. package/MobSF/mobsf/StaticAnalyzer/views/ios/rules/ipa_rules.py +226 -0
  855. package/MobSF/mobsf/StaticAnalyzer/views/ios/rules/objective_c_rules.yaml +355 -0
  856. package/MobSF/mobsf/StaticAnalyzer/views/ios/rules/swift_rules.yaml +461 -0
  857. package/MobSF/mobsf/StaticAnalyzer/views/ios/static_analyzer.py +282 -0
  858. package/MobSF/mobsf/StaticAnalyzer/views/ios/view_source.py +155 -0
  859. package/MobSF/mobsf/StaticAnalyzer/views/sast_engine.py +71 -0
  860. package/MobSF/mobsf/StaticAnalyzer/views/shared_func.py +424 -0
  861. package/MobSF/mobsf/StaticAnalyzer/views/windows/__init__.py +0 -0
  862. package/MobSF/mobsf/StaticAnalyzer/views/windows/db_interaction.py +130 -0
  863. package/MobSF/mobsf/StaticAnalyzer/views/windows/windows.py +590 -0
  864. package/MobSF/mobsf/__init__.py +0 -0
  865. package/MobSF/mobsf/__main__.py +49 -0
  866. package/MobSF/mobsf/install/__init__.py +0 -0
  867. package/MobSF/mobsf/install/windows/__init__.py +0 -0
  868. package/MobSF/mobsf/install/windows/config.txt +26 -0
  869. package/MobSF/mobsf/install/windows/readme.md +43 -0
  870. package/MobSF/mobsf/install/windows/rpc_client.py +191 -0
  871. package/MobSF/mobsf/install/windows/setup.py +433 -0
  872. package/MobSF/mobsf/signatures/IP2LOCATION-LITE-DB5.IPV6.BIN +0 -0
  873. package/MobSF/mobsf/signatures/exodus_trackers +1 -0
  874. package/MobSF/mobsf/signatures/maltrail-malware-domains.txt +157958 -0
  875. package/MobSF/mobsf/signatures/malwaredomainlist +2256 -0
  876. package/MobSF/mobsf/static/adminlte/dashboard/css/adminlte.min.css +12 -0
  877. package/MobSF/mobsf/static/adminlte/dashboard/css/adminlte.min.css.map +1 -0
  878. package/MobSF/mobsf/static/adminlte/dashboard/js/adminlte.min.js +7 -0
  879. package/MobSF/mobsf/static/adminlte/dashboard/js/adminlte.min.js.map +1 -0
  880. package/MobSF/mobsf/static/adminlte/plugins/bootstrap/bootstrap.bundle.min.js +7 -0
  881. package/MobSF/mobsf/static/adminlte/plugins/bootstrap/bootstrap.bundle.min.js.map +1 -0
  882. package/MobSF/mobsf/static/adminlte/plugins/datatables/jquery.dataTables.min.js +166 -0
  883. package/MobSF/mobsf/static/adminlte/plugins/datatables-bs4/dataTables.bootstrap4.min.css +1 -0
  884. package/MobSF/mobsf/static/adminlte/plugins/datatables-bs4/dataTables.bootstrap4.min.js +8 -0
  885. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/all.css +4423 -0
  886. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/all.min.css +5 -0
  887. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/brands.css +14 -0
  888. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/brands.min.css +5 -0
  889. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/fontawesome.css +4390 -0
  890. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/fontawesome.min.css +5 -0
  891. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/regular.css +15 -0
  892. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/regular.min.css +5 -0
  893. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/solid.css +16 -0
  894. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/solid.min.css +5 -0
  895. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/svg-with-js.css +371 -0
  896. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/svg-with-js.min.css +5 -0
  897. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/v4-shims.css +2166 -0
  898. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/css/v4-shims.min.css +5 -0
  899. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-brands-400.eot +0 -0
  900. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-brands-400.svg +3496 -0
  901. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-brands-400.ttf +0 -0
  902. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-brands-400.woff +0 -0
  903. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-brands-400.woff2 +0 -0
  904. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-regular-400.eot +0 -0
  905. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-regular-400.svg +803 -0
  906. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-regular-400.ttf +0 -0
  907. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-regular-400.woff +0 -0
  908. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-regular-400.woff2 +0 -0
  909. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-solid-900.eot +0 -0
  910. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-solid-900.svg +4667 -0
  911. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-solid-900.ttf +0 -0
  912. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-solid-900.woff +0 -0
  913. package/MobSF/mobsf/static/adminlte/plugins/fontawesome-free/webfonts/fa-solid-900.woff2 +0 -0
  914. package/MobSF/mobsf/static/adminlte/plugins/jquery-ui.min.js +13 -0
  915. package/MobSF/mobsf/static/adminlte/plugins/jquery.min.js +2 -0
  916. package/MobSF/mobsf/static/adminlte/plugins/overlayScrollbars/css/OverlayScrollbars.min.css +13 -0
  917. package/MobSF/mobsf/static/adminlte/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js +13 -0
  918. package/MobSF/mobsf/static/adminlte/plugins/sweetalert2/sweetalert2.min.css +1 -0
  919. package/MobSF/mobsf/static/adminlte/plugins/sweetalert2/sweetalert2.min.js +1 -0
  920. package/MobSF/mobsf/static/amcharts/animated.js +1 -0
  921. package/MobSF/mobsf/static/amcharts/core.js +1 -0
  922. package/MobSF/mobsf/static/amcharts/maps.js +1 -0
  923. package/MobSF/mobsf/static/amcharts/worldIndiaLow.js +20 -0
  924. package/MobSF/mobsf/static/codemirror/codemirror.css +350 -0
  925. package/MobSF/mobsf/static/codemirror/codemirror.js +9803 -0
  926. package/MobSF/mobsf/static/codemirror/javascript-lint.js +65 -0
  927. package/MobSF/mobsf/static/codemirror/javascript.js +945 -0
  928. package/MobSF/mobsf/static/codemirror/jshint.js +29591 -0
  929. package/MobSF/mobsf/static/codemirror/lint.css +71 -0
  930. package/MobSF/mobsf/static/codemirror/lint.js +259 -0
  931. package/MobSF/mobsf/static/enlighterjs/enlighterjs.enlighter.min.css +3 -0
  932. package/MobSF/mobsf/static/enlighterjs/enlighterjs.min.css +15 -0
  933. package/MobSF/mobsf/static/enlighterjs/enlighterjs.min.js +3 -0
  934. package/MobSF/mobsf/static/fonts/Open_Sans/LICENSE.txt +202 -0
  935. package/MobSF/mobsf/static/fonts/Open_Sans/OpenSans-Regular.ttf +0 -0
  936. package/MobSF/mobsf/static/fonts/Oswald/OFL.txt +93 -0
  937. package/MobSF/mobsf/static/fonts/Oswald/Oswald-Regular.ttf +0 -0
  938. package/MobSF/mobsf/static/img/favicon.ico +0 -0
  939. package/MobSF/mobsf/static/img/loading.jpg +0 -0
  940. package/MobSF/mobsf/static/img/mobsf_icon.png +0 -0
  941. package/MobSF/mobsf/static/img/mobsf_logo.png +0 -0
  942. package/MobSF/mobsf/static/img/no_icon.png +0 -0
  943. package/MobSF/mobsf/static/jsTree/custom.css +114 -0
  944. package/MobSF/mobsf/static/jsTree/jstree.min.js +6 -0
  945. package/MobSF/mobsf/static/jsTree/themes/default/32px.png +0 -0
  946. package/MobSF/mobsf/static/jsTree/themes/default/40px.png +0 -0
  947. package/MobSF/mobsf/static/jsTree/themes/default/content_background.gif +0 -0
  948. package/MobSF/mobsf/static/jsTree/themes/default/dir.gif +0 -0
  949. package/MobSF/mobsf/static/jsTree/themes/default/file.png +0 -0
  950. package/MobSF/mobsf/static/jsTree/themes/default/style.min.css +1 -0
  951. package/MobSF/mobsf/static/jsTree/themes/default/throbber.gif +0 -0
  952. package/MobSF/mobsf/static/landing/css/home.css +310 -0
  953. package/MobSF/mobsf/static/others/css/devices.min.css +1 -0
  954. package/MobSF/mobsf/static/others/css/pdf_report.css +123 -0
  955. package/MobSF/mobsf/static/others/css/spinner.css +168 -0
  956. package/MobSF/mobsf/static/others/css/terminal.css +79 -0
  957. package/MobSF/mobsf/static/others/css/xcode.min.css +1 -0
  958. package/MobSF/mobsf/static/terminal/terminal.css +79 -0
  959. package/MobSF/mobsf/templates/base/base_layout.html +123 -0
  960. package/MobSF/mobsf/templates/dynamic_analysis/android/dynamic_analyzer.html +1064 -0
  961. package/MobSF/mobsf/templates/dynamic_analysis/android/dynamic_report.html +1017 -0
  962. package/MobSF/mobsf/templates/dynamic_analysis/android/frida_logs.html +48 -0
  963. package/MobSF/mobsf/templates/dynamic_analysis/android/live_api.html +103 -0
  964. package/MobSF/mobsf/templates/dynamic_analysis/android/logcat.html +56 -0
  965. package/MobSF/mobsf/templates/dynamic_analysis/dynamic_analysis.html +328 -0
  966. package/MobSF/mobsf/templates/general/about.html +30 -0
  967. package/MobSF/mobsf/templates/general/apidocs.html +2201 -0
  968. package/MobSF/mobsf/templates/general/error.html +23 -0
  969. package/MobSF/mobsf/templates/general/home.html +298 -0
  970. package/MobSF/mobsf/templates/general/not_found.html +22 -0
  971. package/MobSF/mobsf/templates/general/recent.html +254 -0
  972. package/MobSF/mobsf/templates/general/search.html +35 -0
  973. package/MobSF/mobsf/templates/general/view.html +124 -0
  974. package/MobSF/mobsf/templates/general/zip.html +31 -0
  975. package/MobSF/mobsf/templates/pdf/android_report.html +930 -0
  976. package/MobSF/mobsf/templates/pdf/ios_report.html +760 -0
  977. package/MobSF/mobsf/templates/pdf/windows_report.html +211 -0
  978. package/MobSF/mobsf/templates/static_analysis/android_binary_analysis.html +2006 -0
  979. package/MobSF/mobsf/templates/static_analysis/android_source_analysis.html +1502 -0
  980. package/MobSF/mobsf/templates/static_analysis/compare.html +917 -0
  981. package/MobSF/mobsf/templates/static_analysis/ios_binary_analysis.html +1299 -0
  982. package/MobSF/mobsf/templates/static_analysis/ios_source_analysis.html +1125 -0
  983. package/MobSF/mobsf/templates/static_analysis/source_tree.html +332 -0
  984. package/MobSF/mobsf/templates/static_analysis/treeview_file.html +1 -0
  985. package/MobSF/mobsf/templates/static_analysis/treeview_folder.html +5 -0
  986. package/MobSF/mobsf/templates/static_analysis/windows_binary_analysis.html +411 -0
  987. package/MobSF/requirements.txt +30 -0
  988. package/MobSF/run.bat +19 -0
  989. package/MobSF/run.sh +48 -0
  990. package/MobSF/scripts/__init__.py +0 -0
  991. package/MobSF/scripts/check_install.py +28 -0
  992. package/MobSF/scripts/clean.bat +31 -0
  993. package/MobSF/scripts/clean.sh +43 -0
  994. package/MobSF/scripts/entrypoint.sh +8 -0
  995. package/MobSF/scripts/install_java_wkhtmltopdf.sh +33 -0
  996. package/MobSF/scripts/mass_static_analysis.py +95 -0
  997. package/MobSF/scripts/postgres_support.sh +11 -0
  998. package/MobSF/scripts/stack/docker-compose.yml +15 -0
  999. package/MobSF/scripts/update_android_permissions.py +46 -0
  1000. package/MobSF/setup.bat +81 -0
  1001. package/MobSF/setup.py +61 -0
  1002. package/MobSF/setup.sh +76 -0
  1003. package/MobSF/tox.ini +94 -0
  1004. package/Notes/AWS Security.pdf +0 -0
  1005. package/Notes/Android Security.pdf +0 -0
  1006. package/Notes/Web Security.pdf +0 -0
  1007. package/Screenshot 2022-03-10 at 11.57.37 AM.png +0 -0
  1008. package/Security Bug Demo.mov +0 -0
  1009. package/Security Review.mov +0 -0
  1010. package/Templates/CRLF.txt +61 -0
  1011. package/Templates/cors.html +26 -0
  1012. package/Templates/openredirect.txt +860 -0
  1013. package/Templates/secrets.py +102 -0
  1014. package/Templates/vhost.txt +174 -0
  1015. package/Templates/wordlist.txt +6038 -0
  1016. package/Templates/xss.txt +2691 -0
  1017. package/cloneall.sh +26 -0
  1018. package/index.js +46 -0
  1019. package/meesecops/.dockerignore +6 -0
  1020. package/meesecops/Dockerfile +15 -0
  1021. package/meesecops/LICENSE +201 -0
  1022. package/meesecops/README.md +2 -0
  1023. package/meesecops/README_secops.md +206 -0
  1024. package/meesecops/Workflows/1-factor.png +0 -0
  1025. package/meesecops/Workflows/2-factor.png +0 -0
  1026. package/meesecops/__init__.py +0 -0
  1027. package/meesecops/application/__init__.py +23 -0
  1028. package/meesecops/application/jira_functions.py +554 -0
  1029. package/meesecops/application/static/css/close_style.css +151 -0
  1030. package/meesecops/application/static/css/style.css +358 -0
  1031. package/meesecops/application/static/external/1.16.0.popper.min.js +5 -0
  1032. package/meesecops/application/static/external/bootstrap.min.css +5 -0
  1033. package/meesecops/application/static/external/bootstrap.min.js +7 -0
  1034. package/meesecops/application/static/external/css.css +48 -0
  1035. package/meesecops/application/static/external/index.js +607 -0
  1036. package/meesecops/application/static/external/jquery-1.12.4.js +11008 -0
  1037. package/meesecops/application/static/fonts/glyphicons-halflings-regular.woff2 +0 -0
  1038. package/meesecops/application/static/fonts/hacked.woff +0 -0
  1039. package/meesecops/application/static/images/ajax-loader.gif +0 -0
  1040. package/meesecops/application/static/images/favicon.png +0 -0
  1041. package/meesecops/application/static/images/glogin.png +0 -0
  1042. package/meesecops/application/static/images/logo3.png +0 -0
  1043. package/meesecops/application/static/images/sort_asc.png +0 -0
  1044. package/meesecops/application/static/images/sort_both.png +0 -0
  1045. package/meesecops/application/static/images/sort_desc.png +0 -0
  1046. package/meesecops/application/static/options.json +62 -0
  1047. package/meesecops/application/static/request_options.json +721 -0
  1048. package/meesecops/application/static/robots.txt +2 -0
  1049. package/meesecops/application/templates/close_tickets.html +261 -0
  1050. package/meesecops/application/templates/footer.html +15 -0
  1051. package/meesecops/application/templates/index.html +337 -0
  1052. package/meesecops/application/templates/login.html +50 -0
  1053. package/meesecops/application/templates/nav.html +63 -0
  1054. package/meesecops/application/templates/new_secreview.html +92 -0
  1055. package/meesecops/application/templates/search_tickets.html +77 -0
  1056. package/meesecops/application/templates/security_updates.html +82 -0
  1057. package/meesecops/application/views.py +536 -0
  1058. package/meesecops/config.py +206 -0
  1059. package/meesecops/logs/README.txt +1 -0
  1060. package/meesecops/logs/access_log +0 -0
  1061. package/meesecops/requirements.txt +32 -0
  1062. package/meesecops/run.py +100 -0
  1063. package/meesecops/screenshot/1.png +0 -0
  1064. package/meesecops/screenshot/2.png +0 -0
  1065. package/meesecops/screenshot/3.png +0 -0
  1066. package/meesecops/screenshot/4-1.png +0 -0
  1067. package/meesecops/screenshot/4.png +0 -0
  1068. package/meesecops/screenshot/5.png +0 -0
  1069. package/meesecops/screenshot/6.png +0 -0
  1070. package/meesecops/screenshot/7.png +0 -0
  1071. package/meesecops/ssl/README.txt +1 -0
  1072. package/package.json +11 -0
  1073. package/prod.pem +27 -0
  1074. package/test1.py +133 -0
@@ -0,0 +1,1925 @@
1
+ """
2
+ String transformers that can split and merge strings.
3
+ """
4
+ from abc import ABC, abstractmethod
5
+ from collections import defaultdict
6
+ from dataclasses import dataclass
7
+ import regex as re
8
+ from typing import (
9
+ Any,
10
+ Callable,
11
+ Collection,
12
+ Dict,
13
+ Iterable,
14
+ Iterator,
15
+ List,
16
+ Optional,
17
+ Sequence,
18
+ Tuple,
19
+ TypeVar,
20
+ Union,
21
+ )
22
+
23
+ from black.rusty import Result, Ok, Err
24
+
25
+ from black.mode import Feature
26
+ from black.nodes import syms, replace_child, parent_type
27
+ from black.nodes import is_empty_par, is_empty_lpar, is_empty_rpar
28
+ from black.nodes import CLOSING_BRACKETS, STANDALONE_COMMENT
29
+ from black.lines import Line, append_leaves
30
+ from black.brackets import BracketMatchError
31
+ from black.comments import contains_pragma_comment
32
+ from black.strings import has_triple_quotes, get_string_prefix, assert_is_leaf_string
33
+ from black.strings import normalize_string_quotes
34
+
35
+ from blib2to3.pytree import Leaf, Node
36
+ from blib2to3.pgen2 import token
37
+
38
+
39
+ class CannotTransform(Exception):
40
+ """Base class for errors raised by Transformers."""
41
+
42
+
43
+ # types
44
+ T = TypeVar("T")
45
+ LN = Union[Leaf, Node]
46
+ Transformer = Callable[[Line, Collection[Feature]], Iterator[Line]]
47
+ Index = int
48
+ NodeType = int
49
+ ParserState = int
50
+ StringID = int
51
+ TResult = Result[T, CannotTransform] # (T)ransform Result
52
+ TMatchResult = TResult[Index]
53
+
54
+
55
+ def TErr(err_msg: str) -> Err[CannotTransform]:
56
+ """(T)ransform Err
57
+
58
+ Convenience function used when working with the TResult type.
59
+ """
60
+ cant_transform = CannotTransform(err_msg)
61
+ return Err(cant_transform)
62
+
63
+
64
+ @dataclass # type: ignore
65
+ class StringTransformer(ABC):
66
+ """
67
+ An implementation of the Transformer protocol that relies on its
68
+ subclasses overriding the template methods `do_match(...)` and
69
+ `do_transform(...)`.
70
+
71
+ This Transformer works exclusively on strings (for example, by merging
72
+ or splitting them).
73
+
74
+ The following sections can be found among the docstrings of each concrete
75
+ StringTransformer subclass.
76
+
77
+ Requirements:
78
+ Which requirements must be met of the given Line for this
79
+ StringTransformer to be applied?
80
+
81
+ Transformations:
82
+ If the given Line meets all of the above requirements, which string
83
+ transformations can you expect to be applied to it by this
84
+ StringTransformer?
85
+
86
+ Collaborations:
87
+ What contractual agreements does this StringTransformer have with other
88
+ StringTransfomers? Such collaborations should be eliminated/minimized
89
+ as much as possible.
90
+ """
91
+
92
+ line_length: int
93
+ normalize_strings: bool
94
+ __name__ = "StringTransformer"
95
+
96
+ @abstractmethod
97
+ def do_match(self, line: Line) -> TMatchResult:
98
+ """
99
+ Returns:
100
+ * Ok(string_idx) such that `line.leaves[string_idx]` is our target
101
+ string, if a match was able to be made.
102
+ OR
103
+ * Err(CannotTransform), if a match was not able to be made.
104
+ """
105
+
106
+ @abstractmethod
107
+ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]:
108
+ """
109
+ Yields:
110
+ * Ok(new_line) where new_line is the new transformed line.
111
+ OR
112
+ * Err(CannotTransform) if the transformation failed for some reason. The
113
+ `do_match(...)` template method should usually be used to reject
114
+ the form of the given Line, but in some cases it is difficult to
115
+ know whether or not a Line meets the StringTransformer's
116
+ requirements until the transformation is already midway.
117
+
118
+ Side Effects:
119
+ This method should NOT mutate @line directly, but it MAY mutate the
120
+ Line's underlying Node structure. (WARNING: If the underlying Node
121
+ structure IS altered, then this method should NOT be allowed to
122
+ yield an CannotTransform after that point.)
123
+ """
124
+
125
+ def __call__(self, line: Line, _features: Collection[Feature]) -> Iterator[Line]:
126
+ """
127
+ StringTransformer instances have a call signature that mirrors that of
128
+ the Transformer type.
129
+
130
+ Raises:
131
+ CannotTransform(...) if the concrete StringTransformer class is unable
132
+ to transform @line.
133
+ """
134
+ # Optimization to avoid calling `self.do_match(...)` when the line does
135
+ # not contain any string.
136
+ if not any(leaf.type == token.STRING for leaf in line.leaves):
137
+ raise CannotTransform("There are no strings in this line.")
138
+
139
+ match_result = self.do_match(line)
140
+
141
+ if isinstance(match_result, Err):
142
+ cant_transform = match_result.err()
143
+ raise CannotTransform(
144
+ f"The string transformer {self.__class__.__name__} does not recognize"
145
+ " this line as one that it can transform."
146
+ ) from cant_transform
147
+
148
+ string_idx = match_result.ok()
149
+
150
+ for line_result in self.do_transform(line, string_idx):
151
+ if isinstance(line_result, Err):
152
+ cant_transform = line_result.err()
153
+ raise CannotTransform(
154
+ "StringTransformer failed while attempting to transform string."
155
+ ) from cant_transform
156
+ line = line_result.ok()
157
+ yield line
158
+
159
+
160
+ @dataclass
161
+ class CustomSplit:
162
+ """A custom (i.e. manual) string split.
163
+
164
+ A single CustomSplit instance represents a single substring.
165
+
166
+ Examples:
167
+ Consider the following string:
168
+ ```
169
+ "Hi there friend."
170
+ " This is a custom"
171
+ f" string {split}."
172
+ ```
173
+
174
+ This string will correspond to the following three CustomSplit instances:
175
+ ```
176
+ CustomSplit(False, 16)
177
+ CustomSplit(False, 17)
178
+ CustomSplit(True, 16)
179
+ ```
180
+ """
181
+
182
+ has_prefix: bool
183
+ break_idx: int
184
+
185
+
186
+ class CustomSplitMapMixin:
187
+ """
188
+ This mixin class is used to map merged strings to a sequence of
189
+ CustomSplits, which will then be used to re-split the strings iff none of
190
+ the resultant substrings go over the configured max line length.
191
+ """
192
+
193
+ _Key = Tuple[StringID, str]
194
+ _CUSTOM_SPLIT_MAP: Dict[_Key, Tuple[CustomSplit, ...]] = defaultdict(tuple)
195
+
196
+ @staticmethod
197
+ def _get_key(string: str) -> "CustomSplitMapMixin._Key":
198
+ """
199
+ Returns:
200
+ A unique identifier that is used internally to map @string to a
201
+ group of custom splits.
202
+ """
203
+ return (id(string), string)
204
+
205
+ def add_custom_splits(
206
+ self, string: str, custom_splits: Iterable[CustomSplit]
207
+ ) -> None:
208
+ """Custom Split Map Setter Method
209
+
210
+ Side Effects:
211
+ Adds a mapping from @string to the custom splits @custom_splits.
212
+ """
213
+ key = self._get_key(string)
214
+ self._CUSTOM_SPLIT_MAP[key] = tuple(custom_splits)
215
+
216
+ def pop_custom_splits(self, string: str) -> List[CustomSplit]:
217
+ """Custom Split Map Getter Method
218
+
219
+ Returns:
220
+ * A list of the custom splits that are mapped to @string, if any
221
+ exist.
222
+ OR
223
+ * [], otherwise.
224
+
225
+ Side Effects:
226
+ Deletes the mapping between @string and its associated custom
227
+ splits (which are returned to the caller).
228
+ """
229
+ key = self._get_key(string)
230
+
231
+ custom_splits = self._CUSTOM_SPLIT_MAP[key]
232
+ del self._CUSTOM_SPLIT_MAP[key]
233
+
234
+ return list(custom_splits)
235
+
236
+ def has_custom_splits(self, string: str) -> bool:
237
+ """
238
+ Returns:
239
+ True iff @string is associated with a set of custom splits.
240
+ """
241
+ key = self._get_key(string)
242
+ return key in self._CUSTOM_SPLIT_MAP
243
+
244
+
245
+ class StringMerger(CustomSplitMapMixin, StringTransformer):
246
+ """StringTransformer that merges strings together.
247
+
248
+ Requirements:
249
+ (A) The line contains adjacent strings such that ALL of the validation checks
250
+ listed in StringMerger.__validate_msg(...)'s docstring pass.
251
+ OR
252
+ (B) The line contains a string which uses line continuation backslashes.
253
+
254
+ Transformations:
255
+ Depending on which of the two requirements above where met, either:
256
+
257
+ (A) The string group associated with the target string is merged.
258
+ OR
259
+ (B) All line-continuation backslashes are removed from the target string.
260
+
261
+ Collaborations:
262
+ StringMerger provides custom split information to StringSplitter.
263
+ """
264
+
265
+ def do_match(self, line: Line) -> TMatchResult:
266
+ LL = line.leaves
267
+
268
+ is_valid_index = is_valid_index_factory(LL)
269
+
270
+ for (i, leaf) in enumerate(LL):
271
+ if (
272
+ leaf.type == token.STRING
273
+ and is_valid_index(i + 1)
274
+ and LL[i + 1].type == token.STRING
275
+ ):
276
+ return Ok(i)
277
+
278
+ if leaf.type == token.STRING and "\\\n" in leaf.value:
279
+ return Ok(i)
280
+
281
+ return TErr("This line has no strings that need merging.")
282
+
283
+ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]:
284
+ new_line = line
285
+ rblc_result = self._remove_backslash_line_continuation_chars(
286
+ new_line, string_idx
287
+ )
288
+ if isinstance(rblc_result, Ok):
289
+ new_line = rblc_result.ok()
290
+
291
+ msg_result = self._merge_string_group(new_line, string_idx)
292
+ if isinstance(msg_result, Ok):
293
+ new_line = msg_result.ok()
294
+
295
+ if isinstance(rblc_result, Err) and isinstance(msg_result, Err):
296
+ msg_cant_transform = msg_result.err()
297
+ rblc_cant_transform = rblc_result.err()
298
+ cant_transform = CannotTransform(
299
+ "StringMerger failed to merge any strings in this line."
300
+ )
301
+
302
+ # Chain the errors together using `__cause__`.
303
+ msg_cant_transform.__cause__ = rblc_cant_transform
304
+ cant_transform.__cause__ = msg_cant_transform
305
+
306
+ yield Err(cant_transform)
307
+ else:
308
+ yield Ok(new_line)
309
+
310
+ @staticmethod
311
+ def _remove_backslash_line_continuation_chars(
312
+ line: Line, string_idx: int
313
+ ) -> TResult[Line]:
314
+ """
315
+ Merge strings that were split across multiple lines using
316
+ line-continuation backslashes.
317
+
318
+ Returns:
319
+ Ok(new_line), if @line contains backslash line-continuation
320
+ characters.
321
+ OR
322
+ Err(CannotTransform), otherwise.
323
+ """
324
+ LL = line.leaves
325
+
326
+ string_leaf = LL[string_idx]
327
+ if not (
328
+ string_leaf.type == token.STRING
329
+ and "\\\n" in string_leaf.value
330
+ and not has_triple_quotes(string_leaf.value)
331
+ ):
332
+ return TErr(
333
+ f"String leaf {string_leaf} does not contain any backslash line"
334
+ " continuation characters."
335
+ )
336
+
337
+ new_line = line.clone()
338
+ new_line.comments = line.comments.copy()
339
+ append_leaves(new_line, line, LL)
340
+
341
+ new_string_leaf = new_line.leaves[string_idx]
342
+ new_string_leaf.value = new_string_leaf.value.replace("\\\n", "")
343
+
344
+ return Ok(new_line)
345
+
346
+ def _merge_string_group(self, line: Line, string_idx: int) -> TResult[Line]:
347
+ """
348
+ Merges string group (i.e. set of adjacent strings) where the first
349
+ string in the group is `line.leaves[string_idx]`.
350
+
351
+ Returns:
352
+ Ok(new_line), if ALL of the validation checks found in
353
+ __validate_msg(...) pass.
354
+ OR
355
+ Err(CannotTransform), otherwise.
356
+ """
357
+ LL = line.leaves
358
+
359
+ is_valid_index = is_valid_index_factory(LL)
360
+
361
+ vresult = self._validate_msg(line, string_idx)
362
+ if isinstance(vresult, Err):
363
+ return vresult
364
+
365
+ # If the string group is wrapped inside an Atom node, we must make sure
366
+ # to later replace that Atom with our new (merged) string leaf.
367
+ atom_node = LL[string_idx].parent
368
+
369
+ # We will place BREAK_MARK in between every two substrings that we
370
+ # merge. We will then later go through our final result and use the
371
+ # various instances of BREAK_MARK we find to add the right values to
372
+ # the custom split map.
373
+ BREAK_MARK = "@@@@@ BLACK BREAKPOINT MARKER @@@@@"
374
+
375
+ QUOTE = LL[string_idx].value[-1]
376
+
377
+ def make_naked(string: str, string_prefix: str) -> str:
378
+ """Strip @string (i.e. make it a "naked" string)
379
+
380
+ Pre-conditions:
381
+ * assert_is_leaf_string(@string)
382
+
383
+ Returns:
384
+ A string that is identical to @string except that
385
+ @string_prefix has been stripped, the surrounding QUOTE
386
+ characters have been removed, and any remaining QUOTE
387
+ characters have been escaped.
388
+ """
389
+ assert_is_leaf_string(string)
390
+
391
+ RE_EVEN_BACKSLASHES = r"(?:(?<!\\)(?:\\\\)*)"
392
+ naked_string = string[len(string_prefix) + 1 : -1]
393
+ naked_string = re.sub(
394
+ "(" + RE_EVEN_BACKSLASHES + ")" + QUOTE, r"\1\\" + QUOTE, naked_string
395
+ )
396
+ return naked_string
397
+
398
+ # Holds the CustomSplit objects that will later be added to the custom
399
+ # split map.
400
+ custom_splits = []
401
+
402
+ # Temporary storage for the 'has_prefix' part of the CustomSplit objects.
403
+ prefix_tracker = []
404
+
405
+ # Sets the 'prefix' variable. This is the prefix that the final merged
406
+ # string will have.
407
+ next_str_idx = string_idx
408
+ prefix = ""
409
+ while (
410
+ not prefix
411
+ and is_valid_index(next_str_idx)
412
+ and LL[next_str_idx].type == token.STRING
413
+ ):
414
+ prefix = get_string_prefix(LL[next_str_idx].value)
415
+ next_str_idx += 1
416
+
417
+ # The next loop merges the string group. The final string will be
418
+ # contained in 'S'.
419
+ #
420
+ # The following convenience variables are used:
421
+ #
422
+ # S: string
423
+ # NS: naked string
424
+ # SS: next string
425
+ # NSS: naked next string
426
+ S = ""
427
+ NS = ""
428
+ num_of_strings = 0
429
+ next_str_idx = string_idx
430
+ while is_valid_index(next_str_idx) and LL[next_str_idx].type == token.STRING:
431
+ num_of_strings += 1
432
+
433
+ SS = LL[next_str_idx].value
434
+ next_prefix = get_string_prefix(SS)
435
+
436
+ # If this is an f-string group but this substring is not prefixed
437
+ # with 'f'...
438
+ if "f" in prefix and "f" not in next_prefix:
439
+ # Then we must escape any braces contained in this substring.
440
+ SS = re.subf(r"(\{|\})", "{1}{1}", SS)
441
+
442
+ NSS = make_naked(SS, next_prefix)
443
+
444
+ has_prefix = bool(next_prefix)
445
+ prefix_tracker.append(has_prefix)
446
+
447
+ S = prefix + QUOTE + NS + NSS + BREAK_MARK + QUOTE
448
+ NS = make_naked(S, prefix)
449
+
450
+ next_str_idx += 1
451
+
452
+ S_leaf = Leaf(token.STRING, S)
453
+ if self.normalize_strings:
454
+ S_leaf.value = normalize_string_quotes(S_leaf.value)
455
+
456
+ # Fill the 'custom_splits' list with the appropriate CustomSplit objects.
457
+ temp_string = S_leaf.value[len(prefix) + 1 : -1]
458
+ for has_prefix in prefix_tracker:
459
+ mark_idx = temp_string.find(BREAK_MARK)
460
+ assert (
461
+ mark_idx >= 0
462
+ ), "Logic error while filling the custom string breakpoint cache."
463
+
464
+ temp_string = temp_string[mark_idx + len(BREAK_MARK) :]
465
+ breakpoint_idx = mark_idx + (len(prefix) if has_prefix else 0) + 1
466
+ custom_splits.append(CustomSplit(has_prefix, breakpoint_idx))
467
+
468
+ string_leaf = Leaf(token.STRING, S_leaf.value.replace(BREAK_MARK, ""))
469
+
470
+ if atom_node is not None:
471
+ replace_child(atom_node, string_leaf)
472
+
473
+ # Build the final line ('new_line') that this method will later return.
474
+ new_line = line.clone()
475
+ for (i, leaf) in enumerate(LL):
476
+ if i == string_idx:
477
+ new_line.append(string_leaf)
478
+
479
+ if string_idx <= i < string_idx + num_of_strings:
480
+ for comment_leaf in line.comments_after(LL[i]):
481
+ new_line.append(comment_leaf, preformatted=True)
482
+ continue
483
+
484
+ append_leaves(new_line, line, [leaf])
485
+
486
+ self.add_custom_splits(string_leaf.value, custom_splits)
487
+ return Ok(new_line)
488
+
489
+ @staticmethod
490
+ def _validate_msg(line: Line, string_idx: int) -> TResult[None]:
491
+ """Validate (M)erge (S)tring (G)roup
492
+
493
+ Transform-time string validation logic for __merge_string_group(...).
494
+
495
+ Returns:
496
+ * Ok(None), if ALL validation checks (listed below) pass.
497
+ OR
498
+ * Err(CannotTransform), if any of the following are true:
499
+ - The target string group does not contain ANY stand-alone comments.
500
+ - The target string is not in a string group (i.e. it has no
501
+ adjacent strings).
502
+ - The string group has more than one inline comment.
503
+ - The string group has an inline comment that appears to be a pragma.
504
+ - The set of all string prefixes in the string group is of
505
+ length greater than one and is not equal to {"", "f"}.
506
+ - The string group consists of raw strings.
507
+ """
508
+ # We first check for "inner" stand-alone comments (i.e. stand-alone
509
+ # comments that have a string leaf before them AND after them).
510
+ for inc in [1, -1]:
511
+ i = string_idx
512
+ found_sa_comment = False
513
+ is_valid_index = is_valid_index_factory(line.leaves)
514
+ while is_valid_index(i) and line.leaves[i].type in [
515
+ token.STRING,
516
+ STANDALONE_COMMENT,
517
+ ]:
518
+ if line.leaves[i].type == STANDALONE_COMMENT:
519
+ found_sa_comment = True
520
+ elif found_sa_comment:
521
+ return TErr(
522
+ "StringMerger does NOT merge string groups which contain "
523
+ "stand-alone comments."
524
+ )
525
+
526
+ i += inc
527
+
528
+ num_of_inline_string_comments = 0
529
+ set_of_prefixes = set()
530
+ num_of_strings = 0
531
+ for leaf in line.leaves[string_idx:]:
532
+ if leaf.type != token.STRING:
533
+ # If the string group is trailed by a comma, we count the
534
+ # comments trailing the comma to be one of the string group's
535
+ # comments.
536
+ if leaf.type == token.COMMA and id(leaf) in line.comments:
537
+ num_of_inline_string_comments += 1
538
+ break
539
+
540
+ if has_triple_quotes(leaf.value):
541
+ return TErr("StringMerger does NOT merge multiline strings.")
542
+
543
+ num_of_strings += 1
544
+ prefix = get_string_prefix(leaf.value)
545
+ if "r" in prefix:
546
+ return TErr("StringMerger does NOT merge raw strings.")
547
+
548
+ set_of_prefixes.add(prefix)
549
+
550
+ if id(leaf) in line.comments:
551
+ num_of_inline_string_comments += 1
552
+ if contains_pragma_comment(line.comments[id(leaf)]):
553
+ return TErr("Cannot merge strings which have pragma comments.")
554
+
555
+ if num_of_strings < 2:
556
+ return TErr(
557
+ f"Not enough strings to merge (num_of_strings={num_of_strings})."
558
+ )
559
+
560
+ if num_of_inline_string_comments > 1:
561
+ return TErr(
562
+ f"Too many inline string comments ({num_of_inline_string_comments})."
563
+ )
564
+
565
+ if len(set_of_prefixes) > 1 and set_of_prefixes != {"", "f"}:
566
+ return TErr(f"Too many different prefixes ({set_of_prefixes}).")
567
+
568
+ return Ok(None)
569
+
570
+
571
+ class StringParenStripper(StringTransformer):
572
+ """StringTransformer that strips surrounding parentheses from strings.
573
+
574
+ Requirements:
575
+ The line contains a string which is surrounded by parentheses and:
576
+ - The target string is NOT the only argument to a function call.
577
+ - The target string is NOT a "pointless" string.
578
+ - If the target string contains a PERCENT, the brackets are not
579
+ preceded or followed by an operator with higher precedence than
580
+ PERCENT.
581
+
582
+ Transformations:
583
+ The parentheses mentioned in the 'Requirements' section are stripped.
584
+
585
+ Collaborations:
586
+ StringParenStripper has its own inherent usefulness, but it is also
587
+ relied on to clean up the parentheses created by StringParenWrapper (in
588
+ the event that they are no longer needed).
589
+ """
590
+
591
+ def do_match(self, line: Line) -> TMatchResult:
592
+ LL = line.leaves
593
+
594
+ is_valid_index = is_valid_index_factory(LL)
595
+
596
+ for (idx, leaf) in enumerate(LL):
597
+ # Should be a string...
598
+ if leaf.type != token.STRING:
599
+ continue
600
+
601
+ # If this is a "pointless" string...
602
+ if (
603
+ leaf.parent
604
+ and leaf.parent.parent
605
+ and leaf.parent.parent.type == syms.simple_stmt
606
+ ):
607
+ continue
608
+
609
+ # Should be preceded by a non-empty LPAR...
610
+ if (
611
+ not is_valid_index(idx - 1)
612
+ or LL[idx - 1].type != token.LPAR
613
+ or is_empty_lpar(LL[idx - 1])
614
+ ):
615
+ continue
616
+
617
+ # That LPAR should NOT be preceded by a function name or a closing
618
+ # bracket (which could be a function which returns a function or a
619
+ # list/dictionary that contains a function)...
620
+ if is_valid_index(idx - 2) and (
621
+ LL[idx - 2].type == token.NAME or LL[idx - 2].type in CLOSING_BRACKETS
622
+ ):
623
+ continue
624
+
625
+ string_idx = idx
626
+
627
+ # Skip the string trailer, if one exists.
628
+ string_parser = StringParser()
629
+ next_idx = string_parser.parse(LL, string_idx)
630
+
631
+ # if the leaves in the parsed string include a PERCENT, we need to
632
+ # make sure the initial LPAR is NOT preceded by an operator with
633
+ # higher or equal precedence to PERCENT
634
+ if is_valid_index(idx - 2):
635
+ # mypy can't quite follow unless we name this
636
+ before_lpar = LL[idx - 2]
637
+ if token.PERCENT in {leaf.type for leaf in LL[idx - 1 : next_idx]} and (
638
+ (
639
+ before_lpar.type
640
+ in {
641
+ token.STAR,
642
+ token.AT,
643
+ token.SLASH,
644
+ token.DOUBLESLASH,
645
+ token.PERCENT,
646
+ token.TILDE,
647
+ token.DOUBLESTAR,
648
+ token.AWAIT,
649
+ token.LSQB,
650
+ token.LPAR,
651
+ }
652
+ )
653
+ or (
654
+ # only unary PLUS/MINUS
655
+ before_lpar.parent
656
+ and before_lpar.parent.type == syms.factor
657
+ and (before_lpar.type in {token.PLUS, token.MINUS})
658
+ )
659
+ ):
660
+ continue
661
+
662
+ # Should be followed by a non-empty RPAR...
663
+ if (
664
+ is_valid_index(next_idx)
665
+ and LL[next_idx].type == token.RPAR
666
+ and not is_empty_rpar(LL[next_idx])
667
+ ):
668
+ # That RPAR should NOT be followed by anything with higher
669
+ # precedence than PERCENT
670
+ if is_valid_index(next_idx + 1) and LL[next_idx + 1].type in {
671
+ token.DOUBLESTAR,
672
+ token.LSQB,
673
+ token.LPAR,
674
+ token.DOT,
675
+ }:
676
+ continue
677
+
678
+ return Ok(string_idx)
679
+
680
+ return TErr("This line has no strings wrapped in parens.")
681
+
682
+ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]:
683
+ LL = line.leaves
684
+
685
+ string_parser = StringParser()
686
+ rpar_idx = string_parser.parse(LL, string_idx)
687
+
688
+ for leaf in (LL[string_idx - 1], LL[rpar_idx]):
689
+ if line.comments_after(leaf):
690
+ yield TErr(
691
+ "Will not strip parentheses which have comments attached to them."
692
+ )
693
+ return
694
+
695
+ new_line = line.clone()
696
+ new_line.comments = line.comments.copy()
697
+ try:
698
+ append_leaves(new_line, line, LL[: string_idx - 1])
699
+ except BracketMatchError:
700
+ # HACK: I believe there is currently a bug somewhere in
701
+ # right_hand_split() that is causing brackets to not be tracked
702
+ # properly by a shared BracketTracker.
703
+ append_leaves(new_line, line, LL[: string_idx - 1], preformatted=True)
704
+
705
+ string_leaf = Leaf(token.STRING, LL[string_idx].value)
706
+ LL[string_idx - 1].remove()
707
+ replace_child(LL[string_idx], string_leaf)
708
+ new_line.append(string_leaf)
709
+
710
+ append_leaves(
711
+ new_line, line, LL[string_idx + 1 : rpar_idx] + LL[rpar_idx + 1 :]
712
+ )
713
+
714
+ LL[rpar_idx].remove()
715
+
716
+ yield Ok(new_line)
717
+
718
+
719
+ class BaseStringSplitter(StringTransformer):
720
+ """
721
+ Abstract class for StringTransformers which transform a Line's strings by splitting
722
+ them or placing them on their own lines where necessary to avoid going over
723
+ the configured line length.
724
+
725
+ Requirements:
726
+ * The target string value is responsible for the line going over the
727
+ line length limit. It follows that after all of black's other line
728
+ split methods have been exhausted, this line (or one of the resulting
729
+ lines after all line splits are performed) would still be over the
730
+ line_length limit unless we split this string.
731
+ AND
732
+ * The target string is NOT a "pointless" string (i.e. a string that has
733
+ no parent or siblings).
734
+ AND
735
+ * The target string is not followed by an inline comment that appears
736
+ to be a pragma.
737
+ AND
738
+ * The target string is not a multiline (i.e. triple-quote) string.
739
+ """
740
+
741
+ @abstractmethod
742
+ def do_splitter_match(self, line: Line) -> TMatchResult:
743
+ """
744
+ BaseStringSplitter asks its clients to override this method instead of
745
+ `StringTransformer.do_match(...)`.
746
+
747
+ Follows the same protocol as `StringTransformer.do_match(...)`.
748
+
749
+ Refer to `help(StringTransformer.do_match)` for more information.
750
+ """
751
+
752
+ def do_match(self, line: Line) -> TMatchResult:
753
+ match_result = self.do_splitter_match(line)
754
+ if isinstance(match_result, Err):
755
+ return match_result
756
+
757
+ string_idx = match_result.ok()
758
+ vresult = self._validate(line, string_idx)
759
+ if isinstance(vresult, Err):
760
+ return vresult
761
+
762
+ return match_result
763
+
764
+ def _validate(self, line: Line, string_idx: int) -> TResult[None]:
765
+ """
766
+ Checks that @line meets all of the requirements listed in this classes'
767
+ docstring. Refer to `help(BaseStringSplitter)` for a detailed
768
+ description of those requirements.
769
+
770
+ Returns:
771
+ * Ok(None), if ALL of the requirements are met.
772
+ OR
773
+ * Err(CannotTransform), if ANY of the requirements are NOT met.
774
+ """
775
+ LL = line.leaves
776
+
777
+ string_leaf = LL[string_idx]
778
+
779
+ max_string_length = self._get_max_string_length(line, string_idx)
780
+ if len(string_leaf.value) <= max_string_length:
781
+ return TErr(
782
+ "The string itself is not what is causing this line to be too long."
783
+ )
784
+
785
+ if not string_leaf.parent or [L.type for L in string_leaf.parent.children] == [
786
+ token.STRING,
787
+ token.NEWLINE,
788
+ ]:
789
+ return TErr(
790
+ f"This string ({string_leaf.value}) appears to be pointless (i.e. has"
791
+ " no parent)."
792
+ )
793
+
794
+ if id(line.leaves[string_idx]) in line.comments and contains_pragma_comment(
795
+ line.comments[id(line.leaves[string_idx])]
796
+ ):
797
+ return TErr(
798
+ "Line appears to end with an inline pragma comment. Splitting the line"
799
+ " could modify the pragma's behavior."
800
+ )
801
+
802
+ if has_triple_quotes(string_leaf.value):
803
+ return TErr("We cannot split multiline strings.")
804
+
805
+ return Ok(None)
806
+
807
+ def _get_max_string_length(self, line: Line, string_idx: int) -> int:
808
+ """
809
+ Calculates the max string length used when attempting to determine
810
+ whether or not the target string is responsible for causing the line to
811
+ go over the line length limit.
812
+
813
+ WARNING: This method is tightly coupled to both StringSplitter and
814
+ (especially) StringParenWrapper. There is probably a better way to
815
+ accomplish what is being done here.
816
+
817
+ Returns:
818
+ max_string_length: such that `line.leaves[string_idx].value >
819
+ max_string_length` implies that the target string IS responsible
820
+ for causing this line to exceed the line length limit.
821
+ """
822
+ LL = line.leaves
823
+
824
+ is_valid_index = is_valid_index_factory(LL)
825
+
826
+ # We use the shorthand "WMA4" in comments to abbreviate "We must
827
+ # account for". When giving examples, we use STRING to mean some/any
828
+ # valid string.
829
+ #
830
+ # Finally, we use the following convenience variables:
831
+ #
832
+ # P: The leaf that is before the target string leaf.
833
+ # N: The leaf that is after the target string leaf.
834
+ # NN: The leaf that is after N.
835
+
836
+ # WMA4 the whitespace at the beginning of the line.
837
+ offset = line.depth * 4
838
+
839
+ if is_valid_index(string_idx - 1):
840
+ p_idx = string_idx - 1
841
+ if (
842
+ LL[string_idx - 1].type == token.LPAR
843
+ and LL[string_idx - 1].value == ""
844
+ and string_idx >= 2
845
+ ):
846
+ # If the previous leaf is an empty LPAR placeholder, we should skip it.
847
+ p_idx -= 1
848
+
849
+ P = LL[p_idx]
850
+ if P.type == token.PLUS:
851
+ # WMA4 a space and a '+' character (e.g. `+ STRING`).
852
+ offset += 2
853
+
854
+ if P.type == token.COMMA:
855
+ # WMA4 a space, a comma, and a closing bracket [e.g. `), STRING`].
856
+ offset += 3
857
+
858
+ if P.type in [token.COLON, token.EQUAL, token.NAME]:
859
+ # This conditional branch is meant to handle dictionary keys,
860
+ # variable assignments, 'return STRING' statement lines, and
861
+ # 'else STRING' ternary expression lines.
862
+
863
+ # WMA4 a single space.
864
+ offset += 1
865
+
866
+ # WMA4 the lengths of any leaves that came before that space,
867
+ # but after any closing bracket before that space.
868
+ for leaf in reversed(LL[: p_idx + 1]):
869
+ offset += len(str(leaf))
870
+ if leaf.type in CLOSING_BRACKETS:
871
+ break
872
+
873
+ if is_valid_index(string_idx + 1):
874
+ N = LL[string_idx + 1]
875
+ if N.type == token.RPAR and N.value == "" and len(LL) > string_idx + 2:
876
+ # If the next leaf is an empty RPAR placeholder, we should skip it.
877
+ N = LL[string_idx + 2]
878
+
879
+ if N.type == token.COMMA:
880
+ # WMA4 a single comma at the end of the string (e.g `STRING,`).
881
+ offset += 1
882
+
883
+ if is_valid_index(string_idx + 2):
884
+ NN = LL[string_idx + 2]
885
+
886
+ if N.type == token.DOT and NN.type == token.NAME:
887
+ # This conditional branch is meant to handle method calls invoked
888
+ # off of a string literal up to and including the LPAR character.
889
+
890
+ # WMA4 the '.' character.
891
+ offset += 1
892
+
893
+ if (
894
+ is_valid_index(string_idx + 3)
895
+ and LL[string_idx + 3].type == token.LPAR
896
+ ):
897
+ # WMA4 the left parenthesis character.
898
+ offset += 1
899
+
900
+ # WMA4 the length of the method's name.
901
+ offset += len(NN.value)
902
+
903
+ has_comments = False
904
+ for comment_leaf in line.comments_after(LL[string_idx]):
905
+ if not has_comments:
906
+ has_comments = True
907
+ # WMA4 two spaces before the '#' character.
908
+ offset += 2
909
+
910
+ # WMA4 the length of the inline comment.
911
+ offset += len(comment_leaf.value)
912
+
913
+ max_string_length = self.line_length - offset
914
+ return max_string_length
915
+
916
+
917
+ class StringSplitter(CustomSplitMapMixin, BaseStringSplitter):
918
+ """
919
+ StringTransformer that splits "atom" strings (i.e. strings which exist on
920
+ lines by themselves).
921
+
922
+ Requirements:
923
+ * The line consists ONLY of a single string (with the exception of a
924
+ '+' symbol which MAY exist at the start of the line), MAYBE a string
925
+ trailer, and MAYBE a trailing comma.
926
+ AND
927
+ * All of the requirements listed in BaseStringSplitter's docstring.
928
+
929
+ Transformations:
930
+ The string mentioned in the 'Requirements' section is split into as
931
+ many substrings as necessary to adhere to the configured line length.
932
+
933
+ In the final set of substrings, no substring should be smaller than
934
+ MIN_SUBSTR_SIZE characters.
935
+
936
+ The string will ONLY be split on spaces (i.e. each new substring should
937
+ start with a space). Note that the string will NOT be split on a space
938
+ which is escaped with a backslash.
939
+
940
+ If the string is an f-string, it will NOT be split in the middle of an
941
+ f-expression (e.g. in f"FooBar: {foo() if x else bar()}", {foo() if x
942
+ else bar()} is an f-expression).
943
+
944
+ If the string that is being split has an associated set of custom split
945
+ records and those custom splits will NOT result in any line going over
946
+ the configured line length, those custom splits are used. Otherwise the
947
+ string is split as late as possible (from left-to-right) while still
948
+ adhering to the transformation rules listed above.
949
+
950
+ Collaborations:
951
+ StringSplitter relies on StringMerger to construct the appropriate
952
+ CustomSplit objects and add them to the custom split map.
953
+ """
954
+
955
+ MIN_SUBSTR_SIZE = 6
956
+ # Matches an "f-expression" (e.g. {var}) that might be found in an f-string.
957
+ RE_FEXPR = r"""
958
+ (?<!\{) (?:\{\{)* \{ (?!\{)
959
+ (?:
960
+ [^\{\}]
961
+ | \{\{
962
+ | \}\}
963
+ | (?R)
964
+ )+?
965
+ (?<!\}) \} (?:\}\})* (?!\})
966
+ """
967
+
968
+ def do_splitter_match(self, line: Line) -> TMatchResult:
969
+ LL = line.leaves
970
+
971
+ is_valid_index = is_valid_index_factory(LL)
972
+
973
+ idx = 0
974
+
975
+ # The first leaf MAY be a '+' symbol...
976
+ if is_valid_index(idx) and LL[idx].type == token.PLUS:
977
+ idx += 1
978
+
979
+ # The next/first leaf MAY be an empty LPAR...
980
+ if is_valid_index(idx) and is_empty_lpar(LL[idx]):
981
+ idx += 1
982
+
983
+ # The next/first leaf MUST be a string...
984
+ if not is_valid_index(idx) or LL[idx].type != token.STRING:
985
+ return TErr("Line does not start with a string.")
986
+
987
+ string_idx = idx
988
+
989
+ # Skip the string trailer, if one exists.
990
+ string_parser = StringParser()
991
+ idx = string_parser.parse(LL, string_idx)
992
+
993
+ # That string MAY be followed by an empty RPAR...
994
+ if is_valid_index(idx) and is_empty_rpar(LL[idx]):
995
+ idx += 1
996
+
997
+ # That string / empty RPAR leaf MAY be followed by a comma...
998
+ if is_valid_index(idx) and LL[idx].type == token.COMMA:
999
+ idx += 1
1000
+
1001
+ # But no more leaves are allowed...
1002
+ if is_valid_index(idx):
1003
+ return TErr("This line does not end with a string.")
1004
+
1005
+ return Ok(string_idx)
1006
+
1007
+ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]:
1008
+ LL = line.leaves
1009
+
1010
+ QUOTE = LL[string_idx].value[-1]
1011
+
1012
+ is_valid_index = is_valid_index_factory(LL)
1013
+ insert_str_child = insert_str_child_factory(LL[string_idx])
1014
+
1015
+ prefix = get_string_prefix(LL[string_idx].value)
1016
+
1017
+ # We MAY choose to drop the 'f' prefix from substrings that don't
1018
+ # contain any f-expressions, but ONLY if the original f-string
1019
+ # contains at least one f-expression. Otherwise, we will alter the AST
1020
+ # of the program.
1021
+ drop_pointless_f_prefix = ("f" in prefix) and re.search(
1022
+ self.RE_FEXPR, LL[string_idx].value, re.VERBOSE
1023
+ )
1024
+
1025
+ first_string_line = True
1026
+ starts_with_plus = LL[0].type == token.PLUS
1027
+
1028
+ def line_needs_plus() -> bool:
1029
+ return first_string_line and starts_with_plus
1030
+
1031
+ def maybe_append_plus(new_line: Line) -> None:
1032
+ """
1033
+ Side Effects:
1034
+ If @line starts with a plus and this is the first line we are
1035
+ constructing, this function appends a PLUS leaf to @new_line
1036
+ and replaces the old PLUS leaf in the node structure. Otherwise
1037
+ this function does nothing.
1038
+ """
1039
+ if line_needs_plus():
1040
+ plus_leaf = Leaf(token.PLUS, "+")
1041
+ replace_child(LL[0], plus_leaf)
1042
+ new_line.append(plus_leaf)
1043
+
1044
+ ends_with_comma = (
1045
+ is_valid_index(string_idx + 1) and LL[string_idx + 1].type == token.COMMA
1046
+ )
1047
+
1048
+ def max_last_string() -> int:
1049
+ """
1050
+ Returns:
1051
+ The max allowed length of the string value used for the last
1052
+ line we will construct.
1053
+ """
1054
+ result = self.line_length
1055
+ result -= line.depth * 4
1056
+ result -= 1 if ends_with_comma else 0
1057
+ result -= 2 if line_needs_plus() else 0
1058
+ return result
1059
+
1060
+ # --- Calculate Max Break Index (for string value)
1061
+ # We start with the line length limit
1062
+ max_break_idx = self.line_length
1063
+ # The last index of a string of length N is N-1.
1064
+ max_break_idx -= 1
1065
+ # Leading whitespace is not present in the string value (e.g. Leaf.value).
1066
+ max_break_idx -= line.depth * 4
1067
+ if max_break_idx < 0:
1068
+ yield TErr(
1069
+ f"Unable to split {LL[string_idx].value} at such high of a line depth:"
1070
+ f" {line.depth}"
1071
+ )
1072
+ return
1073
+
1074
+ # Check if StringMerger registered any custom splits.
1075
+ custom_splits = self.pop_custom_splits(LL[string_idx].value)
1076
+ # We use them ONLY if none of them would produce lines that exceed the
1077
+ # line limit.
1078
+ use_custom_breakpoints = bool(
1079
+ custom_splits
1080
+ and all(csplit.break_idx <= max_break_idx for csplit in custom_splits)
1081
+ )
1082
+
1083
+ # Temporary storage for the remaining chunk of the string line that
1084
+ # can't fit onto the line currently being constructed.
1085
+ rest_value = LL[string_idx].value
1086
+
1087
+ def more_splits_should_be_made() -> bool:
1088
+ """
1089
+ Returns:
1090
+ True iff `rest_value` (the remaining string value from the last
1091
+ split), should be split again.
1092
+ """
1093
+ if use_custom_breakpoints:
1094
+ return len(custom_splits) > 1
1095
+ else:
1096
+ return len(rest_value) > max_last_string()
1097
+
1098
+ string_line_results: List[Ok[Line]] = []
1099
+ while more_splits_should_be_made():
1100
+ if use_custom_breakpoints:
1101
+ # Custom User Split (manual)
1102
+ csplit = custom_splits.pop(0)
1103
+ break_idx = csplit.break_idx
1104
+ else:
1105
+ # Algorithmic Split (automatic)
1106
+ max_bidx = max_break_idx - 2 if line_needs_plus() else max_break_idx
1107
+ maybe_break_idx = self._get_break_idx(rest_value, max_bidx)
1108
+ if maybe_break_idx is None:
1109
+ # If we are unable to algorithmically determine a good split
1110
+ # and this string has custom splits registered to it, we
1111
+ # fall back to using them--which means we have to start
1112
+ # over from the beginning.
1113
+ if custom_splits:
1114
+ rest_value = LL[string_idx].value
1115
+ string_line_results = []
1116
+ first_string_line = True
1117
+ use_custom_breakpoints = True
1118
+ continue
1119
+
1120
+ # Otherwise, we stop splitting here.
1121
+ break
1122
+
1123
+ break_idx = maybe_break_idx
1124
+
1125
+ # --- Construct `next_value`
1126
+ next_value = rest_value[:break_idx] + QUOTE
1127
+ if (
1128
+ # Are we allowed to try to drop a pointless 'f' prefix?
1129
+ drop_pointless_f_prefix
1130
+ # If we are, will we be successful?
1131
+ and next_value != self._normalize_f_string(next_value, prefix)
1132
+ ):
1133
+ # If the current custom split did NOT originally use a prefix,
1134
+ # then `csplit.break_idx` will be off by one after removing
1135
+ # the 'f' prefix.
1136
+ break_idx = (
1137
+ break_idx + 1
1138
+ if use_custom_breakpoints and not csplit.has_prefix
1139
+ else break_idx
1140
+ )
1141
+ next_value = rest_value[:break_idx] + QUOTE
1142
+ next_value = self._normalize_f_string(next_value, prefix)
1143
+
1144
+ # --- Construct `next_leaf`
1145
+ next_leaf = Leaf(token.STRING, next_value)
1146
+ insert_str_child(next_leaf)
1147
+ self._maybe_normalize_string_quotes(next_leaf)
1148
+
1149
+ # --- Construct `next_line`
1150
+ next_line = line.clone()
1151
+ maybe_append_plus(next_line)
1152
+ next_line.append(next_leaf)
1153
+ string_line_results.append(Ok(next_line))
1154
+
1155
+ rest_value = prefix + QUOTE + rest_value[break_idx:]
1156
+ first_string_line = False
1157
+
1158
+ yield from string_line_results
1159
+
1160
+ if drop_pointless_f_prefix:
1161
+ rest_value = self._normalize_f_string(rest_value, prefix)
1162
+
1163
+ rest_leaf = Leaf(token.STRING, rest_value)
1164
+ insert_str_child(rest_leaf)
1165
+
1166
+ # NOTE: I could not find a test case that verifies that the following
1167
+ # line is actually necessary, but it seems to be. Otherwise we risk
1168
+ # not normalizing the last substring, right?
1169
+ self._maybe_normalize_string_quotes(rest_leaf)
1170
+
1171
+ last_line = line.clone()
1172
+ maybe_append_plus(last_line)
1173
+
1174
+ # If there are any leaves to the right of the target string...
1175
+ if is_valid_index(string_idx + 1):
1176
+ # We use `temp_value` here to determine how long the last line
1177
+ # would be if we were to append all the leaves to the right of the
1178
+ # target string to the last string line.
1179
+ temp_value = rest_value
1180
+ for leaf in LL[string_idx + 1 :]:
1181
+ temp_value += str(leaf)
1182
+ if leaf.type == token.LPAR:
1183
+ break
1184
+
1185
+ # Try to fit them all on the same line with the last substring...
1186
+ if (
1187
+ len(temp_value) <= max_last_string()
1188
+ or LL[string_idx + 1].type == token.COMMA
1189
+ ):
1190
+ last_line.append(rest_leaf)
1191
+ append_leaves(last_line, line, LL[string_idx + 1 :])
1192
+ yield Ok(last_line)
1193
+ # Otherwise, place the last substring on one line and everything
1194
+ # else on a line below that...
1195
+ else:
1196
+ last_line.append(rest_leaf)
1197
+ yield Ok(last_line)
1198
+
1199
+ non_string_line = line.clone()
1200
+ append_leaves(non_string_line, line, LL[string_idx + 1 :])
1201
+ yield Ok(non_string_line)
1202
+ # Else the target string was the last leaf...
1203
+ else:
1204
+ last_line.append(rest_leaf)
1205
+ last_line.comments = line.comments.copy()
1206
+ yield Ok(last_line)
1207
+
1208
+ def _get_break_idx(self, string: str, max_break_idx: int) -> Optional[int]:
1209
+ """
1210
+ This method contains the algorithm that StringSplitter uses to
1211
+ determine which character to split each string at.
1212
+
1213
+ Args:
1214
+ @string: The substring that we are attempting to split.
1215
+ @max_break_idx: The ideal break index. We will return this value if it
1216
+ meets all the necessary conditions. In the likely event that it
1217
+ doesn't we will try to find the closest index BELOW @max_break_idx
1218
+ that does. If that fails, we will expand our search by also
1219
+ considering all valid indices ABOVE @max_break_idx.
1220
+
1221
+ Pre-Conditions:
1222
+ * assert_is_leaf_string(@string)
1223
+ * 0 <= @max_break_idx < len(@string)
1224
+
1225
+ Returns:
1226
+ break_idx, if an index is able to be found that meets all of the
1227
+ conditions listed in the 'Transformations' section of this classes'
1228
+ docstring.
1229
+ OR
1230
+ None, otherwise.
1231
+ """
1232
+ is_valid_index = is_valid_index_factory(string)
1233
+
1234
+ assert is_valid_index(max_break_idx)
1235
+ assert_is_leaf_string(string)
1236
+
1237
+ _fexpr_slices: Optional[List[Tuple[Index, Index]]] = None
1238
+
1239
+ def fexpr_slices() -> Iterator[Tuple[Index, Index]]:
1240
+ """
1241
+ Yields:
1242
+ All ranges of @string which, if @string were to be split there,
1243
+ would result in the splitting of an f-expression (which is NOT
1244
+ allowed).
1245
+ """
1246
+ nonlocal _fexpr_slices
1247
+
1248
+ if _fexpr_slices is None:
1249
+ _fexpr_slices = []
1250
+ for match in re.finditer(self.RE_FEXPR, string, re.VERBOSE):
1251
+ _fexpr_slices.append(match.span())
1252
+
1253
+ yield from _fexpr_slices
1254
+
1255
+ is_fstring = "f" in get_string_prefix(string)
1256
+
1257
+ def breaks_fstring_expression(i: Index) -> bool:
1258
+ """
1259
+ Returns:
1260
+ True iff returning @i would result in the splitting of an
1261
+ f-expression (which is NOT allowed).
1262
+ """
1263
+ if not is_fstring:
1264
+ return False
1265
+
1266
+ for (start, end) in fexpr_slices():
1267
+ if start <= i < end:
1268
+ return True
1269
+
1270
+ return False
1271
+
1272
+ def passes_all_checks(i: Index) -> bool:
1273
+ """
1274
+ Returns:
1275
+ True iff ALL of the conditions listed in the 'Transformations'
1276
+ section of this classes' docstring would be be met by returning @i.
1277
+ """
1278
+ is_space = string[i] == " "
1279
+
1280
+ is_not_escaped = True
1281
+ j = i - 1
1282
+ while is_valid_index(j) and string[j] == "\\":
1283
+ is_not_escaped = not is_not_escaped
1284
+ j -= 1
1285
+
1286
+ is_big_enough = (
1287
+ len(string[i:]) >= self.MIN_SUBSTR_SIZE
1288
+ and len(string[:i]) >= self.MIN_SUBSTR_SIZE
1289
+ )
1290
+ return (
1291
+ is_space
1292
+ and is_not_escaped
1293
+ and is_big_enough
1294
+ and not breaks_fstring_expression(i)
1295
+ )
1296
+
1297
+ # First, we check all indices BELOW @max_break_idx.
1298
+ break_idx = max_break_idx
1299
+ while is_valid_index(break_idx - 1) and not passes_all_checks(break_idx):
1300
+ break_idx -= 1
1301
+
1302
+ if not passes_all_checks(break_idx):
1303
+ # If that fails, we check all indices ABOVE @max_break_idx.
1304
+ #
1305
+ # If we are able to find a valid index here, the next line is going
1306
+ # to be longer than the specified line length, but it's probably
1307
+ # better than doing nothing at all.
1308
+ break_idx = max_break_idx + 1
1309
+ while is_valid_index(break_idx + 1) and not passes_all_checks(break_idx):
1310
+ break_idx += 1
1311
+
1312
+ if not is_valid_index(break_idx) or not passes_all_checks(break_idx):
1313
+ return None
1314
+
1315
+ return break_idx
1316
+
1317
+ def _maybe_normalize_string_quotes(self, leaf: Leaf) -> None:
1318
+ if self.normalize_strings:
1319
+ leaf.value = normalize_string_quotes(leaf.value)
1320
+
1321
+ def _normalize_f_string(self, string: str, prefix: str) -> str:
1322
+ """
1323
+ Pre-Conditions:
1324
+ * assert_is_leaf_string(@string)
1325
+
1326
+ Returns:
1327
+ * If @string is an f-string that contains no f-expressions, we
1328
+ return a string identical to @string except that the 'f' prefix
1329
+ has been stripped and all double braces (i.e. '{{' or '}}') have
1330
+ been normalized (i.e. turned into '{' or '}').
1331
+ OR
1332
+ * Otherwise, we return @string.
1333
+ """
1334
+ assert_is_leaf_string(string)
1335
+
1336
+ if "f" in prefix and not re.search(self.RE_FEXPR, string, re.VERBOSE):
1337
+ new_prefix = prefix.replace("f", "")
1338
+
1339
+ temp = string[len(prefix) :]
1340
+ temp = re.sub(r"\{\{", "{", temp)
1341
+ temp = re.sub(r"\}\}", "}", temp)
1342
+ new_string = temp
1343
+
1344
+ return f"{new_prefix}{new_string}"
1345
+ else:
1346
+ return string
1347
+
1348
+
1349
+ class StringParenWrapper(CustomSplitMapMixin, BaseStringSplitter):
1350
+ """
1351
+ StringTransformer that splits non-"atom" strings (i.e. strings that do not
1352
+ exist on lines by themselves).
1353
+
1354
+ Requirements:
1355
+ All of the requirements listed in BaseStringSplitter's docstring in
1356
+ addition to the requirements listed below:
1357
+
1358
+ * The line is a return/yield statement, which returns/yields a string.
1359
+ OR
1360
+ * The line is part of a ternary expression (e.g. `x = y if cond else
1361
+ z`) such that the line starts with `else <string>`, where <string> is
1362
+ some string.
1363
+ OR
1364
+ * The line is an assert statement, which ends with a string.
1365
+ OR
1366
+ * The line is an assignment statement (e.g. `x = <string>` or `x +=
1367
+ <string>`) such that the variable is being assigned the value of some
1368
+ string.
1369
+ OR
1370
+ * The line is a dictionary key assignment where some valid key is being
1371
+ assigned the value of some string.
1372
+
1373
+ Transformations:
1374
+ The chosen string is wrapped in parentheses and then split at the LPAR.
1375
+
1376
+ We then have one line which ends with an LPAR and another line that
1377
+ starts with the chosen string. The latter line is then split again at
1378
+ the RPAR. This results in the RPAR (and possibly a trailing comma)
1379
+ being placed on its own line.
1380
+
1381
+ NOTE: If any leaves exist to the right of the chosen string (except
1382
+ for a trailing comma, which would be placed after the RPAR), those
1383
+ leaves are placed inside the parentheses. In effect, the chosen
1384
+ string is not necessarily being "wrapped" by parentheses. We can,
1385
+ however, count on the LPAR being placed directly before the chosen
1386
+ string.
1387
+
1388
+ In other words, StringParenWrapper creates "atom" strings. These
1389
+ can then be split again by StringSplitter, if necessary.
1390
+
1391
+ Collaborations:
1392
+ In the event that a string line split by StringParenWrapper is
1393
+ changed such that it no longer needs to be given its own line,
1394
+ StringParenWrapper relies on StringParenStripper to clean up the
1395
+ parentheses it created.
1396
+ """
1397
+
1398
+ def do_splitter_match(self, line: Line) -> TMatchResult:
1399
+ LL = line.leaves
1400
+
1401
+ string_idx = (
1402
+ self._return_match(LL)
1403
+ or self._else_match(LL)
1404
+ or self._assert_match(LL)
1405
+ or self._assign_match(LL)
1406
+ or self._dict_match(LL)
1407
+ )
1408
+
1409
+ if string_idx is not None:
1410
+ string_value = line.leaves[string_idx].value
1411
+ # If the string has no spaces...
1412
+ if " " not in string_value:
1413
+ # And will still violate the line length limit when split...
1414
+ max_string_length = self.line_length - ((line.depth + 1) * 4)
1415
+ if len(string_value) > max_string_length:
1416
+ # And has no associated custom splits...
1417
+ if not self.has_custom_splits(string_value):
1418
+ # Then we should NOT put this string on its own line.
1419
+ return TErr(
1420
+ "We do not wrap long strings in parentheses when the"
1421
+ " resultant line would still be over the specified line"
1422
+ " length and can't be split further by StringSplitter."
1423
+ )
1424
+ return Ok(string_idx)
1425
+
1426
+ return TErr("This line does not contain any non-atomic strings.")
1427
+
1428
+ @staticmethod
1429
+ def _return_match(LL: List[Leaf]) -> Optional[int]:
1430
+ """
1431
+ Returns:
1432
+ string_idx such that @LL[string_idx] is equal to our target (i.e.
1433
+ matched) string, if this line matches the return/yield statement
1434
+ requirements listed in the 'Requirements' section of this classes'
1435
+ docstring.
1436
+ OR
1437
+ None, otherwise.
1438
+ """
1439
+ # If this line is apart of a return/yield statement and the first leaf
1440
+ # contains either the "return" or "yield" keywords...
1441
+ if parent_type(LL[0]) in [syms.return_stmt, syms.yield_expr] and LL[
1442
+ 0
1443
+ ].value in ["return", "yield"]:
1444
+ is_valid_index = is_valid_index_factory(LL)
1445
+
1446
+ idx = 2 if is_valid_index(1) and is_empty_par(LL[1]) else 1
1447
+ # The next visible leaf MUST contain a string...
1448
+ if is_valid_index(idx) and LL[idx].type == token.STRING:
1449
+ return idx
1450
+
1451
+ return None
1452
+
1453
+ @staticmethod
1454
+ def _else_match(LL: List[Leaf]) -> Optional[int]:
1455
+ """
1456
+ Returns:
1457
+ string_idx such that @LL[string_idx] is equal to our target (i.e.
1458
+ matched) string, if this line matches the ternary expression
1459
+ requirements listed in the 'Requirements' section of this classes'
1460
+ docstring.
1461
+ OR
1462
+ None, otherwise.
1463
+ """
1464
+ # If this line is apart of a ternary expression and the first leaf
1465
+ # contains the "else" keyword...
1466
+ if (
1467
+ parent_type(LL[0]) == syms.test
1468
+ and LL[0].type == token.NAME
1469
+ and LL[0].value == "else"
1470
+ ):
1471
+ is_valid_index = is_valid_index_factory(LL)
1472
+
1473
+ idx = 2 if is_valid_index(1) and is_empty_par(LL[1]) else 1
1474
+ # The next visible leaf MUST contain a string...
1475
+ if is_valid_index(idx) and LL[idx].type == token.STRING:
1476
+ return idx
1477
+
1478
+ return None
1479
+
1480
+ @staticmethod
1481
+ def _assert_match(LL: List[Leaf]) -> Optional[int]:
1482
+ """
1483
+ Returns:
1484
+ string_idx such that @LL[string_idx] is equal to our target (i.e.
1485
+ matched) string, if this line matches the assert statement
1486
+ requirements listed in the 'Requirements' section of this classes'
1487
+ docstring.
1488
+ OR
1489
+ None, otherwise.
1490
+ """
1491
+ # If this line is apart of an assert statement and the first leaf
1492
+ # contains the "assert" keyword...
1493
+ if parent_type(LL[0]) == syms.assert_stmt and LL[0].value == "assert":
1494
+ is_valid_index = is_valid_index_factory(LL)
1495
+
1496
+ for (i, leaf) in enumerate(LL):
1497
+ # We MUST find a comma...
1498
+ if leaf.type == token.COMMA:
1499
+ idx = i + 2 if is_empty_par(LL[i + 1]) else i + 1
1500
+
1501
+ # That comma MUST be followed by a string...
1502
+ if is_valid_index(idx) and LL[idx].type == token.STRING:
1503
+ string_idx = idx
1504
+
1505
+ # Skip the string trailer, if one exists.
1506
+ string_parser = StringParser()
1507
+ idx = string_parser.parse(LL, string_idx)
1508
+
1509
+ # But no more leaves are allowed...
1510
+ if not is_valid_index(idx):
1511
+ return string_idx
1512
+
1513
+ return None
1514
+
1515
+ @staticmethod
1516
+ def _assign_match(LL: List[Leaf]) -> Optional[int]:
1517
+ """
1518
+ Returns:
1519
+ string_idx such that @LL[string_idx] is equal to our target (i.e.
1520
+ matched) string, if this line matches the assignment statement
1521
+ requirements listed in the 'Requirements' section of this classes'
1522
+ docstring.
1523
+ OR
1524
+ None, otherwise.
1525
+ """
1526
+ # If this line is apart of an expression statement or is a function
1527
+ # argument AND the first leaf contains a variable name...
1528
+ if (
1529
+ parent_type(LL[0]) in [syms.expr_stmt, syms.argument, syms.power]
1530
+ and LL[0].type == token.NAME
1531
+ ):
1532
+ is_valid_index = is_valid_index_factory(LL)
1533
+
1534
+ for (i, leaf) in enumerate(LL):
1535
+ # We MUST find either an '=' or '+=' symbol...
1536
+ if leaf.type in [token.EQUAL, token.PLUSEQUAL]:
1537
+ idx = i + 2 if is_empty_par(LL[i + 1]) else i + 1
1538
+
1539
+ # That symbol MUST be followed by a string...
1540
+ if is_valid_index(idx) and LL[idx].type == token.STRING:
1541
+ string_idx = idx
1542
+
1543
+ # Skip the string trailer, if one exists.
1544
+ string_parser = StringParser()
1545
+ idx = string_parser.parse(LL, string_idx)
1546
+
1547
+ # The next leaf MAY be a comma iff this line is apart
1548
+ # of a function argument...
1549
+ if (
1550
+ parent_type(LL[0]) == syms.argument
1551
+ and is_valid_index(idx)
1552
+ and LL[idx].type == token.COMMA
1553
+ ):
1554
+ idx += 1
1555
+
1556
+ # But no more leaves are allowed...
1557
+ if not is_valid_index(idx):
1558
+ return string_idx
1559
+
1560
+ return None
1561
+
1562
+ @staticmethod
1563
+ def _dict_match(LL: List[Leaf]) -> Optional[int]:
1564
+ """
1565
+ Returns:
1566
+ string_idx such that @LL[string_idx] is equal to our target (i.e.
1567
+ matched) string, if this line matches the dictionary key assignment
1568
+ statement requirements listed in the 'Requirements' section of this
1569
+ classes' docstring.
1570
+ OR
1571
+ None, otherwise.
1572
+ """
1573
+ # If this line is apart of a dictionary key assignment...
1574
+ if syms.dictsetmaker in [parent_type(LL[0]), parent_type(LL[0].parent)]:
1575
+ is_valid_index = is_valid_index_factory(LL)
1576
+
1577
+ for (i, leaf) in enumerate(LL):
1578
+ # We MUST find a colon...
1579
+ if leaf.type == token.COLON:
1580
+ idx = i + 2 if is_empty_par(LL[i + 1]) else i + 1
1581
+
1582
+ # That colon MUST be followed by a string...
1583
+ if is_valid_index(idx) and LL[idx].type == token.STRING:
1584
+ string_idx = idx
1585
+
1586
+ # Skip the string trailer, if one exists.
1587
+ string_parser = StringParser()
1588
+ idx = string_parser.parse(LL, string_idx)
1589
+
1590
+ # That string MAY be followed by a comma...
1591
+ if is_valid_index(idx) and LL[idx].type == token.COMMA:
1592
+ idx += 1
1593
+
1594
+ # But no more leaves are allowed...
1595
+ if not is_valid_index(idx):
1596
+ return string_idx
1597
+
1598
+ return None
1599
+
1600
+ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]:
1601
+ LL = line.leaves
1602
+
1603
+ is_valid_index = is_valid_index_factory(LL)
1604
+ insert_str_child = insert_str_child_factory(LL[string_idx])
1605
+
1606
+ comma_idx = -1
1607
+ ends_with_comma = False
1608
+ if LL[comma_idx].type == token.COMMA:
1609
+ ends_with_comma = True
1610
+
1611
+ leaves_to_steal_comments_from = [LL[string_idx]]
1612
+ if ends_with_comma:
1613
+ leaves_to_steal_comments_from.append(LL[comma_idx])
1614
+
1615
+ # --- First Line
1616
+ first_line = line.clone()
1617
+ left_leaves = LL[:string_idx]
1618
+
1619
+ # We have to remember to account for (possibly invisible) LPAR and RPAR
1620
+ # leaves that already wrapped the target string. If these leaves do
1621
+ # exist, we will replace them with our own LPAR and RPAR leaves.
1622
+ old_parens_exist = False
1623
+ if left_leaves and left_leaves[-1].type == token.LPAR:
1624
+ old_parens_exist = True
1625
+ leaves_to_steal_comments_from.append(left_leaves[-1])
1626
+ left_leaves.pop()
1627
+
1628
+ append_leaves(first_line, line, left_leaves)
1629
+
1630
+ lpar_leaf = Leaf(token.LPAR, "(")
1631
+ if old_parens_exist:
1632
+ replace_child(LL[string_idx - 1], lpar_leaf)
1633
+ else:
1634
+ insert_str_child(lpar_leaf)
1635
+ first_line.append(lpar_leaf)
1636
+
1637
+ # We throw inline comments that were originally to the right of the
1638
+ # target string to the top line. They will now be shown to the right of
1639
+ # the LPAR.
1640
+ for leaf in leaves_to_steal_comments_from:
1641
+ for comment_leaf in line.comments_after(leaf):
1642
+ first_line.append(comment_leaf, preformatted=True)
1643
+
1644
+ yield Ok(first_line)
1645
+
1646
+ # --- Middle (String) Line
1647
+ # We only need to yield one (possibly too long) string line, since the
1648
+ # `StringSplitter` will break it down further if necessary.
1649
+ string_value = LL[string_idx].value
1650
+ string_line = Line(
1651
+ mode=line.mode,
1652
+ depth=line.depth + 1,
1653
+ inside_brackets=True,
1654
+ should_split_rhs=line.should_split_rhs,
1655
+ magic_trailing_comma=line.magic_trailing_comma,
1656
+ )
1657
+ string_leaf = Leaf(token.STRING, string_value)
1658
+ insert_str_child(string_leaf)
1659
+ string_line.append(string_leaf)
1660
+
1661
+ old_rpar_leaf = None
1662
+ if is_valid_index(string_idx + 1):
1663
+ right_leaves = LL[string_idx + 1 :]
1664
+ if ends_with_comma:
1665
+ right_leaves.pop()
1666
+
1667
+ if old_parens_exist:
1668
+ assert (
1669
+ right_leaves and right_leaves[-1].type == token.RPAR
1670
+ ), "Apparently, old parentheses do NOT exist?!"
1671
+ old_rpar_leaf = right_leaves.pop()
1672
+
1673
+ append_leaves(string_line, line, right_leaves)
1674
+
1675
+ yield Ok(string_line)
1676
+
1677
+ # --- Last Line
1678
+ last_line = line.clone()
1679
+ last_line.bracket_tracker = first_line.bracket_tracker
1680
+
1681
+ new_rpar_leaf = Leaf(token.RPAR, ")")
1682
+ if old_rpar_leaf is not None:
1683
+ replace_child(old_rpar_leaf, new_rpar_leaf)
1684
+ else:
1685
+ insert_str_child(new_rpar_leaf)
1686
+ last_line.append(new_rpar_leaf)
1687
+
1688
+ # If the target string ended with a comma, we place this comma to the
1689
+ # right of the RPAR on the last line.
1690
+ if ends_with_comma:
1691
+ comma_leaf = Leaf(token.COMMA, ",")
1692
+ replace_child(LL[comma_idx], comma_leaf)
1693
+ last_line.append(comma_leaf)
1694
+
1695
+ yield Ok(last_line)
1696
+
1697
+
1698
+ class StringParser:
1699
+ """
1700
+ A state machine that aids in parsing a string's "trailer", which can be
1701
+ either non-existent, an old-style formatting sequence (e.g. `% varX` or `%
1702
+ (varX, varY)`), or a method-call / attribute access (e.g. `.format(varX,
1703
+ varY)`).
1704
+
1705
+ NOTE: A new StringParser object MUST be instantiated for each string
1706
+ trailer we need to parse.
1707
+
1708
+ Examples:
1709
+ We shall assume that `line` equals the `Line` object that corresponds
1710
+ to the following line of python code:
1711
+ ```
1712
+ x = "Some {}.".format("String") + some_other_string
1713
+ ```
1714
+
1715
+ Furthermore, we will assume that `string_idx` is some index such that:
1716
+ ```
1717
+ assert line.leaves[string_idx].value == "Some {}."
1718
+ ```
1719
+
1720
+ The following code snippet then holds:
1721
+ ```
1722
+ string_parser = StringParser()
1723
+ idx = string_parser.parse(line.leaves, string_idx)
1724
+ assert line.leaves[idx].type == token.PLUS
1725
+ ```
1726
+ """
1727
+
1728
+ DEFAULT_TOKEN = -1
1729
+
1730
+ # String Parser States
1731
+ START = 1
1732
+ DOT = 2
1733
+ NAME = 3
1734
+ PERCENT = 4
1735
+ SINGLE_FMT_ARG = 5
1736
+ LPAR = 6
1737
+ RPAR = 7
1738
+ DONE = 8
1739
+
1740
+ # Lookup Table for Next State
1741
+ _goto: Dict[Tuple[ParserState, NodeType], ParserState] = {
1742
+ # A string trailer may start with '.' OR '%'.
1743
+ (START, token.DOT): DOT,
1744
+ (START, token.PERCENT): PERCENT,
1745
+ (START, DEFAULT_TOKEN): DONE,
1746
+ # A '.' MUST be followed by an attribute or method name.
1747
+ (DOT, token.NAME): NAME,
1748
+ # A method name MUST be followed by an '(', whereas an attribute name
1749
+ # is the last symbol in the string trailer.
1750
+ (NAME, token.LPAR): LPAR,
1751
+ (NAME, DEFAULT_TOKEN): DONE,
1752
+ # A '%' symbol can be followed by an '(' or a single argument (e.g. a
1753
+ # string or variable name).
1754
+ (PERCENT, token.LPAR): LPAR,
1755
+ (PERCENT, DEFAULT_TOKEN): SINGLE_FMT_ARG,
1756
+ # If a '%' symbol is followed by a single argument, that argument is
1757
+ # the last leaf in the string trailer.
1758
+ (SINGLE_FMT_ARG, DEFAULT_TOKEN): DONE,
1759
+ # If present, a ')' symbol is the last symbol in a string trailer.
1760
+ # (NOTE: LPARS and nested RPARS are not included in this lookup table,
1761
+ # since they are treated as a special case by the parsing logic in this
1762
+ # classes' implementation.)
1763
+ (RPAR, DEFAULT_TOKEN): DONE,
1764
+ }
1765
+
1766
+ def __init__(self) -> None:
1767
+ self._state = self.START
1768
+ self._unmatched_lpars = 0
1769
+
1770
+ def parse(self, leaves: List[Leaf], string_idx: int) -> int:
1771
+ """
1772
+ Pre-conditions:
1773
+ * @leaves[@string_idx].type == token.STRING
1774
+
1775
+ Returns:
1776
+ The index directly after the last leaf which is apart of the string
1777
+ trailer, if a "trailer" exists.
1778
+ OR
1779
+ @string_idx + 1, if no string "trailer" exists.
1780
+ """
1781
+ assert leaves[string_idx].type == token.STRING
1782
+
1783
+ idx = string_idx + 1
1784
+ while idx < len(leaves) and self._next_state(leaves[idx]):
1785
+ idx += 1
1786
+ return idx
1787
+
1788
+ def _next_state(self, leaf: Leaf) -> bool:
1789
+ """
1790
+ Pre-conditions:
1791
+ * On the first call to this function, @leaf MUST be the leaf that
1792
+ was directly after the string leaf in question (e.g. if our target
1793
+ string is `line.leaves[i]` then the first call to this method must
1794
+ be `line.leaves[i + 1]`).
1795
+ * On the next call to this function, the leaf parameter passed in
1796
+ MUST be the leaf directly following @leaf.
1797
+
1798
+ Returns:
1799
+ True iff @leaf is apart of the string's trailer.
1800
+ """
1801
+ # We ignore empty LPAR or RPAR leaves.
1802
+ if is_empty_par(leaf):
1803
+ return True
1804
+
1805
+ next_token = leaf.type
1806
+ if next_token == token.LPAR:
1807
+ self._unmatched_lpars += 1
1808
+
1809
+ current_state = self._state
1810
+
1811
+ # The LPAR parser state is a special case. We will return True until we
1812
+ # find the matching RPAR token.
1813
+ if current_state == self.LPAR:
1814
+ if next_token == token.RPAR:
1815
+ self._unmatched_lpars -= 1
1816
+ if self._unmatched_lpars == 0:
1817
+ self._state = self.RPAR
1818
+ # Otherwise, we use a lookup table to determine the next state.
1819
+ else:
1820
+ # If the lookup table matches the current state to the next
1821
+ # token, we use the lookup table.
1822
+ if (current_state, next_token) in self._goto:
1823
+ self._state = self._goto[current_state, next_token]
1824
+ else:
1825
+ # Otherwise, we check if a the current state was assigned a
1826
+ # default.
1827
+ if (current_state, self.DEFAULT_TOKEN) in self._goto:
1828
+ self._state = self._goto[current_state, self.DEFAULT_TOKEN]
1829
+ # If no default has been assigned, then this parser has a logic
1830
+ # error.
1831
+ else:
1832
+ raise RuntimeError(f"{self.__class__.__name__} LOGIC ERROR!")
1833
+
1834
+ if self._state == self.DONE:
1835
+ return False
1836
+
1837
+ return True
1838
+
1839
+
1840
+ def insert_str_child_factory(string_leaf: Leaf) -> Callable[[LN], None]:
1841
+ """
1842
+ Factory for a convenience function that is used to orphan @string_leaf
1843
+ and then insert multiple new leaves into the same part of the node
1844
+ structure that @string_leaf had originally occupied.
1845
+
1846
+ Examples:
1847
+ Let `string_leaf = Leaf(token.STRING, '"foo"')` and `N =
1848
+ string_leaf.parent`. Assume the node `N` has the following
1849
+ original structure:
1850
+
1851
+ Node(
1852
+ expr_stmt, [
1853
+ Leaf(NAME, 'x'),
1854
+ Leaf(EQUAL, '='),
1855
+ Leaf(STRING, '"foo"'),
1856
+ ]
1857
+ )
1858
+
1859
+ We then run the code snippet shown below.
1860
+ ```
1861
+ insert_str_child = insert_str_child_factory(string_leaf)
1862
+
1863
+ lpar = Leaf(token.LPAR, '(')
1864
+ insert_str_child(lpar)
1865
+
1866
+ bar = Leaf(token.STRING, '"bar"')
1867
+ insert_str_child(bar)
1868
+
1869
+ rpar = Leaf(token.RPAR, ')')
1870
+ insert_str_child(rpar)
1871
+ ```
1872
+
1873
+ After which point, it follows that `string_leaf.parent is None` and
1874
+ the node `N` now has the following structure:
1875
+
1876
+ Node(
1877
+ expr_stmt, [
1878
+ Leaf(NAME, 'x'),
1879
+ Leaf(EQUAL, '='),
1880
+ Leaf(LPAR, '('),
1881
+ Leaf(STRING, '"bar"'),
1882
+ Leaf(RPAR, ')'),
1883
+ ]
1884
+ )
1885
+ """
1886
+ string_parent = string_leaf.parent
1887
+ string_child_idx = string_leaf.remove()
1888
+
1889
+ def insert_str_child(child: LN) -> None:
1890
+ nonlocal string_child_idx
1891
+
1892
+ assert string_parent is not None
1893
+ assert string_child_idx is not None
1894
+
1895
+ string_parent.insert_child(string_child_idx, child)
1896
+ string_child_idx += 1
1897
+
1898
+ return insert_str_child
1899
+
1900
+
1901
+ def is_valid_index_factory(seq: Sequence[Any]) -> Callable[[int], bool]:
1902
+ """
1903
+ Examples:
1904
+ ```
1905
+ my_list = [1, 2, 3]
1906
+
1907
+ is_valid_index = is_valid_index_factory(my_list)
1908
+
1909
+ assert is_valid_index(0)
1910
+ assert is_valid_index(2)
1911
+
1912
+ assert not is_valid_index(3)
1913
+ assert not is_valid_index(-1)
1914
+ ```
1915
+ """
1916
+
1917
+ def is_valid_index(idx: int) -> bool:
1918
+ """
1919
+ Returns:
1920
+ True iff @idx is positive AND seq[@idx] does NOT raise an
1921
+ IndexError.
1922
+ """
1923
+ return 0 <= idx < len(seq)
1924
+
1925
+ return is_valid_index