本文整理汇总了Python中pyglass.app.PyGlassEnvironment.PyGlassEnvironment.getRootLocalResourcePath方法的典型用法代码示例。如果您正苦于以下问题:Python PyGlassEnvironment.getRootLocalResourcePath方法的具体用法?Python PyGlassEnvironment.getRootLocalResourcePath怎么用?Python PyGlassEnvironment.getRootLocalResourcePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyglass.app.PyGlassEnvironment.PyGlassEnvironment
的用法示例。
在下文中一共展示了PyGlassEnvironment.getRootLocalResourcePath方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _changeDirToLocalAppPath
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def _changeDirToLocalAppPath(cls, localResourcesPath):
"""_changeDirToLocalAppPath doc..."""
if not localResourcesPath:
localResourcesPath = PyGlassEnvironment.getRootLocalResourcePath(isDir=True)
lastDir = os.path.abspath(os.curdir)
os.chdir(localResourcesPath)
return lastDir
示例2: getAnalysisSettings
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getAnalysisSettings():
""" Retrieves the analysis configuration settings file as a SettingsConfig
instance that can be modified and saved as needed.
@return: SettingsConfig """
if not __LOCALS__.SETTINGS_CONFIG:
__LOCALS__.SETTINGS_CONFIG = SettingsConfig(
FileUtils.makeFilePath(
PyGlassEnvironment.getRootLocalResourcePath(
'analysis', isDir=True),
'analysis.json'), pretty=True)
return __LOCALS__.SETTINGS_CONFIG
示例3: upgradeDatabase
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def upgradeDatabase(cls, databaseUrl):
"""upgradeDatabase doc..."""
from pyglass.alembic.AlembicUtils import AlembicUtils
if not AlembicUtils.hasAlembic:
return False
AlembicUtils.upgradeDatabase(
databaseUrl=databaseUrl,
resourcesPath=PyGlassEnvironment.getRootResourcePath(isDir=True),
localResourcesPath=PyGlassEnvironment.getRootLocalResourcePath(isDir=True),
)
return True
示例4: getPathFromDatabaseUrl
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getPathFromDatabaseUrl(cls, databaseUrl):
urlParts = databaseUrl.split(u'://')
# Determine the sqlite database path
if urlParts[0].lower() == u'shared':
path = [u'shared', u'data']
else:
path = [u'apps', urlParts[0], u'data']
path += urlParts[1].strip(u'/').split(u'/')
if not path[-1].endswith(u'.vdb'):
path[-1] += u'.vdb'
return PyGlassEnvironment.getRootLocalResourcePath(*path)
示例5: getAppDatabaseItems
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getAppDatabaseItems(cls, appName, localResourcesPath =None):
if not localResourcesPath:
localResourcesPath = PyGlassEnvironment.getRootLocalResourcePath(isDir=True)
databaseRoot = FileUtils.makeFolderPath(localResourcesPath, 'apps', appName, 'data')
if not os.path.exists(databaseRoot):
return []
results = []
FileUtils.walkPath(databaseRoot, cls._findAppDatabases, {
'root':databaseRoot,
'results':results,
'appName':appName })
return results
示例6: getPathFromDatabaseUrl
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getPathFromDatabaseUrl(cls, databaseUrl, localResourcesPath=None):
urlParts = databaseUrl.split("://")
# Determine the sqlite database path
if urlParts[0].lower() == "shared":
path = ["shared", "data"]
else:
path = ["apps", urlParts[0], "data"]
path += urlParts[1].strip("/").split("/")
if not path[-1].endswith(".vdb"):
path[-1] += ".vdb"
if localResourcesPath:
return FileUtils.makeFilePath(localResourcesPath, *path)
return PyGlassEnvironment.getRootLocalResourcePath(*path, isFile=True)
示例7: __init__
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def __init__(self, **kwargs):
"""
Creates a new instance of AnalyzerBase.
[cacheData] ~ Object | CacheData
A caching object on which to store data during analysis at the
analyzer level, instead of the stage level.
[logger] ~ Logger
A logger object to use for logging within this analyzer. If no such
logger exists, a new logger is created.
[logFolderPath] ~ String
If no logger was specified for the analyzer, this is the absolute
path to the folder where the log file should be written. This
value is ignored if you specify a logger.
"""
self._tracksSession = None
self._analysisSession = None
self._cache = ConfigsDict(kwargs.get('cacheData'))
self._logger = kwargs.get('logger')
self._tempPath = kwargs.get('tempPath')
self._stages = []
self._sitemaps = []
self._trackways = dict()
self._seriesBundles = dict()
self._plotFigures = dict()
self._currentStage = None
self._success = False
self._errorMessage = None
self._startTime = None
if not self._logger:
self._logger = Logger(
name=self,
logFolder=kwargs.get('logFolderPath'),
printOut=True,
headerless=True,
removeIfExists=True,
timestampFileSuffix=False)
self._defaultRootPath = PyGlassEnvironment.getRootLocalResourcePath(
'analysis', isDir=True)
self._settings = DataLoadUtils.getAnalysisSettings()
示例8: run
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def run(self, appArgs =None, **kwargs):
"""Doc..."""
try:
if PyGlassEnvironment.isDeployed:
logPath = PyGlassEnvironment.getRootLocalResourcePath('logs', isDir=True)
if not os.path.exists(logPath):
os.makedirs(logPath)
try:
sys.stdout.close()
except Exception, err:
pass
sys.stdout = open(logPath + 'out.log', 'w')
try:
sys.stderr.close()
except Exception, err:
pass
sys.stderr = open(logPath + 'error.log', 'w')
示例9: redirectLogOutputs
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def redirectLogOutputs(self, prefix =None, logFolderPath =None):
""" Sets a temporary standard out and error for deployed applications in a write allowed
location to prevent failed write results. """
if not PyGlassEnvironment.isDeployed:
return
if not prefix:
prefix = self.appID
if not prefix.endswith('_'):
prefix += '_'
if logFolderPath:
logPath = logFolderPath
elif PyGlassEnvironment.isInitialized:
logPath = PyGlassEnvironment.getRootLocalResourcePath('logs', isDir=True)
else:
prefix += 'init_'
if appdirs:
logPath = appdirs.user_data_dir(self.appID, self.appGroupID)
else:
logPath = FileUtils.createPath(
os.path.expanduser('~'), '.pyglass', self.appGroupID, self.appID, isDir=True)
FileUtils.getDirectoryOf(logPath, createIfMissing=True)
try:
sys.stdout.flush()
sys.stdout.close()
except Exception as err:
pass
sys.stdout = open(FileUtils.makeFilePath(logPath, prefix + 'out.log'), 'w+')
try:
sys.stderr.flush()
sys.stderr.close()
except Exception as err:
pass
sys.stderr = open(FileUtils.makeFilePath(logPath, prefix + 'error.log'), 'w+')
return True
示例10: getRootLocalResourcePath
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getRootLocalResourcePath(self, *args, **kwargs):
return PyGlassEnvironment.getRootLocalResourcePath(*args, **kwargs)
示例11: rootLocalResourcePath
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def rootLocalResourcePath(self):
return PyGlassEnvironment.getRootLocalResourcePath()
示例12: getLocalAppResourcePath
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getLocalAppResourcePath(self, *args, **kwargs):
return PyGlassEnvironment.getRootLocalResourcePath('apps', self.appID, *args, **kwargs)
示例13: getLocalAppResourcePath
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getLocalAppResourcePath(cls, *args, **kwargs):
"""getLocalAppResourcePath doc..."""
return PyGlassEnvironment.getRootLocalResourcePath(
'apps', cls.APP_ID, *args, **kwargs)
示例14: getRelativeEngineUrl
# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootLocalResourcePath [as 别名]
def getRelativeEngineUrl(cls, databaseUrl, localResourcesPath=None):
"""getRelativeEngineUrl doc..."""
if not localResourcesPath:
localResourcesPath = PyGlassEnvironment.getRootLocalResourcePath(isDir=True)
url = cls.getEngineUrl(databaseUrl=databaseUrl, localResourcesPath=localResourcesPath)
return url.replace(localResourcesPath, "")