Add type hints to customer facing interfaces#195
Add type hints to customer facing interfaces#195
Conversation
b84249e to
a4f849f
Compare
|
|
||
| def __init__(self, pubnub): | ||
| def __init__(self, pubnub, channels: Union[str, List[str]] = None, channel_groups: Union[str, List[str]] = None, | ||
| users: Union[str, List[str]] = None, spaces: Union[str, List[str]] = None, |
There was a problem hiding this comment.
Why do you need users and spaces parameters?
There was a problem hiding this comment.
the users and spaces were already in there so I just bubbled them up to the constructor
| self._sort_params = True | ||
|
|
||
| def ttl(self, ttl): | ||
| def ttl(self, ttl: int) -> 'GrantToken': |
There was a problem hiding this comment.
Is it a common pattern to extract a variable that repeats into constants?
There was a problem hiding this comment.
yeah. this is python's way of saying :
def ttl(self, ttl): # <-this is a setter
self._ttl # <- this is a "protected" property
| MAX_LIMIT = 100 | ||
|
|
||
| def __init__(self, pubnub): | ||
| def __init__(self, pubnub, channel: str = None, start: str = None, end: str = None, limit: str = None): |
There was a problem hiding this comment.
I assume it's not possible to change it, so let's leave it. But I noticed that perhaps all responses contain a reference to a PubNub object. Is there any benefit from such hard coupling?
There was a problem hiding this comment.
it's better than having a global variable because you may have more than one instance running at the same time
a4f849f to
2a11d0e
Compare
2a11d0e to
ab32531
Compare
|
@pubnub-release-bot release |
|
🚀 Release successfully completed 🚀 |
feat: Reconnecting with exponential backoff by default.
Automatic reconnecting for subscribe with exponential backoff is now enabled by default.
BREAKING CHANGES: Modifies Default Behavior of SDK
feat: Access manager v2 deprecation
Access manager v2 endpoints (grant and audit) will no longer be supported after December 31, 2024, and will be removed without further notice. Refer to the documentation to learn more.
feat: Configuration Becomes Immutable
Once used to instantiate PubNub, the configuration object (PNConfiguration instance) becomes immutable. You will receive exceptions if you rely on modifying the configuration after the PubNub instance is created. Refer to the documentation to learn more.
BREAKING CHANGES: Modifies Default Behavior of SDK
style: Type hints and named parameters
Type hints for parameters and return values are now added to provide a better developer experience.
style: Named parameters for endpoints
All endpoints are now accessible through the builder pattern and named parameters, providing a more flexible experience suitable for custom solutions.