Skip to content

Commit

Permalink
Remove useless parameter script_path of mypy.main() (#13399)
Browse files Browse the repository at this point in the history
`script_path` was entirely useless since `bin_dir` had been dropped long time
ago by #5690. This PR also makes arguments of mypy.main keyword-only.
  • Loading branch information
97littleleaf11 committed Aug 14, 2022
1 parent 234b161 commit 599af7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mypy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def console_entry() -> None:
try:
main(None, sys.stdout, sys.stderr)
main()
sys.stdout.flush()
sys.stderr.flush()
except BrokenPipeError:
Expand Down
2 changes: 1 addition & 1 deletion mypy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def run(args: List[str]) -> Tuple[str, str, int]:
from mypy.main import main

return _run(
lambda stdout, stderr: main(None, args=args, stdout=stdout, stderr=stderr, clean_exit=True)
lambda stdout, stderr: main(args=args, stdout=stdout, stderr=stderr, clean_exit=True)
)


Expand Down
7 changes: 3 additions & 4 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ def stat_proxy(path: str) -> os.stat_result:


def main(
script_path: Optional[str],
stdout: TextIO,
stderr: TextIO,
*,
args: Optional[List[str]] = None,
stdout: TextIO = sys.stdout,
stderr: TextIO = sys.stderr,
clean_exit: bool = False,
) -> None:
"""Main entry point to the type checker.
Args:
script_path: Path to the 'mypy' script (used for finding data files).
args: Custom command-line arguments. If not given, sys.argv[1:] will
be used.
clean_exit: Don't hard kill the process on exit. This allows catching
Expand Down

0 comments on commit 599af7f

Please sign in to comment.