Skip to content

Commit 314349a

Browse files
authored
Merge pull request #51 from highcharts-for-python/develop
PR for v.1.7.1
2 parents 2c2f25a + 17e8d27 commit 314349a

File tree

8 files changed

+64
-11
lines changed

8 files changed

+64
-11
lines changed

CHANGES.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11

2+
Release 1.7.1
3+
=========================================
4+
5+
* **BUGFIX:** Fixed the use of an improper constructor when exporting Map charts.
6+
* **ENHANCEMENT:** Bumped requirement to use latest version of Highcharts Core for Python, which
7+
also fixes an export-related serialization error.
8+
* **ENHANCEMENT:** Bumped ``requests`` version number for security patch.
9+
10+
--------------------
11+
212
Release 1.7.0
313
=========================================
414

highcharts_maps/__version__.py

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

highcharts_maps/chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def download_chart(self,
391391
:rtype: :class:`bytes <python:bytes>` or :class:`str <python:str>`
392392
"""
393393
if self.is_maps_chart:
394-
constructor = 'Stock'
394+
constructor = 'Map'
395395
else:
396396
constructor = 'Chart'
397397

highcharts_maps/options/series/data/map_data.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,48 @@ def _to_untrimmed_dict(self, in_cls = None) -> dict:
249249

250250
return untrimmed
251251

252+
@staticmethod
253+
def trim_dict(untrimmed: dict,
254+
to_json: bool = False,
255+
context: str = None,
256+
for_export: bool = False) -> dict:
257+
"""Remove keys from ``untrimmed`` whose values are :obj:`None <python:None>` and
258+
convert values that have ``.to_dict()`` methods.
259+
260+
:param untrimmed: The :class:`dict <python:dict>` whose values may still be
261+
:obj:`None <python:None>` or Python objects.
262+
:type untrimmed: :class:`dict <python:dict>`
263+
264+
:param to_json: If ``True``, will remove all keys from ``untrimmed`` that are not
265+
serializable to JSON. Defaults to ``False``.
266+
:type to_json: :class:`bool <python:bool>`
267+
268+
:param context: If provided, will inform the method of the context in which it is
269+
being run which may inform special handling cases (e.g. where empty strings may
270+
be important / allowable). Defaults to :obj:`None <python:None>`.
271+
:type context: :class:`str <python:str>` or :obj:`None <python:None>`
272+
273+
:param for_export: If ``True``, indicates that the method is being run to
274+
produce a JSON for consumption by the export server. Defaults to ``False``.
275+
:type for_export: :class:`bool <python:bool>`
276+
277+
:returns: Trimmed :class:`dict <python:dict>`
278+
:rtype: :class:`dict <python:dict>`
279+
"""
280+
if not for_export:
281+
return HighchartsMeta.trim_dict(untrimmed = untrimmed,
282+
to_json = to_json,
283+
context = context,
284+
for_export = for_export)
285+
286+
topology = untrimmed.get('topology', None)
287+
288+
return topology
289+
252290
def to_json(self,
253291
filename = None,
254-
encoding = 'utf-8'):
292+
encoding = 'utf-8',
293+
for_export: bool = False):
255294
"""Generate a JSON string/byte string representation of the object compatible with
256295
the Highcharts JavaScript library.
257296
@@ -271,6 +310,10 @@ def to_json(self,
271310
to ``'utf-8'``.
272311
:type encoding: :class:`str <python:str>`
273312
313+
:param for_export: If ``True``, indicates that the method is being run to
314+
produce a JSON for consumption by the export server. Defaults to ``False``.
315+
:type for_export: :class:`bool <python:bool>`
316+
274317
:returns: A JSON representation of the object compatible with the Highcharts
275318
library.
276319
:rtype: :class:`str <python:str>` or :class:`bytes <python:bytes>`

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ classifiers = [
5858

5959
requires-python = ">= 3.10"
6060
dependencies = [
61-
"highcharts-core>=1.7.0",
61+
"highcharts-core>=1.9.3",
6262
"esprima>=4.0.1",
6363
"validator-collection>=1.5.0",
64-
"requests>=2.31.0",
64+
"requests>=2.32.0",
6565
"topojson>=1.5",
6666
"geojson>=3.0"
6767
]

requirements.dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Sphinx==6.1.3
1414
sphinx-rtd-theme==1.2.0
1515
sphinx-toolbox>=3.4.0
1616
sphinx-tabs>=3.4.1
17-
requests==2.31.0
17+
requests==2.32.0
1818
tox==4.0.0
1919
validator-collection==1.5.0
20-
highcharts-core>=1.7.0
20+
highcharts-core>=1.9.3

requirements.travis.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Sphinx==6.1.3
1414
sphinx-rtd-theme==1.2.0
1515
sphinx-toolbox>=3.4.0
1616
sphinx-tabs>=3.4.1
17-
requests==2.31.0
17+
requests==2.32.0
1818
tox==4.0.0
1919
validator-collection==1.5.0
20-
highcharts-core>=1.7.0
20+
highcharts-core>=1.9.3

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
esprima==4.0.1
22
geojson==3.0.1
3-
requests==2.31.0
3+
requests==2.32.0
44
topojson==1.5
55
validator-collection==1.5.0
6-
highcharts-core>=1.7.0
6+
highcharts-core>=1.9.3

0 commit comments

Comments
 (0)