mirror of
https://github.com/python-escpos/python-escpos
synced 2025-12-02 09:43:30 +00:00
Drop Py37, improve typing and docstrings (#544)
Drops Py3.7, improves typing and adds a mypy config, improves the docstrings and isorts the imports. * configure isort * sort with isort * add github action * enable flake8-docstrings * fix docstrings * add mypy env * no implicit optional * add type for raw * add some type hints
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
""" ESC/POS configuration manager.
|
||||
"""ESC/POS configuration manager.
|
||||
|
||||
This module contains the implementations of abstract base class :py:class:`Config`.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
|
||||
import appdirs
|
||||
import yaml
|
||||
|
||||
from . import printer
|
||||
from . import exceptions
|
||||
from . import exceptions, printer
|
||||
|
||||
|
||||
class Config(object):
|
||||
@@ -48,13 +45,11 @@ class Config(object):
|
||||
self._printer_config = None
|
||||
|
||||
def load(self, config_path=None):
|
||||
"""Load and parse the configuration file using pyyaml
|
||||
"""Load and parse the configuration file using pyyaml.
|
||||
|
||||
:param config_path: An optional file path, file handle, or byte string
|
||||
for the configuration file.
|
||||
|
||||
"""
|
||||
|
||||
self._reset_config()
|
||||
|
||||
if not config_path:
|
||||
@@ -96,8 +91,9 @@ class Config(object):
|
||||
self._has_loaded = True
|
||||
|
||||
def printer(self):
|
||||
"""Returns a printer that was defined in the config, or throws an
|
||||
exception.
|
||||
"""Return a printer that was defined in the config.
|
||||
|
||||
Throw an exception on error.
|
||||
|
||||
This method loads the default config if one hasn't beeen already loaded.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user