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

Manage indentation with textwrap #338

Open
opavlyuk opened this issue Sep 13, 2019 · 9 comments
Open

Manage indentation with textwrap #338

opavlyuk opened this issue Sep 13, 2019 · 9 comments
Labels

Comments

@opavlyuk
Copy link

Since python2 will not be maintained soon, according to DRY, may be it would be a good idea to replace (make aliases) dill indentation methods with ones from core library?
For example, dill.source.indent with textwrap.indent, dill.source.outdent with textwrap.dedent.

If python2 support is critical, then dill methods could be refactored, using python2.7 textwrap.

If the idea is acceptable in general, I could provide a patch.

@opavlyuk
Copy link
Author

opavlyuk commented Oct 7, 2019

Looks unnecessary.

@opavlyuk opavlyuk closed this as completed Oct 7, 2019
@mmckerns
Copy link
Member

mmckerns commented Oct 7, 2019

Thanks for the thoughts @opavlyuk, I'll look at what you suggest regardless.

@opavlyuk
Copy link
Author

opavlyuk commented Oct 8, 2019

@mmckerns Thanks, may be it might be useful for the project.

@mmckerns mmckerns added this to the dill-0.3.2 milestone Oct 8, 2019
@opavlyuk opavlyuk reopened this Oct 17, 2019
@mmckerns mmckerns modified the milestones: dill-0.3.2, dill-0.3.3 Jun 15, 2020
@mmckerns
Copy link
Member

mmckerns commented Nov 2, 2020

Kicking this down the road a bit. Support for 2.7 will end soon, so that's probably the appropriate time to deal with this.

@mmckerns mmckerns modified the milestones: dill-0.3.3, dill-0.3.4 Nov 2, 2020
@mmckerns
Copy link
Member

Support for 2.7 will end before dill-0.3.5 #413

@mmckerns mmckerns modified the milestones: dill-0.3.4, dill-0.3.5 Jun 13, 2021
@mmckerns
Copy link
Member

dill-0.3.6 will not support 2.7, support will be dropped imminently

@mmckerns
Copy link
Member

2.7 is no longer supported

@mmckerns
Copy link
Member

There's a difference in the intent:
textwrap.dedent(text) and textwrap.indent(text, prefix, predicate=None)
are intended to shift text, while dill.source.indent(code, spaces=4) and dill.source(code, spaces=None, all=True) is intended to (identify and) shift blocks of code (e.g. inside a def).

I think one would need a bunch of existing logic with only a little replaced with dedent. While on the other hand, dill.source.indent may be able to build a complex predicate or predicates that can replace most of its code.

Will need more investigation...

@mmckerns
Copy link
Member

I'm going to punt this (again) to the next milestone, and come back to it after the pending release.

@mmckerns mmckerns modified the milestones: dill-0.3.6, dill-0.3.7 Jul 24, 2022
@mmckerns mmckerns modified the milestones: dill-0.3.7, dill-0.3.8 Feb 2, 2023
@mmckerns mmckerns modified the milestones: dill-0.3.8, dill-0.3.9 Nov 14, 2023
@mmckerns mmckerns removed this from the dill-0.3.9 milestone Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants