Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Nov 20, 2016
1 parent c47f209 commit 96f3059
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
27 changes: 24 additions & 3 deletions fs/_repr.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
"""
Tools to generate __repr__ strings
"""

from __future__ import unicode_literals

def make_repr(class_name, *args, **kwargs):
"""Generate a repr string."""
"""
Generate a repr string.
Positional arguments should be the positional arguments used to
construct the class. Keyword arguments should consist of tuples of
the attribute value and default. If the value is the default, then
it won't be rendered in the output.
Here's an example::
def __repr__(self):
return make_repr('MyClass', 'foo', name=(self.name, None))
The output of this would be something line ``MyClass('foo',
name='Will')``.
"""
arguments = [repr(arg) for arg in args]
arguments.extend([
"{}={!r}".format(name, value)
for name, (value, default) in kwargs.items()
for name, (value, default) in sorted(kwargs.items())
if value != default
])
return "{}({})".format(class_name, ', '.join(arguments))
return "{}({})".format(class_name, ', '.join(arguments))
3 changes: 1 addition & 2 deletions fs/appfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ class UserConfigFS(_AppFS):
:param str version: Optional version string, if a unique location
per version of the application is required.
:param bool roaming: If ``True``, use a *roaming* profile on
Windows, see http://technet.microsoft.com/en-
us/library/cc766489(WS.10).aspx
Windows.
:param bool create: If ``True`` (the default) the directory will
be created if it does not exist.
Expand Down
2 changes: 1 addition & 1 deletion fs/osfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _make_details_from_stat(cls, stat_result):
'accessed': stat_result.st_atime,
'modified': stat_result.st_mtime,
'size': stat_result.st_size,
'type': int(cls._get_type_from_stat(stat))
'type': int(cls._get_type_from_stat(stat_result))
}
if hasattr(stat, 'st_birthtime'):
details['created'] = stat_result.st_birthtime
Expand Down

0 comments on commit 96f3059

Please sign in to comment.