Skip to content

Commit

Permalink
Merge pull request #103 from OasisLMF/release/3.2.3
Browse files Browse the repository at this point in the history
Release 3.2.3
  • Loading branch information
sambles authored Apr 29, 2024
2 parents 697976a + 15374ef commit d142d4f
Show file tree
Hide file tree
Showing 21 changed files with 479 additions and 368 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
ODS_Tools Changelog
===================

`3.2.3`_
---------
* [#98](https://github.com/OasisLMF/ODS_Tools/pull/104) - odtf outstanding issues
* [#97](https://github.com/OasisLMF/ODS_Tools/pull/97) - Release 3.2.2
* [#105](https://github.com/OasisLMF/ODS_Tools/pull/106) - Correlation Settings in Model settings
* [#96](https://github.com/OasisLMF/ODS_Tools/pull/99) - Verify that summary IDs are unique
.. _`3.2.3`: https://github.com/OasisLMF/ODS_Tools/compare/3.2.2...3.2.3

`3.2.2`_
---------
* [#92](https://github.com/OasisLMF/ODS_Tools/pull/92) - Release 3.2.1
Expand Down
2 changes: 1 addition & 1 deletion ods_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '3.2.2'
__version__ = '3.2.3'

import logging

Expand Down
27 changes: 24 additions & 3 deletions ods_tools/data/model_settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,27 @@
]
}
},
"correlation_settings": {
"type": "array",
"title": "Correlation Settings",
"description": "The Legacy Correlation Settings.",
"items": {
"type": "object",
"properties": {
"peril_correlation_group": {
"type": "integer",
"title": "Peril Correlation Group",
"description": "The Peril Correlation Group",
"minLength": 1
},
"correlation_value": {
"type": "string",
"title": "Correlation Value",
"description": "The Correlation Value"
}
}
}
},
"vulnerability_adjustments": {
"type": "object",
"title": "Vulnerability Adjustments",
Expand Down Expand Up @@ -583,7 +604,7 @@
}
},
"additionalProperties": false
},
},
"string_parameters":{
"title":"Single string paramters",
"type":"array",
Expand Down Expand Up @@ -1219,8 +1240,8 @@
},
"correlation_settings": {
"type": "array",
"title": "Correlation Settings",
"description": "The Correlation Settings",
"title": "Correlation Settings (Legacy)",
"description": "Legacy Correlation Settings. Now moved to model_settings",
"items": {
"type": "object",
"properties": {
Expand Down
7 changes: 5 additions & 2 deletions ods_tools/odtf/connector/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def __init__(self, config, **options):

def _data_serializer(self, row):
return {
k: v if v is not None and not isinstance(v, NotSetType) else ""
k: f'"{v}"'.strip() if isinstance(v, str) and any(d in v for d in [',', ';', '\t', '\n', '"']) else (
v if v is not None and not isinstance(v, NotSetType) else "")
for k, v in row.items()
}

Expand All @@ -83,7 +84,9 @@ def load(self, data: Iterable[Dict[str, Any]]):

with open(self.file_path, "w", newline="") as f:
writer = csv.DictWriter(
f, fieldnames=list(first_row.keys()), quoting=self.quoting
f,
fieldnames=list(first_row.keys()),
quoting=self.quoting
)

if self.write_header:
Expand Down
Loading

0 comments on commit d142d4f

Please sign in to comment.