Skip to content

Commit 7cc4801

Browse files
committed
flake and isort updates
1 parent b640243 commit 7cc4801

File tree

11 files changed

+40
-32
lines changed

11 files changed

+40
-32
lines changed

aws_advanced_python_wrapper/dsql_iam_auth_plugin_factory.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616

1717
from typing import TYPE_CHECKING
1818

19-
from aws_advanced_python_wrapper.utils.dsql_token_utils import DSQLTokenUtils
2019
from aws_advanced_python_wrapper.iam_plugin import IamAuthPlugin
2120
from aws_advanced_python_wrapper.plugin import Plugin, PluginFactory
22-
from aws_advanced_python_wrapper.utils.properties import (Properties)
21+
from aws_advanced_python_wrapper.utils.dsql_token_utils import DSQLTokenUtils
2322

2423
if TYPE_CHECKING:
2524
from aws_advanced_python_wrapper.plugin_service import PluginService
25+
from aws_advanced_python_wrapper.utils.properties import (Properties)
26+
2627

2728
class DsqlIamAuthPluginFactory(PluginFactory):
2829
def get_instance(self, plugin_service: PluginService, props: Properties) -> Plugin:

aws_advanced_python_wrapper/federated_plugin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from aws_advanced_python_wrapper.hostinfo import HostInfo
3232
from aws_advanced_python_wrapper.pep249 import Connection
3333
from aws_advanced_python_wrapper.plugin_service import PluginService
34+
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
3435

3536
from datetime import datetime, timedelta
3637
from typing import Callable, Dict, Optional, Set
@@ -43,9 +44,9 @@
4344
from aws_advanced_python_wrapper.utils.messages import Messages
4445
from aws_advanced_python_wrapper.utils.properties import (Properties,
4546
WrapperProperties)
46-
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
47-
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
4847
from aws_advanced_python_wrapper.utils.rds_token_utils import RDSTokenUtils
48+
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
49+
4950

5051
logger = Logger(__name__)
5152

@@ -57,7 +58,10 @@ class FederatedAuthPlugin(Plugin):
5758
_rds_utils: RdsUtils = RdsUtils()
5859
_token_cache: Dict[str, TokenInfo] = {}
5960

60-
def __init__(self, plugin_service: PluginService, credentials_provider_factory: CredentialsProviderFactory, token_utils: TokenUtils, session: Optional[Session] = None):
61+
def __init__(self, plugin_service: PluginService,
62+
credentials_provider_factory: CredentialsProviderFactory,
63+
token_utils: TokenUtils,
64+
session: Optional[Session] = None):
6165
self._plugin_service = plugin_service
6266
self._credentials_provider_factory = credentials_provider_factory
6367
self._session = session

aws_advanced_python_wrapper/iam_plugin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
from typing import TYPE_CHECKING
1818

1919
from aws_advanced_python_wrapper.utils.iam_utils import IamAuthUtils, TokenInfo
20-
from aws_advanced_python_wrapper.utils.region_utils import RegionUtils
21-
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
20+
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
2221
from aws_advanced_python_wrapper.utils.rds_token_utils import RDSTokenUtils
22+
from aws_advanced_python_wrapper.utils.region_utils import RegionUtils
2323

2424
if TYPE_CHECKING:
2525
from boto3 import Session
2626
from aws_advanced_python_wrapper.driver_dialect import DriverDialect
2727
from aws_advanced_python_wrapper.hostinfo import HostInfo
2828
from aws_advanced_python_wrapper.pep249 import Connection
2929
from aws_advanced_python_wrapper.plugin_service import PluginService
30+
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
3031

3132
from datetime import datetime, timedelta
3233
from typing import Callable, Dict, Optional, Set
@@ -37,7 +38,7 @@
3738
from aws_advanced_python_wrapper.utils.messages import Messages
3839
from aws_advanced_python_wrapper.utils.properties import (Properties,
3940
WrapperProperties)
40-
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
41+
4142

