-
Notifications
You must be signed in to change notification settings - Fork 52
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
Code Cleanup - Github source #295
Conversation
…nit__,py" as well. That caused the confusion mentioned in issue #294. Now all the helper functions are moved to "helper.py".
sources/github/helpers.py
Outdated
def get_rest_pages(access_token: str, query: str) -> Iterator[List[StrAny]]: | ||
url = REST_API_BASE_URL + query | ||
while True: | ||
def _get_rest_pages(access_token: str, query: str) -> Iterator[List[StrAny]]: |
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.
you import this function to another script, so imo prefix "_", which means "private function", doesn't make sense.
you can keep it like get_rest_pages
.
same for get_reactions_data
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.
sure, okay
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.
check unused imports (in init.py file), also run black
command for auto-formatting
sources/github/helpers.py
Outdated
).json() | ||
def _request() -> requests.Response: | ||
r = requests.post( | ||
"https://api.github.com/graphql", |
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.
use GRAPHQL_API_BASE_URL instead of "https://api.github.com/graphql"
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.
sources/github/helpers.py
Outdated
print(f"got page {url}, requests left: " + r.headers["x-ratelimit-remaining"]) | ||
return r | ||
|
||
url = "https://api.github.com" + query |
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.
use REST_API_BASE_URL
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.
sources/github/helpers.py
Outdated
) | ||
return r | ||
|
||
next_page_url = "https://api.github.com" + query |
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.
use REST_API_BASE_URL instead of "https://api.github.com"
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.
All the rest of the API helper functions were defined two times, one in "init.py" and one in "helper.py" as well. This was the issue mentioned in issue #294. Now, all the helper functions are moved to "helper.py".
Tell us what you do here
verified source
)Relevant issue
issue # 294
More PR info