Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

fix: type hinting in collection.py - #688

Merged
Mariatta merged 3 commits into
googleapis:mainfrom
Sugihiru:patch-1
Feb 17, 2023
Merged

fix: type hinting in collection.py#688
Mariatta merged 3 commits into
googleapis:mainfrom
Sugihiru:patch-1

Conversation

@Sugihiru

Copy link
Copy Markdown
Contributor

Mostly adding | None on all fields that may have None as a default value.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes#687 🦕

@Sugihiru
Sugihiru requested review from a teamFebruary 8, 2023 15:33
@product-auto-labelproduct-auto-labelBot added size: s Pull request size is small. api: firestore Issues related to the googleapis/python-firestore API. labels Feb 8, 2023
Mostly adding `| None` on all fields that may have `None` as a default value.

@MariattaMariatta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@MariattaMariatta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The | syntax is only available in Python 3.10+. Since we still support Python 3.7+, then this should be using Union instead of |.

e.g

from typing import Union
...
document_id: Union[str, None]

Use Union to be compatible with 3.7
@MariattaMariatta changed the title Fix type hinting in collection.pyfix: type hinting in collection.pyFeb 16, 2023
@MariattaMariatta added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 16, 2023
@gcf-owl-botgcf-owl-botBot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 16, 2023
@MariattaMariatta added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 17, 2023
@gcf-owl-botgcf-owl-botBot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 17, 2023

@MariattaMariatta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Mariatta
Mariatta merged commit bfb97c2 into googleapis:mainFeb 17, 2023
@release-pleaserelease-pleaseBot mentioned this pull request Feb 17, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: firestoreIssues related to the googleapis/python-firestore API.size: sPull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pylance Typing for collections

2 participants

@Sugihiru@Mariatta