OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """The VHD image path specification implementation.""" | 2 """The VHD image path specification implementation.""" |
3 | 3 |
| 4 from __future__ import unicode_literals |
| 5 |
4 from dfvfs.lib import definitions | 6 from dfvfs.lib import definitions |
5 from dfvfs.path import factory | 7 from dfvfs.path import factory |
6 from dfvfs.path import path_spec | 8 from dfvfs.path import path_spec |
7 | 9 |
8 | 10 |
9 class VHDIPathSpec(path_spec.PathSpec): | 11 class VHDIPathSpec(path_spec.PathSpec): |
10 """Class that implements the VHD image path specification.""" | 12 """VHD image path specification.""" |
11 | 13 |
12 TYPE_INDICATOR = definitions.TYPE_INDICATOR_VHDI | 14 TYPE_INDICATOR = definitions.TYPE_INDICATOR_VHDI |
13 | 15 |
14 def __init__(self, parent=None, **kwargs): | 16 def __init__(self, parent=None, **kwargs): |
15 """Initializes the path specification. | 17 """Initializes a path specification. |
16 | 18 |
17 Note that the VHDI file path specification must have a parent. | 19 Note that the VHDI file path specification must have a parent. |
18 | 20 |
19 Args: | 21 Args: |
20 parent (Optional[PathSpec]): parent path specification. | 22 parent (Optional[PathSpec]): parent path specification. |
21 | 23 |
22 Raises: | 24 Raises: |
23 ValueError: when parent is not set. | 25 ValueError: when parent is not set. |
24 """ | 26 """ |
25 if not parent: | 27 if not parent: |
26 raise ValueError(u'Missing parent value.') | 28 raise ValueError('Missing parent value.') |
27 | 29 |
28 super(VHDIPathSpec, self).__init__(parent=parent, **kwargs) | 30 super(VHDIPathSpec, self).__init__(parent=parent, **kwargs) |
29 | 31 |
30 @property | 32 @property |
31 def comparable(self): | 33 def comparable(self): |
32 """str: comparable representation of the path specification.""" | 34 """str: comparable representation of the path specification.""" |
33 return self._GetComparable() | 35 return self._GetComparable() |
34 | 36 |
35 | 37 |
36 factory.Factory.RegisterPathSpec(VHDIPathSpec) | 38 factory.Factory.RegisterPathSpec(VHDIPathSpec) |
OLD | NEW |