ki-tools / kitools-py

Tools for working with data in Ki analyses
Apache License 2.0
3 stars 0 forks source link

KiProjectResource print method #20

Closed hafen closed 5 years ago

hafen commented 5 years ago

An informative print method for a KiProjectResource would be nice to have. For example:

f = p.data_add("syn:syn123456", name = "my_data")
print(f)
name: my_data
data_type: core
version: [latest]
remote_uri: syn:syn123456
abs_path: [has not been pulled... use data_pull() to pull this dataset]
pcstout commented 5 years ago

@hafen How does this look?

>>> r = kiproject.data_add("data/core/new_study_file_test_file_1_b703a984.dat")

>>> print(r)
Name: new_study_file_test_file_1_b703a984.dat
Date Type: core
Version: [latest]
Remote URI: [has not been pushed... use data_push() to push this dataset]
Absolute Path: /tmp/demo_curator_6f8bba37/data/core/new_study_file_test_file_1_b703a984.dat

>>> kiproject.data_push()
Pushing all resources that have not been pushed.

>>> print(r)
Name: new_study_file_test_file_1_b703a984.dat
Date Type: core
Version: [latest]
Remote URI: syn:syn18667295
Absolute Path: /tmp/demo_curator_6f8bba37/data/core/new_study_file_test_file_1_b703a984.dat

>>> r = kiproject.resources[0]
>>> print(r)
Name: core
Date Type: [has not been pulled... use data_pull() to pull this dataset]
Version: [latest]
Remote URI: syn:syn18667108
Absolute Path: [has not been pulled... use data_pull() to pull this dataset]

>>> kiproject.data_pull(r)

>>> print(r)
Name: core
Date Type: core
Version: [latest]
Remote URI: syn:syn18667108
Absolute Path: /tmp/demo_curator_6f8bba37/data/core
hafen commented 5 years ago

Looks great!

pcstout commented 5 years ago

This has been released as 0.0b15 on Test PyPi.