René's URL Explorer Experiment


Title: Ignoring a file with a single # type: ignore comment. by brandtbucher · Pull Request #6830 · python/mypy · GitHub

Open Graph Title: Ignoring a file with a single # type: ignore comment. by brandtbucher · Pull Request #6830 · python/mypy

X Title: Ignoring a file with a single # type: ignore comment. by brandtbucher · Pull Request #6830 · python/mypy

Description: Fixes #626. For background on the design choices, here is what our current ASTs allow us to find: In all versions of Python, we can accurately detect bare # type: ignore comments before the first statement in a module. In Python 3.8+, we can accurately detect the placement of bare # type: ignore comments within a list of statements (we need end_lineno to do this properly). In no current version of Python can we accurately detect bare # type: ignore comments before the first statement in an indented code block using the AST alone. Considering these limitations, the behavior I chose here is: All versions of Python will ignore a whole file if it contains a bare # type: ignore comment before its first statement. Python 3.8+ will ignore all statements following a bare # type: ignore comment at the top level of a module. This is now a separate PR: #6841. Bare # type: ignore comments have no special meaning inside of indented code blocks. If we were to allow this, we would need to do one of the following (and I personally don't like any of them): Not recognize them at the start of a block. 🙁 Guess where the for/while/with/class/def/try bit ends, a la decorated definitions prior to Python 3.8. 🙁 Parse the raw source of the file ourselves to see where the above block-starters end. 🙁 Modify ast parsing to tell us where the block-starters end. 🙁 A few notes: Ignoring is accomplished by nesting all remaining statements in an unreachable Block. ASTConverter.extra_type_ignores: List[int] is now ASTConverter.type_ignores: Set[int] and is populated before the AST is converted. Tests are added in check-ignore.test and check-38.test.

Open Graph Description: Fixes #626. For background on the design choices, here is what our current ASTs allow us to find: In all versions of Python, we can accurately detect bare # type: ignore comments before the first ...

X Description: Fixes #626. For background on the design choices, here is what our current ASTs allow us to find: In all versions of Python, we can accurately detect bare # type: ignore comments before the first ...

