Skip to content

pedantic/verify does not control all the warnings in VO table parsing #8775

@pllim

Description

@pllim

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

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

def __init__(self, field, config=None, pos=None):
pass

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 here

but this does not:

c.parse('null', config=config)  # No warning

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions