Skip to content

Commit

Permalink
Fix Python2 var-positional arguments SyntaxError
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Feb 25, 2024
1 parent 1f9fac4 commit 705a4f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,23 @@ def get_result(self, func, *args, **kwargs):
cache_id = self._create_id_from_func(partial_func)
return self._get(cache_id)

def run(self, func, seconds, *args, _refresh=False, **kwargs):
def run(self, func, seconds, *args, **kwargs):
"""
Returns the cached data of the given function.
:param func, function to cache
:param seconds: time to live in
:param _refresh: bool, updates cache with new func result
:return:
"""
refresh = kwargs.pop('_refresh', False)
partial_func = partial(func, *args, **kwargs)

# if caching is disabled call the function
if not self._enabled:
return partial_func()

cache_id = self._create_id_from_func(partial_func)
data = None if _refresh else self._get(cache_id, seconds=seconds)
data = None if refresh else self._get(cache_id, seconds=seconds)
if data is None:
data = partial_func()
self._set(cache_id, data)
Expand Down
4 changes: 2 additions & 2 deletions resources/lib/youtube_plugin/kodion/utils/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _find_best_fit_video(_stream_data):
return selected_stream_data


def create_path(*args, is_uri=False):
def create_path(*args, **kwargs):
path = '/'.join([
part
for part in [
Expand All @@ -178,7 +178,7 @@ def create_path(*args, is_uri=False):
else:
return '/'

if is_uri:
if kwargs.get('is_uri', False):
return quote(path)
return path

Expand Down

0 comments on commit 705a4f6

Please sign in to comment.