Skip to content

Commit

Permalink
Addresses #7. Pending Amit's review
Browse files Browse the repository at this point in the history
  • Loading branch information
jvita committed Jan 20, 2022
1 parent 269c662 commit 331c1bd
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions colabfit/tools/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,10 @@ def get_data(
query=None,
ids=None,
keep_ids=False,
concatenate=False, ravel=False, verbose=False#, cache=False
concatenate=False,
ravel=False,
unpack_properties=True,
verbose=False,
):
"""
Queries the database and returns the fields specified by `keys` as a
Expand Down Expand Up @@ -790,15 +793,16 @@ def get_data(
ravel (bool, default=False):
If True, concatenates and ravels the data before returning.
unpack_properties (bool, default=True):
If True, returns only the contents of the :code:`'source-value'`
key for each field in :attr:`fields` (assuming
:code:`'source-value'` exists). Users who wish to return the
full dictionaries for fields should set
:code:`unpack_properties=False`.
verbose (bool, default=False):
If True, prints a progress bar
# cache (bool, default=False):
# If True, caches the results in-memory for faster access later.
# Results are cached by hashing the Mongo query that was used to
# obtain the results and the requested keys, then storing the list
# of returned data.
Returns:
data (dict):
Expand Down Expand Up @@ -848,7 +852,8 @@ def get_data(

if not missing:
if isinstance(v, dict):
v = v['source-value']
if unpack_properties and ('source-value' in v):
v = v['source-value']

data[k].append(np.atleast_1d(v))

Expand Down Expand Up @@ -898,7 +903,7 @@ def get_configurations(
:code:`attach_properties` will attach all linked Properties.
attach_properties (bool, default=False):
If True, attaches all the data of any linked properties from
If True, attaches all the data of any linked properties from
:code:`property_ids`.
generator (bool, default=False):
Expand Down

0 comments on commit 331c1bd

Please sign in to comment.