fname stringlengths 63 176 | rel_fname stringclasses 706
values | line int64 -1 4.5k | name stringlengths 1 81 | kind stringclasses 2
values | category stringclasses 2
values | info stringlengths 0 77.9k ⌀ |
|---|---|---|---|---|---|---|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,630 | add_message | ref | function | self.add_message(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,633 | as_string | ref | function | args=(f"{func}({node.iter.as_string()})",),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,637 | _is_and_or_ternary | def | function | def _is_and_or_ternary(node):
"""Returns true if node is 'condition and true_value or false_value' form.
All of: condition, true_value and false_value should not be a complex boolean expression
"""
return (
isinstance(node, nodes.BoolOp)
and node.op == "or"
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,654 | _and_or_ternary_arguments | def | function | def _and_or_ternary_arguments(node):
false_value = node.values[1]
condition, true_value = node.values[0].values
return condition, true_value, false_value
def visit_functiondef(self, node: nodes.FunctionDef) -> None:
self._return_nodes[node.name] = list(
node.nodes_of... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,659 | visit_functiondef | def | function | def visit_functiondef(self, node: nodes.FunctionDef) -> None:
self._return_nodes[node.name] = list(
node.nodes_of_class(nodes.Return, skip_klass=nodes.FunctionDef)
)
def _check_consistent_returns(self, node: nodes.FunctionDef) -> None:
"""Check that all return statements ins... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,661 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,664 | _check_consistent_returns | def | function | def _check_consistent_returns(self, node: nodes.FunctionDef) -> None:
"""Check that all return statements inside a function are consistent.
Return statements are consistent if:
- all returns are explicit and if there is no implicit return;
- all returns are empty and if ther... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,683 | _is_node_return_ended | ref | function | ) and self._is_node_return_ended(node):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,685 | add_message | ref | function | self.add_message("inconsistent-return-statements", node=node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,687 | _is_if_node_return_ended | def | function | def _is_if_node_return_ended(self, node: nodes.If) -> bool:
"""Check if the If node ends with an explicit return statement.
Args:
node (nodes.If): If node to be checked.
Returns:
bool: _True if the node ends with an explicit statement, _False otherwise.
"""
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,698 | _is_node_return_ended | ref | function | self._is_node_return_ended(_ifn)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,706 | _has_return_in_siblings | ref | function | if not self._has_return_in_siblings(node):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,711 | _is_node_return_ended | ref | function | self._is_node_return_ended(_ore)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,717 | _is_raise_node_return_ended | def | function | def _is_raise_node_return_ended(self, node: nodes.Raise) -> bool:
"""Check if the Raise node ends with an explicit return statement.
Args:
node (nodes.Raise): Raise node to be checked.
Returns:
bool: _True if the node ends with an explicit statement, _False otherwis... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,732 | is_node_inside_try_except | ref | function | if not utils.is_node_inside_try_except(node):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,737 | safe_infer | ref | function | exc = utils.safe_infer(node.exc)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,740 | pytype | ref | function | exc_name = exc.pytype().split(".")[-1]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,741 | get_exception_handlers | ref | function | handlers = utils.get_exception_handlers(node, exc_name)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,746 | _is_node_return_ended | ref | function | return any(self._is_node_return_ended(_handler) for _handler in handlers)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,750 | _is_node_return_ended | def | function | def _is_node_return_ended(self, node: nodes.NodeNG) -> bool:
"""Check if the node ends with an explicit return statement.
Args:
node (nodes.NodeNG): node to be checked.
Returns:
bool: _True if the node ends with an explicit statement, _False otherwise.
"""
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,765 | inferred | ref | function | funcdef_node = node.func.inferred()[0]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,766 | _is_function_def_never_returning | ref | function | if self._is_function_def_never_returning(funcdef_node):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,775 | _is_raise_node_return_ended | ref | function | return self._is_raise_node_return_ended(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,777 | _is_if_node_return_ended | ref | function | return self._is_if_node_return_ended(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,781 | get_children | ref | function | for _child in node.get_children()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,784 | get_children | ref | function | all_but_handler = set(node.get_children()) - handlers
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,786 | _is_node_return_ended | ref | function | self._is_node_return_ended(_child) for _child in all_but_handler
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,787 | _is_node_return_ended | ref | function | ) and all(self._is_node_return_ended(_child) for _child in handlers)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,796 | _is_node_return_ended | ref | function | return any(self._is_node_return_ended(_child) for _child in node.get_children())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,796 | get_children | ref | function | return any(self._is_node_return_ended(_child) for _child in node.get_children())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,799 | _has_return_in_siblings | def | function | def _has_return_in_siblings(node: nodes.NodeNG) -> bool:
"""Returns _True if there is at least one return in the node's siblings."""
next_sibling = node.next_sibling()
while next_sibling:
if isinstance(next_sibling, nodes.Return):
return _True
next_sib... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,801 | next_sibling | ref | function | next_sibling = node.next_sibling()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,805 | next_sibling | ref | function | next_sibling = next_sibling.next_sibling()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,808 | _is_function_def_never_returning | def | function | def _is_function_def_never_returning(self, node: nodes.FunctionDef) -> bool:
"""Return _True if the function never returns. _False otherwise.
Args:
node (nodes.FunctionDef): function definition node to be analyzed.
Returns:
bool: _True if the function never returns,... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,825 | qname | ref | function | return node.qname() in self._never_returning_functions
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,829 | _check_return_at_the_end | def | function | def _check_return_at_the_end(self, node):
"""Check for presence of a *single* return statement at the end of a
function. "return" or "return None" are useless because None is the
default return type if they are missing.
NOTE: produces a message only if there is a single return state... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,848 | add_message | ref | function | self.add_message("useless-return", node=node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,851 | add_message | ref | function | self.add_message("useless-return", node=node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,853 | _check_unnecessary_dict_index_lookup | def | function | def _check_unnecessary_dict_index_lookup(
self, node: Union[nodes.For, nodes.Comprehension]
) -> None:
"""Add message when accessing dict values by index lookup."""
# Verify that we have an .items() call and
# that the object which is iterated is used as a subscript in the
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,866 | safe_infer | ref | function | inferred = utils.safe_infer(node.iter.func)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,869 | as_string | ref | function | iterating_object_name = node.iter.func.expr.as_string()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,877 | get_children | ref | function | node.body if isinstance(node, nodes.For) else node.parent.get_children()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,880 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,906 | as_string | ref | function | or iterating_object_name != subscript.value.as_string()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,920 | add_message | ref | function | self.add_message(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,923 | as_string | ref | function | args=(node.target.elts[1].as_string()),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,931 | as_string | ref | function | or iterating_object_name != subscript.value.as_string()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,947 | safe_infer | ref | function | inferred = utils.safe_infer(value.slice)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,950 | add_message | ref | function | self.add_message(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 1,953 | as_string | ref | function | args=("1".join(value.as_string().rsplit("0", maxsplit=1)),),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 94 | LineSpecifs | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 110 | CplSuccessiveLinesLimits | def | class | __init__ |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 134 | LinesChunk | def | class | __init__ __eq__ __hash__ __repr__ __str__ |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 143 | Index | ref | function | self._index: Index = Index(num_line)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 169 | SuccessiveLinesLimits | def | class | __init__ start end end __repr__ |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 182 | start | def | function | def start(self) -> LineNumber:
return self._start
@property
def end(self) -> LineNumber:
return self._end
@end.setter
def end(self, value: LineNumber) -> None:
self._end = value
def __repr__(self) -> str:
return f"<SuccessiveLinesLimits <{self._start};{self._en... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 186 | end | def | function | def end(self) -> LineNumber:
return self._end
@end.setter
def end(self, value: LineNumber) -> None:
self._end = value
def __repr__(self) -> str:
return f"<SuccessiveLinesLimits <{self._start};{self._end}>>"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 190 | end | def | function | def end(self, value: LineNumber) -> None:
self._end = value
def __repr__(self) -> str:
return f"<SuccessiveLinesLimits <{self._start};{self._end}>>"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 197 | LineSetStartCouple | def | class | __repr__ __eq__ __hash__ increment |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 219 | increment | def | function | def increment(self, value: Index) -> "LineSetStartCouple":
return LineSetStartCouple(
Index(self.fst_lineset_index + value),
Index(self.snd_lineset_index + value),
)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 220 | LineSetStartCouple | ref | function | return LineSetStartCouple(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 221 | Index | ref | function | Index(self.fst_lineset_index + value),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 222 | Index | ref | function | Index(self.snd_lineset_index + value),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 229 | hash_lineset | def | function | def hash_lineset(
lineset: "LineSet", min_common_lines: int = DEFAULT_MIN_SIMILARITY_LINE
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 259 | Index | ref | function | index = Index(index_i)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 260 | SuccessiveLinesLimits | ref | function | index2lines[index] = SuccessiveLinesLimits(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 261 | LineNumber | ref | function | start=LineNumber(start_linenumber), end=LineNumber(end_linenumber)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 261 | LineNumber | ref | function | start=LineNumber(start_linenumber), end=LineNumber(end_linenumber)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 264 | LinesChunk | ref | function | l_c = LinesChunk(lineset.name, index, *succ_lines)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 270 | remove_successives | def | function | def remove_successives(all_couples: CplIndexToCplLines_T) -> None:
"""Removes all successive entries in the dictionary in argument.
:param all_couples: collection that has to be cleaned up from successives entries.
The keys are couples of indices that mark the beginning of common entrie... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 298 | increment | ref | function | test = couple.increment(Index(1))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 298 | Index | ref | function | test = couple.increment(Index(1))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 304 | increment | ref | function | test = test.increment(Index(1))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 304 | Index | ref | function | test = test.increment(Index(1))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 313 | filter_noncode_lines | def | function | def filter_noncode_lines(
ls_1: "LineSet",
stindex_1: Index,
ls_2: "LineSet",
stindex_2: Index,
common_lines_nb: int,
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 344 | Commonality | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 354 | Similar | def | class | __init__ append_stream run _compute_sims _display_sims _get_similarity_report _find_common _iter_sims get_map_data combine_mapreduce_data |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 372 | append_stream | def | function | def append_stream(
self, streamid: str, stream: STREAM_TYPES, encoding: Optional[str] = None
) -> None:
"""Append a file to search for similarities."""
if isinstance(stream, BufferedIOBase):
if encoding is None:
raise ValueError
readlines = decodin... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 379 | decoding_stream | ref | function | readlines = decoding_stream(stream, encoding).readlines
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 384 | LineSet | ref | function | LineSet(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 396 | run | def | function | def run(self) -> None:
"""Start looking for similarities and display results on stdout."""
if self.min_lines == 0:
return
self._display_sims(self._compute_sims())
def _compute_sims(self) -> List[Tuple[int, Set[LinesChunkLimits_T]]]:
"""Compute similarities in appende... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 400 | _display_sims | ref | function | self._display_sims(self._compute_sims())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 400 | _compute_sims | ref | function | self._display_sims(self._compute_sims())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 402 | _compute_sims | def | function | def _compute_sims(self) -> List[Tuple[int, Set[LinesChunkLimits_T]]]:
"""Compute similarities in appended files."""
no_duplicates: Dict[int, List[Set[LinesChunkLimits_T]]] = defaultdict(list)
for commonality in self._iter_sims():
num = commonality.cmn_lines_nb
linese... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 406 | _iter_sims | ref | function | for commonality in self._iter_sims():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 441 | _display_sims | def | function | def _display_sims(
self, similarities: List[Tuple[int, Set[LinesChunkLimits_T]]]
) -> None:
"""Display computed similarities on stdout."""
report = self._get_similarity_report(similarities)
print(report)
def _get_similarity_report(
self, similarities: List[Tuple[int,... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 445 | _get_similarity_report | ref | function | report = self._get_similarity_report(similarities)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 448 | _get_similarity_report | def | function | def _get_similarity_report(
self, similarities: List[Tuple[int, Set[LinesChunkLimits_T]]]
) -> str:
"""Create a report from similarities."""
report: str = ""
duplicated_line_number: int = 0
for number, couples in similarities:
report += f"\n{number} similar li... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 468 | _find_common | def | function | def _find_common(
self, lineset1: "LineSet", lineset2: "LineSet"
) -> Generator[Commonality, None, None]:
"""Find similarities in the two given linesets.
This the core of the algorithm.
The idea is to compute the hashes of a minimal number of successive lines of each lineset and... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 484 | hash_lineset | ref | function | hash_to_index_1, index_to_lines_1 = hash_lineset(lineset1, self.min_lines)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 485 | hash_lineset | ref | function | hash_to_index_2, index_to_lines_2 = hash_lineset(lineset2, self.min_lines)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 505 | LineSetStartCouple | ref | function | LineSetStartCouple(index_1, index_2)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 506 | CplSuccessiveLinesLimits | ref | function | ] = CplSuccessiveLinesLimits(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 512 | remove_successives | ref | function | remove_successives(all_couples)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 519 | Commonality | ref | function | com = Commonality(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 529 | filter_noncode_lines | ref | function | eff_cmn_nb = filter_noncode_lines(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 536 | _iter_sims | def | function | def _iter_sims(self) -> Generator[Commonality, None, None]:
"""Iterate on similarities among all files, by making a cartesian
product
"""
for idx, lineset in enumerate(self.linesets[:-1]):
for lineset2 in self.linesets[idx + 1 :]:
yield from self._find_com... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 542 | _find_common | ref | function | yield from self._find_common(lineset, lineset2)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 544 | get_map_data | def | function | def get_map_data(self):
"""Returns the data we can use for a map/reduce process.
In this case we are returning this instance's Linesets, that is all file
information that will later be used for vectorisation.
"""
return self.linesets
def combine_mapreduce_data(self, lin... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/similar.py | pylint/checkers/similar.py | 552 | combine_mapreduce_data | def | function | def combine_mapreduce_data(self, linesets_collection):
"""Reduces and recombines data into a format that we can report on.
The partner function of get_map_data()
"""
self.linesets = [line for lineset in linesets_collection for line in lineset]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.