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

MOTOR-897 Set up flake8 #146

Merged
merged 11 commits into from
Feb 17, 2022
Merged

MOTOR-897 Set up flake8 #146

merged 11 commits into from
Feb 17, 2022

Conversation

blink1073
Copy link
Member

No description provided.

Copy link
Contributor

@juliusgeo juliusgeo left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from motor import docstrings?

Copy link
Member Author

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)):
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

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

Copy link
Member Author

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

@@ -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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -618,7 +612,7 @@ def __init__(self, delegate):
super().__init__(delegate)

def next(self):
motor_grid_out = super().next()
motor_grid_out = next(super())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not super().next()?

Copy link
Member Author

@blink1073 blink1073 Feb 17, 2022

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()`.

Copy link
Member

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.

Copy link
Member Author

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.

test/tornado_tests/test_motor_auth.py Outdated Show resolved Hide resolved
@@ -298,21 +298,15 @@ def __new__(mcls, name, _bases, attrs):
return type.__new__(_metaclass, str("dummy"), (), {})


class Synchro(with_metaclass(SynchroMeta)):
Copy link
Member

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

@ShaneHarvey
Copy link
Member

Waiting for the synchro task to complete.

@blink1073
Copy link
Member Author

Looks like we're out of synch on parameters: TypeError: watch() got an unexpected keyword argument 'comment

@ShaneHarvey
Copy link
Member

Yes that's expected. I just wanted to make sure that the synchro tests fail in the same way as before.

@blink1073 blink1073 merged commit 5e07f66 into mongodb:master Feb 17, 2022
@blink1073 blink1073 deleted the MOTOR-897 branch February 17, 2022 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants