Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-hypothesmith for openSUSE:Factory checked in at 2023-01-06 21:07:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-hypothesmith (Old) and /work/SRC/openSUSE:Factory/.python-hypothesmith.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hypothesmith" Fri Jan 6 21:07:28 2023 rev:6 rq:1044162 version:0.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-hypothesmith/python-hypothesmith.changes 2022-10-21 16:19:05.926122430 +0200 +++ /work/SRC/openSUSE:Factory/.python-hypothesmith.new.1563/python-hypothesmith.changes 2023-01-06 21:07:29.351742111 +0100 @@ -1,0 +2,23 @@ +Thu Dec 15 06:26:48 UTC 2022 - Daniel Garcia <daniel.gar...@suse.com> + +- Update requirements + +------------------------------------------------------------------- +Tue Dec 13 15:35:43 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 0.2.3 + * Actually package up the renamed grammar file this time. + +- Update to 0.2.2 - 2022-11-29 + * Correct the minimum required version of LibCST + * Use importlib.resources to load the Python grammar (zip-safe) + +------------------------------------------------------------------- +Tue Dec 6 03:35:17 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 0.2.1 - 2022-11-25 + * Use the lark package on PyPI, for Lark version 1.0+ (requires recent Hypothesis) + * Use updated Python grammar for from_grammar(), thanks to Lark updates + * Drop support for Python 3.6, add 3.10 and 3.11 to CI + +------------------------------------------------------------------- @@ -9,0 +33,9 @@ + +------------------------------------------------------------------- +Thu Sep 29 02:26:11 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to 0.2.0 - 2021-11-27 + More efficient generation of Python identifiers + Workaround for CPython parser bug in 3.9.8 (#16) Yes, yet another one - still, that's why hypothesmith exists... +- Update to 0.1.9 - 2021-08-19 + Fixed rare internal error when from_node() generated misplaced except: clauses Old: ---- hypothesmith-0.2.0.tar.gz New: ---- hypothesmith-0.2.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-hypothesmith.spec ++++++ --- /var/tmp/diff_new_pack.l7XQIR/_old 2023-01-06 21:07:29.835744896 +0100 +++ /var/tmp/diff_new_pack.l7XQIR/_new 2023-01-06 21:07:29.839744919 +0100 @@ -1,5 +1,5 @@ # -# spec file for package python-hypothesmith-test +# spec file # # Copyright (c) 2022 SUSE LLC # @@ -27,7 +27,7 @@ %bcond_with test %endif Name: python-hypothesmith%{psuffix} -Version: 0.2.0 +Version: 0.2.3 Release: 0 Summary: Hypothesis strategies for generating Python programs, something like CSmith License: MPL-2.0 @@ -37,15 +37,16 @@ BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-base >= 3.6 -Requires: python-hypothesis >= 5.46 -Requires: python-lark >= 0.7.2 -Requires: python-libcst >= 0.3.8 +Requires: python-base >= 3.7 +Requires: python-hypothesis >= 6.58.1 +Requires: python-lark >= 0.10.1 +Requires: python-libcst >= 0.4.0 %if %{with test} BuildRequires: %{python_module black} -BuildRequires: %{python_module hypothesis >= 5.46} -BuildRequires: %{python_module lark >= 0.7.2} -BuildRequires: %{python_module libcst >= 0.3.8} +BuildRequires: %{python_module exceptiongroup} +BuildRequires: %{python_module hypothesis >= 6.58.1} +BuildRequires: %{python_module lark >= 0.10.1} +BuildRequires: %{python_module libcst >= 0.4.0} BuildRequires: %{python_module parso} BuildRequires: %{python_module pytest-xdist} BuildRequires: %{python_module pytest} ++++++ hypothesmith-0.2.0.tar.gz -> hypothesmith-0.2.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/CHANGELOG.md new/hypothesmith-0.2.3/CHANGELOG.md --- old/hypothesmith-0.2.0/CHANGELOG.md 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/CHANGELOG.md 2022-12-01 10:33:46.000000000 +0100 @@ -1,5 +1,17 @@ # Changelog +### 0.2.3 - 2022-12-01 +- Actually package up the renamed grammar file this time. + +### 0.2.2 - 2022-11-29 +- Correct the minimum required version of LibCST +- Use `importlib.resources` to load the Python grammar (zip-safe) + +### 0.2.1 - 2022-11-25 +- Use the `lark` package on PyPI, for Lark version 1.0+ (requires recent Hypothesis) +- Use updated Python grammar for `from_grammar()`, thanks to Lark updates +- Drop support for Python 3.6, add 3.10 and 3.11 to CI + ### 0.2.0 - 2021-11-27 - More efficient generation of Python identifiers - Workaround for [CPython parser bug in 3.9.8](https://bugs.python.org/issue45738) (#16) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/PKG-INFO new/hypothesmith-0.2.3/PKG-INFO --- old/hypothesmith-0.2.0/PKG-INFO 2021-11-27 09:58:16.368064200 +0100 +++ new/hypothesmith-0.2.3/PKG-INFO 2022-12-01 10:33:54.383975000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesmith -Version: 0.2.0 +Version: 0.2.3 Summary: Hypothesis strategies for generating Python programs, something like CSmith Home-page: https://github.com/Zac-HD/hypothesmith Author: Zac Hatfield-Dodds @@ -8,19 +8,19 @@ License: MPL 2.0 Project-URL: Funding, https://github.com/sponsors/Zac-HD Keywords: python testing fuzzing property-based-testing -Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Hypothesis Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Testing -Requires-Python: >=3.6 +Requires-Python: >=3.7 Description-Content-Type: text/markdown License-File: LICENSE @@ -86,5 +86,3 @@ ### Changelog Patch notes [can be found in `CHANGELOG.md`](https://github.com/Zac-HD/hypothesmith/blob/master/CHANGELOG.md). - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/deps/check.txt new/hypothesmith-0.2.3/deps/check.txt --- old/hypothesmith-0.2.0/deps/check.txt 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/deps/check.txt 2022-12-01 10:33:46.000000000 +0100 @@ -4,43 +4,38 @@ # # pip-compile --output-file=deps/check.txt deps/check.in # -attrs==21.2.0 +attrs==22.1.0 # via flake8-bugbear -autoflake==1.4 +autoflake==2.0.0 # via shed -bandit==1.7.1 +bandit==1.7.4 # via flake8-bandit -black==21.11b1 +black==22.10.0 # via shed -click==8.0.3 +click==8.1.3 # via black -colorama==0.4.4 - # via - # bandit - # click -flake8==4.0.1 +com2ann==0.3.0 + # via shed +flake8==6.0.0 # via # -r deps/check.in # flake8-bandit # flake8-bugbear # flake8-comprehensions # flake8-docstrings - # flake8-polyfill -flake8-bandit==2.1.2 +flake8-bandit==4.1.1 # via -r deps/check.in -flake8-bugbear==21.9.2 +flake8-bugbear==22.10.27 # via -r deps/check.in -flake8-comprehensions==3.7.0 +flake8-comprehensions==3.10.1 # via -r deps/check.in flake8-docstrings==1.6.0 # via -r deps/check.in -flake8-polyfill==1.0.2 - # via flake8-bandit -gitdb==4.0.9 +gitdb==4.0.10 # via gitpython -gitpython==3.1.24 +gitpython==3.1.29 # via bandit -importlib-metadata==4.2.0 +importlib-metadata==5.1.0 # via # click # flake8 @@ -48,68 +43,60 @@ # stevedore isort==5.10.1 # via shed -libcst==0.3.23 +libcst==0.4.9 # via shed -mccabe==0.6.1 +mccabe==0.7.0 # via flake8 -mypy==0.910 +mypy==0.991 # via -r deps/check.in mypy-extensions==0.4.3 # via # black # mypy # typing-inspect -pathspec==0.9.0 +pathspec==0.10.2 # via black -pbr==5.8.0 +pbr==5.11.0 # via stevedore -platformdirs==2.4.0 +platformdirs==2.5.4 # via black -pycodestyle==2.8.0 - # via - # flake8 - # flake8-bandit +pycodestyle==2.10.0 + # via flake8 pydocstyle==6.1.1 # via flake8-docstrings -pyflakes==2.4.0 +pyflakes==3.0.1 # via # autoflake # flake8 -pyupgrade==2.29.1 +pyupgrade==3.2.2 # via shed pyyaml==6.0 # via # bandit # libcst -regex==2021.11.10 - # via black -shed==0.5.3 +shed==0.10.7 # via -r deps/check.in smmap==5.0.0 # via gitdb snowballstemmer==2.2.0 # via pydocstyle -stevedore==3.5.0 +stevedore==4.1.1 # via bandit -tokenize-rt==4.2.1 +tokenize-rt==5.0.0 # via pyupgrade -toml==0.10.2 - # via mypy -tomli==1.2.2 - # via black -typed-ast==1.4.3 +tomli==2.0.1 # via + # autoflake # black # mypy -typing-extensions==4.0.0 +typing-extensions==4.4.0 # via # black - # gitpython # importlib-metadata # libcst # mypy # typing-inspect -typing-inspect==0.7.1 +typing-inspect==0.8.0 # via libcst -zipp==3.6.0 +zipp==3.11.0 # via importlib-metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/deps/test.txt new/hypothesmith-0.2.3/deps/test.txt --- old/hypothesmith-0.2.0/deps/test.txt 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/deps/test.txt 2022-12-01 10:33:46.000000000 +0100 @@ -4,36 +4,34 @@ # # pip-compile --output-file=deps/test.txt deps/test.in setup.py # -atomicwrites==1.4.0 - # via pytest -attrs==21.2.0 +attrs==22.1.0 # via # hypothesis # pytest -black==21.11b1 +black==22.10.0 # via -r deps/test.in -click==8.0.3 +click==8.1.3 # via black -colorama==0.4.4 +coverage[toml]==6.5.0 + # via pytest-cov +exceptiongroup==1.0.4 # via - # click + # hypothesis # pytest -coverage[toml]==6.2 - # via pytest-cov execnet==1.9.0 # via pytest-xdist -hypothesis==6.27.2 +hypothesis[lark]==6.58.1 # via hypothesmith (setup.py) -importlib-metadata==4.8.2 +importlib-metadata==5.1.0 # via # click # pluggy # pytest iniconfig==1.1.1 # via pytest -lark-parser==0.12.0 - # via hypothesmith (setup.py) -libcst==0.3.23 +lark==1.1.4 + # via hypothesis +libcst==0.4.9 # via hypothesmith (setup.py) mypy-extensions==0.4.3 # via @@ -41,53 +39,43 @@ # typing-inspect packaging==21.3 # via pytest -parso==0.8.2 +parso==0.8.3 # via -r deps/test.in -pathspec==0.9.0 +pathspec==0.10.2 # via black -platformdirs==2.4.0 +platformdirs==2.5.4 # via black pluggy==1.0.0 # via pytest -py==1.11.0 - # via - # pytest - # pytest-forked -pyparsing==3.0.6 +pyparsing==3.0.9 # via packaging -pytest==6.2.5 +pytest==7.2.0 # via # -r deps/test.in # pytest-cov - # pytest-forked # pytest-xdist -pytest-cov==3.0.0 +pytest-cov==4.0.0 # via -r deps/test.in -pytest-forked==1.3.0 - # via pytest-xdist -pytest-xdist==2.4.0 +pytest-xdist==3.0.2 # via -r deps/test.in pyyaml==6.0 # via libcst -regex==2021.11.10 - # via black sortedcontainers==2.4.0 # via hypothesis -toml==0.10.2 - # via pytest -tomli==1.2.2 +tomli==2.0.1 # via # black # coverage -typed-ast==1.5.0 + # pytest +typed-ast==1.5.4 # via black -typing-extensions==4.0.0 +typing-extensions==4.4.0 # via # black # importlib-metadata # libcst # typing-inspect -typing-inspect==0.7.1 +typing-inspect==0.8.0 # via libcst -zipp==3.6.0 +zipp==3.11.0 # via importlib-metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/setup.py new/hypothesmith-0.2.3/setup.py --- old/hypothesmith-0.2.0/setup.py 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/setup.py 2022-12-01 10:33:46.000000000 +0100 @@ -26,14 +26,14 @@ author_email="zac@hypothesis.works", packages=setuptools.find_packages(SOURCE), package_dir={"": SOURCE}, - package_data={"": ["py.typed", "python3.lark"]}, + package_data={"": ["py.typed", "python.lark"]}, url="https://github.com/Zac-HD/hypothesmith", project_urls={"Funding": "https://github.com/sponsors/Zac-HD"}, license="MPL 2.0", description="Hypothesis strategies for generating Python programs, something like CSmith", zip_safe=False, - install_requires=["hypothesis>=5.41.0", "lark-parser>=0.7.2", "libcst>=0.3.8"], - python_requires=">=3.6", + install_requires=["hypothesis[lark]>=6.58.1", "libcst>=0.4.0"], + python_requires=">=3.7", classifiers=[ "Development Status :: 4 - Beta", "Framework :: Hypothesis", @@ -41,10 +41,11 @@ "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Testing", ], long_description=open(README).read(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith/__init__.py new/hypothesmith-0.2.3/src/hypothesmith/__init__.py --- old/hypothesmith-0.2.0/src/hypothesmith/__init__.py 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith/__init__.py 2022-12-01 10:33:46.000000000 +0100 @@ -3,5 +3,5 @@ from hypothesmith.cst import from_node from hypothesmith.syntactic import from_grammar -__version__ = "0.2.0" +__version__ = "0.2.3" __all__ = ["from_grammar", "from_node"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith/cst.py new/hypothesmith-0.2.3/src/hypothesmith/cst.py --- old/hypothesmith-0.2.0/src/hypothesmith/cst.py 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith/cst.py 2022-12-01 10:33:46.000000000 +0100 @@ -96,6 +96,10 @@ st.from_regex(_INDENT_WHITESPACE_RE, fullmatch=True), ], [libcst.IsNot, infer, nonempty_whitespace, infer], + [ + libcst.MatchSingleton, + st.builds(libcst.Name, st.sampled_from(["None", "False", "True"])), + ], [libcst.NamedExpr, st.from_type(libcst.Name)], [ libcst.Nonlocal, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith/python.lark new/hypothesmith-0.2.3/src/hypothesmith/python.lark --- old/hypothesmith-0.2.0/src/hypothesmith/python.lark 1970-01-01 01:00:00.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith/python.lark 2022-12-01 10:33:46.000000000 +0100 @@ -0,0 +1,304 @@ +// Python 3 grammar for Lark + +// This grammar should parse all python 3.x code successfully. + +// Adapted from: https://docs.python.org/3/reference/grammar.html + +// Start symbols for the grammar: +// single_input is a single interactive statement; +// file_input is a module or sequence of commands read from an input file; +// eval_input is the input for the eval() functions. +// NB: compound_stmt in single_input is followed by extra NEWLINE! +// + +single_input: _NEWLINE | simple_stmt | compound_stmt _NEWLINE +file_input: (_NEWLINE | stmt)* +eval_input: testlist _NEWLINE* + +decorator: "@" dotted_name [ "(" [arguments] ")" ] _NEWLINE +decorators: decorator+ +decorated: decorators (classdef | funcdef | async_funcdef) + +async_funcdef: "async" funcdef +funcdef: "def" name "(" [parameters] ")" ["->" test] ":" suite + +parameters: paramvalue ("," paramvalue)* ["," SLASH ("," paramvalue)*] ["," [starparams | kwparams]] + | starparams + | kwparams + +SLASH: "/" // Otherwise the it will completely disappear and it will be undisguisable in the result +starparams: (starparam | starguard) poststarparams +starparam: "*" typedparam +starguard: "*" +poststarparams: ("," paramvalue)* ["," kwparams] +kwparams: "**" typedparam ","? + +?paramvalue: typedparam ("=" test)? +?typedparam: name (":" test)? + + +lambdef: "lambda" [lambda_params] ":" test +lambdef_nocond: "lambda" [lambda_params] ":" test_nocond +lambda_params: lambda_paramvalue ("," lambda_paramvalue)* ["," [lambda_starparams | lambda_kwparams]] + | lambda_starparams + | lambda_kwparams +?lambda_paramvalue: name ("=" test)? +lambda_starparams: "*" [name] ("," lambda_paramvalue)* ["," [lambda_kwparams]] +lambda_kwparams: "**" name ","? + + +?stmt: simple_stmt | compound_stmt +?simple_stmt: small_stmt (";" small_stmt)* [";"] _NEWLINE +?small_stmt: (expr_stmt | assign_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) +expr_stmt: testlist_star_expr +assign_stmt: annassign | augassign | assign + +annassign: testlist_star_expr ":" test ["=" test] +assign: testlist_star_expr ("=" (yield_expr|testlist_star_expr))+ +augassign: testlist_star_expr augassign_op (yield_expr|testlist) +!augassign_op: "+=" | "-=" | "*=" | "@=" | "/=" | "%=" | "&=" | "|=" | "^=" | "<<=" | ">>=" | "**=" | "//=" +?testlist_star_expr: test_or_star_expr + | test_or_star_expr ("," test_or_star_expr)+ ","? -> tuple + | test_or_star_expr "," -> tuple + +// For normal and annotated assignments, additional restrictions enforced by the interpreter +del_stmt: "del" exprlist +pass_stmt: "pass" +?flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt +break_stmt: "break" +continue_stmt: "continue" +return_stmt: "return" [testlist] +yield_stmt: yield_expr +raise_stmt: "raise" [test ["from" test]] +import_stmt: import_name | import_from +import_name: "import" dotted_as_names +// note below: the ("." | "...") is necessary because "..." is tokenized as ELLIPSIS +import_from: "from" (dots? dotted_name | dots) "import" ("*" | "(" import_as_names ")" | import_as_names) +!dots: "."+ +import_as_name: name ["as" name] +dotted_as_name: dotted_name ["as" name] +import_as_names: import_as_name ("," import_as_name)* [","] +dotted_as_names: dotted_as_name ("," dotted_as_name)* +dotted_name: name ("." name)* +global_stmt: "global" name ("," name)* +nonlocal_stmt: "nonlocal" name ("," name)* +assert_stmt: "assert" test ["," test] + +?compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | match_stmt + | with_stmt | funcdef | classdef | decorated | async_stmt +async_stmt: "async" (funcdef | with_stmt | for_stmt) +if_stmt: "if" test ":" suite elifs ["else" ":" suite] +elifs: elif_* +elif_: "elif" test ":" suite +while_stmt: "while" test ":" suite ["else" ":" suite] +for_stmt: "for" exprlist "in" testlist ":" suite ["else" ":" suite] +try_stmt: "try" ":" suite except_clauses ["else" ":" suite] [finally] + | "try" ":" suite finally -> try_finally +finally: "finally" ":" suite +except_clauses: except_clause+ +except_clause: "except" [test ["as" name]] ":" suite +// NB compile.c makes sure that the default except clause is last + + +with_stmt: "with" with_items ":" suite +with_items: with_item ("," with_item)* +with_item: test ["as" name] + +match_stmt: "match" test ":" _NEWLINE _INDENT case+ _DEDENT + +case: "case" pattern ["if" test] ":" suite + +?pattern: sequence_item_pattern "," _sequence_pattern -> sequence_pattern + | as_pattern +?as_pattern: or_pattern ("as" NAME)? +?or_pattern: closed_pattern ("|" closed_pattern)* +?closed_pattern: literal_pattern + | NAME -> capture_pattern + | "_" -> any_pattern + | attr_pattern + | "(" as_pattern ")" + | "[" _sequence_pattern "]" -> sequence_pattern + | "(" (sequence_item_pattern "," _sequence_pattern)? ")" -> sequence_pattern + | "{" (mapping_item_pattern ("," mapping_item_pattern)* ","?)?"}" -> mapping_pattern + | "{" (mapping_item_pattern ("," mapping_item_pattern)* ",")? "**" NAME ","? "}" -> mapping_star_pattern + | class_pattern + +literal_pattern: inner_literal_pattern + +?inner_literal_pattern: "None" -> const_none + | "True" -> const_true + | "False" -> const_false + | STRING -> string + | number + +attr_pattern: NAME ("." NAME)+ -> value + +name_or_attr_pattern: NAME ("." NAME)* -> value + +mapping_item_pattern: (literal_pattern|attr_pattern) ":" as_pattern + +_sequence_pattern: (sequence_item_pattern ("," sequence_item_pattern)* ","?)? +?sequence_item_pattern: as_pattern + | "*" NAME -> star_pattern + +class_pattern: name_or_attr_pattern "(" [arguments_pattern ","?] ")" +arguments_pattern: pos_arg_pattern ["," keyws_arg_pattern] + | keyws_arg_pattern -> no_pos_arguments + +pos_arg_pattern: as_pattern ("," as_pattern)* +keyws_arg_pattern: keyw_arg_pattern ("," keyw_arg_pattern)* +keyw_arg_pattern: NAME "=" as_pattern + + + +suite: simple_stmt | _NEWLINE _INDENT stmt+ _DEDENT + +?test: or_test ("if" or_test "else" test)? + | lambdef + | assign_expr + +assign_expr: name ":=" test + +?test_nocond: or_test | lambdef_nocond + +?or_test: and_test ("or" and_test)* +?and_test: not_test_ ("and" not_test_)* +?not_test_: "not" not_test_ -> not_test + | comparison +?comparison: expr (comp_op expr)* +star_expr: "*" expr + +?expr: or_expr +?or_expr: xor_expr ("|" xor_expr)* +?xor_expr: and_expr ("^" and_expr)* +?and_expr: shift_expr ("&" shift_expr)* +?shift_expr: arith_expr (_shift_op arith_expr)* +?arith_expr: term (_add_op term)* +?term: factor (_mul_op factor)* +?factor: _unary_op factor | power + +!_unary_op: "+"|"-"|"~" +!_add_op: "+"|"-" +!_shift_op: "<<"|">>" +!_mul_op: "*"|"@"|"/"|"%"|"//" +// <> isn't actually a valid comparison operator in Python. It's here for the +// sake of a __future__ import described in PEP 401 (which really works :-) +!comp_op: "<"|">"|"=="|">="|"<="|"<>"|"!="|"in"|"not" "in"|"is"|"is" "not" + +?power: await_expr ("**" factor)? +?await_expr: AWAIT? atom_expr +AWAIT: "await" + +?atom_expr: atom_expr "(" [arguments] ")" -> funccall + | atom_expr "[" subscriptlist "]" -> getitem + | atom_expr "." name -> getattr + | atom + +?atom: "(" yield_expr ")" + | "(" _tuple_inner? ")" -> tuple + | "(" comprehension{test_or_star_expr} ")" -> tuple_comprehension + | "[" _testlist_comp? "]" -> list + | "[" comprehension{test_or_star_expr} "]" -> list_comprehension + | "{" _dict_exprlist? "}" -> dict + | "{" comprehension{key_value} "}" -> dict_comprehension + | "{" _set_exprlist "}" -> set + | "{" comprehension{test} "}" -> set_comprehension + | name -> var + | number + | string_concat + | "(" test ")" + | "..." -> ellipsis + | "None" -> const_none + | "True" -> const_true + | "False" -> const_false + + +?string_concat: string+ + +_testlist_comp: test | _tuple_inner +_tuple_inner: test_or_star_expr (("," test_or_star_expr)+ [","] | ",") + + +?test_or_star_expr: test + | star_expr + +?subscriptlist: subscript + | subscript (("," subscript)+ [","] | ",") -> subscript_tuple +?subscript: test | ([test] ":" [test] [sliceop]) -> slice +sliceop: ":" [test] +?exprlist: (expr|star_expr) + | (expr|star_expr) (("," (expr|star_expr))+ [","]|",") +?testlist: test | testlist_tuple +testlist_tuple: test (("," test)+ [","] | ",") +_dict_exprlist: (key_value | "**" expr) ("," (key_value | "**" expr))* [","] + +key_value: test ":" test + +_set_exprlist: test_or_star_expr ("," test_or_star_expr)* [","] + +classdef: "class" name ["(" [arguments] ")"] ":" suite + + + +arguments: argvalue ("," argvalue)* ("," [ starargs | kwargs])? + | starargs + | kwargs + | comprehension{test} + +starargs: stararg ("," stararg)* ("," argvalue)* ["," kwargs] +stararg: "*" test +kwargs: "**" test ("," argvalue)* + +?argvalue: test ("=" test)? + + +comprehension{comp_result}: comp_result comp_fors [comp_if] +comp_fors: comp_for+ +comp_for: [ASYNC] "for" exprlist "in" or_test +ASYNC: "async" +?comp_if: "if" test_nocond + +// not used in grammar, but may appear in "node" passed from Parser to Compiler +encoding_decl: name + +yield_expr: "yield" [testlist] + | "yield" "from" test -> yield_from + +number: DEC_NUMBER | HEX_NUMBER | BIN_NUMBER | OCT_NUMBER | FLOAT_NUMBER | IMAG_NUMBER +string: STRING | LONG_STRING + +// Other terminals + +_NEWLINE: ( /\r?\n[\t ]*/ | COMMENT )+ + +%ignore /[\t \f]+/ // WS +%ignore /\\[\t \f]*\r?\n/ // LINE_CONT +%ignore COMMENT +%declare _INDENT _DEDENT + + +// Python terminals + +!name: NAME | "match" | "case" +NAME: /[^\W\d]\w*/ +COMMENT: /#[^\n]*/ + +STRING: /([ubf]?r?|r[ubf])("(?!"").*?(?<!\\)(\\\\)*?"|'(?!'').*?(?<!\\)(\\\\)*?')/i +LONG_STRING: /([ubf]?r?|r[ubf])(""".*?(?<!\\)(\\\\)*?"""|'''.*?(?<!\\)(\\\\)*?''')/is + +_SPECIAL_DEC: "0".."9" ("_"? "0".."9" )* +DEC_NUMBER: "1".."9" ("_"? "0".."9" )* + | "0" ("_"? "0" )* /(?![1-9])/ +HEX_NUMBER.2: "0" ("x" | "X") ("_"? ("0".."9" | "a".."f" | "A".."F"))+ +OCT_NUMBER.2: "0" ("o" | "O") ("_"? "0".."7" )+ +BIN_NUMBER.2: "0" ("b" | "B") ("_"? "0".."1" )+ + +_EXP: ("e"|"E") ["+" | "-"] _SPECIAL_DEC +DECIMAL: "." _SPECIAL_DEC | _SPECIAL_DEC "." _SPECIAL_DEC? +FLOAT_NUMBER.2: _SPECIAL_DEC _EXP | DECIMAL _EXP? +IMAG_NUMBER.2: (_SPECIAL_DEC | FLOAT_NUMBER) ("J" | "j") + + +// Comma-separated list (with an optional trailing comma) +cs_list{item}: item ("," item)* ","? +_cs_list{item}: item ("," item)* ","? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith/python3.lark new/hypothesmith-0.2.3/src/hypothesmith/python3.lark --- old/hypothesmith-0.2.0/src/hypothesmith/python3.lark 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith/python3.lark 1970-01-01 01:00:00.000000000 +0100 @@ -1,187 +0,0 @@ -// Python 3 grammar for Lark - -// NOTE: Work in progress!!! (XXX TODO) -// This grammar should parse all python 3.x code successfully, -// but the resulting parse-tree is still not well-organized. - -// Adapted from: https://docs.python.org/3/reference/grammar.html -// Adapted by: Erez Shinan - -// Start symbols for the grammar: -// single_input is a single interactive statement; -// file_input is a module or sequence of commands read from an input file; -// eval_input is the input for the eval() functions. -// NB: compound_stmt in single_input is followed by extra NEWLINE! -single_input: _NEWLINE | simple_stmt | compound_stmt _NEWLINE -file_input: (_NEWLINE | stmt)* -eval_input: testlist _NEWLINE* - -decorator: "@" dotted_name [ "(" [arguments] ")" ] _NEWLINE -decorators: decorator+ -decorated: decorators (classdef | funcdef | async_funcdef) - -async_funcdef: "async" funcdef -funcdef: "def" NAME "(" parameters? ")" ["->" test] ":" suite - -parameters: paramvalue ("," paramvalue)* ["," [ starparams | kwparams]] - | starparams - | kwparams -starparams: "*" typedparam? ("," paramvalue)* ["," kwparams] -kwparams: "**" typedparam - -?paramvalue: typedparam ["=" test] -?typedparam: NAME [":" test] - -varargslist: (vfpdef ["=" test] ("," vfpdef ["=" test])* ["," [ "*" [vfpdef] ("," vfpdef ["=" test])* ["," ["**" vfpdef [","]]] | "**" vfpdef [","]]] - | "*" [vfpdef] ("," vfpdef ["=" test])* ["," ["**" vfpdef [","]]] - | "**" vfpdef [","]) - -vfpdef: NAME - -?stmt: simple_stmt | compound_stmt -?simple_stmt: small_stmt (";" small_stmt)* [";"] _NEWLINE -?small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) -?expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) - | ("=" (yield_expr|testlist_star_expr))*) -annassign: ":" test ["=" test] -?testlist_star_expr: (test|star_expr) ("," (test|star_expr))* [","] -!augassign: ("+=" | "-=" | "*=" | "@=" | "/=" | "%=" | "&=" | "|=" | "^=" | "<<=" | ">>=" | "**=" | "//=") -// For normal and annotated assignments, additional restrictions enforced by the interpreter -del_stmt: "del" exprlist -pass_stmt: "pass" -?flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt -break_stmt: "break" -continue_stmt: "continue" -return_stmt: "return" [testlist] -yield_stmt: yield_expr -raise_stmt: "raise" [test ["from" test]] -import_stmt: import_name | import_from -import_name: "import" dotted_as_names -// note below: the ("." | "...") is necessary because "..." is tokenized as ELLIPSIS -import_from: "from" (dots? dotted_name | dots) "import" ("*" | "(" import_as_names ")" | import_as_names) -!dots: "."+ -import_as_name: NAME ["as" NAME] -dotted_as_name: dotted_name ["as" NAME] -import_as_names: import_as_name ("," import_as_name)* [","] -dotted_as_names: dotted_as_name ("," dotted_as_name)* -dotted_name: NAME ("." NAME)* -global_stmt: "global" NAME ("," NAME)* -nonlocal_stmt: "nonlocal" NAME ("," NAME)* -assert_stmt: "assert" test ["," test] - -compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt -async_stmt: "async" (funcdef | with_stmt | for_stmt) -if_stmt: "if" test ":" suite ("elif" test ":" suite)* ["else" ":" suite] -while_stmt: "while" test ":" suite ["else" ":" suite] -for_stmt: "for" exprlist "in" testlist ":" suite ["else" ":" suite] -try_stmt: ("try" ":" suite ((except_clause ":" suite)+ ["else" ":" suite] ["finally" ":" suite] | "finally" ":" suite)) -with_stmt: "with" with_item ("," with_item)* ":" suite -with_item: test ["as" expr] -// NB compile.c makes sure that the default except clause is last -except_clause: "except" [test ["as" NAME]] -suite: simple_stmt | _NEWLINE _INDENT stmt+ _DEDENT - -?test: or_test ("if" or_test "else" test)? | lambdef -?test_nocond: or_test | lambdef_nocond -lambdef: "lambda" [varargslist] ":" test -lambdef_nocond: "lambda" [varargslist] ":" test_nocond -?or_test: and_test ("or" and_test)* -?and_test: not_test ("and" not_test)* -?not_test: "not" not_test -> not - | comparison -?comparison: expr (_comp_op expr)* -star_expr: "*" expr -?expr: xor_expr ("|" xor_expr)* -?xor_expr: and_expr ("^" and_expr)* -?and_expr: shift_expr ("&" shift_expr)* -?shift_expr: arith_expr (_shift_op arith_expr)* -?arith_expr: term (_add_op term)* -?term: factor (_mul_op factor)* -?factor: _factor_op factor | power - -!_factor_op: "+"|"-"|"~" -!_add_op: "+"|"-" -!_shift_op: "<<"|">>" -!_mul_op: "*"|"@"|"/"|"%"|"//" -// <> isn't actually a valid comparison operator in Python. It's here for the -// sake of a __future__ import described in PEP 401 (which really works :-) -!_comp_op: "<"|">"|"=="|">="|"<="|"<>"|"!="|"in"|"not" "in"|"is"|"is" "not" - -?power: await_expr ("**" factor)? -?await_expr: AWAIT? atom_expr -AWAIT: "await" - -?atom_expr: atom_expr "(" [arguments] ")" -> funccall - | atom_expr "[" subscriptlist "]" -> getitem - | atom_expr "." NAME -> getattr - | atom - -?atom: "(" [yield_expr|testlist_comp] ")" -> tuple - | "[" [testlist_comp] "]" -> list - | "{" [dictorsetmaker] "}" -> dict - | NAME -> var - | number | string+ - | "(" test ")" - | "..." -> ellipsis - | "None" -> const_none - | "True" -> const_true - | "False" -> const_false - -?testlist_comp: (test|star_expr) [comp_for | ("," (test|star_expr))+ [","] | ","] -subscriptlist: subscript ("," subscript)* [","] -subscript: test | [test] ":" [test] [sliceop] -sliceop: ":" [test] -exprlist: (expr|star_expr) ("," (expr|star_expr))* [","] -testlist: test ("," test)* [","] -dictorsetmaker: ( ((test ":" test | "**" expr) (comp_for | ("," (test ":" test | "**" expr))* [","])) | ((test | star_expr) (comp_for | ("," (test | star_expr))* [","])) ) - -classdef: "class" NAME ["(" [arguments] ")"] ":" suite - -arguments: argvalue ("," argvalue)* ("," [ starargs | kwargs])? - | starargs - | kwargs - | test comp_for - -starargs: "*" test ("," "*" test)* ("," argvalue)* ["," kwargs] -kwargs: "**" test - -?argvalue: test ("=" test)? - - - -comp_iter: comp_for | comp_if | async_for -async_for: "async" "for" exprlist "in" or_test [comp_iter] -comp_for: "for" exprlist "in" or_test [comp_iter] -comp_if: "if" test_nocond [comp_iter] - -// not used in grammar, but may appear in "node" passed from Parser to Compiler -encoding_decl: NAME - -yield_expr: "yield" [yield_arg] -yield_arg: "from" test | testlist - - -number: DEC_NUMBER | HEX_NUMBER | BIN_NUMBER | OCT_NUMBER | FLOAT_NUMBER | IMAG_NUMBER -string: STRING | LONG_STRING -// Tokens - -NAME: /[a-zA-Z_]\w*/ -COMMENT: /#[^\n]*/ -_NEWLINE: ( /\r?\n[\t ]*/ | COMMENT )+ - - -STRING : /[ubf]?r?("(?!"").*?(?<!\\)(\\\\)*?"|'(?!'').*?(?<!\\)(\\\\)*?')/i -LONG_STRING: /[ubf]?r?(""".*?(?<!\\)(\\\\)*?"""|'''.*?(?<!\\)(\\\\)*?''')/is - -DEC_NUMBER: /0|[1-9]\d*/i -HEX_NUMBER.2: /0x[\da-f]*/i -OCT_NUMBER.2: /0o[0-7]*/i -BIN_NUMBER.2 : /0b[0-1]*/i -FLOAT_NUMBER.2: /((\d+\.\d*|\.\d+)(e[-+]?\d+)?|\d+(e[-+]?\d+))/i -IMAG_NUMBER.2: /\d+j/i | FLOAT_NUMBER "j"i - -%ignore /[\t \f]+/ // WS -%ignore /\\[\t \f]*\r?\n/ // LINE_CONT -%ignore COMMENT -%declare _INDENT _DEDENT - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith/syntactic.py new/hypothesmith-0.2.3/src/hypothesmith/syntactic.py --- old/hypothesmith-0.2.0/src/hypothesmith/syntactic.py 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith/syntactic.py 2022-12-01 10:33:46.000000000 +0100 @@ -3,9 +3,9 @@ import ast import dis import sys -import urllib.request +import warnings from functools import lru_cache -from pathlib import Path +from importlib.resources import read_text from hypothesis import assume, strategies as st from hypothesis.extra.lark import LarkStrategy @@ -13,18 +13,12 @@ from lark import Lark from lark.indenter import Indenter -URL = "https://raw.githubusercontent.com/lark-parser/lark/master/examples/python3.lark" -fname = Path(__file__).with_name(URL.split("/")[-1]) - -if fname.exists(): - with open(fname) as f: - lark_grammar = f.read() -else: # pragma: no cover - # To update the grammar definition, delete the file and execute this. - with urllib.request.urlopen(URL) as handle: - lark_grammar = handle.read().decode() - with open(fname, "w") as f: - f.write(lark_grammar) +# To update this grammar file, run +# wget https://raw.githubusercontent.com/lark-parser/lark/master/lark/grammars/python.lark -O src/hypothesmith/python.lark +with warnings.catch_warnings(): + # `read_text()` is deprecated; I'll update once I've dropped 3.8 and earlier. + warnings.simplefilter("ignore") + LARK_GRAMMAR = read_text("hypothesmith", "python.lark") COMPILE_MODES = { "eval_input": "eval", @@ -181,5 +175,5 @@ """ assert start in {"single_input", "file_input", "eval_input"} assert isinstance(auto_target, bool) - grammar = Lark(lark_grammar, parser="lalr", postlex=PythonIndenter(), start=start) + grammar = Lark(LARK_GRAMMAR, parser="lalr", postlex=PythonIndenter(), start=start) return GrammarStrategy(grammar, start, auto_target) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith.egg-info/PKG-INFO new/hypothesmith-0.2.3/src/hypothesmith.egg-info/PKG-INFO --- old/hypothesmith-0.2.0/src/hypothesmith.egg-info/PKG-INFO 2021-11-27 09:58:16.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith.egg-info/PKG-INFO 2022-12-01 10:33:54.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesmith -Version: 0.2.0 +Version: 0.2.3 Summary: Hypothesis strategies for generating Python programs, something like CSmith Home-page: https://github.com/Zac-HD/hypothesmith Author: Zac Hatfield-Dodds @@ -8,19 +8,19 @@ License: MPL 2.0 Project-URL: Funding, https://github.com/sponsors/Zac-HD Keywords: python testing fuzzing property-based-testing -Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Hypothesis Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Testing -Requires-Python: >=3.6 +Requires-Python: >=3.7 Description-Content-Type: text/markdown License-File: LICENSE @@ -86,5 +86,3 @@ ### Changelog Patch notes [can be found in `CHANGELOG.md`](https://github.com/Zac-HD/hypothesmith/blob/master/CHANGELOG.md). - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith.egg-info/SOURCES.txt new/hypothesmith-0.2.3/src/hypothesmith.egg-info/SOURCES.txt --- old/hypothesmith-0.2.0/src/hypothesmith.egg-info/SOURCES.txt 2021-11-27 09:58:16.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith.egg-info/SOURCES.txt 2022-12-01 10:33:54.000000000 +0100 @@ -12,7 +12,7 @@ src/hypothesmith/__init__.py src/hypothesmith/cst.py src/hypothesmith/py.typed -src/hypothesmith/python3.lark +src/hypothesmith/python.lark src/hypothesmith/syntactic.py src/hypothesmith.egg-info/PKG-INFO src/hypothesmith.egg-info/SOURCES.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/src/hypothesmith.egg-info/requires.txt new/hypothesmith-0.2.3/src/hypothesmith.egg-info/requires.txt --- old/hypothesmith-0.2.0/src/hypothesmith.egg-info/requires.txt 2021-11-27 09:58:16.000000000 +0100 +++ new/hypothesmith-0.2.3/src/hypothesmith.egg-info/requires.txt 2022-12-01 10:33:54.000000000 +0100 @@ -1,3 +1,2 @@ -hypothesis>=5.41.0 -lark-parser>=0.7.2 -libcst>=0.3.8 +hypothesis[lark]>=6.58.1 +libcst>=0.4.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/tests/test_cst.py new/hypothesmith-0.2.3/tests/test_cst.py --- old/hypothesmith-0.2.0/tests/test_cst.py 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/tests/test_cst.py 2022-12-01 10:33:46.000000000 +0100 @@ -52,11 +52,11 @@ @pytest.mark.xfail -@example("A\u2592", black.FileMode()) +@example("A\u2592", black.Mode()) @given( source_code=hypothesmith.from_node(), mode=st.builds( - black.FileMode, + black.Mode, line_length=st.just(88) | st.integers(0, 200), string_normalization=st.booleans(), is_pyi=st.booleans(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/tests/test_syntactic.py new/hypothesmith-0.2.3/tests/test_syntactic.py --- old/hypothesmith-0.2.0/tests/test_syntactic.py 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/tests/test_syntactic.py 2022-12-01 10:33:46.000000000 +0100 @@ -58,12 +58,12 @@ assert ast.dump(first) == ast.dump(second) -@example("\\", black.FileMode()) -@example("A#\r#", black.FileMode()) +@example("\\", black.Mode()) +@example("A#\r#", black.Mode()) @given( source_code=hypothesmith.from_grammar(), mode=st.builds( - black.FileMode, + black.Mode, line_length=st.just(88) | st.integers(0, 200), string_normalization=st.booleans(), is_pyi=st.booleans(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesmith-0.2.0/tox.ini new/hypothesmith-0.2.3/tox.ini --- old/hypothesmith-0.2.0/tox.ini 2021-11-27 09:58:08.000000000 +0100 +++ new/hypothesmith-0.2.3/tox.ini 2022-12-01 10:33:46.000000000 +0100 @@ -8,7 +8,6 @@ deps = --no-deps --requirement deps/check.txt - com2ann ; python_version >= '3.8' commands = shed flake8 @@ -19,10 +18,8 @@ deps = --no-deps --requirement deps/test.txt - # We need this line here because pip-compile doesn't propogate env markers - dataclasses>=0.7 ; python_version < '3.7' commands = - pip install --no-deps --editable . + pip install --no-deps . pytest {posargs:-n auto} # Run `tox -e deps` to update pinned dependencies