Some navis functions expect TreeNeurons to have a tags attribute, or at least check whether it exists, presumably to catch subclasses like CatmaidNeurons. This effectively blesses that tag representation, so we may as well include it in the base class. For me at least, it's convenient to be able to represent tags without needing the live-fetching elements from CatmaidNeurons, so this change adds tags = None to the TreeNeuron class definition, and has other functions check whether it's non-None before trying to read anything from it. Having an optional attribute for tags, rather than an empty dict, means you can distinguish between untagged neurons and neurons which happen to have 0 tags; but having a firm attribute in place for it makes type checkers more happy.
Some navis functions expect TreeNeurons to have a
tags
attribute, or at least check whether it exists, presumably to catch subclasses like CatmaidNeurons. This effectively blesses that tag representation, so we may as well include it in the base class. For me at least, it's convenient to be able to represent tags without needing the live-fetching elements from CatmaidNeurons, so this change addstags = None
to the TreeNeuron class definition, and has other functions check whether it's non-None before trying to read anything from it. Having an optional attribute for tags, rather than an empty dict, means you can distinguish between untagged neurons and neurons which happen to have 0 tags; but having a firm attribute in place for it makes type checkers more happy.