本文整理汇总了Python中reporter.Reporter类的典型用法代码示例。如果您正苦于以下问题:Python Reporter类的具体用法?Python Reporter怎么用?Python Reporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_report
def get_report(record_id):
keyToken='token'
if keyToken in request.params.keys():
token=request.params.get(keyToken)
else:
return wrapResults({"error":{'code':0,'msg':"No token provided!"}})
accessible=auth.getAccessibleProducts(token)
if 'error' in accessible:
return wrapResults(accessible)
if len(accessible['products'])==0:
return wrapResults({'error':{'code':0,'msg':'No accessible products.'}})
reporter=Reporter()
data=reporter.get_report(record_id)
#print data
sysInfo=data.pop('sys_info')
si={}
for key in sysInfo:
rKey=key.replace(':','.')
si[rKey]=sysInfo[key]
if not 'android.os.Build.PRODUCT' in si:
return wrapResults({'error':{'code':0,'msg':'Permission denial.'}})
if not si['android.os.Build.PRODUCT'] in accessible['products']:
return wrapResults({'error':{'code':0,'msg':'Permission denial.'}})
else:
data['sys_info']=si
return wrapResults(data)
开发者ID:liuct,项目名称:bugquery-lt,代码行数:27,代码来源:api.py
示例2: latest
def latest():
'''
Get the latest n records.
Paramenters:
count=n(max=100,default=20)
Return:
Headers:
Content-Type:application/json
Body:
A json array and every element in the array is a json document.
array:[{},{}]
document:{"_id":id,"receive_time":time,"json_str":original}
'''
keyToken='token'
if keyToken in request.params.keys():
token=request.params.get(keyToken)
else:
return wrapResults({"error":"No token provided!"})
accessible=auth.getAccessibleProducts(token)
if 'error' in accessible:
return wrapResults(accessible)
if len(accessible['products'])==0:
return wrapResults({'error':'No accessible products.'})
limit=request.params.get('limit')
reporter=Reporter()
data=reporter.latest(limit)
result=[]
for record in data:
if record['product'] in accessible['products']:
result.append(record)
return wrapResults(result)
开发者ID:liuct,项目名称:bugquery-lt,代码行数:34,代码来源:api.py
示例3: main
def main(args):
if args.v:
print args
genes = read_genes(args)
if args.v:
print "%d genes" % len(genes)
reporter = Reporter(Host(), genes)
try:
out = open(args.out_fn, "w")
except IOError:
out = sys.stdout
except TypeError:
out = sys.stdout
out.write(reporter.report())
for k in sorted(reporter.stats.keys()):
out.write("%-20s: %s\n" % (k, reporter.stats[k]))
if out != sys.stdout:
out.close()
return 0
开发者ID:phonybone,项目名称:Nof1,代码行数:25,代码来源:report.py
示例4: download
def download():
keyToken='token'
if keyToken in request.params.keys():
token=request.params.get(keyToken)
else:
return wrapResults({"error":"No token provided!"})
accessible=auth.getAccessibleProducts(token)
if 'error' in accessible:
return wrapResults(accessible)
if len(accessible['products'])==0:
return wrapResults({'error':'No accessible products.'})
paging=getPagingParameters()
conds = getFilterConditions()
conds.pop('token')
if 'android.os.Build.PRODUCT' in conds:
if not (conds['android.os.Build.PRODUCT'] in accessible['products']):
return wrapResults({'error':'You have no rights to view the data of product:%s'%conds['android.os.Build.PRODUCT']})
result=viewer.errors(accessible['products'],paging,conds)
if result is None:
return wrapResults({'error':{'code':0,'msg':'Result is empty! Change the conditions and try again!'}})
else:
reporter=Reporter()
ids=result['data']
records=reporter.get_batch_report(ids)
result['data']=records
print records[0]
#return wrapResults(result)
f=viewer.error_list_excel(records)
response.set_header('Content-Type','application/vnd.ms-excel')
response.set_header("Content-Disposition", "attachment;filename=errorlist.xls");
return f
开发者ID:liuct,项目名称:bugquery-lt,代码行数:32,代码来源:api.py
示例5: error
def error():
'''
About paging:
request:query/error?conditions&page=1&records=25&paging_token=xxx-xxx
response: {"results":{"paging":{"totalrecords":100,"totalpages":10,"records":10,"page":1,"paging_token":"xxx-xxx"},"data":[{},{}]}}
'''
keyToken='token'
if keyToken in request.params.keys():
token=request.params.get(keyToken)
else:
return wrapResults({"error":"No token provided!"})
accessible=auth.getAccessibleProducts(token)
if 'error' in accessible:
return wrapResults(accessible)
if len(accessible['products'])==0:
return wrapResults({'error':'No accessible products.'})
paging=getPagingParameters()
conds = getFilterConditions()
conds.pop('token')
if 'android.os.Build.PRODUCT' in conds:
if not (conds['android.os.Build.PRODUCT'] in accessible['products']):
return wrapResults({'error':'You have no rights to view the data of product:%s'%conds['android.os.Build.PRODUCT']})
result=viewer.errors(accessible['products'],paging,conds)
if result is None:
return wrapResults({'error':{'code':0,'msg':'Result is empty! Change the conditions and try again!'}})
else:
reporter=Reporter()
ids=result['data']
records=reporter.get_batch_report(ids)
result['data']=records
return wrapResults(result)
开发者ID:liuct,项目名称:bugquery-lt,代码行数:32,代码来源:api.py
示例6: __init__
def __init__(self, identity, src, sink, amount, start):
Reporter.__init__(self, identity)
self.source = src
self.dest = sink
self.size = float(amount) * 8000.0 # amount in MByte -> 1000*8 KBits
self.start_time = float(start) * 1000.0 # 1000ms in a second
self.am_i_done = 0
开发者ID:T3Fei,项目名称:NetworkSimulator,代码行数:7,代码来源:flow.py
示例7: getUserData
def getUserData(user,linkTemplate,ids):
'''
Paramenters:
user: phonenumber or imsi
linkTemplate: "errors?phoneNumber=%s&date=%s" or "errors?imsi=%s&date=%s"
'''
idList=[]
for id in ids:
idList.append(int(id))
spec={"_id":{"$in":idList}}
fields=['category','receive_time']
reporter=Reporter()
records=reporter.getDatas(spec,fields)
data={}
for record in records:
recTime=record['receive_time']
category=record['category']
key=recTime.strftime('%Y%m%d')
if not key in data:
data[key]={"live": 0, "link": linkTemplate%(user,key), "error": 0}
if category=='ERROR':
data[key]['error']+=1
else:
data[key]['live']+=1
return data
开发者ID:liuct,项目名称:bugquery-lt,代码行数:26,代码来源:api.py
示例8: generate_report
def generate_report(bundle, results, options, status, html_filename,
json_filename):
bundle_yaml = get_bundle_yaml(status)
reporter = Reporter(bundle=bundle, results=results, options=options,
bundle_yaml=bundle_yaml)
reporter.generate(html_filename=html_filename,
json_filename=json_filename)
开发者ID:marcoceppi,项目名称:cloud-weather-report,代码行数:7,代码来源:cloud_weather_report.py
示例9: test_generate_with_svg
def test_generate_with_svg(self):
tempdir = mkdtemp()
json_file = os.path.join(tempdir, 'file.json')
html_file = os.path.join(tempdir, 'file.html')
svg_file = os.path.join(tempdir, 'file.svg')
results = self.make_results()
fake_request = FakeRequest()
args = self.make_args()
reporter = Reporter(bundle='git', results=results, options=args,
bundle_yaml='bundle content')
with patch('reporter.requests.post',
autospec=True, return_value=fake_request) as mock_r:
reporter.generate(html_filename=html_file, json_filename=json_file)
mock_r.assert_called_once_with('http://svg.juju.solutions',
'bundle content')
with open(json_file) as fp:
json_content = json.loads(fp.read())
with open(html_file) as fp:
html_content = fp.read()
with open(svg_file) as fp:
svg_content = fp.read()
self.assertIn('charm-proof', html_content)
self.assertEqual(json_content["bundle"]["name"], 'git')
self.assertEqual(json_content["test_id"], '1234')
self.assertEqual(svg_content, 'svg content')
rmtree(tempdir)
开发者ID:marcoceppi,项目名称:cloud-weather-report,代码行数:26,代码来源:test_reporter.py
示例10: __init__
def __init__(self, registry, refresh_interval, filename=None):
Reporter.__init__(self, registry, refresh_interval)
self._filename = filename
if filename:
self._fh = open(filename, 'w')
else:
self._fh = sys.stdout
return
开发者ID:pandich,项目名称:pymetrics,代码行数:8,代码来源:file_reporter.py
示例11: test_get_test_outcome
def test_get_test_outcome(self):
r = Reporter(None, None, None)
results = [r.pass_str, r.pass_str]
self.assertEqual(r.get_test_outcome(results), r.all_passed_str)
results = [r.pass_str, r.fail_str]
self.assertEqual(r.get_test_outcome(results), r.some_failed_str)
results = [r.fail_str, r.fail_str]
self.assertEqual(r.get_test_outcome(results), r.all_failed_str)
开发者ID:NhaTrang,项目名称:cloud-weather-report,代码行数:8,代码来源:test_reporter.py
示例12: main
def main(cmd, files, output, redis_address):
logger = Logger(stream=output == 'stream')
reporter = Reporter(**redis_address)
perf_report = reporter.get_report(files)
schedule = scheduler.make(perf_report, spawner.parallelism())
perf_report = spawner.execute(cmd, schedule, logger)
reporter.submit(perf_report)
开发者ID:jugglinmike,项目名称:parallelizer,代码行数:9,代码来源:parallelizer.py
示例13: get_log
def get_log(record_id):
##print 'get_log()'
reporter=Reporter()
log=reporter.get_log(record_id)
if log==None:
abort(404,"Can not find the log!")
else:
response.set_header('Content-Type','application/x-download')
response.set_header('Content-Disposition','attachment; filename=log_'+record_id+'.zip',True)
return log
开发者ID:liuct,项目名称:bugquery-lt,代码行数:10,代码来源:api.py
示例14: __init__
def __init__(self, input_dir, output_dir=None, tmp_dir=None):
self.input_dir = input_dir
self.output_dir = output_dir
self.tmp_dir = tmp_dir
self.storer = Storer()
self.name = self.__class__.__name__
self.repok = Reporter(prefix="[%s - INFO] " % self.name)
self.repok.new_article()
self.reper = Reporter(prefix="[%s - ERROR] " % self.name)
self.reper.new_article()
开发者ID:essepuntato,项目名称:opencitations,代码行数:10,代码来源:checker.py
示例15: test_generate_html
def test_generate_html(self):
r = Reporter(None, None, None)
with NamedTemporaryFile() as html_file:
html_output = r.generate_html(
json_content=self.make_json(), output_file=html_file.name,
past_results=[])
content = html_file.read()
self.assertRegexpMatches(html_output, 'AWS')
self.assertRegexpMatches(html_output, 'Joyent')
self.assertRegexpMatches(content, 'AWS')
self.assertRegexpMatches(content, 'Joyent')
开发者ID:NhaTrang,项目名称:cloud-weather-report,代码行数:11,代码来源:test_reporter.py
示例16: Crawler
class Crawler():
def __init__(self):
self.vip_info = VipInfo()
self.rss_links = self._load_rss_links()
self.reporter = Reporter()
def _load_rss_links(self):
links = []
directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), "rss")
for root, dirs, fs in os.walk(directory):
for f in fs:
links.append(os.path.join(root, f))
return links
def is_article_scanned(self, article):
#assuming that all aticle updated dae time is in GMT...this comparison can be made
epoch_article_time = mktime(article.updated_parsed)
if epoch_article_time >= CONF.last_script_run_date_time and epoch_article_time >= CONF.REPORT_START_DATE_TIME:
return False
return True
def crawl(self):
new_article_scanned = 0
old_article_scanned = 0
vip_article_found = 0
#not the start time for crawling for this sceduled run
crawl_start_time = time()
for f in list(self.rss_links):
text = open(f, "rb").read()
urls = text.split(os.linesep)
for url in urls:
feed = feedparser.parse(url)
for article in feed.entries:
# print "Working on", article.link
if not self.is_article_scanned(article):
new_article_scanned += 1
if self.vip_info.is_there_vip_news(article):
vip_article_found += 1
self.reporter.update(article)
else:
old_article_scanned += 1
#update the crawl start time in config
CONF.last_script_run_date_time = crawl_start_time
#log
print "new articles scanned:", new_article_scanned
print "old articles skipped:", old_article_scanned
print "vip articles found:", vip_article_found
开发者ID:mvrkmvrk,项目名称:scrap,代码行数:53,代码来源:crawl_news.py
示例17: test_generate
def test_generate(self):
results = self.make_results()
reporter = Reporter(bundle='git', results=results, options=None)
with NamedTemporaryFile() as json_file:
with NamedTemporaryFile() as html_file:
reporter.generate(
html_filename=html_file.name, json_filename=json_file.name)
json_content = json_file.read()
html_content = html_file.read()
json_content = json.loads(json_content)
self.assertIn('charm-proof', html_content)
self.assertEqual(json_content["bundle"]["name"], 'git')
开发者ID:NhaTrang,项目名称:cloud-weather-report,代码行数:12,代码来源:test_reporter.py
示例18: main
def main(self, handlers):
"""
This is the main handler.
It prepares the ExecGraph, ContextStack and Reporter.
TargetResolver.run is where the actual targets are executed.
"""
assert handlers, "Need at least one static target to bootstrap"
execution_graph = ExecGraph(handlers)
stack = ContextStack()
reporter = Reporter()
self.run(execution_graph, stack, reporter)
reporter.flush()
开发者ID:dotmpe,项目名称:script-mpe,代码行数:14,代码来源:libcmdng.py
示例19: __init__
def __init__(self, identity, left, right, rate, delay, size):
Reporter.__init__(self, identity)
self.left_node = left
self.right_node = right
# Need to standardize units to kbit/ms, kbits, and ms
self.capacity_kbit_per_ms = float(rate) # 1000 Kilobits in a Megabit, 1000 ms in a s
self.ms_prop_delay = float(delay) # Already standardized
self.kbits_in_each_buffer = 8.0 * float(size) # 8 = conversion from BYTE to BIT, ignore 1024 vs 1000 convention
self.left_buff = LinkBuffer(self.kbits_in_each_buffer)
self.right_buff = LinkBuffer(self.kbits_in_each_buffer)
self.bidirectional_queueing_delay_memory = [-1] * constants.QUEUEING_DELAY_WINDOW
开发者ID:T3Fei,项目名称:NetworkSimulator,代码行数:14,代码来源:link.py
示例20: report_put
def report_put():
'''
HTTP PUT to upload a data file
'''
contentType=request.get_header('Content-Type')
if contentType==None:
abort(500,'missing Content-Type')
dataTypes = contentType.split(';')
recordId=request.get_header('record-id')
reporter=Reporter()
result=reporter.report_put(dataTypes,recordId,request.body)
if 'error' in result:
abort(500,result['error'])
else:
return result
开发者ID:liuct,项目名称:bugquery-lt,代码行数:15,代码来源:api.py
注:本文中的reporter.Reporter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论