Skip to content

refactor(mixins): extract custom type transforms into utils - #2011

Merged
JohnVillalovos merged 1 commit into
mainfrom
refactor/transform-types
May 29, 2022
Merged

JohnVillalovos merged 1 commit into
mainfrom
refactor/transform-types

Conversation

@nejch

@nejch nejch commented May 7, 2022 •

Copy link
Copy Markdown
Member

I'm trying to add support for multipart uploads to the generic package upload (see #2002), but unfortunately the logic for that is currently done directly in the create()/update() methods (processing the data/files dict for the MultipartEncoder).

This extracts that into a helper and handles transform_files so we can also use it for list() which doesn't need it. This PR preps the code so the generic package one should be smaller.

In the future I think we can simplify multipart encoding more and get rid of files altogether, and just process everything in data - but wanted to keep this PR simple.

@codecov-commenter

codecov-commenter commented May 7, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #2011 (bf0b688) into main (387a140) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2011      +/-   ##
==========================================
+ Coverage   92.67%   92.72%   +0.04%     
==========================================
  Files          78       78              
  Lines        4958     4947      -11     
==========================================
- Hits         4595     4587       -8     
+ Misses        363      360       -3     
Flag Coverage Δ
cli_func_v4 81.50% <88.23%> (+0.10%) ⬆️
py_func_v4 80.37% <100.00%> (-0.01%) ⬇️
unit 83.76% <100.00%> (+0.10%) ⬆️

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

Impacted Files Coverage Δ
gitlab/mixins.py 91.75% <100.00%> (+<0.01%) ⬆️
gitlab/utils.py 93.22% <100.00%> (+1.91%) ⬆️
gitlab/types.py 100.00% <0.00%> (+3.33%) ⬆️

Comment thread gitlab/utils.py Resolved
Comment thread gitlab/utils.py Resolved
Comment thread tests/unit/test_utils.py Resolved
Comment thread gitlab/utils.py Resolved
Comment thread gitlab/utils.py Resolved
Comment thread gitlab/utils.py Resolved

@JohnVillalovos JohnVillalovos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you want to merge this as-is I am okay with that. We can always make it better in the future.

@nejch
nejch force-pushed the refactor/transform-types branch 2 times, most recently from fa8fb57 to bf0b688 Compare May 29, 2022 13:43
@nejch

nejch commented May 29, 2022

Copy link
Copy Markdown
Member Author

@JohnVillalovos I've made some changes roughly as you suggested but I never got to refactoring the files part, I still would like to do that in a follow-up so I haven't touched dataclasses yet as I think it would be only a temporary change :)

@JohnVillalovos

Copy link
Copy Markdown
Member

@JohnVillalovos I've made some changes roughly as you suggested but I never got to refactoring the files part, I still would like to do that in a follow-up so I haven't touched dataclasses yet as I think it would be only a temporary change :)

Sounds good. Approved. Not sure if you want to squash it into one commit or not. Or merge it as-is.

@nejch
nejch force-pushed the refactor/transform-types branch from bf0b688 to ab2d572 Compare May 29, 2022 15:39
@nejch

nejch commented May 29, 2022

Copy link
Copy Markdown
Member Author

@JohnVillalovos I've made some changes roughly as you suggested but I never got to refactoring the files part, I still would like to do that in a follow-up so I haven't touched dataclasses yet as I think it would be only a temporary change :)

Sounds good. Approved. Not sure if you want to squash it into one commit or not. Or merge it as-is.

Ah right makes sense, I've squashed it :) just didn't feel comfortable self-merging for this project.

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.

3 participants