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

Add pagination #21

Merged
merged 27 commits into from
Sep 6, 2017
Merged

Add pagination #21

merged 27 commits into from
Sep 6, 2017

Conversation

dnl-blkv
Copy link
Contributor

@dnl-blkv dnl-blkv commented Sep 1, 2017

No description provided.

Copy link
Contributor

@OGKevin OGKevin left a comment

Choose a reason for hiding this comment

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

Few questions

@@ -13,6 +13,11 @@
from bunq.sdk import context
from bunq.sdk import exception

try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we trying to import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was needed to import different libs depending on the python version (one for 2^, the other for 3^). Removed the if-elses!

# Size of page of payments to list
_PAGE_SIZE = 3

_USER_ITEM_ID = 1969 # Put your user ID here
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these ids be there?

_PAGE_SIZE = 3

_USER_ITEM_ID = 1969 # Put your user ID here
_MONETARY_ACCOUNT_ITEM_ID = 1988 # Put your monetary account ID here
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

:rtype: str
"""

if params:
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this be always true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right 👍

@dnl-blkv
Copy link
Contributor Author

dnl-blkv commented Sep 4, 2017

@OGKevin Done, but let's not merge yet and look make sure the conf is OK first :)

Copy link
Contributor

@OGKevin OGKevin left a comment

Choose a reason for hiding this comment

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

LGTM, will run tests before I approve 😁

@OGKevin
Copy link
Contributor

OGKevin commented Sep 4, 2017

@dnl-blkv all tests passing, please include pagination tests as we discussed and then it should be ready for merging.

@OGKevin OGKevin modified the milestone: V0.11.0 Sep 5, 2017
@dnl-blkv
Copy link
Contributor Author

dnl-blkv commented Sep 5, 2017

@OGKevin this one is done; please take a look :)

Copy link
Contributor

@OGKevin OGKevin 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 🤔

tests/config.py Outdated
"""
:rtype: str
:rtype: str[]
Copy link
Contributor

Choose a reason for hiding this comment

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

Hehe this is not how this is notated in python 😛

Please rewrite to list[str]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixed

tests/config.py Outdated

if not permitted_ips_str:
return []
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this Else redudndant ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, fixed

pagination.older_id = None

def access_url_params_previous_page():
_ = pagination.url_params_previous_page
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there really a need to assign it to _ ? Can't you just call agination.url_params_previous_page without assigning it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without assignment it logically gets an IDE warning. This is a Google-accepted way of suppressing these IDE warnings. See: https://google.github.io/styleguide/pyguide.html#Python_Language_Rules

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough

:raise: NotImplementedError
"""

_ = pagination
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this need to be assigned to _ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pagination.future_id = None

def access_url_params_next_page():
_ = pagination.url_params_next_page
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

ugh

:rtype: None
"""

for i in range(self._payment_missing_count):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rewrite i with _ as of it is not being used inside the loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@dnl-blkv
Copy link
Contributor Author

dnl-blkv commented Sep 6, 2017

@OGKevin All addressed/answered; please take a look!

Copy link
Contributor

@OGKevin OGKevin left a comment

Choose a reason for hiding this comment

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

One question, other than that LGTM

self.assertEqual(url_params_count_only_expected,
pagination.url_params_count_only)

def create_pagination_with_all_properties_set(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be private ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@OGKevin that's true, fixed!

'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],

# Require Python version equal or more than Python 3.
python_requires='>=3',
Copy link
Contributor

Choose a reason for hiding this comment

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

why did we drop it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Python 2.7 handles dependencies poorly. So, it turned out the SDK was not working with 2.7 for last 2 weeks... However, no one ever reported the bug or complained. Moreover, some users were pushing for switch to Python 3 only.

@andrederoos andrederoos merged commit 4cc43a1 into develop Sep 6, 2017
@andrederoos andrederoos deleted the 20-pagination branch September 6, 2017 18:13
@OGKevin OGKevin mentioned this pull request Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants