Skip to content

Commit

Permalink
Run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaily committed Dec 20, 2024
1 parent e7ebda6 commit 1e6a6b5
Show file tree
Hide file tree
Showing 43 changed files with 105 additions and 119 deletions.
3 changes: 1 addition & 2 deletions awscli/autocomplete/autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"""
import logging
from collections import defaultdict, namedtuple
from difflib import SequenceMatcher
from collections import namedtuple, defaultdict


LOG = logging.getLogger(__name__)
Resource = namedtuple('Resource', ['resource_name', 'ident_name',
Expand Down
6 changes: 4 additions & 2 deletions awscli/autocomplete/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from awscli.autocomplete.serverside.custom_completers.ddb.autocomplete import add_ddb_completers
from awscli.autocomplete.serverside.custom_completers.logs.autocomplete import add_log_completers
from awscli.autocomplete.serverside.custom_completers.ddb.autocomplete import \
add_ddb_completers
from awscli.autocomplete.serverside.custom_completers.logs.autocomplete import \
add_log_completers


def get_custom_completers():
Expand Down
3 changes: 1 addition & 2 deletions awscli/autocomplete/db.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os
import logging
import os
import sqlite3

from awscli import __version__ as cli_version


LOG = logging.getLogger(__name__)

# We may eventually include a pre-generated version of this index as part
Expand Down
4 changes: 2 additions & 2 deletions awscli/autocomplete/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"""Generates auto completion index."""
import os

from awscli import clidriver
from awscli.autocomplete import db
from awscli.autocomplete.local import indexer
from awscli.autocomplete.serverside.indexer import APICallIndexer
from awscli.autocomplete import db
from awscli import clidriver


def generate_index(filename):
Expand Down
6 changes: 2 additions & 4 deletions awscli/autocomplete/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
# everytime a user hits <TAB>. Try to avoid any expensive module level
# work or really heavyweight imports. Prefer to lazy load as much as possible.

from awscli.autocomplete import parser, completer, filters
from awscli.autocomplete.local import model, basic, fetcher
from awscli.autocomplete import serverside
from awscli.autocomplete import custom
from awscli.autocomplete import completer, custom, filters, parser, serverside
from awscli.autocomplete.local import basic, fetcher, model


def create_autocompleter(index_filename=None, custom_completers=None,
Expand Down
6 changes: 3 additions & 3 deletions awscli/autoprompt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# language governing permissions and limitations under the License.
from botocore.exceptions import ProfileNotFound

from awscli.customizations.exceptions import ParamValidationError
from awscli.autoprompt.prompttoolkit import PromptToolkitPrompter
from awscli.autocomplete.main import create_autocompleter
from awscli.autocomplete.filters import fuzzy_filter
from awscli.autocomplete.main import create_autocompleter
from awscli.autoprompt.prompttoolkit import PromptToolkitPrompter
from awscli.customizations.exceptions import ParamValidationError
from awscli.errorhandler import SilenceParamValidationMsgErrorHandler


Expand Down
1 change: 1 addition & 0 deletions awscli/autoprompt/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import io

from docutils.core import publish_string

from awscli.bcdoc import docevents, textwriter
Expand Down
25 changes: 13 additions & 12 deletions awscli/autoprompt/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.document import Document
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.key_binding.bindings.focus import focus_next
from prompt_toolkit.keys import Keys
from prompt_toolkit.layout import Float, FloatContainer, HSplit, Window, VSplit
from prompt_toolkit.layout import Float, FloatContainer, HSplit, VSplit, Window
from prompt_toolkit.layout.controls import BufferControl
from prompt_toolkit.layout.dimension import Dimension
from prompt_toolkit.layout.layout import Layout, ConditionalContainer
from prompt_toolkit.layout.menus import CompletionsMenu, MultiColumnCompletionsMenu
from prompt_toolkit.layout.layout import ConditionalContainer, Layout
from prompt_toolkit.layout.menus import (CompletionsMenu,
MultiColumnCompletionsMenu)
from prompt_toolkit.layout.processors import BeforeInput
from prompt_toolkit.widgets import SearchToolbar, VerticalLine
from prompt_toolkit.key_binding.bindings.focus import focus_next

from awscli.autoprompt.history import HistoryDriver, HistoryCompleter
from awscli.autoprompt.widgets import (
HelpPanelWidget, ToolbarWidget, DebugPanelWidget, TitleLine
)
from awscli.autoprompt.filters import (
is_one_column, is_multi_column, doc_section_visible, output_section_visible,
input_buffer_has_focus, doc_window_has_focus, is_history_mode
)
from awscli.autoprompt.filters import (doc_section_visible,
doc_window_has_focus,
input_buffer_has_focus, is_history_mode,
is_multi_column, is_one_column,
output_section_visible)
from awscli.autoprompt.history import HistoryCompleter, HistoryDriver
from awscli.autoprompt.widgets import (DebugPanelWidget, HelpPanelWidget,
TitleLine, ToolbarWidget)


class PrompterKeyboardInterrupt(KeyboardInterrupt):
Expand Down
5 changes: 2 additions & 3 deletions awscli/autoprompt/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import logging
import json
import logging
import os

from prompt_toolkit.completion import Completion, Completer
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.history import FileHistory

from awscli.autocomplete.completer import CompletionResult
from awscli.autocomplete.filters import fuzzy_filter


LOG = logging.getLogger(__name__)


Expand Down
2 changes: 1 addition & 1 deletion awscli/autoprompt/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# language governing permissions and limitations under the License.
import logging

from prompt_toolkit.document import Document
from prompt_toolkit.application import get_app
from prompt_toolkit.document import Document


class PromptToolkitHandler(logging.StreamHandler):
Expand Down
5 changes: 2 additions & 3 deletions awscli/autoprompt/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import argparse
import logging
import io
import logging
import re

import jmespath
from botocore.utils import ArgumentGenerator

from awscli.formatter import get_formatter
from awscli.autocomplete.local.fetcher import CliDriverFetcher

from awscli.formatter import get_formatter

LOG = logging.getLogger(__name__)

Expand Down
10 changes: 4 additions & 6 deletions awscli/autoprompt/prompttoolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@
import logging
import shlex
import sys
from contextlib import nullcontext, contextmanager
from contextlib import contextmanager, nullcontext

from prompt_toolkit.application import Application
from prompt_toolkit.completion import Completer, ThreadedCompleter
from prompt_toolkit.completion import Completion
from prompt_toolkit.completion import Completer, Completion, ThreadedCompleter
from prompt_toolkit.document import Document

from awscli.logger import LOG_FORMAT, disable_crt_logging
from awscli.autocomplete import parser
from awscli.autocomplete.local import model
from awscli.autoprompt.doc import DocsGetter
from awscli.autoprompt.output import OutputGetter
from awscli.autoprompt.factory import PromptToolkitFactory
from awscli.autoprompt.logger import PromptToolkitHandler

from awscli.autoprompt.output import OutputGetter
from awscli.logger import LOG_FORMAT, disable_crt_logging

LOG = logging.getLogger(__name__)

Expand Down
22 changes: 10 additions & 12 deletions awscli/autoprompt/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,26 @@
from functools import partial

from prompt_toolkit.application import get_app
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.document import Document
from prompt_toolkit.filters import has_focus
from prompt_toolkit.formatted_text import HTML, to_formatted_text
from prompt_toolkit.formatted_text.utils import fragment_list_to_text
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.document import Document
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.keys import Keys
from prompt_toolkit.layout import (ConditionalContainer, Float, FloatContainer,
HSplit, VSplit, Window)
from prompt_toolkit.layout.controls import BufferControl
from prompt_toolkit.layout.dimension import Dimension
from prompt_toolkit.layout.processors import Processor, Transformation
from prompt_toolkit.layout import (
HSplit, Window, VSplit, FloatContainer, Float, ConditionalContainer
)
from prompt_toolkit.widgets import (
Frame, HorizontalLine, Dialog, Button, TextArea, Label
)
from prompt_toolkit.widgets import (Button, Dialog, Frame, HorizontalLine,
Label, TextArea)
from prompt_toolkit.widgets.base import Border

from awscli.autoprompt.filters import (
help_section_visible, doc_window_has_focus, search_input_has_focus,
input_buffer_has_focus, is_history_mode, is_debug_mode,
)
from awscli.autoprompt.filters import (doc_window_has_focus,
help_section_visible,
input_buffer_has_focus, is_debug_mode,
is_history_mode, search_input_has_focus)


class FormatTextProcessor(Processor):
Expand Down
1 change: 1 addition & 0 deletions awscli/bcdoc/restdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging

from botocore.compat import OrderedDict

from awscli.bcdoc.docstringparser import DocStringParser
from awscli.bcdoc.style import ReSTStyle

Expand Down
3 changes: 1 addition & 2 deletions awscli/customizations/addexamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
For example, ``examples/ec2/ec2-create-key-pair.rst``.
"""
import os
import logging

