From 2415bce364d0def411f82af3858958d0a5924a26 Mon Sep 17 00:00:00 2001
From: Richard Neumann <r.neumann@homeinfo.de>
Date: Sat, 19 Feb 2022 18:04:44 +0100
Subject: [PATCH] Use | operator instead of Optional and Union

---
 rcon/battleye/proto.py | 6 +++---
 rcon/client.py         | 5 ++---
 rcon/config.py         | 6 +++---
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/rcon/battleye/proto.py b/rcon/battleye/proto.py
index 484fb74..3c706b2 100644
--- a/rcon/battleye/proto.py
+++ b/rcon/battleye/proto.py
@@ -1,7 +1,7 @@
 """Low-level protocol stuff."""
 
 from __future__ import annotations
-from typing import NamedTuple, Union
+from typing import NamedTuple
 from zlib import crc32
 
 
@@ -172,8 +172,8 @@ class ServerMessage(NamedTuple):
         return self.payload.decode('ascii')
 
 
-Request = Union[LoginRequest, CommandRequest]
-Response = Union[LoginResponse, CommandResponse, ServerMessage]
+Request = LoginRequest | CommandRequest
+Response = LoginResponse | CommandResponse | ServerMessage
 
 RESPONSE_TYPES = {
     0x00: LoginResponse,
diff --git a/rcon/client.py b/rcon/client.py
index 6093e50..09a6d3f 100644
--- a/rcon/client.py
+++ b/rcon/client.py
@@ -1,7 +1,6 @@
 """Common base client."""
 
 from socket import SocketKind, socket
-from typing import Optional
 
 
 __all__ = ['BaseClient']
@@ -12,8 +11,8 @@ class BaseClient:
 
     def __init__(
             self, host: str, port: int, *,
-            timeout: Optional[float] = None,
-            passwd: Optional[str] = None
+            timeout: float | None = None,
+            passwd: str | None = None
     ):
         """Initializes the base client with the SOCK_STREAM socket type."""
         self._socket = socket(type=self._socket_type)
diff --git a/rcon/config.py b/rcon/config.py
index f81860d..8ab45d2 100644
--- a/rcon/config.py
+++ b/rcon/config.py
@@ -7,7 +7,7 @@ from getpass import getpass
 from logging import getLogger
 from os import getenv, name
 from pathlib import Path
-from typing import Iterable, NamedTuple, Optional, Union
+from typing import Iterable, NamedTuple
 
 from rcon.exceptions import ConfigReadError, UserAbort
 
@@ -41,7 +41,7 @@ class Config(NamedTuple):
 
     host: str
     port: int
-    passwd: Optional[str] = None
+    passwd: str | None = None
 
     @classmethod
     def from_string(cls, string: str) -> Config:
@@ -71,7 +71,7 @@ class Config(NamedTuple):
         return cls(host, port, passwd)
 
 
-def load(config_files: Union[Path, Iterable[Path]] = CONFIG_FILES) -> None:
+def load(config_files: Path | Iterable[Path] = CONFIG_FILES) -> None:
     """Reads the configuration files and populates SERVERS."""
 
     SERVERS.clear()