Feature

class pyvo.utils.protofeature.Feature(name: str, url: str = '', on: bool = False)[source]

Bases: object

A prototype feature implementing a standard that is currently in the process of being approved, but that might change as a result of the approval process. A Feature must have a name. Optionally, a feature may have a url that is displayed to the user in case a feature is used without the user explicitly opting in on its usage. The URL is expected to contain more information about the standard and its state in the approval process.

Attributes Summary

on

url

Methods Summary

error(function_name)

Format an error message when the feature is being accesses without the user having opted in its usage.

should_error()

Should accessing this feature fail?

Attributes Documentation

on: bool = False
url: str = ''

Methods Documentation

error(function_name)[source]

Format an error message when the feature is being accesses without the user having opted in its usage.

This function will be used as a callback when an error message needs to be displayed to the user, with the function name that was accessed as an argument. Extensions of this class may have additional information to display.

Parameters
function_name: str

The name of the function associated to this feature and that the user called.

Returns
str: The error message to be displayed to the user.
should_error()[source]

Should accessing this feature fail?

Returns
bool Whether accessing this feature should result in an error.