Skip to content

Commit

Permalink
Merge pull request #462 from OpenDataServices/pr-459
Browse files Browse the repository at this point in the history
Pr 459
  • Loading branch information
odscjames authored Sep 17, 2024
2 parents 62247ad + c7de0e7 commit 9eb749a
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed

- Some typos in docs, comments and examples
- Put back some translations that were removed
- Minor python tidyups
- Avoid deprecation warning from the ijson package. https://github.com/OpenDataServices/flatten-tool/pull/458

### Removed
Expand Down
6 changes: 3 additions & 3 deletions examples/bods/schema/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"assertedBy": {
"title": "Asserted by",
"description": "Who is making this statement? This may be the name of the person or organisation making a self-declaration (in which case, please make sure the name field matches the organisation or person name field), or the name or description of some other party. If this statment has been verified, this may also include the name of the organisation providing verification.",
"description": "Who is making this statement? This may be the name of the person or organisation making a self-declaration (in which case, please make sure the name field matches the organisation or person name field), or the name or description of some other party. If this statement has been verified, this may also include the name of the organisation providing verification.",
"type": "array",
"items": {
"$ref": "#/definitions/Agent"
Expand Down Expand Up @@ -375,7 +375,7 @@
},
"description": {
"title": "Description",
"description": "A free-text description to annotate this statment or field.",
"description": "A free-text description to annotate this statement or field.",
"type": "string"
},
"transformedContent": {
Expand Down Expand Up @@ -489,4 +489,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions examples/bods/schema/entity-statement.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
},
"dissolutionDate": {
"title": "Dissolution date",
"description": "If this entity is no longer active, provide the date on which it was disolved or ceased. Please provide as precise a date as possible in ISO 8601 format. When only the year or year and month is known, these can be given as YYYY or YYYY-MM.",
"description": "If this entity is no longer active, provide the date on which it was dissolved or ceased. Please provide as precise a date as possible in ISO 8601 format. When only the year or year and month is known, these can be given as YYYY or YYYY-MM.",
"type": "string",
"pattern": "^([\\+-]?\\d{4}(?!\\d{2}\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$",
"propertyOrder": 35
Expand Down Expand Up @@ -131,4 +131,4 @@
"statementType",
"entityType"
]
}
}
4 changes: 2 additions & 2 deletions examples/bods/schema/person-statement.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "person-statment.json",
"id": "person-statement.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"version": "0.1",
"type": "object",
Expand Down Expand Up @@ -141,4 +141,4 @@
"missingPersonType"
]
}
}
}
2 changes: 1 addition & 1 deletion flattentool/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def main():
try:
# Note: Ensures that empty arguments are not passed to the create_template function
create_template(**kwargs_from_parsed_args(args))
except (OSError, IOError) as e:
except OSError as e:
print(str(e))
return
elif args.subparser_name == "flatten":
Expand Down
2 changes: 1 addition & 1 deletion flattentool/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ def read_sheets(self):
for sheet in self.exclude_sheets or []:
self.sheet_names_map.pop(sheet, None)

sheet_names = list(sheet for sheet in self.sheet_names_map.keys())
sheet_names = list(self.sheet_names_map.keys())
self.sub_sheet_names = sheet_names
self.configure_sheets()

Expand Down
2 changes: 1 addition & 1 deletion flattentool/json_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def parse(self):
continue

self.parse_json_dict(json_dict, sheet=self.main_sheet)
# only persist every 2000 objects. peristing more often slows down storing.
# only persist every 2000 objects. persisting more often slows down storing.
# 2000 top level objects normally not too much to store in memory.
if num % 2000 == 0 and num != 0:
transaction.commit()
Expand Down
4 changes: 2 additions & 2 deletions flattentool/locale/en/LC_MESSAGES/flatten-tool.po
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ msgid ""
msgstr ""

#: flattentool/json_input.py:193
msgid "Etiher json_filename or root_json_dict must be supplied"
msgid "Either json_filename or root_json_dict must be supplied"
msgstr ""

