Skip to content
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

Pylance is not satisfied with the typings #570

Closed
NixBiks opened this issue Apr 23, 2022 · 3 comments
Closed

Pylance is not satisfied with the typings #570

NixBiks opened this issue Apr 23, 2022 · 3 comments
Labels
api: firestore Issues related to the googleapis/python-firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.

Comments

@NixBiks
Copy link

NixBiks commented Apr 23, 2022

I'm using VSCode with pylance (as I think most python developers do).

If I use the async example from the docs then I'm getting a type error

Argument of type "Literal[_MethodDefault._DEFAULT_VALUE]" cannot be assigned to parameter "retry" of type "Retry" in function "get"
  "Literal[_MethodDefault._DEFAULT_VALUE]" is incompatible with "Retry" Pylance(reportGeneralTypeIssues)

Environment details

  • OS type and version: macOS 12.3.1
  • Python version: 3.9.9
  • pip version: 22.04
  • google-cloud-firestore version: 2.4.0

Steps to reproduce

Create example from docs

from google.cloud import firestore


async def abc():
    db = firestore.AsyncClient()
    doc_ref = db.collection("cities").document("SF")

    doc = await doc_ref.get()
    if doc.exists:
        print(f"Document data: {doc.to_dict()}")
    else:
        print("No such document!")

Let me know if you need more information

Screenshot 2022-04-23 at 15 59 02

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Apr 23, 2022
@NixBiks
Copy link
Author

NixBiks commented Apr 23, 2022

So I guess it's because it expects Retry class as argument but _MethodDefault._DEFAULT_VALUE is given which is just equal to object(). Would it be possible to simply have _MethodDefault._DEFAULT_VALUE = Retry() instead? or expect Retry | object in the args (same goes for update, delete, set etc.)

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 24, 2022
@casparolesen
Copy link

We're having the same problem here. Sucks to have to ignore a bunch of lines.

@meredithslota meredithslota added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern. and removed 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jun 21, 2022
@meredithslota
Copy link
Contributor

Agreed — we need to overhaul our typing here, and I'm consolidating related issues (you aren't alone in this complain) into one: #447 Thanks for filing this, and thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

4 participants