Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#101)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](pre-commit/pre-commit-hooks@v4.5.0...v4.6.0)
- [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.5.0](astral-sh/ruff-pre-commit@v0.3.5...v0.5.0)

* style: simplify code

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: yyoung <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and y-young authored Jul 3, 2024
1 parent 8794d7c commit b1ebc04
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -10,7 +10,7 @@ repos:
- id: trailing-whitespace
files: \.py$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.5.0
hooks:
- id: ruff
args: [--fix]
Expand Down
6 changes: 2 additions & 4 deletions nazurin/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ async def size(self) -> Optional[int]:
return None

async def exists(self) -> bool:
if (
return (
os.path.exists(self.path)
and (await aiofiles.os.stat(self.path)).st_size != 0
):
return True
return False
)

@network_retry
async def download(self, session: NazurinRequestSession) -> Optional[int]:
Expand Down
4 changes: 1 addition & 3 deletions nazurin/storage/googledrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ async def store(self, files: List[File]):
tasks = [self.create_folders(destination) for destination in destinations]
logger.info("Creating folders: {}", destinations)
folder_ids = await asyncio.gather(*tasks)
folders = {}
for destination, folder_id in zip(destinations, folder_ids):
folders[destination] = folder_id
folders = dict(zip(destinations, folder_ids))

tasks = [self.upload(item, folders) for item in files]
await run_in_pool(tasks, MAX_PARALLEL_UPLOAD)
Expand Down
4 changes: 1 addition & 3 deletions nazurin/storage/mega.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ async def store(self, files: List[File]):
tasks = [self.ensure_existence(destination) for destination in destinations]
logger.info("Creating folders: {}", destinations)
folder_ids = await asyncio.gather(*tasks)
folders = {}
for destination, folder_id in zip(destinations, folder_ids):
folders[destination] = folder_id
folders = dict(zip(destinations, folder_ids))

tasks = [self.upload(file, folders) for file in files]
await run_in_pool(tasks, MAX_PARALLEL_UPLOAD)
Expand Down

0 comments on commit b1ebc04

Please sign in to comment.