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

mypy type error for pager #991

Description

@tmshn

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version: macOS/debian
  • Python version: python --version 3.9.1
  • pip version: pip --version 21.0.1
  • google-cloud-datacatalog version: pip show google-cloud-datacatalog 3.2.0
  • mypy version: 0.812

Steps to reproduce

  1. use DataCatlogClient#list_tags in for-loop
  2. check that code using mypy

Code example

from google.cloud import datacatalog

dcclient = datacatalog.DataCatalogClient()
for tag in dcclient.list_tags(parent="dummy"):
    print(tag)

Error

$ mypy snippet.py
snippet.py:4:12: error: "Iterable[Tag]" has no attribute "__next__"
Found 1 error in 1 file (checked 1 source file)

I suspect this is due to the return type of ListTagsPager#__iter__ is annotated as Iterable rather than Iterator, but not sure (according to the Python protocol, Iterable only offers __iter__ method, while Iterator offers __next__).

https://github.com/googleapis/python-datacatalog/blob/936800c92a348b8ce438c4b608f17fe6d9f926a1/google/cloud/datacatalog_v1beta1/services/data_catalog/pagers.py#L470

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions