コード例 #1
0
ファイル: operation.py プロジェクト: NYStud/veles
class OperationSetBinData(Operation):
    object_type = 'set_bindata'

    key = fields.String()
    start = fields.SmallUnsignedInteger(default=0)
    data = fields.Binary()
    truncate = fields.Boolean(default=False)
コード例 #2
0
ファイル: check.py プロジェクト: yuttasakcom/veles
class CheckBinData(Check):
    object_type = 'bindata'

    node = fields.NodeID()
    key = fields.String()
    start = fields.SmallUnsignedInteger()
    end = fields.SmallUnsignedInteger(optional=True)
    data = fields.Binary()
コード例 #3
0
ファイル: messages.py プロジェクト: yuttasakcom/veles
class MsgGetBinDataReply(MsgpackMsg):
    """
    Sent by server in reply to MsgGetBinData.
    """

    object_type = 'get_bindata_reply'

    qid = fields.SmallUnsignedInteger()
    data = fields.Binary()
コード例 #4
0
ファイル: operation.py プロジェクト: NYStud/veles
class OperationCreate(Operation):
    object_type = 'create'

    parent = fields.NodeID(default=NodeID.root_id)
    pos_start = fields.Integer(optional=True)
    pos_end = fields.Integer(optional=True)
    tags = fields.Set(fields.String())
    attr = fields.Map(fields.String(), fields.Any())
    data = fields.Map(fields.String(), fields.Any())
    bindata = fields.Map(fields.String(), fields.Binary())
    triggers = fields.Set(fields.String())
コード例 #5
0
 def test_binary(self):
     a = fields.Binary()
     a.validate(b'abcd')
     with self.assertRaises(SchemaError):
         a.validate('abcd')
     with self.assertRaises(SchemaError):
         a.validate(1234)
     self.assertEqual(a.dump(b'abcd'), b'abcd')
     self.assertEqual(a.load(b'abcd'), b'abcd')
     with self.assertRaises(SchemaError):
         a.load('abcd')
     with self.assertRaises(SchemaError):
         a.load(1234)
コード例 #6
0
ファイル: messages.py プロジェクト: yuttasakcom/veles
class MsgSetBinData(MsgpackMsg):
    """
    Sets a range of bindata on a given node.  Server replies with MsgRequestAck
    or MsgRequestError.  The bindata is modified starting from a given start
    position - it is an error if the position is after the current end of
    bindata (but not if it's equal).  The bindata is expanded if necessary
    to hold the new data.  If truncate is set, the bindata is truncated
    after the end of the new data.  If bindata would become 0-length,
    it is deleted.
    """

    object_type = 'set_bindata'

    rid = fields.SmallUnsignedInteger()
    id = fields.NodeID()
    key = fields.String()
    start = fields.SmallUnsignedInteger(default=0)
    data = fields.Binary()
    truncate = fields.Boolean(default=False)
コード例 #7
0
ファイル: messages.py プロジェクト: yuttasakcom/veles
class MsgCreate(MsgpackMsg):
    """
    Creates a node on the server.  It is an error if a node with given id
    already exists.  Server replies with MsgRequestAck or MsgRequestError.
    Replies are matched to requests by ``rid``, which is assigned by the
    client.
    """

    object_type = 'create'

    rid = fields.SmallUnsignedInteger()
    id = fields.NodeID()
    parent = fields.NodeID(default=NodeID.root_id)
    pos_start = fields.Integer(optional=True)
    pos_end = fields.Integer(optional=True)
    tags = fields.Set(fields.String())
    attr = fields.Map(fields.String(), fields.Any())
    data = fields.Map(fields.String(), fields.Any())
    bindata = fields.Map(fields.String(), fields.Binary())
    triggers = fields.Set(fields.String())
コード例 #8
0
class BinaryOptional(model.Model):
    a = fields.Binary(optional=True)
コード例 #9
0
class Binary(model.Model):
    a = fields.Binary()
コード例 #10
0
class SubType2(BaseModel):
    object_type = 'sub2'

    b = fields.Binary()
コード例 #11
0
ファイル: test_polymodel.py プロジェクト: yuttasakcom/veles
class TurboZlew(Zlew):
    object_type = 'turbozlew'
    dopalacz = fields.Binary()
コード例 #12
0
ファイル: test_model.py プロジェクト: yuttasakcom/veles
class TurboZlew(Zlew):
    c = fields.Set(fields.Binary())
    d = fields.Object(Piwo)
    e = fields.Integer(default=3)