diff --git a/pip/src/interpreter.rs b/pip/src/interpreter.rs index d82f4b55cb..3b81d736d7 100644 --- a/pip/src/interpreter.rs +++ b/pip/src/interpreter.rs @@ -10,6 +10,7 @@ use miette::{Diagnostic, Report}; use num_bigint::BigUint; use num_complex::Complex64; use pyo3::{ + basic::CompareOp, create_exception, exceptions::PyException, prelude::*, @@ -422,6 +423,27 @@ pub(crate) enum Result { One, } +#[pymethods] +impl Result { + fn __repr__(&self) -> String { + match self { + Result::Zero => "Zero".to_owned(), + Result::One => "One".to_owned(), + } + } + + fn __str__(&self) -> String { + self.__repr__() + } + + fn __hash__(&self) -> u32 { + match self { + Result::Zero => 0, + Result::One => 1, + } + } +} + #[derive(PartialEq)] #[pyclass(unsendable, eq, eq_int)] /// A Q# Pauli operator.