4243
logger = Logger(__name__)
4344

aws_advanced_python_wrapper/okta_plugin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from aws_advanced_python_wrapper.hostinfo import HostInfo
3232
from aws_advanced_python_wrapper.pep249 import Connection
3333
from aws_advanced_python_wrapper.plugin_service import PluginService
34+
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
3435

3536
import requests
3637

@@ -40,9 +41,9 @@
4041
from aws_advanced_python_wrapper.utils.messages import Messages
4142
from aws_advanced_python_wrapper.utils.properties import (Properties,
4243
WrapperProperties)
43-
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
44-
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
4544
from aws_advanced_python_wrapper.utils.rds_token_utils import RDSTokenUtils
45+
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
46+
4647

4748
logger = Logger(__name__)
4849

@@ -53,7 +54,10 @@ class OktaAuthPlugin(Plugin):
5354
_rds_utils: RdsUtils = RdsUtils()
5455
_token_cache: Dict[str, TokenInfo] = {}
5556

56-
def __init__(self, plugin_service: PluginService, credentials_provider_factory: CredentialsProviderFactory, token_utils: TokenUtils, session: Optional[Session] = None):
57+
def __init__(self, plugin_service: PluginService,
58+
credentials_provider_factory: CredentialsProviderFactory,
59+
token_utils: TokenUtils,
60+
session: Optional[Session] = None):
5761
self._plugin_service = plugin_service
5862
self._credentials_provider_factory = credentials_provider_factory
5963
self._session = session

aws_advanced_python_wrapper/plugin_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
from aws_advanced_python_wrapper.developer_plugin import DeveloperPluginFactory
5858
from aws_advanced_python_wrapper.driver_configuration_profiles import \
5959
DriverConfigurationProfiles
60+
from aws_advanced_python_wrapper.dsql_iam_auth_plugin_factory import \
61+
DsqlIamAuthPluginFactory
6062
from aws_advanced_python_wrapper.errors import (AwsWrapperError,
6163
QueryTimeoutError,
6264
UnsupportedOperationError)
@@ -73,7 +75,6 @@
7375
HostMonitoringPluginFactory
7476
from aws_advanced_python_wrapper.hostinfo import HostInfo, HostRole
7577
from aws_advanced_python_wrapper.iam_plugin import IamAuthPluginFactory
76-
from aws_advanced_python_wrapper.dsql_iam_auth_plugin_factory import DsqlIamAuthPluginFactory
7778
from aws_advanced_python_wrapper.plugin import CanReleaseResources
7879
from aws_advanced_python_wrapper.read_write_splitting_plugin import \
7980
ReadWriteSplittingPluginFactory

aws_advanced_python_wrapper/utils/dsql_token_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,26 @@
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
13-
# limitations under the License.
13+
# limitations under the License.
1414

1515
from __future__ import annotations
1616

17-
from abc import ABC, abstractmethod
1817
from typing import TYPE_CHECKING, Dict, Optional
18+
1919
from aws_advanced_python_wrapper.utils.log import Logger
2020
from aws_advanced_python_wrapper.utils.telemetry.telemetry import \
2121
TelemetryTraceLevel
2222
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
2323

2424
if TYPE_CHECKING:
2525
from aws_advanced_python_wrapper.plugin_service import PluginService
26-
from boto3 import Session
26+
from boto3 import Session
2727

2828
import boto3
2929

3030
logger = Logger(__name__)
3131

