lsst.daf.base gf041782ebf+171108ac67
Loading...
Searching...
No Matches
Classes | Functions | Variables
lsst.daf.base.propertyContainer.propertyContainerContinued Namespace Reference

Classes

class  PropertyList
 
class  PropertySet
 
class  ReturnStyle
 

Functions

 getPropertySetState (container, asLists=False)
 
 getPropertyListState (container, asLists=False)
 
 setPropertySetState (container, state)
 
 setPropertyListState (container, state)
 
 _propertyContainerElementTypeName (container, name)
 
 _propertyContainerGet (container, name, returnStyle)
 
 _iterable (a)
 
 _guessIntegerType (container, name, value)
 
 _propertyContainerSet (container, name, value, typeMenu, *args)
 
 _propertyContainerAdd (container, name, value, typeMenu, *args)
 
 _makePropertySet (state)
 
 _makePropertyList (state)
 

Variables

dict _TYPE_MAP = {}
 
 type_obj = getattr(PropertySet, "TYPE_" + checkType)
 

Function Documentation

◆ _guessIntegerType()

lsst.daf.base.propertyContainer.propertyContainerContinued._guessIntegerType (   container,
  name,
  value 
)
protected
Given an existing container and name, determine the type
that should be used for the supplied value. The supplied value
is assumed to be a scalar.

On Python 3 all ints are LongLong but we need to be able to store them
in Int containers if that is what is being used (testing for truncation).
Int is assumed to mean 32bit integer (2147483647 to -2147483648).

If there is no pre-existing value we have to decide what to do. For now
we pick Int if the value is less than maxsize.

Parameters
----------
container : `lsst.daf.base.PropertySet` or `lsst.daf.base.PropertyList`
    Container from which to get the value

name : `str`
    Name of item

value : `object`
    Value to be assigned a type. Can be an iterable.

Returns
-------
useType : `str` or none
    Type to use for the supplied value. `None` if the input is
    `bool` or a non-integral value.

Definition at line 253 of file propertyContainerContinued.py.

◆ _iterable()

lsst.daf.base.propertyContainer.propertyContainerContinued._iterable (   a)
protected
Make input iterable.

Takes whatever is given to it and yields it back one element at a time.
If it is not an iterable or it is a string or PropertySet/List,
yields itself.

Definition at line 237 of file propertyContainerContinued.py.

◆ _makePropertyList()

lsst.daf.base.propertyContainer.propertyContainerContinued._makePropertyList (   state)
protected
Make a `PropertyList` from the state returned by
`getPropertyListState`

Parameters
----------
state : `list`
    The data returned by `getPropertySetState`.

Definition at line 424 of file propertyContainerContinued.py.

◆ _makePropertySet()

lsst.daf.base.propertyContainer.propertyContainerContinued._makePropertySet (   state)
protected
Make a `PropertySet` from the state returned by `getPropertySetState`

Parameters
----------
state : `list`
    The data returned by `getPropertySetState`.

Definition at line 411 of file propertyContainerContinued.py.

◆ _propertyContainerAdd()

lsst.daf.base.propertyContainer.propertyContainerContinued._propertyContainerAdd (   container,
  name,
  value,
  typeMenu,
args 
)
protected
Add a single Python value of unknown type

Definition at line 387 of file propertyContainerContinued.py.

◆ _propertyContainerElementTypeName()

lsst.daf.base.propertyContainer.propertyContainerContinued._propertyContainerElementTypeName (   container,
  name 
)
protected
Return name of the type of a particular element

Parameters
----------
container : `lsst.daf.base.PropertySet` or `lsst.daf.base.PropertyList`
    Container including the element
name : `str`
    Name of element

Definition at line 162 of file propertyContainerContinued.py.

◆ _propertyContainerGet()

lsst.daf.base.propertyContainer.propertyContainerContinued._propertyContainerGet (   container,
  name,
  returnStyle 
)
protected
Get a value of unknown type as a scalar or array

Parameters
----------
container : `lsst.daf.base.PropertySet` or `lsst.daf.base.PropertyList`
    Container from which to get the value
name : `str`
    Name of item
