PyReprism 0.0.4__tar.gz → 0.1.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.
- pyreprism-0.1.0/.flake8 +11 -0
- pyreprism-0.1.0/.github/scripts/changelog_notes.py +40 -0
- pyreprism-0.1.0/.github/scripts/package_version.py +21 -0
- pyreprism-0.1.0/.github/workflows/ci.yml +71 -0
- pyreprism-0.1.0/.github/workflows/publish.yml +91 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/.gitignore +6 -1
- pyreprism-0.1.0/.pre-commit-hooks.yaml +27 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/.readthedocs.yaml +4 -3
- pyreprism-0.1.0/CHANGELOG.md +78 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/CONTRIBUTING.md +6 -1
- {pyreprism-0.0.4 → pyreprism-0.1.0}/PKG-INFO +17 -4
- pyreprism-0.1.0/README.md +246 -0
- pyreprism-0.1.0/RELEASING.md +61 -0
- pyreprism-0.1.0/pyproject.toml +78 -0
- pyreprism-0.1.0/src/PyReprism/__init__.py +342 -0
- pyreprism-0.1.0/src/PyReprism/__main__.py +7 -0
- pyreprism-0.1.0/src/PyReprism/_tokenops.py +78 -0
- pyreprism-0.1.0/src/PyReprism/batch.py +208 -0
- pyreprism-0.1.0/src/PyReprism/cli.py +429 -0
- pyreprism-0.1.0/src/PyReprism/diffs.py +391 -0
- pyreprism-0.1.0/src/PyReprism/engines/__init__.py +34 -0
- pyreprism-0.1.0/src/PyReprism/engines/base.py +18 -0
- pyreprism-0.1.0/src/PyReprism/engines/pygments_engine.py +108 -0
- pyreprism-0.1.0/src/PyReprism/engines/regex_engine.py +14 -0
- pyreprism-0.1.0/src/PyReprism/languages/__init__.py +101 -0
- pyreprism-0.1.0/src/PyReprism/languages/abap.py +99 -0
- pyreprism-0.1.0/src/PyReprism/languages/actionscript.py +82 -0
- pyreprism-0.1.0/src/PyReprism/languages/ada.py +80 -0
- pyreprism-0.1.0/src/PyReprism/languages/apacheconf.py +102 -0
- pyreprism-0.1.0/src/PyReprism/languages/apl.py +67 -0
- pyreprism-0.1.0/src/PyReprism/languages/applescript.py +57 -0
- pyreprism-0.1.0/src/PyReprism/languages/arduino.py +97 -0
- pyreprism-0.1.0/src/PyReprism/languages/arff.py +84 -0
- pyreprism-0.1.0/src/PyReprism/languages/asciidoc.py +78 -0
- pyreprism-0.1.0/src/PyReprism/languages/asm6502.py +88 -0
- pyreprism-0.1.0/src/PyReprism/languages/aspnet.py +97 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/src/PyReprism/languages/autohotkey.py +26 -29
- pyreprism-0.1.0/src/PyReprism/languages/autoit.py +46 -0
- pyreprism-0.1.0/src/PyReprism/languages/base.py +323 -0
- pyreprism-0.1.0/src/PyReprism/languages/bash.py +39 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/src/PyReprism/languages/basic.py +31 -40
- pyreprism-0.1.0/src/PyReprism/languages/batch.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/bison.py +43 -0
- pyreprism-0.1.0/src/PyReprism/languages/brainfuck.py +42 -0
- pyreprism-0.1.0/src/PyReprism/languages/bro.py +44 -0
- pyreprism-0.1.0/src/PyReprism/languages/c.py +64 -0
- pyreprism-0.1.0/src/PyReprism/languages/clike.py +39 -0
- pyreprism-0.1.0/src/PyReprism/languages/clojure.py +50 -0
- pyreprism-0.1.0/src/PyReprism/languages/coffeescript.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/cpp.py +51 -0
- pyreprism-0.1.0/src/PyReprism/languages/crystal.py +49 -0
- pyreprism-0.1.0/src/PyReprism/languages/csharp.py +53 -0
- pyreprism-0.1.0/src/PyReprism/languages/csp.py +45 -0
- pyreprism-0.1.0/src/PyReprism/languages/css.py +28 -0
- pyreprism-0.1.0/src/PyReprism/languages/css_extras.py +28 -0
- pyreprism-0.1.0/src/PyReprism/languages/d.py +54 -0
- pyreprism-0.1.0/src/PyReprism/languages/dart.py +55 -0
- pyreprism-0.1.0/src/PyReprism/languages/diff.py +42 -0
- pyreprism-0.1.0/src/PyReprism/languages/django.py +62 -0
- pyreprism-0.1.0/src/PyReprism/languages/docker.py +101 -0
- pyreprism-0.1.0/src/PyReprism/languages/eiffel.py +42 -0
- pyreprism-0.1.0/src/PyReprism/languages/elixir.py +54 -0
- pyreprism-0.1.0/src/PyReprism/languages/erb.py +46 -0
- pyreprism-0.1.0/src/PyReprism/languages/erlang.py +55 -0
- pyreprism-0.1.0/src/PyReprism/languages/flow.py +30 -0
- pyreprism-0.1.0/src/PyReprism/languages/fortran.py +51 -0
- pyreprism-0.1.0/src/PyReprism/languages/fsharp.py +52 -0
- pyreprism-0.1.0/src/PyReprism/languages/gedcom.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/gherkin.py +31 -0
- pyreprism-0.1.0/src/PyReprism/languages/git.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/glsl.py +36 -0
- pyreprism-0.1.0/src/PyReprism/languages/go.py +47 -0
- pyreprism-0.1.0/src/PyReprism/languages/graphql.py +51 -0
- pyreprism-0.1.0/src/PyReprism/languages/groovy.py +55 -0
- pyreprism-0.1.0/src/PyReprism/languages/haml.py +29 -0
- pyreprism-0.1.0/src/PyReprism/languages/handlebars.py +41 -0
- pyreprism-0.1.0/src/PyReprism/languages/haskell.py +37 -0
- pyreprism-0.1.0/src/PyReprism/languages/haxe.py +57 -0
- pyreprism-0.1.0/src/PyReprism/languages/hpkp.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/hsts.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/html.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/ichigojam.py +55 -0
- pyreprism-0.1.0/src/PyReprism/languages/icon.py +59 -0
- pyreprism-0.1.0/src/PyReprism/languages/inform7.py +83 -0
- pyreprism-0.1.0/src/PyReprism/languages/ini.py +39 -0
- pyreprism-0.1.0/src/PyReprism/languages/io.py +43 -0
- pyreprism-0.1.0/src/PyReprism/languages/j.py +28 -0
- pyreprism-0.1.0/src/PyReprism/languages/java.py +101 -0
- pyreprism-0.1.0/src/PyReprism/languages/javascript.py +52 -0
- pyreprism-0.1.0/src/PyReprism/languages/jolie.py +29 -0
- pyreprism-0.1.0/src/PyReprism/languages/json.py +29 -0
- pyreprism-0.1.0/src/PyReprism/languages/jsx.py +118 -0
- pyreprism-0.1.0/src/PyReprism/languages/julia.py +79 -0
- pyreprism-0.1.0/src/PyReprism/languages/keyman.py +69 -0
- pyreprism-0.1.0/src/PyReprism/languages/kotlin.py +50 -0
- pyreprism-0.1.0/src/PyReprism/languages/latex.py +45 -0
- pyreprism-0.1.0/src/PyReprism/languages/less.py +45 -0
- pyreprism-0.1.0/src/PyReprism/languages/liquid.py +45 -0
- pyreprism-0.1.0/src/PyReprism/languages/livescript.py +45 -0
- pyreprism-0.1.0/src/PyReprism/languages/lolcode.py +73 -0
- pyreprism-0.1.0/src/PyReprism/languages/lua.py +42 -0
- pyreprism-0.1.0/src/PyReprism/languages/makefile.py +31 -0
- pyreprism-0.1.0/src/PyReprism/languages/markdown.py +28 -0
- pyreprism-0.1.0/src/PyReprism/languages/markup.py +29 -0
- pyreprism-0.1.0/src/PyReprism/languages/markup_templating.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/matlab.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/mel.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/mizar.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/monkey.py +35 -0
- pyreprism-0.1.0/src/PyReprism/languages/n4js.py +35 -0
- pyreprism-0.1.0/src/PyReprism/languages/nasm.py +44 -0
- pyreprism-0.1.0/src/PyReprism/languages/nginx.py +44 -0
- pyreprism-0.1.0/src/PyReprism/languages/nim.py +54 -0
- pyreprism-0.1.0/src/PyReprism/languages/nix.py +39 -0
- pyreprism-0.1.0/src/PyReprism/languages/nsis.py +34 -0
- pyreprism-0.1.0/src/PyReprism/languages/objectivec.py +58 -0
- pyreprism-0.1.0/src/PyReprism/languages/ocaml.py +34 -0
- pyreprism-0.1.0/src/PyReprism/languages/opencl.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/oz.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/parigp.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/parser.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/pascal.py +49 -0
- pyreprism-0.1.0/src/PyReprism/languages/perl.py +70 -0
- pyreprism-0.1.0/src/PyReprism/languages/php.py +56 -0
- pyreprism-0.1.0/src/PyReprism/languages/php_extras.py +16 -0
- pyreprism-0.1.0/src/PyReprism/languages/plsql.py +43 -0
- pyreprism-0.1.0/src/PyReprism/languages/powershell.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/processing.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/prolog.py +31 -0
- pyreprism-0.1.0/src/PyReprism/languages/properties.py +28 -0
- pyreprism-0.1.0/src/PyReprism/languages/protobuf.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/pug.py +31 -0
- pyreprism-0.1.0/src/PyReprism/languages/puppet.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/pure.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/python.py +97 -0
- pyreprism-0.1.0/src/PyReprism/languages/q.py +27 -0
- pyreprism-0.1.0/src/PyReprism/languages/qore.py +23 -0
- pyreprism-0.1.0/src/PyReprism/languages/r.py +24 -0
- pyreprism-0.1.0/src/PyReprism/languages/reason.py +34 -0
- pyreprism-0.1.0/src/PyReprism/languages/registry.py +52 -0
- pyreprism-0.1.0/src/PyReprism/languages/renpy.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/rest.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/rip.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/roboconf.py +31 -0
- pyreprism-0.1.0/src/PyReprism/languages/ruby.py +39 -0
- pyreprism-0.1.0/src/PyReprism/languages/rust.py +55 -0
- pyreprism-0.1.0/src/PyReprism/languages/sas.py +45 -0
- pyreprism-0.1.0/src/PyReprism/languages/sass.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/scala.py +50 -0
- pyreprism-0.1.0/src/PyReprism/languages/scheme.py +52 -0
- pyreprism-0.1.0/src/PyReprism/languages/scss.py +31 -0
- pyreprism-0.1.0/src/PyReprism/languages/smalltalk.py +55 -0
- pyreprism-0.1.0/src/PyReprism/languages/smarty.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/soy.py +33 -0
- pyreprism-0.1.0/src/PyReprism/languages/sql.py +144 -0
- pyreprism-0.1.0/src/PyReprism/languages/stylus.py +56 -0
- pyreprism-0.1.0/src/PyReprism/languages/swift.py +57 -0
- pyreprism-0.1.0/src/PyReprism/languages/tcl.py +40 -0
- pyreprism-0.1.0/src/PyReprism/languages/textile.py +42 -0
- pyreprism-0.1.0/src/PyReprism/languages/tsx.py +52 -0
- pyreprism-0.1.0/src/PyReprism/languages/twig.py +77 -0
- pyreprism-0.1.0/src/PyReprism/languages/typescript.py +58 -0
- pyreprism-0.1.0/src/PyReprism/languages/vbnet.py +69 -0
- pyreprism-0.1.0/src/PyReprism/languages/velocity.py +31 -0
- pyreprism-0.1.0/src/PyReprism/languages/verilog.py +94 -0
- pyreprism-0.1.0/src/PyReprism/languages/vhdl.py +83 -0
- pyreprism-0.1.0/src/PyReprism/languages/vim.py +32 -0
- pyreprism-0.1.0/src/PyReprism/languages/visual_basic.py +41 -0
- pyreprism-0.1.0/src/PyReprism/languages/wasam.py +96 -0
- pyreprism-0.1.0/src/PyReprism/languages/xeora.py +78 -0
- pyreprism-0.1.0/src/PyReprism/languages/xojo.py +95 -0
- pyreprism-0.1.0/src/PyReprism/languages/yaml.py +28 -0
- pyreprism-0.1.0/src/PyReprism/metrics.py +41 -0
- pyreprism-0.1.0/src/PyReprism/tokens.py +37 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/src/PyReprism/utils/extension.py +1 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/src/PyReprism/utils/normalizer.py +1 -2
- pyreprism-0.0.4/.flake8 +0 -7
- pyreprism-0.0.4/.github/workflows/ci.yml +0 -41
- pyreprism-0.0.4/.github/workflows/publish.yml +0 -38
- pyreprism-0.0.4/README.md +0 -96
- pyreprism-0.0.4/dev-requirements.txt +0 -9
- pyreprism-0.0.4/pyproject.toml +0 -47
- pyreprism-0.0.4/pytest.ini +0 -4
- pyreprism-0.0.4/requirements.txt +0 -3
- pyreprism-0.0.4/src/PyReprism/__init__.py +0 -1
- pyreprism-0.0.4/src/PyReprism/languages/__init__.py +0 -147
- pyreprism-0.0.4/src/PyReprism/languages/abap.py +0 -50
- pyreprism-0.0.4/src/PyReprism/languages/actionscript.py +0 -43
- pyreprism-0.0.4/src/PyReprism/languages/ada.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/apacheconf.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/apl.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/applescript.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/arduino.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/arff.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/asciidoc.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/asm6502.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/aspnet.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/autoit.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/bash.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/batch.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/bison.py +0 -50
- pyreprism-0.0.4/src/PyReprism/languages/brainfuck.py +0 -50
- pyreprism-0.0.4/src/PyReprism/languages/bro.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/c.py +0 -113
- pyreprism-0.0.4/src/PyReprism/languages/clike.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/clojure.py +0 -50
- pyreprism-0.0.4/src/PyReprism/languages/coffeescript.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/cpp.py +0 -113
- pyreprism-0.0.4/src/PyReprism/languages/crystal.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/csharp.py +0 -82
- pyreprism-0.0.4/src/PyReprism/languages/csp.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/css.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/css_extras.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/d.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/dart.py +0 -74
- pyreprism-0.0.4/src/PyReprism/languages/diff.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/django.py +0 -124
- pyreprism-0.0.4/src/PyReprism/languages/docker.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/eiffel.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/elixir.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/erlang.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/flow.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/fortran.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/fsharp.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/gedcom.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/gherkin.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/git.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/glsl.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/go.py +0 -82
- pyreprism-0.0.4/src/PyReprism/languages/graphql.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/groovy.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/haml.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/handlebars.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/haskell.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/haxe.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/hpkp.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/hsts.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/html.py +0 -43
- pyreprism-0.0.4/src/PyReprism/languages/ichigojam.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/icon.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/inform7.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/ini.py +0 -40
- pyreprism-0.0.4/src/PyReprism/languages/io.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/j.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/java.py +0 -113
- pyreprism-0.0.4/src/PyReprism/languages/javascript.py +0 -122
- pyreprism-0.0.4/src/PyReprism/languages/jolie.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/json.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/jsx.py +0 -115
- pyreprism-0.0.4/src/PyReprism/languages/julia.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/keyman.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/kotlin.py +0 -81
- pyreprism-0.0.4/src/PyReprism/languages/latex.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/less.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/liquid.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/livescript.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/lolcode.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/lua.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/makefile.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/markdown.py +0 -30
- pyreprism-0.0.4/src/PyReprism/languages/markup.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/markup_templating.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/matlab.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/mel.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/mizar.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/monkey.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/n4js.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/nasm.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/nginx.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/nim.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/nix.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/nsis.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/objectivec.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/ocaml.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/opencl.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/oz.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/parigp.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/parser.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/pascal.py +0 -48
- pyreprism-0.0.4/src/PyReprism/languages/perl.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/php.py +0 -124
- pyreprism-0.0.4/src/PyReprism/languages/php_extras.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/plsql.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/powershell.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/processing.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/prolog.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/properties.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/protobuf.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/pug.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/puppet.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/pure.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/python.py +0 -124
- pyreprism-0.0.4/src/PyReprism/languages/q.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/qore.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/r.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/reason.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/renpy.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/rest.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/rip.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/roboconf.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/ruby.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/rust.py +0 -81
- pyreprism-0.0.4/src/PyReprism/languages/sas.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/sass.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/scala.py +0 -81
- pyreprism-0.0.4/src/PyReprism/languages/scheme.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/scss.py +0 -50
- pyreprism-0.0.4/src/PyReprism/languages/smalltalk.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/smarty.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/soy.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/stylus.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/swift.py +0 -81
- pyreprism-0.0.4/src/PyReprism/languages/tcl.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/textile.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/tsx.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/twig.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/typescript.py +0 -79
- pyreprism-0.0.4/src/PyReprism/languages/vbnet.py +0 -74
- pyreprism-0.0.4/src/PyReprism/languages/velocity.py +0 -49
- pyreprism-0.0.4/src/PyReprism/languages/verilog.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/vhdl.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/vim.py +0 -50
- pyreprism-0.0.4/src/PyReprism/languages/visual_basic.py +0 -50
- pyreprism-0.0.4/src/PyReprism/languages/wasam.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/xeora.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/xojo.py +0 -0
- pyreprism-0.0.4/src/PyReprism/languages/yaml.py +0 -50
- {pyreprism-0.0.4 → pyreprism-0.1.0}/.github/FUNDING.yaml +0 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/LICENSE +0 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/codecov.yml +0 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/docs/intro.rst +0 -0
- /pyreprism-0.0.4/src/PyReprism/languages/erb.py → /pyreprism-0.1.0/src/PyReprism/py.typed +0 -0
- {pyreprism-0.0.4 → pyreprism-0.1.0}/src/PyReprism/utils/__init__.py +0 -0
pyreprism-0.1.0/.flake8
ADDED
|
@@ -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/*
|
|
@@ -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
|
-
#
|
|
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,78 @@
|
|
|
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
|
+
### Added
|
|
11
|
+
- **Diff processing** (`PyReprism.diffs`): parse unified/`git` diffs and analyze
|
|
12
|
+
the changed code per file in its own language. Includes churn metrics
|
|
13
|
+
(`diff_stats`: added/removed split into code, comment and blank), cosmetic
|
|
14
|
+
(comment/whitespace-only) change detection, reconstruction of the added/removed
|
|
15
|
+
code, and ML-oriented `tokenize`/`normalize`/`extract_comments` on changes.
|
|
16
|
+
Fragment mode works from the diff alone; setting a file's `new_source` /
|
|
17
|
+
`old_source` enables accurate full-file classification. New CLI command
|
|
18
|
+
`pyreprism diff` (`--json` / `--csv` / `--per-file` / `--cosmetic`).
|
|
19
|
+
|
|
20
|
+
## [0.1.0] - 2026-07-07
|
|
21
|
+
|
|
22
|
+
This release turns PyReprism from a comment-removal helper into a full
|
|
23
|
+
source-preprocessing toolkit with a high-level API, a CLI, code metrics,
|
|
24
|
+
ML-oriented normalization, an optional accurate backend, and batch processing.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **High-level API** (`import PyReprism as pr`): `remove_*`, `extract_*`,
|
|
28
|
+
`count_*`, `match_*` for comments, keywords, numbers, operators, strings and
|
|
29
|
+
identifiers; plus `preprocess`, `remove_whitespaces`, `get_language` and
|
|
30
|
+
`detect_language`. `lang=` accepts a language name, file extension, or class.
|
|
31
|
+
- **Tokenizer**: `tokenize()` on every language returns a lossless, typed
|
|
32
|
+
`Token` stream (`Token`/`TokenType` in `PyReprism.tokens`).
|
|
33
|
+
- **Code metrics**: `stats()` returns a `CodeStats` (line/token counts,
|
|
34
|
+
comment-to-code ratio, comment density; `as_dict()` for JSON/dataframes).
|
|
35
|
+
- **ML normalization**: `normalize()` canonicalizes code (rename identifiers to
|
|
36
|
+
`VAR1…`, mask string/number literals, drop comments) for clone/plagiarism
|
|
37
|
+
detection and code-embedding pipelines; `blank_comments()` strips comments
|
|
38
|
+
while preserving line numbers.
|
|
39
|
+
- **Pluggable backends**: `engine="regex"` (default, zero-dependency) or
|
|
40
|
+
`engine="pygments"` (`pip install pyreprism[accurate]`) for higher accuracy,
|
|
41
|
+
plus `"auto"`. Available on every operation.
|
|
42
|
+
- **Batch processing** (`PyReprism.batch`): `analyze()` walks a directory tree
|
|
43
|
+
and returns an aggregate report (`to_json`/`to_csv`, per-language breakdown);
|
|
44
|
+
`transform()` bulk-applies a transformation into a mirrored output directory.
|
|
45
|
+
- **Command-line interface** (`pyreprism`, also `python -m PyReprism`):
|
|
46
|
+
`remove`, `extract`, `count`, `preprocess`, `tokenize`, `stats`, `normalize`,
|
|
47
|
+
`scan`, and `languages`; reads stdin/files/globs/directories; supports
|
|
48
|
+
`--lang`, `--engine`, `--in-place`, `--output`, and `--json`/`--csv`.
|
|
49
|
+
- **Source-based language detection**: `detect_language(source=...)` recognizes
|
|
50
|
+
`#!` shebangs and (when Pygments is installed) makes a best-effort content
|
|
51
|
+
guess; the CLI uses this to auto-detect the language of piped input.
|
|
52
|
+
- Pre-commit hooks (`.pre-commit-hooks.yaml`), a `py.typed` marker (PEP 561),
|
|
53
|
+
and a registry-wide test suite covering all supported languages.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
- Implemented real support for 25 previously-empty language stubs and migrated
|
|
57
|
+
22 legacy languages (HTML, JSON, YAML, CSS, Markdown, …) to the
|
|
58
|
+
`BaseLanguage` + registry pattern, making them importable via the public API.
|
|
59
|
+
- Ambiguous file extensions now resolve to a canonical language
|
|
60
|
+
(`.py` → Python, `.js` → JavaScript, …).
|
|
61
|
+
- Consolidated packaging into `pyproject.toml` (single version source, pytest
|
|
62
|
+
and coverage config), updated CI to a Python 3.8–3.12 matrix, and refreshed
|
|
63
|
+
the README.
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
- Corrected comment-stripping for ~30 languages whose regexes either failed to
|
|
67
|
+
remove line comments or consumed surrounding code, and fixed duplicate/broken
|
|
68
|
+
definitions (Perl, csp, glsl, django, apacheconf, php_extras, ruby, and the
|
|
69
|
+
Python triple-quoted-docstring bug).
|
|
70
|
+
|
|
71
|
+
## [0.0.4] - 2024
|
|
72
|
+
|
|
73
|
+
- Early beta releases: comment removal for an initial set of languages and the
|
|
74
|
+
`Normalizer` whitespace helper.
|
|
75
|
+
|
|
76
|
+
[Unreleased]: https://github.com/unlv-evol/PyReprism/compare/v0.1.0...HEAD
|
|
77
|
+
[0.1.0]: https://github.com/unlv-evol/PyReprism/releases/tag/v0.1.0
|
|
78
|
+
[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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PyReprism
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Framework for Source Code Preprocessing
|
|
5
5
|
Project-URL: Homepage, https://github.com/unlv-evol/PyReprism
|
|
6
6
|
Project-URL: Documentation, https://pyreprism.readthedocs.io
|
|
@@ -28,19 +28,32 @@ License: MIT License
|
|
|
28
28
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
29
|
SOFTWARE.
|
|
30
30
|
License-File: LICENSE
|
|
31
|
-
Classifier: Development Status ::
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
32
|
Classifier: Environment :: Console
|
|
33
33
|
Classifier: Intended Audience :: Developers
|
|
34
34
|
Classifier: Intended Audience :: Science/Research
|
|
35
35
|
Classifier: License :: OSI Approved :: MIT License
|
|
36
36
|
Classifier: Operating System :: OS Independent
|
|
37
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
|
|
38
42
|
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
-
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
44
|
+
Requires-Python: >=3.8
|
|
45
|
+
Provides-Extra: accurate
|
|
46
|
+
Requires-Dist: pygments; extra == 'accurate'
|
|
40
47
|
Provides-Extra: dev
|
|
48
|
+
Requires-Dist: build; extra == 'dev'
|
|
41
49
|
Requires-Dist: flake8; extra == 'dev'
|
|
50
|
+
Requires-Dist: pygments; extra == 'dev'
|
|
42
51
|
Requires-Dist: pytest; extra == 'dev'
|
|
43
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'
|
|
44
57
|
Description-Content-Type: text/x-rst
|
|
45
58
|
|
|
46
59
|
.. _intro_toplevel:
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
|
+
[](https://pepy.tech/project/pyreprism)
|
|
3
|
+
[](https://app.fossa.com/projects/custom%2B46484%2Fgithub.com%2Funlv-evol%2FPyReprism?ref=badge_shield&issueType=license)
|
|
4
|
+
[](https://app.fossa.com/projects/custom%2B46484%2Fgithub.com%2Funlv-evol%2FPyReprism?ref=badge_shield&issueType=security)
|
|
5
|
+
[](https://pyreprism.readthedocs.io/en/latest/?badge=latest)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
[](https://codecov.io/gh/unlv-evol/PyReprism)
|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
[](https://archive.softwareheritage.org/browse/origin/?origin_url=https://pypi.org/project/PyReprism/)
|
|
13
|
+
|
|
14
|
+
# PyReprism
|
|
15
|
+
|
|
16
|
+
PyReprism is a Python framework that helps researchers and developers the task of source code preprocessing. With PyReprism, you can easily match, extract, count, and remove comments, whitespaces, operators, numbers and other language specific constructs from over **150 programming languages and file extensions**.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
```shell
|
|
20
|
+
pip install PyReprism
|
|
21
|
+
```
|
|
22
|
+
## Quick Usage
|
|
23
|
+
|
|
24
|
+
The simplest entry point is the top-level API. Pass `lang` as a language name
|
|
25
|
+
(`"python"`), a file extension (`".py"`), or a language class.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import PyReprism as pr
|
|
29
|
+
|
|
30
|
+
source = """
|
|
31
|
+
# single line comment
|
|
32
|
+
x = 5 + 6
|
|
33
|
+
print(x) # inline comment
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
pr.remove_comments(source, lang="python") # -> code with comments stripped
|
|
37
|
+
pr.extract_comments(source, lang="python") # -> ['# single line comment', '# inline comment']
|
|
38
|
+
pr.count_comments(source, lang="python") # -> 2
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Every construct supports the same **match / extract / count / remove** verbs:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
code = 'total = price * 42 + tax # compute'
|
|
45
|
+
|
|
46
|
+
pr.extract_numbers(code, lang="python") # -> ['42']
|
|
47
|
+
pr.extract_keywords(code, lang="python") # -> []
|
|
48
|
+
pr.extract_identifiers(code, lang="python") # -> ['total', 'price', 'tax', 'compute']
|
|
49
|
+
pr.remove_numbers(code, lang="python") # -> 'total = price * + tax # compute'
|
|
50
|
+
pr.extract_strings('s = "hi"', lang="python") # -> ['"hi"']
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`match_*` returns positioned `Token`s (`type`, `value`, `start`, `end`, `line`):
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
for tok in pr.match_comments(source, lang="python"):
|
|
57
|
+
print(tok.line, tok.value)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Tokenize
|
|
61
|
+
|
|
62
|
+
`tokenize()` returns a lossless, typed token stream (comment/string/number/
|
|
63
|
+
keyword/identifier/operator/whitespace/other):
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
for tok in pr.tokenize("x = 5 + y // c", lang="clike"):
|
|
67
|
+
print(tok.type, repr(tok.value))
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Pipelines
|
|
71
|
+
|
|
72
|
+
Chain removal steps in one call:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
pr.preprocess(source, lang="java",
|
|
76
|
+
steps=["comments", "strings", "whitespace"])
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Valid steps: `comments`, `strings`, `numbers`, `operators`, `keywords`, `whitespace`.
|
|
80
|
+
|
|
81
|
+
### Code metrics
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
s = pr.stats(source, lang="python")
|
|
85
|
+
s.code_lines, s.comment_lines, s.blank_lines
|
|
86
|
+
s.comment_to_code_ratio, s.comment_density
|
|
87
|
+
s.as_dict() # includes per-token-type counts, ready for JSON / dataframes
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Normalization for ML / clone detection
|
|
91
|
+
|
|
92
|
+
Canonicalize code so that only its structure remains — rename identifiers to
|
|
93
|
+
`VAR1, VAR2, …`, mask string/number literals, and drop comments:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
pr.normalize("total = price * 42 # cost", lang="python")
|
|
97
|
+
# -> 'VAR1 = VAR2 * 0'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Every part is toggleable (`rename_identifiers`, `mask_numbers`, `mask_strings`,
|
|
101
|
+
`drop_comments`, `collapse_whitespace`). To strip comments while keeping line
|
|
102
|
+
numbers stable (useful for tools that map back to source):
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
pr.blank_comments(source, lang="python") # comment content removed, newlines kept
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Accuracy: choose a backend
|
|
109
|
+
|
|
110
|
+
By default PyReprism uses its own zero-dependency regex engine (fast, no installs).
|
|
111
|
+
For higher accuracy — e.g. correctly ignoring a `#` inside a string — pass
|
|
112
|
+
`engine="pygments"` (install the optional extra with `pip install pyreprism[accurate]`):
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
src = 'url = "http://x#frag" # real comment'
|
|
116
|
+
|
|
117
|
+
pr.remove_comments(src, lang="python") # regex (default)
|
|
118
|
+
pr.remove_comments(src, lang="python", engine="pygments") # keeps the URL, drops the comment
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`engine` accepts `"regex"` (default), `"pygments"`, or `"auto"` (use pygments if
|
|
122
|
+
installed, else regex). It works on every operation — `remove_*`, `extract_*`,
|
|
123
|
+
`count_*`, `tokenize`, `normalize`, `stats`, `preprocess` — and on the CLI via
|
|
124
|
+
`--engine`.
|
|
125
|
+
|
|
126
|
+
### Batch / whole-directory processing
|
|
127
|
+
|
|
128
|
+
Analyze or transform an entire source tree (junk folders like `.git`,
|
|
129
|
+
`node_modules`, `venv` are skipped automatically):
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from PyReprism import batch
|
|
133
|
+
|
|
134
|
+
report = batch.analyze("myproject/") # walk the tree, compute metrics
|
|
135
|
+
report.totals() # aggregate line/token counts
|
|
136
|
+
report.by_language() # per-language breakdown
|
|
137
|
+
report.to_json(); report.to_csv() # export for dataframes / notebooks
|
|
138
|
+
|
|
139
|
+
# Bulk-transform into a mirrored output directory:
|
|
140
|
+
batch.transform("myproject/", lambda text, lang: lang.remove_comments(text),
|
|
141
|
+
output="stripped/")
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Process diffs / pull requests
|
|
145
|
+
|
|
146
|
+
Parse a unified (`git`) diff and analyze the *changed code* per file, language-aware:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from PyReprism import diffs
|
|
150
|
+
|
|
151
|
+
d = diffs.parse(diff_text) # git diff / .diff / .patch text
|
|
152
|
+
|
|
153
|
+
report = diffs.diff_stats(d) # churn split into code vs comment vs blank
|
|
154
|
+
report.totals(); report.to_csv()
|
|
155
|
+
|
|
156
|
+
diffs.cosmetic_files(d) # files whose change is comment/whitespace-only
|
|
157
|
+
|
|
158
|
+
f = d.files[0]
|
|
159
|
+
f.language # detected from the file path
|
|
160
|
+
f.added_text(); f.removed_text() # reconstructed changed code
|
|
161
|
+
f.normalize("added") # canonicalize the added code for ML
|
|
162
|
+
f.extract_comments("added")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
For accuracy where a comment/string spans a hunk boundary, set
|
|
166
|
+
`f.new_source` / `f.old_source` to the full file contents (e.g. from `git show`)
|
|
167
|
+
and the changed lines are classified against the whole file. On the CLI:
|
|
168
|
+
|
|
169
|
+
```shell
|
|
170
|
+
git diff | pyreprism diff --per-file # churn report
|
|
171
|
+
git diff | pyreprism diff --json
|
|
172
|
+
git diff | pyreprism diff --cosmetic # list comment/whitespace-only changes
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Detect the language from a filename
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
cls = pr.detect_language(filename="src/main.go") # -> Go language class
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Language-independent whitespace normalization
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
pr.remove_whitespaces("x = 5 + 6\n\n\nprint(x)") # -> 'x=5+6\nprint(x)'
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
You can also import a language class directly if you prefer:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from PyReprism.languages import Python
|
|
191
|
+
Python.remove_comments(source)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Command line
|
|
195
|
+
|
|
196
|
+
Installing PyReprism also provides a `pyreprism` command (works on stdin/stdout,
|
|
197
|
+
files, and globs; the language is auto-detected from a file's extension):
|
|
198
|
+
|
|
199
|
+
```shell
|
|
200
|
+
pyreprism remove comments file.py
|
|
201
|
+
cat file.go | pyreprism remove comments --lang go
|
|
202
|
+
pyreprism extract comments "src/**/*.py" --json
|
|
203
|
+
pyreprism count comments file.py --lang python
|
|
204
|
+
pyreprism preprocess --steps comments,strings,whitespace file.java
|
|
205
|
+
pyreprism tokenize --json file.py
|
|
206
|
+
pyreprism stats --json file.py # line/token metrics
|
|
207
|
+
pyreprism normalize file.py # canonicalize for ML
|
|
208
|
+
pyreprism remove comments file.py --in-place # rewrite in place
|
|
209
|
+
pyreprism scan myproject/ --csv # aggregate metrics over a tree
|
|
210
|
+
pyreprism remove comments src/ --output out/ # bulk-transform a directory
|
|
211
|
+
pyreprism languages # list supported languages
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Equivalently: `python -m PyReprism ...`.
|
|
215
|
+
|
|
216
|
+
It can also be wired into [pre-commit](https://pre-commit.com) via the bundled
|
|
217
|
+
`.pre-commit-hooks.yaml` (`pyreprism-strip-comments`, `pyreprism-normalize-whitespace`).
|
|
218
|
+
These hooks rewrite files, so scope them with `files:`/`exclude:`.
|
|
219
|
+
|
|
220
|
+
Read the [docs](https://pyreprism.readthedocs.io) for more usage examples.
|
|
221
|
+
|
|
222
|
+
NB: The beta versions of PyReprism is still unstable, but we are working 24/7 to ensure the tool is usable.
|
|
223
|
+
|
|
224
|
+
## How to Contribute
|
|
225
|
+
We invite you to help us build this tool and make it more extensive. Contribution is open to OSS community.
|
|
226
|
+
|
|
227
|
+
```shell
|
|
228
|
+
$ git clone https://github.com/unlv-evol/PyReprism.git
|
|
229
|
+
$ cd PyReprism
|
|
230
|
+
```
|
|
231
|
+
**(Optional)** It is suggested to make use of virtualenv. Therefore, before installing the requirements run:
|
|
232
|
+
|
|
233
|
+
```shell
|
|
234
|
+
$ python3 -m venv venv
|
|
235
|
+
$ source venv/bin/activate
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Then, install the package in editable mode with its development tooling:
|
|
239
|
+
|
|
240
|
+
```shell
|
|
241
|
+
$ pip install -e ".[dev]"
|
|
242
|
+
```
|
|
243
|
+
For more information on how to contribute, read our [contributing guidelines](CONTRIBUTING.md).
|
|
244
|
+
|
|
245
|
+
## Issues
|
|
246
|
+
If you experience any issue, feel free to report it.
|