Add type annotations to methods that take timestamp parameter

This commit is contained in:
Eugene Simonov 2023-12-29 14:56:22 +02:00
parent 6f30559a3a
commit a82eb3c3d2

View file

@ -31,6 +31,7 @@ import shelve
import ssl import ssl
import tempfile import tempfile
import time import time
from typing import Optional
import xml.dom import xml.dom
from urllib.parse import quote_plus from urllib.parse import quote_plus
from xml.dom import Node, minidom from xml.dom import Node, minidom
@ -529,16 +530,16 @@ class _Network:
def scrobble( def scrobble(
self, self,
artist, artist: str,
title, title: str,
timestamp, timestamp: int,
album=None, album: Optional[str] = None,
album_artist=None, album_artist: Optional[str] = None,
track_number=None, track_number: Optional[int] = None,
duration=None, duration: Optional[int] = None,
stream_id=None, stream_id: Optional[str] = None,
context=None, context: Optional[str] = None,
mbid=None, mbid: Optional[str] = None,
): ):
"""Used to add a track-play to a user's profile. """Used to add a track-play to a user's profile.
@ -547,7 +548,7 @@ class _Network:
title (Required) : The track name. title (Required) : The track name.
timestamp (Required) : The time the track started playing, in UNIX timestamp (Required) : The time the track started playing, in UNIX
timestamp format (integer number of seconds since 00:00:00, timestamp format (integer number of seconds since 00:00:00,
January 1st 1970 UTC). This must be in the UTC time zone. January 1st 1970 UTC).
album (Optional) : The album name. album (Optional) : The album name.
album_artist (Optional) : The album artist - if this differs from album_artist (Optional) : The album artist - if this differs from
the track artist. the track artist.
@ -2295,8 +2296,8 @@ class User(_Chartable):
self, self,
limit: int = 10, limit: int = 10,
cacheable: bool = True, cacheable: bool = True,
time_from=None, time_from: Optional[int] = None,
time_to=None, time_to: Optional[int] = None,
stream: bool = False, stream: bool = False,
now_playing: bool = False, now_playing: bool = False,
): ):
@ -2308,12 +2309,10 @@ class User(_Chartable):
limit : If None, it will try to pull all the available data. limit : If None, it will try to pull all the available data.
from (Optional) : Beginning timestamp of a range - only display from (Optional) : Beginning timestamp of a range - only display
scrobbles after this time, in UNIX timestamp format (integer scrobbles after this time, in UNIX timestamp format (integer
number of seconds since 00:00:00, January 1st 1970 UTC). This number of seconds since 00:00:00, January 1st 1970 UTC).
must be in the UTC time zone.
to (Optional) : End timestamp of a range - only display scrobbles to (Optional) : End timestamp of a range - only display scrobbles
before this time, in UNIX timestamp format (integer number of before this time, in UNIX timestamp format (integer number of
seconds since 00:00:00, January 1st 1970 UTC). This must be in seconds since 00:00:00, January 1st 1970 UTC).
the UTC time zone.
stream: If True, it will yield tracks as soon as a page has been retrieved. stream: If True, it will yield tracks as soon as a page has been retrieved.
This method uses caching. Enable caching only if you're pulling a This method uses caching. Enable caching only if you're pulling a