Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Merge e65a31b into fa91827
Browse files Browse the repository at this point in the history
  • Loading branch information
aguilerapy committed Sep 4, 2020
2 parents fa91827 + e65a31b commit a351851
Show file tree
Hide file tree
Showing 59 changed files with 1,305 additions and 404 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ __pycache__
*.mo
.coverage
/media
.DS_Store
130 changes: 86 additions & 44 deletions assets/selection.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
{}
],
"properties": {
"order": 18,
"order": 41,
"id": 9,
"name": "convert-to-json",
"prevSize": 32,
"code": 59657
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 0
},
{
Expand All @@ -54,7 +54,7 @@
"M420.253 321.676c-14.246 0-25.952-11.677-25.952-25.958v-147.068h-216.259c-14.374 0-25.952 11.576-25.952 25.963v501.736c0 14.381 11.576 25.981 25.952 25.981h363.338c14.397 0 25.958-11.599 25.958-25.981v-354.672h-147.087zM364.596 569.116v-42.8h-108.685v-28.639h108.692v-42.8l98.912 57.122-98.919 57.116z",
"M805.871 494.697c-14.258 0-25.952-11.669-25.952-25.952v-147.068h-185.522v354.672c0 29.245-23.783 53.040-53.017 53.040h-3.685v119.982c0 14.381 11.584 25.981 25.963 25.981h363.333c14.392 0 25.963-11.599 25.963-25.981v-354.672h-147.087zM849.132 699.342h-108.697v42.793l-98.9-57.116 98.9-57.105v42.793h108.697v28.632z"
],
"width": 1105,
"width": 1056,
"attrs": [
{},
{},
Expand All @@ -64,7 +64,7 @@
"isMulticolor": false,
"isMulticolor2": false,
"tags": [
"Release package"
"Combine packages"
],
"grid": 16
},
Expand All @@ -75,14 +75,14 @@
{}
],
"properties": {
"order": 2,
"order": 40,
"id": 0,
"name": "combine-package",
"name": "combine-packages",
"prevSize": 32,
"code": 59656
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 1
},
{
Expand Down Expand Up @@ -110,15 +110,15 @@
{}
],
"properties": {
"order": 13,
"order": 39,
"id": 2,
"name": "convert-to-spreadsheet",
"prevSize": 32,
"code": 59649
},
"setIdx": 1,
"setId": 3,
"iconIdx": 3
"setIdx": 0,
"setId": 1,
"iconIdx": 2
},
{
"icon": {
Expand All @@ -143,7 +143,7 @@
"tags": [
"Compiled releases"
],
"grid": 0
"grid": 16
},
"attrs": [
{},
Expand All @@ -154,15 +154,15 @@
{}
],
"properties": {
"order": 3,
"order": 38,
"id": 1,
"name": "compile-releases",
"prevSize": 32,
"code": 59648
},
"setIdx": 1,
"setId": 3,
"iconIdx": 2
"setIdx": 0,
"setId": 1,
"iconIdx": 3
},
{
"icon": {
Expand All @@ -182,22 +182,22 @@
"tags": [
"Data review tool"
],
"grid": 0
"grid": 16
},
"attrs": [
{},
{},
{}
],
"properties": {
"order": 11,
"order": 37,
"id": 3,
"name": "data-review",
"prevSize": 32,
"code": 59650
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 4
},
{
Expand All @@ -214,20 +214,20 @@
"tags": [
"Generate spreadsheet"
],
"grid": 0
"grid": 16
},
"attrs": [
{}
],
"properties": {
"order": 5,
"order": 36,
"id": 4,
"name": "schema-spreadsheet",
"prevSize": 32,
"code": 59651
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 5
},
{
Expand All @@ -250,7 +250,7 @@
"tags": [
"OCDS extension creator"
],
"grid": 0
"grid": 16
},
"attrs": [
{},
Expand All @@ -259,14 +259,14 @@
{}
],
"properties": {
"order": 7,
"order": 35,
"id": 5,
"name": "extension-creator",
"prevSize": 32,
"code": 59652
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 6
},
{
Expand Down Expand Up @@ -294,7 +294,7 @@
"tags": [
"Record packages"
],
"grid": 0
"grid": 16
},
"attrs": [
{},
Expand All @@ -306,14 +306,14 @@
{}
],
"properties": {
"order": 8,
"order": 34,
"id": 6,
"name": "package-records",
"prevSize": 32,
"code": 59653
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 7
},
{
Expand All @@ -335,7 +335,7 @@
"tags": [
"Release packages"
],
"grid": 0
"grid": 16
},
"attrs": [
{},
Expand All @@ -344,14 +344,14 @@
{}
],
"properties": {
"order": 12,
"order": 33,
"id": 7,
"name": "package-releases",
"prevSize": 32,
"code": 59654
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 8
},
{
Expand All @@ -369,22 +369,60 @@
"tags": [
"Upgrade"
],
"grid": 0
"grid": 16
},
"attrs": [
{},
{}
],
"properties": {
"order": 10,
"order": 42,
"id": 8,
"name": "upgrade",
"prevSize": 32,
"code": 59655
},
"setIdx": 1,
"setId": 3,
"setIdx": 0,
"setId": 1,
"iconIdx": 9
},
{
"icon": {
"paths": [
"M155.316 148.832c-9.982 0.535-15.061 2.139-19.785 6.506-3.119 2.941-6.328 8.288-7.664 12.744-0.802 2.852-1.069 63.276-1.069 257.114 0 268.7-0.178 256.579 3.832 264.244 1.961 3.743 6.684 7.754 12.12 10.516l4.902 2.317h375.645l4.991-2.317c9.179-4.367 13.725-10.427 15.507-20.943 1.515-8.912 1.426-356.306-0.089-356.84-0.624-0.267-35.025-0.535-76.466-0.624-71.029-0.267-75.575-0.356-79.942-1.961-6.506-2.317-10.516-5.971-13.636-12.477l-2.674-5.704v-75.129c0-41.441-0.356-75.753-0.802-76.466-0.713-1.069-16.487-1.248-103.202-1.337-56.235-0.089-106.5 0.089-111.669 0.356zM337.033 471.628c0.089 10.873 0.356 19.963 0.624 20.23s24.865 0.713 54.542 0.98l54.096 0.446 0.267 12.833c0.178 8.199-0.089 13.19-0.713 13.903-0.802 0.98-11.407 1.248-54.096 1.248-31.638 0-53.473 0.356-54.007 0.891-0.446 0.446-0.713 9.090-0.713 19.963 0.089 12.388-0.178 19.428-0.713 19.785-0.535 0.267-3.654-1.069-6.951-2.941-3.387-1.961-7.486-4.367-9.179-5.347-11.675-6.595-14.705-8.377-16.755-9.803-1.337-0.98-3.565-2.317-5.080-3.030-2.941-1.426-9.179-4.991-15.774-8.823-2.406-1.426-4.456-2.585-4.634-2.585s-2.406-1.426-4.991-3.119c-2.585-1.693-4.991-3.119-5.347-3.119-0.446 0-5.169-2.585-10.427-5.615-5.347-3.119-10.695-5.971-11.853-6.238-2.585-0.713-6.862-3.832-6.149-4.545 0.267-0.267 8.021-4.813 17.379-10.16 9.269-5.347 20.765-11.942 25.578-14.794 4.813-2.763 11.407-6.506 14.705-8.199 3.297-1.782 6.595-3.654 7.308-4.189 1.693-1.337 4.991-3.208 9.090-5.258 1.872-0.891 7.308-4.010 12.031-6.951s9.358-5.347 10.16-5.347c1.426 0 1.604 1.693 1.604 19.785z",
"M407.439 148.654c-0.713 0.267-1.515 0.891-1.872 1.426-0.98 1.337-0.891 134.394 0.089 135.82 0.624 0.98 11.229 1.248 58.998 1.159 78.248 0 77.713 0 79.139-0.891 1.069-0.713 1.069-1.872 0.178-7.664-0.624-3.743-1.961-8.377-3.030-10.338-1.515-2.852-102.4-104.717-112.471-113.54-1.426-1.337-4.010-2.941-5.615-3.654-3.297-1.426-13.368-2.941-15.418-2.317z",
"M658.225 321.548l-86.715 0.178v15.418c0 8.377-0.089 90.28-0.267 181.985l-0.178 166.656-2.406 6.684c-1.337 3.654-3.208 7.664-4.1 8.912s-2.317 3.387-3.119 4.902c-1.159 2.317-3.297 4.634-9.358 10.338-7.13 6.595-18.715 11.318-30.39 12.299l-6.773 0.535v126.552l2.228 4.456c3.030 6.149 7.843 10.605 13.903 12.833l5.169 1.961h186.085c132.523 0 187.065-0.267 189.739-0.98 9.803-2.674 16.398-9.536 18.715-19.607 0.891-3.476 1.159-357.91 0.356-359.247-0.356-0.446-30.925-0.802-77.624-0.802-75.396 0-77.179 0-80.565-1.782-4.634-2.406-9.536-6.773-11.407-10.16-3.743-6.951-3.743-6.862-3.743-85.021 0-59.265-0.267-75.129-1.069-75.485-2.585-0.802-16.042-0.891-98.479-0.624zM729.255 632.313c3.030 1.693 5.793 3.119 6.060 3.119s1.159 0.535 1.872 1.248c0.802 0.624 4.813 2.941 9.001 4.991 4.189 2.139 8.199 4.367 8.912 4.991s3.565 2.317 6.238 3.743c2.674 1.426 9.892 5.526 16.042 9.090 6.149 3.476 13.368 7.664 16.042 9.179 2.674 1.426 5.347 2.941 5.793 3.297 0.802 0.624 3.654 2.228 13.636 7.664 6.328 3.565 7.13 4.545 5.080 6.060-0.98 0.713-2.763 1.872-4.010 2.495s-3.743 2.050-5.615 3.208c-4.545 2.763-8.199 4.813-17.379 9.714-4.278 2.228-7.932 4.367-8.199 4.723-0.267 0.267-2.228 1.604-4.456 2.763-2.228 1.248-5.615 3.208-7.575 4.367s-5.526 3.119-8.021 4.456c-2.406 1.248-6.060 3.387-8.021 4.634-1.961 1.159-5.347 3.208-7.575 4.456s-6.595 3.743-9.803 5.615c-11.497 6.595-13.279 7.575-14.17 7.575-0.713 0-0.98-6.506-0.98-19.963 0-17.379-0.178-20.052-1.426-20.498-0.802-0.267-25.221-0.535-54.275-0.535-47.323 0-52.849-0.178-53.383-1.426-0.267-0.802-0.535-6.951-0.535-13.725 0-10.962 0.178-12.477 1.604-13.279 0.891-0.446 22.815-0.802 54.007-0.891 28.875 0 52.849-0.356 53.205-0.713 0.446-0.446 0.802-9.269 0.802-19.607 0.089-16.309 0.356-19.874 1.426-19.874 0.089 0 2.674 1.426 5.704 3.119z",
"M793.065 322.44c-0.267 0.446-0.535 31.46-0.624 68.891 0 55.166 0.178 68.088 1.159 68.623 1.337 0.891 134.394 1.069 136.533 0.267 1.069-0.446 1.426-1.872 1.426-6.238 0-10.784-1.248-12.388-33.42-44.293-75.842-75.396-84.754-84.13-88.23-85.734-4.010-1.872-15.953-2.941-16.844-1.515z"
],
"attrs": [
{},
{},
{},
{}
],
"tags": [
"Split packages"
],
"grid": 20,
"isMulticolor": false,
"isMulticolor2": false
},
"attrs": [
{},
{},
{},
{}
],
"properties": {
"order": 44,
"id": 10,
"name": "split-packages",
"prevSize": 32,
"code": 59664
},
"setIdx": 0,
"setId": 1,
"iconIdx": 10
}
],
"height": 1024,
Expand Down Expand Up @@ -422,10 +460,14 @@
"color": 0,
"bgColor": 16777215,
"name": "icomoon",
"classSelector": ".icon"
"classSelector": ".icon",
"autoHost": false
},
"historySize": 50,
"gridSize": 16,
"showGrid": true
"showGrid": false,
"quickUsageToken": {
"UntitledProject": "OGE5ZGY4YzQwNGYyZDAyMDEzN2E0ZWUxMDFjN2RiMTUjMSMxNTkzNjQ3MTEzIyMj"
}
}
}
14 changes: 10 additions & 4 deletions default/data_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def size(self):
"""
return os.path.getsize(self.path)

def json(self, **kwargs):
def json(self, codec='utf-8', **kwargs):
"""
Returns the file's parsed JSON contents.
"""
with open(self.path, encoding='utf-8') as f:
with open(self.path, encoding=codec) as f:
return json.load(f, **kwargs)

def write(self, content):
Expand All @@ -87,19 +87,25 @@ def write(self, content):
else:
f.write(content)

def write_json_to_zip(self, files):
def write_json_to_zip(self, files, pretty_json=None, codec=None):
"""
Writes JSON data to a ZIP file.
:param files: a dict in which keys are file names and values are file contents, or a generator that yields
tuples of file names and file contents.
"""
self._makedirs()
kwargs = {}

if pretty_json:
kwargs['indent'] = 2

if isinstance(files, dict):
files = files.items()

with ZipFile(self.path, 'w', compression=ZIP_DEFLATED) as zipfile:
for name, content in files:
zipfile.writestr(name, json_dumps(content) + '\n')
zipfile.writestr(name, (json_dumps(content, **kwargs) + '\n').encode(codec))

@property
def name(self):
Expand Down
Loading

0 comments on commit a351851

Please sign in to comment.