"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pylint/checkers/refactoring/recommendation_checker.py" between
pylint-2.14.1.tar.gz and pylint-2.14.2.tar.gz

About: pylint analyzes Python source code looking for bugs and signs of poor quality.

recommendation_checker.py  (pylint-2.14.1):recommendation_checker.py  (pylint-2.14.2)
skipping to change at line 396 skipping to change at line 396
node=node, node=node,
line=node.lineno, line=node.lineno,
col_offset=node.col_offset, col_offset=node.col_offset,
) )
elif isinstance(node.parent, nodes.BinOp) and node.parent.op == "%": elif isinstance(node.parent, nodes.BinOp) and node.parent.op == "%":
# Backslashes can't be in f-string expressions # Backslashes can't be in f-string expressions
if "\\" in node.parent.right.as_string(): if "\\" in node.parent.right.as_string():
return return
# If % applied to another type than str, it's modulo and can't be re
placed by formatting
if not hasattr(node.parent.left, "value") or not isinstance(
node.parent.left.value, str
):
return
inferred_right = utils.safe_infer(node.parent.right) inferred_right = utils.safe_infer(node.parent.right)
# If dicts or lists of length > 1 are used # If dicts or lists of length > 1 are used
if isinstance(inferred_right, nodes.Dict): if isinstance(inferred_right, nodes.Dict):
if len(inferred_right.items) > 1: if len(inferred_right.items) > 1:
return return
elif isinstance(inferred_right, nodes.List): elif isinstance(inferred_right, nodes.List):
if len(inferred_right.elts) > 1: if len(inferred_right.elts) > 1:
return return
 End of changes. 1 change blocks. 
0 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)