Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_secret_conf():
warning.warn("load_secret_conf will be deprecated on next release.", warning.PendingDeprecationWarning)
with open("Miragefile.secret", "r") as djfile:
try:
return json.load(djfile)
except:
raise Exception
def in_project():
warning.warn("mirage.project is now pending deprecation.", warning.PendingDeprecationWarning)
try:
set_import_root()
import manage
return True
except ImportError:
return False
except:
return False
def set_import_root():
warning.warn("mirage.project is now pending deprecation.", warning.PendingDeprecationWarning)
sys.path.append("./")
def set_import_root():
warning.warn("set_import_root will be deprecated on next release.", warning.PendingDeprecationWarning)
sys.path.append("./")
def get_app_list() -> list:
"""
Return application lists.
returns:
- (Array) cwd is in app dir returns True
"""
warning.warn("This method is now under construction.", warning.UnderConstructionWarning)
apps = []
list_dir = os.listdir(os.getcwd())
current = os.getcwd()
if not MirageEnvironment.in_project(): return
for dir_file in list_dir:
if os.path.isdir(dir_file):
os.chdir(dir_file)
if MirageEnvironment.in_app():
apps.append(dir_file)
os.chdir(current)
else:
continue
def in_app():
warning.warn("mirage.project is now pending deprecation.", warning.PendingDeprecationWarning)
try:
set_import_root()
import apps
if os.path.isfile("apps.py"):
return True
else:
return False
except ImportError:
return False
except:
return False
def in_project():
warning.warn("in_project will be deprecated on next release.", warning.PendingDeprecationWarning)
try:
set_import_root()
import manage
return True
except ImportError:
return False
except:
return False
def log(string,
withError = False, errorDetail = None,
withInput = False, withConfirm = False, default = None):
warning.warn("command.log will be deprecated on next release!", warning.PendingDeprecationWarning)
if withError:
print('\033[31mMirage: ' + str(string) + '\033[0m')
if not errorDetail == None:
separator_begin = "===== Error Detail =======================================================\n"
separator_end = "==========================================================================\n"
print('\033[31m' + separator_begin + errorDetail + "\n" + separator_end + '\033[0m')
elif withInput:
string = str(input('\033[32m' + str(string) + ' >> \033[0m'))
if string == "" and default != None: