Merge pull request #398 from python-escpos/390-add-spellcheck-to-sphinx

add sphinxcontrib-spelling
This commit is contained in:
Patrick Kanzler 2020-05-12 18:29:48 +02:00 committed by GitHub
commit d330dd80fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 39 additions and 16 deletions

View File

@ -8,6 +8,7 @@ addons:
apt: apt:
packages: packages:
- graphviz - graphviz
- libenchant1c2a
env: env:
global: global:
- ESCPOS_CAPABILITIES_FILE=/home/travis/build/python-escpos/python-escpos/capabilities-data/dist/capabilities.json - ESCPOS_CAPABILITIES_FILE=/home/travis/build/python-escpos/python-escpos/capabilities-data/dist/capabilities.json
@ -19,7 +20,7 @@ matrix:
language: shell language: shell
before_install: before_install:
- choco install python - choco install python
- pip install tox codecov 'sphinx>=1.5.1' - pip install tox codecov 'sphinx>=1.5.1' 'sphinxcontrib-spelling>=5'
env: env:
- TOXENV=py37 - TOXENV=py37
- PATH=/c/Python37:/c/Python37/Scripts:$PATH - PATH=/c/Python37:/c/Python37/Scripts:$PATH
@ -57,7 +58,7 @@ matrix:
- os: windows - os: windows
- os: osx - os: osx
before_install: before_install:
- pip install tox codecov 'sphinx>=1.5.1' - pip install tox codecov 'sphinx>=1.5.1' 'sphinxcontrib-spelling>=5'
- ./doc/generate_authors.sh --check - ./doc/generate_authors.sh --check
script: script:
- tox - tox

View File

