lsst.daf.base gf041782ebf+2691319615
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList Class Reference

Public Member Functions

 get (self, name, default=None)
 
 getArray (self, name)
 
 getScalar (self, name)
 
 set (self, name, value, comment=None)
 
 add (self, name, value, comment=None)
 
 setComment (self, name, comment)
 
 toList (self)
 
 toOrderedDict (self)
 
 __eq__ (self, other)
 
 __copy__ (self)
 
 __deepcopy__ (self, memo)
 
 __iter__ (self)
 
 __setitem__ (self, name, value)
 
 __reduce__ (self)
 

Public Attributes

 COMMENTSUFFIX
 

Static Public Attributes

str COMMENTSUFFIX = "#COMMENT"
 
 toDict = toOrderedDict
 

Protected Attributes

 _typeMenu
 

Static Protected Attributes

dict _typeMenu
 

Detailed Description

Definition at line 793 of file propertyContainerContinued.py.

Member Function Documentation

◆ __copy__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.__copy__ (   self)

Definition at line 1006 of file propertyContainerContinued.py.

◆ __deepcopy__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.__deepcopy__ (   self,
  memo 
)

Definition at line 1013 of file propertyContainerContinued.py.

◆ __eq__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.__eq__ (   self,
  other 
)

Definition at line 993 of file propertyContainerContinued.py.

◆ __iter__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.__iter__ (   self)

Definition at line 1018 of file propertyContainerContinued.py.

◆ __reduce__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.__reduce__ (   self)

Definition at line 1052 of file propertyContainerContinued.py.

◆ __setitem__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.__setitem__ (   self,
  name,
  value 
)
Assigns the supplied value to the container.

Parameters
----------
name : `str`
    Name of item to update. If the name ends with
    `PropertyList.COMMENTSUFFIX`, the comment is updated rather
    than the value.
value : Value to assign
    Can be any value supported by the container's ``set()``
    method. `~collections.abc.Mapping` are converted to
    `PropertySet` before assignment.

Notes
-----
Uses `PropertySet.set`, overwriting any previous value.

Definition at line 1022 of file propertyContainerContinued.py.

◆ add()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.add (   self,
  name,
  value,
  comment = None 
)
Append one or more values to a given item, which need not exist

If the item exists then the new value(s) are appended;
otherwise it is like calling `set`

Parameters
----------
name : `str`
    Name of item
value : any supported type
    Value of item; may be a scalar or array

Notes
-----
If `value` is an `lsst.daf.base.PropertySet` items are added
using dotted names (e.g. if name="a" and value contains
an item "b" which is another PropertySet and contains an
item "c" which is numeric or string, then the value of "c"
is added as "a.b.c", appended to the existing values of
"a.b.c" if any (in which case the types must be compatible).

Raises
------
lsst::pex::exceptions::TypeError
    Raise if the type of ``value`` is incompatible with the existing
    value of the item.

Definition at line 897 of file propertyContainerContinued.py.

◆ get()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.get (   self,
  name,
  default = None 
)
Return an item as a scalar, else default.

Identical to `getScalar` except that a default value is returned
if the requested key is not present.  If an array item is requested
the final value in the array will be returned.

Parameters
----------
name : ``str``
    Name of item
default : `object`, optional
    Default value to use if the named item is not present.

Returns
-------
value : any type supported by container
    Single value of any type supported by the container, else the
    default value if the requested item is not present in the
    container.  For array items the most recently added value is
    returned.

Definition at line 809 of file propertyContainerContinued.py.

◆ getArray()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.getArray (   self,
  name 
)
Return an item as a list.

Parameters
----------
name : `str`
    Name of item

Returns
-------
values : `list` of values
    The contents of the item, guaranteed to be returned as a `list.`

Raises
------
KeyError
    Raised if the item does not exist.

Definition at line 836 of file propertyContainerContinued.py.

◆ getScalar()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.getScalar (   self,
  name 
)
Return an item as a scalar

If the item has more than one value then the last value is returned.

Parameters
----------
name : `str`
    Name of item.

Returns
-------
value : scalar item
    Value stored in the item.  If the item refers to an array the
    most recently added value is returned.

Raises
------
KeyError
    Raised if the item does not exist.

Definition at line 856 of file propertyContainerContinued.py.

◆ set()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.set (   self,
  name,
  value,
  comment = None 
)
Set the value of an item

If the item already exists it is silently replaced; the types
need not match.

Parameters
----------
name : `str`
    Name of item
value : any supported type
    Value of item; may be a scalar or array

Definition at line 879 of file propertyContainerContinued.py.

◆ setComment()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.setComment (   self,
  name,
  comment 
)
Set the comment for an existing entry.

Parameters
----------
name : `str`
    Name of the key to receive updated comment.
comment : `comment`
    New comment string.

Definition at line 930 of file propertyContainerContinued.py.

◆ toList()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.toList (   self)
Return a list of tuples of name, value, comment for each property
in the order that they were inserted.

Returns
-------
ret : `list` of `tuple`
    Tuples of name, value, comment for each property in the order
    in which they were inserted.

Definition at line 949 of file propertyContainerContinued.py.

◆ toOrderedDict()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.toOrderedDict (   self)
Return an ordered dictionary with all properties in the order that
they were inserted.

Returns
-------
d : `dict`
    Ordered dictionary with all properties in the order that they
    were inserted. Comments are not included.

Notes
-----
As of Python 3.6 dicts retain their insertion order.

Definition at line 971 of file propertyContainerContinued.py.

Member Data Documentation

◆ _typeMenu [1/2]

dict lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList._typeMenu
staticprotected
Initial value:
= {bool: "Bool",
int: "Int",
float: "Double",
str: "String",
DateTime: "DateTime",
PropertySet: "PropertySet",
PropertyList: "PropertySet",
None: "Undef",
}

Definition at line 795 of file propertyContainerContinued.py.

◆ _typeMenu [2/2]

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList._typeMenu
protected

Definition at line 895 of file propertyContainerContinued.py.

◆ COMMENTSUFFIX [1/2]

str lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.COMMENTSUFFIX = "#COMMENT"
static

Definition at line 805 of file propertyContainerContinued.py.

◆ COMMENTSUFFIX [2/2]

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.COMMENTSUFFIX

Definition at line 1040 of file propertyContainerContinued.py.

◆ toDict

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertyList.toDict = toOrderedDict
static

Definition at line 991 of file propertyContainerContinued.py.


The documentation for this class was generated from the following file: