Skip to content

Commit b8b63ea

Browse files
committed
Using more descriptive entity_type instead of type_.
1 parent 63464e4 commit b8b63ea

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

gcloud/storage/acl.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ class Entity(object):
9090
outside of using the factor methods on the :class:`ACL` object.
9191
"""
9292

93-
def __init__(self, type_, identifier=None):
93+
def __init__(self, entity_type, identifier=None):
9494
"""
95-
:type type_: string
96-
:param type_: The type of entity (ie, 'group' or 'user').
95+
:type entity_type: string
96+
:param entity_type: The type of entity (ie, 'group' or 'user').
9797
9898
:type identifier: string
9999
:param identifier: The ID or e-mail of the entity.
@@ -104,7 +104,7 @@ def __init__(self, type_, identifier=None):
104104
# TODO: Add validation of types.
105105
self.identifier = identifier
106106
self.roles = set([])
107-
self.type = type_
107+
self.type = entity_type
108108

109109
def __str__(self):
110110
if not self.identifier:
@@ -219,8 +219,8 @@ def entity_from_dict(self, entity_dict):
219219
entity = self.all_authenticated()
220220

221221
elif '-' in entity:
222-
type_, identifier = entity.split('-', 1)
223-
entity = self.entity(type_=type_, identifier=identifier)
222+
entity_type, identifier = entity.split('-', 1)
223+
entity = self.entity(entity_type=entity_type, identifier=identifier)
224224

225225
if not isinstance(entity, ACL.Entity):
226226
raise ValueError('Invalid dictionary: %s' % acl_dict)
@@ -263,16 +263,17 @@ def add_entity(self, entity):
263263

264264
self.entities[str(entity)] = entity
265265

266-
def entity(self, type_, identifier=None):
266+
def entity(self, entity_type, identifier=None):
267267
"""Factory method for creating an Entity.
268268
269269
If an entity with the same type and identifier already exists,
270270
this will return a reference to that entity.
271271
If not, it will create a new one and add it to the list
272272
of known entities for this ACL.
273273
274-
:type type_: string
275-
:param type_: The type of entity to create (ie, ``user``, ``group``, etc)
274+
:type entity_type: string
275+
:param entity_type: The type of entity to create
276+
(ie, ``user``, ``group``, etc)
276277
277278
:type identifier: string
278279
:param identifier: The ID of the entity (if applicable).
@@ -282,7 +283,7 @@ def entity(self, type_, identifier=None):
282283
:returns: A new Entity or a refernece to an existing identical entity.
283284
"""
284285

285-
entity = ACL.Entity(type_=type_, identifier=identifier)
286+
entity = ACL.Entity(entity_type=entity_type, identifier=identifier)
286287
if self.has_entity(entity):
287288
entity = self.get_entity(entity)
288289
else:

0 commit comments

Comments
 (0)