Skip to content

Commit

Permalink
Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurswag committed May 15, 2024
1 parent 7af9afb commit 7a311f8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions backend/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def __init_class__(cls):
)

@classmethod
def store_library_content(cls, library_content: bytes,builtin: bool=False) -> "StoredLibrary | None":
def store_library_content(
cls, library_content: bytes, builtin: bool = False
) -> "StoredLibrary | None":
hash_checksum = sha256(library_content)
if hash_checksum in StoredLibrary.HASH_CHECKSUM_SET:
return None # We do not store the library if its hash checksum is in the database.
Expand Down Expand Up @@ -182,10 +184,12 @@ def store_library_content(cls, library_content: bytes,builtin: bool=False) -> "S
)

@classmethod
def store_library_file(cls, fname: Path,builtin: bool=False) -> "StoredLibrary | None":
def store_library_file(
cls, fname: Path, builtin: bool = False
) -> "StoredLibrary | None":
with open(fname, "rb") as f:
library_content = f.read()
return StoredLibrary.store_library_content(library_content,builtin)
return StoredLibrary.store_library_content(library_content, builtin)

def load(self) -> Union[str, None]:
from library.utils import LibraryImporter
Expand Down

0 comments on commit 7a311f8

Please sign in to comment.