PyReprism 0.0.4__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. pyreprism-0.2.0/.flake8 +11 -0
  2. pyreprism-0.2.0/.github/scripts/changelog_notes.py +40 -0
  3. pyreprism-0.2.0/.github/scripts/package_version.py +21 -0
  4. pyreprism-0.2.0/.github/workflows/ci.yml +71 -0
  5. pyreprism-0.2.0/.github/workflows/publish.yml +91 -0
  6. {pyreprism-0.0.4 → pyreprism-0.2.0}/.gitignore +6 -1
  7. pyreprism-0.2.0/.pre-commit-hooks.yaml +27 -0
  8. {pyreprism-0.0.4 → pyreprism-0.2.0}/.readthedocs.yaml +4 -3
  9. pyreprism-0.2.0/CHANGELOG.md +118 -0
  10. {pyreprism-0.0.4 → pyreprism-0.2.0}/CONTRIBUTING.md +6 -1
  11. pyreprism-0.2.0/PKG-INFO +158 -0
  12. pyreprism-0.2.0/README.md +296 -0
  13. pyreprism-0.2.0/RELEASING.md +61 -0
  14. pyreprism-0.2.0/docs/intro.rst +100 -0
  15. pyreprism-0.2.0/pyproject.toml +78 -0
  16. pyreprism-0.2.0/src/PyReprism/__init__.py +383 -0
  17. pyreprism-0.2.0/src/PyReprism/__main__.py +7 -0
  18. pyreprism-0.2.0/src/PyReprism/_tokenops.py +153 -0
  19. pyreprism-0.2.0/src/PyReprism/batch.py +208 -0
  20. pyreprism-0.2.0/src/PyReprism/cli.py +543 -0
  21. pyreprism-0.2.0/src/PyReprism/diffs.py +391 -0
  22. pyreprism-0.2.0/src/PyReprism/engines/__init__.py +34 -0
  23. pyreprism-0.2.0/src/PyReprism/engines/base.py +18 -0
  24. pyreprism-0.2.0/src/PyReprism/engines/pygments_engine.py +108 -0
  25. pyreprism-0.2.0/src/PyReprism/engines/regex_engine.py +14 -0
  26. pyreprism-0.2.0/src/PyReprism/fingerprints.py +145 -0
  27. pyreprism-0.2.0/src/PyReprism/languages/__init__.py +101 -0
  28. pyreprism-0.2.0/src/PyReprism/languages/abap.py +99 -0
  29. pyreprism-0.2.0/src/PyReprism/languages/actionscript.py +82 -0
  30. pyreprism-0.2.0/src/PyReprism/languages/ada.py +80 -0
  31. pyreprism-0.2.0/src/PyReprism/languages/apacheconf.py +102 -0
  32. pyreprism-0.2.0/src/PyReprism/languages/apl.py +67 -0
  33. pyreprism-0.2.0/src/PyReprism/languages/applescript.py +57 -0
  34. pyreprism-0.2.0/src/PyReprism/languages/arduino.py +97 -0
  35. pyreprism-0.2.0/src/PyReprism/languages/arff.py +84 -0
  36. pyreprism-0.2.0/src/PyReprism/languages/asciidoc.py +78 -0
  37. pyreprism-0.2.0/src/PyReprism/languages/asm6502.py +88 -0
  38. pyreprism-0.2.0/src/PyReprism/languages/aspnet.py +97 -0
  39. {pyreprism-0.0.4 → pyreprism-0.2.0}/src/PyReprism/languages/autohotkey.py +26 -29
  40. pyreprism-0.2.0/src/PyReprism/languages/autoit.py +46 -0
  41. pyreprism-0.2.0/src/PyReprism/languages/base.py +361 -0
  42. pyreprism-0.2.0/src/PyReprism/languages/bash.py +39 -0
  43. {pyreprism-0.0.4 → pyreprism-0.2.0}/src/PyReprism/languages/basic.py +31 -40
  44. pyreprism-0.2.0/src/PyReprism/languages/batch.py +40 -0
  45. pyreprism-0.2.0/src/PyReprism/languages/bison.py +43 -0
  46. pyreprism-0.2.0/src/PyReprism/languages/brainfuck.py +42 -0
  47. pyreprism-0.2.0/src/PyReprism/languages/bro.py +44 -0
  48. pyreprism-0.2.0/src/PyReprism/languages/c.py +64 -0
  49. pyreprism-0.2.0/src/PyReprism/languages/clike.py +39 -0
  50. pyreprism-0.2.0/src/PyReprism/languages/clojure.py +50 -0
  51. pyreprism-0.2.0/src/PyReprism/languages/coffeescript.py +40 -0
  52. pyreprism-0.2.0/src/PyReprism/languages/cpp.py +51 -0
  53. pyreprism-0.2.0/src/PyReprism/languages/crystal.py +49 -0
  54. pyreprism-0.2.0/src/PyReprism/languages/csharp.py +53 -0
  55. pyreprism-0.2.0/src/PyReprism/languages/csp.py +45 -0
  56. pyreprism-0.2.0/src/PyReprism/languages/css.py +28 -0
  57. pyreprism-0.2.0/src/PyReprism/languages/css_extras.py +28 -0
  58. pyreprism-0.2.0/src/PyReprism/languages/d.py +54 -0
  59. pyreprism-0.2.0/src/PyReprism/languages/dart.py +55 -0
  60. pyreprism-0.2.0/src/PyReprism/languages/diff.py +42 -0
  61. pyreprism-0.2.0/src/PyReprism/languages/django.py +62 -0
  62. pyreprism-0.2.0/src/PyReprism/languages/docker.py +101 -0
  63. pyreprism-0.2.0/src/PyReprism/languages/eiffel.py +43 -0
  64. pyreprism-0.2.0/src/PyReprism/languages/elixir.py +54 -0
  65. pyreprism-0.2.0/src/PyReprism/languages/erb.py +46 -0
  66. pyreprism-0.2.0/src/PyReprism/languages/erlang.py +55 -0
  67. pyreprism-0.2.0/src/PyReprism/languages/flow.py +30 -0
  68. pyreprism-0.2.0/src/PyReprism/languages/fortran.py +51 -0
  69. pyreprism-0.2.0/src/PyReprism/languages/fsharp.py +52 -0
  70. pyreprism-0.2.0/src/PyReprism/languages/gedcom.py +33 -0
  71. pyreprism-0.2.0/src/PyReprism/languages/gherkin.py +31 -0
  72. pyreprism-0.2.0/src/PyReprism/languages/git.py +32 -0
  73. pyreprism-0.2.0/src/PyReprism/languages/glsl.py +36 -0
  74. pyreprism-0.2.0/src/PyReprism/languages/go.py +47 -0
  75. pyreprism-0.2.0/src/PyReprism/languages/graphql.py +51 -0
  76. pyreprism-0.2.0/src/PyReprism/languages/groovy.py +55 -0
  77. pyreprism-0.2.0/src/PyReprism/languages/haml.py +29 -0
  78. pyreprism-0.2.0/src/PyReprism/languages/handlebars.py +41 -0
  79. pyreprism-0.2.0/src/PyReprism/languages/haskell.py +37 -0
  80. pyreprism-0.2.0/src/PyReprism/languages/haxe.py +57 -0
  81. pyreprism-0.2.0/src/PyReprism/languages/hpkp.py +40 -0
  82. pyreprism-0.2.0/src/PyReprism/languages/hsts.py +40 -0
  83. pyreprism-0.2.0/src/PyReprism/languages/html.py +40 -0
  84. pyreprism-0.2.0/src/PyReprism/languages/ichigojam.py +55 -0
  85. pyreprism-0.2.0/src/PyReprism/languages/icon.py +59 -0
  86. pyreprism-0.2.0/src/PyReprism/languages/inform7.py +83 -0
  87. pyreprism-0.2.0/src/PyReprism/languages/ini.py +39 -0
  88. pyreprism-0.2.0/src/PyReprism/languages/io.py +43 -0
  89. pyreprism-0.2.0/src/PyReprism/languages/j.py +28 -0
  90. pyreprism-0.2.0/src/PyReprism/languages/java.py +101 -0
  91. pyreprism-0.2.0/src/PyReprism/languages/javascript.py +52 -0
  92. pyreprism-0.2.0/src/PyReprism/languages/jolie.py +29 -0
  93. pyreprism-0.2.0/src/PyReprism/languages/json.py +29 -0
  94. pyreprism-0.2.0/src/PyReprism/languages/jsx.py +118 -0
  95. pyreprism-0.2.0/src/PyReprism/languages/julia.py +79 -0
  96. pyreprism-0.2.0/src/PyReprism/languages/keyman.py +69 -0
  97. pyreprism-0.2.0/src/PyReprism/languages/kotlin.py +50 -0
  98. pyreprism-0.2.0/src/PyReprism/languages/latex.py +45 -0
  99. pyreprism-0.2.0/src/PyReprism/languages/less.py +45 -0
  100. pyreprism-0.2.0/src/PyReprism/languages/liquid.py +45 -0
  101. pyreprism-0.2.0/src/PyReprism/languages/livescript.py +45 -0
  102. pyreprism-0.2.0/src/PyReprism/languages/lolcode.py +73 -0
  103. pyreprism-0.2.0/src/PyReprism/languages/lua.py +42 -0
  104. pyreprism-0.2.0/src/PyReprism/languages/makefile.py +31 -0
  105. pyreprism-0.2.0/src/PyReprism/languages/markdown.py +28 -0
  106. pyreprism-0.2.0/src/PyReprism/languages/markup.py +29 -0
  107. pyreprism-0.2.0/src/PyReprism/languages/markup_templating.py +32 -0
  108. pyreprism-0.2.0/src/PyReprism/languages/matlab.py +40 -0
  109. pyreprism-0.2.0/src/PyReprism/languages/mel.py +40 -0
  110. pyreprism-0.2.0/src/PyReprism/languages/mizar.py +32 -0
  111. pyreprism-0.2.0/src/PyReprism/languages/monkey.py +35 -0
  112. pyreprism-0.2.0/src/PyReprism/languages/n4js.py +35 -0
  113. pyreprism-0.2.0/src/PyReprism/languages/nasm.py +44 -0
  114. pyreprism-0.2.0/src/PyReprism/languages/nginx.py +44 -0
  115. pyreprism-0.2.0/src/PyReprism/languages/nim.py +54 -0
  116. pyreprism-0.2.0/src/PyReprism/languages/nix.py +39 -0
  117. pyreprism-0.2.0/src/PyReprism/languages/nsis.py +34 -0
  118. pyreprism-0.2.0/src/PyReprism/languages/objectivec.py +58 -0
  119. pyreprism-0.2.0/src/PyReprism/languages/ocaml.py +34 -0
  120. pyreprism-0.2.0/src/PyReprism/languages/opencl.py +40 -0
  121. pyreprism-0.2.0/src/PyReprism/languages/oz.py +33 -0
  122. pyreprism-0.2.0/src/PyReprism/languages/parigp.py +32 -0
  123. pyreprism-0.2.0/src/PyReprism/languages/parser.py +32 -0
  124. pyreprism-0.2.0/src/PyReprism/languages/pascal.py +49 -0
  125. pyreprism-0.2.0/src/PyReprism/languages/perl.py +70 -0
  126. pyreprism-0.2.0/src/PyReprism/languages/php.py +56 -0
  127. pyreprism-0.2.0/src/PyReprism/languages/php_extras.py +16 -0
  128. pyreprism-0.2.0/src/PyReprism/languages/plsql.py +43 -0
  129. pyreprism-0.2.0/src/PyReprism/languages/powershell.py +33 -0
  130. pyreprism-0.2.0/src/PyReprism/languages/processing.py +40 -0
  131. pyreprism-0.2.0/src/PyReprism/languages/prolog.py +31 -0
  132. pyreprism-0.2.0/src/PyReprism/languages/properties.py +28 -0
  133. pyreprism-0.2.0/src/PyReprism/languages/protobuf.py +40 -0
  134. pyreprism-0.2.0/src/PyReprism/languages/pug.py +31 -0
  135. pyreprism-0.2.0/src/PyReprism/languages/puppet.py +33 -0
  136. pyreprism-0.2.0/src/PyReprism/languages/pure.py +33 -0
  137. pyreprism-0.2.0/src/PyReprism/languages/python.py +97 -0
  138. pyreprism-0.2.0/src/PyReprism/languages/q.py +27 -0
  139. pyreprism-0.2.0/src/PyReprism/languages/qore.py +23 -0
  140. pyreprism-0.2.0/src/PyReprism/languages/r.py +24 -0
  141. pyreprism-0.2.0/src/PyReprism/languages/reason.py +34 -0
  142. pyreprism-0.2.0/src/PyReprism/languages/registry.py +52 -0
  143. pyreprism-0.2.0/src/PyReprism/languages/renpy.py +33 -0
  144. pyreprism-0.2.0/src/PyReprism/languages/rest.py +32 -0
  145. pyreprism-0.2.0/src/PyReprism/languages/rip.py +32 -0
  146. pyreprism-0.2.0/src/PyReprism/languages/roboconf.py +31 -0
  147. pyreprism-0.2.0/src/PyReprism/languages/ruby.py +39 -0
  148. pyreprism-0.2.0/src/PyReprism/languages/rust.py +55 -0
  149. pyreprism-0.2.0/src/PyReprism/languages/sas.py +45 -0
  150. pyreprism-0.2.0/src/PyReprism/languages/sass.py +33 -0
  151. pyreprism-0.2.0/src/PyReprism/languages/scala.py +50 -0
  152. pyreprism-0.2.0/src/PyReprism/languages/scheme.py +52 -0
  153. pyreprism-0.2.0/src/PyReprism/languages/scss.py +31 -0
  154. pyreprism-0.2.0/src/PyReprism/languages/smalltalk.py +61 -0
  155. pyreprism-0.2.0/src/PyReprism/languages/smarty.py +32 -0
  156. pyreprism-0.2.0/src/PyReprism/languages/soy.py +33 -0
  157. pyreprism-0.2.0/src/PyReprism/languages/sql.py +144 -0
  158. pyreprism-0.2.0/src/PyReprism/languages/stylus.py +56 -0
  159. pyreprism-0.2.0/src/PyReprism/languages/swift.py +57 -0
  160. pyreprism-0.2.0/src/PyReprism/languages/tcl.py +40 -0
  161. pyreprism-0.2.0/src/PyReprism/languages/textile.py +42 -0
  162. pyreprism-0.2.0/src/PyReprism/languages/tsx.py +52 -0
  163. pyreprism-0.2.0/src/PyReprism/languages/twig.py +77 -0
  164. pyreprism-0.2.0/src/PyReprism/languages/typescript.py +58 -0
  165. pyreprism-0.2.0/src/PyReprism/languages/vbnet.py +69 -0
  166. pyreprism-0.2.0/src/PyReprism/languages/velocity.py +31 -0
  167. pyreprism-0.2.0/src/PyReprism/languages/verilog.py +94 -0
  168. pyreprism-0.2.0/src/PyReprism/languages/vhdl.py +83 -0
  169. pyreprism-0.2.0/src/PyReprism/languages/vim.py +32 -0
  170. pyreprism-0.2.0/src/PyReprism/languages/visual_basic.py +41 -0
  171. pyreprism-0.2.0/src/PyReprism/languages/wasam.py +96 -0
  172. pyreprism-0.2.0/src/PyReprism/languages/xeora.py +78 -0
  173. pyreprism-0.2.0/src/PyReprism/languages/xojo.py +95 -0
  174. pyreprism-0.2.0/src/PyReprism/languages/yaml.py +28 -0
  175. pyreprism-0.2.0/src/PyReprism/metrics.py +101 -0
  176. pyreprism-0.2.0/src/PyReprism/ngrams.py +169 -0
  177. pyreprism-0.2.0/src/PyReprism/tokens.py +37 -0
  178. {pyreprism-0.0.4 → pyreprism-0.2.0}/src/PyReprism/utils/extension.py +1 -0
  179. {pyreprism-0.0.4 → pyreprism-0.2.0}/src/PyReprism/utils/normalizer.py +1 -2
  180. pyreprism-0.0.4/.flake8 +0 -7
  181. pyreprism-0.0.4/.github/workflows/ci.yml +0 -41
  182. pyreprism-0.0.4/.github/workflows/publish.yml +0 -38
  183. pyreprism-0.0.4/PKG-INFO +0 -98
  184. pyreprism-0.0.4/README.md +0 -96
  185. pyreprism-0.0.4/dev-requirements.txt +0 -9
  186. pyreprism-0.0.4/docs/intro.rst +0 -53
  187. pyreprism-0.0.4/pyproject.toml +0 -47
  188. pyreprism-0.0.4/pytest.ini +0 -4
  189. pyreprism-0.0.4/requirements.txt +0 -3
  190. pyreprism-0.0.4/src/PyReprism/__init__.py +0 -1
  191. pyreprism-0.0.4/src/PyReprism/languages/__init__.py +0 -147
  192. pyreprism-0.0.4/src/PyReprism/languages/abap.py +0 -50
  193. pyreprism-0.0.4/src/PyReprism/languages/actionscript.py +0 -43
  194. pyreprism-0.0.4/src/PyReprism/languages/ada.py +0 -49
  195. pyreprism-0.0.4/src/PyReprism/languages/apacheconf.py +0 -49
  196. pyreprism-0.0.4/src/PyReprism/languages/apl.py +0 -49
  197. pyreprism-0.0.4/src/PyReprism/languages/applescript.py +0 -49
  198. pyreprism-0.0.4/src/PyReprism/languages/arduino.py +0 -49
  199. pyreprism-0.0.4/src/PyReprism/languages/arff.py +0 -49
  200. pyreprism-0.0.4/src/PyReprism/languages/asciidoc.py +0 -49
  201. pyreprism-0.0.4/src/PyReprism/languages/asm6502.py +0 -49
  202. pyreprism-0.0.4/src/PyReprism/languages/aspnet.py +0 -49
  203. pyreprism-0.0.4/src/PyReprism/languages/autoit.py +0 -49
  204. pyreprism-0.0.4/src/PyReprism/languages/bash.py +0 -49
  205. pyreprism-0.0.4/src/PyReprism/languages/batch.py +0 -49
  206. pyreprism-0.0.4/src/PyReprism/languages/bison.py +0 -50
  207. pyreprism-0.0.4/src/PyReprism/languages/brainfuck.py +0 -50
  208. pyreprism-0.0.4/src/PyReprism/languages/bro.py +0 -49
  209. pyreprism-0.0.4/src/PyReprism/languages/c.py +0 -113
  210. pyreprism-0.0.4/src/PyReprism/languages/clike.py +0 -49
  211. pyreprism-0.0.4/src/PyReprism/languages/clojure.py +0 -50
  212. pyreprism-0.0.4/src/PyReprism/languages/coffeescript.py +0 -49
  213. pyreprism-0.0.4/src/PyReprism/languages/cpp.py +0 -113
  214. pyreprism-0.0.4/src/PyReprism/languages/crystal.py +0 -49
  215. pyreprism-0.0.4/src/PyReprism/languages/csharp.py +0 -82
  216. pyreprism-0.0.4/src/PyReprism/languages/csp.py +0 -49
  217. pyreprism-0.0.4/src/PyReprism/languages/css.py +0 -49
  218. pyreprism-0.0.4/src/PyReprism/languages/css_extras.py +0 -49
  219. pyreprism-0.0.4/src/PyReprism/languages/d.py +0 -49
  220. pyreprism-0.0.4/src/PyReprism/languages/dart.py +0 -74
  221. pyreprism-0.0.4/src/PyReprism/languages/diff.py +0 -49
  222. pyreprism-0.0.4/src/PyReprism/languages/django.py +0 -124
  223. pyreprism-0.0.4/src/PyReprism/languages/docker.py +0 -49
  224. pyreprism-0.0.4/src/PyReprism/languages/eiffel.py +0 -49
  225. pyreprism-0.0.4/src/PyReprism/languages/elixir.py +0 -49
  226. pyreprism-0.0.4/src/PyReprism/languages/erlang.py +0 -49
  227. pyreprism-0.0.4/src/PyReprism/languages/flow.py +0 -0
  228. pyreprism-0.0.4/src/PyReprism/languages/fortran.py +0 -49
  229. pyreprism-0.0.4/src/PyReprism/languages/fsharp.py +0 -49
  230. pyreprism-0.0.4/src/PyReprism/languages/gedcom.py +0 -0
  231. pyreprism-0.0.4/src/PyReprism/languages/gherkin.py +0 -0
  232. pyreprism-0.0.4/src/PyReprism/languages/git.py +0 -0
  233. pyreprism-0.0.4/src/PyReprism/languages/glsl.py +0 -0
  234. pyreprism-0.0.4/src/PyReprism/languages/go.py +0 -82
  235. pyreprism-0.0.4/src/PyReprism/languages/graphql.py +0 -49
  236. pyreprism-0.0.4/src/PyReprism/languages/groovy.py +0 -49
  237. pyreprism-0.0.4/src/PyReprism/languages/haml.py +0 -49
  238. pyreprism-0.0.4/src/PyReprism/languages/handlebars.py +0 -0
  239. pyreprism-0.0.4/src/PyReprism/languages/haskell.py +0 -49
  240. pyreprism-0.0.4/src/PyReprism/languages/haxe.py +0 -0
  241. pyreprism-0.0.4/src/PyReprism/languages/hpkp.py +0 -0
  242. pyreprism-0.0.4/src/PyReprism/languages/hsts.py +0 -0
  243. pyreprism-0.0.4/src/PyReprism/languages/html.py +0 -43
  244. pyreprism-0.0.4/src/PyReprism/languages/ichigojam.py +0 -0
  245. pyreprism-0.0.4/src/PyReprism/languages/icon.py +0 -0
  246. pyreprism-0.0.4/src/PyReprism/languages/inform7.py +0 -0
  247. pyreprism-0.0.4/src/PyReprism/languages/ini.py +0 -40
  248. pyreprism-0.0.4/src/PyReprism/languages/io.py +0 -0
  249. pyreprism-0.0.4/src/PyReprism/languages/j.py +0 -49
  250. pyreprism-0.0.4/src/PyReprism/languages/java.py +0 -113
  251. pyreprism-0.0.4/src/PyReprism/languages/javascript.py +0 -122
  252. pyreprism-0.0.4/src/PyReprism/languages/jolie.py +0 -49
  253. pyreprism-0.0.4/src/PyReprism/languages/json.py +0 -49
  254. pyreprism-0.0.4/src/PyReprism/languages/jsx.py +0 -115
  255. pyreprism-0.0.4/src/PyReprism/languages/julia.py +0 -49
  256. pyreprism-0.0.4/src/PyReprism/languages/keyman.py +0 -0
  257. pyreprism-0.0.4/src/PyReprism/languages/kotlin.py +0 -81
  258. pyreprism-0.0.4/src/PyReprism/languages/latex.py +0 -49
  259. pyreprism-0.0.4/src/PyReprism/languages/less.py +0 -49
  260. pyreprism-0.0.4/src/PyReprism/languages/liquid.py +0 -49
  261. pyreprism-0.0.4/src/PyReprism/languages/livescript.py +0 -49
  262. pyreprism-0.0.4/src/PyReprism/languages/lolcode.py +0 -0
  263. pyreprism-0.0.4/src/PyReprism/languages/lua.py +0 -0
  264. pyreprism-0.0.4/src/PyReprism/languages/makefile.py +0 -49
  265. pyreprism-0.0.4/src/PyReprism/languages/markdown.py +0 -30
  266. pyreprism-0.0.4/src/PyReprism/languages/markup.py +0 -49
  267. pyreprism-0.0.4/src/PyReprism/languages/markup_templating.py +0 -0
  268. pyreprism-0.0.4/src/PyReprism/languages/matlab.py +0 -49
  269. pyreprism-0.0.4/src/PyReprism/languages/mel.py +0 -0
  270. pyreprism-0.0.4/src/PyReprism/languages/mizar.py +0 -0
  271. pyreprism-0.0.4/src/PyReprism/languages/monkey.py +0 -0
  272. pyreprism-0.0.4/src/PyReprism/languages/n4js.py +0 -49
  273. pyreprism-0.0.4/src/PyReprism/languages/nasm.py +0 -0
  274. pyreprism-0.0.4/src/PyReprism/languages/nginx.py +0 -49
  275. pyreprism-0.0.4/src/PyReprism/languages/nim.py +0 -0
  276. pyreprism-0.0.4/src/PyReprism/languages/nix.py +0 -0
  277. pyreprism-0.0.4/src/PyReprism/languages/nsis.py +0 -0
  278. pyreprism-0.0.4/src/PyReprism/languages/objectivec.py +0 -49
  279. pyreprism-0.0.4/src/PyReprism/languages/ocaml.py +0 -49
  280. pyreprism-0.0.4/src/PyReprism/languages/opencl.py +0 -0
  281. pyreprism-0.0.4/src/PyReprism/languages/oz.py +0 -0
  282. pyreprism-0.0.4/src/PyReprism/languages/parigp.py +0 -0
  283. pyreprism-0.0.4/src/PyReprism/languages/parser.py +0 -0
  284. pyreprism-0.0.4/src/PyReprism/languages/pascal.py +0 -48
  285. pyreprism-0.0.4/src/PyReprism/languages/perl.py +0 -49
  286. pyreprism-0.0.4/src/PyReprism/languages/php.py +0 -124
  287. pyreprism-0.0.4/src/PyReprism/languages/php_extras.py +0 -0
  288. pyreprism-0.0.4/src/PyReprism/languages/plsql.py +0 -0
  289. pyreprism-0.0.4/src/PyReprism/languages/powershell.py +0 -0
  290. pyreprism-0.0.4/src/PyReprism/languages/processing.py +0 -0
  291. pyreprism-0.0.4/src/PyReprism/languages/prolog.py +0 -49
  292. pyreprism-0.0.4/src/PyReprism/languages/properties.py +0 -0
  293. pyreprism-0.0.4/src/PyReprism/languages/protobuf.py +0 -0
  294. pyreprism-0.0.4/src/PyReprism/languages/pug.py +0 -0
  295. pyreprism-0.0.4/src/PyReprism/languages/puppet.py +0 -0
  296. pyreprism-0.0.4/src/PyReprism/languages/pure.py +0 -0
  297. pyreprism-0.0.4/src/PyReprism/languages/python.py +0 -124
  298. pyreprism-0.0.4/src/PyReprism/languages/q.py +0 -0
  299. pyreprism-0.0.4/src/PyReprism/languages/qore.py +0 -0
  300. pyreprism-0.0.4/src/PyReprism/languages/r.py +0 -0
  301. pyreprism-0.0.4/src/PyReprism/languages/reason.py +0 -0
  302. pyreprism-0.0.4/src/PyReprism/languages/renpy.py +0 -0
  303. pyreprism-0.0.4/src/PyReprism/languages/rest.py +0 -0
  304. pyreprism-0.0.4/src/PyReprism/languages/rip.py +0 -0
  305. pyreprism-0.0.4/src/PyReprism/languages/roboconf.py +0 -0
  306. pyreprism-0.0.4/src/PyReprism/languages/ruby.py +0 -49
  307. pyreprism-0.0.4/src/PyReprism/languages/rust.py +0 -81
  308. pyreprism-0.0.4/src/PyReprism/languages/sas.py +0 -0
  309. pyreprism-0.0.4/src/PyReprism/languages/sass.py +0 -0
  310. pyreprism-0.0.4/src/PyReprism/languages/scala.py +0 -81
  311. pyreprism-0.0.4/src/PyReprism/languages/scheme.py +0 -49
  312. pyreprism-0.0.4/src/PyReprism/languages/scss.py +0 -50
  313. pyreprism-0.0.4/src/PyReprism/languages/smalltalk.py +0 -49
  314. pyreprism-0.0.4/src/PyReprism/languages/smarty.py +0 -0
  315. pyreprism-0.0.4/src/PyReprism/languages/soy.py +0 -0
  316. pyreprism-0.0.4/src/PyReprism/languages/stylus.py +0 -49
  317. pyreprism-0.0.4/src/PyReprism/languages/swift.py +0 -81
  318. pyreprism-0.0.4/src/PyReprism/languages/tcl.py +0 -0
  319. pyreprism-0.0.4/src/PyReprism/languages/textile.py +0 -0
  320. pyreprism-0.0.4/src/PyReprism/languages/tsx.py +0 -49
  321. pyreprism-0.0.4/src/PyReprism/languages/twig.py +0 -0
  322. pyreprism-0.0.4/src/PyReprism/languages/typescript.py +0 -79
  323. pyreprism-0.0.4/src/PyReprism/languages/vbnet.py +0 -74
  324. pyreprism-0.0.4/src/PyReprism/languages/velocity.py +0 -49
  325. pyreprism-0.0.4/src/PyReprism/languages/verilog.py +0 -0
  326. pyreprism-0.0.4/src/PyReprism/languages/vhdl.py +0 -0
  327. pyreprism-0.0.4/src/PyReprism/languages/vim.py +0 -50
  328. pyreprism-0.0.4/src/PyReprism/languages/visual_basic.py +0 -50
  329. pyreprism-0.0.4/src/PyReprism/languages/wasam.py +0 -0
  330. pyreprism-0.0.4/src/PyReprism/languages/xeora.py +0 -0
  331. pyreprism-0.0.4/src/PyReprism/languages/xojo.py +0 -0
  332. pyreprism-0.0.4/src/PyReprism/languages/yaml.py +0 -50
  333. {pyreprism-0.0.4 → pyreprism-0.2.0}/.github/FUNDING.yaml +0 -0
  334. {pyreprism-0.0.4 → pyreprism-0.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  335. {pyreprism-0.0.4 → pyreprism-0.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  336. {pyreprism-0.0.4 → pyreprism-0.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  337. {pyreprism-0.0.4 → pyreprism-0.2.0}/LICENSE +0 -0
  338. {pyreprism-0.0.4 → pyreprism-0.2.0}/codecov.yml +0 -0
  339. /pyreprism-0.0.4/src/PyReprism/languages/erb.py → /pyreprism-0.2.0/src/PyReprism/py.typed +0 -0
  340. {pyreprism-0.0.4 → pyreprism-0.2.0}/src/PyReprism/utils/__init__.py +0 -0
@@ -0,0 +1,11 @@
1
+ [flake8]
2
+ show-source = True
3
+ count = True
4
+ statistics = True
5
+ max-line-length = 120
6
+ # E501: long lines are common in this project's regex/keyword tables.
7
+ # The W1/W2/W3 and E1/E2/E3 codes below are pre-existing whitespace/indentation
8
+ # style debt across the legacy language modules; they are ignored so flake8 can
9
+ # focus on real correctness issues (pyflakes F-codes, undefined names, etc.).
10
+ extend-ignore = E501, W191, W291, W292, W293, W391, E101, E117, E128, E231, E302, E303, E265, E266
11
+ exclude = .git,.github,venv,.venv,build,dist,docs,htmlcov,tests,src/PyReprism/languages/__init__.py,__test__.py
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env python3
2
+ """Print the CHANGELOG.md section for a given version.
3
+
4
+ Usage: ``python .github/scripts/changelog_notes.py 0.2.0``
5
+
6
+ Extracts the body under ``## [0.2.0] ...`` up to the next ``## [`` heading.
7
+ Falls back to a generic line if the version has no changelog section.
8
+ """
9
+ import pathlib
10
+ import re
11
+ import sys
12
+
13
+ CHANGELOG = pathlib.Path("CHANGELOG.md")
14
+
15
+
16
+ def notes_for(version: str, text: str) -> str:
17
+ pattern = re.compile(
18
+ r"^##\s*\[" + re.escape(version) + r"\][^\n]*\n(.*?)(?=^##\s*\[|\Z)",
19
+ re.MULTILINE | re.DOTALL,
20
+ )
21
+ match = pattern.search(text)
22
+ if match:
23
+ body = match.group(1).strip()
24
+ if body:
25
+ return body
26
+ return f"Release {version}."
27
+
28
+
29
+ def main() -> int:
30
+ if len(sys.argv) != 2:
31
+ print("usage: changelog_notes.py <version>", file=sys.stderr)
32
+ return 2
33
+ version = sys.argv[1]
34
+ text = CHANGELOG.read_text(encoding="utf-8") if CHANGELOG.exists() else ""
35
+ print(notes_for(version, text))
36
+ return 0
37
+
38
+
39
+ if __name__ == "__main__":
40
+ raise SystemExit(main())
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ """Print the package version (``__version__`` from the package __init__)."""
3
+ import pathlib
4
+ import re
5
+ import sys
6
+
7
+ INIT = pathlib.Path("src/PyReprism/__init__.py")
8
+
9
+
10
+ def main() -> int:
11
+ match = re.search(r'^__version__\s*=\s*["\']([^"\']+)["\']',
12
+ INIT.read_text(encoding="utf-8"), re.MULTILINE)
13
+ if not match:
14
+ print("could not find __version__ in", INIT, file=sys.stderr)
15
+ return 1
16
+ print(match.group(1))
17
+ return 0
18
+
19
+
20
+ if __name__ == "__main__":
21
+ raise SystemExit(main())
@@ -0,0 +1,71 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ # Least-privilege by default.
9
+ permissions:
10
+ contents: read
11
+
12
+ # Cancel superseded runs on the same ref.
13
+ concurrency:
14
+ group: ci-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ test:
19
+ name: "Lint & test (Python ${{ matrix.python-version }})"
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
25
+ steps:
26
+ - name: Check out the code
27
+ uses: actions/checkout@v4
28
+
29
+ - name: Set up Python ${{ matrix.python-version }}
30
+ uses: actions/setup-python@v5
31
+ with:
32
+ python-version: ${{ matrix.python-version }}
33
+ cache: pip
34
+ cache-dependency-path: pyproject.toml
35
+
36
+ - name: Install dependencies
37
+ run: |
38
+ python -m pip install --upgrade pip
39
+ pip install -e ".[dev]"
40
+
41
+ - name: Lint with flake8
42
+ run: flake8 src/PyReprism
43
+
44
+ - name: Run tests with pytest
45
+ run: pytest --cov=src/PyReprism --cov-report=xml
46
+
47
+ - name: Upload coverage to Codecov
48
+ if: matrix.python-version == '3.12'
49
+ uses: codecov/codecov-action@v5
50
+ with:
51
+ token: ${{ secrets.CODECOV_TOKEN }}
52
+ files: coverage.xml
53
+ fail_ci_if_error: false
54
+
55
+ build:
56
+ name: "Build & check package"
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - name: Check out the code
60
+ uses: actions/checkout@v4
61
+
62
+ - name: Set up Python
63
+ uses: actions/setup-python@v5
64
+ with:
65
+ python-version: '3.12'
66
+
67
+ - name: Build and validate the distribution
68
+ run: |
69
+ python -m pip install --upgrade pip build twine
70
+ python -m build
71
+ twine check dist/*
@@ -0,0 +1,91 @@
1
+ name: Publish 📦 to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: Build distribution
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Check out the code
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: '3.12'
23
+
24
+ - name: Verify the tag matches the package version
25
+ run: |
26
+ PKG_VERSION="$(python .github/scripts/package_version.py)"
27
+ TAG_VERSION="${GITHUB_REF_NAME#v}"
28
+ echo "tag=$TAG_VERSION package=$PKG_VERSION"
29
+ if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
30
+ echo "::error::Tag ($TAG_VERSION) does not match package version ($PKG_VERSION). Bump __version__ in src/PyReprism/__init__.py."
31
+ exit 1
32
+ fi
33
+
34
+ - name: Build and validate the distribution
35
+ run: |
36
+ python -m pip install --upgrade pip build twine
37
+ python -m build
38
+ twine check dist/*
39
+
40
+ - name: Upload build artifacts
41
+ uses: actions/upload-artifact@v4
42
+ with:
43
+ name: dist
44
+ path: dist/
45
+
46
+ publish:
47
+ name: Publish to PyPI
48
+ needs: build
49
+ runs-on: ubuntu-latest
50
+ environment:
51
+ name: pypi
52
+ url: https://pypi.org/project/PyReprism/
53
+ permissions:
54
+ id-token: write # Trusted Publishing (OIDC) — no API token needed.
55
+ steps:
56
+ - name: Download build artifacts
57
+ uses: actions/download-artifact@v4
58
+ with:
59
+ name: dist
60
+ path: dist/
61
+
62
+ - name: Publish distribution to PyPI
63
+ uses: pypa/gh-action-pypi-publish@release/v1
64
+
65
+ github-release:
66
+ name: Create GitHub Release
67
+ needs: publish
68
+ runs-on: ubuntu-latest
69
+ permissions:
70
+ contents: write # required to create a release
71
+ steps:
72
+ - name: Check out the code
73
+ uses: actions/checkout@v4
74
+
75
+ - name: Download build artifacts
76
+ uses: actions/download-artifact@v4
77
+ with:
78
+ name: dist
79
+ path: dist/
80
+
81
+ - name: Extract release notes from CHANGELOG
82
+ run: python .github/scripts/changelog_notes.py "${GITHUB_REF_NAME#v}" > release-notes.md
83
+
84
+ - name: Create GitHub Release
85
+ env:
86
+ GH_TOKEN: ${{ github.token }}
87
+ run: |
88
+ gh release create "$GITHUB_REF_NAME" \
89
+ --title "$GITHUB_REF_NAME" \
90
+ --notes-file release-notes.md \
91
+ dist/*
@@ -163,4 +163,9 @@ cython_debug/
163
163
  #.idea/
164
164
 
165
165
  # others
166
- __test__.py
166
+ __test__.py
167
+
168
+ # macOS
169
+ .DS_Store
170
+ # Claude Code agent workspace
171
+ .claude/
@@ -0,0 +1,27 @@
1
+ # PyReprism pre-commit hooks.
2
+ #
3
+ # Add to your .pre-commit-config.yaml, e.g.:
4
+ #
5
+ # - repo: https://github.com/unlv-evol/PyReprism
6
+ # rev: v0.1.0
7
+ # hooks:
8
+ # - id: pyreprism-strip-comments
9
+ # files: ^generated/ # scope it! these hooks rewrite files
10
+ #
11
+ # NOTE: these hooks modify source in place. Scope them with `files:`/`exclude:`
12
+ # to directories where stripping comments/whitespace is intended (e.g. generated
13
+ # or vendored code), not your whole repository.
14
+
15
+ - id: pyreprism-strip-comments
16
+ name: PyReprism – strip comments
17
+ description: Remove comments in place (language auto-detected from file extension).
18
+ entry: pyreprism remove comments --in-place
19
+ language: python
20
+ types: [text]
21
+
22
+ - id: pyreprism-normalize-whitespace
23
+ name: PyReprism – normalize whitespace
24
+ description: Collapse insignificant whitespace in place.
25
+ entry: pyreprism preprocess --steps whitespace --in-place
26
+ language: python
27
+ types: [text]
@@ -23,9 +23,10 @@ sphinx:
23
23
  # formats:
24
24
  # - pdf
25
25
 
26
- # Optionally declare the Python requirements required to build your docs
26
+ # Install the package together with its documentation extra.
27
27
  python:
28
28
  install:
29
- - requirements: docs/requirements.txt
30
29
  - method: pip
31
- path: .
30
+ path: .
31
+ extra_requirements:
32
+ - docs
@@ -0,0 +1,118 @@
1
+ # Changelog
2
+
3
+ All notable changes to PyReprism are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-07-08
11
+
12
+ This release adds a static code-analysis toolkit on top of the tokenizer:
13
+ diff/PR analysis, complexity metrics, n-gram "naturalness", and clone/plagiarism
14
+ similarity — plus a comprehensive per-language test suite that hardened comment
15
+ handling across the board.
16
+
17
+ ### Added
18
+ - **Fingerprinting & similarity** (`PyReprism.fingerprints`): winnowing k-gram
19
+ fingerprints over the normalized token stream for clone/plagiarism detection —
20
+ `fingerprint()`, `similarity()`/`containment()` (rename-invariant by default),
21
+ and a `FingerprintIndex` for many-to-many detection over a corpus. CLI:
22
+ `pyreprism similarity a b` and `pyreprism clones DIR --threshold`.
23
+ - **N-gram analysis & code naturalness** (`PyReprism.ngrams`): token/type n-gram
24
+ extraction and frequency counts, plus an `NgramModel` (add-k smoothing,
25
+ save/load) that measures cross-entropy / perplexity against a trained corpus
26
+ ("naturalness of software"). CLI: `pyreprism ngrams` and
27
+ `pyreprism perplexity --train`.
28
+ - **Complexity metrics** computed from the token stream: `halstead()`
29
+ (volume/difficulty/effort/bugs), `cyclomatic_complexity()` (approximate McCabe),
30
+ `maintainability_index()` (0–100), `max_nesting_depth()`, and `code_metrics()`
31
+ which bundles them with the line/token stats. Exposed on the CLI via
32
+ `pyreprism stats --full`.
33
+ - **Diff processing** (`PyReprism.diffs`): parse unified/`git` diffs and analyze
34
+ the changed code per file in its own language. Includes churn metrics
35
+ (`diff_stats`: added/removed split into code, comment and blank), cosmetic
36
+ (comment/whitespace-only) change detection, reconstruction of the added/removed
37
+ code, and ML-oriented `tokenize`/`normalize`/`extract_comments` on changes.
38
+ Fragment mode works from the diff alone; setting a file's `new_source` /
39
+ `old_source` enables accurate full-file classification. New CLI command
40
+ `pyreprism diff` (`--json` / `--csv` / `--per-file` / `--cosmetic`).
41
+
42
+ ### Changed
43
+ - Adopted the standard `src/` layout with tests at the top level, consolidated
44
+ all dependencies into `pyproject.toml` extras, and rewrote the landing page.
45
+ - Single-sourced the version from the package and automated releases: pushing a
46
+ `vX.Y.Z` tag now publishes to PyPI (Trusted Publishing) and creates a GitHub
47
+ Release. Added Python 3.13 to the CI matrix.
48
+ - Added a comprehensive, data-driven per-language comment test suite that
49
+ requires every registered language to be covered.
50
+
51
+ ### Fixed
52
+ - Fixed comment stripping in 8 more languages surfaced by the new test suite:
53
+ `smalltalk` (kept the comment and deleted the code) and
54
+ `eiffel`/`bro`/`coffeescript`/`io`/`nix`/`gherkin`/`gedcom` (trailing comments
55
+ not removed and newlines dropped).
56
+ - Fixed a CLI argument-ordering incompatibility on Python ≤ 3.11 (options must
57
+ follow positionals).
58
+
59
+ ## [0.1.0] - 2026-07-07
60
+
61
+ This release turns PyReprism from a comment-removal helper into a full
62
+ source-preprocessing toolkit with a high-level API, a CLI, code metrics,
63
+ ML-oriented normalization, an optional accurate backend, and batch processing.
64
+
65
+ ### Added
66
+ - **High-level API** (`import PyReprism as pr`): `remove_*`, `extract_*`,
67
+ `count_*`, `match_*` for comments, keywords, numbers, operators, strings and
68
+ identifiers; plus `preprocess`, `remove_whitespaces`, `get_language` and
69
+ `detect_language`. `lang=` accepts a language name, file extension, or class.
70
+ - **Tokenizer**: `tokenize()` on every language returns a lossless, typed
71
+ `Token` stream (`Token`/`TokenType` in `PyReprism.tokens`).
72
+ - **Code metrics**: `stats()` returns a `CodeStats` (line/token counts,
73
+ comment-to-code ratio, comment density; `as_dict()` for JSON/dataframes).
74
+ - **ML normalization**: `normalize()` canonicalizes code (rename identifiers to
75
+ `VAR1…`, mask string/number literals, drop comments) for clone/plagiarism
76
+ detection and code-embedding pipelines; `blank_comments()` strips comments
77
+ while preserving line numbers.
78
+ - **Pluggable backends**: `engine="regex"` (default, zero-dependency) or
79
+ `engine="pygments"` (`pip install pyreprism[accurate]`) for higher accuracy,
80
+ plus `"auto"`. Available on every operation.
81
+ - **Batch processing** (`PyReprism.batch`): `analyze()` walks a directory tree
82
+ and returns an aggregate report (`to_json`/`to_csv`, per-language breakdown);
83
+ `transform()` bulk-applies a transformation into a mirrored output directory.
84
+ - **Command-line interface** (`pyreprism`, also `python -m PyReprism`):
85
+ `remove`, `extract`, `count`, `preprocess`, `tokenize`, `stats`, `normalize`,
86
+ `scan`, and `languages`; reads stdin/files/globs/directories; supports
87
+ `--lang`, `--engine`, `--in-place`, `--output`, and `--json`/`--csv`.
88
+ - **Source-based language detection**: `detect_language(source=...)` recognizes
89
+ `#!` shebangs and (when Pygments is installed) makes a best-effort content
90
+ guess; the CLI uses this to auto-detect the language of piped input.
91
+ - Pre-commit hooks (`.pre-commit-hooks.yaml`), a `py.typed` marker (PEP 561),
92
+ and a registry-wide test suite covering all supported languages.
93
+
94
+ ### Changed
95
+ - Implemented real support for 25 previously-empty language stubs and migrated
96
+ 22 legacy languages (HTML, JSON, YAML, CSS, Markdown, …) to the
97
+ `BaseLanguage` + registry pattern, making them importable via the public API.
98
+ - Ambiguous file extensions now resolve to a canonical language
99
+ (`.py` → Python, `.js` → JavaScript, …).
100
+ - Consolidated packaging into `pyproject.toml` (single version source, pytest
101
+ and coverage config), updated CI to a Python 3.8–3.12 matrix, and refreshed
102
+ the README.
103
+
104
+ ### Fixed
105
+ - Corrected comment-stripping for ~30 languages whose regexes either failed to
106
+ remove line comments or consumed surrounding code, and fixed duplicate/broken
107
+ definitions (Perl, csp, glsl, django, apacheconf, php_extras, ruby, and the
108
+ Python triple-quoted-docstring bug).
109
+
110
+ ## [0.0.4] - 2024
111
+
112
+ - Early beta releases: comment removal for an initial set of languages and the
113
+ `Normalizer` whitespace helper.
114
+
115
+ [Unreleased]: https://github.com/unlv-evol/PyReprism/compare/v0.2.0...HEAD
116
+ [0.2.0]: https://github.com/unlv-evol/PyReprism/compare/v0.1.0...v0.2.0
117
+ [0.1.0]: https://github.com/unlv-evol/PyReprism/releases/tag/v0.1.0
118
+ [0.0.4]: https://github.com/unlv-evol/PyReprism/releases/tag/v0.0.4
@@ -62,4 +62,9 @@ When you're finished with the changes, create a pull request, also known as a PR
62
62
  ### Your PR is merged!
63
63
 
64
64
  Congratulations :tada: :tada: <br />
65
- The PyReprism team thanks you :sparkles:.
65
+ The PyReprism team thanks you :sparkles:.
66
+
67
+ ## Maintainers: cutting a release
68
+
69
+ Releases are automated by pushing a `vX.Y.Z` tag. See [RELEASING.md](RELEASING.md)
70
+ for the full process.
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyReprism
3
+ Version: 0.2.0
4
+ Summary: Framework for Source Code Preprocessing
5
+ Project-URL: Homepage, https://github.com/unlv-evol/PyReprism
6
+ Project-URL: Documentation, https://pyreprism.readthedocs.io
7
+ Project-URL: Issues, https://github.com/unlv-evol/PyReprism/issues
8
+ Author-email: UNLV EVOL LAB <ogenrwot@unlv.nevada.edu>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2024 UNLV EVOL
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Environment :: Console
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Intended Audience :: Science/Research
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.8
39
+ Classifier: Programming Language :: Python :: 3.9
40
+ Classifier: Programming Language :: Python :: 3.10
41
+ Classifier: Programming Language :: Python :: 3.11
42
+ Classifier: Programming Language :: Python :: 3.12
43
+ Classifier: Programming Language :: Python :: 3.13
44
+ Requires-Python: >=3.8
45
+ Provides-Extra: accurate
46
+ Requires-Dist: pygments; extra == 'accurate'
47
+ Provides-Extra: dev
48
+ Requires-Dist: build; extra == 'dev'
49
+ Requires-Dist: flake8; extra == 'dev'
50
+ Requires-Dist: pygments; extra == 'dev'
51
+ Requires-Dist: pytest; extra == 'dev'
52
+ Requires-Dist: pytest-cov; extra == 'dev'
53
+ Requires-Dist: twine; extra == 'dev'
54
+ Provides-Extra: docs
55
+ Requires-Dist: sphinx; extra == 'docs'
56
+ Requires-Dist: sphinx-rtd-theme; extra == 'docs'
57
+ Description-Content-Type: text/x-rst
58
+
59
+ .. _intro_toplevel:
60
+
61
+ ========
62
+ Overview
63
+ ========
64
+
65
+ **PyReprism** is a Python framework for source-code preprocessing. It lets you
66
+ **match, extract, count, and remove** comments, strings, numbers, operators,
67
+ keywords and other language-specific constructs across **145+ programming
68
+ languages and file formats** — through a small high-level API, a command-line
69
+ tool, code metrics, ML-oriented normalization, and diff/pull-request analysis.
70
+
71
+ Highlights
72
+ ==========
73
+
74
+ * One consistent API for every language: ``remove_*`` / ``extract_*`` /
75
+ ``count_*`` / ``match_*`` for each construct, plus a lossless ``tokenize()``.
76
+ * Code metrics (``stats``) and ML canonicalization (``normalize``) for
77
+ clone/plagiarism detection and code-embedding pipelines.
78
+ * Optional high-accuracy `Pygments`_ backend — with **zero required
79
+ dependencies** by default.
80
+ * Batch/corpus analysis and unified/``git`` diff processing.
81
+ * A ``pyreprism`` command-line tool (also ``python -m PyReprism``).
82
+
83
+ Requirements
84
+ ============
85
+
86
+ * `Python`_ 3.8 or newer
87
+
88
+ Install
89
+ =======
90
+
91
+ .. code-block:: shell
92
+
93
+ pip install PyReprism
94
+
95
+ For the higher-accuracy tokenizer backend:
96
+
97
+ .. code-block:: shell
98
+
99
+ pip install "PyReprism[accurate]"
100
+
101
+ Quick start
102
+ ===========
103
+
104
+ .. code-block:: python
105
+
106
+ import PyReprism as pr
107
+
108
+ source = """
109
+ # a comment
110
+ x = 5 + 6
111
+ print(x) # inline
112
+ """
113
+
114
+ pr.remove_comments(source, lang="python") # code without comments
115
+ pr.extract_comments(source, lang="python") # ['# a comment', '# inline']
116
+ pr.count_comments(source, lang="python") # 2
117
+
118
+ ``lang`` accepts a language name (``"python"``), a file extension (``".py"``),
119
+ or a language class. Canonicalize code for machine learning, or measure it:
120
+
121
+ .. code-block:: python
122
+
123
+ pr.normalize("total = price * 42", lang="python") # 'VAR1 = VAR2 * 0'
124
+ pr.stats(source, lang="python").comment_to_code_ratio
125
+
126
+ Command line
127
+ ============
128
+
129
+ .. code-block:: shell
130
+
131
+ pyreprism remove comments file.py
132
+ pyreprism scan myproject/ --csv # aggregate code metrics over a tree
133
+ git diff | pyreprism diff --cosmetic # flag comment/whitespace-only changes
134
+
135
+ Documentation
136
+ =============
137
+
138
+ Full documentation, including the API reference and the list of supported
139
+ languages, is available at https://pyreprism.readthedocs.io.
140
+
141
+ Source code
142
+ ===========
143
+
144
+ PyReprism is developed on GitHub at
145
+ https://github.com/unlv-evol/PyReprism. To work on it locally:
146
+
147
+ .. code-block:: shell
148
+
149
+ git clone https://github.com/unlv-evol/PyReprism.git
150
+ cd PyReprism
151
+ python3 -m venv venv && source venv/bin/activate
152
+ pip install -e ".[dev]"
153
+ pytest
154
+
155
+ See ``CONTRIBUTING.md`` for contribution guidelines.
156
+
157
+ .. _Python: https://www.python.org
158
+ .. _Pygments: https://pygments.org