Ejemplo n.º 1
0
class ISegment(IItem):
    metadata("id_strava")
    index_field("id_strava", type="text")
    id_strava = schema.TextLine(title="Strava id")

    metadata("name")
    index_field("name", type="text")
    name = schema.TextLine(title="Name")

    metadata("type_activity")
    index_field("type_activity", type="text")
    type_activity = schema.TextLine(title="Type")  # Pass to vocabulary

    metadata("distance")
    index_field("distance", type="float")
    distance = schema.Int(title="Distance")

    average_grade = schema.Float(title="Average grade")
    maximum_grade = schema.Float(title="Maximum grade")
    elevation_high = schema.Float(title="Elevation high")
    elevation_low = schema.Float(title="Elevation loc")
    climb_category = schema.Int(title="Climb category")
    city = schema.TextLine(title="City")
    state = schema.TextLine(title="State")
    country = schema.TextLine(title="Country")
Ejemplo n.º 2
0
class IFile(Interface):

    metadata('extension', 'md5', 'content_type', 'filename')

    index('content_type', type='text')
    content_type = schema.BytesLine(
        title=u'Content Type',
        description=u'The content type identifies the type of data.',
        default=b'',
        required=False)

    index('filename', type='text')
    filename = schema.TextLine(title=u'Filename', required=False, default=None)

    data = schema.Bytes(
        title=u'Data',
        description=u'The actual content.',
        required=False,
    )

    index('extension', type='text')
    extension = schema.TextLine(title='Extension of the file', default='')

    index('md5', type='text')
    md5 = schema.TextLine(title='MD5', default='')

    size = schema.Int(title='Size', default=0)

    def get_size():
        """Return the byte-size of the data of the object."""
Ejemplo n.º 3
0
class IExample(IResource):

    metadata("categories")

    index_field("boolean_field", type="boolean")
    boolean_field = schema.Bool(required=False)

    index_field("categories", field_mapping=CATEGORIES_MAPPING)
    categories = schema.List(title="categories",
                             default=[],
                             value_type=schema.JSONField(title="term",
                                                         schema=TERM_SCHEMA))

    textline_field = schema.TextLine(title="kk",
                                     widget="testing",
                                     required=False)
    text_field = schema.Text(required=False)
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine(),
                             required=False)
    datetime = schema.Datetime(required=False)
    jsonfield_value = schema.JSONField(schema={"type": "array"},
                                       required=False)
    write_permission(write_protected="example.MyPermission")
    write_protected = schema.TextLine(title="Write protected field",
                                      required=False)

    default_factory_test = schema.Text(defaultFactory=lambda: "foobar")

    context_default_factory_test = schema.Text(
        defaultFactory=ContextDefaultFactory())
Ejemplo n.º 4
0
class IExample(IResource):

    metadata('categories')

    index_field('boolean_field', type='boolean')
    boolean_field = schema.Bool(required=False)

    index_field('categories', field_mapping=CATEGORIES_MAPPING)
    categories = schema.List(title='categories',
                             default=[],
                             value_type=schema.JSONField(title='term',
                                                         schema=TERM_SCHEMA))

    textline_field = schema.TextLine(title='kk',
                                     widget='testing',
                                     required=False)
    text_field = schema.Text(required=False)
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine(),
                             required=False)
    datetime = schema.Datetime(required=False)

    write_permission(write_protected='example.MyPermission')
    write_protected = schema.TextLine(
        title='Write protected field',
        required=False,
    )

    default_factory_test = schema.Text(defaultFactory=lambda: 'foobar')

    context_default_factory_test = schema.Text(
        defaultFactory=ContextDefaultFactory())
Ejemplo n.º 5
0
class IExample(IResource):

    metadata('categories')

    index('categories', type='nested')
    categories = List(title='categories',
                      default=[],
                      value_type=JSONField(title='term', schema=TERM_SCHEMA))
Ejemplo n.º 6
0
class IExample(IResource):

    metadata('categories')

    index('categories', type='nested')
    categories = schema.List(title='categories',
                             default=[],
                             value_type=schema.JSONField(title='term',
                                                         schema=TERM_SCHEMA))

    textline_field = schema.TextLine()
    text_field = schema.Text()
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine())
    datetime = schema.Datetime()
Ejemplo n.º 7
0
class IExample(IResource):

    metadata('categories')

    index_field('categories', type='nested')
    categories = schema.List(title='categories',
                             default=[],
                             value_type=schema.JSONField(title='term',
                                                         schema=TERM_SCHEMA))

    textline_field = schema.TextLine(title='kk',
                                     widget='testing',
                                     required=False)
    text_field = schema.Text(required=False)
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine(),
                             required=False)
    datetime = schema.Datetime(required=False)
