Boavizta / boaviztapi

🛠 Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
66 stars 23 forks source link

Add is_{STATUS} methods in Boattribute #111

Closed da-ekchajzer closed 1 year ago

da-ekchajzer commented 1 year ago

Problem

I see a lot of if foo.status == Status.NONE: in the code.

   tmp = sub[sub['manufacturer'] == self.cpu_manufacturer]
            if len(tmp) > 0:
                sub = tmp.copy()
        if self.workloads.status != Status.NONE:

Solution

I think we should consider refactoring these with functions like foo.is_set(), foo.is_default(), etc. It will make the code easier to read.

From @samuelrince https://github.com/Boavizta/boaviztapi/pull/110#discussion_r950697116