-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 py3 mypy #9
base: master
Are you sure you want to change the base?
9 py3 mypy #9
Conversation
Signed-off-by: Stephen Cheng <stephen.cheng@cloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "str", variable has type "List[str]") [assignment]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
No overload variant of "getitem" of "list" matches argument type "str" [call-overload]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
No overload variant of "getitem" of "list" matches argument type "str" [call-overload]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
No overload variant of "getitem" of "list" matches argument type "str" [call-overload]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in string interpolation (expression has type "Optional[Any]", placeholder has type "Union[int, float, SupportsFloat]") [str-format]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add # type: igngore[str-format] to ignore this warning in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Statement is unreachable [unreachable]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Non-overlapping equality check (left operand type: "bytes", right operand type: "Literal['refresh']") [comparison-overlap]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Non-overlapping equality check (left operand type: "bytes", right operand type: "Literal['debug_mem']") [comparison-overlap]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
If x = b'abc' then "%s" % x produces "b'abc'", not "abc". If this is desired behavior use "%r" % x. Otherwise, decode the bytes [str-bytes-safe]
@@ -380,7 +380,7 @@ def get_percent_mem_usage(ignored): | |||
memlist = memfd.readlines() | |||
memfd.close() | |||
memdict = [ m.split(':', 1) for m in memlist ] | |||
memdict = dict([(k.strip(), float(re.search('\d+', v.strip()).group(0))) for (k,v) in memdict]) | |||
memdict = dict([(k.strip(), float(re.search(r'\d+', v.strip()).group(0))) for (k,v) in memdict]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "Dict[str, float]", variable has type "List[List[str]]") [assignment]
@@ -380,7 +380,7 @@ def get_percent_mem_usage(ignored): | |||
memlist = memfd.readlines() | |||
memfd.close() | |||
memdict = [ m.split(':', 1) for m in memlist ] | |||
memdict = dict([(k.strip(), float(re.search('\d+', v.strip()).group(0))) for (k,v) in memdict]) | |||
memdict = dict([(k.strip(), float(re.search(r'\d+', v.strip()).group(0))) for (k,v) in memdict]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Item "None" of "Optional[Match[str]]" has no attribute "group" [union-attr]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
pylint
scripts/test_hfx_filename.py|76| C0301: Line too long (107/100) (line-too-long)
scripts/test_hfx_filename.py|79| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|83| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|87| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|89| C0301: Line too long (106/100) (line-too-long)
scripts/test_hfx_filename.py|92| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|96| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|97| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|100| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|101 col 32| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|102 col 101| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|102| C0301: Line too long (101/100) (line-too-long)
scripts/test_hfx_filename.py|106| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_hfx_filename.py|1| C0114: Missing module docstring (missing-module-docstring)
scripts/test_hfx_filename.py|19| C0115: Missing class docstring (missing-class-docstring)
scripts/test_hfx_filename.py|21 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|45 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|71 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|84 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|99| C0115: Missing class docstring (missing-class-docstring)
scripts/test_hfx_filename.py|101 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|8| C0411: standard import "import sys" should be placed before "from mock import MagicMock, patch, call" (wrong-import-order)
scripts/test_perfmon.py|17| C0115: Missing class docstring (missing-class-docstring)
scripts/test_perfmon.py|7| C0411: standard import "import sys" should be placed before "from mock import MagicMock, patch" (wrong-import-order)
scripts/test_perfmon.py|8| C0411: standard import "import math" should be placed before "from mock import MagicMock, patch" (wrong-import-order)
scripts/test_static_vdis.py|17 col 70| C0303: Trailing whitespace (trailing-whitespace)
scripts/test_static_vdis.py|18| C0115: Missing class docstring (missing-class-docstring)
scripts/test_static_vdis.py|7| C0411: standard import "import sys" should be placed before "from mock import MagicMock" (wrong-import-order)
scripts/test_static_vdis.py|8| C0411: standard import "import tempfile" should be placed before "from mock import MagicMock" (wrong-import-order)
s.send("%s\r\n" % h) | ||
#print "%s\r\n" % h, | ||
s.send(request) | ||
s.send((h + "\r\n").encode('utf-8')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0311: Bad indentation. Found 10 spaces, expected 12 (bad-indentation)
result = s.recv(1024) | ||
#print "Received HTTP response:" | ||
#print result | ||
result = s.recv(1024).decode('utf-8') | ||
if "200 OK" not in result: | ||
print("Expected an HTTP 200, got %s" % result, file=sys.stderr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0311: Bad indentation. Found 10 spaces, expected 12 (bad-indentation)
result = s.recv(1024) | ||
#print "Received HTTP response:" | ||
#print result | ||
result = s.recv(1024).decode('utf-8') | ||
if "200 OK" not in result: | ||
print("Expected an HTTP 200, got %s" % result, file=sys.stderr) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0311: Bad indentation. Found 10 spaces, expected 12 (bad-indentation)
@@ -28,18 +28,14 @@ def rpc(session_id, request): | |||
headers = [ | |||
"POST %s?session_id=%s HTTP/1.0" % (db_url, session_id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
@@ -28,18 +28,14 @@ def rpc(session_id, request): | |||
headers = [ | |||
"POST %s?session_id=%s HTTP/1.0" % (db_url, session_id), | |||
"Connection:close", | |||
"content-length:%d" % (len(request)), | |||
"content-length:%d" % (len(request.encode('utf-8'))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
def test_rpc_international_character(self, mock_socket): | ||
mock_connected_socket = MagicMock() | ||
mock_socket.return_value = mock_connected_socket | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
# Not using literal string is for passing python2 check | ||
request = "socket 请求" | ||
body = hfx_filename.rpc(session_id, request) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
request.encode('utf-8') | ||
] | ||
mock_connected_socket.send.assert_has_calls([call(data) for data in expected_data]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
|
||
expected_return = "HelloWorld" | ||
self.assertEqual(expected_return, body) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
def test_db_get_uuid(self, mock_socket): | ||
mock_connected_socket = MagicMock() | ||
mock_socket.return_value = mock_connected_socket | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
Signed-off-by: Bernhard Kaindl <bernhardkaindl7@gmail.com>
f88a55d
to
57d9707
Compare
No description provided.