-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.8.3: fix for output correction and reformatted files
- Loading branch information
spacemanspiff2007
committed
Jul 23, 2021
1 parent
6a4ef9d
commit 2b339ec
Showing
17 changed files
with
131 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
__pycache__ | ||
/conf | ||
/build | ||
/log.log | ||
/log.log | ||
/venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[settings] | ||
line_length = 120 | ||
|
||
src_paths=pyartnet, tests | ||
|
||
ensure_newline_before_comments = True | ||
force_alphabetical_sort_within_sections = True | ||
|
||
balanced_wrapping = True | ||
multi_line_output = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
exclude: \.(?:pdf|svg)$ | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.8.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
|
||
- repo: https://gitlab.com/PyCQA/flake8 | ||
rev: '3.9.1' | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from . import errors, fades, output_correction | ||
from .__version__ import __version__ | ||
from . import errors | ||
from . import fades | ||
|
||
from .dmx_channel import DmxChannel, DmxChannel16Bit, DmxChannel24Bit, DmxChannel32Bit | ||
from .dmx_universe import DmxUniverse | ||
from .artnet_node import ArtNetNode | ||
# isort: split | ||
|
||
from . import output_correction | ||
from .dmx_channel import DmxChannel, DmxChannel16Bit, DmxChannel24Bit, DmxChannel32Bit | ||
from .dmx_universe import DmxUniverse | ||
|
||
# isort: split | ||
|
||
from .artnet_node import ArtNetNode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.8.2' | ||
__version__ = '0.8.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .fade_base import FadeBase | ||
from .fade_linear import LinearFade | ||
from .fade_linear import LinearFade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
|
||
|
||
def quadratic(val: float, max_val: int = 255): | ||
def quadratic(val: float, max_val: int = 0xFF): | ||
return (val ** 2) / max_val | ||
|
||
|
||
def cubic(val: float, max_val: int = 255): | ||
def cubic(val: float, max_val: int = 0xFF): | ||
return (val ** 3) / (max_val * max_val) | ||
|
||
|
||
def quadruple(val: float, max_val: int = 255): | ||
def quadruple(val: float, max_val: int = 0xFF): | ||
return (val ** 4) / (max_val * max_val * max_val) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pre-commit==2.13.0 | ||
pytest==6.2.4 | ||
pytest-asyncio==0.15.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import logging | ||
|
||
import pytest | ||
|
||
import pyartnet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
import pytest | ||
|
||
from pyartnet.output_correction import quadratic, quadruple, cubic | ||
from pyartnet import DmxChannel, DmxChannel16Bit, DmxChannel24Bit, DmxChannel32Bit | ||
from pyartnet.output_correction import cubic, quadratic, quadruple | ||
|
||
|
||
@pytest.mark.parametrize('corr', [quadratic, quadruple, cubic]) | ||
def test_endpoints(corr): | ||
def test_endpoints_8bit(corr): | ||
assert corr(0) == 0 | ||
assert corr(255) == 255 | ||
|
||
i = 0 | ||
while i <= 255: | ||
assert 0 <= corr(i) <= 255 | ||
i += 0.001 | ||
assert corr(0xFF, max_val=DmxChannel._CHANNEL_MAX) == 0xFF | ||
|
||
|
||
@pytest.mark.parametrize('corr', [quadratic, quadruple, cubic]) | ||
def test_endpoints_16bit(corr): | ||
assert corr(0) == 0 | ||
assert corr(0xFFFF, max_val=0xFFFF) == 0xFFFF | ||
assert corr(0, max_val=DmxChannel16Bit._CHANNEL_MAX) == 0 | ||
assert corr(0xFFFF, max_val=DmxChannel16Bit._CHANNEL_MAX) == 0xFFFF | ||
|
||
|
||
@pytest.mark.parametrize('corr', [quadratic, quadruple, cubic]) | ||
def test_endpoints_24bit(corr): | ||
assert corr(0, max_val=DmxChannel16Bit._CHANNEL_MAX) == 0 | ||
assert corr(0xFFFFFF, max_val=DmxChannel24Bit._CHANNEL_MAX) == 0xFFFFFF | ||
|
||
|
||
@pytest.mark.parametrize('corr', [quadratic, quadruple, cubic]) | ||
def test_endpoints_32bit(corr): | ||
assert corr(0, max_val=DmxChannel16Bit._CHANNEL_MAX) == 0 | ||
assert corr(0xFFFFFFFF, max_val=DmxChannel32Bit._CHANNEL_MAX) == 0xFFFFFFFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters