diff --git a/.forgejo/workflows/config/.pylintrc b/.forgejo/workflows/config/.pylintrc index 70bf11c..a80af61 100644 --- a/.forgejo/workflows/config/.pylintrc +++ b/.forgejo/workflows/config/.pylintrc @@ -4,4 +4,6 @@ invalid-name, too-few-public-methods, too-many-instance-attributes, - too-many-arguments + too-many-arguments, + too-many-local-variables, + too-many-locals diff --git a/pyzipline/models.py b/pyzipline/models.py index 205585c..a398a64 100644 --- a/pyzipline/models.py +++ b/pyzipline/models.py @@ -172,8 +172,8 @@ class User: embed (Embed): Embed object of the user's embed totpSecret (Optional[str]): String of the user's TOTP secret domains (List[str]): List of Strings of the user's domains - oauth (Optional[List[OAuth]] = None): (optional) List of OAuth objects - ratelimit (Optional[datetime] = None): (optional) Datetime object of when the user's ratelimit expires + oauth (Optional[List[OAuth]] = None): List of [OAuth](.#pyzipline.models.OAuth) objects + ratelimit (Optional[datetime] = None): Datetime object of when the user's ratelimit expires """ def __init__( self, @@ -188,7 +188,7 @@ class User: embed: Embed, totpSecret: Optional[str], domains: List[str], - oauth: Optional[List['OAuth']] = [], + oauth: Optional[List['OAuth']] = None, ratelimit: Optional[datetime] = None, **kwargs ): @@ -206,6 +206,8 @@ class User: self.oauth = oauth self.ratelimit = ratelimit self.__dict__.update(kwargs) - for oauth_entry in self.oauth: - OAuth(**oauth_entry) - self.oauth.append(oauth_entry) + if self.oauth is not None: + for oauth_entry in self.oauth: + self.oauth.remove(oauth_entry) + o = OAuth(**oauth_entry) + self.oauth.append(o) diff --git a/pyzipline/utils.py b/pyzipline/utils.py index e6e99fe..fc89f1d 100644 --- a/pyzipline/utils.py +++ b/pyzipline/utils.py @@ -1,12 +1,13 @@ +"""This is a list of various utility functions used in PyZipline.""" from datetime import datetime def convert_str_to_datetime(date_string: str) -> datetime: """Converts a Zipline date string to a datetime object Args: - date_string (str): String to convert + date_string: String to convert Returns: - datetime (datetime): Datetime object + datetime: Datetime object """ return datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ') diff --git a/pyzipline/zipline.py b/pyzipline/zipline.py index 0f564b3..0db65eb 100644 --- a/pyzipline/zipline.py +++ b/pyzipline/zipline.py @@ -89,7 +89,7 @@ class ZiplineApi: bool: True if user exists, False if not """ data = {'username': username} if invite is None else {'username': username, 'code': invite} - result: Result = self._rest_adapter.post(endpoint=f"user/check", data=data) + result: Result = self._rest_adapter.post(endpoint="user/check", data=data) if result.status_code == 200: return False if result.message == 'username already exists':