How to use the typeguard.typechecked function in typeguard

To help you get started, we’ve selected a few typeguard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PynPoint / PynPoint / pynpoint / processing / badpixel.py View on Github external
        @typechecked
        def _image_interpolation(image_in: np.ndarray) -> np.ndarray:
            return _bad_pixel_interpolation(image_in,
                                            bad_pixel_map,
                                            self.m_iterations)
github danionescu0 / home-automation / python-server / communication / BaseSerial.py View on Github external
    @typechecked()
    @abc.abstractmethod
    def listen(self, complete_message_callback: Callable[[str], bool], receive_message_callback: Callable[[str], None]):
        pass
github PynPoint / PynPoint / pynpoint / util / continuous.py View on Github external
@typechecked
def icwt(X: np.ndarray,
         scales: np.ndarray) -> np.ndarray:
    """
    Inverse Continuous Wavelet Transform. The reconstruction factor is not applied.

    Parameters
    ----------
    X : numpy.ndarray
        Transformed data (2D).
    scales : numpy.ndarray
        Scales (1D).

    Returns
    -------
    numpy.ndarray
         1D data.
github PynPoint / PynPoint / pynpoint / core / dataio.py View on Github external
    @typechecked
    def __setitem__(self,
                    key: Union[slice, int, tuple],
                    value: Union[np.ndarray, int]) -> None:
        """
        Internal function needed to change data using slicing. See class documentation for an
        example (:class:`~pynpoint.core.dataio.OutputPort`).

        Parameters
        ----------
        key : slice
            Index slice to be changed.
        value : np.ndarray
            New data.

        Returns
        -------
github danionescu0 / home-automation / python-server / repository / ConfigurationRepository.py View on Github external
    @typechecked()
    def get_all(self) -> Dict[str, BaseConfig]:
        return {**self.__get_default_configurations(), **self.__get()}
github PynPoint / PynPoint / pynpoint / processing / psfpreparation.py View on Github external
    @typechecked
    def __init__(self,
                 name_in: str,
                 image_in_tag: str,
                 image_out_tag: str) -> None:
        """
        Parameters
        ----------
        name_in : str
            Unique name of the module instance.
        image_in_tag : str
            Database tag with the input data.
        image_out_tag : str
            Database tag where the output data will be stored. Should be different from
            ``image_in_tag``.

        Returns
github PynPoint / PynPoint / pynpoint / processing / resizing.py View on Github external
    @typechecked
    def __init__(self,
                 name_in: str,
                 image_in_tag: str,
                 image_out_tag: str,
                 lines: Tuple[int, int, int, int]) -> None:
        """
        Parameters
        ----------
        name_in : str
            Unique name of the module instance.
        image_in_tag : str
            Tag of the database entry that is read as input.
        image_out_tag : str
            Tag of the database entry that is written as output, including the images with
            decreased size. Should be different from *image_in_tag*.
        lines : tuple(int, int, int, int)
github PynPoint / PynPoint / pynpoint / util / wavelets.py View on Github external
    @typechecked
    def median_filter(self) -> None:
        """
        Applies a median filter on the internal 1d signal. Can be useful for cosmic ray correction
        after temporal de-noising

        Returns
        -------
        NoneType
            None
        """

        self._m_data = medfilt(self._m_data, 19)
github HACS-workshop / hacspec / lib / speclib.py View on Github external
    @typechecked
    def __ne__(self, other: '_array[T]') -> bool:
        if isinstance(other, _array):
            return self.l != other.l
        fail("_array.__ne__ only works on two _arrays.")
github HACS-workshop / hacspec / lib / speclib.py View on Github external
@typechecked
def refine(t: type, f: Callable[[T], bool]) -> Tuple[type,Callable[[T],T]]:
    def refine_check(x):
        if not isinstance(x,t) or not f(x):
            print("got :"+str(x))
            print("expected : x:"+str(t)+"{"+str(f)+"}")
            fail("refinement check failed")
        return x
    return (t,refine_check)