32+
3233
class DSQLTokenUtils(TokenUtils):
3334
def generate_authentication_token(
3435
self,
@@ -57,4 +58,4 @@ def generate_authentication_token(
5758
context.set_exception(ex)
5859
raise ex
5960
finally:
60-
context.close_context()
61+
context.close_context()

aws_advanced_python_wrapper/utils/iam_utils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,16 @@
1515
from __future__ import annotations
1616

1717
from datetime import datetime
18-
from typing import TYPE_CHECKING, Dict, Optional
19-
20-
import boto3
18+
from typing import TYPE_CHECKING, Optional
2119

2220
from aws_advanced_python_wrapper.errors import AwsWrapperError
2321
from aws_advanced_python_wrapper.utils.log import Logger
2422
from aws_advanced_python_wrapper.utils.messages import Messages
2523
from aws_advanced_python_wrapper.utils.rds_url_type import RdsUrlType
2624
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
27-
from aws_advanced_python_wrapper.utils.telemetry.telemetry import \
28-
TelemetryTraceLevel
2925

3026
if TYPE_CHECKING:
3127
from aws_advanced_python_wrapper.hostinfo import HostInfo
32-
from aws_advanced_python_wrapper.plugin_service import PluginService
33-
from boto3 import Session
3428

3529
from aws_advanced_python_wrapper.utils.properties import (Properties,
3630
WrapperProperties)
@@ -70,6 +64,7 @@ def get_port(props: Properties, host_info: HostInfo, dialect_default_port: int)
7064
def get_cache_key(user: Optional[str], hostname: Optional[str], port: int, region: Optional[str]) -> str:
7165
return f"{region}:{hostname}:{port}:{user}"
7266

67+
7368
class TokenInfo:
7469
@property
7570
def token(self):

aws_advanced_python_wrapper/utils/rds_token_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,26 @@
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
13-
# limitations under the License.
13+
# limitations under the License.
1414

1515
from __future__ import annotations
1616

17-
from abc import ABC, abstractmethod
1817
from typing import TYPE_CHECKING, Dict, Optional
18+
1919
from aws_advanced_python_wrapper.utils.log import Logger
2020
from aws_advanced_python_wrapper.utils.telemetry.telemetry import \
2121
TelemetryTraceLevel
2222
from aws_advanced_python_wrapper.utils.token_utils import TokenUtils
2323

2424
if TYPE_CHECKING:
2525
from aws_advanced_python_wrapper.plugin_service import PluginService
26-
from boto3 import Session
26+
from boto3 import Session
2727

2828
import boto3
2929

3030
logger = Logger(__name__)
3131

32+
3233
class RDSTokenUtils(TokenUtils):
3334
def generate_authentication_token(
3435
self,
@@ -39,7 +40,7 @@ def generate_authentication_token(
3940
region: Optional[str],
4041
credentials: Optional[Dict[str, str]] = None,
4142
client_session: Optional[Session] = None) -> str:
42-
43+
4344
telemetry_factory = plugin_service.get_telemetry_factory()
4445
context = telemetry_factory.open_telemetry_context("fetch authentication token", TelemetryTraceLevel.NESTED)
4546

aws_advanced_python_wrapper/utils/rdsutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ def is_rds_dns(self, host: str) -> bool:
152152

153153
def is_rds_instance(self, host: str) -> bool:
154154
return self._get_dns_group(host) is None and self.is_rds_dns(host)
155-
155+
156156
def is_dsql_cluster(self, host: str) -> bool:
157157
if not host or not host.strip():
158158
return False
159159

160160
pattern = self._find(host, [RdsUtils.AURORA_DSQL_CLUSTER_PATTERN])
161-
161+
162162
return pattern is not None
163163

164164
def is_rds_proxy_dns(self, host: str) -> bool:

aws_advanced_python_wrapper/utils/token_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
13-
# limitations under the License.
13+
# limitations under the License.
1414

1515
from __future__ import annotations
1616

@@ -19,7 +19,8 @@
1919

2020
if TYPE_CHECKING:
2121
from aws_advanced_python_wrapper.plugin_service import PluginService
22-
from boto3 import Session
22+
from boto3 import Session
23+
2324

2425
class TokenUtils(ABC):
2526
@abstractmethod

0 commit comments

Comments
 (0)