Azure / Azure/azure-sdk-tools

[Python APIView] Type annotation rendered as 'any' instead of 'Any' for HttpRequest.content

Open
#14,580 0 comments 0 reactions 0 assignees View on GitHub
APIView customer-reported Python question
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

Bad code snippet:

content: any

What it should do:
- The language parser is rendering the typing annotation as the built-in name "any" instead of the typing type. "any" is a built-in function, not a typing type, so the stub is misleading and can cause errors or incorrect type information. The parser should render the annotation as typing.Any (or Any with an appropriate import).

Good code snippets:

Option A (preferred, explicit import):
from typing import Any

content: Any

Option B (qualified):
import typing

content: typing.Any

Please fix the parser so that type annotations referring to the generic Any are rendered as typing.Any or Any with the corresponding import, rather than the built-in name "any".

Contributor guide

Open the contributing guide

Research direction

Start with the APIView language parser and reproduce the issue using the HttpRequest.content annotation shown in the report. Trace how the generic Any annotation is rendered; done means the generated stub uses typing.Any or Any with an appropriate import instead of the built-in any.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.