OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """The TAR path specification implementation.""" | 2 """The TAR 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 location_path_spec | 8 from dfvfs.path import location_path_spec |
7 | 9 |
8 | 10 |
9 class TARPathSpec(location_path_spec.LocationPathSpec): | 11 class TARPathSpec(location_path_spec.LocationPathSpec): |
10 """Class that implements the TAR file path specification.""" | 12 """TAR file path specification.""" |
11 | 13 |
12 TYPE_INDICATOR = definitions.TYPE_INDICATOR_TAR | 14 TYPE_INDICATOR = definitions.TYPE_INDICATOR_TAR |
13 | 15 |
14 def __init__(self, location=None, parent=None, **kwargs): | 16 def __init__(self, location=None, parent=None, **kwargs): |
15 """Initializes the path specification. | 17 """Initializes a path specification. |
16 | 18 |
17 Note that the TAR file path specification must have a parent. | 19 Note that the TAR file path specification must have a parent. |
18 | 20 |
19 Args: | 21 Args: |
20 location (str): TAR file internal location string prefixed with a path | 22 location (str): TAR file internal location string prefixed with a path |
21 separator character. | 23 separator character. |
22 parent (Optional[PathSpec]): parent path specification. | 24 parent (Optional[PathSpec]): parent path specification. |
23 | 25 |
24 Raises: | 26 Raises: |
25 ValueError: when parent is not set. | 27 ValueError: when parent is not set. |
26 """ | 28 """ |
27 if not parent: | 29 if not parent: |
28 raise ValueError(u'Missing parent value.') | 30 raise ValueError('Missing parent value.') |
29 | 31 |
30 super(TARPathSpec, self).__init__( | 32 super(TARPathSpec, self).__init__( |
31 location=location, parent=parent, **kwargs) | 33 location=location, parent=parent, **kwargs) |
32 | 34 |
33 | 35 |
34 factory.Factory.RegisterPathSpec(TARPathSpec) | 36 factory.Factory.RegisterPathSpec(TARPathSpec) |
OLD | NEW |