-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
As pointed out by @astrofrog in #8756 , pedantic (renamed to verify in #8715) does not universally control all the warnings emitted when parsing VO table. This is an API design question.
Case Study 1
astropy/astropy/io/votable/converters.py
Lines 301 to 303 in 62f1ac1
| if field.arraysize is None: | |
| vo_warn(W47, (), config, pos) | |
| field.arraysize = '1' |
In this example, it explicitly calls vo_warn, which would give warning (or not), but it will never promote the warning to error even if config['verify'] is set to 'exception'. But should it ever be an error, given that some default is assigned anyway in L303?
Case Study 2
astropy/astropy/io/votable/converters.py
Lines 162 to 163 in 62f1ac1
| def __init__(self, field, config=None, pos=None): | |
| pass |
astropy/astropy/io/votable/converters.py
Lines 634 to 635 in 62f1ac1
| def __init__(self, field, config=None, pos=None): | |
| Converter.__init__(self, field, config, pos) |
In this example, config is passed into the constructor as if it means something, but it is not stored by the class. As a result, the following emits a warning:
from astropy.io.votable import tree, converters
config = {'verify': 'ignore'}
field = tree.Field(None, name='c', datatype='float', config=config)
c = converters.get_converter(field, config=config)
c.parse('null') # W30 warning herebut this does not:
c.parse('null', config=config) # No warning