Skip to content

Commit 4051dcc

Browse files
committed
chore: ignore F821 for python 2 compatible code
flake8 cannot auto detect `six.PY2` branch
1 parent cd0f3b5 commit 4051dcc

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

leancloud/engine/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def sign_by_key(timestamp, key):
2121
if six.PY2:
2222

2323
def to_native(s):
24-
if isinstance(s, unicode):
24+
if isinstance(s, unicode): # noqa: F821
2525
return s.encode("utf-8")
2626
return s
2727

leancloud/file_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, name="", data=None, mime_type=None):
6565
data.seek(0, os.SEEK_SET)
6666
except Exception:
6767
if (six.PY3 and isinstance(data, (memoryview, bytes))) or (
68-
six.PY2 and isinstance(data, (buffer, memoryview, str))
68+
six.PY2 and isinstance(data, (buffer, memoryview, str)) # noqa: F821
6969
):
7070
data = io.BytesIO(data)
7171
elif data.read:

tests/test_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def fn(s):
4848

4949
fn(StringIO.StringIO(b))
5050
fn(cStringIO.StringIO(b))
51-
fn(buffer(b))
51+
fn(buffer(b)) # noqa: F821
5252

5353

5454
def test_create_with_url(): # type: () -> None

0 commit comments

Comments
 (0)