Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1123)

Unified Diff: dfvfs/lib/tsk_image.py

Issue 328040044: [dfvfs] Made Unicode strings the default #204 and updated docstrings #182 (Closed)
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dfvfs/lib/sqlite_database.py ('k') | dfvfs/lib/tsk_partition.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dfvfs/lib/tsk_image.py
diff --git a/dfvfs/lib/tsk_image.py b/dfvfs/lib/tsk_image.py
index 945a494cee1be8fa8bc9240c5983325e7cde8c66..bd36da17739bd2aa340f086c226295b32257e47b 100644
--- a/dfvfs/lib/tsk_image.py
+++ b/dfvfs/lib/tsk_image.py
@@ -1,24 +1,26 @@
# -*- coding: utf-8 -*-
"""Helper functions for SleuthKit (TSK) image support."""
+from __future__ import unicode_literals
+
import os
import pytsk3
class TSKFileSystemImage(pytsk3.Img_Info):
- """Class that implements a pytsk3 image object using a file-like object."""
+ """Pytsk3 image object using a file-like object."""
def __init__(self, file_object):
- """Initializes the image object.
+ """Initializes an image object.
Args:
- file_object: the file-like object (instance of FileIO).
+ file_object (FileIO): file-like object.
Raises:
ValueError: if the file-like object is invalid.
"""
if not file_object:
- raise ValueError(u'Missing file-like object.')
+ raise ValueError('Missing file-like object.')
# pytsk3.Img_Info does not let you set attributes after initialization.
self._file_object = file_object
@@ -26,7 +28,7 @@ class TSKFileSystemImage(pytsk3.Img_Info):
# of pylint complain also setting type to RAW or EXTERNAL to make sure
# Img_Info does not do detection.
tsk_img_type = getattr(
- pytsk3, u'TSK_IMG_TYPE_EXTERNAL', pytsk3.TSK_IMG_TYPE_RAW)
+ pytsk3, 'TSK_IMG_TYPE_EXTERNAL', pytsk3.TSK_IMG_TYPE_RAW)
# Note that we want url to be a binary string in Python 2 and a Unicode
# string in Python 3. Hence the string is not prefixed.
pytsk3.Img_Info.__init__(self, url='', type=tsk_img_type)
@@ -42,11 +44,11 @@ class TSKFileSystemImage(pytsk3.Img_Info):
"""Reads a byte string from the image object at the specified offset.
Args:
- offset: offset where to start reading.
- size: number of bytes to read.
+ offset (int): offset where to start reading.
+ size (int): number of bytes to read.
Returns:
- A byte string containing the data read.
+ bytes: data read.
"""
self._file_object.seek(offset, os.SEEK_SET)
return self._file_object.read(size)
« no previous file with comments | « dfvfs/lib/sqlite_database.py ('k') | dfvfs/lib/tsk_partition.py » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b