Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

rominf/ordered-set-stubs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ordered-set-stubs - stubs with type annotations for ordered-set Python library

Archived - now type annotations are the part of the ordered-set library itself.

Usage

For example, you have the following code in ordered_set_stubs_test.py file:

from ordered_set import OrderedSet


# noinspection PyPep8Naming
def receives_OrderedSet_int(ordered_set: 'OrderedSet[int]') -> 'OrderedSet[int]':
    return ordered_set


receives_OrderedSet_int(OrderedSet(['ololo']))

Run mypy to check the code and check that it returns an error:

$ mypy ordered_set_stubs_test.py
ordered_set_stubs_test.py:10: error: List item 0 has incompatible type "str"; expected "int"

In Python 3.7 you can even drop quotes:

from __future__ import annotations
from ordered_set import OrderedSet


# noinspection PyPep8Naming
def receives_OrderedSet_int(ordered_set: OrderedSet[int]) -> OrderedSet[int]:
    return ordered_set


receives_OrderedSet_int(OrderedSet(['ololo']))

About

Stubs with type annotations for ordered-set Python library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages