From 2bba445c4a5eb335dfeafe0ec9a7473bf23807ff Mon Sep 17 00:00:00 2001 From: Riley Shaw <30989490+ShineyDev@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:45:30 +0000 Subject: [PATCH] replace Optional[T] with T | None everywhere --- github/content/announcement.py | 2 +- github/content/codeofconduct.py | 8 ++++---- github/content/license.py | 20 +++++++++---------- github/core/client.py | 6 +++--- github/core/errors.py | 2 +- github/interfaces/comment.py | 4 ++-- github/interfaces/profileowner.py | 10 +++++----- github/organization/organization.py | 16 +++++++-------- github/user/user.py | 30 ++++++++++++++--------------- github/user/userstatus.py | 18 ++++++++--------- 10 files changed, 58 insertions(+), 58 deletions(-) diff --git a/github/content/announcement.py b/github/content/announcement.py index 11c3f497..e40aa829 100644 --- a/github/content/announcement.py +++ b/github/content/announcement.py @@ -90,7 +90,7 @@ def expires_at( """ The date and time at which the announcement will expire. - :type: Optional[:class:`~datetime.datetime`] + :type: :class:`~datetime.datetime` | None """ expires_at = self._data["expiresAt"] diff --git a/github/content/codeofconduct.py b/github/content/codeofconduct.py index 700ead37..c3e71cdc 100644 --- a/github/content/codeofconduct.py +++ b/github/content/codeofconduct.py @@ -123,7 +123,7 @@ def resource_path( """ An HTTP path to the resource. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return super().resource_path @@ -136,7 +136,7 @@ def url( """ An HTTP URL to the resource. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return super().url @@ -311,7 +311,7 @@ async def fetch_resource_path( :attr:`url` attributes are missing. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await super().fetch_resource_path() # type: ignore @@ -337,7 +337,7 @@ async def fetch_url( :attr:`url` attributes are missing. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await super().fetch_url() # type: ignore diff --git a/github/content/license.py b/github/content/license.py index 53a2ea8f..e90deb5f 100644 --- a/github/content/license.py +++ b/github/content/license.py @@ -120,7 +120,7 @@ def choosealicense_url( """ A URL to the license on |choosealicense|. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["url"] @@ -146,7 +146,7 @@ def description( """ A description of the license. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["description"] @@ -159,7 +159,7 @@ def implementation( """ A guide to implementing the license. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["implementation"] @@ -250,7 +250,7 @@ def nickname( """ The human-readable nickname of the license. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["nickname"] @@ -276,7 +276,7 @@ def spdx_id( """ The ID of the license on |spdx|. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["spdxId"] @@ -364,7 +364,7 @@ async def fetch_choosealicense_url( The :attr:`id` attribute is missing. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await self._fetch_field("url") # type: ignore @@ -414,7 +414,7 @@ async def fetch_description( The :attr:`id` attribute is missing. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await self._fetch_field("description") # type: ignore @@ -464,7 +464,7 @@ async def fetch_implementation( The :attr:`id` attribute is missing. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await self._fetch_field("implementation") # type: ignore @@ -639,7 +639,7 @@ async def fetch_nickname( The :attr:`id` attribute is missing. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await self._fetch_field("nickname") # type: ignore @@ -689,7 +689,7 @@ async def fetch_spdx_id( The :attr:`id` attribute is missing. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await self._fetch_field("spdxId") # type: ignore diff --git a/github/core/client.py b/github/core/client.py index 57033f73..e1c88e6b 100644 --- a/github/core/client.py +++ b/github/core/client.py @@ -635,11 +635,11 @@ async def update_status( Parameters ---------- - message: Optional[:class:`str`] + message: :class:`str` | None The message to display on the status. busy: :class:`bool` Whether to mark the user as busy. - emoji: Optional[:class:`str`] + emoji: :class:`str` | None The emoji to display on the status. This can either be a unicode emoji or its name with colons. expires_at: :class:`~datetime.datetime` @@ -649,7 +649,7 @@ async def update_status( status. - :rtype: Optional[:class:`~github.UserStatus`] + :rtype: :class:`~github.UserStatus` | None """ data = await self._http.mutate_user_update_status( diff --git a/github/core/errors.py b/github/core/errors.py index f9cd72cb..4ce5cb18 100644 --- a/github/core/errors.py +++ b/github/core/errors.py @@ -249,7 +249,7 @@ class ClientResponseHTTPUnauthorizedError(ClientResponseHTTPError): response: :class:`aiohttp.ClientResponse` The client response. - data: Optional[:class:`dict`] + data: :class:`dict` | None The response data. """ diff --git a/github/interfaces/comment.py b/github/interfaces/comment.py index f197db5b..6b55010e 100644 --- a/github/interfaces/comment.py +++ b/github/interfaces/comment.py @@ -169,7 +169,7 @@ def edited_at( """ The date and time at which the comment was last edited. - :type: Optional[:class:`~datetime.datetime`] + :type: :class:`~datetime.datetime` | None """ edited_at = self._data["lastEditedAt"] @@ -200,7 +200,7 @@ def published_at( """ The date and time at which the comment was published. - :type: Optional[:class:`~datetime.datetime`] + :type: :class:`~datetime.datetime` | None """ published_at = self._data["publishedAt"] diff --git a/github/interfaces/profileowner.py b/github/interfaces/profileowner.py index ea5edc3b..2ea5cab1 100644 --- a/github/interfaces/profileowner.py +++ b/github/interfaces/profileowner.py @@ -93,7 +93,7 @@ def email( - ``read:org`` for :attr:`Organization.email`. - ``read:user`` OR ``user:email`` for :attr:`User.email`. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["email"] @@ -132,7 +132,7 @@ def location( """ The location of the profile owner. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["location"] @@ -145,7 +145,7 @@ def name( """ The name of the profile owner. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["name"] @@ -171,7 +171,7 @@ def website( """ The website of the profile owner. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["websiteUrl"] @@ -202,7 +202,7 @@ async def fetch_email( The token used by the client does not have the required scopes. - :rtype: Optional[:class:`str`] + :rtype: :class:`str` | None """ return await self._fetch_field("email") # type: ignore diff --git a/github/organization/organization.py b/github/organization/organization.py index 13215aaa..4ee65b65 100644 --- a/github/organization/organization.py +++ b/github/organization/organization.py @@ -176,7 +176,7 @@ def archived_at( """ The date and time at which the organization was archived. - :type: Optional[:class:`~datetime.datetime`] + :type: :class:`~datetime.datetime` | None """ archived_at = self._data["archivedAt"] @@ -247,7 +247,7 @@ def description( """ The description of the organization. - :type: Optional[:class:`str`] + :type: :class:`str` | None """ return self._data["description"] @@ -267,7 +267,7 @@ def description_html( - Sanitizes the string such that it cannot contain HTML tags. - Wraps the string in ``