Skip to content

A more accurate termcolor.colored fallback - #9435

Merged
AlexWaygood merged 2 commits into
python:mainfrom
Avasam:termcolor.colored-type-declaration
Dec 31, 2022
Merged

A more accurate termcolor.colored fallback#9435
AlexWaygood merged 2 commits into
python:mainfrom
Avasam:termcolor.colored-type-declaration

Conversation

@Avasam

@AvasamAvasam commented Dec 31, 2022

Copy link
Copy Markdown
Collaborator

utils.colored's signature now correctly reflects termcolor.colored
Attempt in scripts/runtests.py to deduplicate the same fallback (using utils module in an outside folder).
I think the solution is fine, but you tell me. VSCode can pick-up the source just fine, mypy might need an extra mypy_path="tests" to remove # type: ignore[import] at line 13.
Edit: Apparently it wasn't a great solution (see comments below)

@AlexWaygood

Copy link
Copy Markdown
Member

Eeeeee, I have a strong aversion to mucking about with sys.path 😅 I've heard lots of horror stories about where that gets you...

@Avasam

Avasam commented Dec 31, 2022

Copy link
Copy Markdown
CollaboratorAuthor

[...] I've heard lots of horror stories about where that gets you...

I'll trust your experience on that !
If there's no better solution, it's not that bad of a code duplication, so I can go back to using a fallback (but the one with proper signature).
I was thinking eventually it could use the test scripts directly from within python, instead of having to call a subprocess.

@AlexWaygood

Copy link
Copy Markdown
Member

If there's no better solution, it's not that bad of a code duplication, so I can go back to using a fallback (but the one with proper signature).

Yeah, that sounds fine to me for now :)

@AlexWaygood
AlexWaygood merged commit 46f0d91 into python:mainDec 31, 2022
@Avasam
Avasam deleted the termcolor.colored-type-declaration branch December 31, 2022 23:17
@AlexWaygoodAlexWaygood changed the title Accurate, deduplicated, termcolor.colored fallbackA more accurate termcolor.colored fallbackJan 1, 2023
Sign up for freeto 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.

2 participants

@Avasam@AlexWaygood