Skip to content

Commit

Permalink
fix formatting for repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
niklastheman committed Feb 21, 2024
1 parent 00f3ac3 commit 256de93
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@


class Combiner:
def __init__(self, id: str, name: str, address: str, certificate: str | None, config: dict, fqdn: str | None, ip: str, key: str | None, parent: dict, port: int, status: str, updated_at: str):
def __init__(
self,
id: str,
name: str,
address: str,
certificate: str,
config: dict,
fqdn: str,
ip: str,
key: str,
parent: dict,
port: int,
status: str,
updated_at: str
):
self.id = id
self.name = name
self.address = address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ def list_descendants(self, id: str, limit: int, use_typing: bool = False) -> Lis
model: str = self.database[self.collection].find_one({"key": "models", "parent_model": current_model_id})

if model is not None:
formatted_model: Model | dict = Model.from_dict(model) if use_typing else from_document(model)
formatted_model = Model.from_dict(model) if use_typing else from_document(model)
result.append(formatted_model)
current_model_id = model["model"]
else:
break

result.reverse()

Expand Down Expand Up @@ -123,9 +125,11 @@ def list_ancestors(self, id: str, limit: int, use_typing: bool = False) -> List[
model = self.database[self.collection].find_one({"key": "models", "model": current_model_id})

if model is not None:
formatted_model: Model | dict = Model.from_dict(model) if use_typing else from_document(model)
formatted_model = Model.from_dict(model) if use_typing else from_document(model)
result.append(formatted_model)
current_model_id = model["parent_model"]
else:
break

return result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@


class Package:
def __init__(self, id: str, key: str, committed_at: datetime, description: str, file_name: str, helper: str, name: str, storage_file_name: str, active: bool = False):
def __init__(
self,
id: str,
key: str,
committed_at: datetime,
description: str,
file_name: str,
helper: str,
name: str,
storage_file_name: str,
active: bool = False
):
self.key = key
self.committed_at = committed_at
self.description = description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def add(self, item: T) -> bool:
def delete(self, id: str) -> bool:
pass

def list(self, limit: int | None, skip: int | None, sort_key: str, sort_order=pymongo.DESCENDING, use_typing: bool = False, **kwargs) -> Dict[int, List[T]]:
def list(self, limit: int, skip: int, sort_key: str, sort_order=pymongo.DESCENDING, use_typing: bool = False, **kwargs) -> Dict[int, List[T]]:
cursor = self.database[self.collection].find(kwargs).sort(sort_key, sort_order).skip(skip or 0).limit(limit or 0)

count = self.database[self.collection].count_documents(kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@


class Status:
def __init__(self, id: str, status: str, timestamp: str, log_level: str, data: str, correlation_id: str, type: str, extra: str, session_id: str, sender: dict = None):
def __init__(
self,
id: str,
status: str,
timestamp: str,
log_level: str,
data: str,
correlation_id: str,
type: str,
extra: str,
session_id: str,
sender: dict = None
):
self.id = id
self.status = status
self.timestamp = timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@


class Validation:
def __init__(self, id: str, model_id: str, data: str, correlation_id: str, timestamp: str, session_id: str, meta: str, sender: dict = None, receiver: dict = None):
def __init__(
self,
id: str,
model_id: str,
data: str,
correlation_id: str,
timestamp: str,
session_id: str,
meta: str,
sender: dict = None,
receiver: dict = None
):
self.id = id
self.model_id = model_id
self.data = data
Expand Down

0 comments on commit 256de93

Please sign in to comment.