Skip to content

Commit b212e2f

Browse files
committed
Replace types string with str.
Uses command: ag -l 'type ([^:]+): string' | \ xargs gsed -r -i.bak -e 's/type ([^:]+): string/type \1: str/g' Note: [-r for gsed (GNU sed) is needed for group matching](http://superuser.com/a/336819/125262).
1 parent 52c7ffd commit b212e2f

5 files changed

Lines changed: 42 additions & 42 deletions

File tree

packages/google-cloud-storage/google/cloud/storage/_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class _PropertyMixin(object):
2828
- client
2929
- path
3030
31-
:type name: string
31+
:type name: str
3232
:param name: The name of the object.
3333
"""
3434

@@ -88,7 +88,7 @@ def _patch_property(self, name, value):
8888
It **will not** reload the properties from the server. The behavior is
8989
local only and syncing occurs via :meth:`patch`.
9090
91-
:type name: string
91+
:type name: str
9292
:param name: The field name to update.
9393
9494
:type value: object

packages/google-cloud-storage/google/cloud/storage/acl.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ class _ACLEntity(object):
8585
This is a helper class that you likely won't ever construct
8686
outside of using the factor methods on the :class:`ACL` object.
8787
88-
:type entity_type: string
88+
:type entity_type: str
8989
:param entity_type: The type of entity (ie, 'group' or 'user').
9090
91-
:type identifier: string
91+
:type identifier: str
9292
:param identifier: The ID or e-mail of the entity. For the special
9393
entity types (like 'allUsers') this is optional.
9494
"""
@@ -123,15 +123,15 @@ def get_roles(self):
123123
def grant(self, role):
124124
"""Add a role to the entity.
125125
126-
:type role: string
126+
:type role: str
127127
:param role: The role to add to the entity.
128128
"""
129129
self.roles.add(role)
130130

131131
def revoke(self, role):
132132
"""Remove a role from the entity.
133133
134-
:type role: string
134+
:type role: str
135135
:param role: The role to remove from the entity.
136136
"""
137137
if role in self.roles:
@@ -298,11 +298,11 @@ def entity(self, entity_type, identifier=None):
298298
create a new one and add it to the list of known entities for
299299
this ACL.
300300
301-
:type entity_type: string
301+
:type entity_type: str
302302
:param entity_type: The type of entity to create
303303
(ie, ``user``, ``group``, etc)
304304
305-
:type identifier: string
305+
:type identifier: str
306306
:param identifier: The ID of the entity (if applicable).
307307
This can be either an ID or an e-mail address.
308308
@@ -319,7 +319,7 @@ def entity(self, entity_type, identifier=None):
319319
def user(self, identifier):
320320
"""Factory method for a user Entity.
321321
322-
:type identifier: string
322+
:type identifier: str
323323
:param identifier: An id or e-mail for this particular user.
324324
325325
:rtype: :class:`_ACLEntity`
@@ -330,7 +330,7 @@ def user(self, identifier):
330330
def group(self, identifier):
331331
"""Factory method for a group Entity.
332332
333-
:type identifier: string
333+
:type identifier: str
334334
:param identifier: An id or e-mail for this particular group.
335335
336336
:rtype: :class:`_ACLEntity`
@@ -341,7 +341,7 @@ def group(self, identifier):
341341
def domain(self, domain):
342342
"""Factory method for a domain Entity.
343343
344-
:type domain: string
344+
:type domain: str
345345
:param domain: The domain for this entity.
346346
347347
:rtype: :class:`_ACLEntity`
@@ -419,7 +419,7 @@ def _save(self, acl, predefined, client):
419419
:param acl: The ACL object to save. If left blank, this will save
420420
current entries.
421421
422-
:type predefined: string or None
422+
:type predefined: str or None
423423
:param predefined: An identifier for a predefined ACL. Must be one
424424
of the keys in :attr:`PREDEFINED_JSON_ACLS`
425425
If passed, `acl` must be None.
@@ -470,7 +470,7 @@ def save(self, acl=None, client=None):
470470
def save_predefined(self, predefined, client=None):
471471
"""Save this ACL for the current bucket using a predefined ACL.
472472
473-
:type predefined: string
473+
:type predefined: str
474474
:param predefined: An identifier for a predefined ACL. Must be one
475475
of the keys in :attr:`PREDEFINED_JSON_ACLS`
476476
or :attr:`PREDEFINED_XML_ACLS` (which will be

packages/google-cloud-storage/google/cloud/storage/blob.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
class Blob(_PropertyMixin):
5151
"""A wrapper around Cloud Storage's concept of an ``Object``.
5252
53-
:type name: string
53+
:type name: str
5454
:param name: The name of the blob. This corresponds to the
5555
unique path of the object in the bucket.
5656
@@ -109,10 +109,10 @@ def chunk_size(self, value):
109109
def path_helper(bucket_path, blob_name):
110110
"""Relative URL path for a blob.
111111
112-
:type bucket_path: string
112+
:type bucket_path: str
113113
:param bucket_path: The URL path for a bucket.
114114
115-
:type blob_name: string
115+
:type blob_name: str
116116
:param blob_name: The name of the blob.
117117
118118
:rtype: str
@@ -355,7 +355,7 @@ def download_to_file(self, file_obj, client=None):
355355
def download_to_filename(self, filename, client=None):
356356
"""Download the contents of this blob into a named file.
357357
358-
:type filename: string
358+
:type filename: str
359359
:param filename: A filename to be passed to ``open``.
360360
361361
:type client: :class:`~google.cloud.storage.client.Client` or
@@ -450,7 +450,7 @@ def upload_from_file(self, file_obj, rewind=False, size=None,
450450
:func:`os.fstat`. (If the file handle is not from the
451451
filesystem this won't be possible.)
452452
453-
:type content_type: string or ``NoneType``
453+
:type content_type: str or ``NoneType``
454454
:param content_type: Optional type of content being uploaded.
455455
456456
:type num_retries: integer
@@ -564,10 +564,10 @@ def upload_from_filename(self, filename, content_type=None, client=None):
564564
`lifecycle <https://cloud.google.com/storage/docs/lifecycle>`_
565565
API documents for details.
566566
567-
:type filename: string
567+
:type filename: str
568568
:param filename: The path to the file.
569569
570-
:type content_type: string or ``NoneType``
570+
:type content_type: str or ``NoneType``
571571
:param content_type: Optional type of content being uploaded.
572572
573573
:type client: :class:`~google.cloud.storage.client.Client` or
@@ -601,7 +601,7 @@ def upload_from_string(self, data, content_type='text/plain', client=None):
601601
:param data: The data to store in this blob. If the value is
602602
text, it will be encoded as UTF-8.
603603
604-
:type content_type: string
604+
:type content_type: str
605605
:param content_type: Optional type of content being uploaded. Defaults
606606
to ``'text/plain'``.
607607

packages/google-cloud-storage/google/cloud/storage/bucket.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Bucket(_PropertyMixin):
7474
:param client: A client which holds credentials and project configuration
7575
for the bucket (which requires a project).
7676
77-
:type name: string
77+
:type name: str
7878
:param name: The name of the bucket.
7979
"""
8080

@@ -108,7 +108,7 @@ def blob(self, blob_name, chunk_size=None, encryption_key=None):
108108
This will not make an HTTP request; it simply instantiates
109109
a blob object owned by this bucket.
110110
111-
:type blob_name: string
111+
:type blob_name: str
112112
:param blob_name: The name of the blob to be instantiated.
113113
114114
:type chunk_size: integer
@@ -190,7 +190,7 @@ def default_object_acl(self):
190190
def path_helper(bucket_name):
191191
"""Relative URL path for a bucket.
192192
193-
:type bucket_name: string
193+
:type bucket_name: str
194194
:param bucket_name: The bucket name in the path.
195195
196196
:rtype: str
@@ -219,7 +219,7 @@ def get_blob(self, blob_name, client=None):
219219
>>> print(bucket.get_blob('/does-not-exist.txt'))
220220
None
221221
222-
:type blob_name: string
222+
:type blob_name: str
223223
:param blob_name: The name of the blob to retrieve.
224224
225225
:type client: :class:`~google.cloud.storage.client.Client` or
@@ -386,7 +386,7 @@ def delete_blob(self, blob_name, client=None):
386386
... except NotFound:
387387
... pass
388388
389-
:type blob_name: string
389+
:type blob_name: str
390390
:param blob_name: A blob name to delete.
391391
392392
:type client: :class:`~google.cloud.storage.client.Client` or
@@ -452,7 +452,7 @@ def copy_blob(self, blob, destination_bucket, new_name=None,
452452
:param destination_bucket: The bucket into which the blob should be
453453
copied.
454454
455-
:type new_name: string
455+
:type new_name: str
456456
:param new_name: (optional) the new name for the copied file.
457457
458458
:type client: :class:`~google.cloud.storage.client.Client` or
@@ -494,7 +494,7 @@ def rename_blob(self, blob, new_name, client=None):
494494
:type blob: :class:`google.cloud.storage.blob.Blob`
495495
:param blob: The blob to be renamed.
496496
497-
:type new_name: string
497+
:type new_name: str
498498
:param new_name: The new name for this blob.
499499
500500
:type client: :class:`~google.cloud.storage.client.Client` or
@@ -604,10 +604,10 @@ def enable_logging(self, bucket_name, object_prefix=''):
604604
605605
See: https://cloud.google.com/storage/docs/accesslogs#delivery
606606
607-
:type bucket_name: string
607+
:type bucket_name: str
608608
:param bucket_name: name of bucket in which to store access logs
609609
610-
:type object_prefix: string
610+
:type object_prefix: str
611611
:param object_prefix: prefix for access log filenames
612612
"""
613613
info = {'logBucket': bucket_name, 'logObjectPrefix': object_prefix}
@@ -691,7 +691,7 @@ def storage_class(self, value):
691691
692692
See: https://cloud.google.com/storage/docs/storage-classes
693693
694-
:type value: string
694+
:type value: str
695695
:param value: one of "MULTI_REGIONAL", "REGIONAL", "NEARLINE",
696696
"COLDLINE", "STANDARD", or "DURABLE_REDUCED_AVAILABILITY"
697697
"""
@@ -764,12 +764,12 @@ def configure_website(self, main_page_suffix=None, not_found_page=None):
764764
the bucket, and anything else I add to the bucket. Just make it
765765
all public."
766766
767-
:type main_page_suffix: string
767+
:type main_page_suffix: str
768768
:param main_page_suffix: The page to use as the main page
769769
of a directory.
770770
Typically something like index.html.
771771
772-
:type not_found_page: string
772+
:type not_found_page: str
773773
:param not_found_page: The file to use when a page isn't found.
774774
"""
775775
data = {

packages/google-cloud-storage/google/cloud/storage/client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class Client(JSONClient):
2828
"""Client to bundle configuration needed for API requests.
2929
30-
:type project: string
30+
:type project: str
3131
:param project: the project which the client acts on behalf of. Will be
3232
passed when creating a topic. If not passed,
3333
falls back to the default inferred from the environment.
@@ -121,7 +121,7 @@ def bucket(self, bucket_name):
121121
This will not make an HTTP request; it simply instantiates
122122
a bucket object owned by this client.
123123
124-
:type bucket_name: string
124+
:type bucket_name: str
125125
:param bucket_name: The name of the bucket to be instantiated.
126126
127127
:rtype: :class:`google.cloud.storage.bucket.Bucket`
@@ -156,7 +156,7 @@ def get_bucket(self, bucket_name):
156156
157157
This implements "storage.buckets.get".
158158
159-
:type bucket_name: string
159+
:type bucket_name: str
160160
:param bucket_name: The name of the bucket to get.
161161
162162
:rtype: :class:`google.cloud.storage.bucket.Bucket`
@@ -180,7 +180,7 @@ def lookup_bucket(self, bucket_name):
180180
>>> print(bucket)
181181
<Bucket: my-bucket>
182182
183-
:type bucket_name: string
183+
:type bucket_name: str
184184
:param bucket_name: The name of the bucket to get.
185185
186186
:rtype: :class:`google.cloud.storage.bucket.Bucket`
@@ -205,7 +205,7 @@ def create_bucket(self, bucket_name):
205205
If the bucket already exists, will raise
206206
:class:`google.cloud.exceptions.Conflict`.
207207
208-
:type bucket_name: string
208+
:type bucket_name: str
209209
:param bucket_name: The bucket name to create.
210210
211211
:rtype: :class:`google.cloud.storage.bucket.Bucket`
@@ -230,20 +230,20 @@ def list_buckets(self, max_results=None, page_token=None, prefix=None,
230230
:type max_results: integer or ``NoneType``
231231
:param max_results: Optional. Maximum number of buckets to return.
232232
233-
:type page_token: string or ``NoneType``
233+
:type page_token: str or ``NoneType``
234234
:param page_token: Optional. Opaque marker for the next "page" of
235235
buckets. If not passed, will return the first page
236236
of buckets.
237237
238-
:type prefix: string or ``NoneType``
238+
:type prefix: str or ``NoneType``
239239
:param prefix: Optional. Filter results to buckets whose names begin
240240
with this prefix.
241241
242-
:type projection: string or ``NoneType``
242+
:type projection: str or ``NoneType``
243243
:param projection: If used, must be 'full' or 'noAcl'. Defaults to
244244
'noAcl'. Specifies the set of properties to return.
245245
246-
:type fields: string or ``NoneType``
246+
:type fields: str or ``NoneType``
247247
:param fields: Selector specifying which fields to include in a
248248
partial response. Must be a list of fields. For example
249249
to get a partial response with just the next page token

0 commit comments

Comments
 (0)