Skip to content

Commit

Permalink
docstring updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RhetTbull committed Feb 14, 2020
1 parent aed48f2 commit 510c1b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osxmetadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(self, xa: xattr.xattr):
self._load_tags()

def add(self, tag):
""" add a tag """
if not isinstance(tag, str):
raise TypeError("Tags must be strings")
self._load_tags()
Expand All @@ -95,6 +96,7 @@ def add(self, tag):
self._write_tags(*tags)

def update(self, *tags):
""" update tag list adding any new tags in *tags """
if not all(isinstance(tag, str) for tag in tags):
raise TypeError("Tags must be strings")
self._load_tags()
Expand All @@ -103,12 +105,14 @@ def update(self, *tags):
self._write_tags(*new_tags)

def clear(self):
""" clear tags (remove all tags) """
try:
self._attrs.remove(_TAGS)
except (IOError, OSError):
pass

def remove(self, tag):
""" remove a tag, raise exception if tag does not exist """
self._load_tags()
if not isinstance(tag, str):
raise TypeError("Tags must be strings")
Expand All @@ -117,6 +121,7 @@ def remove(self, tag):
self._write_tags(*tags)

def discard(self, tag):
""" remove a tag, does not raise exception if tag does not exist """
self._load_tags()
if not isinstance(tag, str):
raise TypeError("Tags must be strings")
Expand Down

0 comments on commit 510c1b0

Please sign in to comment.