Skip to content

Commit

Permalink
integrate DATABASE_NAMES into interface_objects
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Sep 7, 2023
1 parent 1908692 commit 88abfbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cellpack/autopack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
import json
from cellpack.autopack.DBRecipeHandler import DBRecipeLoader
from cellpack.autopack.FirebaseHandler import FirebaseHandler
from cellpack.autopack.interface_objects.database_ids import DATABASE_IDS

from cellpack.autopack.interface_objects.meta_enum import MetaEnum
from cellpack.autopack.loaders.utils import read_json_file, write_json_file


Expand Down Expand Up @@ -196,19 +196,16 @@ def checkPath():
autopackdir = pref_path["autopackdir"]


class DATABASE_NAME(MetaEnum):
GITHUB = "github:"
FIREBASE = "firebase:"


REPLACE_PATH = {
"autoPACKserver": autoPACKserver,
"autopackdir": autopackdir,
"autopackdata": appdata,
DATABASE_NAME.GITHUB: autoPACKserver,
DATABASE_NAME.FIREBASE: None,
f"{DATABASE_IDS.GITHUB}:": autoPACKserver,
f"{DATABASE_IDS.FIREBASE}:": None,
}


global CURRENT_RECIPE_PATH
CURRENT_RECIPE_PATH = appdata
# we keep the file here, it come with the distribution
Expand Down Expand Up @@ -284,7 +281,7 @@ def is_remote_path(file_path):
"""
@param file_path: str
"""
for ele in DATABASE_NAME:
for ele in DATABASE_IDS.with_colon():
if ele in file_path:
return True

Expand Down
4 changes: 4 additions & 0 deletions cellpack/autopack/interface_objects/database_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
class DATABASE_IDS(MetaEnum):
FIREBASE = "firebase"
GITHUB = "github"

@classmethod
def with_colon(cls):
return [f"{ele}:" for ele in cls.values()]

0 comments on commit 88abfbe

Please sign in to comment.