• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python models.Report类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中models.Report的典型用法代码示例。如果您正苦于以下问题:Python Report类的具体用法?Python Report怎么用?Python Report使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Report类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: home

def home(cell_path=None):
    import sys
    logging.info("Version python: "+sys.version);
    
    maps = memcache.get('default_maps')

    if maps:
        maps = json.loads(maps)
    else:
        maps = default_maps()
        memcache.add(key='default_maps', value=json.dumps(maps), time=60*10)

    # send only the active report
    reports = json.dumps([Report.current().as_dict()])
    report_base = json.dumps([Report.current().previous().as_dict()])
    logging.info("Reports: "+str(reports))
    logging.info("Maps: "+str(maps))
    u = get_or_create_user()
    if not u:
        abort(403)


    logout_url = users.create_logout_url('/')
    return render_template('home.html',
            reports_json=reports,
            report_base_json=report_base,
            user=u,
            maps=maps,
            polygons_table=settings.FT_TABLE_ID,
            logout_url=logout_url)
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:30,代码来源:views.py


示例2: test_parse_report

    def test_parse_report(self):

        response = '''
            {"response":[
                {"clicks":"103","money":"1000.00","day":"2010-10-08","campaign_id":123,"client_id":123,"client_name":"Ford","campaign_name":"Campaign1","ctr":"0.199","impressions":"51635"}
            ]}
            '''
        account = Account.objects.create(remote_id=1)
        Campaign.objects.create(account=account, remote_id=123, fetched=datetime.now())
        Client.objects.create(account=account, remote_id=123, fetched=datetime.now())

        instance = Report(time_from=datetime.now(), time_to=datetime.now())
        instance.parse(json.loads(response)['response'][0])
        instance.save()

        self.assertTrue(isinstance(instance.campaign, Campaign))
        self.assertEqual(instance.campaign.remote_id, 123)

        self.assertTrue(isinstance(instance.client, Client))
        self.assertEqual(instance.client.remote_id, 123)

        self.assertEqual(instance.clicks, 103)
        self.assertEqual(instance.impressions, 51635)
        self.assertEqual(instance.day, date(2010,10,8))
        self.assertEqual(instance.client_name, "Ford")
        self.assertEqual(instance.campaign_name, "Campaign1")
        self.assertEqual(instance.money, '1000.00')
        self.assertEqual(instance.ctr, '0.199')
开发者ID:wd5,项目名称:1-django-vkontakte-ads,代码行数:28,代码来源:tests.py


示例3: test_one_report

 def test_one_report(self):
   client = Client(product=ProductData.killerapp_obj, cookie='123')
   client.put()
   report = Report(product=ProductData.killerapp_obj, client=client, status=REPORT_NEW, remote_ip='127.0.0.1', data='[]')
   report.put()
 
   response = self.get('/status/')
   assert 'Queued Reports: 1' in str(response)
开发者ID:B-Rich,项目名称:crashkit,代码行数:8,代码来源:test_status.py


示例4: test_model_chart

 def test_model_chart(self):
     "Test Chart Model"
     report = Report(name='test')
     report.save()
     obj = Chart(name='test', report=report)
     obj.save()
     self.assertEquals('test', obj.name)
     self.assertNotEquals(obj.id, None)
     obj.delete()
开发者ID:tovmeod,项目名称:anaf,代码行数:9,代码来源:tests.py


示例5: testing

def testing():
    r = Report.current()
    r = Report.get(Key('ahBpbWF6b24tcHJvdG90eXBlcg4LEgZSZXBvcnQYiaECDA'))
    logging.info("report " + unicode(r))
    ee_resource = 'MOD09GA'
    ndfi = NDFI(ee_resource,
            r.comparation_range(),
            r.range())
    #return str(ndfi.mapid2())
    return str(ndfi.freeze_map(1089491, r.key().id()))
开发者ID:netconstructor,项目名称:DeforestationAnalysisTool,代码行数:10,代码来源:api.py


示例6: user_report

def user_report(request):
	'''
		report handle
	'''
	if request.method == "POST":
		rep_id = request.POST.get("rep_id","")
		rep_type = request.POST.get("rep_type","")
		reason   = request.POST.get("reason","")
		if rep_id == '' or rep_type == '' or reason == '':
			return HttpResponse(-3)
		report = Report(rep_type=int(rep_type),beReported=rep_id,reason=reason)
		report.save()
		return HttpResponse(0)
