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_script(self) -> object:
with MirageEnvironment(WorkingLevel.inproject):
sys.path.append(os.getcwd())
try:
fp, name, desc = imp.find_module("mirage.config")
config_script = imp.load_module("config_script", fp, name, desc)
if config_script.MirageConfig.assertBool():
mys.log("Config script loaded!")
else:
mys.log("Failed to import mirage.config.py !", withError = True)
raise ImportError
except ImportError:
mys.log("Failed to import mirage.config.py !", withError = True)
def _check(self, logger):
with proj.InDir(self._to):
if Path(self._app).is_dir():
if not mys.log("%s ia already exists.\nAre you sure to replace new one?" % self._app, withConfirm = True):
raise FileExistsError
else:
os.system("rm -rf " + self._app)
def flow(self):
for flow in self._flows:
if "function" in str(type(flow)):
try:
flow()
except:
mys.log("Something error has occured!", withError = True, errorDetail = mys.raise_error_message(flow))
raise Exception
def _create_new_django_app(self):
mys.command("django-admin startproject " + self._project_name)
sys.path.append(td)
request.urlretrieve(self._url, "mg_version_check.py")
try:
import mg_version_check
except ImportError:
mys.log("Failed to get version information!", withError=True,
errorDetail=mys.raise_error_message(self.main, traceback.format_exc()))
return
if ver == mg_version_check.__version__:
if ver == "0.1.7":
mys.log("New mirage framework tools available!")
mys.log("See, https://github.com/shotastage/mirageframework for detail.")
else:
mys.log("Update available!", withError=True)
print("This version: {0}".format(ver))
print("Available version: {0}".format(mg_version_check.__version__))
def main(self):
# Beta Warning
mys.log("This feature is now under Beta version.", withError=True)
# Logger instance
logger = mys.progress.Progress()
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
# In advance checking.
try:
self._check(logger)
except:
return
logger.write("Searching application %s..." % self._app, withLazy = True)
if Path(self._app).is_dir():
def __init__(self, subcommand):
mys.log("Django DataBase is now unser development!", withError = True)
self._subcommand = subcommand
def main(self):
if project.in_project():
mys.log("Launching Django Python Shell")
os.system("python manage.py shell")
else:
mys.log("Current dir " + os.getcwd() + " is out of Django project!", withError = True)