A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.astropy.org/en/stable/api/../api/astropy.utils.state.ScienceState.html below:

ScienceState — Astropy v7.1.0

ScienceState#
class astropy.utils.state.ScienceState[source]#

Bases: object

Science state subclasses are used to manage global items that can affect science results. Subclasses will generally override validate to convert from any of the acceptable inputs (such as strings) to the appropriate internal objects, and set an initial value to the _value member so it has a default.

Examples

class MyState(ScienceState):
    @classmethod
    def validate(cls, value):
        if value not in ('A', 'B', 'C'):
            raise ValueError("Must be one of A, B, C")
        return value

Methods Summary

Methods Documentation

classmethod get()[source]#

Get the current science state value.

classmethod set(value)[source]#

Set the current science state value.

classmethod validate(value)[source]#

Validate the value and convert it to its native type, if necessary.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4