当前位置: 首页>>代码示例>>Python>>正文


Python fields.Integer方法代码示例

本文整理汇总了Python中flask_restful.fields.Integer方法的典型用法代码示例。如果您正苦于以下问题:Python fields.Integer方法的具体用法?Python fields.Integer怎么用?Python fields.Integer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_restful.fields的用法示例。


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

示例1: __init__

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def __init__(self, **kwargs):
        self.restapi = kwargs['restapi']
        self.server = kwargs['server']
        self.fields = {
            'host': fields.String,
            'eui': fields.Integer,
            'name': fields.String,
            'enabled': fields.Boolean,
            'power': fields.Integer,
            'created': fields.DateTime(dt_format='iso8601'),
            'updated': fields.DateTime(dt_format='iso8601')
        }
        self.parser = reqparse.RequestParser(bundle_errors=True)
        self.parser.add_argument('host', type=str)
        self.parser.add_argument('eui', type=int)
        self.parser.add_argument('name', type=str)
        self.parser.add_argument('enabled', type=inputs.boolean)
        self.parser.add_argument('power', type=int)
        self.args = self.parser.parse_args() 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:21,代码来源:gateway.py

示例2: __init__

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def __init__(self, **kwargs):
        self.restapi = kwargs['restapi']
        self.server = kwargs['server']
        self.fields = {
            'appif': fields.Integer,
            'name': fields.String,
        }
        self.parser = reqparse.RequestParser(bundle_errors=True)
        self.parser.add_argument('type', type=str)
        self.parser.add_argument('name', type=str)
        self.parser.add_argument('file', type=str)
        self.parser.add_argument('protocol', type=str)
        self.parser.add_argument('iothost', type=str)
        self.parser.add_argument('keyname', type=str)
        self.parser.add_argument('keyvalue', type=str)
        self.parser.add_argument('pollinterval', type=int)
        self.args = self.parser.parse_args() 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:19,代码来源:appinterface.py

示例3: get

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def get(self):
        """Method to get all application interfaces"""
        try:
            interfaces = interfaceManager.getAllInterfaces()
            if interfaces is None:
                returnValue({})
            marshal_fields = {
                'type': fields.String(attribute='__class__.__name__'),
                'id': fields.Integer(attribute='appinterface.id'),
                'name': fields.String
            }
            data = {}
            for i,interface in enumerate(interfaces):
                data[i] = marshal(interface, marshal_fields)
            returnValue(data)
            yield
            
        except TimeoutError:
            log.error("REST API timeout retrieving application interfaces") 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:21,代码来源:appinterface.py

示例4: marshal

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def marshal(self):
        """Get REST API marshalled fields as an orderedDict
        
        Returns:
            OrderedDict of fields defined by marshal_fields
        """
        marshal_fields = {
            'type': fields.String(attribute='__class__.__name__'),
            'id': fields.Integer(attribute='appinterface.id'),
            'name': fields.String,
            'iothost': fields.String,
            'keyname': fields.String,
            'keyvalue': fields.String,
            'started': fields.Boolean,
        }
        return marshal(self, marshal_fields) 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:18,代码来源:azure_iot_mqtt.py

示例5: marshal

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def marshal(self):
        """Get REST API marshalled fields as an orderedDict
        
        Returns:
            OrderedDict of fields defined by marshal_fields
        """
        marshal_fields = {
            'type': fields.String(attribute='__class__.__name__'),
            'id': fields.Integer(attribute='appinterface.id'),
            'name': fields.String,
            'iothost': fields.String,
            'keyname': fields.String,
            'keyvalue': fields.String,
            'poll_interval': fields.Integer,
            'started': fields.Boolean,
        }
        return marshal(self, marshal_fields) 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:19,代码来源:azure_iot_https.py

