Skip to content

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

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

Merged
merged 3 commits into from
Oct 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions stdlib/string.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import sys
from re import RegexFlag
from typing import Any, Iterable, Mapping, Sequence, Tuple

if sys.version_info >= (3, 8):
from re import Pattern
else:
from typing import Pattern
Comment on lines +5 to +8
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.


ascii_letters: str
ascii_lowercase: str
ascii_uppercase: str
Expand All @@ -14,6 +21,11 @@ def capwords(s: str, sep: str | None = ...) -> str: ...

class Template:
template: str
delimiter: str
idpattern: str
braceidpattern: str | None
flags: RegexFlag
pattern: Pattern[str]
def __init__(self, template: str) -> None: ...
def substitute(self, __mapping: Mapping[str, object] = ..., **kwds: object) -> str: ...
def safe_substitute(self, __mapping: Mapping[str, object] = ..., **kwds: object) -> str: ...
Expand Down