Skip to content

Commit

Permalink
remove unnecessary timing code, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaIng committed Mar 2, 2023
1 parent 3984211 commit 718c738
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions lark/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from abc import abstractmethod, ABC
import re
from contextlib import suppress
from time import time
from typing import (
TypeVar, Type, List, Dict, Iterator, Collection, Callable, Optional, FrozenSet, Any,
Pattern as REPattern, ClassVar, TYPE_CHECKING, overload
Expand All @@ -28,7 +27,7 @@
try:
interegular
except NameError:
interegular = interegular
interegular = None

class Pattern(Serialize, ABC):

Expand Down Expand Up @@ -587,7 +586,6 @@ class ContextualLexer(Lexer):
root_lexer: BasicLexer

def __init__(self, conf: 'LexerConf', states: Dict[str, Collection[str]], always_accept: Collection[str]=()) -> None:
start_time = time()
terminals = list(conf.terminals)
terminals_by_name = conf.terminals_by_name

Expand Down Expand Up @@ -615,8 +613,6 @@ def __init__(self, conf: 'LexerConf', states: Dict[str, Collection[str]], always

assert trad_conf.terminals is terminals
self.root_lexer = BasicLexer(trad_conf, comparator)
end_time = time()
logger.debug("ContextualLexer init time: %s" % (end_time - start_time,))

def lex(self, lexer_state: LexerState, parser_state: Any) -> Iterator[Token]:
try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_non_debug(self):
Lark(collision_grammar, parser='lalr', debug=False)
log = log.getvalue()
# no log message
self.assertEqual(len(log), 0)
self.assertEqual(log, "")

def test_loglevel_higher(self):
logger.setLevel(logging.ERROR)
Expand Down

0 comments on commit 718c738

Please sign in to comment.