8000 [cloud.logging] CloudLoggingHandler: bad typing for constructor (transport's type is inferred as type[BackgroundThreadTransport]) · Issue #901 · googleapis/python-logging · GitHub
[go: up one dir, main page]

Skip to content 8000
[cloud.logging] CloudLoggingHandler: bad typing for constructor (transport's type is inferred as type[BackgroundThreadTransport]) #901
Closed
@evil-shrike

Description

@evil-shrike

VSCode's Python plugin can't understand the type of transport argument for CloudLoggingHandler's constructor. It expects to see BackgroundThreadTransport class instead of base.Transport.
So a call with SyncTransport is reported as an error:

import google.cloud.logging
from google.cloud.logging.handlers import CloudLoggingHandler, setup_logging
from google.cloud.logging.handlers.transports import SyncTransport

client = google.cloud.logging.Client()
handler = CloudLoggingHandler(client, name=LOGGER_NAME, transport=SyncTransport)

Argument of type "type[SyncTransport]" cannot be assigned to parameter "transport" of type "type[BackgroundThreadTransport]" in function "init"
"type[SyncTransport]" is incompatible with "type[BackgroundThreadTransport]"

image

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/python-logging API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0