util Module#

util Module#

Various general utilities used in the panel codebase.

panel.util.abbreviated_repr(value, max_length=25, natural_breaks=(',', ' '))[source]#

Returns an abbreviated repr for the supplied object. Attempts to find a natural break point while adhering to the maximum length.


Converts a datetime to a UTC timestamp used by Bokeh interally.

panel.util.edit_readonly(parameterized: param.parameterized.Parameterized) Iterator[source]#

Temporarily set parameters on Parameterized object to readonly=False to allow editing them.

panel.util.full_groupby(l, key=<function <lambda>>)[source]#

Groupby implementation which does not require a prior sort

panel.util.fullpath(path: Union[AnyStr, os.PathLike]) Union[AnyStr, os.PathLike][source]#

Expanduser and then abspath for a given path

panel.util.function_name(func) str[source]#

Returns the name of a function (or its string repr)


Returns the instance owning the supplied instancemethod or the class owning the supplied classmethod.

panel.util.indexOf(obj, objs)[source]#

Returns the index of an object in a list of objects. Unlike the list.index method this function only checks for identity not equality.

panel.util.isIn(obj, objs)[source]#

Checks if the object is in the list of objects safely.

panel.util.is_parameterized(obj) bool[source]#

Whether an object is a Parameterized class or instance.

panel.util.isdatetime(value) bool[source]#

Whether the array or scalar is recognized datetime type.

panel.util.isfile(path: str) bool[source]#

Safe version of os.path.isfile robust to path length issues on Windows

panel.util.param_name(name: str) str[source]#

Removes the integer id from a Parameterized class name.

panel.util.param_reprs(parameterized, skip=None)[source]#

Returns a list of reprs for parameters on the parameterized object. Skips default and empty values.

panel.util.parse_query(query: str) Dict[str, Any][source]#

Parses a url query string, e.g. ?a=1&b=2.1&c=string, converting numeric strings to int or float types.

panel.util.recursive_parameterized(parameterized: param.parameterized.Parameterized, objects=None) List[param.parameterized.Parameterized][source]#

Recursively searches a Parameterized object for other Parmeterized objects.

panel.util.url_path(url: str) str[source]#

Strips the protocol and domain from a URL returning just the path.


Retrieve the value tuple as a tuple of datetime objects.