import os

LOG = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion awscli/customizations/argrename.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from awscli.customizations import utils


ARGUMENT_RENAMES = {
# Mapping of original arg to renamed arg.
# The key is <service>.<operation>.argname
Expand Down
3 changes: 2 additions & 1 deletion awscli/customizations/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
import os
import re

import jmespath

from awscli.arguments import CustomArgument
from awscli.compat import compat_open
from awscli.customizations.exceptions import ParamValidationError
import jmespath


def resolve_given_outfile_path(path):
Expand Down
4 changes: 2 additions & 2 deletions awscli/customizations/assumerole.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import logging
import os

from botocore.exceptions import ProfileNotFound
from botocore.credentials import JSONFileCache
from botocore.exceptions import ProfileNotFound

LOG = logging.getLogger(__name__)
CACHE_DIR = os.path.expanduser(os.path.join('~', '.aws', 'cli', 'cache'))
Expand Down
7 changes: 3 additions & 4 deletions awscli/customizations/awslambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import zipfile
import copy
import zipfile
from contextlib import closing

from awscli.arguments import CustomArgument, CLIArgument
from awscli.customizations.exceptions import ParamValidationError
from awscli.arguments import CLIArgument, CustomArgument
from awscli.compat import BytesIO

from awscli.customizations.exceptions import ParamValidationError

ERROR_MSG = (
"--zip-file must be a zip file with the fileb:// prefix.\n"
Expand Down
4 changes: 2 additions & 2 deletions awscli/customizations/binaryhoist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import copy

from dataclasses import dataclass
from typing import Optional
from awscli.arguments import CustomArgument, CLIArgument

from awscli.arguments import CLIArgument, CustomArgument
from awscli.customizations.exceptions import ParamValidationError


Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/cliinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
from ruamel.yaml import YAML
from ruamel.yaml.error import YAMLError

from awscli.paramfile import get_paramfile, LOCAL_PREFIX_MAP
from awscli.argprocess import ParamError, ParamSyntaxError
from awscli.customizations.arguments import OverrideRequiredArgsArgument
from awscli.paramfile import LOCAL_PREFIX_MAP, get_paramfile


def register_cli_input_args(cli):
Expand Down
7 changes: 3 additions & 4 deletions awscli/customizations/cloudfront.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import hashlib
import random
import sys
import time
import random

from awscrt.crypto import RSA, RSASignatureAlgorithm

from botocore.utils import parse_to_aware_datetime
from botocore.signers import CloudFrontSigner
from botocore.utils import parse_to_aware_datetime

from awscli.arguments import CustomArgument
from awscli.customizations.utils import validate_mutually_exclusive_handler
from awscli.customizations.commands import BasicCommand
from awscli.customizations.utils import validate_mutually_exclusive_handler


def register(event_handler):
Expand Down
5 changes: 3 additions & 2 deletions awscli/customizations/cloudsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@

import logging

from awscli.customizations.flatten import FlattenArguments, SEP
from awscli.customizations.exceptions import ParamValidationError
from botocore.compat import OrderedDict

from awscli.customizations.exceptions import ParamValidationError
from awscli.customizations.flatten import SEP, FlattenArguments

LOG = logging.getLogger(__name__)

DEFAULT_VALUE_TYPE_MAP = {
Expand Down
1 change: 1 addition & 0 deletions awscli/customizations/cloudsearchdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""
from awscli.customizations.exceptions import ParamValidationError


def register_cloudsearchdomain(cli):
cli.register_last('calling-command.cloudsearchdomain',
validate_endpoint_url)
Expand Down
9 changes: 5 additions & 4 deletions awscli/customizations/codecommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

import datetime
import fileinput
import logging
import os
import re
import sys
import logging
import fileinput
import datetime

from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
from botocore.compat import urlsplit
from awscli.customizations.commands import BasicCommand

from awscli.compat import NonTranslatedStdout
from awscli.customizations.commands import BasicCommand

logger = logging.getLogger('botocore.credentials')

Expand Down
Loading

0 comments on commit 1e6a6b5

Please sign in to comment.