當前位置: 首頁>>代碼示例>>Python>>正文


Python ndb.FloatProperty方法代碼示例

本文整理匯總了Python中google.appengine.ext.ndb.FloatProperty方法的典型用法代碼示例。如果您正苦於以下問題:Python ndb.FloatProperty方法的具體用法?Python ndb.FloatProperty怎麽用?Python ndb.FloatProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在google.appengine.ext.ndb的用法示例。


在下文中一共展示了ndb.FloatProperty方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: convert_FloatProperty

# 需要導入模塊: from google.appengine.ext import ndb [as 別名]
# 或者: from google.appengine.ext.ndb import FloatProperty [as 別名]
def convert_FloatProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.FloatProperty``."""
        return f.FloatField(**kwargs) 
開發者ID:jpush,項目名稱:jbox,代碼行數:5,代碼來源:ndb.py

示例2: testFloatProperty_shouldConvertToString

# 需要導入模塊: from google.appengine.ext import ndb [as 別名]
# 或者: from google.appengine.ext.ndb import FloatProperty [as 別名]
def testFloatProperty_shouldConvertToString(self):
        self.__assert_conversion(ndb.FloatProperty, graphene.Float) 
開發者ID:graphql-python,項目名稱:graphene-gae,代碼行數:4,代碼來源:test_converter.py

示例3: parse_property

# 需要導入模塊: from google.appengine.ext import ndb [as 別名]
# 或者: from google.appengine.ext.ndb import FloatProperty [as 別名]
def parse_property(p):
    name, type_alias = p.split(':')
    types = {'string': 'ndb.StringProperty(required=True)',
             'date': 'ndb.DateProperty(required=True)',
             'datetime': 'ndb.DateTimeProperty(required=True)',
             'int': 'ndb.IntegerProperty(required=True)',
             'float': 'ndb.FloatProperty(required=True)',
             'decimal': 'property.SimpleDecimal(required=True)',
             'currency': 'property.SimpleCurrency(required=True)',
             'bool': 'ndb.BooleanProperty(required=True)'}
    return '    %s = %s' % (name, types[type_alias]) 
開發者ID:renzon,項目名稱:tekton,代碼行數:13,代碼來源:manager.py

示例4: _to_default_model_value

# 需要導入模塊: from google.appengine.ext import ndb [as 別名]
# 或者: from google.appengine.ext.ndb import FloatProperty [as 別名]
def _to_default_model_value(descriptor, name, index):
    if isinstance(descriptor, (StringProperty, TextProperty)):
        return "'%s_string'" % name
    if isinstance(descriptor, DateProperty):
        return "date(2014, 1, %s)" % (index + 1)
    if isinstance(descriptor, DateTimeProperty):
        return "datetime(2014, 1, 1, 1, %s, 0)" % (index + 1)
    if isinstance(descriptor, (SimpleCurrency, SimpleDecimal)):
        return "Decimal('1.%s')" % (index + 1 if index >= 9 else '0%s' % (index + 1))
    if isinstance(descriptor, IntegerProperty):
        return "%s" % (index + 1)
    if isinstance(descriptor, FloatProperty):
        return "1.%s" % (index + 1)
    if isinstance(descriptor, BooleanProperty):
        return "True" 
開發者ID:renzon,項目名稱:tekton,代碼行數:17,代碼來源:manager.py

示例5: _to_default_reques_value

# 需要導入模塊: from google.appengine.ext import ndb [as 別名]
# 或者: from google.appengine.ext.ndb import FloatProperty [as 別名]
def _to_default_reques_value(descriptor, name, index):
    if isinstance(descriptor, (StringProperty, TextProperty)):
        return "'%s_string'" % name
    if isinstance(descriptor, DateProperty):
        return "'1/%s/2014'" % (index + 1)
    if isinstance(descriptor, DateTimeProperty):
        return "'1/1/2014 01:%s:0'" % (index + 1)
    if isinstance(descriptor, (SimpleCurrency, SimpleDecimal)):
        return "'1.%s'" % (index + 1 if index >= 9 else '0%s' % (index + 1))
    if isinstance(descriptor, IntegerProperty):
        return "'%s'" % (index + 1)
    if isinstance(descriptor, FloatProperty):
        return "'1.%s'" % (index + 1)
    if isinstance(descriptor, BooleanProperty):
        return "'True'" 
開發者ID:renzon,項目名稱:tekton,代碼行數:17,代碼來源:manager.py

示例6: test_simple_properties

# 需要導入模塊: from google.appengine.ext import ndb [as 別名]
# 或者: from google.appengine.ext.ndb import FloatProperty [as 別名]
def test_simple_properties(self):
    """Simple properties are unmodified in to_serializable_dict()."""
    class Entity(ndb.Model, serializable.SerializableModelMixin):
      blob_prop = ndb.BlobProperty()
      bool_prop = ndb.BooleanProperty()
      float_prop = ndb.FloatProperty()
      int_prop = ndb.IntegerProperty()
      json_prop = ndb.JsonProperty()
      pickle_prop = ndb.PickleProperty()
      str_prop = ndb.StringProperty()
      text_prop = ndb.TextProperty()

    # Test data in simple dict form.
    as_serializable_dict = {
      'blob_prop': 'blob',
      'bool_prop': True,
      'float_prop': 3.14,
      'int_prop': 42,
      'json_prop': ['a list', 'why', 'not?'],
      'pickle_prop': {'some': 'dict'},
      'str_prop': 'blah-blah',
      'text_prop': 'longer blah-blah',
    }

    # Same data but in entity form. Constructing entity directly from
    # |as_serializable_dict| works only if it contains only simple properties
    # (that look the same in serializable dict and entity form).
    as_entity = Entity(**as_serializable_dict)

    # Ensure all simple properties (from _SIMPLE_PROPERTIES) are covered.
    self.assertEqual(
        set(serializable._SIMPLE_PROPERTIES),
        set(prop.__class__ for prop in Entity._properties.values()))

    # Check entity -> serializable dict conversion.
    self.assertEqual(
        as_serializable_dict,
        as_entity.to_serializable_dict())

    # Check serializable dict -> Entity conversion.
    self.assertEqual(
        as_entity,
        Entity.from_serializable_dict(as_serializable_dict)) 
開發者ID:luci,項目名稱:luci-py,代碼行數:45,代碼來源:serializable_test.py


注:本文中的google.appengine.ext.ndb.FloatProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。