Method: pylint.utils.utils._format_option_value
Calls: 577, Exceptions: 0, Paths: 6Back
Path 1: 384 calls (0.67)
dict (267) {'default': 10, 'type': 'float', 'metavar': '
None (34) 'snake_case' (18) '' (18) 1 (9) 5 (9) 4 (9) 100 (6) 'any' (6) 'UPPER_CASE' (6) 7 (6)
'None' (34) 'snake_case' (18) '' (18) '1' (9) '5' (9) '4' (9) '100' (6) 'any' (6) 'UPPER_CASE' (6) '7' (6)
1def _format_option_value(optdict: OptionDict, value: Any) -> str:
2 """Return the user input's value from a 'compiled' value.
3
4 TODO: 3.0: Remove deprecated function
5 """
6 if optdict.get("type", None) == "py_version":
7 value = ".".join(str(item) for item in value)
8 elif isinstance(value, (list, tuple)):
9 value = ",".join(_format_option_value(optdict, item) for item in value)
10 elif isinstance(value, dict):
11 value = ",".join(f"{k}:{v}" for k, v in value.items())
12 elif hasattr(value, "match"): # optdict.get('type') == 'regexp'
13 # compiled regexp
14 value = value.pattern
15 elif optdict.get("type") == "yn":
16 value = "yes" if value else "no"
17 elif isinstance(value, str) and value.isspace():
18 value = f"'{value}'"
19 return str(value)
Path 2: 106 calls (0.18)
dict (100) {'default': '', 'type': 'csv', 'metavar': '
() (21) [] (16) ('CVS',) (3) tuple (3) ('foo', 'bar', 'baz', 'toto', 'tutu', 'tata') (3) ('i', 'j', 'k', 'ex', 'Run', '_') (3) ('abc.abstractproperty'...
'' (37) 'CVS' (3) '^\\.#' (3) 'foo,bar,baz,toto,tutu,tata' (3) 'i,j,k,ex,Run,_' (3) 'abc.abstractproperty' (3) '__init__,__new__,setUp,__post_init__' ...
1def _format_option_value(optdict: OptionDict, value: Any) -> str:
2 """Return the user input's value from a 'compiled' value.
3
4 TODO: 3.0: Remove deprecated function
5 """
6 if optdict.get("type", None) == "py_version":
7 value = ".".join(str(item) for item in value)
8 elif isinstance(value, (list, tuple)):
9 value = ",".join(_format_option_value(optdict, item) for item in value)
10 elif isinstance(value, dict):
11 value = ",".join(f"{k}:{v}" for k, v in value.items())
12 elif hasattr(value, "match"): # optdict.get('type') == 'regexp'
13 # compiled regexp
14 value = value.pattern
15 elif optdict.get("type") == "yn":
16 value = "yes" if value else "no"
17 elif isinstance(value, str) and value.isspace():
18 value = f"'{value}'"
19 return str(value)
Path 3: 64 calls (0.11)
{'default': True, 'type': 'yn', 'metavar': '
True (34) False (30)
'yes' (34) 'no' (30)
1def _format_option_value(optdict: OptionDict, value: Any) -> str:
2 """Return the user input's value from a 'compiled' value.
3
4 TODO: 3.0: Remove deprecated function
5 """
6 if optdict.get("type", None) == "py_version":
7 value = ".".join(str(item) for item in value)
8 elif isinstance(value, (list, tuple)):
9 value = ",".join(_format_option_value(optdict, item) for item in value)
10 elif isinstance(value, dict):
11 value = ",".join(f"{k}:{v}" for k, v in value.items())
12 elif hasattr(value, "match"): # optdict.get('type') == 'regexp'
13 # compiled regexp
14 value = value.pattern
15 elif optdict.get("type") == "yn":
16 value = "yes" if value else "no"
17 elif isinstance(value, str) and value.isspace():
18 value = f"'{value}'"
19 return str(value)
Path 4: 18 calls (0.03)
dict (9) {'type': 'regexp', 'metavar': '
Pattern (18)
'^\\.#' (3) '^_' (3) '^\\s*(# )??$' (3) '.*[Mm]ixin' (3) '_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_' (3) '_.*|^ignor...
1def _format_option_value(optdict: OptionDict, value: Any) -> str:
2 """Return the user input's value from a 'compiled' value.
3
4 TODO: 3.0: Remove deprecated function
5 """
6 if optdict.get("type", None) == "py_version":
7 value = ".".join(str(item) for item in value)
8 elif isinstance(value, (list, tuple)):
9 value = ",".join(_format_option_value(optdict, item) for item in value)
10 elif isinstance(value, dict):
11 value = ",".join(f"{k}:{v}" for k, v in value.items())
12 elif hasattr(value, "match"): # optdict.get('type') == 'regexp'
13 # compiled regexp
14 value = value.pattern
15 elif optdict.get("type") == "yn":
16 value = "yes" if value else "no"
17 elif isinstance(value, str) and value.isspace():
18 value = f"'{value}'"
19 return str(value)
Path 5: 3 calls (0.01)
{'default': ' ', 'type': 'non_empty_string', 'metavar': '
' ' (3)
"' '" (3)
1def _format_option_value(optdict: OptionDict, value: Any) -> str:
2 """Return the user input's value from a 'compiled' value.
3
4 TODO: 3.0: Remove deprecated function
5 """
6 if optdict.get("type", None) == "py_version":
7 value = ".".join(str(item) for item in value)
8 elif isinstance(value, (list, tuple)):
9 value = ",".join(_format_option_value(optdict, item) for item in value)
10 elif isinstance(value, dict):
11 value = ",".join(f"{k}:{v}" for k, v in value.items())
12 elif hasattr(value, "match"): # optdict.get('type') == 'regexp'
13 # compiled regexp
14 value = value.pattern
15 elif optdict.get("type") == "yn":
16 value = "yes" if value else "no"
17 elif isinstance(value, str) and value.isspace():
18 value = f"'{value}'"
19 return str(value)
Path 6: 2 calls (0.0)
dict (2)
(3, 10) (2)
'3.10' (2)
1def _format_option_value(optdict: OptionDict, value: Any) -> str:
2 """Return the user input's value from a 'compiled' value.
3
4 TODO: 3.0: Remove deprecated function
5 """
6 if optdict.get("type", None) == "py_version":
7 value = ".".join(str(item) for item in value)
8 elif isinstance(value, (list, tuple)):
9 value = ",".join(_format_option_value(optdict, item) for item in value)
10 elif isinstance(value, dict):
11 value = ",".join(f"{k}:{v}" for k, v in value.items())
12 elif hasattr(value, "match"): # optdict.get('type') == 'regexp'
13 # compiled regexp
14 value = value.pattern
15 elif optdict.get("type") == "yn":
16 value = "yes" if value else "no"
17 elif isinstance(value, str) and value.isspace():
18 value = f"'{value}'"
19 return str(value)