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

Add the rest of string.Template's class attributes #6109

Merged
merged 3 commits into from
Oct 5, 2021

Conversation

kbrose
Copy link
Contributor

@kbrose kbrose commented Oct 4, 2021

Adds the following attributes to string.Template.

$ stubtest --custom-typeshed-dir . string --concise
string.Template.braceidpattern is not present in stub
string.Template.delimiter is not present in stub
string.Template.flags is not present in stub
string.Template.idpattern is not present in stub
string.Template.pattern is not present in stub

Also just wanted to say thanks for the fantastic Good ways to contribute issue.

@github-actions

This comment has been minimized.

4 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@kbrose
Copy link
Contributor Author

kbrose commented Oct 5, 2021

I'm not sure what the cause is, but any importing of the re package breaks the stubtest for the Markdown package.

@github-actions

This comment has been minimized.

@hauntsaninja
Copy link
Collaborator

That's extremely weird. It does appear to be a genuine mistake in the markdown stubs, but I do not see why this change is at all related. @JelleZijlstra any idea what's going on?

hauntsaninja pushed a commit to hauntsaninja/typeshed that referenced this pull request Oct 5, 2021
@hauntsaninja
Copy link
Collaborator

Maybe #6115 will help :-)

JelleZijlstra pushed a commit that referenced this pull request Oct 5, 2021
Surfaced weirdly by #6109

Co-authored-by: hauntsaninja <>
@@ -1,4 +1,5 @@
from typing import Any, Iterable, Mapping, Sequence, Tuple
# from re import RegexFlag # Importing from regex breaks the Markdown stubtest
from typing import Any, Iterable, Mapping, Pattern, Sequence, Tuple
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's hopefully fixed now if you merge in master. Also, Pattern should be imported from re, not typing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@kbrose
Copy link
Contributor Author

kbrose commented Oct 5, 2021

Appreciate the help, I've rebased from master and took the opportunity to clean up the commits. I'll admit I still don't understand how import re here affects the Markdown package, even after looking at the MR that fixes it.

@github-actions

This comment has been minimized.

@kbrose
Copy link
Contributor Author

kbrose commented Oct 5, 2021

I also can't explain the above below diff in poetry.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2021

Diff from mypy_primer, showing the effect of this PR on open source code:

poetry (https://github.com/python-poetry/poetry.git)
- poetry/plugins/plugin_manager.py:22: error: Need type annotation for "_plugins" (hint: "_plugins: List[<type>] = ...")
+ poetry/mixology/failure.py:144: error: Item "RootCause" of "Union[RootCause, NoVersionsCause, DependencyCause, ConflictCause, PythonCause, PlatformCause, PackageNotFoundCause]" has no attribute "conflict"

Comment on lines +5 to +8
if sys.version_info >= (3, 8):
from re import Pattern
else:
from typing import Pattern
Copy link
Collaborator

Choose a reason for hiding this comment

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

I just noticed that Pattern is not re-exported from re in Python 3.6. My mistake.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

The primer report hints at a real problem with poetry.

@srittau srittau merged commit 47e9788 into python:master Oct 5, 2021
@kbrose kbrose deleted the string-template branch October 5, 2021 17:22
@hauntsaninja
Copy link
Collaborator

Awesome, thanks for your contribution and for working through the several (some mysterious) issues!

@kbrose
Copy link
Contributor Author

kbrose commented Oct 6, 2021

I wouldn't say I "worked through them", but rather "did nothing and had others fix the problem for me" :)

Once again appreciate the reviews and help on this. Cheers.

Sign up for free to 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.

3 participants