Skip to content

Commit 55ce59a

Browse files
committed
chore: pre-commit changes
1 parent 69dcd65 commit 55ce59a

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

upcloud_api/cloud_manager/storage_mixin.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from os import PathLike
2-
from typing import BinaryIO, Optional, Union
2+
from typing import BinaryIO
33

44
from upcloud_api.api import API
55
from upcloud_api.storage import BackupDeletionPolicy, Storage
@@ -47,7 +47,7 @@ def create_storage(
4747
title: str = 'Storage disk',
4848
encrypted: bool = False,
4949
*,
50-
backup_rule: Optional[dict] = None,
50+
backup_rule: dict | None = None,
5151
) -> Storage:
5252
"""
5353
Create a Storage object. Returns an object based on the API's response.
@@ -70,7 +70,7 @@ def create_storage(
7070
res = self.api.post_request('/storage', body)
7171
return Storage(cloud_manager=self, **res['storage'])
7272

73-
def _modify_storage(self, storage, size, title, backup_rule: Optional[dict] = None):
73+
def _modify_storage(self, storage, size, title, backup_rule: dict | None = None):
7474
body = {'storage': {}}
7575
if size:
7676
body['storage']['size'] = size
@@ -81,7 +81,7 @@ def _modify_storage(self, storage, size, title, backup_rule: Optional[dict] = No
8181
return self.api.put_request('/storage/' + str(storage), body)
8282

8383
def modify_storage(
84-
self, storage: str, size: int, title: str, backup_rule: Optional[dict] = None
84+
self, storage: str, size: int, title: str, backup_rule: dict | None = None
8585
) -> Storage:
8686
"""
8787
Modify a Storage object. Returns an object based on the API's response.
@@ -95,9 +95,7 @@ def delete_storage(self, uuid: str, backups: BackupDeletionPolicy = BackupDeleti
9595
"""
9696
return self.api.delete_request(f'/storage/{uuid}?backups={backups.value}')
9797

98-
def clone_storage(
99-
self, storage: Union[Storage, str], title: str, zone: str, tier=None
100-
) -> Storage:
98+
def clone_storage(self, storage: Storage | str, title: str, zone: str, tier=None) -> Storage:
10199
"""
102100
Clones a Storage object. Returns an object based on the API's response.
103101
"""
@@ -203,7 +201,7 @@ def create_storage_import(
203201
def upload_file_for_storage_import(
204202
self,
205203
storage_import: StorageImport,
206-
file: Union[str, PathLike, BinaryIO],
204+
file: str | PathLike | BinaryIO,
207205
timeout: int = 30,
208206
content_type: str = 'application/octet-stream',
209207
):

upcloud_api/cloud_manager/tag_mixin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Optional
2-
31
from upcloud_api.api import API
42
from upcloud_api.tag import Tag
53

@@ -24,7 +22,7 @@ def get_tag(self, name: str) -> Tag:
2422
return Tag(cloud_manager=self, **res['tag'])
2523

2624
def create_tag(
27-
self, name: str, description: Optional[str] = None, servers: Optional[list] = None
25+
self, name: str, description: str | None = None, servers: list | None = None
2826
) -> Tag:
2927
"""
3028
Create a new Tag. Only name is mandatory.

upcloud_api/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from time import sleep
2-
from typing import TYPE_CHECKING, Any, Optional
2+
from typing import TYPE_CHECKING, Any
33

44
from upcloud_api.firewall import FirewallRule
55
from upcloud_api.ip_address import IPAddress
@@ -276,7 +276,7 @@ def remove_ip(self, ip_address: IPAddress) -> None:
276276

277277
def add_storage(
278278
self,
279-
storage: Optional[Storage] = None, # TODO: this probably shouldn't be optional
279+
storage: Storage | None = None, # TODO: this probably shouldn't be optional
280280
type: str = 'disk',
281281
address=None,
282282
) -> None:

0 commit comments

Comments
 (0)