René's URL Explorer Experiment


Title: Incorrect type reported by type checker for async properties · Issue #63 · python-sdbus/python-sdbus-networkmanager · GitHub

Open Graph Title: Incorrect type reported by type checker for async properties · Issue #63 · python-sdbus/python-sdbus-networkmanager

X Title: Incorrect type reported by type checker for async properties · Issue #63 · python-sdbus/python-sdbus-networkmanager

Description: When trying to access an async property of an interface, both mypy and pyright report the wrong type. In this example, I'd expect access_point.ssid to report type bytes, but it doesn't. Also, if I call get_async() directly it reports a d...

Open Graph Description: When trying to access an async property of an interface, both mypy and pyright report the wrong type. In this example, I'd expect access_point.ssid to report type bytes, but it doesn't. Also, if I ...

X Description: When trying to access an async property of an interface, both mypy and pyright report the wrong type. In this example, I'd expect access_point.ssid to report type bytes, but it doesn't. Als...

Opengraph URL: https://github.com/python-sdbus/python-sdbus-networkmanager/issues/63

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect type reported by type checker for async properties","articleBody":"When trying to access an async property of an interface, both **mypy** and **pyright** report the wrong type. In this example, I'd expect `access_point.ssid` to report type `bytes`, but it doesn't. Also, if I call `get_async()` directly it reports a different type for pyright.\r\n\r\n```py\r\nimport sdbus\r\nimport sdbus_async.networkmanager as nm\r\nfrom typing import reveal_type\r\n\r\nsystem_bus = sdbus.sd_bus_open_system()\r\n\r\nasync def get_wifi_connections(wifi_device: nm.NetworkDeviceWireless):\r\n    for path in await wifi_device.get_all_access_points():\r\n        access_point = nm.AccessPoint(path, system_bus)\r\n        ssid = await access_point.ssid\r\n        reveal_type(ssid)\r\n        ssid = await access_point.ssid.get_async()\r\n  reveal_type(ssid)\r\n```\r\n\r\nmypy output:\r\n\r\n```\r\n$ mypy type_test_async.py\r\ntype_test_async.py:10: error: Need type annotation for \"ssid\"  [var-annotated]\r\ntype_test_async.py:11: note: Revealed type is \"Any\"\r\ntype_test_async.py:13: note: Revealed type is \"Any\"\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\r\n\r\npyright output:\r\n\r\n ```\r\n$ pyright type_test_async.py\r\n./type_test_async.py\r\n  ./type_test_async.py:11:21 - information: Type of \"ssid\" is \"T@__await__\"\r\n  ./type_test_async.py:13:21 - information: Type of \"ssid\" is \"Unknown\"\r\n0 errors, 0 warnings, 2 informations \r\n ```\r\n\r\n\r\nIn both cases, I would expect for the revealed type to be `bytes`. At runtime, my code works and `reveal_type` prints `Runtime type is 'bytes'`, so I guess the problem has to do with the type hints. Also, the blocking API doesn't have this problem and correctly report `bytes`.\r\n\r\n```py\r\nimport sdbus\r\nimport sdbus_block.networkmanager as nm_block\r\nfrom typing import reveal_type\r\n\r\nsystem_bus = sdbus.sd_bus_open_system()\r\n\r\ndef get_wifi_block_connections(wifi_device: nm_block.NetworkDeviceWireless):\r\n    for path in wifi_device.access_points:\r\n        access_point = nm_block.AccessPoint(path, system_bus)\r\n        ssid = access_point.ssid\r\n        reveal_type(ssid)  # Both mypy and pyright report `bytes`\r\n```\r\n\r\nI'm using:\r\n- mypy 1.8.0\r\n- pyright 1.1.350\r\n- python 3.11.7\r\n","author":{"url":"https://github.com/ValdezFOmar","@type":"Person","name":"ValdezFOmar"},"datePublished":"2024-02-15T09:25:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/63/python-sdbus-networkmanager/issues/63"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4085cf27-5bd4-7d9d-ac05-ed5a22694f03
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id99A8:36A8E0:D29B41:115433C:698D7046
html-safe-nonce0c065f1d19c1d3a166b263df093d18365bfd8c684021364ae563fea061b363a4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OUE4OjM2QThFMDpEMjlCNDE6MTE1NDMzQzo2OThENzA0NiIsInZpc2l0b3JfaWQiOiI0OTkxMTQzODAyNTc3NTExMTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1996fb36f1259de6e5c6067bd197656ad951ffd1620282a8b91b38224e524dd6
hovercard-subject-tagissue:2136042232
github-keyboard-shortcutsrepository,issues,network-graph,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-sdbus/python-sdbus-networkmanager/63/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5271d7332bb3d0d37f30b805127bc9180d3192870c9e26d20ade59e22c2a8441/python-sdbus/python-sdbus-networkmanager/issues/63
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5271d7332bb3d0d37f30b805127bc9180d3192870c9e26d20ade59e22c2a8441/python-sdbus/python-sdbus-networkmanager/issues/63
og:image:altWhen trying to access an async property of an interface, both mypy and pyright report the wrong type. In this example, I'd expect access_point.ssid to report type bytes, but it doesn't. Also, if I ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameValdezFOmar
hostnamegithub.com
expected-hostnamegithub.com
Nonec0818105fa276287e9369cfdefa0a0fa7953719791ceff9b94d69623c0a4fe8a
turbo-cache-controlno-preview
go-importgithub.com/python-sdbus/python-sdbus-networkmanager git https://github.com/python-sdbus/python-sdbus-networkmanager.git
octolytics-dimension-user_id88226657
octolytics-dimension-user_loginpython-sdbus
octolytics-dimension-repository_id384529652
octolytics-dimension-repository_nwopython-sdbus/python-sdbus-networkmanager
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id384529652
octolytics-dimension-repository_network_root_nwopython-sdbus/python-sdbus-networkmanager
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release715890fa442134f528fb422ab338c0ad55c7a025
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-sdbus/python-sdbus-networkmanager/issues/63#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-sdbus%2Fpython-sdbus-networkmanager%2Fissues%2F63
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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-sdbus%2Fpython-sdbus-networkmanager%2Fissues%2F63
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-sdbus%2Fpython-sdbus-networkmanager
Reloadhttps://github.com/python-sdbus/python-sdbus-networkmanager/issues/63
Reloadhttps://github.com/python-sdbus/python-sdbus-networkmanager/issues/63
Reloadhttps://github.com/python-sdbus/python-sdbus-networkmanager/issues/63
python-sdbus https://github.com/python-sdbus
python-sdbus-networkmanagerhttps://github.com/python-sdbus/python-sdbus-networkmanager
Notifications https://github.com/login?return_to=%2Fpython-sdbus%2Fpython-sdbus-networkmanager
Fork 11 https://github.com/login?return_to=%2Fpython-sdbus%2Fpython-sdbus-networkmanager
Star 43 https://github.com/login?return_to=%2Fpython-sdbus%2Fpython-sdbus-networkmanager
Code https://github.com/python-sdbus/python-sdbus-networkmanager
Issues 2 https://github.com/python-sdbus/python-sdbus-networkmanager/issues
Pull requests 1 https://github.com/python-sdbus/python-sdbus-networkmanager/pulls
Discussions https://github.com/python-sdbus/python-sdbus-networkmanager/discussions
Actions https://github.com/python-sdbus/python-sdbus-networkmanager/actions
Security 0 https://github.com/python-sdbus/python-sdbus-networkmanager/security
Insights https://github.com/python-sdbus/python-sdbus-networkmanager/pulse
Code https://github.com/python-sdbus/python-sdbus-networkmanager
Issues https://github.com/python-sdbus/python-sdbus-networkmanager/issues
Pull requests https://github.com/python-sdbus/python-sdbus-networkmanager/pulls
Discussions https://github.com/python-sdbus/python-sdbus-networkmanager/discussions
Actions https://github.com/python-sdbus/python-sdbus-networkmanager/actions
Security https://github.com/python-sdbus/python-sdbus-networkmanager/security
Insights https://github.com/python-sdbus/python-sdbus-networkmanager/pulse
New issuehttps://github.com/login?return_to=https://github.com/python-sdbus/python-sdbus-networkmanager/issues/63
New issuehttps://github.com/login?return_to=https://github.com/python-sdbus/python-sdbus-networkmanager/issues/63
Incorrect type reported by type checker for async propertieshttps://github.com/python-sdbus/python-sdbus-networkmanager/issues/63#top
https://github.com/ValdezFOmar
https://github.com/ValdezFOmar
ValdezFOmarhttps://github.com/ValdezFOmar
on Feb 15, 2024https://github.com/python-sdbus/python-sdbus-networkmanager/issues/63#issue-2136042232
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.