Skip to content

Commit

Permalink
remove aiofiles
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans committed Jan 7, 2025
1 parent 2cf3932 commit c93b8f5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ repos:
- --scripts-are-modules
additional_dependencies:
- aiohttp<4
- aiohttp-socks<0.10
- aiohttp-socks<0.11
- attrs
- certifi
- charset-normalizer<4
- maxminddb<3
- platformdirs<5
- rich<14
- tomli<3
- types-aiofiles
- typing-extensions<5
- uvloop<0.22; implementation_name=='cpython' and (sys_platform=='darwin' or sys_platform=='linux')
- winloop<0.1.8; implementation_name=='cpython' and (sys_platform=='cygwin' or sys_platform=='win32')
8 changes: 5 additions & 3 deletions proxy_scraper_checker/geodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import stat
from typing import TYPE_CHECKING

import aiofiles
from aiohttp import hdrs

from proxy_scraper_checker import fs
Expand Down Expand Up @@ -50,10 +49,13 @@ async def _save_geodb(
await asyncio.to_thread(
fs.add_permission, GEODB_PATH, stat.S_IWUSR, missing_ok=True
)
async with aiofiles.open(GEODB_PATH, "wb") as geodb:
geodb = await asyncio.to_thread(GEODB_PATH.open, "wb")
try:
async for chunk in response.content.iter_any():
await geodb.write(chunk)
await asyncio.to_thread(geodb.write, chunk)
progress.advance(task_id=task, advance=len(chunk))
finally:
await asyncio.to_thread(geodb.close)
progress.update(task_id=task, successful_count="\N{CHECK MARK}")


Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ requires-python = ">=3.9,<4"
classifiers = ["Private :: Do Not Upload"]
dependencies = [
"aiodns>=1.1,<4",
"aiofiles",
"aiohttp>=3.8.6,<4",
"aiohttp-socks>=0.7,<0.11",
"attrs>=22.2",
Expand All @@ -33,7 +32,6 @@ dev = [
"mypy[faster-cache]==1.14.1",
"ruff==0.8.6",
"tomli==2.2.1",
"types-aiofiles==24.1.0.20241221",
"typing-extensions==4.12.2",
]
nuitka = ["nuitka==2.5.9"]
22 changes: 0 additions & 22 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c93b8f5

Please sign in to comment.