diff --git a/cxxheaderparser/gentest.py b/cxxheaderparser/gentest.py index a738298..c9fd498 100644 --- a/cxxheaderparser/gentest.py +++ b/cxxheaderparser/gentest.py @@ -1,7 +1,6 @@ import argparse import dataclasses import inspect -import re import subprocess import typing @@ -72,7 +71,7 @@ def gentest( data = parse_string(content, options=options) if fail: raise ValueError("did not fail") - except CxxParseError as e: + except CxxParseError: if not fail: raise # do it again, but strip the content so the error message matches diff --git a/cxxheaderparser/lexer.py b/cxxheaderparser/lexer.py index b62e660..af7769f 100644 --- a/cxxheaderparser/lexer.py +++ b/cxxheaderparser/lexer.py @@ -1,5 +1,3 @@ -import contextlib -from collections import deque import re import typing import sys @@ -838,8 +836,6 @@ class BoundedTokenStream(TokenStream): return len(self.tokbuf) > 0 def _fill_tokbuf(self, tokbuf: typing.Deque[LexToken]) -> bool: - from .errors import CxxParseError - raise CxxParseError("no more tokens left in this group") def current_location(self) -> Location: diff --git a/cxxheaderparser/parser.py b/cxxheaderparser/parser.py index 1b53429..c35707c 100644 --- a/cxxheaderparser/parser.py +++ b/cxxheaderparser/parser.py @@ -94,7 +94,7 @@ class CxxParser: ) self.anon_id = 0 - self.verbose = True if self.options.verbose else False + self.verbose = self.options.verbose if self.verbose: def debug_print(fmt: str, *args: typing.Any) -> None: diff --git a/cxxheaderparser/preprocessor.py b/cxxheaderparser/preprocessor.py index 33382dd..33f7771 100644 --- a/cxxheaderparser/preprocessor.py +++ b/cxxheaderparser/preprocessor.py @@ -5,7 +5,6 @@ Contains optional preprocessor support via pcpp import io import re import os -from os.path import relpath import typing from .options import PreprocessorFunction diff --git a/cxxheaderparser/simple.py b/cxxheaderparser/simple.py index a707877..421666b 100644 --- a/cxxheaderparser/simple.py +++ b/cxxheaderparser/simple.py @@ -50,7 +50,6 @@ from .types import ( ) from .parserstate import ( - State, ClassBlockState, ExternBlockState, NamespaceBlockState,