Skip to content

Commit

Permalink
Remove old deprecations (#13882)
Browse files Browse the repository at this point in the history
* Remove old deprecations

* lift HSL deprecation
  • Loading branch information
bryevdv committed May 7, 2024
1 parent cfac219 commit cf19b57
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 621 deletions.
7 changes: 0 additions & 7 deletions docs/bokeh/source/docs/reference/tile_providers.rst

This file was deleted.

6 changes: 0 additions & 6 deletions src/bokeh/colors/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

# Bokeh imports
from ..core.serialization import AnyRep, Serializable, Serializer
from ..util.deprecation import deprecated

if TYPE_CHECKING:
from typing_extensions import Self
Expand Down Expand Up @@ -376,10 +375,6 @@ class HSL(Color):
Alpha values may also optionally be provided. Otherwise, alpha values
default to 1.
.. warning::
HSL is deprecated as of Bokeh 2.3.1 and will be removed in a future
release. Use RGB or named colors instead.
'''

def __init__(self, h: float, s: float, l: float, a: float = 1.0) -> None:
Expand All @@ -399,7 +394,6 @@ def __init__(self, h: float, s: float, l: float, a: float = 1.0) -> None:
An alpha value for this color in [0, 1] (default: 1.0)
'''
deprecated((2, 3, 1), "HSL()", "RGB() or named colors")
self.h = h
self.s = s
self.l = l
Expand Down
9 changes: 0 additions & 9 deletions src/bokeh/core/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,10 @@ class SomeModel(Model):
.. autoclass:: MarkerType
.. autoclass:: MinMaxBounds
.. autoclass:: NonNegative
.. autoclass:: NonNegativeInt
.. autoclass:: Nothing
.. autoclass:: Null
.. autoclass:: Percent
.. autoclass:: Positive
.. autoclass:: PositiveInt
.. autoclass:: RGB
.. autoclass:: Regex
.. autoclass:: Size
Expand Down Expand Up @@ -152,7 +150,6 @@ class SomeModel(Model):
.. autoclass:: InstanceDefault
.. autoclass:: Include
.. autoclass:: Nullable
.. autoclass:: NonNullable
.. autoclass:: NotSerialized
.. autoclass:: Object
.. autoclass:: Override
Expand Down Expand Up @@ -253,8 +250,6 @@ class SomeModel(Model):
'MinMaxBounds',
'NonEmpty',
'NonNegative',
'NonNegativeInt',
'NonNullable',
'NotSerialized',
'Nothing',
'Null',
Expand All @@ -268,7 +263,6 @@ class SomeModel(Model):
'PandasGroupBy',
'Percent',
'Positive',
'PositiveInt',
'RGB',
'Readonly',
'Regex',
Expand Down Expand Up @@ -376,17 +370,14 @@ class SomeModel(Model):

from .property.nothing import Nothing

from .property.nullable import NonNullable
from .property.nullable import Nullable

from .property.numeric import Angle
from .property.numeric import Byte
from .property.numeric import Interval
from .property.numeric import NonNegative
from .property.numeric import NonNegativeInt
from .property.numeric import Percent
from .property.numeric import Positive
from .property.numeric import PositiveInt
from .property.numeric import Size

from .property.override import Override
Expand Down
20 changes: 1 addition & 19 deletions src/bokeh/core/property/nullable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
""" Provide ``Nullable`` and ``NonNullable`` properties. """
""" Provide ``Nullable`` property. """

#-----------------------------------------------------------------------------
# Boilerplate
Expand All @@ -22,23 +22,19 @@
from typing import Any, TypeVar

# Bokeh imports
from ...util.deprecation import deprecated
from ._sphinx import property_link, register_type_link, type_link
from .bases import (
Init,
Property,
SingleParameterizedProperty,
TypeOrInst,
)
from .required import Required
from .singletons import Undefined

#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------

__all__ = (
"NonNullable",
"Nullable",
)

Expand Down Expand Up @@ -74,19 +70,6 @@ def validate(self, value: Any, detail: bool = True) -> None:
msg = "" if not detail else f"expected either None or a value of type {self.type_param}, got {value!r}"
raise ValueError(msg)

class NonNullable(Required[T]):
"""
A property accepting a value of some other type while having undefined default.
.. deprecated:: 3.0.0
Use ``bokeh.core.property.required.Required`` instead.
"""

def __init__(self, type_param: TypeOrInst[Property[T]], *, default: Init[T] = Undefined, help: str | None = None) -> None:
deprecated((3, 0, 0), "NonNullable(Type)", "Required(Type)")
super().__init__(type_param, default=default, help=help)

#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
Expand All @@ -100,6 +83,5 @@ def __init__(self, type_param: TypeOrInst[Property[T]], *, default: Init[T] = Un
#-----------------------------------------------------------------------------

@register_type_link(Nullable)
@register_type_link(NonNullable)
def _sphinx_type_link(obj: SingleParameterizedProperty[Any]) -> str:
return f"{property_link(obj)}({type_link(obj.type_param)})"
41 changes: 0 additions & 41 deletions src/bokeh/core/property/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from typing import Any, TypeVar

# Bokeh imports
from ...util.deprecation import deprecated
from .bases import (
Init,
Property,
Expand All @@ -43,10 +42,8 @@
'Byte',
'Interval',
'NonNegative',
'NonNegativeInt',
'Percent',
'Positive',
'PositiveInt',
'Size',
)

Expand Down Expand Up @@ -80,44 +77,6 @@ def validate(self, value: Any, detail: bool = True) -> None:
if not (0 < value):
raise ValueError(f"expected a positive number, got {value!r}")

class NonNegativeInt(Int):
"""
Accept non-negative integers.
.. deprecated:: 3.0.0
Use ``NonNegative(Int)`` instead.
"""

def __init__(self, default: Init[int] = Intrinsic, *, help: str | None = None) -> None:
deprecated((3, 0, 0), "NonNegativeInt", "NonNegative(Int)")
super().__init__(default=default, help=help)

def validate(self, value: Any, detail: bool = True) -> None:
super().validate(value, detail)

if not (0 <= value):
raise ValueError(f"expected non-negative integer, got {value!r}")

class PositiveInt(Int):
"""
Accept positive integers.
.. deprecated:: 3.0.0
Use ``Positive(Int)`` instead.
"""

def __init__(self, default: Init[int] = Intrinsic, *, help: str | None = None) -> None:
deprecated((3, 0, 0), "Positive", "Positive(Int)")
super().__init__(default=default, help=help)

def validate(self, value: Any, detail: bool = True) -> None:
super().validate(value, detail)

if not (0 < value):
raise ValueError(f"expected positive integer, got {value!r}")

class Interval(SingleParameterizedProperty[T]):
""" Accept numeric values that are contained within a given interval.
Expand Down
36 changes: 10 additions & 26 deletions src/bokeh/models/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,14 @@
Enum,
Instance,
Int,
List,
Nullable,
Seq,
String,
)
from ..core.validation import error
from ..core.validation.errors import MISSING_MERCATOR_DIMENSION
from ..model import Model
from ..util.deprecation import deprecated
from ..util.strings import format_docstring
from ..util.warnings import warn
from .tickers import Ticker

#-----------------------------------------------------------------------------
Expand All @@ -63,7 +60,6 @@
"CategoricalTickFormatter",
"CustomJSTickFormatter",
"DatetimeTickFormatter",
"FuncTickFormatter",
"LogTickFormatter",
"MercatorTickFormatter",
"NumeralTickFormatter",
Expand Down Expand Up @@ -386,18 +382,6 @@ def __init__(self, *args, **kwargs) -> None:
'''
""")

def FuncTickFormatter(*args, **kw):
from bokeh.util.deprecation import deprecated
deprecated((3, 0, 0), "FuncTickFormatter", "CustomJSTickFormatter")
return CustomJSTickFormatter(*args, **kw)

def _deprecated_datetime_list_format(fmt: list[str]) -> str:
deprecated("Passing lists of formats for DatetimeTickFormatter scales was deprecated in Bokeh 3.0. Configure a single string format for each scale")
if len(fmt) == 0:
raise ValueError("Datetime format list must contain one element")
if len(fmt) > 1:
warn(f"DatetimeFormatter scales now only accept a single format. Using the first provided: {fmt[0]!r}")
return fmt[0]

class DatetimeTickFormatter(TickFormatter):
''' A ``TickFormatter`` for displaying datetime values nicely across a
Expand Down Expand Up @@ -609,34 +593,34 @@ def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)

microseconds = String(help=_DATETIME_TICK_FORMATTER_HELP("``microseconds``"),
default="%fus").accepts(List(String), _deprecated_datetime_list_format)
default="%fus")

milliseconds = String(help=_DATETIME_TICK_FORMATTER_HELP("``milliseconds``"),
default="%3Nms").accepts(List(String), _deprecated_datetime_list_format)
default="%3Nms")

seconds = String(help=_DATETIME_TICK_FORMATTER_HELP("``seconds``"),
default="%Ss").accepts(List(String), _deprecated_datetime_list_format)
default="%Ss")

minsec = String(help=_DATETIME_TICK_FORMATTER_HELP("``minsec`` (for combined minutes and seconds)"),
default=":%M:%S").accepts(List(String), _deprecated_datetime_list_format)
default=":%M:%S")

minutes = String(help=_DATETIME_TICK_FORMATTER_HELP("``minutes``"),
default=":%M").accepts(List(String), _deprecated_datetime_list_format)
default=":%M")

hourmin = String(help=_DATETIME_TICK_FORMATTER_HELP("``hourmin`` (for combined hours and minutes)"),
default="%H:%M").accepts(List(String), _deprecated_datetime_list_format)
default="%H:%M")

hours = String(help=_DATETIME_TICK_FORMATTER_HELP("``hours``"),
default="%Hh").accepts(List(String), _deprecated_datetime_list_format)
default="%Hh")

days = String(help=_DATETIME_TICK_FORMATTER_HELP("``days``"),
default="%m/%d").accepts(List(String), _deprecated_datetime_list_format)
default="%m/%d")

months = String(help=_DATETIME_TICK_FORMATTER_HELP("``months``"),
default="%m/%Y").accepts(List(String), _deprecated_datetime_list_format)
default="%m/%Y")

years = String(help=_DATETIME_TICK_FORMATTER_HELP("``years``"),
default="%Y").accepts(List(String), _deprecated_datetime_list_format)
default="%Y")

strip_leading_zeros = Either(Bool, Seq(Enum(ResolutionType)), default=False, help="""
Whether to strip any leading zeros in the formatted ticks.
Expand Down
27 changes: 1 addition & 26 deletions src/bokeh/models/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@
String,
)
from ..model import Model
from ..util.deprecation import deprecated
from ..util.serialization import convert_datetime_array
from ..util.warnings import BokehUserWarning, warn
from .callbacks import CustomJS
from .filters import AllIndices, Filter, IntersectionFilter
from .filters import AllIndices, Filter
from .selections import Selection, SelectionPolicy, UnionRenderers

if TYPE_CHECKING:
Expand Down Expand Up @@ -735,9 +734,6 @@ class CDSView(Model):
'''

def __init__(self, *args: TAny, **kwargs: TAny) -> None:
if "source" in kwargs:
del kwargs["source"]
deprecated("CDSView.source is no longer needed, and is now ignored. In a future release, passing source will result an error.")
super().__init__(*args, **kwargs)

filter = Instance(Filter, default=InstanceDefault(AllIndices), help="""
Expand All @@ -755,27 +751,6 @@ def __init__(self, *args: TAny, **kwargs: TAny) -> None:
cds_view.filter &= ~IndexFilter(indices=[10, 11])
""")

@property
def filters(self) -> list[Filter]:
deprecated("CDSView.filters was deprecated in bokeh 3.0. Use CDSView.filter instead.")
filter = self.filter
if isinstance(filter, IntersectionFilter):
return filter.operands
elif isinstance(filter, AllIndices):
return []
else:
return [filter]

@filters.setter
def filters(self, filters: list[Filter]) -> None:
deprecated("CDSView.filters was deprecated in bokeh 3.0. Use CDSView.filter instead.")
if len(filters) == 0:
self.filter = AllIndices()
elif len(filters) == 1:
self.filter = filters[0]
else:
self.filter = IntersectionFilter(operands=filters)

class GeoJSONDataSource(ColumnarDataSource):
'''
Expand Down
7 changes: 0 additions & 7 deletions src/bokeh/themes/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
# Bokeh imports
from ..core.has_props import HasProps
from ..core.types import PathLike
from ..util.deprecation import deprecated

if TYPE_CHECKING:
from ..model import Model
Expand Down Expand Up @@ -179,12 +178,6 @@ def __init__(self, filename: PathLike | None = None, json: dict[str, Any] | None
if not isinstance(value, dict):
raise ValueError(f"theme problem: attrs.{key} should be a dictionary of properties, not {value!r}")

# Special-case to allow Figure to continue working with a deprecation
if "Figure" in self._json['attrs']:
self._json['attrs']['figure'] = self._json['attrs']['Figure']
del self._json['attrs']['Figure']
deprecated((3, 0, 0), "Use of 'Figure' as a key in Theme attributes", "'figure' (lower-case) as a key")

self._line_defaults = self._json.get('line_defaults', _empty_dict)
self._fill_defaults = self._json.get('fill_defaults', _empty_dict)
self._text_defaults = self._json.get('text_defaults', _empty_dict)
Expand Down

0 comments on commit cf19b57

Please sign in to comment.