token-utils 0.1.7__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 (153) hide show
  1. token_utils-0.2.0/.flake8 +14 -0
  2. token_utils-0.2.0/.gitignore +133 -0
  3. token_utils-0.2.0/.idea/.gitignore +5 -0
  4. token_utils-0.2.0/.idea/inspectionProfiles/profiles_settings.xml +6 -0
  5. token_utils-0.2.0/.idea/modules.xml +8 -0
  6. token_utils-0.2.0/.idea/token-utils.iml +11 -0
  7. token_utils-0.2.0/.idea/vcs.xml +6 -0
  8. token_utils-0.2.0/.idea/workspace.xml +67 -0
  9. token_utils-0.2.0/.nojekyll +0 -0
  10. token_utils-0.2.0/LICENSE +25 -0
  11. token_utils-0.2.0/PKG-INFO +79 -0
  12. token_utils-0.2.0/README.md +54 -0
  13. token_utils-0.2.0/ae.bat +50 -0
  14. token_utils-0.2.0/docs/Makefile +20 -0
  15. token_utils-0.2.0/docs/doctrees/about_tokens.doctree +0 -0
  16. token_utils-0.2.0/docs/doctrees/api.doctree +0 -0
  17. token_utils-0.2.0/docs/doctrees/environment.pickle +0 -0
  18. token_utils-0.2.0/docs/doctrees/history.doctree +0 -0
  19. token_utils-0.2.0/docs/doctrees/index.doctree +0 -0
  20. token_utils-0.2.0/docs/doctrees/nbsphinx/tokenize_notebook.ipynb +610 -0
  21. token_utils-0.2.0/docs/doctrees/tokenize.doctree +0 -0
  22. token_utils-0.2.0/docs/doctrees/tokenize_notebook.doctree +0 -0
  23. token_utils-0.2.0/docs/html/.buildinfo +4 -0
  24. token_utils-0.2.0/docs/html/.buildinfo.bak +4 -0
  25. token_utils-0.2.0/docs/html/.nojekyll +0 -0
  26. token_utils-0.2.0/docs/html/_modules/ideas/token_utils.html +565 -0
  27. token_utils-0.2.0/docs/html/_modules/index.html +109 -0
  28. token_utils-0.2.0/docs/html/_modules/token_utils/_token_utils.html +665 -0
  29. token_utils-0.2.0/docs/html/_modules/token_utils/token_class.html +268 -0
  30. token_utils-0.2.0/docs/html/_modules/token_utils/utils.html +509 -0
  31. token_utils-0.2.0/docs/html/_sources/about_tokens.rst.txt +72 -0
  32. token_utils-0.2.0/docs/html/_sources/api.rst.txt +9 -0
  33. token_utils-0.2.0/docs/html/_sources/history.rst.txt +127 -0
  34. token_utils-0.2.0/docs/html/_sources/index.rst.txt +93 -0
  35. token_utils-0.2.0/docs/html/_sources/tokenize.rst.txt +87 -0
  36. token_utils-0.2.0/docs/html/_sources/tokenize_notebook.ipynb.txt +610 -0
  37. token_utils-0.2.0/docs/html/_static/_sphinx_javascript_frameworks_compat.js +123 -0
  38. token_utils-0.2.0/docs/html/_static/basic.css +914 -0
  39. token_utils-0.2.0/docs/html/_static/css/badge_only.css +1 -0
  40. token_utils-0.2.0/docs/html/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
  41. token_utils-0.2.0/docs/html/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  42. token_utils-0.2.0/docs/html/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
  43. token_utils-0.2.0/docs/html/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  44. token_utils-0.2.0/docs/html/_static/css/fonts/fontawesome-webfont.eot +0 -0
  45. token_utils-0.2.0/docs/html/_static/css/fonts/fontawesome-webfont.svg +2671 -0
  46. token_utils-0.2.0/docs/html/_static/css/fonts/fontawesome-webfont.ttf +0 -0
  47. token_utils-0.2.0/docs/html/_static/css/fonts/fontawesome-webfont.woff +0 -0
  48. token_utils-0.2.0/docs/html/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
  49. token_utils-0.2.0/docs/html/_static/css/fonts/lato-bold-italic.woff +0 -0
  50. token_utils-0.2.0/docs/html/_static/css/fonts/lato-bold-italic.woff2 +0 -0
  51. token_utils-0.2.0/docs/html/_static/css/fonts/lato-bold.woff +0 -0
  52. token_utils-0.2.0/docs/html/_static/css/fonts/lato-bold.woff2 +0 -0
  53. token_utils-0.2.0/docs/html/_static/css/fonts/lato-normal-italic.woff +0 -0
  54. token_utils-0.2.0/docs/html/_static/css/fonts/lato-normal-italic.woff2 +0 -0
  55. token_utils-0.2.0/docs/html/_static/css/fonts/lato-normal.woff +0 -0
  56. token_utils-0.2.0/docs/html/_static/css/fonts/lato-normal.woff2 +0 -0
  57. token_utils-0.2.0/docs/html/_static/css/theme.css +4 -0
  58. token_utils-0.2.0/docs/html/_static/custom.css +57 -0
  59. token_utils-0.2.0/docs/html/_static/doctools.js +149 -0
  60. token_utils-0.2.0/docs/html/_static/documentation_options.js +13 -0
  61. token_utils-0.2.0/docs/html/_static/file.png +0 -0
  62. token_utils-0.2.0/docs/html/_static/fonts/Inconsolata-Bold.ttf +0 -0
  63. token_utils-0.2.0/docs/html/_static/fonts/Inconsolata-Regular.ttf +0 -0
  64. token_utils-0.2.0/docs/html/_static/fonts/Inconsolata.ttf +0 -0
  65. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bold.eot +0 -0
  66. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bold.ttf +0 -0
  67. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bold.woff +0 -0
  68. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bold.woff2 +0 -0
  69. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bolditalic.eot +0 -0
  70. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bolditalic.ttf +0 -0
  71. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bolditalic.woff +0 -0
  72. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-bolditalic.woff2 +0 -0
  73. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-italic.eot +0 -0
  74. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-italic.ttf +0 -0
  75. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-italic.woff +0 -0
  76. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-italic.woff2 +0 -0
  77. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-regular.eot +0 -0
  78. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-regular.ttf +0 -0
  79. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-regular.woff +0 -0
  80. token_utils-0.2.0/docs/html/_static/fonts/Lato/lato-regular.woff2 +0 -0
  81. token_utils-0.2.0/docs/html/_static/fonts/Lato-Bold.ttf +0 -0
  82. token_utils-0.2.0/docs/html/_static/fonts/Lato-Regular.ttf +0 -0
  83. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot +0 -0
  84. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf +0 -0
  85. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff +0 -0
  86. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 +0 -0
  87. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot +0 -0
  88. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf +0 -0
  89. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff +0 -0
  90. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 +0 -0
  91. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab-Bold.ttf +0 -0
  92. token_utils-0.2.0/docs/html/_static/fonts/RobotoSlab-Regular.ttf +0 -0
  93. token_utils-0.2.0/docs/html/_static/fonts/fontawesome-webfont.eot +0 -0
  94. token_utils-0.2.0/docs/html/_static/fonts/fontawesome-webfont.svg +2671 -0
  95. token_utils-0.2.0/docs/html/_static/fonts/fontawesome-webfont.ttf +0 -0
  96. token_utils-0.2.0/docs/html/_static/fonts/fontawesome-webfont.woff +0 -0
  97. token_utils-0.2.0/docs/html/_static/fonts/fontawesome-webfont.woff2 +0 -0
  98. token_utils-0.2.0/docs/html/_static/jquery-3.2.1.js +10253 -0
  99. token_utils-0.2.0/docs/html/_static/jquery.js +2 -0
  100. token_utils-0.2.0/docs/html/_static/js/badge_only.js +1 -0
  101. token_utils-0.2.0/docs/html/_static/js/modernizr.min.js +4 -0
  102. token_utils-0.2.0/docs/html/_static/js/theme.js +1 -0
  103. token_utils-0.2.0/docs/html/_static/js/versions.js +228 -0
  104. token_utils-0.2.0/docs/html/_static/language_data.js +192 -0
  105. token_utils-0.2.0/docs/html/_static/minus.png +0 -0
  106. token_utils-0.2.0/docs/html/_static/nbsphinx-broken-thumbnail.svg +9 -0
  107. token_utils-0.2.0/docs/html/_static/nbsphinx-code-cells.css +259 -0
  108. token_utils-0.2.0/docs/html/_static/nbsphinx-gallery.css +31 -0
  109. token_utils-0.2.0/docs/html/_static/nbsphinx-no-thumbnail.svg +9 -0
  110. token_utils-0.2.0/docs/html/_static/plus.png +0 -0
  111. token_utils-0.2.0/docs/html/_static/pygments.css +75 -0
  112. token_utils-0.2.0/docs/html/_static/searchtools.js +632 -0
  113. token_utils-0.2.0/docs/html/_static/sphinx_highlight.js +154 -0
  114. token_utils-0.2.0/docs/html/_static/underscore-1.3.1.js +999 -0
  115. token_utils-0.2.0/docs/html/_static/underscore.js +31 -0
  116. token_utils-0.2.0/docs/html/about_tokens.html +185 -0
  117. token_utils-0.2.0/docs/html/api.html +449 -0
  118. token_utils-0.2.0/docs/html/genindex.html +274 -0
  119. token_utils-0.2.0/docs/html/history.html +223 -0
  120. token_utils-0.2.0/docs/html/index.html +214 -0
  121. token_utils-0.2.0/docs/html/objects.inv +0 -0
  122. token_utils-0.2.0/docs/html/py-modindex.html +130 -0
  123. token_utils-0.2.0/docs/html/search.html +127 -0
  124. token_utils-0.2.0/docs/html/searchindex.js +1 -0
  125. token_utils-0.2.0/docs/html/tokenize.html +480 -0
  126. token_utils-0.2.0/docs/html/tokenize_notebook.html +584 -0
  127. token_utils-0.2.0/docs/html/tokenize_notebook.ipynb +610 -0
  128. token_utils-0.2.0/docs/make.bat +36 -0
  129. token_utils-0.2.0/docs/source/_static/custom.css +57 -0
  130. token_utils-0.2.0/docs/source/about_tokens.rst +72 -0
  131. token_utils-0.2.0/docs/source/api.rst +9 -0
  132. token_utils-0.2.0/docs/source/conf.py +172 -0
  133. token_utils-0.2.0/docs/source/history.rst +127 -0
  134. token_utils-0.2.0/docs/source/index.rst +93 -0
  135. token_utils-0.2.0/docs/source/tokenize_notebook.ipynb +610 -0
  136. token_utils-0.2.0/pypi_upload.bat +13 -0
  137. token_utils-0.2.0/pyproject.toml +38 -0
  138. token_utils-0.2.0/src/token_utils/__about__.py +2 -0
  139. token_utils-0.2.0/src/token_utils/__init__.py +3 -0
  140. token_utils-0.2.0/src/token_utils/py_token.py +151 -0
  141. token_utils-0.2.0/src/token_utils/py_tokenize.py +591 -0
  142. token_utils-0.2.0/src/token_utils/token_class.py +136 -0
  143. token-utils-0.1.7/token_utils.py → token_utils-0.2.0/src/token_utils/utils.py +98 -191
  144. token_utils-0.2.0/tests/__init__.py +1 -0
  145. token_utils-0.2.0/tests/test_token_utils.py +252 -0
  146. token-utils-0.1.7/PKG-INFO +0 -36
  147. token-utils-0.1.7/README.md +0 -18
  148. token-utils-0.1.7/setup.cfg +0 -4
  149. token-utils-0.1.7/setup.py +0 -27
  150. token-utils-0.1.7/token_utils.egg-info/PKG-INFO +0 -36
  151. token-utils-0.1.7/token_utils.egg-info/SOURCES.txt +0 -7
  152. token-utils-0.1.7/token_utils.egg-info/dependency_links.txt +0 -1
  153. token-utils-0.1.7/token_utils.egg-info/top_level.txt +0 -1