#: flattentool/json_input.py:198
Expand Down Expand Up @@ -216,7 +216,7 @@ msgstr ""

#: flattentool/schema.py:390
msgid ""
"Unknown type_set: {}, did you forget to explicity set the \"type\" key on"
"Unknown type_set: {}, did you forget to explicitly set the \"type\" key on"
" \"items\"?"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions flattentool/locale/es/LC_MESSAGES/flatten-tool.po
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ msgstr ""
"como una lista en un archivo o mediante un esquema)"

#: flattentool/json_input.py:193
msgid "Etiher json_filename or root_json_dict must be supplied"
msgid "Either json_filename or root_json_dict must be supplied"
msgstr "Se debe proporcionar el r json_filename o root_json_dict"

#: flattentool/json_input.py:198
Expand Down Expand Up @@ -261,7 +261,7 @@ msgstr ""

#: flattentool/schema.py:390
msgid ""
"Unknown type_set: {}, did you forget to explicity set the \"type\" key on "
"Unknown type_set: {}, did you forget to explicitly set the \"type\" key on "
"\"items\"?"
msgstr ""
"Type_set desconocido: {}, ¿olvidó establecer explícitamente la clave "
Expand Down
1 change: 1 addition & 0 deletions flattentool/sort_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def get_schema_element(self, tag_name, name_attribute):
Return the specified element from the schema.
tag_name -- the name of the tag in the schema, e.g. 'complexType'
name_attribute -- the value of the 'name' attribute in the schema, ie.
the name of the element/type etc. being described,
e.g. iati-activities
Expand Down
2 changes: 1 addition & 1 deletion flattentool/tests/fixtures/SOURCES
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ License: http://data.gc.ca/eng/open-government-licence-canada

fundingproviders-grants_fixed_2_grants.json
Source: Edited version of data from http://data.threesixtygiving.org/dataset/welcome-trust-grants-awarded
(converted to different formats; key "Grants" changed to "grants"; truncated to two releases; personal and organization indentifiers replaced)
(converted to different formats; key "Grants" changed to "grants"; truncated to two releases; personal and organization identifiers replaced)
License: Creative Commons Attribution
2 changes: 1 addition & 1 deletion flattentool/tests/fixtures/release-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@
"Transaction": {
"type": "object",
"title": "Transaction Information",
"description": "A spending transaction related to the contracting process. Draws upon the data models of the [Budget Data Package](https://github.com/openspending/budget-data-package/blob/master/specification.md) and the [International Aid Transpareny Initiative](http://iatistandard.org/activity-standard/iati-activities/iati-activity/transaction/) and should be used to cross-reference to more detailed information held using a Budget Data Package, IATI file, or to provide enough information to allow a user to manually or automatically cross-reference with some other published source of transactional spending data.",
"description": "A spending transaction related to the contracting process. Draws upon the data models of the [Budget Data Package](https://github.com/openspending/budget-data-package/blob/master/specification.md) and the [International Aid Transparency Initiative](http://iatistandard.org/activity-standard/iati-activities/iati-activity/transaction/) and should be used to cross-reference to more detailed information held using a Budget Data Package, IATI file, or to provide enough information to allow a user to manually or automatically cross-reference with some other published source of transactional spending data.",
"required": ["id"],
"properties": {
"id":{
Expand Down
2 changes: 1 addition & 1 deletion flattentool/tests/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_blank_sheets(tmpdir):
wb = openpyxl.load_workbook(tmpdir.join("release.xlsx").strpath)
assert wb.sheetnames == ["release"]
rows = list(wb["release"].rows)
# openpyxl fixed this bug but earler versions of python are stuck with it.
# openpyxl fixed this bug but earlier versions of python are stuck with it.
# remove when we no longer support 3.5
if sys.version_info >= (3, 6, 0):
assert len(rows) == 0
Expand Down

0 comments on commit 9eb749a

Please sign in to comment.