rope icon indicating copy to clipboard operation
rope copied to clipboard

Rope does not support the syntax for keyword arguments only __init_subclass__

Open rdbisme opened this issue 3 years ago • 1 comments

class PhaseState(SubsetState, SingleFluidState, abstract=True):
    """This :class:`ConsSubsetState` stores two sets of indices, one per
    phase, and it matches the field names with a regex in order to detect the
    phase they are member of. This is needed to support out-of-order listing of
    fields"""

    _REGEX_PATTERN = re.compile(r"\w+(\d{1})")
    _subset_fields_map: PhasePair

    def __init_subclass__(cls, /, abstract=False, **kwargs):
        pass


This generates a syntax error for me while refactoring using ropevim

rdbisme avatar Jul 12 '21 14:07 rdbisme

Hi, what Python version are you using to run Rope?

Syntax error usually happens because your editor is running Rope with Python version that doesn't support the syntax you're trying to use.

Rope used the ast standard library module to parse Python, so Rope only supports syntax that are supported by the version of Python that rope itself is running as.

The positional only syntax was added in Python 3.8. Can you configure your editor to try running rope with Python 3.8 or higher and see if this is still an issue there?

lieryan avatar Sep 03 '21 21:09 lieryan

Closing. Cannot reproduce with latest version of rope using appropriate version of Python.

If you think this is incorrect, please provide additional details on what exactly you're trying to do and with environment info (version of python, rope, and editor).

lieryan avatar Nov 30 '22 11:11 lieryan