Skip to content

Commit

Permalink
try new traitlets again
Browse files Browse the repository at this point in the history
  • Loading branch information
nrbgt committed Sep 15, 2023
1 parent c0a8117 commit fc993f6
Show file tree
Hide file tree
Showing 34 changed files with 209 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .github/locks/linux-64_dev_lab3.6_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5
https://conda.anaconda.org/conda-forge/noarch/tomli-w-1.0.0-pyhd8ed1ab_0.tar.bz2#73506d1ab4202481841c68c169b7ef6c
https://conda.anaconda.org/conda-forge/noarch/tomlkit-0.12.1-pyha770c72_0.conda#62f5b331c53d73e2f6c4c130b53518a0
https://conda.anaconda.org/conda-forge/linux-64/tornado-6.3.3-py311h459d7ec_0.conda#7d9a31416c18704f55946ff7cf8da5dc
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/types-docutils-0.20.0.3-pyhd8ed1ab_0.conda#0f441a778d5741b7da075b02c7fa1106
https://conda.anaconda.org/conda-forge/noarch/types-pyyaml-5.4.12-pyhd8ed1ab_0.tar.bz2#efd73a6664edb11d09c52fb05356f0bf
https://conda.anaconda.org/conda-forge/noarch/types-urllib3-1.26.25.14-pyhd8ed1ab_0.conda#06118f39abab2ab953276a50b2775509
Expand Down
1 change: 1 addition & 0 deletions .github/locks/linux-64_test_lab3.5_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# - scour
# - selenium <4.10.0
# - tomli
# - traitlets <5.10
# - traittypes

@EXPLICIT
Expand Down
1 change: 1 addition & 0 deletions .github/locks/linux-64_test_lab3.5_py3.8.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# - scour
# - selenium <4.10.0
# - tomli
# - traitlets <5.10
# - traittypes

@EXPLICIT
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/linux-64_test_lab3.6_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda#3
https://conda.anaconda.org/conda-forge/noarch/toml-0.10.2-pyhd8ed1ab_0.tar.bz2#f832c45a477c78bebd107098db465095
https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5844808ffab9ebdb694585b50ba02a96
https://conda.anaconda.org/conda-forge/linux-64/tornado-6.3.3-py311h459d7ec_0.conda#7d9a31416c18704f55946ff7cf8da5dc
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.7.1-pyha770c72_0.conda#c39d6a09fe819de4951c2642629d9115
https://conda.anaconda.org/conda-forge/noarch/typing_utils-0.1.0-pyhd8ed1ab_0.tar.bz2#eb67e3cace64c66233e2d35949e20f92
https://conda.anaconda.org/conda-forge/noarch/uri-template-1.3.0-pyhd8ed1ab_0.conda#0944dc65cb4a9b5b68522c3bb585d41c
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/linux-64_test_lab3.6_py3.8.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda#3
https://conda.anaconda.org/conda-forge/noarch/toml-0.10.2-pyhd8ed1ab_0.tar.bz2#f832c45a477c78bebd107098db465095
https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5844808ffab9ebdb694585b50ba02a96
https://conda.anaconda.org/conda-forge/linux-64/tornado-6.3.3-py38h01eb140_0.conda#465bbfc0eb2022837d957d045b6b627a
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.7.1-pyha770c72_0.conda#c39d6a09fe819de4951c2642629d9115
https://conda.anaconda.org/conda-forge/noarch/typing_utils-0.1.0-pyhd8ed1ab_0.tar.bz2#eb67e3cace64c66233e2d35949e20f92
https://conda.anaconda.org/conda-forge/noarch/uri-template-1.3.0-pyhd8ed1ab_0.conda#0944dc65cb4a9b5b68522c3bb585d41c
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/osx-64_dev_lab3.6_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5
https://conda.anaconda.org/conda-forge/noarch/tomli-w-1.0.0-pyhd8ed1ab_0.tar.bz2#73506d1ab4202481841c68c169b7ef6c
https://conda.anaconda.org/conda-forge/noarch/tomlkit-0.12.1-pyha770c72_0.conda#62f5b331c53d73e2f6c4c130b53518a0
https://conda.anaconda.org/conda-forge/osx-64/tornado-6.3.3-py311h2725bcf_0.conda#2e29e821b0448e8e8ab627f202554575
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/types-docutils-0.20.0.3-pyhd8ed1ab_0.conda#0f441a778d5741b7da075b02c7fa1106
https://conda.anaconda.org/conda-forge/noarch/types-pyyaml-5.4.12-pyhd8ed1ab_0.tar.bz2#efd73a6664edb11d09c52fb05356f0bf
https://conda.anaconda.org/conda-forge/noarch/types-urllib3-1.26.25.14-pyhd8ed1ab_0.conda#06118f39abab2ab953276a50b2775509
Expand Down
1 change: 1 addition & 0 deletions .github/locks/osx-64_test_lab3.5_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# - scour
# - selenium <4.10.0
# - tomli
# - traitlets <5.10
# - traittypes

