mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Make lint happier
This commit is contained in:
@@ -26,7 +26,8 @@ class BinaryReader:
|
||||
|
||||
# region Reading
|
||||
|
||||
# "All numbers are written as little endian." |> Source: https://core.telegram.org/mtproto
|
||||
# "All numbers are written as little endian."
|
||||
# https://core.telegram.org/mtproto
|
||||
def read_byte(self):
|
||||
"""Reads a single byte value"""
|
||||
return self.read(1)[0]
|
||||
@@ -56,8 +57,7 @@ class BinaryReader:
|
||||
"""Read the given amount of bytes"""
|
||||
result = self.reader.read(length)
|
||||
if len(result) != length:
|
||||
raise BufferError(
|
||||
'Trying to read outside the data bounds (no more data left to read)')
|
||||
raise BufferError('No more data left to read')
|
||||
|
||||
return result
|
||||
|
||||
@@ -70,7 +70,9 @@ class BinaryReader:
|
||||
# region Telegram custom reading
|
||||
|
||||
def tgread_bytes(self):
|
||||
"""Reads a Telegram-encoded byte array, without the need of specifying its length"""
|
||||
"""Reads a Telegram-encoded byte array,
|
||||
without the need of specifying its length
|
||||
"""
|
||||
first_byte = self.read_byte()
|
||||
if first_byte == 254:
|
||||
length = self.read_byte() | (self.read_byte() << 8) | (
|
||||
@@ -102,7 +104,9 @@ class BinaryReader:
|
||||
raise ValueError('Invalid boolean code {}'.format(hex(value)))
|
||||
|
||||
def tgread_date(self):
|
||||
"""Reads and converts Unix time (used by Telegram) into a Python datetime object"""
|
||||
"""Reads and converts Unix time (used by Telegram)
|
||||
into a Python datetime object
|
||||
"""
|
||||
value = self.read_int()
|
||||
return None if value == 0 else datetime.fromtimestamp(value)
|
||||
|
||||
@@ -152,7 +156,9 @@ class BinaryReader:
|
||||
self.reader.seek(position)
|
||||
|
||||
def seek(self, offset):
|
||||
"""Seeks the stream position given an offset from the current position. May be negative"""
|
||||
"""Seeks the stream position given an offset from the
|
||||
current position. The offset may be negative
|
||||
"""
|
||||
self.reader.seek(offset, os.SEEK_CUR)
|
||||
|
||||
# endregion
|
||||
|
Reference in New Issue
Block a user