hikari.utility.interval ======================= .. py:module:: hikari.utility.interval Classes ------- .. autoapisummary:: hikari.utility.interval.Interval Module Contents --------------- .. py:class:: Interval(left, right) A class handling [A, B] line segments and numpy operations on them. The following magic methods have been implemented for `Interval`: - creation using `Interval(A, B)` syntax (if `A == B`, represents a point) - comparison operations with numbers (True if holds for the whole Interval) - arithmetic operations, which act element-wise for left and right edge - access methods: `A == Interval(A, B)[0] == Interval(A, B).left` - container methods: 5 and 6.2 are `in Interval(5, 7)`, but 7. might not be .. py:attribute:: left .. py:attribute:: right .. py:method:: __eq__(other) .. py:method:: __lt__(other) .. py:method:: __gt__(other) .. py:method:: __le__(other) .. py:method:: __ge__(other) .. py:method:: __pos__() .. py:method:: __neg__() .. py:method:: __add__(other) .. py:method:: __sub__(other) .. py:method:: __mul__(other) .. py:method:: __truediv__(other) .. py:method:: __str__() .. py:method:: __repr__() .. py:method:: __iter__() .. py:method:: __getitem__(key) .. py:method:: __setitem__(key, value) .. py:method:: __contains__(item) .. py:method:: __len__() .. py:method:: _min(item) :staticmethod: Recursively returns minimum of args if possible, otherwise args .. py:method:: _max(item) :staticmethod: Recursively returns maximum of args if possible, otherwise args .. py:method:: arange(step=1) Return a 1D-list of values from left to right every step :param step: spacing between adjacent values, default 1. :type step: int or float :return: array of values from left to right (including right) every step :rtype: np.array .. py:method:: comb_with(*others, step=1) Return combinations of self.arange(step) with every other.arange(step) :param others: interval or iterable of intervals to comb self with :type others: Interval or tuple or list :param step: spacing between adjacent values, default 1. :type step: int or float :return: array of all combinations found in numpy.meshgrid every step :rtype: np.array .. py:method:: mesh_with(*others, step=1) Return a numpy.mesh of self.arange(step) with every other.arange(step) :param others: interval or iterable of intervals to mesh self with :type others: Interval or tuple or list :param step: spacing between adjacent values, default 1. :type step: int or float :return: array of values meshed by numpy.meshgrid every step :rtype: np.array