Ejemplo n.º 8
0
class IActivity(IFolder):

    metadata("id_strava")
    index_field("id_strava", type="text")
    id_strava = schema.TextLine(title="Strava id")

    metadata("name")
    index_field("name", type="text")
    name = schema.TextLine(title="Name")

    metadata("distance")
    index_field("distance", type="float")
    distance = schema.Int(title="Distance")

    metadata("moving_time")
    index_field("moving_time", type="int")
    moving_time = schema.Int(title="Moving time")

    elapsed_time = schema.Int(title="Elapsed time")

    metadata("total_elevation_gain")
    index_field("total_elevation_gain", type="int")
    total_elevation_gain = schema.Int(title="Total elevation gain")

    metadata("type_activity")
    index_field("type_activity", type="text")
    type_activity = schema.TextLine(title="Type")  # Pass to vocabulary

    metadata("start_date")
    index_field("start_date", type="date")
    start_date = schema.Datetime(title="Start date")

    start_date_local = schema.Datetime(title="Start date local")
    timezone = schema.TextLine(title="Timezone")
    utc_offset = schema.Int(title="Utc offset")

    metadata("average_speed")
    index_field("average_speed", type="float")
    average_speed = schema.Float(title="Averge speed")

    metadata("max_speed")
    index_field("max_speed", type="float")
    max_speed = schema.Float(title="Max speed")

    metadata("average_cadence")
    index_field("average_cadence", type="float")
    average_cadence = schema.Float(title="Average cadence")

    metadata("average_watts")
    index_field("average_watts", type="float")
    average_watts = schema.Float(title="Average watts")

    metadata("weighted_average_watts")
    index_field("weighted_average_watts", type="float")
    weighted_average_watts = schema.Float(title="Weighted average watts")

    metadata("kilojoules")
    index_field("kilojoules", type="float")
    kilojoules = schema.Float(title="Kilojoules")

    metadata("device_watts")
    index_field("device_watts", type="boolean")
    device_watts = schema.Bool(title="Device watts")

    metadata("max_watts")
    index_field("max_watts", type="float")
    max_watts = schema.Float(title="Max watts")

    metadata("average_heartrate")
    index_field("average_heartrate", type="float")
    average_heartrate = schema.Float(title="Average heartrate")

    metadata("max_heartrate")
    index_field("max_heartrate", type="int")
    max_heartrate = schema.Int(title="Max heartrate")

    elev_high = schema.Float(title="Elev high")
    elev_low = schema.Float(title="Elev low")
    calories = schema.Float(title="Calories")
Ejemplo n.º 9
0
class ISegmentEffort(IItem):

    metadata("id_strava")
    index_field("id_strava", type="text")
    id_strava = schema.TextLine(title="Strava id")

    metadata("name")
    index_field("name", type="text")
    name = schema.TextLine(title="Name")

    metadata("activity")
    index_field("activity", type="text")
    activity = schema.TextLine(title="Activity")

    metadata("segment")
    index_field("segment", type="text")
    segment = schema.TextLine(title="Segment")

    metadata("elapsed_time")
    index_field("elapsed_time", type="int")
    elapsed_time = schema.Int(title="Elapsed time")

    metadata("moving_time")
    index_field("moving_time", type="int")
    moving_time = schema.Int(title="Moving time")

    metadata("start_date")
    index_field("start_date", type="date")
    start_date = schema.Datetime(title="Start date")

    metadata("start_date_local")
    index_field("start_date_local", type="date")
    start_date_local = schema.Datetime(title="Start date local")

    metadata("distance")
    index_field("distance", type="float")
    distance = schema.Float(title="Distance")

    start_index = schema.Float(title="Start index")
    end_index = schema.Float(title="End index")

    metadata("average_cadence")
    index_field("average_cadence", type="float")
    average_cadence = schema.Float(title="Average cadence")

    metadata("average_heartrate")
    index_field("average_heartrate", type="float")
    average_heartrate = schema.Float(title="Average heartrate")

    metadata("max_heartrate")
    index_field("max_heartrate", type="int")
    max_heartrate = schema.Int(title="Max heartrate")

    metadata("device_watts")
    index_field("device_watts", type="boolean")
    device_watts = schema.Bool(title="Device watts")

    metadata("average_watts")
    index_field("average_watts", type="float")
    average_watts = schema.Float(title="Average watts")