mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
Fixed multiple problems related to migration to django-preferences.
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
|
||||
def first_non_null(*iterable):
|
||||
'''
|
||||
"""
|
||||
Returns the first element from the iterable which is not None.
|
||||
If all the elements are 'None', 'None' is returned.
|
||||
:param iterable: Iterable containing list of elements.
|
||||
:return: First non-null element, or None if all elements are 'None'.
|
||||
'''
|
||||
"""
|
||||
return next((item for item in iterable if item is not None), None)
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Iterable
|
||||
from typing import Iterable, Optional
|
||||
from xml.etree import ElementTree
|
||||
import re
|
||||
|
||||
@ -12,7 +12,7 @@ class SubFileParser(object):
|
||||
def probe(self, file_handle) -> bool:
|
||||
"""
|
||||
Tests if file matches file format.
|
||||
:param file: File path
|
||||
:param file_handle: File handle
|
||||
:return: True if file matches, false otherwise
|
||||
"""
|
||||
return False
|
||||
@ -20,7 +20,7 @@ class SubFileParser(object):
|
||||
def parse(self, file_handle) -> Iterable[str]:
|
||||
"""
|
||||
Parses file and returns a list of subscription URLs.
|
||||
:param file:
|
||||
:param file_handle:
|
||||
:return:
|
||||
"""
|
||||
return []
|
||||
@ -63,7 +63,7 @@ class OPMLParser(SubFileParser):
|
||||
"""
|
||||
def __init__(self):
|
||||
self.__cached_file = None
|
||||
self.__cached_tree: ElementTree.ElementTree = None
|
||||
self.__cached_tree: Optional[ElementTree.ElementTree] = None
|
||||
|
||||
def __parse(self, file_handle):
|
||||
if file_handle == self.__cached_file:
|
||||
|
@ -7,8 +7,8 @@ class YoutubeAPI(YouTube):
|
||||
|
||||
@staticmethod
|
||||
def build_public() -> 'YoutubeAPI':
|
||||
from YtManagerApp.management.appconfig import youtube_api_key
|
||||
return YoutubeAPI(key=youtube_api_key)
|
||||
from YtManagerApp.management.appconfig import appconfig
|
||||
return YoutubeAPI(key=appconfig.youtube_api_key)
|
||||
|
||||
# @staticmethod
|
||||
# def build_oauth() -> 'YoutubeAPI':
|
||||
|
Reference in New Issue
Block a user