returnStyle : `ReturnStyle`
    Control whether numeric or string data is returned as an array
    or scalar (the other types, ``PropertyList``, ``PropertySet``
        and ``PersistablePtr``, are always returned as a scalar):
    - ReturnStyle.ARRAY: return numeric or string data types
        as an array of values.
    - ReturnStyle.SCALAR: return numeric or string data types
        as a single value; if the item has multiple values then
        return the last value.
    - ReturnStyle.AUTO: (deprecated) return numeric or string data
        as a scalar if there is just one item, or as an array
        otherwise.

Raises
------
KeyError
    Raised if the specified key does not exist in the container.
TypeError
    Raised if the value retrieved is of an unexpected type.
ValueError
    Raised if the value for ``returnStyle`` is not correct.

Definition at line 182 of file propertyContainerContinued.py.

◆ _propertyContainerSet()

lsst.daf.base.propertyContainer.propertyContainerContinued._propertyContainerSet (   container,
  name,
  value,
  typeMenu,
args 
)
protected
Set a single Python value of unknown type

Definition at line 363 of file propertyContainerContinued.py.

◆ getPropertyListState()

lsst.daf.base.propertyContainer.propertyContainerContinued.getPropertyListState (   container,
  asLists = False 
)
Get the state of a PropertyList in a form that can be pickled.

Parameters
----------
container : `PropertyList`
    The property container.
asLists : `bool`, optional
    If False, the default, `tuple` will be used for the contents. If true
    a `list` will be used.

Returns
-------
state : `list` of `tuple` or `list` of `list`
    The state, as a list of tuples (or lists), each of which contains
    the following 4 items:

    name (a `str`):
        the name of the item
    elementTypeName (a `str`):
        the suffix of a ``setX`` method name
        which is appropriate for the data type. For example integer
        data has ``elementTypeName="Int"` which corresponds to
        the ``setInt`` method.
    value
        the data for the item, in a form compatible
        with the set method named by ``elementTypeName``
    comment (a `str`): the comment. This item is only present
        if ``container`` is a PropertyList.

Definition at line 86 of file propertyContainerContinued.py.

◆ getPropertySetState()

lsst.daf.base.propertyContainer.propertyContainerContinued.getPropertySetState (   container,
  asLists = False 
)
Get the state of a PropertySet in a form that can be pickled.

Parameters
----------
container : `PropertySet`
    The property container.
asLists : `bool`, optional
    If False, the default, `tuple` will be used for the contents. If true
    a `list` will be used.

Returns
-------
state : `list` of `tuple` or `list` of `list`
    The state, as a list of tuples (or lists), each of which contains
    the following 3 items:

    name (a `str`)
        the name of the item
    elementTypeName (a `str`)
        the suffix of a ``setX`` method name
        which is appropriate for the data type. For example integer
        data has ``elementTypeName="Int"` which corresponds to
        the ``setInt`` method.
    value
        the data for the item, in a form compatible
        with the set method named by ``elementTypeName``

Definition at line 51 of file propertyContainerContinued.py.

◆ setPropertyListState()

lsst.daf.base.propertyContainer.propertyContainerContinued.setPropertyListState (   container,
  state 
)
Restore the state of a PropertyList, in place.

Parameters
----------
container : `PropertyList`
    The property container whose state is to be restored.
    It should be empty to start with and is updated in place.
state : `list`
    The state, as returned by ``getPropertyListState``

Definition at line 141 of file propertyContainerContinued.py.

◆ setPropertySetState()

lsst.daf.base.propertyContainer.propertyContainerContinued.setPropertySetState (   container,
  state 
)
Restore the state of a PropertySet, in place.

Parameters
----------
container : `PropertySet`
    The property container whose state is to be restored.
    It should be empty to start with and is updated in place.
state : `list`
    The state, as returned by `getPropertySetState`

Definition at line 123 of file propertyContainerContinued.py.

Variable Documentation

◆ _TYPE_MAP

dict lsst.daf.base.propertyContainer.propertyContainerContinued._TYPE_MAP = {}
protected

Definition at line 41 of file propertyContainerContinued.py.

◆ type_obj

lsst.daf.base.propertyContainer.propertyContainerContinued.type_obj = getattr(PropertySet, "TYPE_" + checkType)

Definition at line 45 of file propertyContainerContinued.py.