Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] next-pylint April 25 #39839

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ def read_utf8(self):
try:
return input_bytes.decode('utf-8')
except UnicodeDecodeError as exn:
logger.error('Invalid UTF-8 input bytes: %r', input_bytes)
logger.error('Invalid UTF-8 input bytes: %r', input_bytes) # pylint: disable=do-not-log-raised-errors
raise exn
else:
# PY2
return unicode(input_bytes, "utf-8") # pylint: disable=undefined-variable
return unicode(input_bytes, "utf-8") # pylint: disable=undefined-variable

def skip_null(self):
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def read_utf8(self):
try:
return input_bytes.decode('utf-8')
except UnicodeDecodeError as exn:
logger.error('Invalid UTF-8 input bytes: %r', input_bytes)
logger.error('Invalid UTF-8 input bytes: %r', input_bytes) # pylint: disable=do-not-log-raised-errors
raise exn
else:
# PY2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------------------------------------
# pylint: disable=invalid-overridden-method

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import logging
import random
from typing import Any, Dict, TYPE_CHECKING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ def validate_and_format_range_headers(
return range_header, range_validation


def add_metadata_headers(metadata=None):
# type: (Optional[Dict[str, str]]) -> Dict[str, str]
def add_metadata_headers(metadata: Optional[Dict[str, str]] = None) -> Dict[str, str]:
headers = {}
if metadata:
for key, value in metadata.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
# license information.
# --------------------------------------------------------------------------

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import inspect
import threading
from asyncio import Lock
from io import UnsupportedOperation
from itertools import islice
from math import ceil
Expand Down Expand Up @@ -165,7 +164,7 @@ def __init__(

# Progress feedback
self.progress_total = 0
self.progress_lock = Lock() if parallel else None
self.progress_lock = asyncio.Lock() if parallel else None
self.progress_hook = progress_hook

# Encryption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# pylint: disable=invalid-overridden-method
# mypy: disable-error-code=override

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import codecs
import sys
import warnings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------------------------------------
# pylint: disable=invalid-overridden-method

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import logging
import random
from typing import Any, Dict, TYPE_CHECKING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ def validate_and_format_range_headers(
return range_header, range_validation


def add_metadata_headers(metadata=None):
# type: (Optional[Dict[str, str]]) -> Dict[str, str]
def add_metadata_headers(metadata: Optional[Dict[str, str]] = None) -> Dict[str, str]:
headers = {}
if metadata:
for key, value in metadata.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
# license information.
# --------------------------------------------------------------------------

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import inspect
import threading
from asyncio import Lock
from io import UnsupportedOperation
from itertools import islice
from math import ceil
Expand Down Expand Up @@ -165,7 +164,7 @@ def __init__(

# Progress feedback
self.progress_total = 0
self.progress_lock = Lock() if parallel else None
self.progress_lock = asyncio.Lock() if parallel else None
self.progress_hook = progress_hook

# Encryption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# pylint: disable=invalid-overridden-method
# mypy: disable-error-code=override

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import sys
import warnings
from io import BytesIO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typing import (Any, Dict)
from typing import Any, Dict

_SUPPORTED_API_VERSIONS = [
'2019-02-02',
Expand Down Expand Up @@ -31,8 +31,7 @@
]


def get_api_version(kwargs):
# type: (Dict[str, Any]) -> str
def get_api_version(kwargs: Dict[str, Any]) -> str:
api_version = kwargs.get('api_version', None)
if api_version and api_version not in _SUPPORTED_API_VERSIONS:
versions = '\n'.join(_SUPPORTED_API_VERSIONS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------------------------------------
# pylint: disable=invalid-overridden-method

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import logging
import random
from typing import Any, Dict, TYPE_CHECKING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ def validate_and_format_range_headers(
return range_header, range_validation


def add_metadata_headers(metadata=None):
# type: (Optional[Dict[str, str]]) -> Dict[str, str]
def add_metadata_headers(metadata: Optional[Dict[str, str]] = None) -> Dict[str, str]:
headers = {}
if metadata:
for key, value in metadata.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
# license information.
# --------------------------------------------------------------------------

import asyncio
import asyncio # pylint: disable=do-not-import-asyncio
import inspect
import threading
from asyncio import Lock
from io import UnsupportedOperation
from itertools import islice
from math import ceil
Expand Down Expand Up @@ -165,7 +164,7 @@ def __init__(

# Progress feedback
self.progress_total = 0
self.progress_lock = Lock() if parallel else None
self.progress_lock = asyncio.Lock() if parallel else None
self.progress_hook = progress_hook

# Encryption
Expand Down