obspy.core.event.base.Comment
- class Comment(force_resource_id=True, *args, **kwargs)[source]
Bases:
obspy.core.event.base._event_type_class_factory.<locals>.AbstractEventTypeWithResourceID
Comment holds information on comments to a resource as well as author and creation time information.
- Parameters
text (str) – Text of comment.
resource_id (
ResourceIdentifier
) – Resource identifier of comment.force_resource_id (bool, optional) – If set to False, the automatic initialization of resource_id attribute in case it is not specified will be skipped.
creation_info (
CreationInfo
, optional) – Creation info for the comment.
>>> comment = Comment(text="Some comment") >>> print(comment) Comment(text='Some comment', resource_id=ResourceIdentifier(...)) >>> comment = Comment(text="Some comment", force_resource_id=False) >>> print(comment) Comment(text='Some comment') >>> comment.resource_id = "comments/obspy-comment-123456" >>> print(comment) Comment(text='Some comment', resource_id=ResourceIdentifier(...)) >>> comment.creation_info = {"author": "obspy.org"} >>> print(comment.creation_info) CreationInfo(author='obspy.org')
Note
For handling additional information not covered by the QuakeML standard and how to output it to QuakeML see the ObsPy Tutorial.
Attributes
Public Methods
Clear the class :return: |
|
If key is not found, d is returned if given, otherwise KeyError is raised. |
|
as a 2-tuple; but raise KeyError if D is empty. |
|
Private Methods
Warning
Private methods are mainly for internal/developer use and their API might change without notice.
- Comment._cast_type(key, value)
Cast type of value to type required in _types dict.
- Parameters
key (str) – The key from __setattr__.
value – The value being set to key.
- Returns
value cast to correct type.
- Comment._pretty_str(priorized_keys=[], min_label_length=16)
Return better readable string representation of AttribDict object.
- Parameters
- Returns
String representation of current AttribDict object.
- Comment._repr_pretty_(p, cycle)
Special Methods
- Comment.__bool__()
- Comment.__contains__(key)
- Comment.__delattr__(name)
- Comment.__delitem__(name)
- Comment.__dir__()
Default dir() implementation.
- Comment.__eq__(other)
Two instances are considered equal if all attributes and all lists are identical.
- Comment.__format__(format_spec, /)
Default object formatter.
- Comment.__ge__(value, /)
Return self>=value.
- Comment.__getattr__(name, default=None)
Py3k hasattr() expects an AttributeError no KeyError to be raised if the attribute is not found.
- Comment.__getattribute__(name, /)
Return getattr(self, name).
- Comment.__getitem__(name, default=None)
- Comment.__gt__(value, /)
Return self>value.
- Comment.__init__(force_resource_id=True, *args, **kwargs)
- Comment.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- Comment.__iter__()
- Comment.__le__(value, /)
Return self<=value.
- Comment.__len__()
- Comment.__lt__(value, /)
Return self<value.
- Comment.__ne__(other)
- Comment.__new__(**kwargs)
- Comment.__nonzero__()
- Comment.__reduce__()
Helper for pickle.
- Comment.__reduce_ex__(protocol, /)
Helper for pickle.
- Comment.__repr__()
- Comment.__setattr__(name, value)
Custom property implementation that works if the class is inheriting from AttribDict.
- Comment.__setitem__(key, value)
- Comment.__sizeof__()
Size of object in memory, in bytes.
- Comment.__str__(force_one_line=False)
Fairly extensive in an attempt to cover several use cases. It is always possible to change it in the child class.
- classmethod Comment.__subclasshook__(C)