示例6: to_json

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def to_json(self,
                model,
                model_fields=None,
                meta=None,
                status_code=HTTP_STATUS_CODE_OK):
        """Create json response from a database models.

        Args:
            model: Instance of a timesketch database model
            model_fields: Dictionary describing the resulting schema
            meta: Dictionary holding any metadata for the result
            status_code: Integer used as status_code in the response

        Returns:
            Response in json format (instance of flask.wrappers.Response)
        """
        if not meta:
            meta = dict()

        schema = {'meta': meta, 'objects': []}

        if model:
            if not model_fields:
                try:
                    model_fields = self.fields_registry[model.__tablename__]
                except AttributeError:
                    model_fields = self.fields_registry[model[0].__tablename__]
            schema['objects'] = [marshal(model, model_fields)]

        response = jsonify(schema)
        response.status_code = status_code
        return response 
开发者ID:google,项目名称:timesketch,代码行数:34,代码来源:__init__.py

示例7: __init__

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def __init__(self, **kwargs):
        self.restapi = kwargs['restapi']
        self.server = kwargs['server']
        self.fields = {
            'name': fields.String,
            'listen': fields.String,
            'port': fields.Integer,
            'webport': fields.Integer,
            'apitoken': fields.String,
            'freqband': fields.String,
            'netid': fields.Integer,
            'duplicateperiod': fields.Integer,
            'fcrelaxed': fields.Boolean,
            'otaastart': fields.Integer,
            'otaaend':  fields.Integer,
            'macqueueing': fields.Boolean,
            'macqueuelimit': fields.Integer,
            'adrenable': fields.Boolean,
            'adrmargin': fields.Float,
            'adrcycletime': fields.Integer,
            'adrmessagetime': fields.Integer,
        }
        self.parser = reqparse.RequestParser(bundle_errors=True)
        self.parser.add_argument('name', type=str)
        self.parser.add_argument('listen', type=str)
        self.parser.add_argument('port', type=int)
        self.parser.add_argument('webport', type=int)
        self.parser.add_argument('apitoken', type=str)
        self.parser.add_argument('freqband', type=str)
        self.parser.add_argument('netid', type=int)
        self.parser.add_argument('duplicateperiod', type=int)
        self.parser.add_argument('fcrelaxed', type=bool)
        self.parser.add_argument('otaastart', type=int)
        self.parser.add_argument('otaaend', type=int)
        self.parser.add_argument('macqueuing', type=bool)
        self.parser.add_argument('macqueuelimit', type=int)
        self.parser.add_argument('adrenable', type=bool)
        self.parser.add_argument('adrmargin', type=float)
        self.parser.add_argument('adrcycletime', type=int)
        self.parser.add_argument('adrmessagetime', type=int)
        self.args = self.parser.parse_args() 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:43,代码来源:system.py

示例8: __init__

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def __init__(self, **kwargs):
        self.restapi = kwargs['restapi']
        self.server = kwargs['server']
        self.fields = {
            'deveui': fields.Integer,
            'name': fields.String,
            'devclass': fields.String,
            'enabled': fields.Boolean,
            'otaa': fields.Boolean,
            'devaddr': fields.Integer,
            'appeui': fields.Integer,
            'appskey': fields.Integer,
            'nwkskey': fields.Integer,
            'tx_datr': fields.String,
            'snr_average': fields.Float,
            'appname': fields.String,
            'latitude': fields.Float,
            'longitude': fields.Float,
            'created': fields.DateTime(dt_format='iso8601'),
            'updated': fields.DateTime(dt_format='iso8601')
        }
        self.parser = reqparse.RequestParser(bundle_errors=True)
        self.parser.add_argument('deveui', type=int)
        self.parser.add_argument('name', type=str)
        self.parser.add_argument('devclass', type=str)
        self.parser.add_argument('enabled', type=inputs.boolean)
        self.parser.add_argument('otaa', type=inputs.boolean)
        self.parser.add_argument('devaddr', type=int)
        self.parser.add_argument('appeui', type=int)
        self.parser.add_argument('nwkskey', type=int)
        self.parser.add_argument('appskey', type=int)
        self.parser.add_argument('appname', type=str)
        self.parser.add_argument('latitude', type=float)
        self.parser.add_argument('longitude', type=float)
        self.args = self.parser.parse_args() 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:37,代码来源:device.py

