Skip to content

Commit 6b72e57

Browse files
authored
Merge pull request #48 from highcharts-for-python/develop
PR for v.1.4.5
2 parents 84e849f + fe56987 commit 6b72e57

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Release 1.4.5
2+
=========================================
3+
4+
* **BUGFIX**: Fixed ``FlagDataCollection`` serialization bug.
5+
6+
---------------------
7+
18
Release 1.4.4
29
=========================================
310

highcharts_stock/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.4.4'
1+
__version__ = '1.4.5'

highcharts_stock/options/series/data/flags.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def _get_props_from_array(cls, length = None) -> List[str]:
108108
1: ['x'],
109109
2: ['x', 'title']
110110
}
111+
111112
return cls._get_props_from_array_helper(prop_list, length)
112113

113114
def to_array(self, force_object = False) -> List | Dict:
@@ -128,23 +129,7 @@ def to_array(self, force_object = False) -> List | Dict:
128129
:returns: The array representation of the data point.
129130
:rtype: :class:`list <python:list>` of values or :class:`dict <python:dict>`
130131
"""
131-
if self.requires_js_object or force_object:
132-
return self._to_untrimmed_dict()
133-
134-
if self.x is not None:
135-
x = self.x
136-
else:
137-
x = constants.EnforcedNull
138-
139-
if self.title is not None:
140-
title = self.title
141-
else:
142-
title = constants.EnforcedNull
143-
144-
if self.title is None:
145-
return [x]
146-
147-
return [x, title]
132+
return self._to_untrimmed_dict()
148133

149134
@classmethod
150135
def _get_kwargs_from_dict(cls, as_dict):
@@ -212,6 +197,18 @@ def _to_untrimmed_dict(self, in_cls = None) -> dict:
212197

213198

214199
class FlagDataCollection(DataPointCollection):
200+
201+
@property
202+
def requires_js_object(self) -> bool:
203+
"""Indicates whether or not the data point *must* be serialized to a JS literal
204+
object or whether it can be serialized to a primitive array.
205+
206+
:returns: ``True`` if the data point *must* be serialized to a JS literal object.
207+
``False`` if it can be serialized to an array.
208+
:rtype: :class:`bool <python:bool>`
209+
"""
210+
return True
211+
215212
@classmethod
216213
def _get_data_point_class(cls):
217214
"""The Python class to use as the underlying data point within the Collection.

0 commit comments

Comments
 (0)