Merge branch 'LonamiWebs:master' into master

This commit is contained in:
Anonymous 2021-05-15 11:08:43 +05:30
commit 6c3e2bc0a1
3 changed files with 6 additions and 5 deletions

View File

@ -370,7 +370,7 @@ class DialogMethods:
await client.edit_folder(dialogs, [0, 1]) await client.edit_folder(dialogs, [0, 1])
# Un-archiving all dialogs # Un-archiving all dialogs
await client.archive(unpack=1) await client.edit_folder(unpack=1)
""" """
if (entity is None) == (unpack is None): if (entity is None) == (unpack is None):
raise ValueError('You can only set either entities or unpack, not both') raise ValueError('You can only set either entities or unpack, not both')

View File

@ -142,12 +142,12 @@ class _DirectDownloadIter(RequestIter):
class _GenericDownloadIter(_DirectDownloadIter): class _GenericDownloadIter(_DirectDownloadIter):
async def _load_next_chunk(self, mask=MIN_CHUNK_SIZE - 1): async def _load_next_chunk(self):
# 1. Fetch enough for one chunk # 1. Fetch enough for one chunk
data = b'' data = b''
# 1.1. ``bad`` is how much into the data we have we need to offset # 1.1. ``bad`` is how much into the data we have we need to offset
bad = self.request.offset & mask bad = self.request.offset % self.request.limit
before = self.request.offset before = self.request.offset
# 1.2. We have to fetch from a valid offset, so remove that bad part # 1.2. We have to fetch from a valid offset, so remove that bad part
@ -702,7 +702,8 @@ class DownloadMethods:
if chunk_size == request_size \ if chunk_size == request_size \
and offset % MIN_CHUNK_SIZE == 0 \ and offset % MIN_CHUNK_SIZE == 0 \
and stride % MIN_CHUNK_SIZE == 0: and stride % MIN_CHUNK_SIZE == 0 \
and offset % limit == 0:
cls = _DirectDownloadIter cls = _DirectDownloadIter
self._log[__name__].info('Starting direct file download in chunks of ' self._log[__name__].info('Starting direct file download in chunks of '
'%d at %d, stride %d', request_size, offset, stride) '%d at %d, stride %d', request_size, offset, stride)

View File

@ -44,7 +44,7 @@ class SenderGetter(abc.ABC):
# in which case we want to force fetch the entire thing because # in which case we want to force fetch the entire thing because
# the user explicitly called a method. If the user is okay with # the user explicitly called a method. If the user is okay with
# cached information, they may use the property instead. # cached information, they may use the property instead.
if (self._sender is None or self._sender.min) \ if (self._sender is None or getattr(self._sender, 'min', None)) \
and await self.get_input_sender(): and await self.get_input_sender():
try: try:
self._sender =\ self._sender =\