Skip to content

Commit

Permalink
#1, #3: Added docstrings to _path_to_id().
Browse files Browse the repository at this point in the history
  • Loading branch information
Bystroushaak committed Oct 6, 2014
1 parent a56a66d commit 58f4d37
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/edeposit/amqp/ltp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ def _get_localized_fn(path, root_dir):


def _path_to_id(path):
"""
Name of the root directory is used as ``<packageid>`` in ``info.xml``.
This function makes sure, that :func:`os.path.basename` doesn't return
blank string in case that there is `/` at the end of the `path`.
Args:
path (str): Path to the root directory.
Returns:
str: Basename of the `path`.
"""
if path.endswith("/"):
path = path[:-1]

Expand Down

0 comments on commit 58f4d37

Please sign in to comment.