crdoconnor / xeger

Library to generate random strings from regular expressions.
Other
121 stars 21 forks source link

sre_parse is not available in python 3.11 #22

Open gsemet opened 1 year ago

gsemet commented 1 year ago

Please update to use re.parse directly.

Error:

.venv/lib/python3.11/site-packages/jsonschema_default/__init__.py:28: in create_from
    obj = {p: _get_default(name=p, prop=prop, schema=schema) for p, prop in properties.items()}
.venv/lib/python3.11/site-packages/jsonschema_default/__init__.py:28: in <dictcomp>
    obj = {p: _get_default(name=p, prop=prop, schema=schema) for p, prop in properties.items()}
.venv/lib/python3.11/site-packages/jsonschema_default/__init__.py:61: in _get_default
    default = _get_default(name, any_of[0], schema)
.venv/lib/python3.11/site-packages/jsonschema_default/__init__.py:74: in _get_default
    default = generator(name, prop, schema)
.venv/lib/python3.11/site-packages/jsonschema_default/__init__.py:94: in _create_string
    default = x.xeger(regex_pattern)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <xeger.xeger.Xeger object at 0x7f01ce5b5790>, string_or_regex = '^(.+)$'
    def xeger(self, string_or_regex):
        try:
            pattern = string_or_regex.pattern
        except AttributeError:
            pattern = string_or_regex

>       parsed = re.sre_parse.parse(pattern)
E       AttributeError: module 're' has no attribute 'sre_parse'
.venv/lib/python3.11/site-packages/xeger/xeger.py:87: AttributeError
LanderMoerkerke commented 1 year ago

Fix in PR: https://github.com/crdoconnor/xeger/pull/21