Skip to content

Commit

Permalink
Adds syntax highlighting (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Apr 12, 2020
1 parent 4b53ce1 commit cc192d3
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,25 @@ directly to your Python code based on the types collected at runtime.
Example
-------

Say ``some/module.py`` originally contains::
Say ``some/module.py`` originally contains:

.. code:: python
def add(a, b):
return a + b
And ``myscript.py`` contains::
And ``myscript.py`` contains:

.. code:: python
from some.module import add
add(1, 2)
Now we want to infer the type annotation of ``add`` in ``some/module.py`` by
running ``myscript.py`` with ``MonkeyType``. One way is to run::
running ``myscript.py`` with ``MonkeyType``. One way is to run:

.. code:: bash
$ monkeytype run myscript.py
Expand All @@ -29,11 +35,15 @@ By default, this will dump call traces into a SQLite database in the file
``monkeytype`` command to generate a stub file for a module, or apply the type
annotations directly to your code.

Running ``monkeytype stub some.module`` will output a stub::
Running ``monkeytype stub some.module`` will output a stub:

.. code:: python
def add(a: int, b: int) -> int: ...
Running ``monkeytype apply some.module`` will modify ``some/module.py`` to::
Running ``monkeytype apply some.module`` will modify ``some/module.py`` to:

.. code:: python
def add(a: int, b: int) -> int:
return a + b
Expand Down Expand Up @@ -71,7 +81,9 @@ comments).
Installing
----------

Install MonkeyType with `pip`_::
Install MonkeyType with `pip`_:

.. code:: bash
pip install MonkeyType
Expand Down

0 comments on commit cc192d3

Please sign in to comment.