From ab9fbc48aea5a3dc938ce2f650c9dd6c08262911 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 5 Sep 2012 10:24:10 -0400 Subject: [PATCH] MM2: Added docstrings --- python_apps/media-monitor2/media/monitor/pure.py | 16 +++++++++++++++- python_apps/pypo/recorder.py | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index 94eb5fffb..00a8b70c6 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -88,6 +88,10 @@ def is_file_supported(path): # TODO : In the future we would like a better way to find out whether a show # has been recorded def is_airtime_recorded(md): + """ + Takes a metadata dictionary and returns True if it belongs to a file that + was recorded by Airtime. + """ if not 'MDATA_KEY_CREATOR' in md: return False return md['MDATA_KEY_CREATOR'] == u'Airtime Show Recorder' @@ -456,7 +460,9 @@ def owner_id(original_path): return owner_id def file_playable(pathname): - + """ + Returns True if 'pathname' is playable by liquidsoap. False otherwise. + """ #when there is an single apostrophe inside of a string quoted by #apostrophes, we can only escape it by replace that apostrophe with '\''. #This breaks the string into two, and inserts an escaped single quote in @@ -471,6 +477,14 @@ def file_playable(pathname): return (return_code == 0) def toposort(data): + """ + Topological sort on 'data' where 'data' is of the form: + data = [ + 'one' : set('two','three'), + 'two' : set('three'), + 'three' : set() + ] + """ for k, v in data.items(): v.discard(k) # Ignore self dependencies extra_items_in_deps = reduce(set.union, data.values()) - set(data.keys()) diff --git a/python_apps/pypo/recorder.py b/python_apps/pypo/recorder.py index b2309dc2e..5b735c290 100644 --- a/python_apps/pypo/recorder.py +++ b/python_apps/pypo/recorder.py @@ -37,6 +37,8 @@ except Exception, e: print ('Error loading config file: %s', e) sys.exit() +# TODO : add docstrings everywhere in this module + def getDateTimeObj(time): # TODO : clean up for this function later. # - use tuples to parse result from split (instead of indices)