Method: pylint.checkers.utils.parse_format_method_string
Calls: 211, Exceptions: 5, Paths: 12Back
Path 1: 103 calls (0.49)
'{Param_1} {Param_2}' (9) 'String {Param} {Param}' (6) '{Param_1} {Param_2} {Param_3}' (6) '{a[Param_1]}{a[Param_2]}' (6) 'String {Param_1}' (6) '{Par...
tuple (103)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 2: 44 calls (0.21)
'{}' (11) '{} {}' (7) 'String {}' (3) 'test {} {}' (3) 'msg: {}' (2) 'value: {}' (2) ' I am a {} docstring.' (1) 'some value {} some other value {} {}...
tuple (44)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 3: 19 calls (0.09)
'{0}' (4) '{0}, {1}' (3) '{0:>{1}}' (3) '{0} {1}' (2) '{0} {1} {0}' (2) 'testing {0}' (1) '{0!r:20}' (1) '{0} {1} {2}' (1) 'A{0}{1}' (1) '{0}{1}{0}' (...
tuple (19)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 4: 12 calls (0.06)
'{0} {named}' (3) '{0}, {named}' (3) '{0} {a}' (2) '{0} {1} {a}' (1) '{0:{a[1]}} {a}' (1) '{0:{a[1]}}' (1) '{0:{a.x}}' (1)
tuple (12)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 5: 8 calls (0.04)
'{} {named}' (3) '{}, {named}' (2) '{[0]} {}' (2) '{} {a}' (1)
tuple (8)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 6: 8 calls (0.04)
'{0.missing.length}' (1) '{1.missing.length}' (1) '{0.missing}' (1) 'Hello John Doe {0[0]}' (1) 'Hello {0[name]}' (1) '{0.foo}: {0.bar}' (1) 'AAA{0[if...
tuple (8)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 7: 6 calls (0.03)
'String' (4) 'constant string' (1) '{{}}' (1)
tuple (6)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 8: 5 calls (0.02)
'{0}{1[FOO]}' (3) '{0.__class__.__name__}: {0}' (1) '{0[0]}: {0}' (1)
tuple (5)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 9: 3 calls (0.01)
'{} {' (1) '{} }' (1) 'a {} {' (1)
IncompleteFormatString (3)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 10: 1 calls (0.0)
'0} - {1}' (1)
IncompleteFormatString (1)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 11: 1 calls (0.0)
'{0} {}' (1)
tuple (1)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)
Path 12: 1 calls (0.0)
'There are {.:2f} undiscovered errors.' (1)
IncompleteFormatString (1)
1def parse_format_method_string(
2 format_string: str,
3) -> tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]:
4 """Parses a PEP 3101 format string, returning a tuple of
5 (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args).
6
7 keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt
8 is the number of arguments required by the format string and
9 explicit_pos_args is the number of arguments passed with the position.
10 """
11 keyword_arguments = []
12 implicit_pos_args_cnt = 0
13 explicit_pos_args = set()
14 for name in collect_string_fields(format_string):
15 if name and str(name).isdigit():
16 explicit_pos_args.add(str(name))
17 elif name:
18 keyname, fielditerator = split_format_field_names(name)
19 if isinstance(keyname, numbers.Number):
20 explicit_pos_args.add(str(keyname))
21 try:
22 keyword_arguments.append((keyname, list(fielditerator)))
23 except ValueError as e:
24 raise IncompleteFormatString() from e
25 else:
26 implicit_pos_args_cnt += 1
27 return keyword_arguments, implicit_pos_args_cnt, len(explicit_pos_args)