Skip to content

Commit 52f8ff9

Browse files
committed
Fix old pythons
1 parent 5494432 commit 52f8ff9

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ dependencies = [
3333
"humanize",
3434
"tblib",
3535
"paramiko",
36-
"requests"
36+
"requests",
37+
"typing-extensions",
3738
]
3839

3940
[project.urls]

src/pyorderly/outpack/location_http.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import shutil
2-
from typing import Dict, List, override
2+
from typing import Dict, List
33
from urllib.parse import urljoin
44

55
import requests
6+
from typing_extensions import override
67

78
from pyorderly.outpack.location_driver import LocationDriver
89
from pyorderly.outpack.metadata import MetadataCore, PacketFile, PacketLocation

src/pyorderly/outpack/location_path.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import shutil
33
from typing import Dict, List
44

5+
from typing_extensions import override
6+
57
from pyorderly.outpack.location_driver import LocationDriver
68
from pyorderly.outpack.metadata import MetadataCore, PacketFile, PacketLocation
79
from pyorderly.outpack.root import find_file_by_hash, root_open
@@ -13,15 +15,19 @@ class OutpackLocationPath(LocationDriver):
1315
def __init__(self, path):
1416
self.__root = root_open(path, locate=False)
1517

18+
@override
1619
def __enter__(self):
1720
return self
1821

22+
@override
1923
def __exit__(self, exc_type, exc_value, exc_tb):
2024
pass
2125

26+
@override
2227
def list(self) -> Dict[str, PacketLocation]:
2328
return self.__root.index.location(LOCATION_LOCAL)
2429

30+
@override
2531
def metadata(self, packet_ids: List[str]) -> Dict[str, str]:
2632
all_ids = self.__root.index.location(LOCATION_LOCAL).keys()
2733
missing_ids = set(packet_ids).difference(all_ids)
@@ -35,6 +41,7 @@ def metadata(self, packet_ids: List[str]) -> Dict[str, str]:
3541
ret[packet_id] = read_string(path)
3642
return ret
3743

44+
@override
3845
def fetch_file(self, _packet: MetadataCore, file: PacketFile, dest: str):
3946
if self.__root.config.core.use_file_store:
4047
path = self.__root.files.filename(file.hash)

src/pyorderly/outpack/location_ssh.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from urllib.parse import urlsplit
77

88
import paramiko
9+
from typing_extensions import override
910

1011
from pyorderly.outpack.config import Config
1112
from pyorderly.outpack.hash import hash_parse
@@ -52,6 +53,7 @@ def __init__(self, url: str, known_hosts=None, password=None):
5253
self._password = password
5354
self._stack = ExitStack()
5455

56+
@override
5557
def __enter__(self):
5658
with ExitStack() as stack:
5759
client = stack.enter_context(paramiko.SSHClient())
@@ -98,9 +100,11 @@ def __enter__(self):
98100

99101
return self
100102

103+
@override
101104
def __exit__(self, *args):
102105
return self._stack.__exit__(*args)
103106

107+
@override
104108
def list(self) -> Dict[str, PacketLocation]:
105109
path = self._root / ".outpack" / "location" / LOCATION_LOCAL
106110
result = {}
@@ -109,6 +113,7 @@ def list(self) -> Dict[str, PacketLocation]:
109113
result[packet] = PacketLocation.from_json(f.read().strip())
110114
return result
111115

116+
@override
112117
def metadata(self, ids: List[str]) -> Dict[str, str]:
113118
path = self._root / ".outpack" / "metadata"
114119
result = {}
@@ -119,6 +124,7 @@ def metadata(self, ids: List[str]) -> Dict[str, str]:
119124

120125
return result
121126

127+
@override
122128
def fetch_file(self, packet: MetadataCore, file: PacketFile, dest: str):
123129
path = self._file_path(packet, file)
124130
if path is None:

0 commit comments

Comments
 (0)