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

Refactor package_managers #495

Merged
merged 2 commits into from
Jul 10, 2021

Conversation

Hritik14
Copy link
Collaborator

@Hritik14 Hritik14 commented Jul 3, 2021

Fixes: #492

Use uniform names and prototypes for fetch method.
Remove unnecessary checks. Re-use sessions.

I've removed endpoint argument from GitHubTagsAPI, I did not find a use for it at the current stage. Also, the fetch method is only called for the pkg which is not already in cache, so other checks appeared redundant. Please correct me if I am wrong.


Move load_api to parent class and refactor imports

The code for load_api was repetitive and used in all subclasses of
VersionAPI, it is better suited in the parent class. fetch method is
also now consistent and defined as an abstract method in the base class.
Python ABC is not used as different implementations of load_api and
fetch are allowed as done in DebianVersionAPI

Signed-off-by: Hritik Vijay [email protected]

Hritik14 added 2 commits July 4, 2021 02:07
Use uniform names and prototypes for `fetch` function.
Remove unnecessary checks. Re-use sessions

Signed-off-by: Hritik Vijay <[email protected]>
The code for `load_api` was repetitive and used in all subclasses of
VersionAPI, it is better suited in the parent class. `fetch` method is
also now consistent and defined as an abstract method in the base class.
Python ABC is not used as different implementations of `load_api` and
`fetch` are allowed as done in DebianVersionAPI

Signed-off-by: Hritik Vijay <[email protected]>
@Hritik14 Hritik14 changed the title Refactor package_manangers Refactor package_managers Jul 3, 2021
@Hritik14 Hritik14 requested a review from sbs2001 July 7, 2021 13:27
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Hritik14 Hritik14 merged commit 09839b9 into aboutcode-org:main Jul 10, 2021
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

Successfully merging this pull request may close these issues.

Make package manager api code more readable
2 participants