fix(google-auth): invalid TYPE_CHECKING imports in google/auth/_default.py cause Unknown types in Pyright
Los mantenedores suelen responder en 1 día
@sakshamgoyal-01 ya está trabajando en esto.
Desde el 13/11/2026.
- #19078 de @sakshamgoyal-01 — abierto
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- authentication
Línea de trabajo
The problem is in the TYPE_CHECKING block at the top of google/auth/_default.py, which imports the classes google.auth.credentials.Credentials and google.auth.transport.Request as if they were modules. Check the annotations on default() to see where Pyright reports Unknown. Pull request 19078 is already open against this issue, so review that first. Done means the block imports the modules and Pyright no longer reports Unknown for default().
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
(Note: This is an AI-generated issue.)
Problem
In google/auth/_default.py, the TYPE_CHECKING block attempts to import classes as if they were submodules:
if TYPE_CHECKING: # pragma: NO COVER
import google.auth.credentials.Credentials # type: ignore
import google.auth.transport.Request # type: ignore
Because Credentials and Request are classes (not submodules), these imports fail to resolve and are suppressed with # type: ignore. As a result, type checkers like Pyright / BasedPyright resolve the annotations on google.auth.default():
def default(
scopes: Optional[Sequence[str]] = None,
request: Optional["google.auth.transport.Request"] = None,
quota_project_id: Optional[str] = None,
default_scopes: Optional[Sequence[str]] = None,
) -> tuple["google.auth.credentials.Credentials", Optional[str]]:
as Unknown (e.g., (..., request: Unknown | None = None, ...) -> tuple[Unknown, str | None]), triggering reportUnknownVariableType / reportUnknownMemberType warnings for callers.
Suggested Fix
Import the modules instead of the classes in the TYPE_CHECKING block:
if TYPE_CHECKING: # pragma: NO COVER
import google.auth.credentials
import google.auth.transport
- Lenguaje dominante
- Python
- Estrellas
- 5.4k
- Forks
- 1.8k
- Merge medio
- 2 d 7 h
- PR fusionados (30 d)
- 173
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de googleapis/google-cloud-python
-
firestore: field path with a quoted name ending in a backslash is misparsedPosiblemente ocupada @sebxt la tomó hace 25 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
googleapis/google-cloud-python#18771 ·
Los mantenedores suelen responder en 1 día
-
api: spanner type: feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
googleapis/google-cloud-python#18584 ·
Los mantenedores suelen responder en 1 día
-
auth: `impersonated_credentials` loses `subject` on copy, so `with_scopes()` and `with_quota_project()` turn off domain wide delegationPosiblemente ocupada @Om-singhaI la tomó hace 55 días. Abiertoauth priority: p2 type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
googleapis/google-cloud-python#18428 ·
Los mantenedores suelen responder en 1 día
-
A client called `run_in_transaction` be stuck if Spanner is downPosiblemente ocupada @founderinaction la tomó hace 7 días. Abiertopriority: p2 type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
googleapis/google-cloud-python#18375 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
ci: enable --strict flag in presubmit twine_checkQuizá libre de nuevo @ohmayr la tomó hace 44 días y no hay ningún pull request abierto. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
googleapis/google-cloud-python#18339 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de googleapis/google-cloud-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
cpp-best-practices/project_validator#267 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Project-N-E-K-O/N.E.K.O#3725 ·
Los mantenedores suelen responder en 1 día
-
[Bug] Sending a Telegram message chain twice duplicates mentionsPosiblemente ocupada @123XieC la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AstrBotDevs/AstrBot#11125 ·
Los mantenedores suelen responder en 1 día
-
backend bug priority: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nooriegarg/ContribIQ#73 ·
Los mantenedores suelen responder en 1 día
-
bug p3 security
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
amd/gaia#8197 · 2 comentarios ·
Los mantenedores suelen responder en 1 día