diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 07:00:22 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 07:00:22 +0000 |
commit | 02b1774bd1236384116b2e8d088d9ec0efc866e2 (patch) | |
tree | bd80db5769e0fe8fe2cbb4106b56abaeb64d23d6 | |
parent | f82ffe08117a17c508af1f65c9df7ce5d7dba0b0 (diff) |
automatic import of python-hypothesmithopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-hypothesmith.spec | 260 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 262 insertions, 0 deletions
@@ -0,0 +1 @@ +/hypothesmith-0.2.3.tar.gz diff --git a/python-hypothesmith.spec b/python-hypothesmith.spec new file mode 100644 index 0000000..0effdf3 --- /dev/null +++ b/python-hypothesmith.spec @@ -0,0 +1,260 @@ +%global _empty_manifest_terminate_build 0 +Name: python-hypothesmith +Version: 0.2.3 +Release: 1 +Summary: Hypothesis strategies for generating Python programs, something like CSmith +License: MPL 2.0 +URL: https://github.com/Zac-HD/hypothesmith +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/08/6b/514cefcb28a4fe9e65309ef3ed14aeb066dc71ea4fe5d937976d2125dc32/hypothesmith-0.2.3.tar.gz +BuildArch: noarch + +Requires: python3-hypothesis[lark] +Requires: python3-libcst + +%description +# hypothesmith +Hypothesis strategies for generating Python programs, something like CSmith. + +This is definitely pre-alpha, but if you want to play with it feel free! +You can even keep the shiny pieces when - not if - it breaks. + +Get it today with [`pip install hypothesmith`](https://pypi.org/project/hypothesmith/), +or by cloning [the GitHub repo](https://github.com/Zac-HD/hypothesmith). + +You can run the tests, such as they are, with `tox` on Python 3.6 or later. +Use `tox -va` to see what environments are available. + +## Usage +This package provides two Hypothesis strategies for generating Python source code. + +The generated code will always be syntatically valid, and is useful for testing +parsers, linters, auto-formatters, and other tools that operate on source code. + +> DO NOT EXECUTE CODE GENERATED BY THESE STRATEGIES. +> +> It could do literally anything that running Python code is able to do, +> including changing, deleting, or uploading important data. Arbitrary +> code can be useful, but "arbitrary code execution" can be very, very bad. + +#### `hypothesmith.from_grammar(start="file_input", *, auto_target=True)` + +Generates syntactically-valid Python source code based on the grammar. + +Valid values for ``start`` are ``"single_input"``, ``"file_input"``, or +``"eval_input"``; respectively a single interactive statement, a module or +sequence of commands read from a file, and input for the eval() function. + +If ``auto_target`` is ``True``, this strategy uses ``hypothesis.target()`` +internally to drive towards larger and more complex examples. We recommend +leaving this enabled, as the grammar is quite complex and only simple examples +tend to be generated otherwise. + +#### `hypothesmith.from_node(node=libcst.Module, *, auto_target=True)` + +Generates syntactically-valid Python source code based on the node types +defined by the [`LibCST`](https://libcst.readthedocs.io/en/latest/) project. + +You can pass any subtype of `libcst.CSTNode`. Alternatively, you can use +Hypothesis' built-in `from_type(node_type).map(lambda n: libcst.Module([n]).code`, +after Hypothesmith has registered the required strategies. However, this does +not include automatic targeting and limitations of LibCST may lead to invalid +code being generated. + +## Notable bugs found with Hypothesmith +- [BPO-40661, a segfault in the new parser](https://bugs.python.org/issue40661), + was given maximum priority and blocked the planned release of CPython 3.9 beta1. +- [BPO-38953](https://bugs.python.org/issue38953) `tokenize` -> `untokenize` roundtrip bugs. +- [BPO-42218](https://bugs.python.org/issue42218) mishandled error case in new PEG parser. +- [`lib2to3` errors on \r in comment](https://github.com/psf/black/issues/970) +- [Black fails on files ending in a backslash](https://github.com/psf/black/issues/1012) +- [At least three round-trip bugs in LibCST](https://github.com/Instagram/LibCST#acknowledgements) + ([search commits for "hypothesis"](https://github.com/Instagram/LibCST/search?q=Fix+hypothesis&type=commits)) +- [Invalid code generated by LibCST](https://github.com/Instagram/LibCST/issues/287) + +### Changelog + +Patch notes [can be found in `CHANGELOG.md`](https://github.com/Zac-HD/hypothesmith/blob/master/CHANGELOG.md). + + +%package -n python3-hypothesmith +Summary: Hypothesis strategies for generating Python programs, something like CSmith +Provides: python-hypothesmith +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-hypothesmith +# hypothesmith +Hypothesis strategies for generating Python programs, something like CSmith. + +This is definitely pre-alpha, but if you want to play with it feel free! +You can even keep the shiny pieces when - not if - it breaks. + +Get it today with [`pip install hypothesmith`](https://pypi.org/project/hypothesmith/), +or by cloning [the GitHub repo](https://github.com/Zac-HD/hypothesmith). + +You can run the tests, such as they are, with `tox` on Python 3.6 or later. +Use `tox -va` to see what environments are available. + +## Usage +This package provides two Hypothesis strategies for generating Python source code. + +The generated code will always be syntatically valid, and is useful for testing +parsers, linters, auto-formatters, and other tools that operate on source code. + +> DO NOT EXECUTE CODE GENERATED BY THESE STRATEGIES. +> +> It could do literally anything that running Python code is able to do, +> including changing, deleting, or uploading important data. Arbitrary +> code can be useful, but "arbitrary code execution" can be very, very bad. + +#### `hypothesmith.from_grammar(start="file_input", *, auto_target=True)` + +Generates syntactically-valid Python source code based on the grammar. + +Valid values for ``start`` are ``"single_input"``, ``"file_input"``, or +``"eval_input"``; respectively a single interactive statement, a module or +sequence of commands read from a file, and input for the eval() function. + +If ``auto_target`` is ``True``, this strategy uses ``hypothesis.target()`` +internally to drive towards larger and more complex examples. We recommend +leaving this enabled, as the grammar is quite complex and only simple examples +tend to be generated otherwise. + +#### `hypothesmith.from_node(node=libcst.Module, *, auto_target=True)` + +Generates syntactically-valid Python source code based on the node types +defined by the [`LibCST`](https://libcst.readthedocs.io/en/latest/) project. + +You can pass any subtype of `libcst.CSTNode`. Alternatively, you can use +Hypothesis' built-in `from_type(node_type).map(lambda n: libcst.Module([n]).code`, +after Hypothesmith has registered the required strategies. However, this does +not include automatic targeting and limitations of LibCST may lead to invalid +code being generated. + +## Notable bugs found with Hypothesmith +- [BPO-40661, a segfault in the new parser](https://bugs.python.org/issue40661), + was given maximum priority and blocked the planned release of CPython 3.9 beta1. +- [BPO-38953](https://bugs.python.org/issue38953) `tokenize` -> `untokenize` roundtrip bugs. +- [BPO-42218](https://bugs.python.org/issue42218) mishandled error case in new PEG parser. +- [`lib2to3` errors on \r in comment](https://github.com/psf/black/issues/970) +- [Black fails on files ending in a backslash](https://github.com/psf/black/issues/1012) +- [At least three round-trip bugs in LibCST](https://github.com/Instagram/LibCST#acknowledgements) + ([search commits for "hypothesis"](https://github.com/Instagram/LibCST/search?q=Fix+hypothesis&type=commits)) +- [Invalid code generated by LibCST](https://github.com/Instagram/LibCST/issues/287) + +### Changelog + +Patch notes [can be found in `CHANGELOG.md`](https://github.com/Zac-HD/hypothesmith/blob/master/CHANGELOG.md). + + +%package help +Summary: Development documents and examples for hypothesmith +Provides: python3-hypothesmith-doc +%description help +# hypothesmith +Hypothesis strategies for generating Python programs, something like CSmith. + +This is definitely pre-alpha, but if you want to play with it feel free! +You can even keep the shiny pieces when - not if - it breaks. + +Get it today with [`pip install hypothesmith`](https://pypi.org/project/hypothesmith/), +or by cloning [the GitHub repo](https://github.com/Zac-HD/hypothesmith). + +You can run the tests, such as they are, with `tox` on Python 3.6 or later. +Use `tox -va` to see what environments are available. + +## Usage +This package provides two Hypothesis strategies for generating Python source code. + +The generated code will always be syntatically valid, and is useful for testing +parsers, linters, auto-formatters, and other tools that operate on source code. + +> DO NOT EXECUTE CODE GENERATED BY THESE STRATEGIES. +> +> It could do literally anything that running Python code is able to do, +> including changing, deleting, or uploading important data. Arbitrary +> code can be useful, but "arbitrary code execution" can be very, very bad. + +#### `hypothesmith.from_grammar(start="file_input", *, auto_target=True)` + +Generates syntactically-valid Python source code based on the grammar. + +Valid values for ``start`` are ``"single_input"``, ``"file_input"``, or +``"eval_input"``; respectively a single interactive statement, a module or +sequence of commands read from a file, and input for the eval() function. + +If ``auto_target`` is ``True``, this strategy uses ``hypothesis.target()`` +internally to drive towards larger and more complex examples. We recommend +leaving this enabled, as the grammar is quite complex and only simple examples +tend to be generated otherwise. + +#### `hypothesmith.from_node(node=libcst.Module, *, auto_target=True)` + +Generates syntactically-valid Python source code based on the node types +defined by the [`LibCST`](https://libcst.readthedocs.io/en/latest/) project. + +You can pass any subtype of `libcst.CSTNode`. Alternatively, you can use +Hypothesis' built-in `from_type(node_type).map(lambda n: libcst.Module([n]).code`, +after Hypothesmith has registered the required strategies. However, this does +not include automatic targeting and limitations of LibCST may lead to invalid +code being generated. + +## Notable bugs found with Hypothesmith +- [BPO-40661, a segfault in the new parser](https://bugs.python.org/issue40661), + was given maximum priority and blocked the planned release of CPython 3.9 beta1. +- [BPO-38953](https://bugs.python.org/issue38953) `tokenize` -> `untokenize` roundtrip bugs. +- [BPO-42218](https://bugs.python.org/issue42218) mishandled error case in new PEG parser. +- [`lib2to3` errors on \r in comment](https://github.com/psf/black/issues/970) +- [Black fails on files ending in a backslash](https://github.com/psf/black/issues/1012) +- [At least three round-trip bugs in LibCST](https://github.com/Instagram/LibCST#acknowledgements) + ([search commits for "hypothesis"](https://github.com/Instagram/LibCST/search?q=Fix+hypothesis&type=commits)) +- [Invalid code generated by LibCST](https://github.com/Instagram/LibCST/issues/287) + +### Changelog + +Patch notes [can be found in `CHANGELOG.md`](https://github.com/Zac-HD/hypothesmith/blob/master/CHANGELOG.md). + + +%prep +%autosetup -n hypothesmith-0.2.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-hypothesmith -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.3-1 +- Package Spec generated @@ -0,0 +1 @@ +7f22fda08f7262ceb53a562025dc59b4 hypothesmith-0.2.3.tar.gz |