Path 1: 4 calls (0.67)

PosixPath (4)

PosixPath (4)

1def __init__(self, primer_directory: Path, json_path: Path) -> None:
2        # Preparing arguments
3        self.primer_directory = primer_directory
4        self._argument_parser = argparse.ArgumentParser(prog="Pylint Primer")
5        self._subparsers = self._argument_parser.add_subparsers(
6            dest="command", required=True
7        )
8
9        # All arguments for the prepare parser
10        prepare_parser = self._subparsers.add_parser("prepare")
11        prepare_parser.add_argument(
12            "--clone", help="Clone all packages.", action="store_true", default=False
13        )
14        prepare_parser.add_argument(
15            "--check",
16            help="Check consistencies and commits of all packages.",
17            action="store_true",
18            default=False,
19        )
20        prepare_parser.add_argument(
21            "--make-commit-string",
22            help="Get latest commit string.",
23            action="store_true",
24            default=False,
25        )
26        prepare_parser.add_argument(
27            "--read-commit-string",
28            help="Print latest commit string.",
29            action="store_true",
30            default=False,
31        )
32
33        # All arguments for the run parser
34        run_parser = self._subparsers.add_parser("run")
35        run_parser.add_argument(
36            "--type", choices=["main", "pr"], required=True, help="Type of primer run."
37        )
38
39        # All arguments for the compare parser
40        compare_parser = self._subparsers.add_parser("compare")
41        compare_parser.add_argument(
42            "--base-file",
43            required=True,
44            help="Location of output file of the base run.",
45        )
46        compare_parser.add_argument(
47            "--new-file",
48            required=True,
49            help="Location of output file of the new run.",
50        )
51        compare_parser.add_argument(
52            "--commit",
53            required=True,
54            help="Commit hash of the PR commit being checked.",
55        )
56
57        # Storing arguments
58        self.config = self._argument_parser.parse_args()
59
60        self.packages = self._get_packages_to_lint_from_json(json_path)
61        """All packages to prime."""
62
63        if self.config.command == "prepare":
64            command_class: type[PrimerCommand] = PrepareCommand
65        elif self.config.command == "run":
66            command_class = RunCommand
67        elif self.config.command == "compare":
68            command_class = CompareCommand
69        self.command = command_class(self.primer_directory, self.packages, self.config)
            

Path 2: 2 calls (0.33)

PosixPath (2)

PosixPath (2)

SystemExit (2)

1def __init__(self, primer_directory: Path, json_path: Path) -> None:
2        # Preparing arguments
3        self.primer_directory = primer_directory
4        self._argument_parser = argparse.ArgumentParser(prog="Pylint Primer")
5        self._subparsers = self._argument_parser.add_subparsers(
6            dest="command", required=True
7        )
8
9        # All arguments for the prepare parser
10        prepare_parser = self._subparsers.add_parser("prepare")
11        prepare_parser.add_argument(
12            "--clone", help="Clone all packages.", action="store_true", default=False
13        )
14        prepare_parser.add_argument(
15            "--check",
16            help="Check consistencies and commits of all packages.",
17            action="store_true",
18            default=False,
19        )
20        prepare_parser.add_argument(
21            "--make-commit-string",
22            help="Get latest commit string.",
23            action="store_true",
24            default=False,
25        )
26        prepare_parser.add_argument(
27            "--read-commit-string",
28            help="Print latest commit string.",
29            action="store_true",
30            default=False,
31        )
32
33        # All arguments for the run parser
34        run_parser = self._subparsers.add_parser("run")
35        run_parser.add_argument(
36            "--type", choices=["main", "pr"], required=True, help="Type of primer run."
37        )
38
39        # All arguments for the compare parser
40        compare_parser = self._subparsers.add_parser("compare")
41        compare_parser.add_argument(
42            "--base-file",
43            required=True,
44            help="Location of output file of the base run.",
45        )
46        compare_parser.add_argument(
47            "--new-file",
48            required=True,
49            help="Location of output file of the new run.",
50        )
51        compare_parser.add_argument(
52            "--commit",
53            required=True,
54            help="Commit hash of the PR commit being checked.",
55        )
56
57        # Storing arguments
58        self.config = self._argument_parser.parse_args()
59
60        self.packages = self._get_packages_to_lint_from_json(json_path)
61        """All packages to prime."""
62
63        if self.config.command == "prepare":
64            command_class: type[PrimerCommand] = PrepareCommand
65        elif self.config.command == "run":
66            command_class = RunCommand
67        elif self.config.command == "compare":
68            command_class = CompareCommand
69        self.command = command_class(self.primer_directory, self.packages, self.config)