Skip to content

Commit

Permalink
azure servicebus: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marnikow committed Oct 4, 2023
1 parent dae5567 commit 60eac95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions kombu/transport/azureservicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def _try_parse_connection_string(self) -> None:
self._namespace, self._credential = Transport.parse_uri(
self.conninfo.hostname)

if isinstance(self._credential, DefaultAzureCredential) or isinstance(self._credential, ManagedIdentityCredential):
if (isinstance(self._credential, DefaultAzureCredential) or
isinstance(self._credential, ManagedIdentityCredential)):
return None

if ":" in self._credential:
Expand Down Expand Up @@ -438,7 +439,8 @@ class Transport(virtual.Transport):
can_parse_url = True

@staticmethod
def parse_uri(uri: str) -> tuple[str, str | DefaultAzureCredential | ManagedIdentityCredential]:
def parse_uri(uri: str) -> tuple[str, str | DefaultAzureCredential |
ManagedIdentityCredential]:
# URL like:
# azureservicebus://{SAS policy name}:{SAS key}@{ServiceBus Namespace}
# urllib parse does not work as the sas key could contain a slash
Expand Down
4 changes: 2 additions & 2 deletions t/unit/transport/test_azureservicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def test_queue_service_mi():
conn = Connection(URL_CREDS_MI, transport=azureservicebus.Transport)
channel = conn.channel()

# Check the ManagedIdentityCredential has been parsed from the url correctly
# and the credential is a ManagedIdentityCredential
# Check the ManagedIdentityCredential has been parsed from the url
# correctly and the credential is a ManagedIdentityCredential
assert isinstance(channel._credential, ManagedIdentityCredential)


Expand Down

0 comments on commit 60eac95

Please sign in to comment.