-
Notifications
You must be signed in to change notification settings - Fork 429
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
feat: Add endpoint to fetch GitHub repository contributors #4013
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4013 +/- ##
=======================================
Coverage 96.28% 96.29%
=======================================
Files 1143 1143
Lines 36992 37072 +80
=======================================
+ Hits 35618 35698 +80
Misses 1374 1374 ☔ View full report in Codecov by Sentry. |
…invalid query params
class PaginatedQueryParams(ABC): | ||
page: int = field(default=1, init=False) | ||
page_size: int = field(default=100, init=False) |
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.
- Why derive from
ABC
? - Why
init=False
? What if we want to customise pagination?
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.
- Because I forgot we need to use it for a request and thought we would only need it as a base class for others. Now I changed it to a regular class and it's in use by the get repos endpoint.
- Because derivating without either
init=false
orkw_only
gives an error. I now changed to usekw_only
to have a better result.
Thanks for cathing this out!
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.
LGTM in general with one question outstanding.
@khvn26 I solved your question, but that implied making some adjustments and improvements. Can you please re-review? |
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.
Three minor comments, otherwise LGTM.
# Then | ||
assert response.status_code == status.HTTP_400_BAD_REQUEST | ||
response_json = response.json() | ||
if is_invalid_page: |
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.
An if
inside a test is a code smell. I think it's better to have a parametrised detail
or response_json
argument instead.
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.
Right, thanks! Done.
# Then | ||
assert response.status_code == status.HTTP_400_BAD_REQUEST | ||
response_json = response.json() | ||
if is_invalid_page: |
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.
Same here; consider parametrising detail
or response_json
argument instead.
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
response: requests.Response, | ||
total_count: int | None = None, | ||
incomplete_results: bool | None = None, | ||
) -> dict[str, Any]: |
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.
nit: It's not critical, but, since we fully control the creation of this dict, we could add a TypedDict
return type to this function that would help introspection.
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.
Maybe Dataclass or would it be too much? Let's please discuss this. Merging as is FTM.
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
Fetch GitHub repository contributors endpoint added.
Some Data Classes were optimized
How did you test this code?
Unit tests added to cover the new code