コード例 #1
0
class SampleEntity(Entity):
    string_field = StringField()
    string_field_w_default = StringField('default')
    integer_field = IntField()
    integer_field_w_default = IntField(42)
    enum_field = EnumField(ChooseOne)
    enum_field_w_default = EnumField(ChooseOne, ChooseOne.B)
    list_field = ListField(string_types, ['alpha', 'beta', 'gamma'])
コード例 #2
0
class DerivedSampleEntity(SampleEntity):
    string_field_w_default = StringField('new_default')
    choice = EnumField(ChooseOne, required=False)
    new_field = IntField()
    enum_field = ChooseOne.A

    def __init__(self, new_field, **kwargs):
        super(DerivedSampleEntity, self).__init__(new_field=new_field,
                                                  **kwargs)
コード例 #3
0
    def test_unassigned_name_throws_error(self):
        field = IntField()
        with ExpectedException(AttributeError):
            field.name

        class Clazz(object):
            int_field = IntField()

        clazz = Clazz()
        with ExpectedException(AttributeError):
            clazz.int_field
コード例 #4
0
ファイル: __init__.py プロジェクト: kalefranz/conda-env2
class PackageSpec(Entity):
    """
    pyside-1.1.2-py27_1
    zlib-1.2.7-1
    """
    channel = StringField()
    name = StringField()
    version = StringField()
    build = StringField()
    build_number = IntField()
    platform = EnumField(Platform)
    arch = EnumField(Arch)
コード例 #5
0
 class Clazz(Entity):
     int_field = IntField(required=False, nullable=True)
コード例 #6
0
 class Clazz(Entity):
     int_field = IntField('18')
コード例 #7
0
 class Clazz(object):
     int_field = IntField()
コード例 #8
0
ファイル: __init__.py プロジェクト: kalefranz/conda-env2
class Patch(Entity):
    filename = StringField()
    url = StringField()
    patch_level = IntField(default=0)