Skip to content

Commit 367f5b8

Browse files
committed
updates README
1 parent 3c589f9 commit 367f5b8

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

README.rst

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)