Browse Source

docs and type annotation fixes

Cheskel Twersky 4 years ago
parent
commit
bedfbf0880
4 changed files with 13 additions and 14 deletions
  1. 1 1
      README.md
  2. 2 3
      docs/conf.py
  3. 1 1
      docs/index.rst
  4. 9 9
      list_youtube_channel/get_channel.py

+ 1 - 1
README.md

@@ -1,5 +1,5 @@
 # List Yuotube channel
 # List Yuotube channel
-This module was originally made to get a list of all the videos from a Yuotube channle, but was then extended to include some other functionality.
+This module was originally made to get a list of all the videos from a Youtube channel, but was then extended to include some other functionality.
 
 
 With this module you can:
 With this module you can:
 
 

+ 2 - 3
docs/conf.py

@@ -2,7 +2,7 @@
 import os
 import os
 import sys
 import sys
 sys.path.insert(0, os.path.abspath('../'))
 sys.path.insert(0, os.path.abspath('../'))
-
+from list_youtube_channel import __version__ as release
 
 
 
 
 project = 'List youtube channel'
 project = 'List youtube channel'
@@ -20,5 +20,4 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
 
 
 
 
 
 
-html_theme = "sphinx_rtd_theme"
-
+html_theme = 'sphinx_rtd_theme'

+ 1 - 1
docs/index.rst

@@ -1,7 +1,7 @@
 
 
 Welcome to List youtube channel's documentation!
 Welcome to List youtube channel's documentation!
 ================================================
 ================================================
-This module was originally made to get a list of all the videos from a Yuotube channle, but was then extended to include some other functionality.
+This module was originally made to get a list of all the videos from a Youtube channel, but was then extended to include some other functionality.
 
 
 With this module you can:
 With this module you can:
 
 

+ 9 - 9
list_youtube_channel/get_channel.py

@@ -4,7 +4,7 @@ import json
 import time
 import time
 
 
 
 
-def get_channel(channel_id: str, limit: int = None, sleep: int = 1, sort_by: str = 'newest') -> Generator:
+def get_channel(channel_id: str, limit: int = None, sleep: int = 1, sort_by: str = 'newest') -> Generator[dict, None, None]:
     """Get videos for a channel.
     """Get videos for a channel.
 
 
     Parameters:
     Parameters:
@@ -34,7 +34,7 @@ def get_channel(channel_id: str, limit: int = None, sleep: int = 1, sort_by: str
         yield video
         yield video
 
 
 
 
-def get_playlist(playlist_id: str, limit: int = None, sleep: int = 1):
+def get_playlist(playlist_id: str, limit: int = None, sleep: int = 1) -> Generator[dict, None, None]:
     """Get videos for a playlist.
     """Get videos for a playlist.
 
 
     Parameters:
     Parameters:
@@ -53,7 +53,7 @@ def get_playlist(playlist_id: str, limit: int = None, sleep: int = 1):
         yield video
         yield video
 
 
 
 
-def get_search(query: str, limit: int = None, sleep: int = 1, sort_by: str = 'relevance', results_type: str = 'video') -> Generator:
+def get_search(query: str, limit: int = None, sleep: int = 1, sort_by: str = 'relevance', results_type: str = 'video') -> Generator[dict, None, None]:
     """Search youtube and get videos.
     """Search youtube and get videos.
 
 
     Parameters:
     Parameters:
@@ -71,9 +71,9 @@ def get_search(query: str, limit: int = None, sleep: int = 1, sort_by: str = 're
             ``"rating"``: Get videos with more likes first.
             ``"rating"``: Get videos with more likes first.
             Defaults to ``"relevance"``.
             Defaults to ``"relevance"``.
         results_type (``str``, *optional*):
         results_type (``str``, *optional*):
-            What type you want to search for. Pass one of the following values.
-            ``"video"``|``"channel"``|``"playlist"``|``"movie"``
-            Defaults to `"video"`.
+            What type you want to search for. Pass one of the following values:
+            ``"video"|"channel"|"playlist"|"movie"``.
+            Defaults to ``"video"``.
     """
     """
 
 
     sort_by_map = {
     sort_by_map = {
@@ -98,7 +98,7 @@ def get_search(query: str, limit: int = None, sleep: int = 1, sort_by: str = 're
         yield video
         yield video
 
 
 
 
-def get_videos(url: str, api_endpoint: str, selector: str, limit: int, sleep: int) -> Generator:
+def get_videos(url: str, api_endpoint: str, selector: str, limit: int, sleep: int) -> Generator[dict, None, None]:
     session = requests.Session()
     session = requests.Session()
     session.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36'
     session.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36'
     is_first = True
     is_first = True
@@ -168,7 +168,7 @@ def get_next_data(data: dict) -> dict:
     return next_data
     return next_data
 
 
 
 
-def search_dict(partial: dict, search_key: str) -> Generator:
+def search_dict(partial: dict, search_key: str) -> Generator[dict, None, None]:
     stack = [partial]
     stack = [partial]
     while stack:
     while stack:
         current_item = stack.pop(0)
         current_item = stack.pop(0)
@@ -183,5 +183,5 @@ def search_dict(partial: dict, search_key: str) -> Generator:
                 stack.append(value)
                 stack.append(value)
 
 
 
 
-def get_videos_items(data: dict, selector: str) -> Generator:
+def get_videos_items(data: dict, selector: str) -> Generator[dict, None, None]:
     return search_dict(data, selector)
     return search_dict(data, selector)