@@ -0,0 +1,14 @@
1
+ [flake8]
2
+ max-line-length = 88
3
+ # see https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
4
+ ignore = E203, E266, E402, E501, W503
5
+ exclude =
6
+ # No need to traverse our git directory
7
+ .git/*,
8
+ # There's no value in checking cache directories
9
+ __pycache__,
10
+ # documentation, to be ignored
11
+ docs/*,
12
+ images/*,
13
+ # This contains our tests directory
14
+ tests/*,
@@ -0,0 +1,133 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+ venv*/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+
132
+
133
+ temp*.*
@@ -0,0 +1,5 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/token-utils.iml" filepath="$PROJECT_DIR$/.idea/token-utils.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module external.system.id="pyproject.toml" type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
6
+ <excludeFolder url="file://$MODULE_DIR$/venv-token3.10" />
7
+ </content>
8
+ <orderEntry type="jdk" jdkName="~\github\token-utils\venv-token3.10" jdkType="Python SDK" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ </component>
11
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,67 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
6
+ <component name="ChangeListManager">
7
+ <list default="true" id="3545b7d4-d817-410c-bc69-d7ce96a4dbcc" name="Changes" comment="">
8
+ <change beforePath="$PROJECT_DIR$/src/token_utils/py_tokenize.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/token_utils/py_tokenize.py" afterDir="false" />
9
+ </list>
10
+ <option name="SHOW_DIALOG" value="false" />
11
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
12
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
13
+ <option name="LAST_RESOLUTION" value="IGNORE" />
14
+ </component>
15
+ <component name="FileTemplateManagerImpl">
16
+ <option name="RECENT_TEMPLATES">
17
+ <list>
18
+ <option value="Python Script" />
19
+ </list>
20
+ </option>
21
+ </component>
22
+ <component name="Git.Settings">
23
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
24
+ </component>
25
+ <component name="ProjectColorInfo">{
26
+ &quot;associatedIndex&quot;: 4,
27
+ &quot;fromUser&quot;: false
28
+ }</component>
29
+ <component name="ProjectId" id="3JjJsQEtY2V4TIefkRlMyE5hIqZ" />
30
+ <component name="ProjectViewState">
31
+ <option name="hideEmptyMiddlePackages" value="true" />
32
+ <option name="showLibraryContents" value="true" />
33
+ </component>
34
+ <component name="PropertiesComponent"><![CDATA[{
35
+ "keyToString": {
36
+ "ModuleVcsDetector.initialDetectionPerformed": "true",
37
+ "RunOnceActivity.ShowReadmeOnStart": "true",
38
+ "RunOnceActivity.git.unshallow": "true",
39
+ "RunOnceActivity.typescript.service.memoryLimit.init": "true",
40
+ "codeWithMe.voiceChat.enabledByDefault": "false",
41
+ "git-widget-placeholder": "master",
42
+ "last_opened_file_path": "C:/Users/Andre/github/token-utils",
43
+ "nodejs_package_manager_path": "npm",
44
+ "python.packages.toolwindow.project.migrated.to.right.top.v2": "true"
45
+ }
46
+ }]]></component>
47
+ <component name="SharedIndexes">
48
+ <attachedChunks>
49
+ <set>
50
+ <option value="bundled-python-sdk-73a66231627c-5bd6d13a2a75-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-262.10968.92" />
51
+ </set>
52
+ </attachedChunks>
53
+ </component>
54
+ <component name="TaskManager">
55
+ <task active="true" id="Default" summary="Default task">
56
+ <changelist id="3545b7d4-d817-410c-bc69-d7ce96a4dbcc" name="Changes" comment="" />
57
+ <created>1790168749536</created>
58
+ <option name="number" value="Default" />
59
+ <option name="presentableId" value="Default" />
60
+ <updated>1790168749536</updated>
61
+ </task>
62
+ <servers />
63
+ </component>
64
+ <component name="TypeScriptGeneratedFilesManager">
65
+ <option name="version" value="3" />
66
+ </component>
67
+ </project>
File without changes
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 André Roberge
4
+
5
+ Note: the untokenize function was modified and adapted from
6
+ https://github.com/myint/untokenize,
7
+ Copyright (C) 2013-2018 Steven Myint, MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: token-utils
3
+ Version: 0.2.0
4
+ Summary: Convenient tools to deal with tokens.
5
+ Project-URL: Documentation, https://aroberge.github.io/token-utils/docs/html/
6
+ Project-URL: Issues, https://github.com/aroberge/token-utils/issues
7
+ Project-URL: Source, https://github.com/aroberge/token-utils
8
+ Author-email: André Roberge <andre.roberge@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3.6
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Programming Language :: Python :: Implementation :: CPython
23
+ Requires-Python: >=3.6
24
+ Description-Content-Type: text/markdown
25
+
26
+ # token-utils
27
+
28
+ Installation: `pip install token-utils`.
29
+
30
+ The purpose of token-utils is to simplify manipulations of tokens normally
31
+ obtaind from Python's [tokenize module](https://docs.python.org/3/library/tokenize.html).
32
+ One of token-utils' features is that, unlike Python's version, the following
33
+ is always guaranteed:
34
+
35
+ ```python
36
+ from token_utils import tokenize, untokenize
37
+
38
+ source = "Arbitrary Python code here"
39
+
40
+ assert source == untokenize(tokenize(source))
41
+ ```
42
+
43
+ To get an idea of the simplicity of using token-utils,
44
+ consider [this example from Python's standard library](https://docs.python.org/3/library/tokenize.html#examples) which substitute Decimals for floats in a string of statements:
45
+
46
+ ```python
47
+ from tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP
48
+ from io import BytesIO
49
+
50
+ def decistmt(s):
51
+ result = []
52
+ g = tokenize(BytesIO(s.encode('utf-8')).readline) # tokenize the string
53
+ for toknum, tokval, _, _, _ in g:
54
+ if toknum == NUMBER and '.' in tokval: # replace NUMBER tokens
55
+ result.extend([
56
+ (NAME, 'Decimal'),
57
+ (OP, '('),
58
+ (STRING, repr(tokval)),
59
+ (OP, ')')
60
+ ])
61
+ else:
62
+ result.append((toknum, tokval))
63
+ return untokenize(result).decode('utf-8')
64
+ ```
65
+
66
+ Here's how you could achieve the same result with token-utils:
67
+
68
+ ```python
69
+ from token_utils import tokenize, untokenize
70
+
71
+ def decistmt(source):
72
+ tokens = tokenize(source)
73
+ for token in tokens:
74
+ if token.is_float():
75
+ token.string = f"Decimal('{token.string}')"
76
+ return untokenize(tokens)
77
+ ```
78
+
79
+ See [the documentation](https://aroberge.github.io/token-utils/docs/html/) for more information.
@@ -0,0 +1,54 @@
1
+ # token-utils
2
+
3
+ Installation: `pip install token-utils`.
4
+
5
+ The purpose of token-utils is to simplify manipulations of tokens normally
6
+ obtaind from Python's [tokenize module](https://docs.python.org/3/library/tokenize.html).
7
+ One of token-utils' features is that, unlike Python's version, the following
8
+ is always guaranteed:
9
+
10
+ ```python
11
+ from token_utils import tokenize, untokenize
12
+
13
+ source = "Arbitrary Python code here"
14
+
15
+ assert source == untokenize(tokenize(source))
16
+ ```
17
+
18
+ To get an idea of the simplicity of using token-utils,
19
+ consider [this example from Python's standard library](https://docs.python.org/3/library/tokenize.html#examples) which substitute Decimals for floats in a string of statements:
20
+
21
+ ```python
22
+ from tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP
23
+ from io import BytesIO
24
+
25
+ def decistmt(s):
26
+ result = []
27
+ g = tokenize(BytesIO(s.encode('utf-8')).readline) # tokenize the string
28
+ for toknum, tokval, _, _, _ in g:
29
+ if toknum == NUMBER and '.' in tokval: # replace NUMBER tokens
30
+ result.extend([
31
+ (NAME, 'Decimal'),
32
+ (OP, '('),
33
+ (STRING, repr(tokval)),
34
+ (OP, ')')
35
+ ])
36
+ else:
37
+ result.append((toknum, tokval))
38
+ return untokenize(result).decode('utf-8')
39
+ ```
40
+
41
+ Here's how you could achieve the same result with token-utils:
42
+
43
+ ```python
44
+ from token_utils import tokenize, untokenize
45
+
46
+ def decistmt(source):
47
+ tokens = tokenize(source)
48
+ for token in tokens:
49
+ if token.is_float():
50
+ token.string = f"Decimal('{token.string}')"
51
+ return untokenize(tokens)
52
+ ```
53
+
54
+ See [the documentation](https://aroberge.github.io/token-utils/docs/html/) for more information.
@@ -0,0 +1,50 @@
1
+ echo off
2
+ REM Default is Python 3.9
3
+
4
+ if "%1"=="3.6" goto py_36
5
+ if "%1"=="3.7" goto py_37
6
+ if "%1"=="3.8" goto py_38
7
+ if "%1"=="3.9" goto py_39
8
+ if "%1"=="3.10" goto py_310
9
+ if "%1"=="3.11" goto py_311
10
+ if "%1"=="3.12" goto py_312
11
+ if "%1"=="3.13" goto py_313
12
+ if "%1"=="3.14" goto py_314
13
+
14
+ :py_39
15
+ venv-token3.9\scripts\activate
16
+ goto end
17
+
18
+ :py_36
19
+ venv-token3.6\scripts\activate
20
+ goto end
21
+
22
+ :py_37
23
+ venv-token3.7\scripts\activate
24
+ goto end
25
+
26
+ :py_38
27
+ venv-token3.8\scripts\activate
28
+ goto end
29
+
30
+ :py_310
31
+ venv-token3.10\scripts\activate
32
+ goto end
33
+
34
+ :py_311
35
+ venv-token3.11\scripts\activate
36
+ goto end
37
+
38
+ :py_312
39
+ venv-token3.12\scripts\activate
40
+ goto end
41
+
42
+ :py_313
43
+ venv-token3.13\scripts\activate
44
+ goto end
45
+
46
+ :py_314
47
+ venv-token3.14\scripts\activate
48
+ goto end
49
+
50
+ :end
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line.
5
+ SPHINXOPTS =
6
+ SPHINXBUILD = sphinx-build
7
+ SPHINXPROJ = token-utils
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)