search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``igraph`.`utils``

module documentation
(source)

Utility functions that cannot be categorised anywhere else.

Class | `multidict` | A dictionary-like object that is customized to deal with multiple values for the same key.
Function | `consecutive_pairs` | Returns consecutive pairs of items from the given iterable.
Function | `dbl_epsilon` | Approximates the machine epsilon value for doubles.
Function | `deprecated` | Prints a warning message related to the deprecation of some igraph feature.
Function | `named_temporary_file` | Context manager that creates a named temporary file and returns its name.
Function | `numpy_to_contiguous_memoryview` | Converts a NumPy array or matrix into a contiguous memoryview object that is suitable to be forwarded to the Graph constructor.
Function | `rescale` | Rescales a list of numbers into a given range.
Function | `safemax` | Safer variant of `max()` that returns a default value if the iterable is empty.
Function | `safemin` | Safer variant of `min()` that returns a default value if the iterable is empty.
Function | `_is_running_in_ipython` | Internal function that determines whether igraph is running inside IPython or not.

def consecutive_pairs(iterable, circular=False): (source)

Returns consecutive pairs of items from the given iterable.

When `circular` is `True`, the pair consisting of the last and first elements is also returned.

Example:

>     >>> list(consecutive_pairs(range(5)))
>     [(0, 1), (1, 2), (2, 3), (3, 4)]
>     >>> list(consecutive_pairs(range(5), circular=True))
>     [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]
>     >>> list(consecutive_pairs([]))
>     []
>     >>> list(consecutive_pairs([], circular=True))
>     []
>     >>> list(consecutive_pairs([0]))
>     []
>     >>> list(consecutive_pairs([0], circular=True))
>     [(0, 0)]

def dbl_epsilon(): (source)

Approximates the machine epsilon value for doubles.

def deprecated(message): (source)

Prints a warning message related to the deprecation of some igraph feature.

@contextmanager
def named_temporary_file(*args, **kwds): (source)

Context manager that creates a named temporary file and returns its name.

All parameters are passed on to `tempfile.mkstemp`, see its documentation for more info.

def numpy_to_contiguous_memoryview(obj): (source)

Converts a NumPy array or matrix into a contiguous memoryview object that is suitable to be forwarded to the Graph constructor.

This is used internally to allow us to use a NumPy array or matrix directly when constructing a Graph.

def rescale(values, out_range=(0.0, 1.0), in_range=None, clamp=False, scale=None): (source)

Rescales a list of numbers into a given range.

`out_range` gives the range of the output values; by default, the minimum of the original numbers in the list will be mapped to the first element in the output range and the maximum will be mapped to the second element. Elements between the minimum and maximum values in the input list will be interpolated linearly between the first and second values of the output range.

`in_range` may be used to override which numbers are mapped to the first and second values of the output range. This must also be a tuple, where the first element will be mapped to the first element of the output range and the second element to the second.

If `clamp` is `True`, elements which are outside the given `out_range` after rescaling are clamped to the output range to ensure that no number will be outside `out_range` in the result.

If `scale` is not `None`, it will be called for every element of `values` and the rescaling will take place on the results instead. This can be used, for instance, to transform the logarithm of the original values instead of the actual values. A typical use-case is to map a range of values to color identifiers on a logarithmic scale. Scaling also applies to the `in_range` parameter if present.

Examples:

>     >>> rescale(range(5), (0, 8))
>     [0.0, 2.0, 4.0, 6.0, 8.0]
>     >>> rescale(range(5), (2, 10))
>     [2.0, 4.0, 6.0, 8.0, 10.0]
>     >>> rescale(range(5), (0, 4), (1, 3))
>     [-2.0, 0.0, 2.0, 4.0, 6.0]
>     >>> rescale(range(5), (0, 4), (1, 3), clamp=True)
>     [0.0, 0.0, 2.0, 4.0, 4.0]
>     >>> rescale([0]*5, (1, 3))
>     [2.0, 2.0, 2.0, 2.0, 2.0]
>     >>> from math import log10
>     >>> rescale([1, 10, 100, 1000, 10000], (0, 8), scale=log10)
>     [0.0, 2.0, 4.0, 6.0, 8.0]
>     >>> rescale([1, 10, 100, 1000, 10000], (0, 4), (10, 1000), scale=log10)
>     [-2.0, 0.0, 2.0, 4.0, 6.0]

Parameters
values | Undocumented
out_range | the range of output values
in_range | the range of the input values; this is the range that is mapped to `out_range`. `None` means to use the minimum and maximum of the input, respectively.
clamp | specifies what to do when an input value falls outside `in_range`. `True` means to clamp the value to the bounds of `in_range`, `False` means not to clamp.
scale | an optional transformation to perform on the input values before mapping them to the output range.

def safemax(iterable, default=0): (source)

Safer variant of `max()` that returns a default value if the iterable is empty.

Example:

>     >>> safemax([-5, 6, 4])
>     6
>     >>> safemax([])
>     0
>     >>> safemax((), 2)
>     2

def safemin(iterable, default=0): (source)

Safer variant of `min()` that returns a default value if the iterable is empty.

Example:

>     >>> safemin([-5, 6, 4])
>     -5
>     >>> safemin([])
>     0
>     >>> safemin((), 2)
>     2

def _is_running_in_ipython(): (source)

Internal function that determines whether igraph is running inside IPython or not.