EdinburghGenomics / pyclarity-lims

Python interface to the GenoLogics LIMS server via its REST API.
MIT License
11 stars 4 forks source link

Step.available_programs FutureWarning #27

Closed dbarrell closed 6 years ago

dbarrell commented 6 years ago

Hi,

I am getting this warning when using Step.available_programs():

/usr/local/lib/python2.7/dist-packages/pyclarity_lims/entities.py:862: FutureWarning: The behavior of this method will change in future versions.  Use specific 'len(ele
m)' or 'elem is not None' test instead.
  if available_programs_et:

Should I change to a different method to get available programs or is this just related to how the Entities object is going to change in the future?

Thanks!

Dan

tcezard commented 6 years ago

It is apparently a message from the Xml library used to parse the xml page. see https://stackoverflow.com/questions/20129996/why-does-boolxml-etree-elementtree-element-evaluate-to-false We should change the test

if available_programs_et:

to

if available_programs_et is not None and len(available_programs_et) > 0:

To avoid the warning message. You do can still use the function as it is though. I'll keep the issue open until we fix the warning.

dbarrell commented 6 years ago

I created a pull request if it helps: https://github.com/EdinburghGenomics/pyclarity-lims/pull/35

tcezard commented 6 years ago

resolved in #35