Skip to content

Commit 1719114

Browse files
committed
Merge branch 'feature/v0.1.13' into develop
2 parents 4f8713b + 3ac1b65 commit 1719114

13 files changed

+720
-545
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203

.pre-commit-config.yaml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
repos:
2-
- repo: https://gitlab.com/pycqa/flake8
3-
rev: 3.7.8
2+
- repo: https://github.com/asottile/pyupgrade
3+
rev: v2.32.0
4+
hooks:
5+
- id: pyupgrade
6+
args: [--py38-plus]
7+
- repo: https://github.com/ikamensh/flynt/
8+
rev: '0.76'
9+
hooks:
10+
- id: flynt
11+
- repo: https://github.com/psf/black
12+
rev: 22.3.0
13+
hooks:
14+
- id: black
15+
language_version: python3.8
16+
- repo: https://github.com/PyCQA/flake8
17+
rev: 4.0.1
418
hooks:
519
- id: flake8
6-
exclude: examples
7-
- repo: https://github.com/pre-commit/mirrors-yapf
8-
rev: v0.23.0
20+
- repo: https://github.com/pycqa/pydocstyle
21+
rev: 6.1.1
922
hooks:
10-
- id: yapf
23+
- id: pydocstyle
24+
args:
25+
- --convention=numpy
26+
- --add-ignore=D104,D200,D202,D205,D301,D400

CONTRIBUTORS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Contributors
44
Colour - Dash
55
-------------
66

7-
- **Thomas Mansencal**, *Visual Effects Artist @ Weta Digital*
7+
- **Thomas Mansencal**, *Lead Pipeline Developer @ WetaFX*
88

99
Project coordination, writing.
1010

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Contact & Social
5151
The *Colour Developers* can be reached via different means:
5252

5353
- `Email <mailto:colour-developers@colour-science.org>`__
54-
- `Discourse <https://colour-science.discourse.group/>`__
5554
- `Facebook <https://www.facebook.com/python.colour.science>`__
5655
- `Gitter <https://gitter.im/colour-science/colour>`__
5756
- `Twitter <https://twitter.com/colour_science>`__

app.py

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
Application
43
===========
@@ -8,48 +7,42 @@
87
import os
98
from flask import Flask
109

11-
__author__ = 'Colour Developers'
12-
__copyright__ = 'Copyright (C) 2018-2021 - Colour Developers'
13-
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
14-
__maintainer__ = 'Colour Developers'
15-
__email__ = 'colour-developers@colour-science.org'
16-
__status__ = 'Production'
10+
__author__ = "Colour Developers"
11+
__copyright__ = "Copyright 2018 Colour Developers"
12+
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
13+
__maintainer__ = "Colour Developers"
14+
__email__ = "colour-developers@colour-science.org"
15+
__status__ = "Production"
1716

18-
__application_name__ = 'Colour - Dash'
17+
__application_name__ = "Colour - Dash"
1918

20-
__major_version__ = '0'
21-
__minor_version__ = '1'
22-
__change_version__ = '12'
23-
__version__ = '.'.join(
24-
(__major_version__,
25-
__minor_version__,
26-
__change_version__)) # yapf: disable
19+
__major_version__ = "0"
20+
__minor_version__ = "1"
21+
__change_version__ = "13"
22+
__version__ = ".".join(
23+
(__major_version__, __minor_version__, __change_version__)
24+
)
2725

28-
__all__ = ['SERVER', 'SERVER_URL', 'APP']
26+
__all__ = ["SERVER", "SERVER_URL", "APP"]
2927

30-
SERVER = Flask(__name__)
28+
SERVER: Flask = Flask(__name__)
3129
"""
3230
*Flask* server hosting the *Dash* app.
33-
34-
SERVER : Flask
3531
"""
3632

37-
SERVER_URL = os.environ.get('COLOUR_DASH_SERVER')
33+
SERVER_URL: str = os.environ.get("COLOUR_DASH_SERVER")
3834
"""
3935
Server url used to construct permanent links for the individual apps.
40-
41-
SERVER_URL : unicode
4236
"""
4337

44-
APP = dash.Dash(
38+
APP: dash.Dash = dash.Dash(
4539
__application_name__,
46-
external_scripts=os.environ.get('COLOUR_DASH_JS', '').split(','),
47-
external_stylesheets=os.environ.get('COLOUR_DASH_CSS', '').split(','),
48-
server=SERVER)
40+
external_scripts=os.environ.get("COLOUR_DASH_JS", "").split(","),
41+
external_stylesheets=os.environ.get("COLOUR_DASH_CSS", "").split(","),
42+
server=SERVER,
43+
)
4944
"""
5045
*Dash* app.
51-
52-
APP : Dash
5346
"""
5447

55-
APP.config['suppress_callback_exceptions'] = True
48+
APP.config["suppress_callback_exceptions"] = True

apps/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

