energyquantified / eq-python-client

Python library for Energy Quantified's Time Series API.
https://energyquantified-python.readthedocs.io/
Apache License 2.0
15 stars 2 forks source link

Border class __repr__ error #32

Closed stanton119 closed 3 years ago

stanton119 commented 3 years ago

Hi,

I can't print the border objects

Example:

from energyquantified.metadata import Area
areas = Area.by_tag('GB')
borders = areas.borders
print(borders)

Error:

energyquantified\metadata\area.py in __repr__(self)
     277             self.sink.tag,
     278             # self.allocations,
 --> 279             sorted(self.allocations),
     280         )
     281  
TypeError: '<' not supported between instances of 'Allocation' and 'Allocation'

Looks like the Allocation class doesnt have the dunder methods for less than (__lt__) and greater than (__gt__) and therefore cannot run the sorting.

Running on version 0.6 Python 3.8.10

jonmd commented 3 years ago

I've published a fix in v0.6.1

Thanks for the bug report, @stanton119. I didn't notice that you posted an issue until today – can't remember getting a notification. Sorry about the delay.