summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@intel.com>2013-04-10 10:20:29 +0300
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2013-04-19 16:25:55 +0300
commit0130711d2384e59824af40f666d11bf0a52f8ee5 (patch)
treecc0624e404e1925a0150284120242ac702e9c2b7
parent820afe7f0a0becd21c7355b5b4e55278ab06ec47 (diff)
downloadmic-0130711d2384e59824af40f666d11bf0a52f8ee5.tar.gz
mic-0130711d2384e59824af40f666d11bf0a52f8ee5.tar.bz2
mic-0130711d2384e59824af40f666d11bf0a52f8ee5.zip
gpt_parse: use _ prefix for private class members
Change-Id: Iaccffd75f77bbca172d9a328a9fba42c4e25ad57 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
-rw-r--r--mic/utils/gpt_parser.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/mic/utils/gpt_parser.py b/mic/utils/gpt_parser.py
index 22fad54..2c08a16 100644
--- a/mic/utils/gpt_parser.py
+++ b/mic/utils/gpt_parser.py
@@ -88,7 +88,7 @@ class GptParser:
self.disk_path = disk_path
try:
- self.disk_obj = open(disk_path, 'rb')
+ self._disk_obj = open(disk_path, 'rb')
except IOError as err:
raise MountError("Cannot open file '%s' for reading GPT " \
"partitions: %s" % (disk_path, err))
@@ -96,7 +96,7 @@ class GptParser:
def __del__(self):
""" The class destructor. """
- self.disk_obj.close()
+ self._disk_obj.close()
def read_header(self, primary = True):
""" Read and verify the GPT header and return a tuple containing the
@@ -114,9 +114,9 @@ class GptParser:
otherwise the backup GPT header is read instead. """
# Read and validate the primary GPT header
- self.disk_obj.seek(self.sector_size)
+ self._disk_obj.seek(self.sector_size)
try:
- raw_hdr = self.disk_obj.read(struct.calcsize(_GPT_HEADER_FORMAT))
+ raw_hdr = self._disk_obj.read(struct.calcsize(_GPT_HEADER_FORMAT))
except IOError as err:
raise MountError("cannot read from file '%s': %s" % \
(self.disk_path, err))
@@ -126,9 +126,9 @@ class GptParser:
if not primary:
# Read and validate the backup GPT header
- self.disk_obj.seek(raw_hdr[6] * self.sector_size)
+ self._disk_obj.seek(raw_hdr[6] * self.sector_size)
try:
- raw_hdr = self.disk_obj.read(struct.calcsize(_GPT_HEADER_FORMAT))
+ raw_hdr = self._disk_obj.read(struct.calcsize(_GPT_HEADER_FORMAT))
except IOError as err:
raise MountError("cannot read from file '%s': %s" % \
(self.disk_path, err))
@@ -168,10 +168,10 @@ class GptParser:
entries_start = header[9] * self.sector_size
entries_count = header[10]
- self.disk_obj.seek(entries_start)
+ self._disk_obj.seek(entries_start)
for _ in xrange(0, entries_count):
- entry = self.disk_obj.read(struct.calcsize(_GPT_ENTRY_FORMAT))
+ entry = self._disk_obj.read(struct.calcsize(_GPT_ENTRY_FORMAT))
entry = struct.unpack(_GPT_ENTRY_FORMAT, entry)
if entry[2] == 0 or entry[3] == 0: