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

Pathlib weherever possible 2665 #2688

Merged

Conversation

eldbud
Copy link
Contributor

@eldbud eldbud commented Oct 2, 2021

Refactored usage of str objects and/or os module can be replaced with pathlib.Path across the project.
Hopefully managed to find all places in the project that can be updated.

Bibo-Joshi and others added 23 commits September 15, 2021 17:09
…ryptionError (python-telegram-bot#2621)

* move telegramdecryptionerror to error.py

* Change error class name
…t#2612)

* feat: add docs about docs

* fix: improve looks

* fix: make link work

* fix: this looks better

* Improved markdown, updated link

* Less justifying

Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
* Fix incomplete type annotations for CallbackContext

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
* Feat: Custom pytest marker

Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
* Make basepersistence methods abstractmethod

Signed-off-by: starry69 <starry369126@outlook.com>

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
…m-bot#2634)

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com>
@Poolitzer Poolitzer linked an issue Oct 2, 2021 that may be closed by this pull request
Copy link
Member

@Poolitzer Poolitzer left a comment

Choose a reason for hiding this comment

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

You have one failing test here and it actually seems related to your changes. You wanna give it a shot at fixing? I can't recreate it myself sadly, using windows + py3.7, maybe someone else has a plan.

telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
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 your PR! I left a number of comments an questions :)
Apart from those:

  • Please double check that you added versioning directives everywhere where needed.
  • Just to clarify: Is there now any parameter that accepts Path objects in addition to what it accepted before? if so, please make sure that the tests cover both cases

telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
telegram/files/file.py Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
telegram/files/inputfile.py Outdated Show resolved Hide resolved
telegram/request.py Outdated Show resolved Hide resolved
tests/test_file.py Outdated Show resolved Hide resolved
tests/test_inputfile.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
telegram/request.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
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.

round 2 of reviews

telegram/dice.py Outdated Show resolved Hide resolved
telegram/ext/dispatcher.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/files/file.py Outdated Show resolved Hide resolved
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 new updates and sorry for making your merge-life harder unintentionally 😬
I think we're pretty much down to nitpicking details :)

telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
tests/test_persistence.py Show resolved Hide resolved
tests/test_request.py Outdated Show resolved Hide resolved
telegram/ext/dispatcher.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
…le.py, added a parametrized test_filepath_argument_types in test_persistence.py, and added test_download in test_request.py
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)

telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
telegram/ext/picklepersistence.py Outdated Show resolved Hide resolved
tests/test_persistence.py Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)

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.

If tests run and @harshil21 approves as well, we can merge :)

@eldbud
Copy link
Contributor Author

eldbud commented Oct 4, 2021

@Bibo-Joshi can you please role back your push to this branch? i can't push my changes, and some of yours i think break the test.

edit: reverted.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)

@Bibo-Joshi
Copy link
Member

The failures where unrelated. I've reverted the reversion 😉

@eldbud
Copy link
Contributor Author

eldbud commented Oct 5, 2021

The failures where unrelated. I've reverted the reversion 😉

did you make sure the test passes? this is how i initially wrote it and it failed.
when updating user data, the data is saved in FILENAME_user_data. so _user_data needs to be appended to the end of the original filename. without it, the is_file assetion fails.

Does this not happen to you?

Copy link
Member

@eldbud I removed single_file=False, so we don't need the _user_data extension 😉 The one currently failing test is unrelated

@eldbud eldbud requested review from harshil21 and Poolitzer October 5, 2021 07:53
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.

good now!

@Bibo-Joshi Bibo-Joshi merged commit 6965ae9 into python-telegram-bot:v14 Oct 5, 2021
@Bibo-Joshi
Copy link
Member

Thank you for this contribution @eldbud ! Nice work :)

@eldbud eldbud deleted the pathlib-weherever-possible-2665 branch October 5, 2021 18:25
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2021
@harshil21 harshil21 added the hacktoberfest-accepted other: hacktoberfest-accepted label Oct 30, 2021
@Bibo-Joshi Bibo-Joshi added 🔌 enhancement pr description: enhancement and removed enhancement labels Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔌 enhancement pr description: enhancement hacktoberfest-accepted other: hacktoberfest-accepted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use pathlib weherever possible
7 participants