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

Addition: Docs need to say that _refresh_states() also takes a non iterable #354

Open
IAlwaysBeCoding opened this issue Nov 21, 2018 · 1 comment

Comments

@IAlwaysBeCoding
Copy link
Contributor

IAlwaysBeCoding commented Nov 21, 2018

The docs need to be changed to let the user know that _refresh_states() also takes a non iterable, aka a single object not contained in a list.

def refresh_states(self, requests):
"""
Retrieves states for all requests from storage.
:param requests: list(:class:`Request <frontera.core.models.Request>`)
"""
self._states_context.refresh_and_keep(requests)

That's because the function refresh_and_keep() converts the non iterable object into a non-iterable object contained within a list.

def refresh_and_keep(self, requests):
self.to_fetch(requests)
self.fetch()
self.states.set_states(requests)
self._requests.extend(requests if isinstance(requests, Iterable) else [requests])

@sibiryakov
Copy link
Member

Good catch! Can you make PR @IAlwaysBeCoding ?

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

No branches or pull requests

2 participants