Opengraph URL: https://github.com/python/mypy/pull/6830

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:53e1e527-3c45-9972-2335-02eca0d89958
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB6E8:3C8297:1576A5:1DDA2A:6A583F13
html-safe-noncedb5a499a465522fd71bafe8be5aa9e7a233e1a5d1881d02170d65b62e5a0d672
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkU4OjNDODI5NzoxNTc2QTU6MUREQTJBOjZBNTgzRjEzIiwidmlzaXRvcl9pZCI6IjY1MzgzNzE4NTQ4NjAwNDIwMDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac32a568e90537cc9e6db15954faa34f9a6d9f7115e7fb4e0eb241fe9888b69db1
hovercard-subject-tagpull_request:278511633
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/mypy/pull/6830/files
twitter:imagehttps://avatars.githubusercontent.com/u/40968415?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40968415?s=400&v=4
og:image:altFixes #626. For background on the design choices, here is what our current ASTs allow us to find: In all versions of Python, we can accurately detect bare # type: ignore comments before the first ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/mypy/pull/6830/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F6830%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F6830%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/pull/6830/files
Reloadhttps://github.com/python/mypy/pull/6830/files
Reloadhttps://github.com/python/mypy/pull/6830/files
Please reload this pagehttps://github.com/python/mypy/pull/6830/files
python https://github.com/python
mypyhttps://github.com/python/mypy
Please reload this pagehttps://github.com/python/mypy/pull/6830/files
Notifications https://github.com/login?return_to=%2Fpython%2Fmypy
Fork 3.2k https://github.com/login?return_to=%2Fpython%2Fmypy
Star 20.5k https://github.com/login?return_to=%2Fpython%2Fmypy
Code https://github.com/python/mypy
Issues 2.7k https://github.com/python/mypy/issues
Pull requests 465 https://github.com/python/mypy/pulls
Actions https://github.com/python/mypy/actions
Projects https://github.com/python/mypy/projects
Wiki https://github.com/python/mypy/wiki
Security and quality 0 https://github.com/python/mypy/security
Insights https://github.com/python/mypy/pulse
Code https://github.com/python/mypy
Issues https://github.com/python/mypy/issues
Pull requests https://github.com/python/mypy/pulls
Actions https://github.com/python/mypy/actions
Projects https://github.com/python/mypy/projects
Wiki https://github.com/python/mypy/wiki
Security and quality https://github.com/python/mypy/security
Insights https://github.com/python/mypy/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fmypy%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fmypy%2Fissues%2Fnew%2Fchoose
gvanrossumhttps://github.com/gvanrossum
python:masterhttps://github.com/python/mypy/tree/master
Conversation 31 https://github.com/python/mypy/pull/6830
Commits 7 https://github.com/python/mypy/pull/6830/commits
Checks 0 https://github.com/python/mypy/pull/6830/checks
Files changed https://github.com/python/mypy/pull/6830/files
Please reload this pagehttps://github.com/python/mypy/pull/6830/files
Ignoring a file with a single # type: ignore comment. https://github.com/python/mypy/pull/6830/files#top
Show all changes 7 commits https://github.com/python/mypy/pull/6830/files
7a51cf2 Stop checking at bare top-level "# type: ignore" comments. brandtbucher May 14, 2019 https://github.com/python/mypy/pull/6830/commits/7a51cf24903340a4520a9b9b73967fc64210cfaf
aa11089 Test new "# type: ignore" behavior. brandtbucher May 14, 2019 https://github.com/python/mypy/pull/6830/commits/aa11089c20fad5eb242d0af07a0d80d99a2793ac
ce54ab4 Appease mypy. brandtbucher May 14, 2019 https://github.com/python/mypy/pull/6830/commits/ce54ab48d145bdc6d0e0c9bcffe6cc1631d6ef55
4567661 Add docs for new # type: ignore usage. brandtbucher May 14, 2019 https://github.com/python/mypy/pull/6830/commits/45676615883991d7ebded58b2ddd135565527261
c95b98d Code cleanup from GvR's first review. brandtbucher May 14, 2019 https://github.com/python/mypy/pull/6830/commits/c95b98ddf69d1f8b6ef2de0e2a67f73bbd7a7cca
07cc315 Break out a new section for this feature. brandtbucher May 15, 2019 https://github.com/python/mypy/pull/6830/commits/07cc3152f4b4dd9a3e5000264ac58785b3486f6f
9937b1b Back out Python 3.8 feature. brandtbucher May 16, 2019 https://github.com/python/mypy/pull/6830/commits/9937b1b4cbf555339fa500ecfac98285f2f6d16a
Clear filters https://github.com/python/mypy/pull/6830/files
Please reload this pagehttps://github.com/python/mypy/pull/6830/files
Please reload this pagehttps://github.com/python/mypy/pull/6830/files
common_issues.rst https://github.com/python/mypy/pull/6830/files#diff-6f6f317bbcf646dd0a1eb65128d8ecc9fc2c3623bb7d74635e97bcb394ac7b7a
fastparse.py https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
fastparse2.py https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
check-ignore.test https://github.com/python/mypy/pull/6830/files#diff-04c447950c68d933fddf0930675007f51ba3af965ea1d1578c693bffb6096e58
docs/source/common_issues.rsthttps://github.com/python/mypy/pull/6830/files#diff-6f6f317bbcf646dd0a1eb65128d8ecc9fc2c3623bb7d74635e97bcb394ac7b7a
View file https://github.com/python/mypy/blob/9937b1b4cbf555339fa500ecfac98285f2f6d16a/docs/source/common_issues.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/mypy/pull/6830/{{ revealButtonHref }}
https://github.com/python/mypy/pull/6830/files#diff-6f6f317bbcf646dd0a1eb65128d8ecc9fc2c3623bb7d74635e97bcb394ac7b7a
https://github.com/python/mypy/pull/6830/files#diff-6f6f317bbcf646dd0a1eb65128d8ecc9fc2c3623bb7d74635e97bcb394ac7b7a
mypy/fastparse.pyhttps://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
View file https://github.com/python/mypy/blob/9937b1b4cbf555339fa500ecfac98285f2f6d16a/mypy/fastparse.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/mypy/pull/6830/{{ revealButtonHref }}
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
https://github.com/python/mypy/pull/6830/files#diff-a7d2c40f4be6322cee498432ca9dbbc3a356c3cbcb61029231452f6638bb11b5
mypy/fastparse2.pyhttps://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
View file https://github.com/python/mypy/blob/9937b1b4cbf555339fa500ecfac98285f2f6d16a/mypy/fastparse2.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/mypy/pull/6830/{{ revealButtonHref }}
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
https://github.com/python/mypy/pull/6830/files#diff-3696210142b010eb29775fe8d6134eadff99f0924eaa43a8950e96dba9b84081
test-data/unit/check-ignore.testhttps://github.com/python/mypy/pull/6830/files#diff-04c447950c68d933fddf0930675007f51ba3af965ea1d1578c693bffb6096e58
View file https://github.com/python/mypy/blob/9937b1b4cbf555339fa500ecfac98285f2f6d16a/test-data/unit/check-ignore.test
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/mypy/pull/6830/{{ revealButtonHref }}
https://github.com/python/mypy/pull/6830/files#diff-04c447950c68d933fddf0930675007f51ba3af965ea1d1578c693bffb6096e58
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.