本文整理汇总了Python中OutputManager.OutputManager类的典型用法代码示例。如果您正苦于以下问题:Python OutputManager类的具体用法?Python OutputManager怎么用?Python OutputManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OutputManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verifyConfiguration
def verifyConfiguration(self, mesh):
"""
Verify compatibility of configuration.
"""
OutputManager.verifyConfiguration(self, mesh)
ModuleOutputSolnSubset.verifyConfiguration(self, mesh)
return
示例2: _configure
def _configure(self):
"""
Set members based using inventory.
"""
OutputManager._configure(self)
self.vertexDataFields = self.inventory.vertexDataFields
self.cellInfoFields = self.inventory.cellInfoFields
return
示例3: searchInTitle
def searchInTitle(self, subString):
elementList = self._searchInTitleImpl(subString)
elementDict = {}
for elements in elementList:
id = elements[0]
elementDict[id] = elements
sorted(elementDict)
OutputManager.listPrint(elementDict, OutputManager.HEADER_FULL)
示例4: searchInMushroom
def searchInMushroom(self, substr):
elementList = self._searchInMushroomImpl(substr)
for element in elementList:
OutputManager.searchMDPrint(
element[0] +
" - " +
element[1],
element[2])
示例5: _configure
def _configure(self):
"""
Set members based using inventory.
"""
try:
OutputManager._configure(self)
except ValueError, err:
aliases = ", ".join(self.aliases)
raise ValueError("Error while configuring output over points "
"(%s):\n%s" % (aliases, err.message))
示例6: _configure
def _configure(self):
"""
Set members based using inventory.
"""
try:
OutputManager._configure(self)
ModuleOutputSolnSubset.label(self, self.label)
except ValueError, err:
aliases = ", ".join(self.aliases)
raise ValueError("Error while configuring output over boundary " "(%s):\n%s" % (aliases, err.message))
示例7: __init__
def __init__(self, name="outputsoln"):
"""
Constructor.
"""
OutputManager.__init__(self, name)
self.availableFields = {
"vertex": {"info": [], "data": ["displacement", "velocity"]},
"cell": {"info": [], "data": []},
}
return
示例8: initialize
def initialize(self, mesh, normalizer):
"""
Initialize output manager.
"""
logEvent = "%sinit" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
self.submesh = self.subdomainMesh(mesh)
OutputManager.initialize(self, normalizer)
self._eventLogger.eventEnd(logEvent)
return
示例9: __init__
def __init__(self, name="outputsolnpoints"):
"""
Constructor.
"""
OutputManager.__init__(self, name)
self.availableFields = \
{'vertex': \
{'info': [],
'data': ["displacement","velocity"]},
'cell': \
{'info': [],
'data': []}}
return
示例10: initialize
def initialize(self, mesh, normalizer):
"""
Initialize output manager.
"""
logEvent = "%sinit" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
import weakref
self.mesh = weakref.ref(mesh)
OutputManager.initialize(self, normalizer)
self._eventLogger.eventEnd(logEvent)
return
示例11: listNotesAndMeta
def listNotesAndMeta(self):
list = self._swiftManager.downloadObjectIds()
soDict = {}
sort = Configuration.entriessort
for element in list:
# exclude versions and deleted notes, that always begin with 'v'
if VersionManager.isVersionOrDeleted(element):
continue
id = SwiftManager.objIdToId(element)
if id is None:
raise RuntimeError(
"Can not get the ID from " +
element +
" ... should not happen, really")
metamngr = self._swiftManager.metaManagerFactory(element)
id = int(id)
crdate = metamngr.getCreateDate()
lastmod = metamngr.getLastModifiedDate()
tags = metamngr.getTags()
name = SwiftManager.objIdToTitle(element)
soDict[id] = [id, name, crdate, lastmod, tags]
if sort == "name":
soDict = OrderedDict(
sorted(
soDict.items(),
key=lambda k_v: k_v[1][1]))
elif sort == "crdate":
soDict = OrderedDict(
sorted(
soDict.items(),
key=lambda k_v1: datetime.strptime(
k_v1[1][2],
"%H:%M:%S, %d/%m/%Y").isoformat(),
reverse=True))
elif sort == "id":
sorted(soDict)
else:
soDict = OrderedDict(
sorted(
soDict.items(),
key=lambda k_v2: datetime.strptime(
k_v2[1][3],
"%H:%M:%S, %d/%m/%Y").isoformat(),
reverse=True))
OutputManager.listPrint(soDict, OutputManager.HEADER_FULL)
示例12: diffVersions
def diffVersions(self, noteId):
'''
creates the diff of two versions of a note
:param noteId:
:return:
'''
if self._swiftManager.doesNoteExist(noteId) == True:
note, title, versions, noteList = self._versionMngr._getVersionInfo(
noteId)
# user input for id, if the input is not an integer the error
# message will be displayed
try:
diff1 = int(
raw_input("ID of base version? (0 is the current version) > "))
diff2 = int(
raw_input("ID of target version? (0 is the current version) > "))
except (ValueError):
print "invalid input"
sys.exit(1)
# check if the user wants to diff with the current note
if diff1 == 0:
diff1Content = self._swiftManager.getNote(noteId).getContent()
elif diff2 == 0:
diff2Content = self._swiftManager.getNote(noteId).getContent()
# append 0, because it's valid but not a key
self._keyList.append(0)
for key, value in versions.iteritems():
self._keyList.append(key)
diffTitle = versions[key][1]
# check which input is which note
if key == diff1:
diff1Content = noteList[diffTitle]
elif key == diff2:
diff2Content = noteList[diffTitle]
# as an information for the user, that the version doesn't exist
if diff1 not in self._keyList:
print str(diff1) + " doesn't exist"
elif diff2 not in self._keyList:
print str(diff2) + " doesn't exist"
OutputManager.printDiff(diff1Content, diff2Content)
# as an information for the user
else:
print "Note #" + str(noteId) + " doesn't exist"
示例13: searchInTags
def searchInTags(self, substr):
'''
for every object in list check for tags
check if tags are the same
if tags in element meta
print element name
'''
elementList = self._searchInTagsImpl(substr)
dict = {}
for elements in elementList:
id = elements[0]
dict[id] = elements
sorted(dict)
OutputManager.listPrint(dict, OutputManager.HEADER_TAG)
示例14: printMeta
def printMeta(self, metaId):
'''
prints the metadata of a single note
:param metaId:
:return:
'''
dict = {}
note = self.getNote(metaId)
mm = self.metaManagerFactory(note.getObjectId())
name = SwiftManager.objIdToTitle(note.getObjectId())
crDate = mm.getCreateDate()
lastmod = mm.getLastModifiedDate()
tags = mm.getTags()
dict[metaId] = [metaId, name, crDate, lastmod, tags]
sorted(dict)
OutputManager.listPrint(dict, OutputManager.HEADER_FULL)
示例15: searchEverything
def searchEverything(self, substr):
'''
this function searches for a substring, it doesn't matter if it is in title, content or tags, if there are results
they will be printed.
:param substr:
:return:
'''
titleMatch = self._searchInTitleImpl(substr)
tagMatch = self._searchInTagsImpl(substr)
contentMatch = self._searchInMushroomImpl(substr)
generalMatch = []
title = {}
tag = {}
content = {}
for element in titleMatch:
title[str(element[0])] = str(element[1])
for element in tagMatch:
tag[str(element[0])] = [str(element[1]), element[2]]
for element in contentMatch:
content[str(element[0])] = [str(element[1]), element[2]]
generalMatch = set(title.keys() + tag.keys() + content.keys())
for element in generalMatch:
if element in tag.keys() and element in content.keys():
OutputManager.searchEverythingPrint(
element,
content[element][0],
tag,
content[element][1])
elif element in content.keys():
OutputManager.searchEverythingPrint(
element,
content[element][0],
None,
content[element][1])
elif element in tag.keys():
OutputManager.searchEverythingPrint(
element,
tag.values()[0][0],
tag.values()[0][1])
elif element in title.keys():
OutputManager.searchEverythingPrint(element, title.values()[0])
else:
print "nothing found"