Skip to content

Commit d9d9810

Browse files
committed
Refactor: Moved _find function to top
1 parent 74f76fd commit d9d9810

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

adafruit_templateengine.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,22 @@ def _find_include(template: str):
272272
return _INCLUDE_PATTERN.search(template)
273273

274274

275+
def _find_hash_comment(template: str):
276+
return _HASH_COMMENT_PATTERN.search(template)
277+
278+
279+
def _find_block_comment(template: str):
280+
return _BLOCK_COMMENT_PATTERN.search(template)
281+
282+
283+
def _find_token(template: str):
284+
return _TOKEN_PATTERN.search(template)
285+
286+
287+
def _token_is_on_own_line(text_before_token: str) -> bool:
288+
return _LSTRIP_BLOCK_PATTERN.search(text_before_token) is not None
289+
290+
275291
def _exists_and_is_file(path: str) -> bool:
276292
try:
277293
return (os.stat(path)[0] & 0b_11110000_00000000) == 0b_10000000_00000000
@@ -456,14 +472,6 @@ def _replace_blocks_with_replacements(template: str, replacements: "dict[str, st
456472
return template
457473

458474

459-
def _find_hash_comment(template: str):
460-
return _HASH_COMMENT_PATTERN.search(template)
461-
462-
463-
def _find_block_comment(template: str):
464-
return _BLOCK_COMMENT_PATTERN.search(template)
465-
466-
467475
def _remove_comments(
468476
template: str,
469477
*,
@@ -497,14 +505,6 @@ def _remove_matched_comment(template: str, comment_match: re.Match):
497505
return template
498506

499507

500-
def _find_token(template: str):
501-
return _TOKEN_PATTERN.search(template)
502-
503-
504-
def _token_is_on_own_line(text_before_token: str) -> bool:
505-
return _LSTRIP_BLOCK_PATTERN.search(text_before_token) is not None
506-
507-
508508
def _create_template_rendering_function( # pylint: disable=,too-many-locals,too-many-branches,too-many-statements
509509
template: str,
510510
language: str = Language.HTML,

0 commit comments

Comments
 (0)