开发者ID:amituofo,项目名称:BOHOO,代码行数:13,代码来源:views.py


示例7: default_maps

def default_maps():
    maps = []
    r = Report.current() 
    logging.info("report " + unicode(r))
    landsat = EELandsat()
    ndfi = NDFI(past_month_range(r.start), r.range())

    d = landsat.mapid(*r.range())
    maps.append({'data' :d, 'info': 'LANDSAT/L7_L1T'})
    """
    d = landsat.mapid(*past_month_range(r.start))
    maps.append({'data' :d, 'info': 'LANDSAT/L7_L1T-old'})
    """
    #d = ndfi.mapid2()
    #if d: maps.append({'data' :d, 'info': 'ndfi difference'})
    d = ndfi.smaid()
    if d: maps.append({'data': d, 'info': 'SMA'})
    d = ndfi.rgb1id()
    if d: maps.append({'data': d, 'info': 'RGB'})
    d = ndfi.ndfi0id()
    if d: maps.append({'data': d, 'info': 'NDFI T0'})
    d = ndfi.ndfi1id()
    if d: maps.append({'data' :d, 'info': 'NDFI T1'})
    d = ndfi.baseline(r.base_map())
    if d: maps.append({'data' :d, 'info': 'Baseline'})
    d = ndfi.rgb0id()
    if d: maps.append({'data': d, 'info': 'Previous RGB'})
    return maps
开发者ID:Imazon,项目名称:DeforestationAnalysisTool,代码行数:28,代码来源:views.py


示例8: cancellation

    def cancellation(self):

        buy = self.buy
        reports = Report.select().where(Report.buy == buy)
        list_error = [(check_befor_update_data(report)) for report in reports]
        if list_error == [] or list_error == [[]]:
            reply = QMessageBox.question(
                self,
                "Confirmation",
                "<h3 style='color:red;'>Voulez vous" " vraiment annuler ce rapport" " d'achat?</h3>",
                QMessageBox.Yes | QMessageBox.No,
                QMessageBox.No,
            )

            if reply == QMessageBox.Yes:
                from ui.dashboard import DashbordViewWidget

                buy.deletes_data()
                self.change_main_context(DashbordViewWidget)
        else:
            QMessageBox.about(
                self,
                "Alerte",
                "<h3>Vous ne pousez pas supprimer ce rapport car:</h3>"
                "<ul><li></li>"
                " %(err)s"
                "<li>Après la suppression</li></ul>" % {"err": list_error},
            )
开发者ID:Ciwara,项目名称:GCiss,代码行数:28,代码来源:buy_show.py


示例9: home

def home(cell_path=None):
    maps = memcache.get('default_maps')
    if maps:
        maps = json.loads(maps)
    else:
        maps = default_maps()
        memcache.add(key='default_maps', value=json.dumps(maps), time=3600*24)

    # send only the active report
    reports = json.dumps([Report.current().as_dict()])
    user = users.get_current_user()
    u = User.get_user(user)
    if not u and users.is_current_user_admin():
        u = User(user=user, role='admin')
        u.put()

    if not u:
        abort(403)

    logout_url = users.create_logout_url('/')
    return render_template('home.html',
            reports_json=reports,
            user=u,
            maps=maps,
            logout_url=logout_url)
开发者ID:netconstructor,项目名称:DeforestationAnalysisTool,代码行数:25,代码来源:views.py


示例10: tiles_sensor

def tiles_sensor(sensor=None):
    tile_array = []
    if request.method == 'POST':
        return jsonify({'result': 'post method'})
    else:
        if sensor == 'modis':
            tile_array = [
                          { 'name': 'h10v09', 'value': 'h10v09'},
                          { 'name': 'h11v08', 'value': 'h11v08'},
                          { 'name': 'h11v09', 'value': 'h11v09'},
                          { 'name': 'h11v10', 'value': 'h11v10'}, 
                          { 'name': 'h12v08', 'value': 'h12v08'},
                          { 'name': 'h12v09', 'value': 'h12v09'},                       
                          { 'name': 'h12v10', 'value': 'h12v10'},
                          { 'name': 'h13v09', 'value': 'h13v09'},
                          { 'name': 'h13v10', 'value': 'h13v10'}
                        ]
            
            r = Report.current()
            start_date = r.start
            end_date = r.end
            #compounddate = '%04d%02d' % (start_date.year, start_date.month) 
            
            for i in range(len(tile_array)):
                image_picker = ImagePicker.find_by_period_and_cell(start_date, end_date, tile_array[i]['name'])
                if image_picker:
                    tile_array[i]['done'] = True
                else:
                    tile_array[i]['done'] = False
                

    return jsonify({'result': tile_array})
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:32,代码来源:views.py


