BeanieODM / beanie

Asynchronous Python ODM for MongoDB
http://beanie-odm.dev/
Apache License 2.0
2.04k stars 215 forks source link

VSCode pylance langauge server and its type checker, pyright reports some errors for the code example in doc site #142

Closed grimmer0125 closed 1 year ago

grimmer0125 commented 2 years ago

beanie ver.: 1.7.0 os: macOS 11.6, m1 machine VSCode: 1.60.1 VSCode Python extension: v2021.9.1246542782

  1. Indexed: (related to #10, #59, #105)

    Illegal type annotation: call expression not allowed Pylance(reportGeneralTypeIssues)
  2. "motor_asyncio" is not a known member of module Pylance(reportGeneralTypeIssues), will be solved by #147

  3. await product.set({Product.name: "Gold bar"}) a. "Product" is not awaitable Pylance(reportGeneralTypeIssues) b. "set" is not a known member of "None" Pylance(reportOptionalMemberAccess)

Pylance ref: https://github.com/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md#diagnostic-severity-rules

To temporarily suppress this errors:

  1. within a file, put # pyright: reportGeneralTypeIssues=warning, reportOptionalMemberAccess=warning. (or warning-> false) at the top of the file
  2. single line: put this at the end of the line # type: ignore (PEP484)
截圖 2021-11-17 下午2 17 53
roman-right commented 2 years ago

Hey @grimmer0125 ,

Good catch. Thank you.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 14 days with no activity.