apps/common.py

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,57 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
Common
43
======
54
"""
65

76
import colour
87

9-
__author__ = 'Colour Developers'
10-
__copyright__ = 'Copyright (C) 2018-2021 - Colour Developers'
11-
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
12-
__maintainer__ = 'Colour Developers'
13-
__email__ = 'colour-developers@colour-science.org'
14-
__status__ = 'Production'
8+
from colour.hints import ArrayLike, Dict, Integer, List
9+
10+
__author__ = "Colour Developers"
11+
__copyright__ = "Copyright 2018 Colour Developers"
12+
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
13+
__maintainer__ = "Colour Developers"
14+
__email__ = "colour-developers@colour-science.org"
15+
__status__ = "Production"
1516

1617
__all__ = [
17-
'RGB_COLOURSPACE_OPTIONS', 'CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS',
18-
'ILLUMINANTS_OPTIONS', 'NUKE_COLORMATRIX_NODE_TEMPLATE',
19-
'nuke_format_matrix'
18+
"RGB_COLOURSPACE_OPTIONS",
19+
"CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS",
20+
"ILLUMINANTS_OPTIONS",
21+
"NUKE_COLORMATRIX_NODE_TEMPLATE",
22+
"nuke_format_matrix",
2023
]
2124

22-
RGB_COLOURSPACE_OPTIONS = [{
23-
'label': key,
24-
'value': key
25-
} for key in sorted(colour.RGB_COLOURSPACES.keys())
26-
if key not in ('aces', 'adobe1998', 'prophoto')]
25+
RGB_COLOURSPACE_OPTIONS: List[Dict] = [
26+
{"label": key, "value": key}
27+
for key in sorted(colour.RGB_COLOURSPACES.keys())
28+
if key not in ("aces", "adobe1998", "prophoto")
29+
]
2730
"""
2831
*RGB* colourspace options for a :class:`Dropdown` class instance.
29-
30-
RGB_COLOURSPACE_OPTIONS : list
3132
"""
3233

33-
CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS = [{
34-
'label': key,
35-
'value': key
36-
} for key in sorted(colour.CHROMATIC_ADAPTATION_TRANSFORMS.keys())]
34+
CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS: List[Dict] = [
35+
{"label": key, "value": key}
36+
for key in sorted(colour.CHROMATIC_ADAPTATION_TRANSFORMS.keys())
37+
]
3738
"""
3839
*Chromatic adaptation transform* options for a :class:`Dropdown` class
3940
instance.
40-
41-
CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS : list
4241
"""
4342

44-
ILLUMINANTS_OPTIONS = [{
45-
'label': key,
46-
'value': key
47-
} for key in sorted(colour.CCS_ILLUMINANTS[
48-
'CIE 1931 2 Degree Standard Observer'].keys())]
43+
ILLUMINANTS_OPTIONS: List[Dict] = [
44+
{"label": key, "value": key}
45+
for key in sorted(
46+
colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"].keys()
47+
)
48+
]
4949
"""
5050
*CIE 1931 2 Degree Standard Observer* illuminant options for a
5151
:class:`Dropdown`class instance.
52-
53-
ILLUMINANTS_OPTIONS : list
5452
"""
5553

56-
NUKE_COLORMATRIX_NODE_TEMPLATE = """
54+
NUKE_COLORMATRIX_NODE_TEMPLATE: str = """
5755
ColorMatrix {{
5856
inputs 0
5957
matrix {{
@@ -63,41 +61,41 @@
6361
selected true
6462
xpos 0
6563
ypos 0
66-
}}""" [1:]
64+
}}"""[
65+
1:
66+
]
6767
"""
6868
*The Foundry Nuke* *ColorMatrix* node template.
69-
70-
NUKE_COLORMATRIX_NODE_TEMPLATE : unicode
7169
"""
7270

7371

74-
def nuke_format_matrix(M, decimals=10):
72+
def nuke_format_matrix(M: ArrayLike, decimals: Integer = 10) -> str:
7573
"""
76-
Formats given matrix for usage in *The Foundry Nuke*, i.e. *TCL* code for
74+
Format given matrix for usage in *The Foundry Nuke*, i.e. *TCL* code for
7775
a *ColorMatrix* node.
7876
7977
Parameters
8078
----------
81-
M : array_like
79+
M
8280
Matrix to format.
83-
decimals : int, optional
81+
decimals
8482
Decimals to use when formatting the matrix.
8583
8684
Returns
8785
-------
88-
unicode
86+
:class:`str`
8987
*The Foundry Nuke* formatted matrix.
9088
"""
9189

92-
def pretty(x):
90+
def pretty(x: ArrayLike) -> str:
9391
"""
9492
Prettify given number.
9593
"""
9694

97-
return ' '.join(map('{{: 0.{0}f}}'.format(decimals).format, x))
95+
return " ".join(map(f"{{: 0.{decimals}f}}".format, x))
9896

99-
tcl = '{{{0}}}\n'.format(pretty(M[0]))
100-
tcl += ' {{{0}}}\n'.format(pretty(M[1]))
101-
tcl += ' {{{0}}}'.format(pretty(M[2]))
97+
tcl = f"{{{pretty(M[0])}}}\n"
98+
tcl += f" {{{pretty(M[1])}}}\n"
99+
tcl += f" {{{pretty(M[2])}}}"
102100

103101
return tcl

0 commit comments

Comments
 (0)