irods / python-irodsclient

A Python API for iRODS
Other
63 stars 73 forks source link

How does iRODSMetaCollection object have no get attribute? #634

Open tanmayagrawal21 opened 2 weeks ago

tanmayagrawal21 commented 2 weeks ago
{"ansible_loop_var": "item", "changed": false, "item": "/testing/trash/home/shared", "msg": "An unexpected exception of type AttributeError occurred. Arguments: (\"'iRODSMetaCollection' object has no attribute 'get'\",)"}

Source Python

    elif entity_type == "collection":
        try:
            return session.collections.get(entity_name)
        except CollectionDoesNotExist as e:
            raise _IrodsAvuError(
                "The collection '{0}' does not exist".format(entity_name))

Despite it being one of the stated functionalities: https://github.com/irods/python-irodsclient/blob/main/irods/test/collection_test.py

alanking commented 2 weeks ago

iRODSMetaCollection does not appear to have a get attribute: https://github.com/irods/python-irodsclient/blob/e982023e77ac53ddda9b0b01026d08d564aa46fb/irods/meta.py#L77-L209 Are you looking for get_all or get_one?

d-w-moore commented 2 weeks ago

Note get_all retrieves all AVUs associated with a certain key (passed as the argument). But, there's also the items method, which does actually fetches all metadata associated with the object. So you could say the get attribute is there, just ... misnamed.

trel commented 2 weeks ago

Cause for an alias? Or would that make matters worse?

d-w-moore commented 2 weeks ago

Cause for an alias? Or would that make matters worse?

I don't think it would hurt, and we've renamed a few things in the PRC already.

korydraughn commented 2 weeks ago

Is there an iRODSMetaDataObject class we can compare to? I didn't see one, which seems a little weird.

I noticed __getitem__ on iRODSMetaCollection which allows fetching info using the subscript operator.

@tanmayagrawal21 Where is it stated that the class supports .get? I didn't see it in the link you posted.