Skip to content

Commit

Permalink
Small set of non-blocking changes from b6. (#13690)
Browse files Browse the repository at this point in the history
- adds EOF whitespace
- renames _id to _session_id
- Adjusts docstring type

Closes #13686
  • Loading branch information
KieranBrantnerMagee authored Sep 21, 2020
1 parent 430e884 commit bcc4170
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class BaseSession(object):
def __init__(self, session_id, receiver, encoding="UTF-8"):
# type: (str, Union[ServiceBusSessionReceiver, ServiceBusSessionReceiverAsync], str) -> None
self._id = session_id
self._session_id = session_id
self._receiver = receiver
self._encoding = encoding
self._session_start = None
Expand Down Expand Up @@ -58,7 +58,7 @@ def session_id(self):
:rtype: str
"""
return self._id
return self._session_id

@property
def locked_until_utc(self):
Expand Down Expand Up @@ -110,7 +110,7 @@ def get_state(self):
self._check_live()
response = self._receiver._mgmt_request_response_with_retry( # pylint: disable=protected-access
REQUEST_RESPONSE_GET_SESSION_STATE_OPERATION,
{MGMT_REQUEST_SESSION_ID: self._id},
{MGMT_REQUEST_SESSION_ID: self._session_id},
mgmt_handlers.default
)
session_state = response.get(MGMT_RESPONSE_SESSION_STATE)
Expand Down Expand Up @@ -138,7 +138,7 @@ def set_state(self, state):
state = state.encode(self._encoding) if isinstance(state, six.text_type) else state
return self._receiver._mgmt_request_response_with_retry( # pylint: disable=protected-access
REQUEST_RESPONSE_SET_SESSION_STATE_OPERATION,
{MGMT_REQUEST_SESSION_ID: self._id, MGMT_REQUEST_SESSION_STATE: bytearray(state)},
{MGMT_REQUEST_SESSION_ID: self._session_id, MGMT_REQUEST_SESSION_STATE: bytearray(state)},
mgmt_handlers.default
)

Expand Down Expand Up @@ -169,7 +169,7 @@ def renew_lock(self):
self._check_live()
expiry = self._receiver._mgmt_request_response_with_retry( # pylint: disable=protected-access
REQUEST_RESPONSE_RENEW_SESSION_LOCK_OPERATION,
{MGMT_REQUEST_SESSION_ID: self._id},
{MGMT_REQUEST_SESSION_ID: self._session_id},
mgmt_handlers.default
)
expiry_timestamp = expiry[MGMT_RESPONSE_RECEIVER_EXPIRATION]/1000.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def get_state(self):
self._check_live()
response = await self._receiver._mgmt_request_response_with_retry( # pylint: disable=protected-access
REQUEST_RESPONSE_GET_SESSION_STATE_OPERATION,
{MGMT_REQUEST_SESSION_ID: self._id},
{MGMT_REQUEST_SESSION_ID: self._session_id},
mgmt_handlers.default
)
session_state = response.get(MGMT_RESPONSE_SESSION_STATE)
Expand Down Expand Up @@ -89,7 +89,7 @@ async def set_state(self, state):
state = state.encode(self._encoding) if isinstance(state, six.text_type) else state
return await self._receiver._mgmt_request_response_with_retry( # pylint: disable=protected-access
REQUEST_RESPONSE_SET_SESSION_STATE_OPERATION,
{MGMT_REQUEST_SESSION_ID: self._id, MGMT_REQUEST_SESSION_STATE: bytearray(state)},
{MGMT_REQUEST_SESSION_ID: self._session_id, MGMT_REQUEST_SESSION_STATE: bytearray(state)},
mgmt_handlers.default
)

Expand Down Expand Up @@ -120,7 +120,7 @@ async def renew_lock(self):
self._check_live()
expiry = await self._receiver._mgmt_request_response_with_retry( # pylint: disable=protected-access
REQUEST_RESPONSE_RENEW_SESSION_LOCK_OPERATION,
{MGMT_REQUEST_SESSION_ID: self._id},
{MGMT_REQUEST_SESSION_ID: self._session_id},
mgmt_handlers.default
)
expiry_timestamp = expiry[MGMT_RESPONSE_RECEIVER_EXPIRATION]/1000.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ServiceBusAdministrationClient: #pylint:disable=too-many-public-methods

def __init__(
self, fully_qualified_namespace: str,
credential: Union["AsyncTokenCredential"],
credential: "AsyncTokenCredential",
**kwargs) -> None:

self.fully_qualified_namespace = fully_qualified_namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ async def test_async_mgmt_namespace_get_properties(self, servicebus_namespace_co
assert properties
assert properties.messaging_sku == 'Standard'
# assert properties.name == servicebus_namespace.name
# This is disabled pending investigation of why it isn't getting scrubbed despite expected scrubber use.
# This is disabled pending investigation of why it isn't getting scrubbed despite expected scrubber use.

0 comments on commit bcc4170

Please sign in to comment.