pypath.core.attrs.AttributeHandler§

class pypath.core.attrs.AttributeHandler(attrs=None, **kwargs)[source]§

Bases: object

Base class for other classes which carry custom attributes (data) in a dedicated dict under the attrs attribute.

__init__(attrs=None, **kwargs)[source]§

Methods

__init__([attrs])

serialize(**kwargs)

Generates a JSON string with the full contents of the attributes, without any whitespace or line break.

update_attrs([attrs])

Updates the attributes stored here.

Attributes

attrs

serialize(**kwargs)[source]§

Generates a JSON string with the full contents of the attributes, without any whitespace or line break.

Returns

(str): The attributes JSON serialized.

update_attrs(attrs=None, **kwargs)[source]§

Updates the attributes stored here. The attributes with identical keys are merged using the pypath.share.common.combine_attrs() function.

The new attributes can be provided three ways: an object with an attribute called attrs; a dictionary of attributes; or the attributes as keyword arguments.