Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
don't redefine builtin functions
  • Loading branch information
mkmer committed Apr 12, 2024
1 parent c7bb530 commit 49744c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions blinkpy/blinkpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import time
import logging
import datetime
from aiofiles import ospath, open

import aiofiles
from requests.structures import CaseInsensitiveDict
from dateutil.parser import parse
from slugify import slugify
Expand Down Expand Up @@ -413,12 +412,12 @@ async def _parse_downloaded_items(self, result, camera, path, delay, debug):
filename = os.path.join(path, filename)

if not debug:
if await ospath.isfile(filename):
if await aiofiles.ospath.isfile(filename):
_LOGGER.info("%s already exists, skipping...", filename)
continue

response = await self.do_http_get(address)
async with open(filename, "wb") as vidfile:
async with aiofiles.open(filename, "wb") as vidfile:
await vidfile.write(await response.read())

_LOGGER.info("Downloaded video to %s", filename)
Expand Down
6 changes: 3 additions & 3 deletions blinkpy/helpers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import time
import secrets
import re
from aiofiles import open
from asyncio import sleep
from calendar import timegm
from functools import wraps
from getpass import getpass
import aiofiles
import dateutil.parser
from blinkpy.helpers import constants as const

Expand All @@ -21,7 +21,7 @@
async def json_load(file_name):
"""Load json credentials from file."""
try:
async with open(file_name, "r") as json_file:
async with aiofiles.open(file_name, "r") as json_file:
test = await json_file.read()
data = json.loads(test)
return data
Expand All @@ -34,7 +34,7 @@ async def json_load(file_name):

async def json_save(data, file_name):
"""Save data to file location."""
async with open(file_name, "w") as json_file:
async with aiofiles.open(file_name, "w") as json_file:
await json_file.write(json.dumps(data, indent=4))


Expand Down
4 changes: 2 additions & 2 deletions blinkpy/sync_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import datetime
import traceback
import asyncio
from aiofiles import open
import aiofiles
from sortedcontainers import SortedSet
from requests.structures import CaseInsensitiveDict
from blinkpy import api
Expand Down Expand Up @@ -732,7 +732,7 @@ async def download_video(self, blink, file_name, max_retries=4) -> bool:
url = blink.urls.base_url + self.url()
video = await api.http_get(blink, url, json=False)
if video.status == 200:
async with open(file_name, "wb") as vidfile:
async with aiofiles.open(file_name, "wb") as vidfile:
await vidfile.write(await video.read()) # download the video
return True
seconds = backoff_seconds(retry=retry, default_time=3)
Expand Down

0 comments on commit 49744c0

Please sign in to comment.