示例9: __init__

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def __init__(self, **kwargs):
        self.restapi = kwargs['restapi']
        self.server = kwargs['server']
        self.fields = {
            'appeui': fields.Integer,
            'name': fields.String,
            'domain': fields.String,
            'appnonce': fields.Integer,
            'appkey': fields.Integer,
            'fport': fields.Integer,
            'appinterface_id': fields.Integer,
            'properties': {},
            'created': fields.DateTime(dt_format='iso8601'),
            'updated': fields.DateTime(dt_format='iso8601')
        }
        self.pfields = {
            'port': fields.Integer,
            'name': fields.String,
            'type': fields.String,
            'created': fields.DateTime(dt_format='iso8601'),
            'updated': fields.DateTime(dt_format='iso8601')
        }
        self.parser = reqparse.RequestParser(bundle_errors=True)
        self.parser.add_argument('appeui', type=int)
        self.parser.add_argument('name', type=str)
        self.parser.add_argument('domain', type=str)
        self.parser.add_argument('appnonce', type=int)
        self.parser.add_argument('appkey', type=int)
        self.parser.add_argument('fport', type=int)
        self.parser.add_argument('interface', type=int)
        self.args = self.parser.parse_args() 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:33,代码来源:application.py

示例10: marshal

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def marshal(self):
        """Get REST API marshalled fields as an orderedDict
        
        Returns:
            OrderedDict of fields defined by marshal_fields
        """
        marshal_fields = {
            'type': fields.String(attribute='__class__.__name__'),
            'id': fields.Integer(attribute='appinterface.id'),
            'name': fields.String,
            'started': fields.Boolean
        }
        return marshal(self, marshal_fields) 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:15,代码来源:reflector.py

示例11: marshal

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def marshal(self):
        """Get REST API marshalled fields as an orderedDict
        
        Returns:
            OrderedDict of fields defined by marshal_fields
        """
        marshal_fields = {
            'type': fields.String(attribute='__class__.__name__'),
            'id': fields.Integer(attribute='appinterface.id'),
            'name': fields.String,
            'file': fields.String,
            'started': fields.Boolean
        }
        return marshal(self, marshal_fields) 
开发者ID:Fluent-networks,项目名称:floranet,代码行数:16,代码来源:file_text_store.py

示例12: listen_to_web

# 需要导入模块: from flask_restful import fields [as 别名]
# 或者: from flask_restful.fields import Integer [as 别名]
def listen_to_web(args, max_positions, task, process_batch):
    # initialize web app
    app = Flask(__name__, static_folder='')
    api = Api(app)

    # register route for web server

    # a simple form page
    @app.route('/form')
    def form():
        input = request.args.get('input', '')
        inputs = [input]
        results, outputs = process_inputs(args, inputs, max_positions, task, process_batch)
        return render_template('form.html', input=input, outputs=outputs)

    # a dynamic web app with static resource
    @app.route('/')
    def index():
        return render_template('index.html')

    @app.route('/static/<path:path>')
    def send_static(path):
        return send_from_directory('templates/static', path)

    # a JSON api
    resource_fields = {
        'iteration': fields.Integer,
        'src_str': fields.String, 'hypo_str': fields.String,
        'hypo_score': fields.Float, 'pos_scores': fields.Float, 'gleu_scores': fields.Float,
        'fluency_scores': fields.Float, 'alignments': fields.Float,
        'hypo_score_str': fields.String, 'pos_scores_str': fields.String, 'gleu_scores_str': fields.String,
        'fluency_scores_str': fields.String,  'alignments_str': fields.String
    }
    class API(Resource):
        @marshal_with(resource_fields)
        def get(self, input):
            inputs = [input]
            results, outputs = process_inputs(args, inputs, max_positions, task, process_batch)
            # return outputs # raw string outputs
            return results # json

    # register routes for API
    api.add_resource(API, '/api/<string:input>')

    # listen with web server
    print('server running at port: {}'.format(args.port))
    http_server = WSGIServer(('', args.port), app)
    http_server.serve_forever() 
开发者ID:rgcottrell,项目名称:pytorch-human-performance-gec,代码行数:50,代码来源:interactive.py


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