本文整理汇总了Python中histogram.Histogram.buildHistogram方法的典型用法代码示例。如果您正苦于以下问题:Python Histogram.buildHistogram方法的具体用法?Python Histogram.buildHistogram怎么用?Python Histogram.buildHistogram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类histogram.Histogram
的用法示例。
在下文中一共展示了Histogram.buildHistogram方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: producerLoop
# 需要导入模块: from histogram import Histogram [as 别名]
# 或者: from histogram.Histogram import buildHistogram [as 别名]
def producerLoop(exclusiveUnprocessedFileQueue, processedHistogramBuffer, numProducers):
'''
loops through, each time grabs a file from the unprocessed queue
and creates an individual histogram for that file.
Then adds that histogram to the processed buffer
for the consumer to acess
'''
global doneProducing
#while not doneProducing:
while not exclusiveUnprocessedFileQueue.isEmpty():
fileToProcess = exclusiveUnprocessedFileQueue.pop()
if fileToProcess != None: #none returned if unprocessed q was empty
#makes individual file histogram
fileHistogram = Histogram(fileToProcess)
fileHistogram.buildHistogram()
processedHistogramBuffer.add(fileHistogram)
itemsAvailable.release()
else:
continue
producerProcessedLock.acquire()
if exclusiveUnprocessedFileQueue.isEmpty() and not doneProducing:
doneProducing = 1
producerProcessedLock.release()
#tells consumer that a thread is done processing
itemsAvailable.release()