You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
import site
|
|
import os
|
|
|
|
class Variable:
|
|
def __init__(self):
|
|
pass
|
|
|
|
def get(self):
|
|
"""
|
|
Функция заполнения переменной
|
|
"""
|
|
pass
|
|
|
|
def set(self, value):
|
|
"""
|
|
Функция модификации переменной
|
|
"""
|
|
pass
|
|
|
|
def choice(self):
|
|
"""
|
|
Функция возвращет список доступных значений для переменной
|
|
"""
|
|
pass
|
|
|
|
def check(self, value):
|
|
"""
|
|
Функция проверки значения устанавливаемого значения
|
|
"""
|
|
|
|
class NamespaceError(Exception):
|
|
pass
|
|
|
|
class Namespace:
|
|
DefaultPath = "[default_path]"
|
|
def __init__(self, varPath=DefaultPath):
|
|
if varPath is Namespace.DefaultPath:
|
|
self.varPath = self._getMainPackage()
|
|
else:
|
|
self.varPath = varPath
|
|
self.childs = []
|
|
|
|
def _getMainPackage(self):
|
|
site_dirs = [os.path.normpath(x) for x in site.getsitepackages()]
|
|
for site_dir in site_dirs:
|
|
calculate_dir = os.path.join(site_dir, "calculate/vars")
|
|
if os.path.exists(calculate_dir):
|
|
return calculate_dir
|
|
|
|
def findVariablePackages(self, dirPath):
|
|
pass
|