-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
159 changed files
with
6,699 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# built-in | ||
import sys | ||
|
||
# app | ||
from ._cli import main | ||
|
||
|
||
if __name__ == '__main__': | ||
exit(main(sys.argv[1:])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# app | ||
from ._main import main | ||
|
||
|
||
__all__ = ['main'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# built-in | ||
from argparse import ArgumentParser | ||
from types import MappingProxyType | ||
from typing import Callable, Mapping, Sequence | ||
|
||
# app | ||
from ._lint import lint_command | ||
from ._stub import stub_command | ||
|
||
|
||
CommandsType = Mapping[str, Callable[[Sequence[str]], int]] | ||
COMMANDS: CommandsType = MappingProxyType(dict( | ||
lint=lint_command, | ||
stub=stub_command, | ||
)) | ||
|
||
|
||
def main(argv: Sequence[str], *, commands: CommandsType = COMMANDS) -> int: | ||
parser = ArgumentParser(prog='python3 -m deal') | ||
parser.add_argument('command', choices=sorted(commands)) | ||
|
||
args, unknown_argv = parser.parse_known_args(argv) | ||
command = commands[args.command] | ||
return command(unknown_argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# built-in | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
from typing import Sequence | ||
|
||
# app | ||
from ..linter import StubsManager, generate_stub | ||
|
||
|
||
def stub_command(argv: Sequence[str]) -> int: | ||
parser = ArgumentParser(prog='python3 -m deal stub') | ||
parser.add_argument('--iterations', type=int, default=1) | ||
parser.add_argument('paths', nargs='+') | ||
args = parser.parse_args(argv) | ||
|
||
paths = [Path(path) for path in args.paths] | ||
roots = list(StubsManager.default_paths) + list(set(paths)) | ||
stubs = StubsManager(paths=roots) | ||
|
||
for _ in range(args.iterations): | ||
for path in paths: | ||
generate_stub(path=path, stubs=stubs) | ||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
|
||
class _State: | ||
__slots__ = ('main', 'debug') | ||
|
||
def __init__(self): | ||
self.reset() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# app | ||
from ._checker import Checker | ||
from ._stub import StubsManager, generate_stub | ||
|
||
|
||
__all__ = ['Checker'] | ||
__all__ = ['Checker', 'StubsManager', 'generate_stub'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.