Bare list/dict annotations leave GoogleAdsClient.get_service and generated request params partially unknown

Aberta
#1,093 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
74/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
grpc, python

Direção de pesquisa

Start with google/ads/googleads/client.py and the ads generator client.py.j2 template named in the issue, then reproduce the strict pyright diagnostics with the provided example. Update the annotations at both locations and verify that get_service and generated request parameters no longer produce partially unknown types; the issue describes these as annotation-only changes with no runtime effect.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

With google-ads 31.0.0 under pyright strict, two annotations without type arguments make every call site report reportUnknownMemberType:

  • GoogleAdsClient.get_service(..., interceptors: Union[list, None] = None, ...) in google/ads/googleads/client.py. list[grpc.UnaryUnaryClientInterceptor] or Sequence[...] would type it.
  • Every generated service method: request: Optional[Union[<Request>, dict]] = None, for example ConversionUploadServiceClient.upload_click_conversions. This comes from the ads generator template (packages/gapic-generator/gapic/ads-templates/.../client.py.j2 in googleapis/google-cloud-python). Dict[str, Any] would type it.

Repro:

from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.v24.services.services.conversion_upload_service import ConversionUploadServiceClient

def f(c: GoogleAdsClient, s: ConversionUploadServiceClient) -> None:
    c.get_service("ConversionUploadService")  # Type of "get_service" is partially unknown
    s.upload_click_conversions(request=None)  # Type of "upload_click_conversions" is partially unknown

These are annotation-only changes with no runtime effect. Callers currently work around them with local Protocols.

Linguagem predominante
Python
Estrelas
760
Forks
547
Merge médio
2h 16min
PRs com merge (30d)
3

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de googleads/google-ads-python

Todas as issues de googleads/google-ads-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.