Skip to content

Commit

Permalink
typing: Replace new union syntax with Optional
Browse files Browse the repository at this point in the history
The library supports python 3.9, which does not support union with |
  • Loading branch information
Amund211 committed Jun 4, 2023
1 parent fd1bad0 commit 48f192f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions discordrp/presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from abc import ABC, abstractmethod
from enum import IntEnum
from typing import Any, cast
from typing import Any, Optional, cast
from types import TracebackType
from uuid import uuid4

Expand Down Expand Up @@ -44,7 +44,7 @@ def __init__(self, client_id: str):
# Send a handshake request
self._handshake()

def set(self, activity: dict[str, Any] | None) -> None:
def set(self, activity: Optional[dict[str, Any]]) -> None:
"""
Sends an activity payload to Discord.
:param activity: A dictionary of this format:
Expand Down Expand Up @@ -134,9 +134,9 @@ def __enter__(self) -> 'Presence':

def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
exc_traceback: TracebackType | None,
exc_type: Optional[type[BaseException]],
exc_value: Optional[BaseException],
exc_traceback: Optional[TracebackType],
) -> None:
self.close()

Expand Down

0 comments on commit 48f192f

Please sign in to comment.