PEP check

This commit is contained in:
Maximilien Rigaut 2022-05-31 05:42:12 +02:00
parent b30e209f15
commit 80effbb854
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
7 changed files with 14 additions and 14 deletions

View File

@ -255,7 +255,7 @@ class TableCellContainer(BaseContainer):
class LinebreakContainer(BaseContainer):
def export(self, _): # MONITOR: Observe behaviour when we'll be done, might cause unintended side-effects
def export(self, _): # MONITOR: Observe behaviour when we'll be done, might cause unintended side effects
return "<br/>\n"
@ -327,7 +327,7 @@ class ContextManager:
level="CRITICAL"
)
try:
container = _to_container[pile_start.label]()
container = _to_container[pile_start.label]() # noqa : F821
except KeyError:
log_exception(
KeyError(f"Element {self.pile[start].label} not in dictionary of tokens-containers correspondences."),
@ -346,7 +346,7 @@ class ContextManager:
for i in range(start, end):
if self.pile[i]:
# container.add(self.pile[i].to_container()) # This line transform the self modifiying containers # MONITOR
container.add(self.pile[i]) # Could also ignore the first and last element, or ignore the self modifying tokens
container.add(self.pile[i]) # Could also ignore the first and last element, or ignore the self modifying tokens # noqa : F821
self.pile[i] = None
container.add(self.pile[end])
self.pile[end] = None

View File

@ -290,7 +290,7 @@ class PreParser:
shortcut_s = self.get_element_from_config('aliases', 'images', shortcut)
_, _, var_list, var_dict = export.split_optionals(optionals)
request = export.ExportRequest('inline_elements', 'image', optionals)
request = export.ExportRequest('inline_elements', 'image', optionals) # noqa : F841
output = self.__env.export_mngr(request)
return output.start + self.make_replacements(shortcut_s, *var_list, **var_dict) + output.end

View File

@ -58,7 +58,7 @@ def env_checker():
pass
def begin_crawling(p_env):
def begin_crawling(p_env): # noqa : F811
"""
Starts reading every file in the userfiles and
adds them to the crawler object progressively.
@ -66,7 +66,7 @@ def begin_crawling(p_env):
pass
def begin_pre_parsing(p_env):
def begin_pre_parsing(p_env): # noqa : F811
"""
Create an importTree and checks for conflicts or loops;
then replaces imports with their contents,
@ -75,7 +75,7 @@ def begin_pre_parsing(p_env):
pass
def begin_parsing(p_env):
def begin_parsing(p_env): # noqa : F811
"""
For each of the generated files,
parses element after element and creates
@ -86,7 +86,7 @@ def begin_parsing(p_env):
pass
def begin_export(p_env):
def begin_export(p_env): # noqa : F811
"""
Replaces all parsed values with their attributed
correspondences as per the template_manager

View File

@ -311,7 +311,7 @@ def of_type(token_class):
def reparse(parse_element):
"""
Creates a function which re-parses given match with specified parsing element.
Creates a function which reparses given match with specified parsing element.
:param parse_element: pp object defining desired match
:return: returns a function parsing given match with specified parsing element
"""
@ -335,7 +335,7 @@ def split_optionals(optionals):
ci = ''
hi = ''
if not optionals:
return SplitOptionals()
return SplitOptionals() # noqa : E741
for element in optionals.content:
if element.label == 'optional:class':
ci += " " + element.content[0]

View File

@ -5,7 +5,7 @@
# from bootstraparse.modules.tools import __GLk, __GL, find_*_in_file
# __GLk(n) # Returns a file link n traceback objects back
# __GL() # Returns a line number at current position
# find_*_in_file(file) # Try to find (class, function or variable) in file and return it's line number
# find_*_in_file(file) # Try to find (class, function or variable) in file and return its line number
import inspect
import os
@ -106,7 +106,7 @@ def find_functions_in_file(file_path, list_function_name): # pragma: no cover (
:return: Dict of function found and line number
:rtype: dict
"""
return find_string_in_file(file_path, [re.compile(f"$def ({function_name})") for function_name in list_function_name])
return find_string_in_file(file_path, [re.compile(f"$def ({function_name})") for function_name in list_function_name]) # noqa
def find_classes_in_file(file_path, list_class_name): # pragma: no cover (Cursed code inspection)

View File

@ -893,7 +893,7 @@ def test_reparse(original_string, reparse_with, expected_output, line_test):
"""
print()
print(f"Reparsing string: '{original_string}'")
print("Defined at %(filename)s:%(lineno)d" % {'filename': __file__, 'lineno': int(line_test)})
print("Defined at %(filename)s:%(lineno)d" % {'filename': __file__, 'lineno': int(line_test)}) # noqa
print(f"With expression: '{reparse_with}'")
print("Defined at %(filename)s:%(lineno)d" % {'filename': __syntax_file,
'lineno': __definition_of_syntax_elements[reparse_with]})

View File

@ -45,7 +45,7 @@ _zipped_type_counterpart_container = [
def test_counterpart_container(type_n, expected_counterpart, expected_container, file_n):
"""Test the .counterpart() and .to_container() method of SemanticTypes."""
try:
token = type_n(["test"])
token = type_n(["test"]) # noqa
token.line_number = 1
assert token.counterpart() == expected_counterpart
if expected_container == "error":