Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: move response_content into backend code#2488

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
nejch wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromrefactor/response-content-backend

Conversation

nejch
Copy link
Member

Needed in order to later add other backends that handle streaming responses differently. Just a first step, later maybe we could get rid ofresponse_content completely from individual methods and just handle this in the request code 🤔

@codecov-commenter
Copy link

codecov-commenter commentedFeb 12, 2023
edited by codecovbot
Loading

Codecov Report

Attention: Patch coverage is87.17949% with5 lines in your changes missing coverage. Please review.

Project coverage is 96.10%. Comparing base(7ec3189) to head(24ba442).
Report is 80 commits behind head on main.

Current head24ba442 differs from pull request most recent heada8c95c8

Pleaseupload reports for the commita8c95c8 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@##             main    #2488      +/-   ##==========================================- Coverage   96.52%   96.10%   -0.43%==========================================  Files          90       87       -3       Lines        5872     5667     -205     ==========================================- Hits         5668     5446     -222- Misses        204      221      +17
FlagCoverage Δ
api_func_v482.47% <71.79%> (+0.23%)⬆️
cli_func_v482.93% <48.71%> (-0.65%)⬇️
unit87.55% <69.23%> (-0.75%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

FilesCoverage Δ
gitlab/_backends/requests_backend.py96.92% <100.00%> (-1.89%)⬇️
gitlab/mixins.py92.05% <100.00%> (-0.87%)⬇️
gitlab/v4/objects/artifacts.py100.00% <100.00%> (ø)
gitlab/v4/objects/files.py100.00% <100.00%> (ø)
gitlab/v4/objects/packages.py96.22% <100.00%> (-3.78%)⬇️
gitlab/v4/objects/projects.py98.86% <100.00%> (+0.07%)⬆️
gitlab/v4/objects/repositories.py83.56% <100.00%> (ø)
gitlab/v4/objects/secure_files.py100.00% <100.00%> (ø)
gitlab/v4/objects/snippets.py97.95% <100.00%> (-0.05%)⬇️
gitlab/_backends/protocol.py80.00% <80.00%> (-12.86%)⬇️
... and2 more

... and29 files with indirect coverage changes

@nejchnejchforce-pushed therefactor/response-content-backend branch from70a5cfd to940e59cCompareFebruary 12, 2023 16:03
@nejchnejchforce-pushed therefactor/response-content-backend branch from940e59c to4dc7f00CompareFebruary 15, 2023 23:01
@nejchnejch marked this pull request as ready for reviewFebruary 15, 2023 23:03
@nejchnejchforce-pushed therefactor/response-content-backend branch 7 times, most recently from0f907b9 toab089fbCompareMarch 12, 2023 08:40
@nejchnejchforce-pushed therefactor/response-content-backend branch fromab089fb toa8c95c8CompareJune 8, 2024 15:38
@nejch
Copy link
MemberAuthor

@JohnVillalovos I've rebased and reworked this a bit based on previous comments. Would you be able to have a look at this one?

IMO it's also a bit cleaner like this to have the response logic be part of the client/backend than a separate util function since we've split out the client code (and more recently the backend code) from the monolith__init__ module.

Copy link
Member

@JohnVillalovosJohnVillalovos left a comment

Choose a reason for hiding this comment

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

Thanks@nejch

Overall looks good to me. Only a couple of nits on my end. But I would be okay with merging as is. So approved by me.

@@ -17,6 +17,17 @@ def __init__(self, response: requests.Response) -> None: ...


class Backend(Protocol):
@staticmethod
@abc.abstractmethod
def response_content(

Choose a reason for hiding this comment

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

This seems like it might be a good time to make the method require keyword args for all the args. I'm a fan of requiring keyword args 😆

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I believe this would be a breaking change as we still expose it in utils as a non-private function. In that case I'd maybe drop the wrapper entirely and not just deprecate it, as then we don't need to worry about maintaining the signature twice (#2488 (comment)).

Might be worth grouping breaking changes and wait to merge them all together though for a major release.

Choose a reason for hiding this comment

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

Well I didn't think it would be a breaking change if this is the new function and then the wrapper (with the deprecation) would call this one with keyword args.

chunk_size: int,
*,
iterator: bool,
*args: Any, **kwargs: Any

Choose a reason for hiding this comment

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

I would prefer to keep the signature as before. Instead of using *args/**kwargs.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

My initial idea was to just leave a simple wrapper for backward compatibility but maybe we can just drop it (see#2488 (comment)).

Choose a reason for hiding this comment

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

My thought was that this one would maintain the same exact signature as before, and then call the new function with keyword arguments.

But! It isn't that important and perfectly fine with me if you want to merge this in as is 👍

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Ahh I misunderstood your comment I think, I thought you wanted to match the signatures. I'll add the changes!

@github-actionsGitHub Actions
Copy link

This Pull Request (PR) was marked stale because it has been open 90 days with no activity. Please remove the stale label or comment on this PR. Otherwise, it will be closed in 15 days.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JohnVillalovosJohnVillalovosJohnVillalovos approved these changes

@lmilbaumlmilbaumlmilbaum requested changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@nejch@codecov-commenter@JohnVillalovos@lmilbaum

[8]ページ先頭

©2009-2025 Movatter.jp