File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,14 +19,35 @@ Usage
1919 greet(' user!' ) # >>> Hello user!
2020 greet(42 ) # >>> x (42) is not type <type 'str'>
2121
22+ .. code-block :: python
23+
24+ # Types
25+ Any # represents any type; ignored by checker
26+ Class # represents any type; analogous to types.TypeType
27+
28+ Optional # optional type; allows for given type or None value
29+ opt(str ) # optional type alias with a type value of str
30+
31+ .. code-block :: python
32+
33+ # Properties
34+ class TypesafeClass (object ):
35+ def __init__ (self ):
36+ self ._x = ' '
37+ add_property(self , ' x' , str )
38+
39+ instance = TypesafeClass()
40+ instance.x # >>> ''
41+
42+
2243 flake8 Integration
2344------------------
2445
2546.. code-block :: python
2647
2748 def greet (x ):
2849 return ' Hello ' + x
29-
50+
3051 .. code-block :: bash
3152
3253 $ flake8 greet.py
@@ -37,9 +58,9 @@ Installation
3758
3859.. code-block :: bash
3960
40- $ pip install git+git://github.com/mirainc/python-typesafe.git@v0.2
41-
61+ $ pip install git+git://github.com/mirainc/python-typesafe.git@v0.3
62+
4263 .. code-block :: bash
43-
64+
4465 # in requirements.txt
45- -e git://github.com/mirainc/python-typesafe.git@v0.2 #egg=typesafe
66+ -e git://github.com/mirainc/python-typesafe.git@v0.3 #egg=typesafe
You can’t perform that action at this time.
0 commit comments