示例11: popup

    def popup(self, pos):

        from ui.ligne_edit import EditLigneViewWidget
        from ui.deleteview import DeleteViewWidget
        from data_helper import check_befor_update_data
        row = self.selectionModel().selection().indexes()[0].row()
        if (len(self.data) - 1) < row:
            return False
        menu = QMenu()
        editaction = menu.addAction("Modifier cette ligne")
        delaction = menu.addAction("Supprimer cette ligne")
        action = menu.exec_(self.mapToGlobal(pos))
        report = Report.get(id=self.data[row][-1])
        if action == editaction:
            try:
                self.parent.open_dialog(EditLigneViewWidget, modal=True,
                                        table_p=self, report=report)
            except IndexError:
                pass
        if action == delaction:
            list_error = check_befor_update_data(report)
            if list_error == []:
                if len(self.data) < 2:
                    self.parent.cancellation()
                else:
                    self.parent.open_dialog(
                        DeleteViewWidget, modal=True, obj=report, table_p=self,)
            else:
                from Common.ui.util import raise_error
                raise_error(u"Impossible de supprimer", """<h3>L'article {} :</h3>
                        Aura <b>{}</b> comme dernier restant.""".format(
                    report.product.name, list_error[-1]))
开发者ID:Ciwara,项目名称:GCiss,代码行数:32,代码来源:invoice_show.py


示例12: default_maps

def default_maps():
    maps = []
    r = Report.current() 
    logging.info("report " + unicode(r))
    ee_resource = 'MOD09GA'
    landsat = EELandsat('LANDSAT/L7_L1T')
    ndfi = NDFI(ee_resource,
        past_month_range(r.start),
        r.range())

    d = landsat.mapid(*r.range())
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'LANDSAT/L7_L1T'})
    """
    d = landsat.mapid(*past_month_range(r.start))
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'LANDSAT/L7_L1T-old'})
    """
    #d = ndfi.mapid2()
    #if 'data' in d:
        #maps.append({'data' :d['data'], 'info': 'ndfi difference'})
    d = ndfi.smaid()
    if 'data' in d:
        maps.append({'data': d['data'], 'info': 'SMA'})
    d = ndfi.rgbid()
    if 'data' in d:
        maps.append({'data': d['data'], 'info': 'RGB'})
    d = ndfi.ndfi0id()
    if 'data' in d:
        maps.append({'data': d['data'], 'info': 'NDFI T0'})
    d = ndfi.ndfi1id()
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'NDFI T1'})
    return maps
开发者ID:vhlins,项目名称:DeforestationAnalysisTool,代码行数:34,代码来源:views.py


示例13: stats

def stats(table, zone=None, format="csv"):

    reports = request.args.get('reports', None)
    if not reports:
        abort(400)
    try:
        reports = map(int, reports.split(','))
    except ValueError:
        logging.error("bad format for report id")
        abort(400)

    this_report = ReportType.factory(format)
    this_report.init(zone)
    this_report.write_header()

    logging.info("table id is %s ", table)
    logging.info("and we see %s ", FustionTablesNames.all().filter('table_id =', table).fetch(1))
    logging.info("and zone %s ", zone)
    logging.info("and format %s ", format)

    reports = [Report.get_by_id(x) for x in reports]
    for r in reports:
        if not r:
            logging.error("report not found")
            abort(404)

        stats = this_report.get_stats(r, table)

        for s in stats:
            this_report.write_row(r, s, table)

    this_report.write_footer()
    return this_report.response("report_%s" % table)
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:33,代码来源:api.py


示例14: default_maps