@EXPLICIT
Expand Down
1 change: 1 addition & 0 deletions .github/locks/osx-64_test_lab3.5_py3.8.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# - scour
# - selenium <4.10.0
# - tomli
# - traitlets <5.10
# - traittypes

@EXPLICIT
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/osx-64_test_lab3.6_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda#3
https://conda.anaconda.org/conda-forge/noarch/toml-0.10.2-pyhd8ed1ab_0.tar.bz2#f832c45a477c78bebd107098db465095
https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5844808ffab9ebdb694585b50ba02a96
https://conda.anaconda.org/conda-forge/osx-64/tornado-6.3.3-py311h2725bcf_0.conda#2e29e821b0448e8e8ab627f202554575
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.7.1-pyha770c72_0.conda#c39d6a09fe819de4951c2642629d9115
https://conda.anaconda.org/conda-forge/noarch/typing_utils-0.1.0-pyhd8ed1ab_0.tar.bz2#eb67e3cace64c66233e2d35949e20f92
https://conda.anaconda.org/conda-forge/noarch/uri-template-1.3.0-pyhd8ed1ab_0.conda#0944dc65cb4a9b5b68522c3bb585d41c
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/osx-64_test_lab3.6_py3.8.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda#3
https://conda.anaconda.org/conda-forge/noarch/toml-0.10.2-pyhd8ed1ab_0.tar.bz2#f832c45a477c78bebd107098db465095
https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5844808ffab9ebdb694585b50ba02a96
https://conda.anaconda.org/conda-forge/osx-64/tornado-6.3.3-py38hcafd530_0.conda#5874d0b6e1829203c19c22d3c3e38cae
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.7.1-pyha770c72_0.conda#c39d6a09fe819de4951c2642629d9115
https://conda.anaconda.org/conda-forge/noarch/typing_utils-0.1.0-pyhd8ed1ab_0.tar.bz2#eb67e3cace64c66233e2d35949e20f92
https://conda.anaconda.org/conda-forge/noarch/uri-template-1.3.0-pyhd8ed1ab_0.conda#0944dc65cb4a9b5b68522c3bb585d41c
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/win-64_dev_lab3.6_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5
https://conda.anaconda.org/conda-forge/noarch/tomli-w-1.0.0-pyhd8ed1ab_0.tar.bz2#73506d1ab4202481841c68c169b7ef6c
https://conda.anaconda.org/conda-forge/noarch/tomlkit-0.12.1-pyha770c72_0.conda#62f5b331c53d73e2f6c4c130b53518a0
https://conda.anaconda.org/conda-forge/win-64/tornado-6.3.3-py311ha68e1ae_0.conda#373efebfbe9d127ef4fa2086637cb2f8
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/types-docutils-0.20.0.3-pyhd8ed1ab_0.conda#0f441a778d5741b7da075b02c7fa1106
https://conda.anaconda.org/conda-forge/noarch/types-pyyaml-5.4.12-pyhd8ed1ab_0.tar.bz2#efd73a6664edb11d09c52fb05356f0bf
https://conda.anaconda.org/conda-forge/noarch/types-urllib3-1.26.25.14-pyhd8ed1ab_0.conda#06118f39abab2ab953276a50b2775509
Expand Down
1 change: 1 addition & 0 deletions .github/locks/win-64_test_lab3.5_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# - scour
# - selenium <4.10.0
# - tomli
# - traitlets <5.10
# - traittypes

