Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ There are several interesting things to note here:
The `optional` or `default = ...` part don't influence the annotation.

- Referencing the `float` and `Iterable` worked out of the box.
All [built-in types](https://docs.python.org/3/library/stdtypes.html#built-in-types) as well as types from the standard library's `typing` and `collections.abc` module can be used like this.
All [built-in types](https://docs.python.org/3/library/stdtypes.html#built-in-types) as well as types from the standard library's `typing`, `types` and `collections.abc` module can be used like this.
Necessary imports will be added automatically to the stub file.


Expand Down
1 change: 1 addition & 0 deletions src/docstub/_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def common_known_types():
types |= _runtime_types_in_module("typing")
# Overrides containers from typing
types |= _runtime_types_in_module("collections.abc")
types |= _runtime_types_in_module("types")
return types


Expand Down
2 changes: 2 additions & 0 deletions tests/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ def test_query_prefix(self, search_name, expected_name, expected_origin):
("collections.abc.Iterable", "collections.abc"),
("Literal", "typing"),
("typing.Literal", "typing"),
("NoneType", "types"),
("SimpleNamespace", "types"),
],
)
def test_common_known_types(self, search_name, import_path):
Expand Down
Loading