-
Notifications
You must be signed in to change notification settings - Fork 207
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
MOTOR-897 Set up flake8 #146
Conversation
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.
LGTM!
motor/core.py
Outdated
@@ -34,7 +33,7 @@ | |||
from pymongo.driver_info import DriverInfo | |||
from pymongo.encryption import ClientEncryption | |||
|
|||
from motor.docstrings import * | |||
import motor.docstrings as docstrings |
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.
from motor import docstrings
?
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.
Haha yeah, will do
@@ -298,21 +298,15 @@ def __new__(mcls, name, _bases, attrs): | |||
return type.__new__(_metaclass, str("dummy"), (), {}) | |||
|
|||
|
|||
class Synchro(with_metaclass(SynchroMeta)): |
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.
Can we also remove with_metaclass now?
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.
Done
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.
These changes cause this error in the synchro tests:
[2022/02/17 01:40:50.485] Traceback (most recent call last):
[2022/02/17 01:40:50.485] File "/opt/python/3.7/lib/python3.7/runpy.py", line 183, in _run_module_as_main
[2022/02/17 01:40:50.485] mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
[2022/02/17 01:40:50.485] File "/opt/python/3.7/lib/python3.7/runpy.py", line 109, in _get_module_details
[2022/02/17 01:40:50.485] __import__(pkg_name)
[2022/02/17 01:40:50.485] File "/data/mci/25c39eae21d0be14b9a9ad83b5be38eb/src/synchro/__init__.py", line 291, in <module>
[2022/02/17 01:40:50.485] class Synchro(meta=SynchroMeta):
[2022/02/17 01:40:50.485] TypeError: __init_subclass__() takes no keyword arguments
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.
Fixed, used the wrong argument name
synchro/__init__.py
Outdated
@@ -424,7 +418,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): | |||
self.synchronize(self.delegate.end_session) | |||
|
|||
def with_transaction(self, *args, **kwargs): | |||
raise unittest.SkipTest("MOTOR-606 Synchro does not support " "with_transaction") | |||
raise unittest.SkipTest("MOTOR-606 Synchro does not supportwith_transaction") |
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.
missing space.
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.
fixed
synchro/__init__.py
Outdated
@@ -618,7 +612,7 @@ def __init__(self, delegate): | |||
super().__init__(delegate) | |||
|
|||
def next(self): | |||
motor_grid_out = super().next() | |||
motor_grid_out = next(super()) |
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.
Why not super().next()
?
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.
B305 `.next()` is not a thing on Python 3. Use the `next()` builtin. For Python 2 compatibility, use `six.next()`.
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.
But Cursor.next() it is a thing in pymongo. That's what's confusing to me. I think we should disable this check as long as we support next() methods.
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.
Yeah I'll disable B305
globally here as well.
@@ -298,21 +298,15 @@ def __new__(mcls, name, _bases, attrs): | |||
return type.__new__(_metaclass, str("dummy"), (), {}) | |||
|
|||
|
|||
class Synchro(with_metaclass(SynchroMeta)): |
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.
These changes cause this error in the synchro tests:
[2022/02/17 01:40:50.485] Traceback (most recent call last):
[2022/02/17 01:40:50.485] File "/opt/python/3.7/lib/python3.7/runpy.py", line 183, in _run_module_as_main
[2022/02/17 01:40:50.485] mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
[2022/02/17 01:40:50.485] File "/opt/python/3.7/lib/python3.7/runpy.py", line 109, in _get_module_details
[2022/02/17 01:40:50.485] __import__(pkg_name)
[2022/02/17 01:40:50.485] File "/data/mci/25c39eae21d0be14b9a9ad83b5be38eb/src/synchro/__init__.py", line 291, in <module>
[2022/02/17 01:40:50.485] class Synchro(meta=SynchroMeta):
[2022/02/17 01:40:50.485] TypeError: __init_subclass__() takes no keyword arguments
Waiting for the synchro task to complete. |
Looks like we're out of synch on parameters: |
Yes that's expected. I just wanted to make sure that the synchro tests fail in the same way as before. |
No description provided.