Skip to content

Commit fd4f032

Browse files
ambvgsnedders
andauthoredFeb 21, 2024
Constant phases (#567)
* Get rid of getPhases This added a fair bit of complexity, and notable made the Phase classes dynamically generated. However, by doing this, we no longer include "process the token using the rules for" phases in the debug log. Co-authored-by: Sam Sneddon <[email protected]>
1 parent 82c2599 commit fd4f032

File tree

3 files changed

+2172
-2190
lines changed

3 files changed

+2172
-2190
lines changed
 

‎html5lib/_utils.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,3 @@ def moduleFactory(baseModule, *args, **kwargs):
145145
return mod
146146

147147
return moduleFactory
148-
149-
150-
def memoize(func):
151-
cache = {}
152-
153-
def wrapped(*args, **kwargs):
154-
key = (tuple(args), tuple(kwargs.items()))
155-
if key not in cache:
156-
cache[key] = func(*args, **kwargs)
157-
return cache[key]
158-
159-
return wrapped

‎html5lib/html5parser.py

Lines changed: 2172 additions & 2177 deletions
Large diffs are not rendered by default.

‎html5lib/tests/test_parser2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def test_debug_log():
6868
('dataState', 'InBodyPhase', 'InBodyPhase', 'processStartTag', {'name': 'p', 'type': 'StartTag'}),
6969
('dataState', 'InBodyPhase', 'InBodyPhase', 'processCharacters', {'type': 'Characters'}),
7070
('dataState', 'InBodyPhase', 'InBodyPhase', 'processStartTag', {'name': 'script', 'type': 'StartTag'}),
71-
('dataState', 'InBodyPhase', 'InHeadPhase', 'processStartTag', {'name': 'script', 'type': 'StartTag'}),
7271
('scriptDataState', 'TextPhase', 'TextPhase', 'processCharacters', {'type': 'Characters'}),
7372
('dataState', 'TextPhase', 'TextPhase', 'processEndTag', {'name': 'script', 'type': 'EndTag'}),
7473
('dataState', 'InBodyPhase', 'InBodyPhase', 'processCharacters', {'type': 'Characters'}),

0 commit comments

Comments
 (0)
Please sign in to comment.