tkrebes / nisyscfg-python

NI System Configuration Python API
MIT License
4 stars 0 forks source link

README Mistake: is_in_product? #55

Closed ni-jfitzger closed 1 year ago

ni-jfitzger commented 1 year ago

Describe the bug The README shows this example:

>>> import nisyscfg
>>> with nisyscfg.Session() as session:
>>>     # Print user aliases for all National Instruments devices in the local system
>>>     filter = session.create_filter()
>>>     filter.is_present = True
>>>     filter.is_in_product = True
>>>     filter.is_device = True
>>>     for resource in session.find_hardware(filter):
>>>         print(resource.expert_user_alias[0])

I searched the code for "is_in_product" because I wasn't familiar with that property, but I couldn't find anything. I think it's supposed to be "is_ni_product".

ni-jfitzger commented 1 year ago

Oddly, I don't think setting a bad filter property errors. Maybe something like this is needed to protect against that:

https://github.com/ni/nimi-python/blob/88fb949fd1ef02c523c6e552ae4331b835947545/generated/nidcpower/nidcpower/session.py#L4299

https://github.com/ni/nimi-python/blob/88fb949fd1ef02c523c6e552ae4331b835947545/generated/nidcpower/nidcpower/session.py#L4291

ni-jfitzger commented 1 year ago

Oddly, I don't think setting a bad filter property errors. Maybe something like this is needed to protect against that:

https://github.com/ni/nimi-python/blob/88fb949fd1ef02c523c6e552ae4331b835947545/generated/nidcpower/nidcpower/session.py#L4299

https://github.com/ni/nimi-python/blob/88fb949fd1ef02c523c6e552ae4331b835947545/generated/nidcpower/nidcpower/session.py#L4291

You may not even need the is_frozen part. I don't think you're adding attributes during or after object creation.