Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Nov 19, 2016
1 parent ab15ba7 commit 94e2095
Show file tree
Hide file tree
Showing 7 changed files with 266 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ Reference
:maxdepth: 3

reference/base.rst
reference/compress.rst
reference/copy.rst
reference/enums.rst
reference/errors.rst
reference/info_objects.rst
reference/move.rst
reference/opener.rst
reference/path.rst
reference/permissions.rst
reference/tree.rst
reference/walk.rst
reference/wildcard.rst
5 changes: 5 additions & 0 deletions docs/source/reference/compress.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fs.compress
===========

.. automodule:: fs.compress
:members:
5 changes: 5 additions & 0 deletions docs/source/reference/permissions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fs.permissions
==============

.. automodule:: fs.permissions
:members:
5 changes: 5 additions & 0 deletions docs/source/reference/wildcard.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fs.wildcard
===========

.. automodule:: fs.wildcard
:members:
213 changes: 213 additions & 0 deletions docs/tree.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions fs/compress.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
This module can compress the contents of a filesystem.
Currently only the Zip format is supported.
"""

from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
Expand Down
33 changes: 30 additions & 3 deletions fs/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,33 @@ class Permissions(object):
"""
An abstraction for file system permissions.
:param list names: A list of permissions.
:param int mode: A mode integer.
:param str user: A triplet of *user* permissions, e.g. ``"rwx"`` or
``"r--"``
:param str group: A triplet of *group* permissions, e.g. ``"rwx"``
or ``"r--"``
:param str other: A triplet of *other* permissions, e.g. ``"rwx"``
or ``"r--"``
:param bool sticky: A boolean for the *sticky* bit.
:param bool setuid: A boolean for the *setuid* bit.
:param bool setguid: A boolean for the *setuid* bit.
Permissions objects store information regarding the permissions
on a resource. It supports Linux permissions, but is generic enough
to manage permission information from almost any filesystem.
>>> from fs.permissions import Permissions
>>> p = Permissions(user='rwx', group='rw-', other='r--')
>>> print(p)
rwxrw-r--
>>> p.mode
500
>>> oct(p.mode)
'0764'
"""

_LINUX_PERMS = [
Expand Down Expand Up @@ -75,9 +102,9 @@ def __init__(self,
}
else:
perms = self._perms = set()
perms.update('u_' + p for p in user or '')
perms.update('g_' + p for p in group or '')
perms.update('o_' + p for p in other or '')
perms.update('u_' + p for p in user or '' if p != '-')
perms.update('g_' + p for p in group or '' if p != '-')
perms.update('o_' + p for p in other or '' if p != '-')

if sticky:
self._perms.add('sticky')
Expand Down

0 comments on commit 94e2095

Please sign in to comment.