Browse Source

Cleaning up Docs

Trying to get coverage to upload to devpi and cleaning up Sphinx docs
master
Nate Bohman 4 years ago
parent
commit
f7d422919d
Signed by: Nate Bohman <natrinicle@gmail.com> GPG Key ID: C10546A54ABA1CE5
3 changed files with 24 additions and 24 deletions
  1. +1
    -0
      MANIFEST.in
  2. +2
    -0
      docs/source/conf.py
  3. +21
    -24
      shm_dict/shm_dict.py

+ 1
- 0
MANIFEST.in View File

@@ -9,6 +9,7 @@ include requirements*
include tox.ini
include docs/source/conf.py
include docs/source/coverage/extract_source.py
include docs/source/coverage/*.source.html
include docs/[mM]ake*
recursive-include . *.gitkeep
recursive-include docs/source *.rst

+ 2
- 0
docs/source/conf.py View File

@@ -221,6 +221,8 @@ epub_exclude_files = ["search.html"]
# name if not the default objects.inv
intersphinx_mapping = {
"arrow": ("https://arrow.readthedocs.io/en/latest/", None),
"py2": ("https://docs.python.org/2", None),
"py3": ("https://docs.python.org/3", None),
"python": ("https://docs.python.org/3", None),
"requests": ("http://docs.python-requests.org/en/master/", None),
"six": ("https://six.readthedocs.io/", None),

+ 21
- 24
shm_dict/shm_dict.py View File

@@ -19,6 +19,7 @@ import pickle # nosec
import sys
import threading

# Related third party imports (If you used pip/apt/yum to install)
import posix_ipc
import six

@@ -32,36 +33,32 @@ __maintainer__ = "Nate Bohman"
__email__ = "natrinicle@natrinicle.com"
__status__ = "Production"

# Get the current working directory and add it to the sys.path unless it's already in there.
CWD = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
if CWD not in sys.path:
sys.path.append(CWD)

logger = logging.getLogger(__name__) # pylint: disable=invalid-name


class SHMDict(MutableMapping):
"""Python shared memory file descriptor.

:param name: Name for shared memory and semaphore if volatile
or path to file if persistent.
:param persist: True if name is the path to a file and this
shared memory dictionary should be written
out to the file for persistence between runs
and/or processes.
:param lock_timeout: Time in seconds before giving up on
acquiring an exclusive lock to the
dictionary.
:param auto_unlock: If the lock_timeout is hit, and this
is True, automatically bypass the
lock and use the dictionary anyway.
:type name: :class:`str`
:type persist: :class:`bool`
:type lock_timeout: :class:`int` or :class:`float`
:type auto_unlock: :class:`bool`
"""
"""Python shared memory dictionary."""

def __init__(self, name, persist=False, lock_timeout=30, auto_unlock=False):
"""Standard init method.

:param name: Name for shared memory and semaphore if volatile
or path to file if persistent.
:param persist: True if name is the path to a file and this
shared memory dictionary should be written
out to the file for persistence between runs
and/or processes.
:param lock_timeout: Time in seconds before giving up on
acquiring an exclusive lock to the
dictionary.
:param auto_unlock: If the lock_timeout is hit, and this
is True, automatically bypass the
lock and use the dictionary anyway.
:type name: :class:`str`
:type persist: :class:`bool`
:type lock_timeout: :class:`int` or :class:`float`
:type auto_unlock: :class:`bool`
"""
self.name = name
self.persist_file = None
self.lock_timeout = lock_timeout

Loading…
Cancel
Save