本文整理匯總了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, "")