Set a PyTables attribute for the given node. Parameters ---------- where, name These arguments work as in :meth:`File.get_node`, referencing the node to be acted upon. attrname The name of the attribute to set. attrvalue
(
self,
where: Node | str,
attrname: str,
attrvalue: Any,
name: str | None = None,
)
| 2005 | return obj._f_getattr(attrname) |
| 2006 | |
| 2007 | def set_node_attr( |
| 2008 | self, |
| 2009 | where: Node | str, |
| 2010 | attrname: str, |
| 2011 | attrvalue: Any, |
| 2012 | name: str | None = None, |
| 2013 | ) -> None: |
| 2014 | """Set a PyTables attribute for the given node. |
| 2015 | |
| 2016 | Parameters |
| 2017 | ---------- |
| 2018 | where, name |
| 2019 | These arguments work as in |
| 2020 | :meth:`File.get_node`, referencing the node to be acted upon. |
| 2021 | attrname |
| 2022 | The name of the attribute to set. |
| 2023 | attrvalue |
| 2024 | The value of the attribute to set. Any kind of Python |
| 2025 | object (like strings, ints, floats, lists, tuples, dicts, |
| 2026 | small NumPy objects ...) can be stored as an attribute. |
| 2027 | However, if necessary, pickle is automatically used so as |
| 2028 | to serialize objects that you might want to save. |
| 2029 | See the :class:`AttributeSet` class for details. |
| 2030 | |
| 2031 | Notes |
| 2032 | ----- |
| 2033 | If the node already has a large number of attributes, a |
| 2034 | PerformanceWarning is issued. |
| 2035 | |
| 2036 | """ |
| 2037 | obj = self.get_node(where, name=name) |
| 2038 | obj._f_setattr(attrname, attrvalue) |
| 2039 | |
| 2040 | def del_node_attr( |
| 2041 | self, where: Node | str, attrname: str, name: str | None = None |