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/strings.py
pylint/checkers/strings.py
360
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
363
pytype
ref
function
args=(arg_type.pytype(), format_type),
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
367
add_message
ref
function
self.add_message("format-needs-mapping", node=node, args=type_name)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
379
safe_infer
ref
function
rhs_tuple = utils.safe_infer(args)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
394
add_message
ref
function
self.add_message("too-many-format-args", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
396
add_message
ref
function
self.add_message("too-few-format-args", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
400
safe_infer
ref
function
arg_type = utils.safe_infer(arg)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
404
arg_matches_format_type
ref
function
and not arg_matches_format_type(arg_type, format_type)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
406
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
409
pytype
ref
function
args=(arg_type.pytype(), format_type),
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
412
check_messages
ref
function
@check_messages("f-string-without-interpolation")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
413
visit_joinedstr
def
function
def visit_joinedstr(self, node: nodes.JoinedStr) -> None: self._check_interpolation(node) def _check_interpolation(self, node: nodes.JoinedStr) -> None: if isinstance(node.parent, nodes.FormattedValue): return for value in node.values: if isinstance(value, nodes....
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
414
_check_interpolation
ref
function
self._check_interpolation(node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
416
_check_interpolation
def
function
def _check_interpolation(self, node: nodes.JoinedStr) -> None: if isinstance(node.parent, nodes.FormattedValue): return for value in node.values: if isinstance(value, nodes.FormattedValue): return self.add_message("f-string-without-interpolation", node...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
422
add_message
ref
function
self.add_message("f-string-without-interpolation", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
424
check_messages
ref
function
@check_messages(*MSGS)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
425
visit_call
def
function
def visit_call(self, node: nodes.Call) -> None: func = utils.safe_infer(node.func) if ( isinstance(func, astroid.BoundMethod) and isinstance(func.bound, astroid.Instance) and func.bound.name in {"str", "unicode", "bytes"} ): if func.name in {"s...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
426
safe_infer
ref
function
func = utils.safe_infer(node.func)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
433
safe_infer
ref
function
arg = utils.safe_infer(node.args[0])
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
437
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
443
_check_new_format
ref
function
self._check_new_format(node, func)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
445
_detect_vacuous_formatting
def
function
def _detect_vacuous_formatting(self, node, positional_arguments): counter = collections.Counter( arg.name for arg in positional_arguments if isinstance(arg, nodes.Name) ) for name, count in counter.items(): if count == 1: continue self.add_...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
452
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
456
_check_new_format
def
function
def _check_new_format(self, node, func): """Check the new string formatting.""" # Skip format nodes which don't have an explicit string on the # left side of the format operation. # We do this because our inference engine can't properly handle # redefinitions of the original ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
474
infer
ref
function
strnode = next(func.bound.infer())
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
480
from_call
ref
function
call_site = astroid.arguments.CallSite.from_call(node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
485
parse_format_method_string
ref
function
fields, num_args, manual_pos = utils.parse_format_method_string(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
489
add_message
ref
function
self.add_message("bad-format-string", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
496
add_message
ref
function
self.add_message("format-combined-specification", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
505
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
510
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
530
add_message
ref
function
self.add_message("format-string-without-interpolation", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
533
add_message
ref
function
self.add_message("too-many-format-args", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
535
add_message
ref
function
self.add_message("too-few-format-args", node=node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
537
_detect_vacuous_formatting
ref
function
self._detect_vacuous_formatting(node, positional_arguments)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
538
_check_new_format_specifiers
ref
function
self._check_new_format_specifiers(node, fields, named_arguments)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
540
_check_new_format_specifiers
def
function
def _check_new_format_specifiers(self, node, fields, named): """Check attribute and index access in the format string ("{0.a}" and "{0[a]}"). """ for key, specifiers in fields: # Obtain the argument. If it can't be obtained # or inferred, skip this check. ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
554
get_argument_from_call
ref
function
argname = utils.get_argument_from_call(node, key)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
564
safe_infer
ref
function
argument = utils.safe_infer(argname)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
587
has_dynamic_getattr
ref
function
and previous.has_dynamic_getattr()
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
591
get_access_path
ref
function
path = get_access_path(key, parsed)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
592
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
602
getitem
ref
function
previous = previous.getitem(nodes.Const(specifier))
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
602
Const
ref
function
previous = previous.getitem(nodes.Const(specifier))
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
623
get_access_path
ref
function
path = get_access_path(key, parsed)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
624
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
630
infer
ref
function
previous = next(previous.infer())
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
636
StringConstantChecker
def
class
__init__ process_module process_tokens visit_list visit_set visit_tuple visit_assign check_for_consistent_string_delimiters check_for_concatenated_strings process_string_token process_non_raw_string_token visit_const _detect_u_string_prefix
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
715
process_module
def
function
def process_module(self, node: nodes.Module) -> None: self._unicode_literals = "unicode_literals" in node.future_imports def process_tokens(self, tokens): encoding = "ascii" for i, (tok_type, token, start, _, line) in enumerate(tokens): if tok_type == tokenize.ENCODING: ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
718
process_tokens
def
function
def process_tokens(self, tokens): encoding = "ascii" for i, (tok_type, token, start, _, line) in enumerate(tokens): if tok_type == tokenize.ENCODING: # this is always the first token processed encoding = token elif tok_type == tokenize.STRING: ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
727
process_string_token
ref
function
self.process_string_token(token, start[0], start[1])
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
741
str_eval
ref
function
self.string_tokens[start] = (str_eval(token), next_token)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
744
check_for_consistent_string_delimiters
ref
function
self.check_for_consistent_string_delimiters(tokens)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
746
check_messages
ref
function
@check_messages("implicit-str-concat")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
747
visit_list
def
function
def visit_list(self, node: nodes.List) -> None: self.check_for_concatenated_strings(node.elts, "list") @check_messages("implicit-str-concat") def visit_set(self, node: nodes.Set) -> None: self.check_for_concatenated_strings(node.elts, "set") @check_messages("implicit-str-concat") d...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
748
check_for_concatenated_strings
ref
function
self.check_for_concatenated_strings(node.elts, "list")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
750
check_messages
ref
function
@check_messages("implicit-str-concat")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
751
visit_set
def
function
def visit_set(self, node: nodes.Set) -> None: self.check_for_concatenated_strings(node.elts, "set") @check_messages("implicit-str-concat") def visit_tuple(self, node: nodes.Tuple) -> None: self.check_for_concatenated_strings(node.elts, "tuple") def visit_assign(self, node: nodes.Assign...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
752
check_for_concatenated_strings
ref
function
self.check_for_concatenated_strings(node.elts, "set")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
754
check_messages
ref
function
@check_messages("implicit-str-concat")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
755
visit_tuple
def
function
def visit_tuple(self, node: nodes.Tuple) -> None: self.check_for_concatenated_strings(node.elts, "tuple") def visit_assign(self, node: nodes.Assign) -> None: if isinstance(node.value, nodes.Const) and isinstance(node.value.value, str): self.check_for_concatenated_strings([node.value...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
756
check_for_concatenated_strings
ref
function
self.check_for_concatenated_strings(node.elts, "tuple")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
758
visit_assign
def
function
def visit_assign(self, node: nodes.Assign) -> None: if isinstance(node.value, nodes.Const) and isinstance(node.value.value, str): self.check_for_concatenated_strings([node.value], "assignment") def check_for_consistent_string_delimiters( self, tokens: Iterable[tokenize.TokenInfo] ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
760
check_for_concatenated_strings
ref
function
self.check_for_concatenated_strings([node.value], "assignment")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
762
check_for_consistent_string_delimiters
def
function
def check_for_consistent_string_delimiters( self, tokens: Iterable[tokenize.TokenInfo] ) -> None: """Adds a message for each string using inconsistent quote delimiters. Quote delimiters are used inconsistently if " and ' are mixed in a module's shortstrings without having done s...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
778
_is_quote_delimiter_chosen_freely
ref
function
if tok_type == tokenize.STRING and _is_quote_delimiter_chosen_freely(token):
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
779
_get_quote_delimiter
ref
function
string_delimiters[_get_quote_delimiter(token)] += 1
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
783
most_common
ref
function
most_common_delimiter = string_delimiters.most_common(1)[0][0]
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
787
_get_quote_delimiter
ref
function
quote_delimiter = _get_quote_delimiter(token)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
789
_is_quote_delimiter_chosen_freely
ref
function
_is_quote_delimiter_chosen_freely(token)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
792
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
796
check_for_concatenated_strings
def
function
def check_for_concatenated_strings(self, elements, iterable_type): for elt in elements: if not ( isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES ): continue if elt.col_offset < 0: # This can happen in ca...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
799
pytype
ref
function
isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
819
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
823
process_string_token
def
function
def process_string_token(self, token, start_row, start_col): quote_char = None index = None for index, char in enumerate(token): if char in "'\"": quote_char = char break if quote_char is None: return prefix = token[:in...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
842
process_non_raw_string_token
ref
function
self.process_non_raw_string_token(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
849
process_non_raw_string_token
def
function
def process_non_raw_string_token( self, prefix, string_body, start_row, string_start_col ): """Check for bad escapes in a non-raw string. prefix: lowercase string of eg 'ur' string prefix markers. string_body: the un-parsed body of the string, not including the quote mar...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
893
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
900
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
911
check_messages
ref
function
@check_messages("redundant-u-string-prefix")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
912
visit_const
def
function
def visit_const(self, node: nodes.Const) -> None: if node.pytype() == "builtins.str" and not isinstance( node.parent, nodes.JoinedStr ): self._detect_u_string_prefix(node) def _detect_u_string_prefix(self, node: nodes.Const): """Check whether strings include a 'u...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
913
pytype
ref
function
if node.pytype() == "builtins.str" and not isinstance(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
916
_detect_u_string_prefix
ref
function
self._detect_u_string_prefix(node)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
918
_detect_u_string_prefix
def
function
def _detect_u_string_prefix(self, node: nodes.Const): """Check whether strings include a 'u' prefix like u'String'.""" if node.kind == "u": self.add_message( "redundant-u-string-prefix", line=node.lineno, col_offset=node.col_offset, ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
921
add_message
ref
function
self.add_message(
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
928
register
def
function
def register(linter: "PyLinter") -> None: linter.register_checker(StringFormatChecker(linter)) linter.register_checker(StringConstantChecker(linter))
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
929
register_checker
ref
function
linter.register_checker(StringFormatChecker(linter))
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
929
StringFormatChecker
ref
function
linter.register_checker(StringFormatChecker(linter))
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
930
register_checker
ref
function
linter.register_checker(StringConstantChecker(linter))
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
930
StringConstantChecker
ref
function
linter.register_checker(StringConstantChecker(linter))
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
933
str_eval
def
function
def str_eval(token): """Mostly replicate `ast.literal_eval(token)` manually to avoid any performance hit. This supports f-strings, contrary to `ast.literal_eval`. We have to support all string literal notations: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals """ ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
948
_is_long_string
def
function
def _is_long_string(string_token: str) -> bool: """Is this string token a "longstring" (is it triple-quoted)? Long strings are triple-quoted as defined in https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals This function only checks characters up through the open quotes...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
971
_get_quote_delimiter
def
function
def _get_quote_delimiter(string_token: str) -> str: """Returns the quote character used to delimit this token string. This function checks whether the token is a well-formed string. Args: string_token: The token to be parsed. Returns: A string containing solely the first quote delimit...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
992
_is_quote_delimiter_chosen_freely
def
function
def _is_quote_delimiter_chosen_freely(string_token: str) -> bool: """Was there a non-awkward option for the quote delimiter? Args: string_token: The quoted string whose delimiters are to be checked. Returns: Whether there was a choice in this token's quote character that would not ...
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
1,004
_get_quote_delimiter
ref
function
quote_delimiter = _get_quote_delimiter(string_token)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
1,008
_is_long_string
ref
function
and not _is_long_string(string_token)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/strings.py
pylint/checkers/strings.py
1,009
str_eval
ref
function
and unchosen_delimiter not in str_eval(string_token)
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/threading_checker.py
pylint/checkers/threading_checker.py
15
ThreadingChecker
def
class
visit_with
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/threading_checker.py
pylint/checkers/threading_checker.py
43
check_messages
ref
function
@check_messages("useless-with-lock")
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/threading_checker.py
pylint/checkers/threading_checker.py
44
visit_with
def
function
def visit_with(self, node: nodes.With) -> None: context_managers = (c for c, _ in node.items if isinstance(c, nodes.Call)) for context_manager in context_managers: if isinstance(context_manager, nodes.Call): infered_function = safe_infer(context_manager.func) ...