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

Public Member Functions

 from_mapping (cls, metadata)
 
 get (self, name, default=None)
 
 getArray (self, name)
 
 getScalar (self, name)
 
 set (self, name, value)
 
 add (self, name, value)
 
 update (self, addition)
 
 toDict (self)
 
 __eq__ (self, other)
 
 __copy__ (self)
 
 __deepcopy__ (self, memo)
 
 __contains__ (self, name)
 
 __setitem__ (self, name, value)
 
 __getitem__ (self, name)
 
 __delitem__ (self, name)
 
 __str__ (self)
 
 __len__ (self)
 
 __iter__ (self)
 
 keys (self)
 
 items (self)
 
 values (self)
 
 pop (self, name, default=None)
 
 __reduce__ (self)
 

Protected Attributes

 _typeMenu
 

Static Protected Attributes

dict _typeMenu
 

Detailed Description

Definition at line 439 of file propertyContainerContinued.py.

Member Function Documentation

◆ __contains__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.__contains__ (   self,
  name 
)
Determines if the name is found at the top level hierarchy
of the container.

Notes
------
Does not use `PropertySet.exists()`` because that includes support
for "."-delimited names.  This method is consistent with the
items returned from ``__iter__``.

Definition at line 682 of file propertyContainerContinued.py.

◆ __copy__()

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

Definition at line 670 of file propertyContainerContinued.py.

◆ __deepcopy__()

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

Definition at line 677 of file propertyContainerContinued.py.

◆ __delitem__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.__delitem__ (   self,
  name 
)

Definition at line 728 of file propertyContainerContinued.py.

◆ __eq__()

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

Definition at line 646 of file propertyContainerContinued.py.

◆ __getitem__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.__getitem__ (   self,
  name 
)
Returns a scalar item from the container.

Notes
-----
Uses `PropertySet.getScalar` to guarantee that a single value
will be returned.

Definition at line 718 of file propertyContainerContinued.py.

◆ __iter__()

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

Definition at line 741 of file propertyContainerContinued.py.

◆ __len__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.__len__ (   self)

Definition at line 738 of file propertyContainerContinued.py.

◆ __reduce__()

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

Definition at line 783 of file propertyContainerContinued.py.

◆ __setitem__()

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

Parameters
----------
name : `str`
    Name of item to update.
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 694 of file propertyContainerContinued.py.

◆ __str__()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.__str__ (   self)

Definition at line 735 of file propertyContainerContinued.py.

◆ add()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.add (   self,
  name,
  value 
)
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` or
`lsst.daf.base.PropertyList` then ``value`` replaces
the existing value. Also the item is added as a live
reference, so updating ``value`` will update this container
and vice-versa.

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

Definition at line 574 of file propertyContainerContinued.py.

◆ from_mapping()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.from_mapping (   cls,
  metadata 
)
Create a `PropertySet` from a mapping or dict-like object.

Parameters
----------
metadata : `collections.abc.Mapping`
    Metadata from which to create the `PropertySet`.
    Can be a mapping, a `~dataclasses.dataclass` or anything that
    supports ``toDict()``, ``to_dict()`` or ``dict()`` method.
    It is assumed that the dictionary is expanded recursively by these
    methods or that the Python type can be understood by `PropertySet`.

Returns
-------
ps : `PropertySet`
    The new `PropertySet`.

Definition at line 452 of file propertyContainerContinued.py.

◆ get()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.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 486 of file propertyContainerContinued.py.

◆ getArray()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.getArray (   self,
  name 
)
Return an item as an array if the item is numeric or string

If the item is a `PropertySet`, `PropertyList` or
`lsst.daf.base.PersistablePtr` then return the item as a scalar.

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

Returns
-------
values : `list` of any type supported by container
    The contents of the item, guaranteed to be returned as a `list.`

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

Definition at line 513 of file propertyContainerContinued.py.

◆ getScalar()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.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 536 of file propertyContainerContinued.py.

◆ items()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.items (   self)

Definition at line 748 of file propertyContainerContinued.py.

◆ keys()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.keys (   self)

Definition at line 745 of file propertyContainerContinued.py.

◆ pop()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.pop (   self,
  name,
  default = None 
)
Remove the named key and return its value.

Parameters
----------
name : `str`
    Name of the key to remove. Can be hierarchical.
default : Any, optional
    Value to return if the key is not present.

Returns
-------
value : Any
    The value of the item as would be returned using `getScalar()`.

Raises
------
KeyError
    Raised if no default is given and the key is missing.

Definition at line 754 of file propertyContainerContinued.py.

◆ set()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.set (   self,
  name,
  value 
)
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 559 of file propertyContainerContinued.py.

◆ toDict()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.toDict (   self)
Returns a (possibly nested) dictionary with all properties.

Returns
-------
d : `dict`
    Dictionary with all names and values (no comments).

Definition at line 627 of file propertyContainerContinued.py.

◆ update()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.update (   self,
  addition 
)
Update the current container with the supplied additions.

Parameters
----------
addition : `collections.abc.Mapping` or `PropertySet`
    The content to merge into the current container.

Notes
-----
This is not the same as calling `PropertySet.combine` since the
behavior differs when both mappings contain the same key.  This
method updates by overwriting existing values completely with
the new value.

Definition at line 603 of file propertyContainerContinued.py.

◆ values()

lsst.daf.base.propertyContainer.propertyContainerContinued.PropertySet.values (   self)

Definition at line 751 of file propertyContainerContinued.py.

Member Data Documentation

◆ _typeMenu [1/2]

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

Definition at line 442 of file propertyContainerContinued.py.

◆ _typeMenu [2/2]

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

Definition at line 572 of file propertyContainerContinued.py.


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