Skip to content

Commit

Permalink
replace Optional[T] with T | None everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
ShineyDev committed Feb 7, 2025
1 parent e2bcb66 commit 2bba445
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion github/content/announcement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
8 changes: 4 additions & 4 deletions github/content/codeofconduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -136,7 +136,7 @@ def url(
"""
An HTTP URL to the resource.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return super().url
Expand Down Expand Up @@ -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

Check warning on line 317 in github/content/codeofconduct.py

View workflow job for this annotation

GitHub Actions / Check

Unnecessary "# type: ignore" comment
Expand All @@ -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

Check warning on line 343 in github/content/codeofconduct.py

View workflow job for this annotation

GitHub Actions / Check

Unnecessary "# type: ignore" comment
Expand Down
20 changes: 10 additions & 10 deletions github/content/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -146,7 +146,7 @@ def description(
"""
A description of the license.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["description"]
Expand All @@ -159,7 +159,7 @@ def implementation(
"""
A guide to implementing the license.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["implementation"]
Expand Down Expand Up @@ -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"]
Expand All @@ -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"]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions github/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion github/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
4 changes: 2 additions & 2 deletions github/interfaces/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down
10 changes: 5 additions & 5 deletions github/interfaces/profileowner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -132,7 +132,7 @@ def location(
"""
The location of the profile owner.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["location"]
Expand All @@ -145,7 +145,7 @@ def name(
"""
The name of the profile owner.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["name"]
Expand All @@ -171,7 +171,7 @@ def website(
"""
The website of the profile owner.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["websiteUrl"]
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions github/organization/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -247,7 +247,7 @@ def description(
"""
The description of the organization.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["description"]
Expand All @@ -267,7 +267,7 @@ def description_html(
- Sanitizes the string such that it cannot contain HTML tags.
- Wraps the string in ``<div>`` tags.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["descriptionHTML"]
Expand Down Expand Up @@ -345,7 +345,7 @@ def twitter_username(
"""
The Twitter username of the organization.
:type: Optional[:class:`str`]
:type: :class:`str` | None
"""

return self._data["twitterUsername"]
Expand Down Expand Up @@ -381,7 +381,7 @@ async def fetch_archived_at(
The :attr:`id` attribute is missing.
:rtype: Optional[:class:`~datetime.datetime`]
:rtype: :class:`~datetime.datetime` | None
"""

archived_at = await self._fetch_field("archivedAt")
Expand Down Expand Up @@ -507,7 +507,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
Expand All @@ -529,7 +529,7 @@ async def fetch_description_html(
The :attr:`id` attribute is missing.
:rtype: Optional[:class:`str`]
:rtype: :class:`str` | None
"""

return await self._fetch_field("descriptionHTML") # type: ignore
Expand Down Expand Up @@ -664,7 +664,7 @@ async def fetch_twitter_username(
The :attr:`id` attribute is missing.
:rtype: Optional[:class:`str`]
:rtype: :class:`str` | None
"""

return await self._fetch_field("twitterUsername") # type: ignore
Expand Down
Loading

0 comments on commit 2bba445

Please sign in to comment.