Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: gslib/file_part.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gslib/exception.py ('k') | gslib/gcs_json_api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gslib/file_part.py
===================================================================
--- gslib/file_part.py (revision 33376)
+++ gslib/file_part.py (working copy)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,18 +12,25 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+"""FilePart implementation for representing part of a file."""
+from __future__ import absolute_import
+
import os
+
class FilePart(file):
+ """Subclass of the file API for representing part of a file.
+
+ This class behaves as a contiguous subset of a given file (e.g., this object
+ will behave as though the desired part of the file was written to another
+ file, and the second file was opened).
"""
- Subclass of the file API whose only purpose it to behave as a contiguous
- subset of a given file (e.g., this object will behave as though the desired
- part of the file was written to another file, and the second file was opened).
- """
+ # pylint: disable=super-init-not-called
def __init__(self, filename, offset, length):
- """
+ """Initializes the FilePart.
+
Args:
filename: The name of the existing file, of which this object represents
a part.
@@ -39,6 +47,7 @@
def __enter__(self):
pass
+ # pylint: disable=redefined-builtin
def __exit__(self, type, value, traceback):
self.close()
@@ -48,7 +57,7 @@
def read(self, size=-1):
if size < 0:
size = self.length
- size = min(size, self._end - self._fp.tell()) # Only read to our EOF
+ size = min(size, self._end - self._fp.tell()) # Only read to our EOF
return self._fp.read(max(0, size))
def seek(self, offset, whence=os.SEEK_SET):
@@ -64,30 +73,30 @@
def flush(self, size=None):
raise NotImplementedError('flush is not implemented in FilePart.')
-
+
def fileno(self, size=None):
raise NotImplementedError('fileno is not implemented in FilePart.')
-
+
def isatty(self, size=None):
raise NotImplementedError('isatty is not implemented in FilePart.')
-
+
def next(self, size=None):
raise NotImplementedError('next is not implemented in FilePart.')
-
+
def readline(self, size=None):
raise NotImplementedError('readline is not implemented in FilePart.')
-
+
def readlines(self, size=None):
raise NotImplementedError('readlines is not implemented in FilePart.')
-
+
def xreadlines(self, size=None):
raise NotImplementedError('xreadlines is not implemented in FilePart.')
-
+
def truncate(self, size=None):
raise NotImplementedError('truncate is not implemented in FilePart.')
-
+
def write(self, size=None):
raise NotImplementedError('write is not implemented in FilePart.')
-
+
def writelines(self, size=None):
raise NotImplementedError('writelines is not implemented in FilePart.')
« no previous file with comments | « gslib/exception.py ('k') | gslib/gcs_json_api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698