Skip to content

Pathlib weherever possible 2665 - #2688

Merged
Bibo-Joshi merged 38 commits into
python-telegram-bot:v14from
eldbud:pathlib-weherever-possible-2665
Oct 5, 2021
Merged

Pathlib weherever possible 2665#2688
Bibo-Joshi merged 38 commits into
python-telegram-bot:v14from
eldbud:pathlib-weherever-possible-2665

Conversation

@eldbud

@eldbud eldbud commented Oct 2, 2021

Copy link
Copy Markdown
Contributor

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

@Poolitzer Poolitzer 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.

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.

Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated

@Bibo-Joshi Bibo-Joshi 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.

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

Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/files/file.py Outdated
Comment thread telegram/files/file.py Outdated
Comment thread telegram/files/file.py
Comment thread telegram/files/file.py Outdated
Comment thread telegram/files/inputfile.py Outdated
Comment thread telegram/request.py Outdated
Comment thread tests/test_file.py Outdated
Comment thread tests/test_inputfile.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/files/file.py Outdated
Comment thread telegram/files/file.py Outdated
Comment thread telegram/files/file.py Outdated
Comment thread telegram/files/file.py Outdated
Comment thread telegram/request.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/files/file.py Outdated

@harshil21 harshil21 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.

round 2 of reviews

Comment thread telegram/dice.py Outdated
Comment thread telegram/ext/dispatcher.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/files/file.py Outdated

@Bibo-Joshi Bibo-Joshi 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.

Thanks for the new updates and sorry for making your merge-life harder unintentionally 😬
I think we're pretty much down to nitpicking details :)

Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread tests/test_persistence.py
Comment thread tests/test_request.py Outdated
Comment thread telegram/ext/dispatcher.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
…le.py, added a parametrized test_filepath_argument_types in test_persistence.py, and added test_download in test_request.py

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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 :)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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 :)

Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread telegram/ext/picklepersistence.py Outdated
Comment thread tests/test_persistence.py Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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 Bibo-Joshi 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 tests run and @harshil21 approves as well, we can merge :)

@eldbud

eldbud commented Oct 4, 2021

Copy link
Copy Markdown
Contributor Author

@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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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 :)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@eldbud

eldbud commented Oct 5, 2021

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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 Poolitzer and harshil21 October 5, 2021 07:53

@harshil21 harshil21 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.

good now!

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

Copy link
Copy Markdown
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