@EXPLICIT
Expand Down
1 change: 1 addition & 0 deletions .github/locks/win-64_test_lab3.5_py3.8.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# - scour
# - selenium <4.10.0
# - tomli
# - traitlets <5.10
# - traittypes

@EXPLICIT
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/win-64_test_lab3.6_py3.11.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda#3
https://conda.anaconda.org/conda-forge/noarch/toml-0.10.2-pyhd8ed1ab_0.tar.bz2#f832c45a477c78bebd107098db465095
https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5844808ffab9ebdb694585b50ba02a96
https://conda.anaconda.org/conda-forge/win-64/tornado-6.3.3-py311ha68e1ae_0.conda#373efebfbe9d127ef4fa2086637cb2f8
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.7.1-pyha770c72_0.conda#c39d6a09fe819de4951c2642629d9115
https://conda.anaconda.org/conda-forge/noarch/typing_utils-0.1.0-pyhd8ed1ab_0.tar.bz2#eb67e3cace64c66233e2d35949e20f92
https://conda.anaconda.org/conda-forge/noarch/uri-template-1.3.0-pyhd8ed1ab_0.conda#0944dc65cb4a9b5b68522c3bb585d41c
Expand Down
2 changes: 1 addition & 1 deletion .github/locks/win-64_test_lab3.6_py3.8.conda.lock
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda#3
https://conda.anaconda.org/conda-forge/noarch/toml-0.10.2-pyhd8ed1ab_0.tar.bz2#f832c45a477c78bebd107098db465095
https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5844808ffab9ebdb694585b50ba02a96
https://conda.anaconda.org/conda-forge/win-64/tornado-6.3.3-py38h91455d4_0.conda#317a39276a96a1aa8c96f174366c2f19
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696
https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.7.1-pyha770c72_0.conda#c39d6a09fe819de4951c2642629d9115
https://conda.anaconda.org/conda-forge/noarch/typing_utils-0.1.0-pyhd8ed1ab_0.tar.bz2#eb67e3cace64c66233e2d35949e20f92
https://conda.anaconda.org/conda-forge/noarch/uri-template-1.3.0-pyhd8ed1ab_0.conda#0944dc65cb4a9b5b68522c3bb585d41c
Expand Down
1 change: 1 addition & 0 deletions .github/specs/_lab/lab3.5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dependencies:
- ipywidgets <8.0.5
- jupyterlab >=3.5.2,<3.6
- jupyterlab_widgets <3.0.6
- traitlets <5.10
5 changes: 5 additions & 0 deletions .github/specs/_lab/lab3.6.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
_patches:
- old: https://conda.anaconda.org/conda-forge/noarch/traitlets-5.9.0-pyhd8ed1ab_0.conda#d0b4f5c87cd35ac3fb3d47b223263a64
new: https://conda.anaconda.org/conda-forge/noarch/traitlets-5.10.0-pyhd8ed1ab_0.conda#efd3f63a93621367d4fa6e274c511696

dependencies:
- jupyter_server >=2.2.1
- jupyterlab >=3.6.4,<3.7
- orjson
# - traitlets >=5.10
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ addopts = [
]
filterwarnings = [
"error",
# for traitlets <=5.9
"ignore:^\n?.*Sentinel:DeprecationWarning:traittypes",
# traitlets >=5.10
"ignore:^\n?.*Sentinel:DeprecationWarning:traitlets",
"ignore:.metadata:DeprecationWarning:ipywidgets",
]
Expand Down
12 changes: 12 additions & 0 deletions scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,11 @@ def lock_one(platform: str, lockfile: Path, stack: Paths) -> None:

