coconut-develop 3.1.0.post0.dev11__tar.gz → 3.1.0.post0.dev12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/DOCS.md +1 -0
- coconut-develop-3.1.0.post0.dev12/PKG-INFO +140 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/_pyparsing.py +4 -4
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/api.pyi +3 -1
- coconut-develop-3.1.0.post0.dev12/coconut/command/resources/pyrightconfig.json +7 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/compiler.py +31 -6
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/grammar.py +10 -18
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/header.py +7 -7
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/matching.py +29 -23
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/util.py +123 -30
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/constants.py +8 -6
- coconut-develop-3.1.0.post0.dev12/coconut/icoconut/coconut/kernel.json +11 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/root.py +1 -1
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/terminal.py +2 -2
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/main_test.py +25 -21
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/primary_1.coco +9 -11
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/non_strict/non_strict_test.coco +15 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/extras.coco +40 -34
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut_develop.egg-info/SOURCES.txt +1 -0
- coconut_develop-3.1.0.post0.dev11/PKG-INFO +0 -387
- coconut_develop-3.1.0.post0.dev11/coconut/icoconut/coconut/kernel.json +0 -11
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/CONTRIBUTING.md +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/FAQ.md +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/HELP.md +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/LICENSE.txt +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/MANIFEST.in +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/README.rst +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/__coconut__/__init__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/__coconut__/__init__.pyi +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/__coconut__/py.typed +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/_coconut/__init__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/_coconut/__init__.pyi +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/_coconut/py.typed +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/__coconut__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/__coconut__.pyi +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/__init__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/__init__.pyi +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/__main__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/api.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/__init__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/__init__.pyi +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/cli.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/command.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/command.pyi +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/mypy.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/resources/zcoconut.pth +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/util.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/command/watch.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/__init__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/templates/header.py_template +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/convenience.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/convenience.pyi +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/exceptions.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/highlighter.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/icoconut/__init__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/icoconut/__main__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/icoconut/coconut_py/kernel.json +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/icoconut/coconut_py2/kernel.json +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/icoconut/coconut_py3/kernel.json +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/icoconut/embed.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/icoconut/root.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/integrations.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/main.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/py.typed +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/requirements.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/__init__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/__main__.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/constants_test.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/__init__.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/__main__.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/main.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/primary_2.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/specific.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/suite.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/tutorial.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/agnostic/util.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/target_2/py2_test.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/target_3/py3_test.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/target_311/py311_test.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/target_35/py35_test.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/target_36/py36_test.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/target_38/py38_test.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/cocotest/target_sys/target_sys_test.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/importable.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/runnable.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/tests/src/runner.coco +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/util.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/conf.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/pyproject.toml +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/setup.cfg +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/setup.py +0 -0
- {coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/xontrib/coconut.py +0 -0
|
@@ -336,6 +336,7 @@ If the `--strict` (`-s` for short) flag is enabled, Coconut will perform additio
|
|
|
336
336
|
The style issues which will cause `--strict` to throw an error are:
|
|
337
337
|
|
|
338
338
|
- mixing of tabs and spaces
|
|
339
|
+
- use of `"hello" "world"` implicit string concatenation (use `+` instead for clarity; Coconut will compile the `+` away)
|
|
339
340
|
- use of `from __future__` imports (Coconut does these automatically)
|
|
340
341
|
- inheriting from `object` in classes (Coconut does this automatically)
|
|
341
342
|
- semicolons at end of lines
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: coconut-develop
|
|
3
|
+
Version: 3.1.0.post0.dev12
|
|
4
|
+
Summary: Simple, elegant, Pythonic functional programming.
|
|
5
|
+
Home-page: http://coconut-lang.org
|
|
6
|
+
Author: Evan Hubinger
|
|
7
|
+
Author-email: evanjhub@gmail.com
|
|
8
|
+
License: Apache 2.0
|
|
9
|
+
Description: |logo| Coconut
|
|
10
|
+
==============
|
|
11
|
+
|
|
12
|
+
..
|
|
13
|
+
<insert toctree here>
|
|
14
|
+
|
|
15
|
+
.. |logo| image:: https://github.com/evhub/coconut/raw/gh-pages/favicon-32x32.png
|
|
16
|
+
|
|
17
|
+
.. image:: https://opencollective.com/coconut/backers/badge.svg
|
|
18
|
+
:alt: Backers on Open Collective
|
|
19
|
+
:target: #backers
|
|
20
|
+
.. image:: https://opencollective.com/coconut/sponsors/badge.svg
|
|
21
|
+
:alt: Sponsors on Open Collective
|
|
22
|
+
:target: #sponsors
|
|
23
|
+
.. image:: https://badges.gitter.im/evhub/coconut.svg
|
|
24
|
+
:alt: Join the chat at https://gitter.im/evhub/coconut
|
|
25
|
+
:target: https://gitter.im/evhub/coconut?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
26
|
+
|
|
27
|
+
Coconut (`coconut-lang.org`__) is a variant of Python_ that **adds on top of Python syntax** new features for simple, elegant, Pythonic **functional programming**.
|
|
28
|
+
|
|
29
|
+
__ Coconut_
|
|
30
|
+
.. _Coconut: http://coconut-lang.org/
|
|
31
|
+
|
|
32
|
+
Coconut is developed on GitHub_ and hosted on PyPI_. Installing Coconut is as easy as opening a command prompt and entering::
|
|
33
|
+
|
|
34
|
+
pip install coconut
|
|
35
|
+
|
|
36
|
+
To help you get started, check out these links for more information about Coconut:
|
|
37
|
+
|
|
38
|
+
- Tutorial_: If you're new to Coconut, a good place to start is Coconut's **tutorial**.
|
|
39
|
+
- Documentation_: If you're looking for info about a specific feature, check out Coconut's **documentation**.
|
|
40
|
+
- `Online Interpreter`_: If you want to try Coconut in your browser, check out Coconut's **online interpreter**.
|
|
41
|
+
- FAQ_: If you have general questions about Coconut—like who Coconut is built for and whether or not you should use it—Coconut's frequently asked questions are often the best place to start.
|
|
42
|
+
- `Create a New Issue <https://github.com/evhub/coconut/issues/new>`_: If you're having a problem with Coconut, creating a new issue detailing the problem will allow it to be addressed as soon as possible.
|
|
43
|
+
- Gitter_: For any questions, concerns, or comments about anything Coconut-related, ask around at Coconut's Gitter, a GitHub-integrated chat room for Coconut developers.
|
|
44
|
+
- Releases_: Want to know what's been added in recent Coconut versions? Check out the release log for all the new features and fixes.
|
|
45
|
+
|
|
46
|
+
.. _Python: https://www.python.org/
|
|
47
|
+
.. _PyPI: https://pypi.python.org/pypi/coconut
|
|
48
|
+
.. _Tutorial: http://coconut.readthedocs.io/en/latest/HELP.html
|
|
49
|
+
.. _Documentation: http://coconut.readthedocs.io/en/latest/DOCS.html
|
|
50
|
+
.. _`Online Interpreter`: https://cs121-team-panda.github.io/coconut-interpreter
|
|
51
|
+
.. _FAQ: http://coconut.readthedocs.io/en/latest/FAQ.html
|
|
52
|
+
.. _GitHub: https://github.com/evhub/coconut
|
|
53
|
+
.. _Gitter: https://gitter.im/evhub/coconut
|
|
54
|
+
.. _Releases: https://github.com/evhub/coconut/releases
|
|
55
|
+
|
|
56
|
+
Credits
|
|
57
|
+
+++++++
|
|
58
|
+
|
|
59
|
+
Contributors
|
|
60
|
+
------------
|
|
61
|
+
|
|
62
|
+
This project exists thanks to all the people who contribute! `Become a contributor`__.
|
|
63
|
+
|
|
64
|
+
.. image:: https://opencollective.com/coconut/contributors.svg?width=890&button=false
|
|
65
|
+
:target: https://github.com/evhub/coconut/graphs/contributors
|
|
66
|
+
|
|
67
|
+
__ Contributor_
|
|
68
|
+
.. _Contributor: http://coconut.readthedocs.io/en/develop/CONTRIBUTING.html
|
|
69
|
+
|
|
70
|
+
Backers
|
|
71
|
+
-------
|
|
72
|
+
|
|
73
|
+
Thank you to all our backers! `Become a backer`__.
|
|
74
|
+
|
|
75
|
+
.. image:: https://opencollective.com/coconut/backers.svg?width=890
|
|
76
|
+
:target: https://opencollective.com/coconut#backers
|
|
77
|
+
|
|
78
|
+
__ Backer_
|
|
79
|
+
.. _Backer: https://opencollective.com/coconut#backer
|
|
80
|
+
|
|
81
|
+
Sponsors
|
|
82
|
+
--------
|
|
83
|
+
|
|
84
|
+
Support Coconut by becoming a sponsor. Your logo will show up here with a link to your website. `Become a sponsor`__.
|
|
85
|
+
|
|
86
|
+
.. image:: https://opencollective.com/XX/sponsor/0/avatar.svg
|
|
87
|
+
:target: https://opencollective.com/coconut/sponsor/0/website
|
|
88
|
+
|
|
89
|
+
__ Sponsor_
|
|
90
|
+
.. _Sponsor: https://opencollective.com/coconut#sponsor
|
|
91
|
+
|
|
92
|
+
Keywords: functional,programming,language,compiler,pattern,pattern-matching,algebraic,data type,data types,lambda,lambdas,lazy,evaluation,lazy list,lazy lists,tail,recursion,call,recursive,recursive_iterator,infix,function,composition,compose,partial,application,currying,curry,pipeline,pipe,unicode,operator,operators,frozenset,literal,syntax,destructuring,assignment,fold,datamaker,prepattern,iterator,generator,none,coalesce,coalescing,statement,lru_cache,memoization,backport,typing,embed,PEP 622,overrides,islice,itertools,functools,TYPE_CHECKING,Expected,breakpoint,help,reduce,takewhile,dropwhile,tee,count,makedata,consume,process_map,thread_map,addpattern,recursive_generator,fmap,starmap,reiterable,scan,groupsof,memoize,zip_longest,override,flatten,ident,call,safe_call,flip,const,lift,lift_apart,all_equal,collectby,mapreduce,multi_enumerate,cartesian_product,multiset,cycle,windowsof,and_then,and_then_await,async_map,py_chr,py_dict,py_hex,py_input,py_int,py_map,py_object,py_oct,py_open,py_print,py_range,py_str,py_super,py_zip,py_filter,py_reversed,py_enumerate,py_raw_input,py_xrange,py_repr,py_breakpoint,py_min,py_max,_namedtuple_of,reveal_type,reveal_locals,MatchError,CoconutWarning,__fmap__,__iter_getitem__,data,match,case,cases,where,addpattern,then,operator,type,copyclosure,λ
|
|
93
|
+
Platform: UNKNOWN
|
|
94
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
95
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
96
|
+
Classifier: Intended Audience :: Developers
|
|
97
|
+
Classifier: Topic :: Software Development
|
|
98
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
99
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
100
|
+
Classifier: Topic :: Software Development :: Interpreters
|
|
101
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
102
|
+
Classifier: Topic :: Utilities
|
|
103
|
+
Classifier: Environment :: Console
|
|
104
|
+
Classifier: Operating System :: OS Independent
|
|
105
|
+
Classifier: Programming Language :: Python
|
|
106
|
+
Classifier: Programming Language :: Python :: 2
|
|
107
|
+
Classifier: Programming Language :: Python :: 2.6
|
|
108
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
109
|
+
Classifier: Programming Language :: Python :: 3
|
|
110
|
+
Classifier: Programming Language :: Python :: 3.2
|
|
111
|
+
Classifier: Programming Language :: Python :: 3.3
|
|
112
|
+
Classifier: Programming Language :: Python :: 3.4
|
|
113
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
114
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
115
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
116
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
117
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
118
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
119
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
120
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
121
|
+
Classifier: Programming Language :: Other
|
|
122
|
+
Classifier: Programming Language :: Other Scripting Engines
|
|
123
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
124
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
125
|
+
Classifier: Framework :: IPython
|
|
126
|
+
Classifier: Framework :: Jupyter
|
|
127
|
+
Classifier: Typing :: Typed
|
|
128
|
+
Provides-Extra: kernel
|
|
129
|
+
Provides-Extra: watch
|
|
130
|
+
Provides-Extra: mypy
|
|
131
|
+
Provides-Extra: xonsh
|
|
132
|
+
Provides-Extra: numpy
|
|
133
|
+
Provides-Extra: jupyter
|
|
134
|
+
Provides-Extra: jupyterlab
|
|
135
|
+
Provides-Extra: jupytext
|
|
136
|
+
Provides-Extra: all
|
|
137
|
+
Provides-Extra: ipython
|
|
138
|
+
Provides-Extra: docs
|
|
139
|
+
Provides-Extra: tests
|
|
140
|
+
Provides-Extra: dev
|
{coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/_pyparsing.py
RENAMED
|
@@ -39,7 +39,6 @@ from coconut.constants import (
|
|
|
39
39
|
min_versions,
|
|
40
40
|
max_versions,
|
|
41
41
|
pure_python_env_var,
|
|
42
|
-
enable_pyparsing_warnings,
|
|
43
42
|
use_left_recursion_if_available,
|
|
44
43
|
get_bool_env_var,
|
|
45
44
|
use_computation_graph_env_var,
|
|
@@ -243,8 +242,9 @@ USE_COMPUTATION_GRAPH = get_bool_env_var(
|
|
|
243
242
|
use_computation_graph_env_var,
|
|
244
243
|
default=(
|
|
245
244
|
not MODERN_PYPARSING # not yet supported
|
|
246
|
-
#
|
|
247
|
-
# and
|
|
245
|
+
# technically PYPY is faster without the computation graph, but
|
|
246
|
+
# it breaks some features and balloons the memory footprint
|
|
247
|
+
# and not PYPY
|
|
248
248
|
),
|
|
249
249
|
)
|
|
250
250
|
|
|
@@ -265,7 +265,7 @@ else:
|
|
|
265
265
|
|
|
266
266
|
maybe_make_safe = getattr(_pyparsing, "maybe_make_safe", None)
|
|
267
267
|
|
|
268
|
-
if
|
|
268
|
+
if DEVELOP:
|
|
269
269
|
if MODERN_PYPARSING:
|
|
270
270
|
_pyparsing.enable_all_warnings()
|
|
271
271
|
else:
|
|
@@ -27,7 +27,9 @@ from coconut.command.command import Command
|
|
|
27
27
|
|
|
28
28
|
class CoconutException(Exception):
|
|
29
29
|
"""Coconut Exception."""
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
def syntax_err(self) -> SyntaxError:
|
|
32
|
+
...
|
|
31
33
|
|
|
32
34
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
33
35
|
# COMMAND:
|
{coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/compiler.py
RENAMED
|
@@ -813,6 +813,7 @@ class Compiler(Grammar, pickleable_obj):
|
|
|
813
813
|
cls.unsafe_typedef_tuple <<= attach(cls.unsafe_typedef_tuple_ref, cls.method("unsafe_typedef_tuple_handle"))
|
|
814
814
|
cls.impl_call <<= attach(cls.impl_call_ref, cls.method("impl_call_handle"))
|
|
815
815
|
cls.protocol_intersect_expr <<= attach(cls.protocol_intersect_expr_ref, cls.method("protocol_intersect_expr_handle"))
|
|
816
|
+
cls.and_expr <<= attach(cls.and_expr_ref, cls.method("and_expr_handle"))
|
|
816
817
|
|
|
817
818
|
# these handlers just do strict/target checking
|
|
818
819
|
cls.u_string <<= attach(cls.u_string_ref, cls.method("u_string_check"))
|
|
@@ -4567,18 +4568,40 @@ async with {iter_item} as {temp_var}:
|
|
|
4567
4568
|
loop=loop
|
|
4568
4569
|
)
|
|
4569
4570
|
|
|
4570
|
-
def string_atom_handle(self, tokens):
|
|
4571
|
+
def string_atom_handle(self, original, loc, tokens, allow_silent_concat=False):
|
|
4571
4572
|
"""Handle concatenation of string literals."""
|
|
4572
4573
|
internal_assert(len(tokens) >= 1, "invalid string literal tokens", tokens)
|
|
4573
|
-
if
|
|
4574
|
-
return
|
|
4575
|
-
elif any(s.startswith(("f", "rf")) for s in tokens): # has f-strings
|
|
4576
|
-
return " ".join(tokens)
|
|
4574
|
+
if len(tokens) == 1:
|
|
4575
|
+
return tokens[0]
|
|
4577
4576
|
else:
|
|
4578
|
-
|
|
4577
|
+
if not allow_silent_concat:
|
|
4578
|
+
self.strict_err_or_warn("found Python-style implicit string concatenation (use explicit '+' for clarity; Coconut will compile it away)", original, loc)
|
|
4579
|
+
if any(s.endswith(")") for s in tokens): # has .format() calls
|
|
4580
|
+
# parens are necessary for string_atom_handle
|
|
4581
|
+
return "(" + " + ".join(tokens) + ")"
|
|
4582
|
+
elif any(s.startswith(("f", "rf")) for s in tokens): # has f-strings
|
|
4583
|
+
return " ".join(tokens)
|
|
4584
|
+
else:
|
|
4585
|
+
return self.eval_now(" ".join(tokens))
|
|
4579
4586
|
|
|
4580
4587
|
string_atom_handle.ignore_one_token = True
|
|
4581
4588
|
|
|
4589
|
+
def and_expr_handle(self, original, loc, tokens):
|
|
4590
|
+
"""Handle expressions that could be explicit string concatenation."""
|
|
4591
|
+
item, labels = tokens[0]
|
|
4592
|
+
out = [item]
|
|
4593
|
+
all_items = [item]
|
|
4594
|
+
is_str_concat = "IS_STR" in labels
|
|
4595
|
+
for i in range(1, len(tokens), 2):
|
|
4596
|
+
op, (item, labels) = tokens[i:i + 2]
|
|
4597
|
+
out += [op, item]
|
|
4598
|
+
all_items.append(item)
|
|
4599
|
+
is_str_concat = is_str_concat and "IS_STR" in labels and op == "+"
|
|
4600
|
+
if is_str_concat:
|
|
4601
|
+
return self.string_atom_handle(original, loc, all_items, allow_silent_concat=True)
|
|
4602
|
+
else:
|
|
4603
|
+
return " ".join(out)
|
|
4604
|
+
|
|
4582
4605
|
def unsafe_typedef_tuple_handle(self, original, loc, tokens):
|
|
4583
4606
|
"""Handle Tuples in typedefs."""
|
|
4584
4607
|
tuple_items = self.testlist_star_expr_handle(original, loc, tokens)
|
|
@@ -4595,6 +4618,8 @@ async with {iter_item} as {temp_var}:
|
|
|
4595
4618
|
out += [op, term]
|
|
4596
4619
|
return " ".join(out)
|
|
4597
4620
|
|
|
4621
|
+
term_handle.ignore_one_token = True
|
|
4622
|
+
|
|
4598
4623
|
def impl_call_handle(self, loc, tokens):
|
|
4599
4624
|
"""Process implicit function application or coefficient syntax."""
|
|
4600
4625
|
internal_assert(len(tokens) >= 2, "invalid implicit call / coefficient tokens", tokens)
|
{coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/grammar.py
RENAMED
|
@@ -119,6 +119,7 @@ from coconut.compiler.util import (
|
|
|
119
119
|
using_fast_grammar_methods,
|
|
120
120
|
disambiguate_literal,
|
|
121
121
|
any_of,
|
|
122
|
+
add_labels,
|
|
122
123
|
)
|
|
123
124
|
|
|
124
125
|
|
|
@@ -592,15 +593,6 @@ def join_match_funcdef(tokens):
|
|
|
592
593
|
)
|
|
593
594
|
|
|
594
595
|
|
|
595
|
-
def kwd_err_msg_handle(tokens):
|
|
596
|
-
"""Handle keyword parse error messages."""
|
|
597
|
-
kwd, = tokens
|
|
598
|
-
if kwd == "def":
|
|
599
|
-
return "invalid function definition"
|
|
600
|
-
else:
|
|
601
|
-
return 'invalid use of the keyword "' + kwd + '"'
|
|
602
|
-
|
|
603
|
-
|
|
604
596
|
def alt_ternary_handle(tokens):
|
|
605
597
|
"""Handle if ... then ... else ternary operator."""
|
|
606
598
|
cond, if_true, if_false = tokens
|
|
@@ -1378,7 +1370,8 @@ class Grammar(object):
|
|
|
1378
1370
|
# for known_atom, type should be known at compile time
|
|
1379
1371
|
known_atom = (
|
|
1380
1372
|
const_atom
|
|
1381
|
-
|
|
1373
|
+
# IS_STR is used by and_expr_handle
|
|
1374
|
+
| string_atom("IS_STR")
|
|
1382
1375
|
| list_item
|
|
1383
1376
|
| dict_literal
|
|
1384
1377
|
| dict_comp
|
|
@@ -1582,14 +1575,13 @@ class Grammar(object):
|
|
|
1582
1575
|
# arith_expr = exprlist(term, addop)
|
|
1583
1576
|
# shift_expr = exprlist(arith_expr, shift)
|
|
1584
1577
|
# and_expr = exprlist(shift_expr, amp)
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
shift,
|
|
1590
|
-
amp,
|
|
1591
|
-
),
|
|
1578
|
+
term_op = any_of(
|
|
1579
|
+
addop,
|
|
1580
|
+
shift,
|
|
1581
|
+
amp,
|
|
1592
1582
|
)
|
|
1583
|
+
and_expr = Forward()
|
|
1584
|
+
and_expr_ref = tokenlist(attach(term, add_labels), term_op, allow_trailing=False, suppress=False)
|
|
1593
1585
|
|
|
1594
1586
|
protocol_intersect_expr = Forward()
|
|
1595
1587
|
protocol_intersect_expr_ref = tokenlist(and_expr, amp_colon, allow_trailing=False)
|
|
@@ -2863,7 +2855,7 @@ class Grammar(object):
|
|
|
2863
2855
|
"misplaced '?' (naked '?' is only supported inside partial application arguments)",
|
|
2864
2856
|
)
|
|
2865
2857
|
| fixto(Optional(keyword("if") + skip_to_in_line(unsafe_equals)) + equals, "misplaced assignment (maybe should be '==')")
|
|
2866
|
-
|
|
|
2858
|
+
| fixto(keyword("def"), "invalid function definition")
|
|
2867
2859
|
| fixto(end_of_line, "misplaced newline (maybe missing ':')")
|
|
2868
2860
|
)
|
|
2869
2861
|
|
{coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/header.py
RENAMED
|
@@ -968,24 +968,24 @@ import os as _coconut_os
|
|
|
968
968
|
_coconut_cached__coconut__ = _coconut_sys.modules.get({__coconut__})
|
|
969
969
|
_coconut_file_dir = {coconut_file_dir}
|
|
970
970
|
_coconut_pop_path = False
|
|
971
|
-
if _coconut_cached__coconut__ is None or getattr(_coconut_cached__coconut__, "_coconut_header_info", None) != _coconut_header_info and _coconut_os.path.dirname(_coconut_cached__coconut__.__file__ or "") != _coconut_file_dir:
|
|
971
|
+
if _coconut_cached__coconut__ is None or getattr(_coconut_cached__coconut__, "_coconut_header_info", None) != _coconut_header_info and _coconut_os.path.dirname(_coconut_cached__coconut__.__file__ or "") != _coconut_file_dir: # type: ignore
|
|
972
972
|
if _coconut_cached__coconut__ is not None:
|
|
973
973
|
_coconut_sys.modules[{_coconut_cached__coconut__}] = _coconut_cached__coconut__
|
|
974
974
|
del _coconut_sys.modules[{__coconut__}]
|
|
975
975
|
_coconut_sys.path.insert(0, _coconut_file_dir)
|
|
976
976
|
_coconut_pop_path = True
|
|
977
977
|
_coconut_module_name = _coconut_os.path.splitext(_coconut_os.path.basename(_coconut_file_dir))[0]
|
|
978
|
-
if _coconut_module_name and _coconut_module_name[0].isalpha() and all(c.isalpha() or c.isdigit() for c in _coconut_module_name) and "__init__.py" in _coconut_os.listdir(_coconut_file_dir):
|
|
979
|
-
_coconut_full_module_name = str(_coconut_module_name + ".__coconut__")
|
|
978
|
+
if _coconut_module_name and _coconut_module_name[0].isalpha() and all(c.isalpha() or c.isdigit() for c in _coconut_module_name) and "__init__.py" in _coconut_os.listdir(_coconut_file_dir): # type: ignore
|
|
979
|
+
_coconut_full_module_name = str(_coconut_module_name + ".__coconut__") # type: ignore
|
|
980
980
|
import __coconut__ as _coconut__coconut__
|
|
981
981
|
_coconut__coconut__.__name__ = _coconut_full_module_name
|
|
982
|
-
for _coconut_v in vars(_coconut__coconut__).values():
|
|
983
|
-
if getattr(_coconut_v, "__module__", None) == {__coconut__}:
|
|
982
|
+
for _coconut_v in vars(_coconut__coconut__).values(): # type: ignore
|
|
983
|
+
if getattr(_coconut_v, "__module__", None) == {__coconut__}: # type: ignore
|
|
984
984
|
try:
|
|
985
985
|
_coconut_v.__module__ = _coconut_full_module_name
|
|
986
986
|
except AttributeError:
|
|
987
|
-
_coconut_v_type = type(_coconut_v)
|
|
988
|
-
if getattr(_coconut_v_type, "__module__", None) == {__coconut__}:
|
|
987
|
+
_coconut_v_type = type(_coconut_v) # type: ignore
|
|
988
|
+
if getattr(_coconut_v_type, "__module__", None) == {__coconut__}: # type: ignore
|
|
989
989
|
_coconut_v_type.__module__ = _coconut_full_module_name
|
|
990
990
|
_coconut_sys.modules[_coconut_full_module_name] = _coconut__coconut__
|
|
991
991
|
from __coconut__ import *
|
{coconut_develop-3.1.0.post0.dev11 → coconut-develop-3.1.0.post0.dev12}/coconut/compiler/matching.py
RENAMED
|
@@ -639,6 +639,22 @@ if {assign_to} is _coconut_sentinel:
|
|
|
639
639
|
elif "elem" in group:
|
|
640
640
|
group_type = "elem_matches"
|
|
641
641
|
group_contents = group
|
|
642
|
+
# must check for f_string before string, since a mixture will be tagged as both
|
|
643
|
+
elif "f_string" in group:
|
|
644
|
+
group_type = "f_string"
|
|
645
|
+
# f strings are always unicode
|
|
646
|
+
if seq_type is None:
|
|
647
|
+
seq_type = '"'
|
|
648
|
+
elif seq_type != '"':
|
|
649
|
+
raise CoconutDeferredSyntaxError("string literals and byte literals cannot be mixed in string patterns", self.loc)
|
|
650
|
+
for str_literal in group:
|
|
651
|
+
if str_literal.startswith("b"):
|
|
652
|
+
raise CoconutDeferredSyntaxError("string literals and byte literals cannot be mixed in string patterns", self.loc)
|
|
653
|
+
if len(group) == 1:
|
|
654
|
+
str_item = group[0]
|
|
655
|
+
else:
|
|
656
|
+
str_item = self.comp.string_atom_handle(self.original, self.loc, group, allow_silent_concat=True)
|
|
657
|
+
group_contents = (str_item, "_coconut.len(" + str_item + ")")
|
|
642
658
|
elif "string" in group:
|
|
643
659
|
group_type = "string"
|
|
644
660
|
for str_literal in group:
|
|
@@ -655,16 +671,6 @@ if {assign_to} is _coconut_sentinel:
|
|
|
655
671
|
else:
|
|
656
672
|
str_item = self.comp.eval_now(" ".join(group))
|
|
657
673
|
group_contents = (str_item, len(self.comp.literal_eval(str_item)))
|
|
658
|
-
elif "f_string" in group:
|
|
659
|
-
group_type = "f_string"
|
|
660
|
-
# f strings are always unicode
|
|
661
|
-
if seq_type is None:
|
|
662
|
-
seq_type = '"'
|
|
663
|
-
elif seq_type != '"':
|
|
664
|
-
raise CoconutDeferredSyntaxError("string literals and byte literals cannot be mixed in string patterns", self.loc)
|
|
665
|
-
internal_assert(len(group) == 1, "invalid f string sequence match group", group)
|
|
666
|
-
str_item = group[0]
|
|
667
|
-
group_contents = (str_item, "_coconut.len(" + str_item + ")")
|
|
668
674
|
else:
|
|
669
675
|
raise CoconutInternalException("invalid sequence match group", group)
|
|
670
676
|
seq_groups.append((group_type, group_contents))
|
|
@@ -682,12 +688,12 @@ if {assign_to} is _coconut_sentinel:
|
|
|
682
688
|
bounded = False
|
|
683
689
|
elif gtype == "elem_matches":
|
|
684
690
|
min_len_int += len(gcontents)
|
|
685
|
-
elif gtype == "string":
|
|
686
|
-
str_item, str_len = gcontents
|
|
687
|
-
min_len_int += str_len
|
|
688
691
|
elif gtype == "f_string":
|
|
689
692
|
str_item, str_len = gcontents
|
|
690
693
|
min_len_strs.append(str_len)
|
|
694
|
+
elif gtype == "string":
|
|
695
|
+
str_item, str_len = gcontents
|
|
696
|
+
min_len_int += str_len
|
|
691
697
|
else:
|
|
692
698
|
raise CoconutInternalException("invalid sequence match group type", gtype)
|
|
693
699
|
min_len = add_int_and_strs(min_len_int, min_len_strs)
|
|
@@ -711,17 +717,17 @@ if {assign_to} is _coconut_sentinel:
|
|
|
711
717
|
self.add_check("_coconut.len(" + head_var + ") == " + str(len(matches)))
|
|
712
718
|
self.match_all_in(matches, head_var)
|
|
713
719
|
start_ind_int += len(matches)
|
|
720
|
+
elif seq_groups[0][0] == "f_string":
|
|
721
|
+
internal_assert(not iter_match, "cannot be both f string and iter match")
|
|
722
|
+
_, (str_item, str_len) = seq_groups.pop(0)
|
|
723
|
+
self.add_check(item + ".startswith(" + str_item + ")")
|
|
724
|
+
start_ind_strs.append(str_len)
|
|
714
725
|
elif seq_groups[0][0] == "string":
|
|
715
726
|
internal_assert(not iter_match, "cannot be both string and iter match")
|
|
716
727
|
_, (str_item, str_len) = seq_groups.pop(0)
|
|
717
728
|
if str_len > 0:
|
|
718
729
|
self.add_check(item + ".startswith(" + str_item + ")")
|
|
719
730
|
start_ind_int += str_len
|
|
720
|
-
elif seq_groups[0][0] == "f_string":
|
|
721
|
-
internal_assert(not iter_match, "cannot be both f string and iter match")
|
|
722
|
-
_, (str_item, str_len) = seq_groups.pop(0)
|
|
723
|
-
self.add_check(item + ".startswith(" + str_item + ")")
|
|
724
|
-
start_ind_strs.append(str_len)
|
|
725
731
|
if not seq_groups:
|
|
726
732
|
return
|
|
727
733
|
start_ind = add_int_and_strs(start_ind_int, start_ind_strs)
|
|
@@ -735,17 +741,17 @@ if {assign_to} is _coconut_sentinel:
|
|
|
735
741
|
for i, match in enumerate(matches):
|
|
736
742
|
self.match(match, item + "[-" + str(len(matches) - i) + "]")
|
|
737
743
|
last_ind_int -= len(matches)
|
|
744
|
+
elif seq_groups[-1][0] == "f_string":
|
|
745
|
+
internal_assert(not iter_match, "cannot be both f string and iter match")
|
|
746
|
+
_, (str_item, str_len) = seq_groups.pop()
|
|
747
|
+
self.add_check(item + ".endswith(" + str_item + ")")
|
|
748
|
+
last_ind_strs.append("-" + str_len)
|
|
738
749
|
elif seq_groups[-1][0] == "string":
|
|
739
750
|
internal_assert(not iter_match, "cannot be both string and iter match")
|
|
740
751
|
_, (str_item, str_len) = seq_groups.pop()
|
|
741
752
|
if str_len > 0:
|
|
742
753
|
self.add_check(item + ".endswith(" + str_item + ")")
|
|
743
754
|
last_ind_int -= str_len
|
|
744
|
-
elif seq_groups[-1][0] == "f_string":
|
|
745
|
-
internal_assert(not iter_match, "cannot be both f string and iter match")
|
|
746
|
-
_, (str_item, str_len) = seq_groups.pop()
|
|
747
|
-
self.add_check(item + ".endswith(" + str_item + ")")
|
|
748
|
-
last_ind_strs.append("-" + str_len)
|
|
749
755
|
if not seq_groups:
|
|
750
756
|
return
|
|
751
757
|
last_ind = add_int_and_strs(last_ind_int, last_ind_strs)
|