Skip to content

Commit 94e2095

Browse files
committed
docs
1 parent ab15ba7 commit 94e2095

File tree

7 files changed

+266
-3
lines changed

7 files changed

+266
-3
lines changed

docs/source/reference.rst

+2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ Reference
55
:maxdepth: 3
66

77
reference/base.rst
8+
reference/compress.rst
89
reference/copy.rst
910
reference/enums.rst
1011
reference/errors.rst
1112
reference/info_objects.rst
1213
reference/move.rst
1314
reference/opener.rst
1415
reference/path.rst
16+
reference/permissions.rst
1517
reference/tree.rst
1618
reference/walk.rst
1719
reference/wildcard.rst

docs/source/reference/compress.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fs.compress
2+
===========
3+
4+
.. automodule:: fs.compress
5+
:members:

docs/source/reference/permissions.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fs.permissions
2+
==============
3+
4+
.. automodule:: fs.permissions
5+
:members:

docs/source/reference/wildcard.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fs.wildcard
2+
===========
3+
4+
.. automodule:: fs.wildcard
5+
:members:

docs/tree.html

+213
Large diffs are not rendered by default.

fs/compress.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""
2+
This module can compress the contents of a filesystem.
3+
4+
Currently only the Zip format is supported.
5+
"""
6+
17
from __future__ import absolute_import
28
from __future__ import print_function
39
from __future__ import unicode_literals

fs/permissions.py

+30-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,33 @@ class Permissions(object):
3838
"""
3939
An abstraction for file system permissions.
4040
41+
:param list names: A list of permissions.
42+
:param int mode: A mode integer.
43+
:param str user: A triplet of *user* permissions, e.g. ``"rwx"`` or
44+
``"r--"``
45+
:param str group: A triplet of *group* permissions, e.g. ``"rwx"``
46+
or ``"r--"``
47+
:param str other: A triplet of *other* permissions, e.g. ``"rwx"``
48+
or ``"r--"``
49+
:param bool sticky: A boolean for the *sticky* bit.
50+
:param bool setuid: A boolean for the *setuid* bit.
51+
:param bool setguid: A boolean for the *setuid* bit.
52+
53+
Permissions objects store information regarding the permissions
54+
on a resource. It supports Linux permissions, but is generic enough
55+
to manage permission information from almost any filesystem.
56+
57+
>>> from fs.permissions import Permissions
58+
>>> p = Permissions(user='rwx', group='rw-', other='r--')
59+
>>> print(p)
60+
rwxrw-r--
61+
>>> p.mode
62+
500
63+
>>> oct(p.mode)
64+
'0764'
65+
66+
67+
4168
"""
4269

4370
_LINUX_PERMS = [
@@ -75,9 +102,9 @@ def __init__(self,
75102
}
76103
else:
77104
perms = self._perms = set()
78-
perms.update('u_' + p for p in user or '')
79-
perms.update('g_' + p for p in group or '')
80-
perms.update('o_' + p for p in other or '')
105+
perms.update('u_' + p for p in user or '' if p != '-')
106+
perms.update('g_' + p for p in group or '' if p != '-')
107+
perms.update('o_' + p for p in other or '' if p != '-')
81108

82109
if sticky:
83110
self._perms.add('sticky')

0 commit comments

Comments
 (0)