Skip to content

Commit

Permalink
add some documentation on why so many getters
Browse files Browse the repository at this point in the history
  • Loading branch information
loulecrivain committed Feb 26, 2025
1 parent 5ce650b commit f697b1a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cosmo/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ def tuplize(cls, o):


# POJO style store
# why so many getters, you ask? the answer is simple:
# netbox developers like to change their data structure
# every quarter. so, instead of having a billion attribute
# names in the code to change each time it happens,
# you just have to change the attribute name in
# the getter method and voilà.
# that's also why you abstain from directly addressing
# attributes in the visitors.
# as a bonus, we can also have tiny bits of logic in
# the getters to deduplicate utility code
class DeviceType(AbstractNetboxType):
def __repr__(self):
return super().__repr__() + f"({self.getName()})"
Expand Down

0 comments on commit f697b1a

Please sign in to comment.