get_comment_unit¶
- sofia_redux.scan.utilities.utils.get_comment_unit(comment, default=None)[source]¶
See if a header comment contains a unit and return if found.
In this case, header units are expected to be enclosed within round () or square [] brackets. The first valid unit found inside brackets will be returned with round brackets overruling square.
- Parameters:
- commentstr or None
The header comment which may contain a unit.
- defaultstr or units.Unit, optional
The unit to return if not found.
- Returns:
- unitNone or units.Unit