BoboTiG / thermalprinter

Python module to manage the DP-EH600 thermal printer.
https://pypi.org/project/thermalprinter/
MIT License
32 stars 8 forks source link

Add option to specify command timeout #17

Closed d21d3q closed 2 years ago

d21d3q commented 2 years ago

I've been working with DP-EH400/1 printer, and I observed response times above 50ms, sometimes reaching 80ms. image This PR allows for specifying custom timeout value.

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.21%.

Quality metrics Before After Change
Complexity 5.02 ⭐ 5.01 ⭐ -0.01 👍
Method Length 50.20 ⭐ 50.44 ⭐ 0.24 👎
Working memory 6.75 🙂 6.82 🙂 0.07 👎
Quality 75.92% 75.71% -0.21% 👎
Other metrics Before After Change
Lines 681 682 1
Changed files Quality Before Quality After Quality Change
tests/test_methods.py 73.97% 🙂 73.96% 🙂 -0.01% 👎
thermalprinter/init.py 87.84% ⭐ 87.84% ⭐ 0.00%
thermalprinter/thermalprinter.py 75.80% ⭐ 75.58% ⭐ -0.22% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
thermalprinter/thermalprinter.py ThermalPrinter.image 22 😞 197 😞 14 😞 32.74% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
tests/test_methods.py test_signature 0 ⭐ 391 ⛔ 6 ⭐ 60.26% 🙂 Try splitting into smaller methods
thermalprinter/thermalprinter.py ThermalPrinter.__repr__ 8 ⭐ 102 🙂 10 😞 60.88% 🙂 Extract out complex expressions
thermalprinter/thermalprinter.py ThermalPrinter.__init__ 3 ⭐ 136 😞 10 😞 61.47% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

BoboTiG commented 2 years ago

Thanks @d21d3q !

I'll update the project, and do a new release when I'll have some free time.