android-notify 1.60.0__py3-none-any.whl → 1.60.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of android-notify might be problematic. Click here for more details.
- android_notify/config.py +1 -1
- {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/METADATA +4 -4
- {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/RECORD +375 -6
- venv/Lib/site-packages/_distutils_hack/__init__.py +239 -0
- venv/Lib/site-packages/_distutils_hack/override.py +1 -0
- venv/Lib/site-packages/pkg_resources/__init__.py +3713 -0
- venv/Lib/site-packages/pkg_resources/py.typed +0 -0
- venv/Lib/site-packages/pkg_resources/tests/__init__.py +0 -0
- venv/Lib/site-packages/pkg_resources/tests/data/my-test-package-source/setup.py +7 -0
- venv/Lib/site-packages/pkg_resources/tests/test_find_distributions.py +56 -0
- venv/Lib/site-packages/pkg_resources/tests/test_integration_zope_interface.py +54 -0
- venv/Lib/site-packages/pkg_resources/tests/test_markers.py +8 -0
- venv/Lib/site-packages/pkg_resources/tests/test_pkg_resources.py +485 -0
- venv/Lib/site-packages/pkg_resources/tests/test_resources.py +869 -0
- venv/Lib/site-packages/pkg_resources/tests/test_working_set.py +505 -0
- venv/Lib/site-packages/setuptools/__init__.py +248 -0
- venv/Lib/site-packages/setuptools/_core_metadata.py +337 -0
- venv/Lib/site-packages/setuptools/_discovery.py +33 -0
- venv/Lib/site-packages/setuptools/_distutils/__init__.py +14 -0
- venv/Lib/site-packages/setuptools/_distutils/_log.py +3 -0
- venv/Lib/site-packages/setuptools/_distutils/_macos_compat.py +12 -0
- venv/Lib/site-packages/setuptools/_distutils/_modified.py +95 -0
- venv/Lib/site-packages/setuptools/_distutils/_msvccompiler.py +16 -0
- venv/Lib/site-packages/setuptools/_distutils/archive_util.py +294 -0
- venv/Lib/site-packages/setuptools/_distutils/ccompiler.py +26 -0
- venv/Lib/site-packages/setuptools/_distutils/cmd.py +554 -0
- venv/Lib/site-packages/setuptools/_distutils/command/__init__.py +23 -0
- venv/Lib/site-packages/setuptools/_distutils/command/_framework_compat.py +54 -0
- venv/Lib/site-packages/setuptools/_distutils/command/bdist.py +167 -0
- venv/Lib/site-packages/setuptools/_distutils/command/bdist_dumb.py +141 -0
- venv/Lib/site-packages/setuptools/_distutils/command/bdist_rpm.py +598 -0
- venv/Lib/site-packages/setuptools/_distutils/command/build.py +156 -0
- venv/Lib/site-packages/setuptools/_distutils/command/build_clib.py +201 -0
- venv/Lib/site-packages/setuptools/_distutils/command/build_ext.py +812 -0
- venv/Lib/site-packages/setuptools/_distutils/command/build_py.py +407 -0
- venv/Lib/site-packages/setuptools/_distutils/command/build_scripts.py +160 -0
- venv/Lib/site-packages/setuptools/_distutils/command/check.py +152 -0
- venv/Lib/site-packages/setuptools/_distutils/command/clean.py +77 -0
- venv/Lib/site-packages/setuptools/_distutils/command/config.py +358 -0
- venv/Lib/site-packages/setuptools/_distutils/command/install.py +805 -0
- venv/Lib/site-packages/setuptools/_distutils/command/install_data.py +94 -0
- venv/Lib/site-packages/setuptools/_distutils/command/install_egg_info.py +91 -0
- venv/Lib/site-packages/setuptools/_distutils/command/install_headers.py +46 -0
- venv/Lib/site-packages/setuptools/_distutils/command/install_lib.py +238 -0
- venv/Lib/site-packages/setuptools/_distutils/command/install_scripts.py +62 -0
- venv/Lib/site-packages/setuptools/_distutils/command/sdist.py +521 -0
- venv/Lib/site-packages/setuptools/_distutils/compat/__init__.py +18 -0
- venv/Lib/site-packages/setuptools/_distutils/compat/numpy.py +2 -0
- venv/Lib/site-packages/setuptools/_distutils/compat/py39.py +66 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/base.py +1394 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/cygwin.py +340 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/errors.py +24 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/msvc.py +614 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_base.py +83 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py +76 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_mingw.py +48 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py +136 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_unix.py +413 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/unix.py +422 -0
- venv/Lib/site-packages/setuptools/_distutils/compilers/C/zos.py +230 -0
- venv/Lib/site-packages/setuptools/_distutils/core.py +289 -0
- venv/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +31 -0
- venv/Lib/site-packages/setuptools/_distutils/debug.py +5 -0
- venv/Lib/site-packages/setuptools/_distutils/dep_util.py +14 -0
- venv/Lib/site-packages/setuptools/_distutils/dir_util.py +244 -0
- venv/Lib/site-packages/setuptools/_distutils/dist.py +1386 -0
- venv/Lib/site-packages/setuptools/_distutils/errors.py +108 -0
- venv/Lib/site-packages/setuptools/_distutils/extension.py +258 -0
- venv/Lib/site-packages/setuptools/_distutils/fancy_getopt.py +471 -0
- venv/Lib/site-packages/setuptools/_distutils/file_util.py +236 -0
- venv/Lib/site-packages/setuptools/_distutils/filelist.py +431 -0
- venv/Lib/site-packages/setuptools/_distutils/log.py +56 -0
- venv/Lib/site-packages/setuptools/_distutils/spawn.py +134 -0
- venv/Lib/site-packages/setuptools/_distutils/sysconfig.py +598 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/__init__.py +42 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/compat/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/compat/py39.py +40 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/support.py +134 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_archive_util.py +353 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_bdist.py +47 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_bdist_dumb.py +78 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_bdist_rpm.py +127 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_build.py +49 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_build_clib.py +134 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +628 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_build_py.py +196 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_build_scripts.py +96 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_check.py +194 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_clean.py +45 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_cmd.py +107 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_config_cmd.py +87 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_core.py +130 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_dir_util.py +139 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_dist.py +552 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_extension.py +117 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_file_util.py +95 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_filelist.py +336 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_install.py +245 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_install_data.py +74 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_install_headers.py +33 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_install_lib.py +110 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_install_scripts.py +52 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_log.py +12 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_modified.py +126 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_sdist.py +470 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_spawn.py +141 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_sysconfig.py +319 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_text_file.py +127 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_util.py +243 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_version.py +80 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/test_versionpredicate.py +0 -0
- venv/Lib/site-packages/setuptools/_distutils/tests/unix_compat.py +17 -0
- venv/Lib/site-packages/setuptools/_distutils/text_file.py +286 -0
- venv/Lib/site-packages/setuptools/_distutils/unixccompiler.py +9 -0
- venv/Lib/site-packages/setuptools/_distutils/util.py +518 -0
- venv/Lib/site-packages/setuptools/_distutils/version.py +348 -0
- venv/Lib/site-packages/setuptools/_distutils/versionpredicate.py +175 -0
- venv/Lib/site-packages/setuptools/_distutils/zosccompiler.py +3 -0
- venv/Lib/site-packages/setuptools/_entry_points.py +94 -0
- venv/Lib/site-packages/setuptools/_imp.py +87 -0
- venv/Lib/site-packages/setuptools/_importlib.py +9 -0
- venv/Lib/site-packages/setuptools/_itertools.py +23 -0
- venv/Lib/site-packages/setuptools/_normalization.py +177 -0
- venv/Lib/site-packages/setuptools/_path.py +93 -0
- venv/Lib/site-packages/setuptools/_reqs.py +42 -0
- venv/Lib/site-packages/setuptools/_scripts.py +361 -0
- venv/Lib/site-packages/setuptools/_shutil.py +59 -0
- venv/Lib/site-packages/setuptools/_static.py +188 -0
- venv/Lib/site-packages/setuptools/_vendor/autocommand/__init__.py +27 -0
- venv/Lib/site-packages/setuptools/_vendor/autocommand/autoasync.py +142 -0
- venv/Lib/site-packages/setuptools/_vendor/autocommand/autocommand.py +70 -0
- venv/Lib/site-packages/setuptools/_vendor/autocommand/automain.py +59 -0
- venv/Lib/site-packages/setuptools/_vendor/autocommand/autoparse.py +333 -0
- venv/Lib/site-packages/setuptools/_vendor/autocommand/errors.py +23 -0
- venv/Lib/site-packages/setuptools/_vendor/backports/__init__.py +1 -0
- venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/__init__.py +2937 -0
- venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/__main__.py +5 -0
- venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/compat/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/_vendor/backports/tarfile/compat/py38.py +24 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/__init__.py +1083 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py +83 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_collections.py +30 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_compat.py +57 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_functools.py +104 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py +73 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_meta.py +67 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/_text.py +99 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py +22 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py +36 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py +21 -0
- venv/Lib/site-packages/setuptools/_vendor/importlib_metadata/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/inflect/__init__.py +3986 -0
- venv/Lib/site-packages/setuptools/_vendor/inflect/compat/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/_vendor/inflect/compat/py38.py +7 -0
- venv/Lib/site-packages/setuptools/_vendor/inflect/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/collections/__init__.py +1091 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/collections/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/context.py +361 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/functools/__init__.py +633 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi +125 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/functools/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/text/__init__.py +624 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/text/layouts.py +25 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/text/show-newlines.py +33 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/text/strip-prefix.py +21 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/text/to-dvorak.py +6 -0
- venv/Lib/site-packages/setuptools/_vendor/jaraco/text/to-qwerty.py +6 -0
- venv/Lib/site-packages/setuptools/_vendor/more_itertools/__init__.py +6 -0
- venv/Lib/site-packages/setuptools/_vendor/more_itertools/__init__.pyi +2 -0
- venv/Lib/site-packages/setuptools/_vendor/more_itertools/more.py +4806 -0
- venv/Lib/site-packages/setuptools/_vendor/more_itertools/more.pyi +709 -0
- venv/Lib/site-packages/setuptools/_vendor/more_itertools/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/more_itertools/recipes.py +1046 -0
- venv/Lib/site-packages/setuptools/_vendor/more_itertools/recipes.pyi +136 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/__init__.py +15 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/_elffile.py +110 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/_manylinux.py +263 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/_musllinux.py +85 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/_parser.py +354 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/_structures.py +61 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/_tokenizer.py +194 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/licenses/__init__.py +145 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/licenses/_spdx.py +759 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/markers.py +331 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/metadata.py +863 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/requirements.py +91 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/specifiers.py +1020 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/tags.py +617 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/utils.py +163 -0
- venv/Lib/site-packages/setuptools/_vendor/packaging/version.py +582 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/__init__.py +627 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/__main__.py +55 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/android.py +249 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/api.py +292 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/macos.py +130 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/unix.py +275 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/version.py +16 -0
- venv/Lib/site-packages/setuptools/_vendor/platformdirs/windows.py +272 -0
- venv/Lib/site-packages/setuptools/_vendor/tomli/__init__.py +11 -0
- venv/Lib/site-packages/setuptools/_vendor/tomli/_parser.py +691 -0
- venv/Lib/site-packages/setuptools/_vendor/tomli/_re.py +107 -0
- venv/Lib/site-packages/setuptools/_vendor/tomli/_types.py +10 -0
- venv/Lib/site-packages/setuptools/_vendor/tomli/py.typed +1 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/__init__.py +48 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_checkers.py +993 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_config.py +108 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_decorators.py +235 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_exceptions.py +42 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_functions.py +308 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_importhook.py +213 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_memo.py +48 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_pytest_plugin.py +127 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_suppression.py +86 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_transformer.py +1229 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_union_transformer.py +55 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/_utils.py +173 -0
- venv/Lib/site-packages/setuptools/_vendor/typeguard/py.typed +0 -0
- venv/Lib/site-packages/setuptools/_vendor/typing_extensions.py +3641 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/__init__.py +3 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/__main__.py +23 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/_bdist_wheel.py +613 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/_setuptools_logging.py +26 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/bdist_wheel.py +26 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/cli/__init__.py +155 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/cli/convert.py +332 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/cli/pack.py +85 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/cli/tags.py +139 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/cli/unpack.py +30 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/macosx_libfile.py +482 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/metadata.py +183 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/util.py +17 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_elffile.py +108 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_manylinux.py +260 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_musllinux.py +83 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_parser.py +356 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_structures.py +61 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py +192 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/markers.py +253 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/requirements.py +90 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/specifiers.py +1011 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/tags.py +571 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/utils.py +172 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/vendored/packaging/version.py +561 -0
- venv/Lib/site-packages/setuptools/_vendor/wheel/wheelfile.py +227 -0
- venv/Lib/site-packages/setuptools/_vendor/zipp/__init__.py +501 -0
- venv/Lib/site-packages/setuptools/_vendor/zipp/compat/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/_vendor/zipp/compat/py310.py +11 -0
- venv/Lib/site-packages/setuptools/_vendor/zipp/glob.py +106 -0
- venv/Lib/site-packages/setuptools/archive_util.py +219 -0
- venv/Lib/site-packages/setuptools/build_meta.py +548 -0
- venv/Lib/site-packages/setuptools/command/__init__.py +21 -0
- venv/Lib/site-packages/setuptools/command/_requirestxt.py +131 -0
- venv/Lib/site-packages/setuptools/command/alias.py +77 -0
- venv/Lib/site-packages/setuptools/command/bdist_egg.py +477 -0
- venv/Lib/site-packages/setuptools/command/bdist_rpm.py +42 -0
- venv/Lib/site-packages/setuptools/command/bdist_wheel.py +604 -0
- venv/Lib/site-packages/setuptools/command/build.py +135 -0
- venv/Lib/site-packages/setuptools/command/build_clib.py +103 -0
- venv/Lib/site-packages/setuptools/command/build_ext.py +470 -0
- venv/Lib/site-packages/setuptools/command/build_py.py +400 -0
- venv/Lib/site-packages/setuptools/command/develop.py +55 -0
- venv/Lib/site-packages/setuptools/command/dist_info.py +103 -0
- venv/Lib/site-packages/setuptools/command/easy_install.py +30 -0
- venv/Lib/site-packages/setuptools/command/editable_wheel.py +908 -0
- venv/Lib/site-packages/setuptools/command/egg_info.py +718 -0
- venv/Lib/site-packages/setuptools/command/install.py +131 -0
- venv/Lib/site-packages/setuptools/command/install_egg_info.py +58 -0
- venv/Lib/site-packages/setuptools/command/install_lib.py +137 -0
- venv/Lib/site-packages/setuptools/command/install_scripts.py +67 -0
- venv/Lib/site-packages/setuptools/command/rotate.py +65 -0
- venv/Lib/site-packages/setuptools/command/saveopts.py +21 -0
- venv/Lib/site-packages/setuptools/command/sdist.py +217 -0
- venv/Lib/site-packages/setuptools/command/setopt.py +141 -0
- venv/Lib/site-packages/setuptools/command/test.py +45 -0
- venv/Lib/site-packages/setuptools/compat/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/compat/py310.py +20 -0
- venv/Lib/site-packages/setuptools/compat/py311.py +27 -0
- venv/Lib/site-packages/setuptools/compat/py312.py +13 -0
- venv/Lib/site-packages/setuptools/compat/py39.py +9 -0
- venv/Lib/site-packages/setuptools/config/__init__.py +43 -0
- venv/Lib/site-packages/setuptools/config/_apply_pyprojecttoml.py +526 -0
- venv/Lib/site-packages/setuptools/config/_validate_pyproject/__init__.py +34 -0
- venv/Lib/site-packages/setuptools/config/_validate_pyproject/error_reporting.py +336 -0
- venv/Lib/site-packages/setuptools/config/_validate_pyproject/extra_validations.py +82 -0
- venv/Lib/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py +51 -0
- venv/Lib/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_validations.py +1412 -0
- venv/Lib/site-packages/setuptools/config/_validate_pyproject/formats.py +402 -0
- venv/Lib/site-packages/setuptools/config/expand.py +452 -0
- venv/Lib/site-packages/setuptools/config/pyprojecttoml.py +468 -0
- venv/Lib/site-packages/setuptools/config/setupcfg.py +780 -0
- venv/Lib/site-packages/setuptools/depends.py +185 -0
- venv/Lib/site-packages/setuptools/discovery.py +614 -0
- venv/Lib/site-packages/setuptools/dist.py +1119 -0
- venv/Lib/site-packages/setuptools/errors.py +67 -0
- venv/Lib/site-packages/setuptools/extension.py +177 -0
- venv/Lib/site-packages/setuptools/glob.py +185 -0
- venv/Lib/site-packages/setuptools/installer.py +155 -0
- venv/Lib/site-packages/setuptools/launch.py +36 -0
- venv/Lib/site-packages/setuptools/logging.py +40 -0
- venv/Lib/site-packages/setuptools/modified.py +18 -0
- venv/Lib/site-packages/setuptools/monkey.py +126 -0
- venv/Lib/site-packages/setuptools/msvc.py +1536 -0
- venv/Lib/site-packages/setuptools/namespaces.py +106 -0
- venv/Lib/site-packages/setuptools/tests/__init__.py +13 -0
- venv/Lib/site-packages/setuptools/tests/compat/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/tests/compat/py39.py +3 -0
- venv/Lib/site-packages/setuptools/tests/config/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/tests/config/downloads/__init__.py +59 -0
- venv/Lib/site-packages/setuptools/tests/config/downloads/preload.py +18 -0
- venv/Lib/site-packages/setuptools/tests/config/test_apply_pyprojecttoml.py +772 -0
- venv/Lib/site-packages/setuptools/tests/config/test_expand.py +247 -0
- venv/Lib/site-packages/setuptools/tests/config/test_pyprojecttoml.py +396 -0
- venv/Lib/site-packages/setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py +109 -0
- venv/Lib/site-packages/setuptools/tests/config/test_setupcfg.py +980 -0
- venv/Lib/site-packages/setuptools/tests/contexts.py +131 -0
- venv/Lib/site-packages/setuptools/tests/environment.py +95 -0
- venv/Lib/site-packages/setuptools/tests/fixtures.py +392 -0
- venv/Lib/site-packages/setuptools/tests/integration/__init__.py +0 -0
- venv/Lib/site-packages/setuptools/tests/integration/helpers.py +77 -0
- venv/Lib/site-packages/setuptools/tests/integration/test_pbr.py +20 -0
- venv/Lib/site-packages/setuptools/tests/integration/test_pip_install_sdist.py +223 -0
- venv/Lib/site-packages/setuptools/tests/mod_with_constant.py +1 -0
- venv/Lib/site-packages/setuptools/tests/namespaces.py +90 -0
- venv/Lib/site-packages/setuptools/tests/script-with-bom.py +1 -0
- venv/Lib/site-packages/setuptools/tests/test_archive_util.py +36 -0
- venv/Lib/site-packages/setuptools/tests/test_bdist_deprecations.py +28 -0
- venv/Lib/site-packages/setuptools/tests/test_bdist_egg.py +73 -0
- venv/Lib/site-packages/setuptools/tests/test_bdist_wheel.py +708 -0
- venv/Lib/site-packages/setuptools/tests/test_build.py +33 -0
- venv/Lib/site-packages/setuptools/tests/test_build_clib.py +84 -0
- venv/Lib/site-packages/setuptools/tests/test_build_ext.py +293 -0
- venv/Lib/site-packages/setuptools/tests/test_build_meta.py +959 -0
- venv/Lib/site-packages/setuptools/tests/test_build_py.py +480 -0
- venv/Lib/site-packages/setuptools/tests/test_config_discovery.py +647 -0
- venv/Lib/site-packages/setuptools/tests/test_core_metadata.py +622 -0
- venv/Lib/site-packages/setuptools/tests/test_depends.py +15 -0
- venv/Lib/site-packages/setuptools/tests/test_develop.py +112 -0
- venv/Lib/site-packages/setuptools/tests/test_dist.py +278 -0
- venv/Lib/site-packages/setuptools/tests/test_dist_info.py +147 -0
- venv/Lib/site-packages/setuptools/tests/test_distutils_adoption.py +198 -0
- venv/Lib/site-packages/setuptools/tests/test_editable_install.py +1263 -0
- venv/Lib/site-packages/setuptools/tests/test_egg_info.py +1306 -0
- venv/Lib/site-packages/setuptools/tests/test_extern.py +15 -0
- venv/Lib/site-packages/setuptools/tests/test_find_packages.py +218 -0
- venv/Lib/site-packages/setuptools/tests/test_find_py_modules.py +73 -0
- venv/Lib/site-packages/setuptools/tests/test_glob.py +45 -0
- venv/Lib/site-packages/setuptools/tests/test_install_scripts.py +89 -0
- venv/Lib/site-packages/setuptools/tests/test_logging.py +76 -0
- venv/Lib/site-packages/setuptools/tests/test_manifest.py +622 -0
- venv/Lib/site-packages/setuptools/tests/test_namespaces.py +138 -0
- venv/Lib/site-packages/setuptools/tests/test_scripts.py +12 -0
- venv/Lib/site-packages/setuptools/tests/test_sdist.py +984 -0
- venv/Lib/site-packages/setuptools/tests/test_setopt.py +40 -0
- venv/Lib/site-packages/setuptools/tests/test_setuptools.py +290 -0
- venv/Lib/site-packages/setuptools/tests/test_shutil_wrapper.py +23 -0
- venv/Lib/site-packages/setuptools/tests/test_unicode_utils.py +10 -0
- venv/Lib/site-packages/setuptools/tests/test_virtualenv.py +113 -0
- venv/Lib/site-packages/setuptools/tests/test_warnings.py +106 -0
- venv/Lib/site-packages/setuptools/tests/test_wheel.py +690 -0
- venv/Lib/site-packages/setuptools/tests/test_windows_wrappers.py +258 -0
- venv/Lib/site-packages/setuptools/tests/text.py +4 -0
- venv/Lib/site-packages/setuptools/tests/textwrap.py +6 -0
- venv/Lib/site-packages/setuptools/unicode_utils.py +102 -0
- venv/Lib/site-packages/setuptools/version.py +6 -0
- venv/Lib/site-packages/setuptools/warnings.py +110 -0
- venv/Lib/site-packages/setuptools/wheel.py +261 -0
- venv/Lib/site-packages/setuptools/windows_support.py +30 -0
- {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/WHEEL +0 -0
- {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/entry_points.txt +0 -0
- {android_notify-1.60.0.dist-info → android_notify-1.60.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Copyright 2014-2015 Nathan West
|
|
2
|
+
#
|
|
3
|
+
# This file is part of autocommand.
|
|
4
|
+
#
|
|
5
|
+
# autocommand is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# autocommand is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with autocommand. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from asyncio import get_event_loop, iscoroutine
|
|
19
|
+
from functools import wraps
|
|
20
|
+
from inspect import signature
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async def _run_forever_coro(coro, args, kwargs, loop):
|
|
24
|
+
'''
|
|
25
|
+
This helper function launches an async main function that was tagged with
|
|
26
|
+
forever=True. There are two possibilities:
|
|
27
|
+
|
|
28
|
+
- The function is a normal function, which handles initializing the event
|
|
29
|
+
loop, which is then run forever
|
|
30
|
+
- The function is a coroutine, which needs to be scheduled in the event
|
|
31
|
+
loop, which is then run forever
|
|
32
|
+
- There is also the possibility that the function is a normal function
|
|
33
|
+
wrapping a coroutine function
|
|
34
|
+
|
|
35
|
+
The function is therefore called unconditionally and scheduled in the event
|
|
36
|
+
loop if the return value is a coroutine object.
|
|
37
|
+
|
|
38
|
+
The reason this is a separate function is to make absolutely sure that all
|
|
39
|
+
the objects created are garbage collected after all is said and done; we
|
|
40
|
+
do this to ensure that any exceptions raised in the tasks are collected
|
|
41
|
+
ASAP.
|
|
42
|
+
'''
|
|
43
|
+
|
|
44
|
+
# Personal note: I consider this an antipattern, as it relies on the use of
|
|
45
|
+
# unowned resources. The setup function dumps some stuff into the event
|
|
46
|
+
# loop where it just whirls in the ether without a well defined owner or
|
|
47
|
+
# lifetime. For this reason, there's a good chance I'll remove the
|
|
48
|
+
# forever=True feature from autoasync at some point in the future.
|
|
49
|
+
thing = coro(*args, **kwargs)
|
|
50
|
+
if iscoroutine(thing):
|
|
51
|
+
await thing
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def autoasync(coro=None, *, loop=None, forever=False, pass_loop=False):
|
|
55
|
+
'''
|
|
56
|
+
Convert an asyncio coroutine into a function which, when called, is
|
|
57
|
+
evaluted in an event loop, and the return value returned. This is intented
|
|
58
|
+
to make it easy to write entry points into asyncio coroutines, which
|
|
59
|
+
otherwise need to be explictly evaluted with an event loop's
|
|
60
|
+
run_until_complete.
|
|
61
|
+
|
|
62
|
+
If `loop` is given, it is used as the event loop to run the coro in. If it
|
|
63
|
+
is None (the default), the loop is retreived using asyncio.get_event_loop.
|
|
64
|
+
This call is defered until the decorated function is called, so that
|
|
65
|
+
callers can install custom event loops or event loop policies after
|
|
66
|
+
@autoasync is applied.
|
|
67
|
+
|
|
68
|
+
If `forever` is True, the loop is run forever after the decorated coroutine
|
|
69
|
+
is finished. Use this for servers created with asyncio.start_server and the
|
|
70
|
+
like.
|
|
71
|
+
|
|
72
|
+
If `pass_loop` is True, the event loop object is passed into the coroutine
|
|
73
|
+
as the `loop` kwarg when the wrapper function is called. In this case, the
|
|
74
|
+
wrapper function's __signature__ is updated to remove this parameter, so
|
|
75
|
+
that autoparse can still be used on it without generating a parameter for
|
|
76
|
+
`loop`.
|
|
77
|
+
|
|
78
|
+
This coroutine can be called with ( @autoasync(...) ) or without
|
|
79
|
+
( @autoasync ) arguments.
|
|
80
|
+
|
|
81
|
+
Examples:
|
|
82
|
+
|
|
83
|
+
@autoasync
|
|
84
|
+
def get_file(host, port):
|
|
85
|
+
reader, writer = yield from asyncio.open_connection(host, port)
|
|
86
|
+
data = reader.read()
|
|
87
|
+
sys.stdout.write(data.decode())
|
|
88
|
+
|
|
89
|
+
get_file(host, port)
|
|
90
|
+
|
|
91
|
+
@autoasync(forever=True, pass_loop=True)
|
|
92
|
+
def server(host, port, loop):
|
|
93
|
+
yield_from loop.create_server(Proto, host, port)
|
|
94
|
+
|
|
95
|
+
server('localhost', 8899)
|
|
96
|
+
|
|
97
|
+
'''
|
|
98
|
+
if coro is None:
|
|
99
|
+
return lambda c: autoasync(
|
|
100
|
+
c, loop=loop,
|
|
101
|
+
forever=forever,
|
|
102
|
+
pass_loop=pass_loop)
|
|
103
|
+
|
|
104
|
+
# The old and new signatures are required to correctly bind the loop
|
|
105
|
+
# parameter in 100% of cases, even if it's a positional parameter.
|
|
106
|
+
# NOTE: A future release will probably require the loop parameter to be
|
|
107
|
+
# a kwonly parameter.
|
|
108
|
+
if pass_loop:
|
|
109
|
+
old_sig = signature(coro)
|
|
110
|
+
new_sig = old_sig.replace(parameters=(
|
|
111
|
+
param for name, param in old_sig.parameters.items()
|
|
112
|
+
if name != "loop"))
|
|
113
|
+
|
|
114
|
+
@wraps(coro)
|
|
115
|
+
def autoasync_wrapper(*args, **kwargs):
|
|
116
|
+
# Defer the call to get_event_loop so that, if a custom policy is
|
|
117
|
+
# installed after the autoasync decorator, it is respected at call time
|
|
118
|
+
local_loop = get_event_loop() if loop is None else loop
|
|
119
|
+
|
|
120
|
+
# Inject the 'loop' argument. We have to use this signature binding to
|
|
121
|
+
# ensure it's injected in the correct place (positional, keyword, etc)
|
|
122
|
+
if pass_loop:
|
|
123
|
+
bound_args = old_sig.bind_partial()
|
|
124
|
+
bound_args.arguments.update(
|
|
125
|
+
loop=local_loop,
|
|
126
|
+
**new_sig.bind(*args, **kwargs).arguments)
|
|
127
|
+
args, kwargs = bound_args.args, bound_args.kwargs
|
|
128
|
+
|
|
129
|
+
if forever:
|
|
130
|
+
local_loop.create_task(_run_forever_coro(
|
|
131
|
+
coro, args, kwargs, local_loop
|
|
132
|
+
))
|
|
133
|
+
local_loop.run_forever()
|
|
134
|
+
else:
|
|
135
|
+
return local_loop.run_until_complete(coro(*args, **kwargs))
|
|
136
|
+
|
|
137
|
+
# Attach the updated signature. This allows 'pass_loop' to be used with
|
|
138
|
+
# autoparse
|
|
139
|
+
if pass_loop:
|
|
140
|
+
autoasync_wrapper.__signature__ = new_sig
|
|
141
|
+
|
|
142
|
+
return autoasync_wrapper
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Copyright 2014-2015 Nathan West
|
|
2
|
+
#
|
|
3
|
+
# This file is part of autocommand.
|
|
4
|
+
#
|
|
5
|
+
# autocommand is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# autocommand is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with autocommand. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from .autoparse import autoparse
|
|
19
|
+
from .automain import automain
|
|
20
|
+
try:
|
|
21
|
+
from .autoasync import autoasync
|
|
22
|
+
except ImportError: # pragma: no cover
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def autocommand(
|
|
27
|
+
module, *,
|
|
28
|
+
description=None,
|
|
29
|
+
epilog=None,
|
|
30
|
+
add_nos=False,
|
|
31
|
+
parser=None,
|
|
32
|
+
loop=None,
|
|
33
|
+
forever=False,
|
|
34
|
+
pass_loop=False):
|
|
35
|
+
|
|
36
|
+
if callable(module):
|
|
37
|
+
raise TypeError('autocommand requires a module name argument')
|
|
38
|
+
|
|
39
|
+
def autocommand_decorator(func):
|
|
40
|
+
# Step 1: if requested, run it all in an asyncio event loop. autoasync
|
|
41
|
+
# patches the __signature__ of the decorated function, so that in the
|
|
42
|
+
# event that pass_loop is True, the `loop` parameter of the original
|
|
43
|
+
# function will *not* be interpreted as a command-line argument by
|
|
44
|
+
# autoparse
|
|
45
|
+
if loop is not None or forever or pass_loop:
|
|
46
|
+
func = autoasync(
|
|
47
|
+
func,
|
|
48
|
+
loop=None if loop is True else loop,
|
|
49
|
+
pass_loop=pass_loop,
|
|
50
|
+
forever=forever)
|
|
51
|
+
|
|
52
|
+
# Step 2: create parser. We do this second so that the arguments are
|
|
53
|
+
# parsed and passed *before* entering the asyncio event loop, if it
|
|
54
|
+
# exists. This simplifies the stack trace and ensures errors are
|
|
55
|
+
# reported earlier. It also ensures that errors raised during parsing &
|
|
56
|
+
# passing are still raised if `forever` is True.
|
|
57
|
+
func = autoparse(
|
|
58
|
+
func,
|
|
59
|
+
description=description,
|
|
60
|
+
epilog=epilog,
|
|
61
|
+
add_nos=add_nos,
|
|
62
|
+
parser=parser)
|
|
63
|
+
|
|
64
|
+
# Step 3: call the function automatically if __name__ == '__main__' (or
|
|
65
|
+
# if True was provided)
|
|
66
|
+
func = automain(module)(func)
|
|
67
|
+
|
|
68
|
+
return func
|
|
69
|
+
|
|
70
|
+
return autocommand_decorator
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Copyright 2014-2015 Nathan West
|
|
2
|
+
#
|
|
3
|
+
# This file is part of autocommand.
|
|
4
|
+
#
|
|
5
|
+
# autocommand is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# autocommand is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with autocommand. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
import sys
|
|
19
|
+
from .errors import AutocommandError
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AutomainRequiresModuleError(AutocommandError, TypeError):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def automain(module, *, args=(), kwargs=None):
|
|
27
|
+
'''
|
|
28
|
+
This decorator automatically invokes a function if the module is being run
|
|
29
|
+
as the "__main__" module. Optionally, provide args or kwargs with which to
|
|
30
|
+
call the function. If `module` is "__main__", the function is called, and
|
|
31
|
+
the program is `sys.exit`ed with the return value. You can also pass `True`
|
|
32
|
+
to cause the function to be called unconditionally. If the function is not
|
|
33
|
+
called, it is returned unchanged by the decorator.
|
|
34
|
+
|
|
35
|
+
Usage:
|
|
36
|
+
|
|
37
|
+
@automain(__name__) # Pass __name__ to check __name__=="__main__"
|
|
38
|
+
def main():
|
|
39
|
+
...
|
|
40
|
+
|
|
41
|
+
If __name__ is "__main__" here, the main function is called, and then
|
|
42
|
+
sys.exit called with the return value.
|
|
43
|
+
'''
|
|
44
|
+
|
|
45
|
+
# Check that @automain(...) was called, rather than @automain
|
|
46
|
+
if callable(module):
|
|
47
|
+
raise AutomainRequiresModuleError(module)
|
|
48
|
+
|
|
49
|
+
if module == '__main__' or module is True:
|
|
50
|
+
if kwargs is None:
|
|
51
|
+
kwargs = {}
|
|
52
|
+
|
|
53
|
+
# Use a function definition instead of a lambda for a neater traceback
|
|
54
|
+
def automain_decorator(main):
|
|
55
|
+
sys.exit(main(*args, **kwargs))
|
|
56
|
+
|
|
57
|
+
return automain_decorator
|
|
58
|
+
else:
|
|
59
|
+
return lambda main: main
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# Copyright 2014-2015 Nathan West
|
|
2
|
+
#
|
|
3
|
+
# This file is part of autocommand.
|
|
4
|
+
#
|
|
5
|
+
# autocommand is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# autocommand is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with autocommand. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
import sys
|
|
19
|
+
from re import compile as compile_regex
|
|
20
|
+
from inspect import signature, getdoc, Parameter
|
|
21
|
+
from argparse import ArgumentParser
|
|
22
|
+
from contextlib import contextmanager
|
|
23
|
+
from functools import wraps
|
|
24
|
+
from io import IOBase
|
|
25
|
+
from autocommand.errors import AutocommandError
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_empty = Parameter.empty
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class AnnotationError(AutocommandError):
|
|
32
|
+
'''Annotation error: annotation must be a string, type, or tuple of both'''
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class PositionalArgError(AutocommandError):
|
|
36
|
+
'''
|
|
37
|
+
Postional Arg Error: autocommand can't handle postional-only parameters
|
|
38
|
+
'''
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class KWArgError(AutocommandError):
|
|
42
|
+
'''kwarg Error: autocommand can't handle a **kwargs parameter'''
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class DocstringError(AutocommandError):
|
|
46
|
+
'''Docstring error'''
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class TooManySplitsError(DocstringError):
|
|
50
|
+
'''
|
|
51
|
+
The docstring had too many ---- section splits. Currently we only support
|
|
52
|
+
using up to a single split, to split the docstring into description and
|
|
53
|
+
epilog parts.
|
|
54
|
+
'''
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _get_type_description(annotation):
|
|
58
|
+
'''
|
|
59
|
+
Given an annotation, return the (type, description) for the parameter.
|
|
60
|
+
If you provide an annotation that is somehow both a string and a callable,
|
|
61
|
+
the behavior is undefined.
|
|
62
|
+
'''
|
|
63
|
+
if annotation is _empty:
|
|
64
|
+
return None, None
|
|
65
|
+
elif callable(annotation):
|
|
66
|
+
return annotation, None
|
|
67
|
+
elif isinstance(annotation, str):
|
|
68
|
+
return None, annotation
|
|
69
|
+
elif isinstance(annotation, tuple):
|
|
70
|
+
try:
|
|
71
|
+
arg1, arg2 = annotation
|
|
72
|
+
except ValueError as e:
|
|
73
|
+
raise AnnotationError(annotation) from e
|
|
74
|
+
else:
|
|
75
|
+
if callable(arg1) and isinstance(arg2, str):
|
|
76
|
+
return arg1, arg2
|
|
77
|
+
elif isinstance(arg1, str) and callable(arg2):
|
|
78
|
+
return arg2, arg1
|
|
79
|
+
|
|
80
|
+
raise AnnotationError(annotation)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _add_arguments(param, parser, used_char_args, add_nos):
|
|
84
|
+
'''
|
|
85
|
+
Add the argument(s) to an ArgumentParser (using add_argument) for a given
|
|
86
|
+
parameter. used_char_args is the set of -short options currently already in
|
|
87
|
+
use, and is updated (if necessary) by this function. If add_nos is True,
|
|
88
|
+
this will also add an inverse switch for all boolean options. For
|
|
89
|
+
instance, for the boolean parameter "verbose", this will create --verbose
|
|
90
|
+
and --no-verbose.
|
|
91
|
+
'''
|
|
92
|
+
|
|
93
|
+
# Impl note: This function is kept separate from make_parser because it's
|
|
94
|
+
# already very long and I wanted to separate out as much as possible into
|
|
95
|
+
# its own call scope, to prevent even the possibility of suble mutation
|
|
96
|
+
# bugs.
|
|
97
|
+
if param.kind is param.POSITIONAL_ONLY:
|
|
98
|
+
raise PositionalArgError(param)
|
|
99
|
+
elif param.kind is param.VAR_KEYWORD:
|
|
100
|
+
raise KWArgError(param)
|
|
101
|
+
|
|
102
|
+
# These are the kwargs for the add_argument function.
|
|
103
|
+
arg_spec = {}
|
|
104
|
+
is_option = False
|
|
105
|
+
|
|
106
|
+
# Get the type and default from the annotation.
|
|
107
|
+
arg_type, description = _get_type_description(param.annotation)
|
|
108
|
+
|
|
109
|
+
# Get the default value
|
|
110
|
+
default = param.default
|
|
111
|
+
|
|
112
|
+
# If there is no explicit type, and the default is present and not None,
|
|
113
|
+
# infer the type from the default.
|
|
114
|
+
if arg_type is None and default not in {_empty, None}:
|
|
115
|
+
arg_type = type(default)
|
|
116
|
+
|
|
117
|
+
# Add default. The presence of a default means this is an option, not an
|
|
118
|
+
# argument.
|
|
119
|
+
if default is not _empty:
|
|
120
|
+
arg_spec['default'] = default
|
|
121
|
+
is_option = True
|
|
122
|
+
|
|
123
|
+
# Add the type
|
|
124
|
+
if arg_type is not None:
|
|
125
|
+
# Special case for bool: make it just a --switch
|
|
126
|
+
if arg_type is bool:
|
|
127
|
+
if not default or default is _empty:
|
|
128
|
+
arg_spec['action'] = 'store_true'
|
|
129
|
+
else:
|
|
130
|
+
arg_spec['action'] = 'store_false'
|
|
131
|
+
|
|
132
|
+
# Switches are always options
|
|
133
|
+
is_option = True
|
|
134
|
+
|
|
135
|
+
# Special case for file types: make it a string type, for filename
|
|
136
|
+
elif isinstance(default, IOBase):
|
|
137
|
+
arg_spec['type'] = str
|
|
138
|
+
|
|
139
|
+
# TODO: special case for list type.
|
|
140
|
+
# - How to specificy type of list members?
|
|
141
|
+
# - param: [int]
|
|
142
|
+
# - param: int =[]
|
|
143
|
+
# - action='append' vs nargs='*'
|
|
144
|
+
|
|
145
|
+
else:
|
|
146
|
+
arg_spec['type'] = arg_type
|
|
147
|
+
|
|
148
|
+
# nargs: if the signature includes *args, collect them as trailing CLI
|
|
149
|
+
# arguments in a list. *args can't have a default value, so it can never be
|
|
150
|
+
# an option.
|
|
151
|
+
if param.kind is param.VAR_POSITIONAL:
|
|
152
|
+
# TODO: consider depluralizing metavar/name here.
|
|
153
|
+
arg_spec['nargs'] = '*'
|
|
154
|
+
|
|
155
|
+
# Add description.
|
|
156
|
+
if description is not None:
|
|
157
|
+
arg_spec['help'] = description
|
|
158
|
+
|
|
159
|
+
# Get the --flags
|
|
160
|
+
flags = []
|
|
161
|
+
name = param.name
|
|
162
|
+
|
|
163
|
+
if is_option:
|
|
164
|
+
# Add the first letter as a -short option.
|
|
165
|
+
for letter in name[0], name[0].swapcase():
|
|
166
|
+
if letter not in used_char_args:
|
|
167
|
+
used_char_args.add(letter)
|
|
168
|
+
flags.append('-{}'.format(letter))
|
|
169
|
+
break
|
|
170
|
+
|
|
171
|
+
# If the parameter is a --long option, or is a -short option that
|
|
172
|
+
# somehow failed to get a flag, add it.
|
|
173
|
+
if len(name) > 1 or not flags:
|
|
174
|
+
flags.append('--{}'.format(name))
|
|
175
|
+
|
|
176
|
+
arg_spec['dest'] = name
|
|
177
|
+
else:
|
|
178
|
+
flags.append(name)
|
|
179
|
+
|
|
180
|
+
parser.add_argument(*flags, **arg_spec)
|
|
181
|
+
|
|
182
|
+
# Create the --no- version for boolean switches
|
|
183
|
+
if add_nos and arg_type is bool:
|
|
184
|
+
parser.add_argument(
|
|
185
|
+
'--no-{}'.format(name),
|
|
186
|
+
action='store_const',
|
|
187
|
+
dest=name,
|
|
188
|
+
const=default if default is not _empty else False)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def make_parser(func_sig, description, epilog, add_nos):
|
|
192
|
+
'''
|
|
193
|
+
Given the signature of a function, create an ArgumentParser
|
|
194
|
+
'''
|
|
195
|
+
parser = ArgumentParser(description=description, epilog=epilog)
|
|
196
|
+
|
|
197
|
+
used_char_args = {'h'}
|
|
198
|
+
|
|
199
|
+
# Arange the params so that single-character arguments are first. This
|
|
200
|
+
# esnures they don't have to get --long versions. sorted is stable, so the
|
|
201
|
+
# parameters will otherwise still be in relative order.
|
|
202
|
+
params = sorted(
|
|
203
|
+
func_sig.parameters.values(),
|
|
204
|
+
key=lambda param: len(param.name) > 1)
|
|
205
|
+
|
|
206
|
+
for param in params:
|
|
207
|
+
_add_arguments(param, parser, used_char_args, add_nos)
|
|
208
|
+
|
|
209
|
+
return parser
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
_DOCSTRING_SPLIT = compile_regex(r'\n\s*-{4,}\s*\n')
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def parse_docstring(docstring):
|
|
216
|
+
'''
|
|
217
|
+
Given a docstring, parse it into a description and epilog part
|
|
218
|
+
'''
|
|
219
|
+
if docstring is None:
|
|
220
|
+
return '', ''
|
|
221
|
+
|
|
222
|
+
parts = _DOCSTRING_SPLIT.split(docstring)
|
|
223
|
+
|
|
224
|
+
if len(parts) == 1:
|
|
225
|
+
return docstring, ''
|
|
226
|
+
elif len(parts) == 2:
|
|
227
|
+
return parts[0], parts[1]
|
|
228
|
+
else:
|
|
229
|
+
raise TooManySplitsError()
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def autoparse(
|
|
233
|
+
func=None, *,
|
|
234
|
+
description=None,
|
|
235
|
+
epilog=None,
|
|
236
|
+
add_nos=False,
|
|
237
|
+
parser=None):
|
|
238
|
+
'''
|
|
239
|
+
This decorator converts a function that takes normal arguments into a
|
|
240
|
+
function which takes a single optional argument, argv, parses it using an
|
|
241
|
+
argparse.ArgumentParser, and calls the underlying function with the parsed
|
|
242
|
+
arguments. If it is not given, sys.argv[1:] is used. This is so that the
|
|
243
|
+
function can be used as a setuptools entry point, as well as a normal main
|
|
244
|
+
function. sys.argv[1:] is not evaluated until the function is called, to
|
|
245
|
+
allow injecting different arguments for testing.
|
|
246
|
+
|
|
247
|
+
It uses the argument signature of the function to create an
|
|
248
|
+
ArgumentParser. Parameters without defaults become positional parameters,
|
|
249
|
+
while parameters *with* defaults become --options. Use annotations to set
|
|
250
|
+
the type of the parameter.
|
|
251
|
+
|
|
252
|
+
The `desctiption` and `epilog` parameters corrospond to the same respective
|
|
253
|
+
argparse parameters. If no description is given, it defaults to the
|
|
254
|
+
decorated functions's docstring, if present.
|
|
255
|
+
|
|
256
|
+
If add_nos is True, every boolean option (that is, every parameter with a
|
|
257
|
+
default of True/False or a type of bool) will have a --no- version created
|
|
258
|
+
as well, which inverts the option. For instance, the --verbose option will
|
|
259
|
+
have a --no-verbose counterpart. These are not mutually exclusive-
|
|
260
|
+
whichever one appears last in the argument list will have precedence.
|
|
261
|
+
|
|
262
|
+
If a parser is given, it is used instead of one generated from the function
|
|
263
|
+
signature. In this case, no parser is created; instead, the given parser is
|
|
264
|
+
used to parse the argv argument. The parser's results' argument names must
|
|
265
|
+
match up with the parameter names of the decorated function.
|
|
266
|
+
|
|
267
|
+
The decorated function is attached to the result as the `func` attribute,
|
|
268
|
+
and the parser is attached as the `parser` attribute.
|
|
269
|
+
'''
|
|
270
|
+
|
|
271
|
+
# If @autoparse(...) is used instead of @autoparse
|
|
272
|
+
if func is None:
|
|
273
|
+
return lambda f: autoparse(
|
|
274
|
+
f, description=description,
|
|
275
|
+
epilog=epilog,
|
|
276
|
+
add_nos=add_nos,
|
|
277
|
+
parser=parser)
|
|
278
|
+
|
|
279
|
+
func_sig = signature(func)
|
|
280
|
+
|
|
281
|
+
docstr_description, docstr_epilog = parse_docstring(getdoc(func))
|
|
282
|
+
|
|
283
|
+
if parser is None:
|
|
284
|
+
parser = make_parser(
|
|
285
|
+
func_sig,
|
|
286
|
+
description or docstr_description,
|
|
287
|
+
epilog or docstr_epilog,
|
|
288
|
+
add_nos)
|
|
289
|
+
|
|
290
|
+
@wraps(func)
|
|
291
|
+
def autoparse_wrapper(argv=None):
|
|
292
|
+
if argv is None:
|
|
293
|
+
argv = sys.argv[1:]
|
|
294
|
+
|
|
295
|
+
# Get empty argument binding, to fill with parsed arguments. This
|
|
296
|
+
# object does all the heavy lifting of turning named arguments into
|
|
297
|
+
# into correctly bound *args and **kwargs.
|
|
298
|
+
parsed_args = func_sig.bind_partial()
|
|
299
|
+
parsed_args.arguments.update(vars(parser.parse_args(argv)))
|
|
300
|
+
|
|
301
|
+
return func(*parsed_args.args, **parsed_args.kwargs)
|
|
302
|
+
|
|
303
|
+
# TODO: attach an updated __signature__ to autoparse_wrapper, just in case.
|
|
304
|
+
|
|
305
|
+
# Attach the wrapped function and parser, and return the wrapper.
|
|
306
|
+
autoparse_wrapper.func = func
|
|
307
|
+
autoparse_wrapper.parser = parser
|
|
308
|
+
return autoparse_wrapper
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
@contextmanager
|
|
312
|
+
def smart_open(filename_or_file, *args, **kwargs):
|
|
313
|
+
'''
|
|
314
|
+
This context manager allows you to open a filename, if you want to default
|
|
315
|
+
some already-existing file object, like sys.stdout, which shouldn't be
|
|
316
|
+
closed at the end of the context. If the filename argument is a str, bytes,
|
|
317
|
+
or int, the file object is created via a call to open with the given *args
|
|
318
|
+
and **kwargs, sent to the context, and closed at the end of the context,
|
|
319
|
+
just like "with open(filename) as f:". If it isn't one of the openable
|
|
320
|
+
types, the object simply sent to the context unchanged, and left unclosed
|
|
321
|
+
at the end of the context. Example:
|
|
322
|
+
|
|
323
|
+
def work_with_file(name=sys.stdout):
|
|
324
|
+
with smart_open(name) as f:
|
|
325
|
+
# Works correctly if name is a str filename or sys.stdout
|
|
326
|
+
print("Some stuff", file=f)
|
|
327
|
+
# If it was a filename, f is closed at the end here.
|
|
328
|
+
'''
|
|
329
|
+
if isinstance(filename_or_file, (str, bytes, int)):
|
|
330
|
+
with open(filename_or_file, *args, **kwargs) as file:
|
|
331
|
+
yield file
|
|
332
|
+
else:
|
|
333
|
+
yield filename_or_file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Copyright 2014-2016 Nathan West
|
|
2
|
+
#
|
|
3
|
+
# This file is part of autocommand.
|
|
4
|
+
#
|
|
5
|
+
# autocommand is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# autocommand is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with autocommand. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AutocommandError(Exception):
|
|
20
|
+
'''Base class for autocommand exceptions'''
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
# Individual modules will define errors specific to that module.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
|