Skip to content

Commit b790200

Browse files
authored
Upload API convenience fixes (#9) (#10)
* return the HTTP response when posting a model * drop internal MaveDB attributes * make virtual method explicit * update authors
1 parent 1621814 commit b790200

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2020, Alan F Rubin
3+
Copyright (c) 2020-2022, MaveDB Developers
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

mavetools/client/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ def post_model_instance(self, model_instance):
7171
7272
Returns
7373
-------
74+
requests.model.Response
75+
The HTTP response object from the request, which contains the URN
76+
of the newly-created model in the `Response.text` field.
77+
78+
Raises
79+
------
7480
AuthTokenMissingException
7581
If the auth_token is missing
7682
"""
@@ -100,3 +106,6 @@ def post_model_instance(self, model_instance):
100106

101107
# No errors or exceptions at this point, log successful upload
102108
logging.info(f"Successfully uploaded {model_instance}!")
109+
110+
# return the HTTP response
111+
return r

mavetools/models/dataset.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,27 @@ class Dataset(TimeStamped, Urn):
3737
"""
3838
Instantiates Dataset object and declares attributes
3939
"""
40-
40+
# record keeping attributes
4141
publish_date: str = attr.ib(kw_only=True)
4242
created_by: str = attr.ib(kw_only=True)
4343
modified_by: str = attr.ib(kw_only=True)
44-
# optional attributes
45-
approved: Optional[str] = attr.ib(kw_only=True, default=None)
46-
private: Optional[bool] = attr.ib(kw_only=True, default=None)
47-
last_child_value: Optional[Any] = attr.ib(kw_only=True, default=None)
44+
45+
# required attributes
46+
short_description: str = attr.ib(kw_only=True)
47+
title: str = attr.ib(kw_only=True)
48+
contributors: List[str] = attr.ib(kw_only=True)
49+
4850
# optional attribute
49-
extra_metadata: Optional[Dict[str, str]] = attr.ib(kw_only=True, default=None)
5051
abstract_text: str = attr.ib(kw_only=True)
5152
method_text: str = attr.ib(kw_only=True)
52-
short_description: str = attr.ib(kw_only=True)
53-
title: str = attr.ib(kw_only=True)
5453
keywords: List[Keyword] = attr.ib(kw_only=True)
5554
sra_ids: Optional[List[ExternalIdentifier]] = attr.ib(kw_only=True, default=None)
5655
doi_ids: Optional[List[ExternalIdentifier]] = attr.ib(kw_only=True, default=None)
5756
pubmed_ids: Optional[List[ExternalIdentifier]] = attr.ib(kw_only=True, default=None)
58-
contributors: List[str] = attr.ib(kw_only=True)
57+
extra_metadata: Optional[Dict[str, str]] = attr.ib(kw_only=True, default=None)
5958

6059
def deserialize():
61-
# why pass?
62-
pass
60+
raise NotImplementedError()
6361

6462

6563
@attr.s
@@ -68,8 +66,10 @@ class NewDataset:
6866
Instantiates NewDataset object and declares object attributes
6967
"""
7068

69+
# required attributes
7170
title: str = attr.ib(kw_only=True)
7271
short_description: str = attr.ib(kw_only=True)
72+
7373
# optional attributes
7474
abstract_text: Optional[str] = attr.ib(kw_only=True, default=None)
7575
method_text: Optional[str] = attr.ib(kw_only=True, default=None)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
setup(
2222
name="mavetools",
2323
version="0.1.1",
24-
author="Alan F Rubin",
24+
author="MaveDB Developers",
2525
author_email="[email protected]",
2626
description=(
2727
"Useful functions for manipulating Multiplex Assay of Variant Effect datasets."

0 commit comments

Comments
 (0)