kopia lustrzana https://github.com/jupyterhub/repo2docker
sort and pretty print dataverse.json
so that we can track changes and only update the lines of the files that need updatingpull/796/head
rodzic
bfbec349c2
commit
3bdf7041dc
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,14 @@ from ..utils import copytree, deep_get
|
|||
|
||||
|
||||
class Dataverse(DoiProvider):
|
||||
"""Provide contents of a Dataverse dataset."""
|
||||
"""
|
||||
Provide contents of a Dataverse dataset.
|
||||
|
||||
This class loads a a list of existing Dataverse installations from the internal
|
||||
file dataverse.json. This file is manually updated with the following command:
|
||||
|
||||
python setup.py generate_dataverse_file
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
data_file = os.path.join(os.path.dirname(__file__), "dataverse.json")
|
||||
|
|
9
setup.py
9
setup.py
|
@ -31,8 +31,13 @@ class GenerateDataverseInstallationsFileCommand(Command):
|
|||
data = json.loads(resp_body.decode("utf-8"))
|
||||
if "installations" not in data:
|
||||
raise ValueError("Malformed installation map.")
|
||||
with open("repo2docker/contentproviders/dataverse.json", "wb") as fp:
|
||||
fp.write(resp_body)
|
||||
|
||||
def get_identifier(json):
|
||||
return int(json["id"])
|
||||
|
||||
data["installations"].sort(key=get_identifier)
|
||||
with open("repo2docker/contentproviders/dataverse.json", "w") as fp:
|
||||
json.dump(data, fp, indent=4, sort_keys=True)
|
||||
|
||||
|
||||
__cmdclass = versioneer.get_cmdclass()
|
||||
|
|
Ładowanie…
Reference in New Issue