Method: pylint.pyreverse.utils.check_if_graphviz_supports_format
Calls: 3, Exceptions: 1, Paths: 3Back
Path 1: 1 calls (0.33)
'png' (1)
1def check_if_graphviz_supports_format(output_format: str) -> None:
2 """Check if the ``dot`` command supports the requested output format.
3
4 This is needed if image output is desired and ``dot`` is used to convert
5 from *.gv into the final output format.
6 """
7 dot_output = subprocess.run(
8 ["dot", "-T?"], capture_output=True, check=False, encoding="utf-8"
9 )
10 match = re.match(
11 pattern=r".*Use one of: (?P<formats>(\S*\s?)+)",
12 string=dot_output.stderr.strip(),
13 )
14 if not match:
15 print(
16 "Unable to determine Graphviz supported output formats. "
17 "Pyreverse will continue, but subsequent error messages "
18 "regarding the output format may come from Graphviz directly."
19 )
20 return
21 supported_formats = match.group("formats")
22 if output_format not in supported_formats.split():
23 print(
24 f"Format {output_format} is not supported by Graphviz. It supports: {supported_formats}"
25 )
26 sys.exit(32)
Path 2: 1 calls (0.33)
'png' (1)
None (1)
1def check_if_graphviz_supports_format(output_format: str) -> None:
2 """Check if the ``dot`` command supports the requested output format.
3
4 This is needed if image output is desired and ``dot`` is used to convert
5 from *.gv into the final output format.
6 """
7 dot_output = subprocess.run(
8 ["dot", "-T?"], capture_output=True, check=False, encoding="utf-8"
9 )
10 match = re.match(
11 pattern=r".*Use one of: (?P<formats>(\S*\s?)+)",
12 string=dot_output.stderr.strip(),
13 )
14 if not match:
15 print(
16 "Unable to determine Graphviz supported output formats. "
17 "Pyreverse will continue, but subsequent error messages "
18 "regarding the output format may come from Graphviz directly."
19 )
20 return
21 supported_formats = match.group("formats")
22 if output_format not in supported_formats.split():
23 print(
24 f"Format {output_format} is not supported by Graphviz. It supports: {supported_formats}"
25 )
26 sys.exit(32)
Path 3: 1 calls (0.33)
'somethingElse' (1)
SystemExit (1)
1def check_if_graphviz_supports_format(output_format: str) -> None:
2 """Check if the ``dot`` command supports the requested output format.
3
4 This is needed if image output is desired and ``dot`` is used to convert
5 from *.gv into the final output format.
6 """
7 dot_output = subprocess.run(
8 ["dot", "-T?"], capture_output=True, check=False, encoding="utf-8"
9 )
10 match = re.match(
11 pattern=r".*Use one of: (?P<formats>(\S*\s?)+)",
12 string=dot_output.stderr.strip(),
13 )
14 if not match:
15 print(
16 "Unable to determine Graphviz supported output formats. "
17 "Pyreverse will continue, but subsequent error messages "
18 "regarding the output format may come from Graphviz directly."
19 )
20 return
21 supported_formats = match.group("formats")
22 if output_format not in supported_formats.split():
23 print(
24 f"Format {output_format} is not supported by Graphviz. It supports: {supported_formats}"
25 )
26 sys.exit(32)