Skip to content

Conversation

@joshthoward
Copy link
Member

Added flake8 to the GitHub CI tests and then updated the code to pass flake8 test. Some unused imports were removed.

The max line length is set to 120 and the W503 rule is ignored which is PEP 8 compliant.

@cla-bot
Copy link

cla-bot bot commented Jan 14, 2021

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla.

1 similar comment
@cla-bot
Copy link

cla-bot bot commented Jan 14, 2021

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla.

@cla-bot
Copy link

cla-bot bot commented Jan 14, 2021

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla.

@joshthoward
Copy link
Member Author

CLA has been sent via email.

Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

A few comments.

Thanks for your contribution. ❤️


@pytest.mark.skip(reason="Nan currently not returning the correct python type fon inf")
def test_float_inf_query_param(trino_connection):
cur = trino_connection.cursor()
Copy link
Member

Choose a reason for hiding this comment

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

Thanks. ❤️

cur.execute(
"""
select * FRMO foo WHERE x = ?;
select * FRMO foo WHERE x = ?;
Copy link
Member

Choose a reason for hiding this comment

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

While we are at it, can you make SQL queries use uppercase keywords (or at-least be consistent within a single query) if it's not too much of an effort?

It should be a separate commit though.

from . import exceptions
from . import logging

__all__ = ['auth', 'dbapi', 'client', 'constants', 'exceptions', 'logging']
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we consider all of these to be public API.

Most notably client isn't supposed to be public since it's an implementation detail of the driver. People can use it but it's not expected to be stable (which is what __all__ indicates by convention.

auth, dbapi, constants and exceptions might be considered public.

Copy link
Member Author

Choose a reason for hiding this comment

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

__all__ is updated here to indicate to flake8 that the unused imports are part of a public API. Otherwise, we might want to remove client and logging from __init__.py. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Good point. Let's leave it out of this PR - I'll follow up on this in #43

@@ -34,14 +34,6 @@
TRINO_PORT = 8080


def is_process_alive(pid):
Copy link
Member

Choose a reason for hiding this comment

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

It's surprising that this is unused. I'll check what changed to make this unused.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's interesting code. ProcessLookupError is not imported and cannot be caught as an exception.

Copy link
Member

Choose a reason for hiding this comment

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

This function was never called but has been here since the beginning. 🤷‍♂️

Let's remove it then. 👍

@cla-bot
Copy link

cla-bot bot commented Jan 14, 2021

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla.

1 similar comment
@cla-bot
Copy link

cla-bot bot commented Jan 14, 2021

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla.

def test_select_query(trino_connection):
cur = trino_connection.cursor()
cur.execute("select * from system.runtime.nodes")
cur.execute("SELECT * FROM system.runtime.nodes")
Copy link
Member

Choose a reason for hiding this comment

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

is this being checked too?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not since it isn't "Python" code.

setup.cfg Outdated
Comment on lines 9 to 10
# https:#www.flake8rules.com/rules/W503.html
# https:#www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator
Copy link
Member

@findepi findepi Jan 15, 2021

Choose a reason for hiding this comment

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

# -> // in url

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.

Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@joshthoward
Copy link
Member Author

@findepi, @hashhar can either of you guys merge my PR? I think we should be good to close here.

Copy link
Member

@findepi findepi left a comment

Choose a reason for hiding this comment

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

LGTM!

One minor comment about commit boundaries.

@findepi findepi merged commit 2eec36c into trinodb:master Jan 19, 2021
@findepi
Copy link
Member

findepi commented Jan 19, 2021

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants