pydocstyle icon indicating copy to clipboard operation
pydocstyle copied to clipboard

Add support for PEP701

Open parona-source opened this issue 2 years ago • 3 comments

  • fstrings are broken into several distinct tokens in py3.12, reattach them together as a singular string to preserve previous behavior.

Closes: https://github.com/PyCQA/pydocstyle/issues/646

  • [x] Add unit tests and integration tests where applicable.
    If you've added an error code or changed an error code behavior, you should probably add or change a test case file under tests/test_cases/ and add it to the list under tests/test_definitions.py.
    If you've added or changed a command line option, you should probably add or change a test in tests/test_integration.py.
  • [x] Add a line to the release notes (docs/release_notes.rst) under "Current Development Version".
    Make sure to include the PR number after you open and get one.

parona-source avatar Nov 01 '23 09:11 parona-source

docs/readthedocs.org:pydocstyle

Error

Problem in your project's configuration. No default configuration file found at repository's root.

Doesn't appear to be my fault?

Edit: Yep, config file is required after 10.8.0 (released October 24th).

https://github.com/readthedocs/readthedocs.org/pull/10367 https://github.com/readthedocs/readthedocs.org/issues/10587

parona-source avatar Nov 01 '23 09:11 parona-source

python3.12 -m tokenize <(echo 'f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"')
0,0-0,0:            ENCODING       'utf-8'        
1,0-1,2:            FSTRING_START  'f"'           
1,2-1,3:            OP             '{'            
1,3-1,5:            FSTRING_START  'f"'           
1,5-1,6:            OP             '{'            
1,6-1,8:            FSTRING_START  'f"'           
1,8-1,9:            OP             '{'            
1,9-1,11:           FSTRING_START  'f"'           
1,11-1,12:          OP             '{'            
1,12-1,14:          FSTRING_START  'f"'           
1,14-1,15:          OP             '{'            
1,15-1,17:          FSTRING_START  'f"'           
1,17-1,18:          OP             '{'            
1,18-1,19:          NUMBER         '1'            
1,19-1,20:          OP             '+'            
1,20-1,21:          NUMBER         '1'            
1,21-1,22:          OP             '}'            
1,22-1,23:          FSTRING_END    '"'            
1,23-1,24:          OP             '}'            
1,24-1,25:          FSTRING_END    '"'            
1,25-1,26:          OP             '}'            
1,26-1,27:          FSTRING_END    '"'            
1,27-1,28:          OP             '}'            
1,28-1,29:          FSTRING_END    '"'            
1,29-1,30:          OP             '}'            
1,30-1,31:          FSTRING_END    '"'            
1,31-1,32:          OP             '}'            
1,32-1,33:          FSTRING_END    '"'            
1,33-1,34:          NEWLINE        '\n'           
2,0-2,0:            ENDMARKER      '' 

nested fstrings. didn't take this into account.

parona-source avatar Nov 02 '23 05:11 parona-source

python3.12 -m tokenize <(echo 'f"""Do something. {f"This is a nested fstring."}"""')
0,0-0,0:            ENCODING       'utf-8'        
1,0-1,4:            FSTRING_START  'f"""'         
1,4-1,18:           FSTRING_MIDDLE 'Do something. '
1,18-1,19:          OP             '{'            
1,19-1,21:          FSTRING_START  'f"'           
1,21-1,46:          FSTRING_MIDDLE 'This is a nested fstring.'
1,46-1,47:          FSTRING_END    '"'            
1,47-1,48:          OP             '}'            
1,48-1,51:          FSTRING_END    '"""'          
1,51-1,52:          NEWLINE        '\n'           
2,0-2,0:            ENDMARKER      ''  
python3.11 -m tokenize <(echo 'f"""Do something. {f"This is a nested fstring."}"""')
0,0-0,0:            ENCODING       'utf-8'        
1,0-1,51:           STRING         'f"""Do something. {f"This is a nested fstring."}"""'
1,51-1,52:          NEWLINE        '\n'           
2,0-2,0:            ENDMARKER      ''

parona-source avatar Nov 02 '23 08:11 parona-source