lock_args = ["conda-lock", "--kind=explicit"]
comment = lock_comment(stack)
patches = []
for env_file in stack:
lock_args += ["--file", env_file]
env_data = safe_load(env_file)
patches += env_data.get("_patches", [])
lock_args += ["--platform", platform]

if P.LOCK_HISTORY.exists():
Expand All @@ -268,6 +271,15 @@ def lock_one(platform: str, lockfile: Path, stack: Paths) -> None:
subprocess.check_call(str_args, cwd=td)
raw = tmp_lock.read_text(**P.UTF8).split(P.EXPLICIT)[1].strip()

if patches:
print(f" ... applying {len(patches)} patches")
lines = raw.splitlines()
for patch in patches:
print(f""" ... looking to patch {patch["old"]}...""")
index = lines.index(patch["old"])
lines[index] = patch["new"]
raw = "\n".join(lines)

lockfile.parent.mkdir(exist_ok=True, parents=True)
lockfile.write_text("\n".join([comment, P.EXPLICIT, raw, ""]), **P.UTF8)

Expand Down
11 changes: 6 additions & 5 deletions src/ipyforcegraph/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
import ipywidgets as W
import traitlets as T

from . import _types as _t
from .constants import EXTENSION_NAME, EXTENSION_SPEC_VERSION


class ForceBase(W.Widget):
"""The base class for all ``IPyForceGraph`` widgets."""

_model_name: str = T.Unicode("ForceBaseModel").tag(sync=True)
_model_module: str = T.Unicode(EXTENSION_NAME).tag(sync=True)
_model_module_version: str = T.Unicode(EXTENSION_SPEC_VERSION).tag(sync=True)
_view_module: str = T.Unicode(EXTENSION_NAME).tag(sync=True)
_view_module_version: str = T.Unicode(EXTENSION_SPEC_VERSION).tag(sync=True)
_model_name: _t.Tstr = T.Unicode("ForceBaseModel").tag(sync=True)
_model_module: _t.Tstr = T.Unicode(EXTENSION_NAME).tag(sync=True)
_model_module_version: _t.Tstr = T.Unicode(EXTENSION_SPEC_VERSION).tag(sync=True)
_view_module: _t.Tstr = T.Unicode(EXTENSION_NAME).tag(sync=True)
_view_module_version: _t.Tstr = T.Unicode(EXTENSION_SPEC_VERSION).tag(sync=True)
21 changes: 21 additions & 0 deletions src/ipyforcegraph/_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Type hint compatibility for `traitlets` and friends."""

# Copyright (c) 2023 ipyforcegraph contributors.
# Distributed under the terms of the Modified BSD License.

from typing import Any, Dict, Optional, Union

import traitlets as T

Tstr = T.Unicode[str, Union[str, bytes]]
Tstr_maybe = T.Unicode[Optional[str], Union[str, bytes, None]]

Tint = T.Int[int, int]
Tint_maybe = Optional[int]

Tfloat = T.Float[float, float]
Tfloat_maybe = T.Float[Optional[int], Union[int, float, None]]

Tbool = T.Bool[bool, Union[bool, int]]

Tdict_any = T.Instance[Dict[Any, Any]]
29 changes: 15 additions & 14 deletions src/ipyforcegraph/behaviors/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import ipywidgets as W
import traitlets as T

from .. import _types as _t
from .._base import ForceBase
from ..trait_utils import JSON_TYPES, coerce

Expand Down Expand Up @@ -35,9 +36,9 @@ class DEFAULT_RANK:
class Behavior(ForceBase):
"""The base class for all IPyForceGraph graph behaviors."""

_model_name: str = T.Unicode("BehaviorModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("BehaviorModel").tag(sync=True)

rank: int = T.Int(
rank: _t.Tint = T.Int(
DEFAULT_RANK.behavior,
help=("order in which behaviors are applied: lower numbers are applied first."),
).tag(sync=True)
Expand All @@ -46,30 +47,30 @@ class Behavior(ForceBase):
class BaseD3Force(Behavior):
"""A base for all ``d3-force-3d`` force wrappers."""

_model_name: str = T.Unicode("BaseD3ForceModel").tag(sync=True)
active: bool = T.Bool(True, help="whether the force is currently active").tag(
_model_name: _t.Tstr = T.Unicode("BaseD3ForceModel").tag(sync=True)
active: _t.Tbool = T.Bool(True, help="whether the force is currently active").tag(
sync=True
)


class ShapeBase(ForceBase):
"""A base class from which all :mod:`~ipyforcegraph.behaviors.shapes` inherit."""

_model_name: str = T.Unicode("ShapeBaseModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("ShapeBaseModel").tag(sync=True)


class DynamicValue(ForceBase):
"""An abstract class to describe what a Dynamic Widget Trait is and does."""

_model_name: str = T.Unicode("DynamicModel").tag(sync=True)
_model_name = T.Unicode("DynamicModel").tag(sync=True)

JSON_DATA_TYPES = JSON_TYPES.get_supported_types()

value: str = T.Unicode(
value: _t.Tstr = T.Unicode(
"", help="the source used to compute the value for the trait"
).tag(sync=True)

coerce: str = T.Unicode(
coerce: _t.Tstr_maybe = T.Unicode(
help="name of a JSON Schema ``type`` into which to coerce the final value",
allow_none=True,
).tag(sync=True)
Expand Down Expand Up @@ -97,7 +98,7 @@ def _validate_coercer(self, proposal: T.Bunch) -> Optional[str]:
class Column(DynamicValue):
"""A column from a :class:`~ipyforcegraph.sources.dataframe.DataFrameSource`."""

_model_name: str = T.Unicode("ColumnModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("ColumnModel").tag(sync=True)


class Nunjucks(DynamicValue):
Expand Down Expand Up @@ -140,7 +141,7 @@ class Nunjucks(DynamicValue):
rgb({{ c }},0,0)
"""