@ -19,7 +19,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others # the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext spelling
help: help:
@echo "Please use \`make <target>' where <target> is one of" @echo "Please use \`make <target>' where <target> is one of"
@ -45,6 +45,7 @@ help:
@echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity" @echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)" @echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " spelling to run the spellchecker"
clean: clean:
rm -rf $(BUILDDIR)/* rm -rf $(BUILDDIR)/*
@ -175,3 +176,8 @@ pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo @echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
spelling:
$(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling
@echo
@echo "Spellchecker finished."

View File

@ -43,6 +43,7 @@ extensions = [
'sphinx.ext.todo', 'sphinx.ext.todo',
'sphinx.ext.graphviz', 'sphinx.ext.graphviz',
'sphinx.ext.inheritance_diagram', 'sphinx.ext.inheritance_diagram',
'sphinxcontrib.spelling',
] ]
# supress warnings for external images # supress warnings for external images
@ -292,3 +293,9 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu. # If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False #texinfo_no_detailmenu = False
# spellchecker
spelling_ignore_pypi_package_names = True
spelling_ignore_wiki_words = True
spelling_ignore_python_builtins = True
spelling_ignore_importable_modules = True

View File

@ -6,4 +6,5 @@ sphinx-rtd-theme
setuptools setuptools
setuptools-scm setuptools-scm
docutils>=0.12 docutils>=0.12
sphinxcontrib-spelling>=5
python-barcode>=0.11.0,<1 python-barcode>=0.11.0,<1

View File

@ -0,0 +1,7 @@
Raspbian
ESC
POS
Escpos
Escpos
baudrate
lsusb

View File

@ -48,9 +48,9 @@ to have and the second yields the "Output Endpoint" address.
By default the "Interface" number is "0" and the "Output Endpoint" By default the "Interface" number is "0" and the "Output Endpoint"
address is "0x01". If you have other values then you can define them on address is "0x01". If you have other values then you can define them on
your instance. So, assuming that we have another printer, CT-S2000, your instance. So, assuming that we have another printer, CT-S2000,
manufactured by Citizen (with "Vendor ID" of 2730 and "Product ID" of 0fff) manufactured by Citizen (with "Vendor ID" of 2730 and "Product ID" of 0fff)
where in\_ep is on 0x81 and out\_ep=0x02, then the printer definition should where in\_ep is on 0x81 and out\_ep=0x02, then the printer definition should
look like: look like:
**Generic USB Printer initialization** **Generic USB Printer initialization**
@ -163,7 +163,7 @@ The printer section
The ``printer`` configuration section defines a default printer to create. The ``printer`` configuration section defines a default printer to create.
The only required paramter is ``type``. The value of this has to be one of the The only required parameter is ``type``. The value of this has to be one of the
printers defined in :doc:`/user/printers`. printers defined in :doc:`/user/printers`.
The rest of the given parameters will be passed on to the initialization of the printer class. The rest of the given parameters will be passed on to the initialization of the printer class.
@ -199,7 +199,7 @@ Python-escpos is designed to accept unicode.
For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess
the right codepage and then send the encoded data to the printer. If this feature does not work, please try to the right codepage and then send the encoded data to the printer. If this feature does not work, please try to
isolate the error and then create an issue on the Github project page. isolate the error and then create an issue on the GitHub project page.
If you want or need to you can manually set the codepage. For this please use the ``charcode()``-function. You can set If you want or need to you can manually set the codepage. For this please use the ``charcode()``-function. You can set
any key-value that is in ``CHARCODE``. If something is wrong, an ``CharCodeError`` will be raised. any key-value that is in ``CHARCODE``. If something is wrong, an ``CharCodeError`` will be raised.

View File

@ -60,6 +60,7 @@ tests_require =
mock mock
hypothesis>4 hypothesis>4
flake8 flake8
sphinxcontrib-spelling>=5
[nosetests] [nosetests]
verbosity=3 verbosity=3

View File

@ -59,7 +59,7 @@ BARCODE_B = 'barcodeB'
class BaseProfile(object): class BaseProfile(object):
"""This respresents a printer profile. """This represents a printer profile.
A printer profile knows about the number of columns, supported A printer profile knows about the number of columns, supported
features, colors and more. features, colors and more.

View File

@ -3,7 +3,7 @@
""" CLI """ CLI
This module acts as a command line interface for python-escpos. It mirrors This module acts as a command line interface for python-escpos. It mirrors
closely the available ESCPOS commands while adding a couple extra ones for convience. closely the available ESCPOS commands while adding a couple extra ones for convenience.
It requires you to have a configuration file. See documentation for details. It requires you to have a configuration file. See documentation for details.
@ -554,7 +554,7 @@ def main():
def demo(printer, **kwargs): def demo(printer, **kwargs):
""" """
Prints specificed demos. Called when CLI is passed `demo`. This function Prints demos. Called when CLI is passed `demo`. This function
uses the DEMO_FUNCTIONS dictionary. uses the DEMO_FUNCTIONS dictionary.
:param printer: A printer from escpos.printer :param printer: A printer from escpos.printer

View File

@ -1,6 +1,6 @@
""" ESC/POS configuration manager. """ ESC/POS configuration manager.
This module contains the implentations of abstract base class :py:class:`Config`. This module contains the implementations of abstract base class :py:class:`Config`.
""" """

View File

@ -398,7 +398,7 @@ class Escpos(object):
*default*: A *default*: A
:param check: If this parameter is True, the barcode format will be checked to ensure it meets the bc :param check: If this parameter is True, the barcode format will be checked to ensure it meets the bc
requirements as defigned in the esc/pos documentation. See :py:meth:`.check_barcode()` requirements as definged in the ESC/POS documentation. See :py:meth:`.check_barcode()`
for more information. *default*: True. for more information. *default*: True.
:raises: :py:exc:`~escpos.exceptions.BarcodeSizeError`, :raises: :py:exc:`~escpos.exceptions.BarcodeSizeError`,

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
"""verifies that the metaclass abc is properly used by Escpos """verifies that the metaclass abc is properly used by ESC/POS
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_ :author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
:organization: `python-escpos <https://github.com/python-escpos>`_ :organization: `python-escpos <https://github.com/python-escpos>`_
@ -16,7 +16,7 @@ from abc import ABCMeta
@raises(TypeError) @raises(TypeError)
def test_abstract_base_class_raises(): def test_abstract_base_class_raises():
"""test whether the abstract base class raises an exception for Escpos""" """test whether the abstract base class raises an exception for ESC/POS"""
escpos.Escpos() # This call should raise TypeError because of abstractmethod _raw() escpos.Escpos() # This call should raise TypeError because of abstractmethod _raw()

View File

@ -19,7 +19,6 @@ deps = nose
pytest-mock pytest-mock
hypothesis>4 hypothesis>4
python-barcode python-barcode
viivakoodi
commands = pytest --cov escpos commands = pytest --cov escpos
passenv = ESCPOS_CAPABILITIES_PICKLE_DIR ESCPOS_CAPABILITIES_FILE CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_* passenv = ESCPOS_CAPABILITIES_PICKLE_DIR ESCPOS_CAPABILITIES_FILE CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_*
@ -29,6 +28,7 @@ changedir = doc
deps = sphinx>=1.5.1 deps = sphinx>=1.5.1
setuptools_scm setuptools_scm
python-barcode python-barcode
sphinxcontrib-spelling>=5
commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
[testenv:flake8] [testenv:flake8]