Skip to content

Commit

Permalink
Third-round-of-review
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Nov 20, 2019
1 parent 5854b30 commit d309807
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pyquil/paulis.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def __mul__(self, term: Union[PauliDesignator, PauliCoefficientDesignator]) -> P

return term_with_coeff(new_term, new_term.coefficient * new_coeff)

def __rmul__(self, other: Number) -> 'PauliTerm':
def __rmul__(self, other: PauliCoefficientDesignator) -> 'PauliTerm':
"""Multiplies this PauliTerm with another object, probably a number.
:param other: A number or PauliTerm to multiply by
Expand Down Expand Up @@ -270,10 +270,10 @@ def __add__(self, other: Union[PauliDesignator, PauliCoefficientDesignator]) ->
new_sum = PauliSum([self, other])
return new_sum.simplify()

def __radd__(self, other: Number) -> 'PauliTerm':
def __radd__(self, other: PauliCoefficientDesignator) -> 'PauliTerm':
"""Adds this PauliTerm with a Number.
:param other: A PauliTerm object or a Number
:param other: A Number
:returns: A new PauliTerm
:rtype: PauliTerm
"""
Expand Down Expand Up @@ -483,7 +483,7 @@ def sZ(q: int) -> PauliTerm:
return PauliTerm("Z", q)


def term_with_coeff(term: PauliTerm, coeff: Number) -> PauliTerm:
def term_with_coeff(term: PauliTerm, coeff: PauliCoefficientDesignator) -> PauliTerm:
"""
Change the coefficient of a PauliTerm.
Expand Down Expand Up @@ -576,7 +576,7 @@ def __mul__(self, other: Union[PauliDesignator, PauliCoefficientDesignator]) ->
new_sum = PauliSum(new_terms)
return new_sum.simplify()

def __rmul__(self, other: Number) -> 'PauliSum':
def __rmul__(self, other: PauliCoefficientDesignator) -> 'PauliSum':
"""
Multiples together this PauliSum with PauliSum, PauliTerm or Number objects. The new term
is then simplified according to the Pauli Algebra rules.
Expand Down Expand Up @@ -634,12 +634,12 @@ def __add__(self, other: Union[PauliDesignator, PauliCoefficientDesignator]) ->
new_sum = PauliSum(new_terms)
return new_sum.simplify()

def __radd__(self, other: Union[PauliDesignator, PauliCoefficientDesignator]) -> 'PauliSum':
def __radd__(self, other: PauliCoefficientDesignator) -> 'PauliSum':
"""
Adds together this PauliSum with PauliSum, PauliTerm or Number objects. The new term
Adds together this PauliSum with a Number object. The new term
is then simplified according to the Pauli Algebra rules.
:param other: a PauliSum, PauliTerm or Number object
:param other: A Number
:return: A new PauliSum object given by the addition.
:rtype: PauliSum
"""
Expand Down

0 comments on commit d309807

Please sign in to comment.