_model_name: str = T.Unicode("NunjucksModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("NunjucksModel").tag(sync=True)


def _make_trait(
Expand Down Expand Up @@ -177,7 +178,7 @@ def _make_trait(
class HasScale(ShapeBase):
"""A shape that has ``scale_on_zoom``."""

_model_name: str = T.Unicode("HasScaleModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("HasScaleModel").tag(sync=True)

scale_on_zoom: TBoolFeature = _make_trait(
"whether font size/stroke respects the global scale. Has no impact on `link` shapes.",
Expand All @@ -192,7 +193,7 @@ def _validate_scale_bools(self, proposal: T.Bunch) -> Any:
class HasFillAndStroke(HasScale):
"""A shape that has ``fill`` and ``stroke``."""

_model_name: str = T.Unicode("HasFillModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("HasFillModel").tag(sync=True)
fill: TFeature = _make_trait("the fill color of a shape")
stroke: TFeature = _make_trait("the stroke color of a shape")
stroke_width: TNumFeature = _make_trait("the stroke width of a shape", numeric=True)
Expand All @@ -214,7 +215,7 @@ def _validate_has_fill_and_stroke_arrays(self, proposal: T.Bunch) -> Any:
class HasOffsets(ShapeBase):
"""A shape that can be offset in the horizontal, vertical, or elevation dimensions."""

_model_name: str = T.Unicode("HasOffsetsModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("HasOffsetsModel").tag(sync=True)

offset_x: float = _make_trait(
"the relative horizontal offset from the middle of the shape in ``px``",
Expand All @@ -237,7 +238,7 @@ def _validate_offset_numerics(self, proposal: T.Bunch) -> Any:
class HasDimensions(HasFillAndStroke, HasOffsets):
"""A shape that has ``width``, ``height`` and ``depth``."""

_model_name: str = T.Unicode("HasDimensionsModel").tag(sync=True)
_model_name: _t.Tstr = T.Unicode("HasDimensionsModel").tag(sync=True)

width: TNumFeature = _make_trait("the width of a shape in ``px``", numeric=True)
height: TNumFeature = _make_trait("the height of a shape in ``px``", numeric=True)
Expand Down
Loading

0 comments on commit fc993f6

Please sign in to comment.