Skip to content

Conversation

@Poolitzer
Copy link
Member

@Poolitzer Poolitzer commented Sep 6, 2022

TODO after merge: Update wiki and transition guide/script

Checklist for PRs

  • Added .. versionadded:: version, .. versionchanged:: version or .. deprecated:: version to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests
  • Documented code changes according to the CSI standard
  • Added myself alphabetically to AUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable __all__ s

@harshil21 harshil21 added this to the v20.0a5 milestone Sep 9, 2022
@harshil21 harshil21 added enhancement 🛠 breaking change type: breaking 🛠 refactor change type: refactor and removed enhancement labels Sep 9, 2022
@Poolitzer Poolitzer changed the title Feat: File.download, merge out and custom_path into out Feat: Rewrite File.download into download_to_drive and download_to_object Sep 12, 2022
@Poolitzer
Copy link
Member Author

Poolitzer commented Sep 12, 2022

I dont get codecov path, test_download_file_obj covers that, no?

async def test_download_file_obj(self, monkeypatch, file):
async def test(*args, **kwargs):
return self.file_content
monkeypatch.setattr(file.get_bot().request, "retrieve", test)
with TemporaryFile() as custom_fobj:
out_fobj = await file.download_to_object(out=custom_fobj)
assert out_fobj is custom_fobj
out_fobj.seek(0)
assert out_fobj.read() == self.file_content

Edit: Doesn't complain anymore. I think it has seen its error :D

Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I left some comments, some of which are not actually due to your changes :D

IISC Codecov mainly complains about decrypting files with self._credentials not being covered.

Regarding naming, I'd like to also throw download_to_file (as alternative to download_to_drive) and download_to_memory (as alternative to download_to_obj) into the race.

Poolitzer and others added 3 commits September 13, 2022 13:02
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
@harshil21 harshil21 added the ℹ️ needs-wiki-update information: needs-wiki-update label Sep 24, 2022
@Poolitzer
Copy link
Member Author

Poolitzer commented Oct 6, 2022

There are open questions I have now, unordered as I think of them.

  • Did it make sense that I did this whole encrypted file way? It feels to me like the natural way to test this, but maybe there is a better way?
    • If that makes sense to use, shouldn't we use this in different tests?
  • Should we rename the hash param in decrypt, it shadows a builtin function.
  • Why does EncryptedPassportElement take credentials argument?
  • Does it make sense not to apply the decryption on local files? Because thats what currently happens...

@Bibo-Joshi
Copy link
Member

Bibo-Joshi commented Oct 24, 2022

So I finally got around to review this again and I apologize for taking so long.
The new test look good to me, I understood what they do while reading them. However, it would be nice to have some comments that explain how you created the image_de/encrypted and the input for FileCredentials. That would have the benefits of a) being able to reproduce things and b) have even better understanding of what's going on.

  • Did it make sense that I did this whole encrypted file way? It feels to me like the natural way to test this, but maybe there is a better way?

LGTM.

  • If that makes sense to use, shouldn't we use this in different tests?

That would mean tuching passport tests. grrrrrrr. I'm okay with only touching them if absolutely necessary xD

  • Should we rename the hash param in decrypt, it shadows a builtin function.

Okay with me, can be a separate PR though.

  • Why does EncryptedPassportElement take credentials argument?

No clue, goes back to #1168. IISC removing should be fine, maybe in the same PR as the hash param

  • Does it make sense not to apply the decryption on local files? Because thats what currently happens...

It does not, actually 🤔 Even for local files, they should be encrypted, I guess. Can you fix that + add tests?

Also improved docs for the tests
Copy link
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

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

nice work, didn't look at the tests too closely:

Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

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

Thanks for the updates & the improvements for local encrypted files!

__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]

if __version_info__ < (20, 0, 0, "alpha", 1):
if __version_info__ < (20, 0, 0, "alpha", 5):
Copy link
Member

Choose a reason for hiding this comment

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

This may have to change to (20, 0, 0, "beta", 0) … suggestions for a good place to keep track of that? 😬

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe in the release page? But it's hard to say when a change breaks an example post those changes

Copy link
Member

Choose a reason for hiding this comment

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

I'm mainly talking about our plans to make the next release a beta release. Only if we get another API update before #3249 is mergable, the next release would be calld 20.0a5 … Mind you, this check would still be correct, since (20, 0, 0, "alpha", 5) < (20, 0, 0, "beta", 0), but it would probably still confuse users xD I'll add a note o the "how to release page" as reminder :)

Poolitzer and others added 2 commits October 31, 2022 19:07
Also rename to_drive to to_memory
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

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

precommit and doc-build are failing 🤔
otherwise LGTM 🙂

Copy link
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

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

LGTM

@Bibo-Joshi Bibo-Joshi merged commit 636654c into master Nov 2, 2022
@Bibo-Joshi Bibo-Joshi deleted the rewrite_file_params branch November 2, 2022 07:28
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🛠 breaking change type: breaking ℹ️ needs-wiki-update information: needs-wiki-update 🛠 refactor change type: refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants