Skip to content

Commit

Permalink
style: format imports everywhere with isort
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCrews committed Sep 9, 2022
1 parent b26b873 commit d5b1066
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 54 deletions.
13 changes: 9 additions & 4 deletions docopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@
"""
from __future__ import annotations

import sys
import re
import inspect

from typing import Any, Callable, NamedTuple, cast, Type, Tuple, Union
import re
import sys
from typing import Any
from typing import Callable
from typing import NamedTuple
from typing import Tuple
from typing import Type
from typing import Union
from typing import cast

__all__ = ["docopt", "magic_docopt", "magic", "DocoptExit"]
__version__ = "0.8.1"
Expand Down
1 change: 0 additions & 1 deletion examples/arguments_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__)
print(arguments)
1 change: 0 additions & 1 deletion examples/calculator_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__)
print(arguments)
1 change: 0 additions & 1 deletion examples/counted_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
"""
from docopt import docopt


print(docopt(__doc__))
1 change: 0 additions & 1 deletion examples/git/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

from docopt import docopt


if __name__ == "__main__":

args = docopt(__doc__, version="git version 1.7.4.4", options_first=True)
Expand Down
1 change: 0 additions & 1 deletion examples/git/git_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
"""
from docopt import docopt


if __name__ == "__main__":
print(docopt(__doc__))
1 change: 0 additions & 1 deletion examples/git/git_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@
"""
from docopt import docopt


if __name__ == "__main__":
print(docopt(__doc__))
1 change: 0 additions & 1 deletion examples/git/git_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
"""
from docopt import docopt


if __name__ == "__main__":
print(docopt(__doc__))
1 change: 0 additions & 1 deletion examples/git/git_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@
"""
from docopt import docopt


if __name__ == "__main__":
print(docopt(__doc__))
1 change: 0 additions & 1 deletion examples/git/git_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@
"""
from docopt import docopt


if __name__ == "__main__":
print(docopt(__doc__))
1 change: 0 additions & 1 deletion examples/git/git_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@
"""
from docopt import docopt


if __name__ == "__main__":
print(docopt(__doc__))
1 change: 0 additions & 1 deletion examples/git/git_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__)
print(arguments)
6 changes: 4 additions & 2 deletions examples/interactive_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
--baud=<n> Baudrate [default: 9600]
"""

import sys
import cmd
from docopt import docopt, DocoptExit
import sys

from docopt import DocoptExit
from docopt import docopt


def docopt_cmd(func):
Expand Down
1 change: 0 additions & 1 deletion examples/naval_fate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__, version="Naval Fate 2.0")
print(arguments)
1 change: 0 additions & 1 deletion examples/odd_even_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__)
print(arguments)
1 change: 0 additions & 1 deletion examples/options_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__, version="1.0.0rc2")
print(arguments)
1 change: 0 additions & 1 deletion examples/options_shortcut_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__, version="1.0.0rc2")
print(arguments)
1 change: 0 additions & 1 deletion examples/quick_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""
from docopt import docopt


if __name__ == "__main__":
arguments = docopt(__doc__, version="0.1.1rc")
print(arguments)
6 changes: 5 additions & 1 deletion examples/validation_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
from docopt import docopt

try:
from schema import Schema, And, Or, Use, SchemaError
from schema import And
from schema import Or
from schema import Schema
from schema import SchemaError
from schema import Use
except ImportError:
exit(
"This example requires that `schema` data-validation library"
Expand Down
8 changes: 5 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import json
from pathlib import Path
import re
from typing import Generator, Sequence
from pathlib import Path
from typing import Generator
from typing import Sequence
from unittest import mock

import docopt
import pytest

import docopt


def pytest_collect_file(file_path: Path, path, parent):
if file_path.suffix == ".docopt" and file_path.stem.startswith("test"):
Expand Down
50 changes: 25 additions & 25 deletions tests/test_docopt.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
from __future__ import annotations
from typing import Sequence

import re
from textwrap import dedent
from typing import Sequence

from docopt import (
ParsedOptions,
docopt,
DocoptExit,
DocoptLanguageError,
Option,
Argument,
Command,
OptionsShortcut,
Required,
NotRequired,
Either,
OneOrMore,
lint_docstring,
parse_argv,
parse_docstring_sections,
parse_longer,
parse_options,
parse_pattern,
parse_shorts,
formal_usage,
Tokens,
transform,
)
import pytest
from pytest import raises

from docopt import Argument
from docopt import Command
from docopt import DocoptExit
from docopt import DocoptLanguageError
from docopt import Either
from docopt import NotRequired
from docopt import OneOrMore
from docopt import Option
from docopt import OptionsShortcut
from docopt import ParsedOptions
from docopt import Required
from docopt import Tokens
from docopt import docopt
from docopt import formal_usage
from docopt import lint_docstring
from docopt import parse_argv
from docopt import parse_docstring_sections
from docopt import parse_longer
from docopt import parse_options
from docopt import parse_pattern
from docopt import parse_shorts
from docopt import transform


def test_pattern_flat():
assert Required(OneOrMore(Argument("N")), Option("-a"), Argument("M")).flat() == [
Expand Down
12 changes: 9 additions & 3 deletions tests/test_docopt_ng.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import pytest
import docopt
from docopt import DocoptExit, DocoptLanguageError, Option, Argument, parse_argv, Tokens
from pytest import raises

import docopt
from docopt import Argument
from docopt import DocoptExit
from docopt import DocoptLanguageError
from docopt import Option
from docopt import Tokens
from docopt import docopt as user_provided_alias_containing_magic
from docopt import magic
from docopt import magic_docopt
from docopt import docopt as user_provided_alias_containing_magic
from docopt import parse_argv


def test_docopt_ng_more_magic_spellcheck_and_expansion():
Expand Down

0 comments on commit d5b1066

Please sign in to comment.