~ubuntuone-control-tower/ubuntuone-storage-protocol/stable-1-6

« back to all changes in this revision

Viewing changes to ubuntuone/storageprotocol/volumes.py

  • Committer: Tarmac
  • Author(s): Rodney Dawes
  • Date: 2010-11-16 15:10:48 UTC
  • mfrom: (121.1.4 use-packages)
  • Revision ID: tarmac-20101116151048-b0e20j7lorb4yhe1
Switch to using packaged mocker and ubuntuone-dev-tools
Use pyflakes with u1lint and also run pep8
Fix a lot of pylint/pyflakes/pep8 errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from ubuntuone.storageprotocol import protocol_pb2
23
23
 
 
24
# these are valid, pylint: disable=C0103
24
25
_direction_prot2nice = {
25
26
    protocol_pb2.Shares.FROM_ME: "from_me",
26
27
    protocol_pb2.Shares.TO_ME:   "to_me",
32
33
    protocol_pb2.Shares.MODIFY: "Modify",
33
34
}
34
35
_access_nice2prot = dict((y, x) for x, y in _access_prot2nice.items())
 
36
# pylint: enable=C0103
35
37
 
36
38
 
37
39
class Volume(object):
62
64
                  self.generation == other.generation)
63
65
        return result
64
66
 
 
67
 
65
68
class ShareVolume(Volume):
66
69
    """A volume representing an accepted Share."""
67
70
 
91
94
            other_username=msg.other_username,
92
95
            other_visible_name=msg.other_visible_name,
93
96
            accepted=msg.accepted,
94
 
            access_level=_access_prot2nice[msg.access_level]
95
 
        )
 
97
            access_level=_access_prot2nice[msg.access_level])
96
98
        result = cls(**kwargs)
97
99
        return result
98
100
 
125
127
            node_id=uuid.UUID(msg.node),
126
128
            generation=msg.generation,
127
129
            free_bytes=msg.free_bytes,
128
 
            suggested_path=msg.suggested_path
129
 
        )
 
130
            suggested_path=msg.suggested_path)
130
131
        result = cls(**kwargs)
131
132
        return result
132
133