本文整理汇总了Python中utils.trace函数的典型用法代码示例。如果您正苦于以下问题:Python trace函数的具体用法?Python trace怎么用?Python trace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,uploadTokenDict,blooploadChunkFilename, remoteSession, fileObject):
GetterSetter.__init__(self)
if remoteSession is not None:
self.setRemoteSession(remoteSession)
if blooploadChunkFilename is not None:
self.setBlooploadChunkFilename(blooploadChunkFilename)
if fileObject is not None:
self.setFileObject(fileObject)
if uploadTokenDict == None and blooploadChunkFilename == None:
'''They want to use an empty object'''
trace("UploadToken","__init__","Using empty constructor")
return
if uploadTokenDict is None:
trace("UploadToken","__init__","UploadToken Constructor: Missing token dict.")
raise UploadTokenException("UploadToken Constructor: Missing token dict.")
for x in uploadTokenDict:
#trace('UploadToken','__init__', x + ':' + str(uploadTokenDict[x]))
self._set(x,uploadTokenDict[x])
#End transfer.
#trace('UploadToken','__init__', "The Upload Token->")
#trace('UploadToken','__init__', uploadTokenDict)
if uploadTokenDict['status'] == '1' :
try:
self._checkIncomingKeys()
except UploadTokenException, e:
raise e
开发者ID:gubatron,项目名称:blooploader,代码行数:34,代码来源:upload_token.py
示例2: handleStartElement
def handleStartElement(self, name, attrs):
"""Called by expat parser on start element."""
if name == "funkload":
self.config["version"] = attrs["version"]
self.config["time"] = attrs["time"]
elif name == "config":
self.config[attrs["key"]] = attrs["value"]
if attrs["key"] == "duration":
if self.cycle_duration and attrs["value"] != self.cycle_duration:
trace("Skipping file %s with different cycle duration %s" % (self.current_file, attrs["value"]))
raise EndOfConfig
self.cycle_duration = attrs["value"]
elif attrs["key"] == "cycles":
if self.cycles and attrs["value"] != self.cycles:
trace(
"Skipping file %s with different cycles %s != %s"
% (self.current_file, attrs["value"], self.cycles)
)
raise EndOfConfig
self.cycles = attrs["value"]
elif attrs["key"] == "node":
self.nodes[self.current_file] = attrs["value"]
else:
self.files.append(self.current_file)
raise EndOfConfig
开发者ID:kossovo,项目名称:FunkLoad,代码行数:25,代码来源:MergeResultFiles.py
示例3: unpack
def unpack(self):
utils.trace( "MultiSource unpack", 2 )
# pylint: disable=E1101
# multiple inheritance: MultiSource is never the only
# superclass, others define self.buildSystemType.
self.source.buildSystemType = self.buildSystemType
return self.source.unpack()
开发者ID:matlinuxer2,项目名称:kde-windows-emerge,代码行数:7,代码来源:MultiSource.py
示例4: SourceFactory
def SourceFactory(settings):
""" return sourceBase derived instance for recent settings"""
utils.trace( "SourceFactory called", 1 )
source = None
if settings.hasTarget():
if settings.hasMultipleTargets():
url = settings.targetAt(0)
else:
url = settings.target()
source = ArchiveSource(settings)
## \todo move settings access into info class
if settings.hasSvnTarget():
url = settings.svnTarget()
sourceType = utils.getVCSType( url )
if sourceType == "svn":
source = SvnSource(settings)
elif sourceType == "hg":
source = HgSource(settings)
elif sourceType == "git":
source = GitSource(settings)
if source == None:
utils.die("none or unsupported source system set")
if not source.subinfo:
source.subinfo = settings
source.url = url
return source
开发者ID:pombredanne,项目名称:emerge-1,代码行数:29,代码来源:SourceFactory.py
示例5: processDone
def processDone(self, view, protocol, client,
account, request):
if __debug__:
trace("processDone")
if self.shuttingDown:
return None
# request
# 0: cmd
# 1: client
# 2: accountUUID
dt = self.getDownloadTracker(account)
if dt.totalDownloaded > 0:
# This is a PyICU.ChoiceFormat class
txt = constants.DOWNLOAD_CHANDLER_MESSAGES.format(dt.totalDownloaded)
setStatusMessage(txt % \
{'accountName': account.displayName,
'numberTotal': dt.totalDownloaded,
'numberNew': dt.totalNewDownloaded,
'numberUpdates': dt.totalUpdateDownloaded,
'numberDuplicates': dt.totalIgnoreDownloaded,
'numberErrors': dt.totalErrorDownloaded})
else:
setStatusMessage(constants.DOWNLOAD_NO_MESSAGES % \
{'accountName': account.displayName})
self._resetWorker(account)
# Post a notification to the Mail Protocol Client
# That the requested actions are finished.
reactor.callFromThread(client.requestsComplete)
开发者ID:HackLinux,项目名称:chandler,代码行数:34,代码来源:mailworker.py
示例6: processUIDS
def processUIDS(self, view, protocol, client,
account, request):
if __debug__:
trace("processUIDS")
# request =
# 0: cmd
# 1: Mail Client
# 2: accountUUID
# 3: proocol specific info
# IMAP = tuple containing
# 0: imap folder UUID
# 1: UID of last message
#
# POP = List of UIDS of seen messages
if self.shuttingDown:
return None
if protocol == "IMAP":
imapFolderUUID = request[3][0]
imapFolder = view.findUUID(imapFolderUUID)
# Store the last message UID for the IMAPFolder
imapFolder.lastMessageUID = request[3][1]
elif protocol == "POP":
uids = request[3]
for uid in uids:
account.seenMessageUIDS[uid] = "True"
view.commit()
开发者ID:HackLinux,项目名称:chandler,代码行数:33,代码来源:mailworker.py
示例7: onDeleteAction
def onDeleteAction(self, val):
'''
Prepares for deletion of selected folders and files.
If the user is sure, it will invoke deleteAction on a worker thread.
'''
utils.trace("ActionManager","onDeleteAction","")
from AppController import AppController
bloopTree = AppController.getInstance().getMainViewController().getBloopTree()
# Grab the currently selected items (could be multiple selections)
currentItems = bloopTree.selectedItems()
if currentItems is None:
return
if len(currentItems) > 0:
from PyQt4.Qt import QMessageBox
delConfirmMsg = i18n.LABEL_CONFIRM_FILE_DELETION_MESSAGE if len(currentItems) == 1 else i18n.LABEL_CONFIRM_FILES_DELETION_MESSAGE
confirmDelete = QMessageBox.warning(AppController.getInstance().getMainView(),
i18n.LABEL_CONFIRM_FILES_DELETION_TITLE,
delConfirmMsg,
QMessageBox.Yes | QMessageBox.Cancel,
QMessageBox.Yes);
if confirmDelete == QMessageBox.Cancel:
AppController.getInstance().getMainView().statusBar().showMessage("")
return
AppController.getInstance().getMainView().statusBar().showMessage(i18n.LABEL_BLOOPTREE_STATUS_BAR_DELETING)
self.hireWorker(self.deleteAction, currentItems)
开发者ID:gubatron,项目名称:blooploader,代码行数:30,代码来源:ActionManager.py
示例8: dummyUpload
def dummyUpload(self):
'''Proof of concept method to upload a file to mybloop'''
from base64 import b64encode
'''will upload a dummy file'''
fp = open('01.mp3')
fp.seek(0,2)
fileSize = fp.tell()
fp.seek(0)
chunkNum = 0
chunkSize = 131072
offset = 0
while fp.tell() < fileSize:
fp.seek(offset)
chunkData = fp.read(chunkSize)
trace("RemoteSession","dummyUpload","Sending chunk")
self.server.dummyUpload(chunkNum,
chunkSize,
b64encode(chunkData))
offset += chunkSize
trace("RemoteSession","dummyUpload","Uploaded " + str(offset))
fp.close()
开发者ID:gubatron,项目名称:blooploader,代码行数:30,代码来源:RemoteSession.py
示例9: local_prep_worker
def local_prep_worker ( worker ):
virtual_env = os.path.join( self.remote_res_dir , self.tarred_testsdir )
if worker.isdir( virtual_env ):
worker.execute ( "rmdir -rf %s" % virtual_env )
worker.execute ( "mkdir -p %s" % virtual_env )
worker.put ( get_virtualenv_script(),
os.path.join( self.remote_res_dir,
"virtualenv.py") )
trace(".")
worker.execute( "python virtualenv.py %s" %\
self.tarred_testsdir,
cwdir = self.remote_res_dir )
tarball = os.path.split(self.tarred_tests)[1]
remote_tarball = os.path.join( self.remote_res_dir,\
tarball)
# setup funkload
worker.execute("./bin/easy_install %s" % self.funkload_location,
cwdir = virtual_env)
#unpackage tests.
worker.put( self.tarred_tests, os.path.join(self.remote_res_dir , tarball))
worker.execute( "tar -xvf %s" %(tarball), cwdir = self.remote_res_dir)
worker.execute("rm %s" % remote_tarball)
开发者ID:jasongrout,项目名称:FunkLoad,代码行数:27,代码来源:Distributed.py
示例10: onSetPrivateAction
def onSetPrivateAction(self):
utils.trace("ActionManager","onSetPublicAction","")
from AppController import AppController
bloopTree = AppController.getInstance().getMainViewController().getBloopTree()
# Grab the currently selected items (could be multiple selections)
currentItems = bloopTree.selectedItems()
if currentItems is None:
return
# We're going to store our list of files and directories here
fileList = []
dirList = []
for item in currentItems:
itemData = item.getItemData()
if item.isFile():
fileList.append(itemData['fileID'])
elif item.isDirectory():
dirList.append(itemData['directoryID'])
items = {}
items['fileList'] = fileList
items['dirList'] = dirList
utils.trace("ActionManager","onSetPublicAction",items)
# Grab the remote instance and prepare to make the call
remoteSession = AppController.getInstance().getRemoteSession()
remoteSession.setItemVisibility(items, 'private')
# Loop through the items and set their 'filePrivate' fields to 0
for item in currentItems:
item.setPrivate()
开发者ID:gubatron,项目名称:blooploader,代码行数:35,代码来源:ActionManager.py
示例11: _refreshCache
def _refreshCache(self, protocol):
instances = None
method = None
if protocol in Mail.ACCOUNT_TYPES:
instances = self._clientInstances.get(protocol)
method = Mail.ACCOUNT_TYPES[protocol].getActiveAccounts
self._view.refresh()
uuidList = []
delList = []
for acc in method(self._view):
uuidList.append(acc.itsUUID)
for accUUID in instances.keys():
if not accUUID in uuidList:
client = instances.get(accUUID)
instances.pop(accUUID)
del client
delList.append(accUUID)
if __debug__:
s = len(delList)
if s > 0:
c = s > 1 and "Clients" or "Client"
a = s > 1 and "accountUUID's" or "accountUUID"
trace("removed %s%s with %s %s" % (protocol, c, a, delList))
开发者ID:HackLinux,项目名称:chandler,代码行数:30,代码来源:mailservice.py
示例12: local_prep_worker
def local_prep_worker(worker):
remote_res_dir = os.path.join(self.remote_res_dir, worker.name)
virtual_env = os.path.join(remote_res_dir, self.tarred_testsdir)
if worker.isdir(virtual_env):
worker.execute("rm -rf %s" % virtual_env)
worker.execute("mkdir -p %s" % virtual_env)
worker.put(get_virtualenv_script(), os.path.join(remote_res_dir, "virtualenv.py"))
trace(".")
worker.execute("%s virtualenv.py %s" % (self.python_bin, self.tarred_testsdir), cwdir=remote_res_dir)
tarball = os.path.split(self.tarred_tests)[1]
remote_tarball = os.path.join(remote_res_dir, tarball)
# setup funkload
cmd = "./bin/easy_install setuptools ez_setup {funkload}".format(funkload=self.funkload_location)
if self.distributed_packages:
cmd += " %s" % self.distributed_packages
worker.execute(cmd, cwdir=virtual_env)
# unpackage tests.
worker.put(self.tarred_tests, os.path.join(remote_res_dir, tarball))
worker.execute("tar -xvf %s" % tarball, cwdir=remote_res_dir)
worker.execute("rm %s" % remote_tarball)
开发者ID:kgs,项目名称:FunkLoad,代码行数:29,代码来源:Distributed.py
示例13: main
def main(args = None):
opts = docopt.docopt(
doc = __doc__,
argv = args)
try:
if opts["--no-color"]:
utils.disable_colors()
if opts["--verbose"]:
utils.enable_tracing()
for name in opts["NAMES"]:
dist = get_distribution(name)
for name in required(dist):
raise Error(dist.project_name, "required by", name)
for req in dist.requires():
names = filter(lambda name: name != dist.project_name, required(req))
if not names:
uninstall(req.project_name, dryrun = opts["--dry-run"])
else:
utils.trace(req.project_name, "not uninstalled, used by", names)
uninstall(dist.project_name, dryrun = opts["--dry-run"])
# else:
# for dist in pip.get_installed_distributions():
# print utils.magenta(dist.project_name), dist.location
except utils.Error as exc:
raise SystemExit(utils.red(exc))
开发者ID:pombredanne,项目名称:lab-2,代码行数:25,代码来源:pip-autoremove.py
示例14: processEmpty
def processEmpty(self, view, protocol, client,
account, request):
if __debug__:
trace("processEmpty")
if self.shuttingDown:
return None
return
开发者ID:HackLinux,项目名称:chandler,代码行数:8,代码来源:mailworker.py
示例15: __init__
def __init__(self):
object.__init__(self)
utils.trace( "MultiSource __init__", 2 )
# pylint: disable=E1101
# multiple inheritance: MultiSource is never the only
# superclass, others define self.source, self.subinfo etc.
# TODO: This code should mostly be in the class defining self.source etc.
self.source = SourceFactory(self.subinfo)
self.source.localFileNames = self.localFileNames.__get__(self, MultiSource)
开发者ID:pombredanne,项目名称:emerge-1,代码行数:9,代码来源:MultiSource.py
示例16: run
def run(self):
port = 8000
if self.port:
port = int(self.port)
server_address = ('', port)
trace("Starting debug HTTP server at port %d\n" % port)
httpd = BaseHTTPServer.HTTPServer(server_address, FunkLoadHTTPRequestHandler)
httpd.serve_forever()
开发者ID:MaxCDN,项目名称:FunkLoad,代码行数:9,代码来源:FunkLoadHTTPServer.py
示例17: final_collect
def final_collect(self):
expr = re.compile("Log\s+xml:\s+(.*?)\n")
for worker, results in self._worker_results.items():
res = expr.findall(results)
if res:
remote_file = res[0]
file = os.path.split(remote_file)[1]
local_file = os.path.join(self.distribution_output, "%s-%s" % (worker.host, file))
worker.get(remote_file, local_file)
trace("* Received bench log from [%s] into %s\n" % (worker.host, local_file))
开发者ID:pnl,项目名称:FunkLoad,代码行数:10,代码来源:Distributed.py
示例18: removeThreads
def removeThreads(self, number_of_threads):
"""Removes threads. Used to dynamically remove threads during a
debug bench run."""
self.thread_creation_lock.acquire()
try:
trace('* Removing threads: ')
self.deleteThreads(number_of_threads)
trace(' done.\n')
finally:
self.thread_creation_lock.release()
开发者ID:SMFOSS,项目名称:FunkLoad,代码行数:10,代码来源:BenchRunner.py
示例19: extractScript
def extractScript(self):
"""Convert a tcpwatch capture into a FunkLoad script."""
files = self.searchFiles()
requests = self.extractRequests(files)
code = [self.convertToFunkLoad(request) for request in requests]
if not code:
trace("Sorry no action recorded.\n")
return ""
code.insert(0, "")
return self.reindent("\n".join(code))
开发者ID:rbowen,项目名称:FunkLoad,代码行数:10,代码来源:Recorder.py
示例20: put
def put(self, local_path, remote_path):
"""
performs a copy from `local_path` to `remote_path`
For performing the inverse operation, use the :meth:`get`
"""
try:
sftp = self.connection.open_sftp()
sftp.put(local_path, remote_path)
except Exception, error:
trace("failed to put %s->%s with error %s\n" % (local_path, remote_path, error))
开发者ID:pnl,项目名称:FunkLoad,代码行数:10,代码来源:Distributed.py
注:本文中的utils.trace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论