Terseus
e5d6663721
Prevent incorrect syntax error with nonlocal of a parameter
...
Also includes a test for the error "name 'x' is assigned before nonlocal
declaration"
Fixes #175
2021-02-21 10:40:45 +01:00
Peter Law
0e20c33c21
Add type annotations to start- and end-pos attributes
...
These are frequently used within consuming code, so having annotations
avoids others needing to work around mypy errors from them.
2021-01-03 15:57:53 +00:00
gousaiyang
257ac768fb
Parenthesized single starred expression (*x) is no longer valid anywhere in Python 3.9+
2020-12-30 17:14:39 -08:00
gousaiyang
79aeb2a801
Fix various issues regarding starred expressions
...
- Properly check for starred expression deletion
- Check for starred expressions not in tuple/list/set (when not in assignment)
- Fix a bug that considered starred expression assignment `[*x] = 1` as invalid
- Enhance test cases for valid and invalid `del` statements and starred expressions
2020-12-30 13:11:59 -08:00
gousaiyang
b287476366
Allow unparenthesized walrus in set literals, set comprehensions and indexes
2020-11-27 14:46:54 -08:00
Tim Hatch
d39aadc4cc
Support named unicode characters in f-strings ( #160 )
...
* Support named unicode characters in f-strings
Fixes #154
The previous behavior misinterpreted the curly braces as enclosing an
expression. This change does some cursory validation so we can still
get parse errors in the most egregious cases, but does not validate that
the names are actually valid, only that they are name-shaped and have a
chance of being valid.
The character names appear to obey a few rules:
* Case insensitive
* Name characters are `[A-Z0-9 \-]`
* Whitespace before or after is not allowed
* Whitespace in the middle may only be a single space between words
* Dashes may occur at the start or middle of a word
```py
f"\N{A B}" # might be legal
f"\N{a b}" # equivalent to above
f"\N{A B}" # no way
f"\N{ A B }" # no way
f"""\N{A
B}""" # no way
```
For confirming this regex matches all (current) unicode character names:
```py
import re
import sys
import unicodedata
R = re.compile(r"[A-Za-z0-9\-]+(?: [A-Za-z0-9\-]+)*")
for i in range(sys.maxunicode):
try:
name = unicodedata.name(chr(i))
except ValueError:
# Some small values like 0 and 1 have no name, /shrug
continue
m = R.fullmatch(name)
if m is None:
print("FAIL", repr(name))
```
* Improve tests for named unicode escapes
2020-11-22 15:37:04 +03:00
Saiyang Gou
b08b61b578
Allow some unparenthesized syntactic structures in f-string expression part ( #159 )
...
Resolves #157 , #158
2020-11-19 16:32:59 +03:00
Saiyang Gou
034a9e8944
Properly check for invalid conversion character with f-string debugging syntax ( #156 )
2020-11-18 12:56:04 +03:00
Batuhan Taskaya
52cfa5a8ac
satisfy flake8
2020-09-24 10:48:22 +03:00
Batuhan Taskaya
606c528803
Retrieve all kinds of assignment targets from with test
2020-09-24 10:42:56 +03:00
Dave Halter
ea6b01b968
Use pathlib.Path instead of strings
2020-07-26 01:19:41 +02:00
Dave Halter
97c10facf7
Remove super arguments
2020-07-25 23:54:21 +02:00
Dave Halter
dcc756a373
Remove object inheritance
2020-07-25 18:20:56 +02:00
Dave Halter
8a34245239
Get rid of mypy issues with tokenize.py
2020-07-25 15:34:29 +02:00
Dave Halter
75b467e681
Some more small Python 3 changes
2020-07-25 02:33:24 +02:00
Dave Halter
902885656d
Remove some Python 3.6 references
2020-07-25 02:10:10 +02:00
Dave Halter
4f9f193747
Remove some Python 3.5/3.4 references
2020-07-25 02:04:58 +02:00
Dave Halter
86d53add2d
Remove sys.version_info usages that are no longer necessary
2020-07-25 01:53:51 +02:00
Dave Halter
22fb62336e
Remove failing examples that are just Python 2 examples
2020-07-25 01:49:44 +02:00
Dave Halter
6eb6ac0bb2
Ignore Python 2 specific code in tests
2020-07-25 01:41:33 +02:00
Dave Halter
7c68ba4c45
Remove absolute import future import checking
2020-07-25 01:33:11 +02:00
Dave Halter
19f4550ced
Use enum instead of our own logic
2020-07-24 17:39:49 +02:00
Dave Halter
a0662b3b3b
flake8 changes
2020-07-24 16:11:06 +02:00
Dave Halter
2962517be0
Get rid of the xfails
2020-07-24 15:43:41 +02:00
Dave Halter
93e74efc01
Some whitespace changes
2020-07-24 14:50:01 +02:00
Dave Halter
b5e2e67a4d
Remove support for parsing Python 2
2020-07-24 14:48:02 +02:00
Dave Halter
21f782dc34
Fix the tests
2020-07-24 01:45:31 +02:00
Dave Halter
164489cf97
Remove the u function and u literals
2020-07-24 01:39:03 +02:00
Dave Halter
736f616787
Remove FileNotFoundError and PermissionError from _compatibility.py
2020-07-24 01:24:59 +02:00
Dave Halter
3b263f0a0d
Fix a failing test
2020-07-24 01:01:23 +02:00
Dave Halter
c53321a440
Comprehensions are not valid as class params, fixes #122
2020-07-24 00:32:24 +02:00
Matthias Bussonnier
40e78ff7e0
Parse alpha, beta and rc versions strings.
...
fixes #142
2020-06-30 13:28:09 -07:00
Jocelyn Boullier
88874a5a9f
Fix #139 : newlines in async for comprehension
2020-06-29 18:40:55 +02:00
Dave Halter
58790c119e
Fix issues of #136
2020-06-19 20:20:00 +02:00
Dave Halter
3923ecf12f
Ignore permission errors when saving to cache
...
This might happen when a user doesn't have full access to his home directory.
Fixes davidhalter/jedi#1615
2020-06-19 12:06:46 +02:00
Dave Halter
bd33e4ef7e
Merge pull request #135 from isidentical/starred-expr
...
Improve handling of starred expression on different contexts
2020-06-05 12:58:14 +02:00
Batuhan Taskaya
891bfdaa04
Test only python3+
2020-06-04 22:09:04 +03:00
Batuhan Taskaya
5e1828b3f0
Check full error message
2020-06-04 22:02:12 +03:00
Batuhan Taskaya
44cf64a5f7
Improve handling of starred expression on different contexts (load/store)
2020-06-04 21:35:48 +03:00
Batuhan Taskaya
fe24f0dc1b
Implement garbage collections for inactive cache files ( #121 )
...
Cache files that weren't accessed in the last 30 days will be automatically
garbage collected. This collection happens when the `save_module` is called
via a lock system that would make it happen only one time per day.
2020-06-02 12:36:05 +03:00
Batuhan Taskaya
6f29c551fd
Adjust invalid aug assign target for 3.9+
2020-05-27 00:55:31 +02:00
Batuhan Taskaya
e0dc415bbc
Extend annotated assignment rule's RHS
2020-05-26 01:10:04 +03:00
Batuhan Taskaya
6b0e01c220
Revert trailing comma for 3.6<
2020-05-23 21:17:08 +03:00
Batuhan Taskaya
92396a9a16
allow trailing comma <3.6, test both postive/negative cases
2020-05-23 17:45:20 +03:00
Batuhan Taskaya
fe54800cdd
Check all arguments for unparenthesized generator expressions
...
Previously only the first argument on the argument list checked
against the generator expressions, now all argumnets are controlled.
2020-05-23 16:57:34 +03:00
Dave Halter
6ecd975516
Merge pull request #117 from isidentical/repeated-kwarg-39
...
Show which keyword argument is repeated on 3.9+
2020-05-23 15:15:14 +02:00
Batuhan Taskaya
27a7c16803
assert full message
2020-05-23 15:51:00 +03:00
Batuhan Taskaya
a06521d912
Don't give syntax errors for parenthesised kwargs <3.8
2020-05-23 14:43:43 +02:00
Batuhan Taskaya
216a77dce5
Show which keyword argument is repeated on 3.9+
2020-05-23 14:06:24 +03:00
Batuhan Taskaya
8f46481aaf
Raise violation on starred expressions where the child is a boolean/none
2020-05-23 01:09:38 +03:00