def default_maps():
    maps = []
    r = Report.current()
    logging.info("report " + unicode(r))
    landsat = EELandsat(timestamp(r.start), datetime.datetime.now())
    ndfi = NDFI(past_month_range(r.start), r.range())

    logging.info('Past_month_range: '+str(past_month_range(r.start))+', Range: '+str(r.range)+', Timestamp: '+str(timestamp(r.start))+', Datetime: '+str(datetime.datetime.now()) )

    d = landsat.mapid(timestamp(r.start), datetime.datetime.now())
    maps.append({'data' :d, 'info': 'LANDSAT/LE7_L1T'})

    d = landsat.mapid_landsat8(timestamp(r.start), datetime.datetime.now())
    maps.append({'data':d, 'info': 'LANDSAT/LC8_L1T'})

    assetid = r.previous().as_dict().get('assetid')
    logging.info("Assetid :"+str(assetid))
    d = ndfi.smaid()
    if d: maps.append({'data': d, 'info': 'SMA'})    
    d = ndfi.rgb1id()
    if d: maps.append({'data': d, 'info': 'RGB'})
    d = ndfi.ndfi0id('modis')
    if d: maps.append({'data': d, 'info': 'NDFI T0 (MODIS)'})
    d = ndfi.ndfi1id('modis')
    if d: maps.append({'data' :d, 'info': 'NDFI T1 (MODIS)'})
    d = ndfi.baseline(r.base_map())
    if d: maps.append({'data' :d, 'info': 'Baseline'})
    d = ndfi.rgb0id()
    if d: maps.append({'data': d, 'info': 'Previous RGB'})
    return maps
    
    """
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:32,代码来源:views.py


示例15: xmlrpc_test_bulk_insert

    def xmlrpc_test_bulk_insert(self, count, same_crackers = False):
        if same_crackers and len(self._crackers) < count:
            logging.debug("Filling static crackers from {} to {}".format(len(self._crackers), count))
            for i in xrange(len(self._crackers), count):
                self._crackers.append(self.random_ip_address())

        for i in xrange(count):
            reporter = self.random_ip_address()
            if same_crackers:
                cracker_ip = self._crackers[i]
            else:
                cracker_ip = self.random_ip_address()

            logging.debug("Adding report for {} from {}".format(cracker_ip, reporter))

            yield utils.wait_and_lock_host(cracker_ip)
            
            cracker = yield Cracker.find(where=['ip_address=?', cracker_ip], limit=1)
            if cracker is None:
                now = time.time()
                cracker = Cracker(ip_address=cracker_ip, first_time=now, latest_time=now, total_reports=0, current_reports=0)
                yield cracker.save()
            yield controllers.add_report_to_cracker(cracker, reporter)
            
            utils.unlock_host(cracker_ip)
            logging.debug("Done adding report for {} from {}".format(cracker_ip,reporter))
        total = yield Cracker.count()
        total_reports = yield Report.count()
        returnValue((total,total_reports))
开发者ID:herrold,项目名称:denyhosts_sync,代码行数:29,代码来源:debug_views.py


示例16: set_data_for

 def set_data_for(self, value=None):
     products = [(Product.get(id=rpt.product_id).name) for rpt in
                 Report.select(fn.Distinct(Report.product))]
     if value:
         products = [(prod.name) for prod in Product.select().where(Product.name.contains(value))
                     .where(Product.name << products).order_by(Product.name.desc())]
     self.data = [(prd, "") for prd in products]
开发者ID:Ciwara,项目名称:GCiss,代码行数:7,代码来源:invoice.py


示例17: default_maps

def default_maps():
    maps = []
    r = Report.current()
    logging.info("report " + unicode(r))
    ee_resource = "MOD09GA"
    landsat = EELandsat("LANDSAT/L7_L1T")
    ndfi = NDFI(ee_resource, past_month_range(r.start), r.range())

    d = landsat.mapid(*r.range())
    if "data" in d:
        maps.append({"data": d["data"], "info": "LANDSAT/L7_L1T"})
    """
    d = landsat.mapid(*past_month_range(r.start))
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'LANDSAT/L7_L1T-old'})
    """
    # d = ndfi.mapid2()
    # if 'data' in d:
    # maps.append({'data' :d['data'], 'info': 'ndfi difference'})
    d = ndfi.smaid()
    if "data" in d:
        maps.append({"data": d["data"], "info": "SMA"})
    d = ndfi.rgbid()
    if "data" in d:
        maps.append({"data": d["data"], "info": "RGB"})
    d = ndfi.ndfi0id()
    if "data" in d:
        maps.append({"data": d["data"], "info": "NDFI t0"})
    d = ndfi.ndfi1id()
    if "data" in d:
        maps.append({"data": d["data"], "info": "NDFI t1"})
    return maps
开发者ID:ImazonSadGoogle,项目名称:DeforestationAnalysisTool,代码行数:32,代码来源:views.py


示例18: report_get

 def report_get(self, request):
     item = Report.get_by_id(request.id)
     current_user = users.get_current_user()
     if item and item.author == current_user.author:
         return item.to_message()
     else:
         raise endpoints.NotFoundException('Report %s not found.' %
                                           (request.id,))
开发者ID:htomika,项目名称:gaeFeedFind,代码行数:8,代码来源:parser_api.py


示例19: report

def report(request):
    if request.method == 'POST':
        errors = []
        try:
            patientId = int(request.POST.get('patientId'))
            name = request.POST.get('name')
            latitude = float(request.POST.get('latitude'))
            longitude = float(request.POST.get('longitude'))
            dt = request.POST.get('datetime')
            datetime = datetime.strptime(dt,"%Y-%m-%d %H:%M:%S")
            incomingReport = Report(patientId=patientId, name=name, \
                    latitude=latitude, longitude=longitude, datetime=datetime)
            incomingReport.save()
            return HttpResponse("Report successfully added to database")
        except ValueError:
            return HttpResponse("Report not added properly")
    else:
        raise Http404
开发者ID:Suckzoo,项目名称:ITC202,代码行数:18,代码来源:views.py


示例20: imagepicker_tile

def imagepicker_tile():    
       
    if request.method == 'POST' and request.form.get('list_cloud_percent') and request.form.get('date_start') and request.form.get('date_end'):
        

        date_start         = request.form.get('date_start')
        date_end           = request.form.get('date_end')
        date_start = datetime.datetime.strptime(date_start,"%d/%b/%Y")
        date_end = datetime.datetime.strptime(date_end,"%d/%b/%Y")
        
        list_cloud_percent = request.form.get('list_cloud_percent')
        list_cloud_percent = json.loads(list_cloud_percent)
        
        landstat = EELandsat(date_start, date_end)
        result = landstat.get_thumbs(list_cloud_percent)
                
        return jsonify({'result': result})
    elif request.method == 'POST' and request.form.get('thumbs_tile'):
        
        logging.info(request.form.get('thumbs_tile'))
        thumbs_tile = request.form.get('thumbs_tile')        
        thumbs_tile = thumbs_tile.split(',')
        
        date_start  = request.form.get('date_start')
        date_end    = request.form.get('date_end')
        date_start = datetime.datetime.strptime(date_start,"%d/%b/%Y")
        date_end = datetime.datetime.strptime(date_end,"%d/%b/%Y")
        
        result = ""
        sensor_date = {}
        
        for i in range(len(thumbs_tile)):
            date, tile, sensor = thumbs_tile[i].split('__')
            
            if tile not in sensor_date.keys():
                sensor_date[tile]                = {}
                sensor_date[tile]['location']    = Tile.find_geo_region(tile.replace("_", "/"))
                sensor_date[tile]['sensor_date'] = []
                sensor_date[tile]['sensor_date'].append(sensor+'__'+date)
            else:
                sensor_date[tile]['sensor_date'].append(sensor+'__'+date)
                
            

        report = Report.current()
        
        logging.info("===== sensor_date =====")
        logging.info(sensor_date)
        
        for key in sensor_date:
            imagePicker = ImagePicker(report=report, added_by= users.get_current_user(), cell=str(key.replace("_", "/")),  location=str(sensor_date[key]['location']), sensor_dates=sensor_date[key]['sensor_date'], start=date_start, end=date_end)
            result = result + imagePicker.save()
        
        return jsonify({'result': result})
    else:     
        return jsonify({'result': None})
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:56,代码来源:views.py



注:本文中的models.Report类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Repute类代码示例发布时间:2022-05-27
下一篇:
Python models.Record类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap