Skip to content

Commit

Permalink
small docfixes, add tox -e sphinx_build target
Browse files Browse the repository at this point in the history
  • Loading branch information
jquast committed Jun 11, 2023
1 parent bd4e7dc commit bbe2b66
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
Empty file removed doc/build/.keep
Empty file.
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# html_static_path = ['_static']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ skip_missing_interpreters = true
usedevelop=true
deps=-rrequirements-testing.txt
commands = py.test --verbose --verbose --cov xmodem {posargs}

[testenv:build_sphinx]
# build html documentation
deps=-rrequirements-docs.txt
basepython = python3.11
commands={envbindir}/python setup.py build_sphinx
26 changes: 14 additions & 12 deletions xmodem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,20 @@ class XMODEM(object):
XMODEM Protocol handler, expects two callables which encapsulate the read
and write operations on the underlying stream.
Example functions for reading and writing to a serial line using `pyserial <http://pyserial.sourceforge.net/>`_::
>>> import serial
>>> from xmodem import XMODEM
>>> ser = serial.Serial('/dev/ttyUSB0', timeout=0) # or whatever you need
>>> def getc(size, timeout=1):
... return ser.read(size) or None
...
>>> def putc(data, timeout=1):
... return ser.write(data) or None
...
>>> modem = XMODEM(getc, putc)
Example functions for reading and writing to a serial line using `pyserial <http://pyserial.sourceforge.net/>`_,
.. code-block:: python
import serial
from xmodem import XMODEM
ser = serial.Serial('/dev/ttyUSB0', timeout=0) # or whatever you need
def getc(size, timeout=1):
return ser.read(size) or None
def putc(data, timeout=1):
return ser.write(data) or None
modem = XMODEM(getc, putc)
:param getc: Function to retrieve bytes from a stream. The function takes
the number of bytes to read from the stream and a timeout in seconds as
Expand Down

0 comments on commit bbe2b66

Please sign in to comment.