Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pyorderly/outpack/location_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __enter__(self):
path = self._root / ".outpack" / "config.json"
try:
with sftp.open(str(path)) as f:
self.config = Config.from_json(f.read().strip()) # type: ignore
self.config = Config.from_json(f.read().strip())
except OSError as e:
if e.errno == errno.ENOENT:
msg = f"Path '{self._root}' on remote {self._hostname} is not a valid outpack repository"
Expand All @@ -106,7 +106,7 @@ def list(self) -> Dict[str, PacketLocation]:
result = {}
for packet in self._sftp.listdir(str(path)):
with self._sftp.open(str(path / packet)) as f:
result[packet] = PacketLocation.from_json(f.read().strip()) # type: ignore
result[packet] = PacketLocation.from_json(f.read().strip())
return result

def metadata(self, ids: List[str]) -> Dict[str, str]:
Expand Down
21 changes: 8 additions & 13 deletions src/pyorderly/outpack/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
from pathlib import Path
from typing import Dict, List, Optional, Union

from dataclasses_json import dataclass_json
from dataclasses_json import DataClassJsonMixin

from pyorderly.outpack.hash import hash_file
from pyorderly.outpack.tools import GitInfo


@dataclass_json()
@dataclass
class PacketFile:
class PacketFile(DataClassJsonMixin):
path: str
size: float
hash: str
Expand All @@ -35,16 +34,14 @@ def from_packet_file(file: PacketFile, location: str, packet_id: str):
)


@dataclass_json()
@dataclass
class PacketDependsPath:
class PacketDependsPath(DataClassJsonMixin):
here: str
there: str


@dataclass_json()
@dataclass
class PacketDepends:
class PacketDepends(DataClassJsonMixin):
packet: str
query: str
files: List[PacketDependsPath]
Expand All @@ -57,9 +54,8 @@ def files_from_dict(files):
Parameters = Dict[str, Union[bool, int, float, str]]


@dataclass_json()
@dataclass
class MetadataCore:
class MetadataCore(DataClassJsonMixin):
schema_version: str
id: str
name: str
Expand All @@ -78,19 +74,18 @@ def file_hash(self, name):
raise Exception(msg)


@dataclass_json()
@dataclass
class PacketLocation:
class PacketLocation(DataClassJsonMixin):
packet: str
time: float
hash: str


def read_metadata_core(path) -> MetadataCore:
with open(path) as f:
return MetadataCore.from_json(f.read().strip()) # type: ignore
return MetadataCore.from_json(f.read().strip())


def read_packet_location(path) -> PacketLocation:
with open(path) as f:
return PacketLocation.from_json(f.read().strip()) # type: ignore
return PacketLocation.from_json(f.read().strip())
Loading