godot-gdscript-toolkit
godot-gdscript-toolkit copied to clipboard
Broken Lark Dependency
Hi,
With the latest changes I seem to have some broken dependencies. When trying to run the gdlint or gdformat hooks from pre commit I get the following errors (shown below). I haven't made any changes to my python environment and tried a fresh install of the pre-commit env too.
gdlint...................................................................Failed
- hook id: gdlint
- exit code: 1
Traceback (most recent call last):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 590, in lex
yield lexer.next_token(lexer_state, parser_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 528, in next_token
raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: <exception str() failed>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__main__.py", line 134, in _lint_file
problems = lint_code(content, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__init__.py", line 118, in lint_code
parse_tree = parser.parse(gdscript_code, gather_metadata=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\parser\parser.py", line 62, in parse
self._parser_with_metadata.parse(adjusted_code)
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lark.py", line 645, in parse
return self.parser.parse(text, start=start, on_error=on_error)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parser_frontends.py", line 96, in parse
return self.parser.parse(stream, chosen_start, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 41, in parse
return self.parser.parse(lexer, start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 171, in parse
return self.parse_from_state(parser_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 193, in parse_from_state
raise e
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 183, in parse_from_state
for token in state.lexer.lex(state):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\indenter.py", line 45, in _process
for token in stream:
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 599, in lex
raise UnexpectedToken(token, e.allowed, state=parser_state, token_history=[last_token], terminals_by_name=self.root_lexer.terminals_by_name)
lark.exceptions.UnexpectedToken: <exception str() failed>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 14, in lark_unexpected_token_to_str
return f"{exception.get_context(code)}\n{exception}"
^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__
% (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr
return self.pattern.raw or self.name
^^^^^^^^^^^^^^^^
AttributeError: 'PatternStr' object has no attribute 'raw'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Scripts\gdlint.EXE\__main__.py", line 7, in <module>
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__main__.py", line 66, in main
problems_total += _lint_file(file_path, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__main__.py", line 148, in _lint_file
lark_unexpected_token_to_str(exception, content),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 16, in lark_unexpected_token_to_str
return f"{exception}".strip()
^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__
% (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr
return self.pattern.raw or self.name
^^^^^^^^^^^^^^^^
AttributeError: 'PatternStr' object has no attribute 'raw'
gdformat.................................................................Failed
- hook id: gdformat
- exit code: 1
Traceback (most recent call last):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 590, in lex
yield lexer.next_token(lexer_state, parser_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 528, in next_token
raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: <exception str() failed>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 209, in _format_code
code_parse_tree = parser.parse(code, gather_metadata=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\parser\parser.py", line 62, in parse
self._parser_with_metadata.parse(adjusted_code)
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lark.py", line 645, in parse
return self.parser.parse(text, start=start, on_error=on_error)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parser_frontends.py", line 96, in parse
return self.parser.parse(stream, chosen_start, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 41, in parse
return self.parser.parse(lexer, start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 171, in parse
return self.parse_from_state(parser_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 193, in parse_from_state
raise e
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 183, in parse_from_state
for token in state.lexer.lex(state):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\indenter.py", line 45, in _process
for token in stream:
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 599, in lex
raise UnexpectedToken(token, e.allowed, state=parser_state, token_history=[last_token], terminals_by_name=self.root_lexer.terminals_by_name)
lark.exceptions.UnexpectedToken: <exception str() failed>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 14, in lark_unexpected_token_to_str
return f"{exception.get_context(code)}\n{exception}"
^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__
% (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr
return self.pattern.raw or self.name
^^^^^^^^^^^^^^^^
AttributeError: 'PatternStr' object has no attribute 'raw'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Scripts\gdformat.EXE\__main__.py", line 7, in <module>
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 78, in main
_format_files(files, line_length, spaces_for_indent, safety_checks)
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 167, in _format_files
success, actually_formatted, formatted_code = _format_code(
^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 233, in _format_code
lark_unexpected_token_to_str(
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 16, in lark_unexpected_token_to_str
return f"{exception}".strip()
^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__
% (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr
return self.pattern.raw or self.name
^^^^^^^^^^^^^^^^
AttributeError: 'PatternStr' object has no attribute 'raw'
Hi,
With the latest changes I seem to have some broken dependencies. When trying to run the gdlint or gdformat hooks from pre commit I get the following errors (shown below). I haven't made any changes to my python environment and tried a fresh install of the pre-commit env too.
gdlint...................................................................Failed - hook id: gdlint - exit code: 1 Traceback (most recent call last): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 590, in lex yield lexer.next_token(lexer_state, parser_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 528, in next_token raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column, lark.exceptions.UnexpectedCharacters: <exception str() failed> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__main__.py", line 134, in _lint_file problems = lint_code(content, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__init__.py", line 118, in lint_code parse_tree = parser.parse(gdscript_code, gather_metadata=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\parser\parser.py", line 62, in parse self._parser_with_metadata.parse(adjusted_code) File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lark.py", line 645, in parse return self.parser.parse(text, start=start, on_error=on_error) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parser_frontends.py", line 96, in parse return self.parser.parse(stream, chosen_start, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 41, in parse return self.parser.parse(lexer, start) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 171, in parse return self.parse_from_state(parser_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 193, in parse_from_state raise e File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 183, in parse_from_state for token in state.lexer.lex(state): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\indenter.py", line 45, in _process for token in stream: File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 599, in lex raise UnexpectedToken(token, e.allowed, state=parser_state, token_history=[last_token], terminals_by_name=self.root_lexer.terminals_by_name) lark.exceptions.UnexpectedToken: <exception str() failed> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 14, in lark_unexpected_token_to_str return f"{exception.get_context(code)}\n{exception}" ^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__ % (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected] ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr return self.pattern.raw or self.name ^^^^^^^^^^^^^^^^ AttributeError: 'PatternStr' object has no attribute 'raw' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Scripts\gdlint.EXE\__main__.py", line 7, in <module> File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__main__.py", line 66, in main problems_total += _lint_file(file_path, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\linter\__main__.py", line 148, in _lint_file lark_unexpected_token_to_str(exception, content), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 16, in lark_unexpected_token_to_str return f"{exception}".strip() ^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__ % (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected] ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr return self.pattern.raw or self.name ^^^^^^^^^^^^^^^^ AttributeError: 'PatternStr' object has no attribute 'raw' gdformat.................................................................Failed - hook id: gdformat - exit code: 1 Traceback (most recent call last): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 590, in lex yield lexer.next_token(lexer_state, parser_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 528, in next_token raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column, lark.exceptions.UnexpectedCharacters: <exception str() failed> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 209, in _format_code code_parse_tree = parser.parse(code, gather_metadata=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\parser\parser.py", line 62, in parse self._parser_with_metadata.parse(adjusted_code) File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lark.py", line 645, in parse return self.parser.parse(text, start=start, on_error=on_error) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parser_frontends.py", line 96, in parse return self.parser.parse(stream, chosen_start, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 41, in parse return self.parser.parse(lexer, start) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 171, in parse return self.parse_from_state(parser_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 193, in parse_from_state raise e File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\parsers\lalr_parser.py", line 183, in parse_from_state for token in state.lexer.lex(state): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\indenter.py", line 45, in _process for token in stream: File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 599, in lex raise UnexpectedToken(token, e.allowed, state=parser_state, token_history=[last_token], terminals_by_name=self.root_lexer.terminals_by_name) lark.exceptions.UnexpectedToken: <exception str() failed> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 14, in lark_unexpected_token_to_str return f"{exception.get_context(code)}\n{exception}" ^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__ % (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected] ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr return self.pattern.raw or self.name ^^^^^^^^^^^^^^^^ AttributeError: 'PatternStr' object has no attribute 'raw' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Scripts\gdformat.EXE\__main__.py", line 7, in <module> File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 78, in main _format_files(files, line_length, spaces_for_indent, safety_checks) File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 167, in _format_files success, actually_formatted, formatted_code = _format_code( ^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\formatter\__main__.py", line 233, in _format_code lark_unexpected_token_to_str( File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\gdtoolkit\common\exceptions.py", line 16, in lark_unexpected_token_to_str return f"{exception}".strip() ^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 256, in __str__ % (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\exceptions.py", line 142, in _format_expected expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected] ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\.cache\pre-commit\repohvda1znc\py_env-python3\Lib\site-packages\lark\lexer.py", line 124, in user_repr return self.pattern.raw or self.name ^^^^^^^^^^^^^^^^ AttributeError: 'PatternStr' object has no attribute 'raw'
can you try forcing gdtoolkit reinstall?
Same error for me unfortunately.
I did py -m pip install --upgrade --force-reinstall gdtoolkit
then also uninstalled and reinitialised pre_commit environment again but still getting the error
Also just tried the following and both work when calling directly
py -m gdtoolkit.formatter ./
py -m gdtoolkit.linter ./
but through pre commit getting the error
For what's it worth to the discussion I also ran into this today after updating gdtoolkit, but py -m pip install --upgrade --force-reinstall gdtoolkit worked like a charm.
For what's it worth to the discussion I also ran into this today after updating gdtoolkit, but
py -m pip install --upgrade --force-reinstall gdtoolkitworked like a charm.
just had the same problem after installing (pip3 install "gdtoolkit==3.*"). This fixed it for me, thx :)