flywheel.fields.types module

Field type definitions

class flywheel.fields.types.BinaryType[source]

Bases: flywheel.fields.types.TypeDefinition

Binary strings, stored as a str

aliases = ['B', <class 'boto.dynamodb.types.Binary'>, <type 'str'>][source]
coerce(value, force)[source]
data_type[source]

alias of str

ddb_data_type = 'B'[source]
ddb_dump(value)[source]
ddb_load(value)[source]
class flywheel.fields.types.BoolType[source]

Bases: flywheel.fields.types.TypeDefinition

Booleans, backed by a Dynamo Number

coerce(value, force)[source]
data_type[source]

alias of bool

ddb_data_type = 'N'[source]
ddb_dump(value)[source]
ddb_load(value)[source]
class flywheel.fields.types.DateTimeType[source]

Bases: flywheel.fields.types.TypeDefinition

Datetimes, stored as a unix timestamp

data_type[source]

alias of datetime

ddb_data_type = 'N'[source]
ddb_dump(value)[source]
ddb_load(value)[source]
class flywheel.fields.types.DateType[source]

Bases: flywheel.fields.types.TypeDefinition

Dates, stored as timestamps

data_type[source]

alias of date

ddb_data_type = 'N'[source]
ddb_dump(value)[source]
ddb_load(value)[source]
class flywheel.fields.types.DecimalType[source]

Bases: flywheel.fields.types.TypeDefinition

Numerical values that use Decimal in the application layer.

This should be used if you want to work with floats but need the additional precision of the Decimal type.

coerce(value, force)[source]
data_type[source]

alias of Decimal

ddb_data_type = 'N'[source]
class flywheel.fields.types.DictType[source]

Bases: flywheel.fields.types.TypeDefinition

Dict types, stored as a json string

coerce(value, force)[source]
data_type[source]

alias of dict

ddb_data_type = 'S'[source]
ddb_dump(value)[source]
ddb_load(value)[source]
mutable = True[source]
class flywheel.fields.types.FloatType[source]

Bases: flywheel.fields.types.TypeDefinition

Float values

coerce(value, force)[source]
data_type[source]

alias of float

ddb_data_type = 'N'[source]
ddb_load(value)[source]
class flywheel.fields.types.IntType[source]

Bases: flywheel.fields.types.TypeDefinition

Integer values (includes longs)

coerce(value, force)[source]
data_type[source]

alias of int

ddb_data_type = 'N'[source]
ddb_load(value)[source]
class flywheel.fields.types.Key(bucket=None, name=None)[source]

Bases: boto.s3.key.Key

Subclass of boto S3 key that adds equality operators

copy_data_from_key(key)[source]

Copy the data from a boto Key

class flywheel.fields.types.ListType[source]

Bases: flywheel.fields.types.TypeDefinition

List types, stored as a json string

coerce(value, force)[source]
data_type[source]

alias of list

ddb_data_type = 'S'[source]
ddb_dump(value)[source]
ddb_load(value)[source]
mutable = True[source]
class flywheel.fields.types.NumberType[source]

Bases: flywheel.fields.types.TypeDefinition

Any kind of numerical value

coerce(value, force)[source]
data_type = 'N'[source]
ddb_data_type = 'N'[source]
ddb_load(value)[source]
class flywheel.fields.types.S3Type(bucket, scheme='default')[source]

Bases: flywheel.fields.types.TypeDefinition

Store a link to an S3 key

Parameters:

bucket : str

The name of the S3 bucket

scheme : str, optional

The name of the scheme to use to connect to S3 if the bucket is a string. (default ‘default’). See set_scheme() for more information.

SCHEMES = {'default': {}}[source]
bucket[source]

Getter for S3 bucket

coerce(value, force)[source]

S3Type will auto-coerce string types

ddb_data_type = 'S'[source]
ddb_dump(value)[source]
ddb_load(value)[source]
mutable = True[source]
classmethod set_scheme(name, **kwargs)[source]

Register a S3 connection scheme

The connection scheme is a collection of keyword arguments that will be passed to connect_s3() when creating a S3 connection.

Parameters:

name : str

The name of the scheme. If the name is ‘default’, then that scheme will be used when no scheme is explicitly passed to the constructor.

**kwargs : dict

All keyword arguments

class flywheel.fields.types.SetType(item_type=None, type_class=None)[source]

Bases: flywheel.fields.types.TypeDefinition

Set types

classmethod bind(item_type)[source]

Create a set factory that will contain a specific data type

coerce(value, force)[source]
data_type[source]

alias of set

ddb_dump(value)[source]
ddb_dump_inner(value)[source]

We need to expose this for ‘contains’ and ‘ncontains’

ddb_load(value)[source]
mutable = True[source]
class flywheel.fields.types.StringType[source]

Bases: flywheel.fields.types.TypeDefinition

String values, stored as unicode

aliases = ['S'][source]
coerce(value, force)[source]
data_type[source]

alias of unicode

ddb_data_type = 'S'[source]
class flywheel.fields.types.TypeDefinition[source]

Bases: object

Base class for all Field types

Attributes

data_type
aliases list() -> new empty list
ddb_data_type
mutable bool(x) -> bool
allowed_filters set The set of filters that can be used on this field type
aliases = [][source]
coerce(value, force)[source]

Check the type of a value and possible convert it

Parameters:

value : object

The value to check

force : bool

If True, always attempt to convert a bad type to the correct type

Returns:

value : object

A variable of the correct type

Raises:

exc : TypeError or ValueError

If the value is the incorrect type and could not be converted

data_type = None[source]
ddb_data_type = None[source]
ddb_dump(value)[source]

Dump a value to a form that can be stored in DynamoDB

ddb_dump_inner(value)[source]

If this is a set type, dump a value to the type contained in the set

ddb_load(value)[source]

Turn a value into this type from a DynamoDB value

mutable = False[source]
flywheel.fields.types.register_type(type_class, allow_in_set=True)[source]

Register a type class for use with Fields

flywheel.fields.types.set_(data_type)[source]

Create an alias for a SetType that contains this data type

Read the Docs v: 0.1.3
Versions
latest
0.1.3
0.1.2
0.1.1
0.1.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.