GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — typeform: remove a regex call, rearrange checks by JelleZijlstra · Pull Request #21459 · python/mypy

typeform: remove a regex call, rearrange checks #21459

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.

Sign up for GitHub

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
JelleZijlstra merged 5 commits into python:master from JelleZijlstra:isidentifier
May 10, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

typeform: remove a regex call, rearrange checks #21459

Changes from 1 commit
Commits
Show all changes
5 commits
Select commit Hold shift + click to select a range
7468f00
typeform: remove a regex call
JelleZijlstra May 10, 2026
17fa7b9
rearrange a bit
JelleZijlstra May 10, 2026
e75a7a6
catch punctuation
JelleZijlstra May 10, 2026
7e3f058
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 10, 2026
3419c41
len < 2
JelleZijlstra May 10, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
rearrange a bit
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@JelleZijlstra
JelleZijlstra committed May 10, 2026
commit 17fa7b947565b63eab3dd551c336ee28de79edfc

There are no files selected for viewing

22 changes: 11 additions & 11 deletions 22 mypy/semanal.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8036,13 +8036,6 @@ def try_parse_as_type_expression(self, maybe_type_expr: Expression) -> None:
return
elif isinstance(maybe_type_expr, StrExpr):
str_value = maybe_type_expr.value # cache
# Filter out string literals with common patterns that could not
# possibly be in a type expression
if _MULTIPLE_WORDS_NONTYPE_RE.match(str_value):
# A common pattern in string literals containing a sentence.
# But cannot be a type expression.
maybe_type_expr.as_type = None
return
# Filter out string literals which look like an identifier but
# cannot be a type expression, for a few common reasons
if str_value.isidentifier():
Expand Down Expand Up @@ -8071,13 +8064,20 @@ def try_parse_as_type_expression(self, maybe_type_expr: Expression) -> None:
return
else: # does not look like an identifier
if '"' in str_value or "'" in str_value:
# Only valid inside a Literal[...] type
# Only valid inside a Literal[...] or Annotated[..., ...] type
if "[" not in str_value:
# Cannot be a Literal[...] type
# Cannot be a Literal[...] or Annotated[..., ...] type
maybe_type_expr.as_type = None
return
elif str_value == "":
# Empty string is not a valid type
elif str_value == "" or str_value.isspace():
# Empty or whitespace-only string is not a valid type
maybe_type_expr.as_type = None
return
# Filter out string literals with common patterns that could not
# possibly be in a type expression
if _MULTIPLE_WORDS_NONTYPE_RE.match(str_value):
# A common pattern in string literals containing a sentence.
# But cannot be a type expression.
maybe_type_expr.as_type = None
return
elif isinstance(maybe_type_expr, IndexExpr):
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.