本文整理汇总了Python中pyaid.file.FileUtils.FileUtils.makeFolderPath方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.makeFolderPath方法的具体用法?Python FileUtils.makeFolderPath怎么用?Python FileUtils.makeFolderPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyaid.file.FileUtils.FileUtils
的用法示例。
在下文中一共展示了FileUtils.makeFolderPath方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initializeFromInternalPath
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def initializeFromInternalPath(cls, referencePath, force =False):
""" Used to explicitly initialiize the pyglass environment when running inside the source
code respository with a standard structure where the repository root has a src and
a resources folder. """
if cls.isInitialized and not force:
return True
path = FileUtils.cleanupPath(referencePath, noTail=True)
if os.path.isfile(path):
path = FileUtils.getDirectoryOf(referencePath, noTail=True)
rootPath = None
while path:
srcPath = FileUtils.makeFolderPath(path, 'src', isDir=True)
resPath = FileUtils.makeFolderPath(path, 'resources', isDir=True)
if os.path.exists(srcPath) and os.path.exists(resPath):
rootPath = path
break
path = FileUtils.getDirectoryOf(path, noTail=True)
if not rootPath:
return False
cls._rootResourcePath = FileUtils.makeFolderPath(rootPath, 'resources')
cls._rootLocalResourcePath = FileUtils.makeFolderPath(rootPath, 'resources', 'local')
return True
示例2: initialize
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def initialize():
path = FileUtils.makeFolderPath(MY_DIR, 'data')
SystemUtils.remove(path)
os.makedirs(path)
tracks = DataLoadUtils.getTrackWithAnalysis()
return tracks[['uid', 'site', 'width', 'sizeClass']]
示例3: tempPath
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def tempPath(self):
""" The root folder path where all temporary files created during analysis should be stored.
This path is created on demand and always removed at the end of the analysis process,
even if the process is aborted by an error in an analysis stage. """
if not self._tempPath:
return FileUtils.makeFolderPath(self._defaultRootPath, 'temp')
return self._tempPath
示例4: initialize
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def initialize(my_path):
if os.path.isfile(my_path):
my_path = FileUtils.getDirectoryOf(my_path)
path = FileUtils.makeFolderPath(my_path, 'data')
SystemUtils.remove(path)
os.makedirs(path)
return path
示例5: getAppDatabaseItems
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [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: getMigrationPathFromDatabaseUrl
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def getMigrationPathFromDatabaseUrl(cls, databaseUrl, root=False, resourcesPath=None):
urlParts = databaseUrl.split("://")
if urlParts[0].lower() == "shared":
path = ["shared", "alembic"]
else:
path = ["apps", urlParts[0], "alembic"]
if not root:
path += urlParts[-1].split("/")
# Remove the extension
if path[-1].endswith(".vdb"):
path[-1] = path[-1][:-4]
if resourcesPath:
return FileUtils.makeFolderPath(resourcesPath, *path, isDir=True)
return PyGlassEnvironment.getRootResourcePath(*path, isDir=True)
示例7: hasMigrationEnvironment
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def hasMigrationEnvironment(cls, databaseUrl, resourcesPath =None):
""" Determines whether or not the specified application database currently has a migration
environment setup
:param databaseUrl:
:param resourcesPath:
:return: True or false depending on the presence of a migration environment """
if not resourcesPath:
resourcesPath = PyGlassEnvironment.getRootResourcePath(isDir=True)
migrationPath = PyGlassModelUtils.getMigrationPathFromDatabaseUrl(
databaseUrl=databaseUrl, resourcesPath=resourcesPath)
if not os.path.exists(migrationPath):
return False
if not os.path.exists(FileUtils.makeFilePath(migrationPath, 'alembic.ini')):
return False
if not os.path.exists(FileUtils.makeFolderPath(migrationPath, 'versions')):
return False
return True
示例8:
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
from __future__ import print_function, absolute_import, unicode_literals, division
import os
import sys
from pyaid.file.FileUtils import FileUtils
from pyaid.json.JSON import JSON
from pyaid.system.SystemUtils import SystemUtils
FOLDER_NAME = 'Statistical-Results'
#---------------------------------------------------------------------------------------------------
rootPath = FileUtils.getDirectoryOf(__file__)
localAnalysisPath = FileUtils.makeFolderPath(rootPath, '..', 'resources', 'local', 'analysis')
analysisConfigPath = FileUtils.makeFilePath(localAnalysisPath, 'analysis.json')
config = JSON.fromFile(analysisConfigPath)
if 'OUTPUT_PATH' not in config:
rootTargetPath = localAnalysisPath
else:
rootTargetPath = FileUtils.cleanupPath(config['OUTPUT_PATH'], isDir=True)
targetPath = FileUtils.makeFolderPath(rootTargetPath, FOLDER_NAME)
if os.path.exists(targetPath):
SystemUtils.remove(targetPath)
outputPath = FileUtils.makeFolderPath(rootPath, 'output')
示例9: _getLayout
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
import locale
import numpy as np
import pandas as pd
import plotly.graph_objs as plotlyGraph
from cadence.analysis.shared import DataLoadUtils, PlotConfigs
from cadence.analysis.shared.plotting import PlotlyUtils
from plotly import plotly
################################################################################
locale.setlocale(locale.LC_ALL, ('en_US', 'utf8'))
PLOTLY_FOLDER = 'Comparison'
MY_DIR = FileUtils.getDirectoryOf(__file__)
DATA_DIR = FileUtils.makeFolderPath(MY_DIR, 'data')
OUT_PATH = FileUtils.makeFilePath(DATA_DIR, 'deviation.h5')
METADATA_FILE = FileUtils.makeFilePath(DATA_DIR, 'deviation.metadata.json')
#_______________________________________________________________________________
def _getLayout(
metadata, title, fixed = False, xAxis =None, yAxis =None, **kwargs
):
if not xAxis:
xAxis = {}
xAxis.setdefault('title', 'Deviation (%)')
if not yAxis:
yAxis = {}
yAxis.setdefault('title', 'Frequency')
yAxis.setdefault('autorange', True)
示例10: currentLocalAppResourcesPath
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def currentLocalAppResourcesPath(self):
if not self.currentAppPath:
return None
return FileUtils.makeFolderPath(self.currentAppPath, 'resources', 'local', isDir=True)
示例11: getProjectPath
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
# (C)2015
# Scott Ernst
from __future__ import \
print_function, absolute_import, \
unicode_literals, division
import os
import re
import sqlalchemy as sqla
import pandas as pd
from pyaid.file.FileUtils import FileUtils
ROOT_PROJECT_PATH = FileUtils.makeFolderPath(
FileUtils.getDirectoryOf(__file__), '..', '..')
_data = None
#_______________________________________________________________________________
def getProjectPath(*args, **kwargs):
""" Creates an absolute path from the relative path arguments within the
project folder.
"""
return FileUtils.createPath(ROOT_PROJECT_PATH, *args, **kwargs)
#_______________________________________________________________________________
def getResourcesPath(*args, **kwargs):
""" Creates an absolute path from the relative path arguments within the
project folder.
"""
示例12: namedtuple
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
from pyaid.file.CsvWriter import CsvWriter
from pyaid.file.FileUtils import FileUtils
import six
from cadence import reporting
from cadence.analysis.shared import DataLoadUtils
from cadence.enums.TrackCsvColumnEnum import TrackCsvColumnEnum
from cadence.enums.TrackPropEnum import TrackPropEnum
MY_DIR = FileUtils.getDirectoryOf(__file__)
DATA_DIR = FileUtils.makeFolderPath(MY_DIR, "data")
OUT_PATH = FileUtils.makeFilePath(DATA_DIR, "beb500.h5")
METADATA_FILE = FileUtils.makeFilePath(DATA_DIR, "beb500.metadata.json")
TCCE = TrackCsvColumnEnum
TPE = TrackPropEnum
ENTRY = namedtuple("ENTRY", ["label", "src", "dest"])
CONVERSIONS = [
ENTRY("Index", TCCE.INDEX, None),
ENTRY("Tracksite", TCCE.TRACKSITE, TPE.SITE),
ENTRY("Level", TCCE.LEVEL, TPE.LEVEL),
ENTRY("Trackway", TCCE.TRACKWAY, None),
ENTRY("Excavation Area", TCCE.SECTOR, TPE.SECTOR),
ENTRY("E", TCCE.ENTRY_AZIMUTH, ""),
示例13: outputRootPath
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import makeFolderPath [as 别名]
def outputRootPath(self):
""" The root folder where analysis output files for this particular Analyzer should be
stored. This path represents a folder within the analysisRootPath property specific
to this analyzer. """
return FileUtils.makeFolderPath(self.analysisRootPath, self.__class__.__name__)