Skip to content

PR for v.1.7.1 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

Release 1.7.1
=========================================

* **BUGFIX:** Fixed the use of an improper constructor when exporting Map charts.
* **ENHANCEMENT:** Bumped requirement to use latest version of Highcharts Core for Python, which
also fixes an export-related serialization error.
* **ENHANCEMENT:** Bumped ``requests`` version number for security patch.

--------------------

Release 1.7.0
=========================================

Expand Down
2 changes: 1 addition & 1 deletion highcharts_maps/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.7.0'
__version__ = '1.7.1'
2 changes: 1 addition & 1 deletion highcharts_maps/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def download_chart(self,
:rtype: :class:`bytes <python:bytes>` or :class:`str <python:str>`
"""
if self.is_maps_chart:
constructor = 'Stock'
constructor = 'Map'
else:
constructor = 'Chart'

Expand Down
45 changes: 44 additions & 1 deletion highcharts_maps/options/series/data/map_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,48 @@ def _to_untrimmed_dict(self, in_cls = None) -> dict:

return untrimmed

@staticmethod
def trim_dict(untrimmed: dict,
to_json: bool = False,
context: str = None,
for_export: bool = False) -> dict:
"""Remove keys from ``untrimmed`` whose values are :obj:`None <python:None>` and
convert values that have ``.to_dict()`` methods.

:param untrimmed: The :class:`dict <python:dict>` whose values may still be
:obj:`None <python:None>` or Python objects.
:type untrimmed: :class:`dict <python:dict>`

:param to_json: If ``True``, will remove all keys from ``untrimmed`` that are not
serializable to JSON. Defaults to ``False``.
:type to_json: :class:`bool <python:bool>`

:param context: If provided, will inform the method of the context in which it is
being run which may inform special handling cases (e.g. where empty strings may
be important / allowable). Defaults to :obj:`None <python:None>`.
:type context: :class:`str <python:str>` or :obj:`None <python:None>`

:param for_export: If ``True``, indicates that the method is being run to
produce a JSON for consumption by the export server. Defaults to ``False``.
:type for_export: :class:`bool <python:bool>`

:returns: Trimmed :class:`dict <python:dict>`
:rtype: :class:`dict <python:dict>`
"""
if not for_export:
return HighchartsMeta.trim_dict(untrimmed = untrimmed,
to_json = to_json,
context = context,
for_export = for_export)

topology = untrimmed.get('topology', None)

return topology

def to_json(self,
filename = None,
encoding = 'utf-8'):
encoding = 'utf-8',
for_export: bool = False):
"""Generate a JSON string/byte string representation of the object compatible with
the Highcharts JavaScript library.

Expand All @@ -271,6 +310,10 @@ def to_json(self,
to ``'utf-8'``.
:type encoding: :class:`str <python:str>`

:param for_export: If ``True``, indicates that the method is being run to
produce a JSON for consumption by the export server. Defaults to ``False``.
:type for_export: :class:`bool <python:bool>`

:returns: A JSON representation of the object compatible with the Highcharts
library.
:rtype: :class:`str <python:str>` or :class:`bytes <python:bytes>`
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ classifiers = [

requires-python = ">= 3.10"
dependencies = [
"highcharts-core>=1.7.0",
"highcharts-core>=1.9.3",
"esprima>=4.0.1",
"validator-collection>=1.5.0",
"requests>=2.31.0",
"requests>=2.32.0",
"topojson>=1.5",
"geojson>=3.0"
]
Expand Down
4 changes: 2 additions & 2 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Sphinx==6.1.3
sphinx-rtd-theme==1.2.0
sphinx-toolbox>=3.4.0
sphinx-tabs>=3.4.1
requests==2.31.0
requests==2.32.0
tox==4.0.0
validator-collection==1.5.0
highcharts-core>=1.7.0
highcharts-core>=1.9.3
4 changes: 2 additions & 2 deletions requirements.travis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Sphinx==6.1.3
sphinx-rtd-theme==1.2.0
sphinx-toolbox>=3.4.0
sphinx-tabs>=3.4.1
requests==2.31.0
requests==2.32.0
tox==4.0.0
validator-collection==1.5.0
highcharts-core>=1.7.0
highcharts-core>=1.9.3
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
esprima==4.0.1
geojson==3.0.1
requests==2.31.0
requests==2.32.0
topojson==1.5
validator-collection==1.5.0
highcharts-core>=1.7.0
highcharts-core>=1.9.3
Loading