refs #0 The root commit.
This commit is contained in:
24
back/core/util.py
Normal file
24
back/core/util.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from config.module import Module
|
||||
from core.database import SessionLocal
|
||||
from core.helper import get_file_name, get_parent_directory_name
|
||||
|
||||
|
||||
def update_module_locals(path, _locals):
|
||||
item = get_file_name(path)
|
||||
module_name = get_parent_directory_name(path)
|
||||
|
||||
module = Module(module_name)
|
||||
|
||||
_locals[module.get_name(item)] = module.get_item(item)
|
||||
|
||||
|
||||
def get_session():
|
||||
session = SessionLocal()
|
||||
try:
|
||||
yield session
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
|
||||
def get_module(module: str) -> dict:
|
||||
return Module(module).get_item("create_schema").construct().schema()
|
||||
Reference in New Issue
Block a user