Skip to content

Commit 8ecf3b6

Browse files
committed
Fix coding style to please ruff
1 parent b426705 commit 8ecf3b6

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

tests/test_tokenizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def tokens_match(expected, received):
8585
8686
"""
8787
check_self_closing = any(
88-
token[0] == "StartTag" and len(token) == 4 or
89-
token[0] == "EndTag" and len(token) == 3
88+
(token[0] == "StartTag" and len(token) == 4) or
89+
(token[0] == "EndTag" and len(token) == 3)
9090
for token in expected)
9191
if not check_self_closing:
9292
for token in received:

tinyhtml5/parser.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def dispatch(items):
295295

296296
class Phase:
297297
"""Base class for helper that implements each phase of processing."""
298-
__slots__ = ("parser", "tree", "__start_tag_cache", "__end_tag_cache")
298+
__slots__ = ("__end_tag_cache", "__start_tag_cache", "parser", "tree")
299299

300300
def __init__(self, parser, tree):
301301
self.parser = parser
@@ -377,7 +377,7 @@ def process_doctype(self, token):
377377
correct = token["correct"]
378378

379379
if (name != "html" or public_id is not None or
380-
system_id is not None and system_id != "about:legacy-compat"):
380+
(system_id is not None and system_id != "about:legacy-compat")):
381381
self.parser.parse_error("unknown-doctype")
382382

383383
if public_id is None:
@@ -450,20 +450,20 @@ def process_doctype(self, token):
450450
public_id in ("-//w3o//dtd w3 html strict 3.0//en//",
451451
"-/w3c/dtd html 4.0 transitional/en",
452452
"html") or
453-
public_id.startswith(
453+
(public_id.startswith(
454454
("-//w3c//dtd html 4.01 frameset//",
455455
"-//w3c//dtd html 4.01 transitional//")) and
456-
system_id is None or
457-
system_id and system_id.lower() ==
458-
"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"):
456+
system_id is None) or
457+
(system_id and system_id.lower() ==
458+
"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd")):
459459
self.parser.compatibility_mode = "quirks"
460460
elif (public_id.startswith(
461461
("-//w3c//dtd xhtml 1.0 frameset//",
462462
"-//w3c//dtd xhtml 1.0 transitional//")) or
463-
public_id.startswith(
463+
(public_id.startswith(
464464
("-//w3c//dtd html 4.01 frameset//",
465465
"-//w3c//dtd html 4.01 transitional//")) and
466-
system_id is not None):
466+
system_id is not None)):
467467
self.parser.compatibility_mode = "limited quirks"
468468

469469
self.parser.phase = self.parser.phases["before html"]
@@ -1706,7 +1706,7 @@ def end_tag_other(self, token):
17061706

17071707

17081708
class InTableTextPhase(Phase):
1709-
__slots__ = ("original_phase", "character_tokens")
1709+
__slots__ = ("character_tokens", "original_phase")
17101710

17111711
def __init__(self, *args, **kwargs):
17121712
super().__init__(*args, **kwargs)

0 commit comments

Comments
 (0)