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

Unified Diff: dfvfs/path/path_spec.py

Issue 326910043: [dfvfs] Made Unicode strings the default #204 and updated docstrings #182 (Closed)
Patch Set: Made Unicode strings the default #204 and updated docstrings #182 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/path/os_path_spec.py ('k') | dfvfs/path/qcow_path_spec.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dfvfs/path/path_spec.py
diff --git a/dfvfs/path/path_spec.py b/dfvfs/path/path_spec.py
index 0eb3d06b4d4e38c7725e67b8b0c9cc7a238d51e4..09e857889cfc8240313354f14ee5c1b5440c409d 100644
--- a/dfvfs/path/path_spec.py
+++ b/dfvfs/path/path_spec.py
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
"""The Virtual File System (VFS) path specification interface."""
+from __future__ import unicode_literals
+
import abc
class PathSpec(object):
- """Class that implements the path specification interface.
+ """Path specification interface.
Attributes:
parent (PathSpec): parent path specification.
@@ -14,19 +16,19 @@ class PathSpec(object):
_IS_SYSTEM_LEVEL = False
def __init__(self, parent=None, **kwargs):
- """Initializes the path specification.
+ """Initializes a path specification.
Args:
parent (Optional[PathSpec]): parent path specification.
- kwargs: a dictionary of keyword arguments dependending on the path
- specification.
+ kwargs (dict[str, object]): keyword arguments dependending on the path
+ specification.
Raises:
ValueError: when there are unused keyword arguments.
"""
if kwargs:
- raise ValueError(u'Unused keyword arguments: {0:s}.'.format(
- u', '.join(kwargs)))
+ raise ValueError('Unused keyword arguments: {0:s}.'.format(
+ ', '.join(kwargs)))
super(PathSpec, self).__init__()
self.parent = parent
@@ -39,7 +41,7 @@ class PathSpec(object):
"""Returns the hash of a path specification."""
return hash(self.comparable)
- def _GetComparable(self, sub_comparable_string=u''):
+ def _GetComparable(self, sub_comparable_string=''):
"""Retrieves the comparable representation.
This is a convenience function for constructing comparables.
@@ -52,14 +54,14 @@ class PathSpec(object):
"""
string_parts = []
- string_parts.append(getattr(self.parent, u'comparable', u''))
- string_parts.append(u'type: {0:s}'.format(self.type_indicator))
+ string_parts.append(getattr(self.parent, 'comparable', ''))
+ string_parts.append('type: {0:s}'.format(self.type_indicator))
if sub_comparable_string:
- string_parts.append(u', {0:s}'.format(sub_comparable_string))
- string_parts.append(u'\n')
+ string_parts.append(', {0:s}'.format(sub_comparable_string))
+ string_parts.append('\n')
- return u''.join(string_parts)
+ return ''.join(string_parts)
@abc.abstractproperty
def comparable(self):
@@ -68,10 +70,10 @@ class PathSpec(object):
@property
def type_indicator(self):
"""str: type indicator."""
- type_indicator = getattr(self, u'TYPE_INDICATOR', None)
+ type_indicator = getattr(self, 'TYPE_INDICATOR', None)
if type_indicator is None:
raise NotImplementedError(
- u'Invalid path specification missing type indicator.')
+ 'Invalid path specification missing type indicator.')
return type_indicator
def CopyToDict(self):
@@ -85,7 +87,7 @@ class PathSpec(object):
if attribute_value is None:
continue
- if attribute_name == u'parent':
+ if attribute_name == 'parent':
attribute_value = attribute_value.CopyToDict()
path_spec_dict[attribute_name] = attribute_value
@@ -109,4 +111,4 @@ class PathSpec(object):
Returns:
bool: True if the path specification is at system-level.
"""
- return getattr(self, u'_IS_SYSTEM_LEVEL', False)
+ return getattr(self, '_IS_SYSTEM_LEVEL', False)
« no previous file with comments | « dfvfs/path/os_path_spec.py ('k') | dfvfs/path/qcow_path_spec.py » ('j') | no next file with comments »

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