Add comments about generator functions

This commit is contained in:
Roman Miroshnychenko 2016-12-15 14:12:10 +02:00
parent 8c73b186be
commit 0508d92475
1 changed files with 9 additions and 1 deletions

10
main.py
View File

@ -75,22 +75,30 @@ def get_url(**kwargs):
def get_categories():
"""
Get the list of video categories.
Here you can insert some parsing code that retrieves
the list of video categories (e.g. 'Movies', 'TV-shows', 'Documentaries' etc.)
from some site or server.
.. note:: Consider using `generator functions <https://wiki.python.org/moin/Generators>`_
instead of returning lists.
:return: The list of video categories
:rtype: list
"""
return VIDEOS.keys()
return VIDEOS.iterkeys()
def get_videos(category):
"""
Get the list of videofiles/streams.
Here you can insert some parsing code that retrieves
the list of video streams in the given category from some site or server.
.. note:: Consider using `generators functions <https://wiki.python.org/moin/Generators>`_
instead of returning lists.
:param category: Category name
:type category: str
:return: the list of videos in the category