Skip to content

Commit

Permalink
remove None from constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkoham committed Oct 27, 2020
1 parent f848fce commit c884ebb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion qiskit/aqua/operators/state_fns/circuit_state_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CircuitStateFn(StateFn):

# TODO allow normalization somehow?
def __init__(self,
primitive: Union[QuantumCircuit, Instruction] = None,
primitive: Union[QuantumCircuit, Instruction],
coeff: Union[int, float, complex, ParameterExpression] = 1.0,
is_measurement: bool = False) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion qiskit/aqua/operators/state_fns/cvar_measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __new__(cls,
primitive: Union[str, dict, Result,
list, np.ndarray, Statevector,
QuantumCircuit, Instruction,
OperatorBase] = None,
OperatorBase],
alpha: float = 1.0,
coeff: Union[int, float, complex, ParameterExpression] = 1.0,
) -> 'CVaRMeasurement':
Expand Down
2 changes: 1 addition & 1 deletion qiskit/aqua/operators/state_fns/dict_state_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DictStateFn(StateFn):

# TODO allow normalization somehow?
def __init__(self,
primitive: Optional[Union[str, dict, Result]] = None,
primitive: Union[str, dict, Result],
coeff: Union[int, float, complex, ParameterExpression] = 1.0,
is_measurement: bool = False) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion qiskit/aqua/operators/state_fns/operator_state_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class OperatorStateFn(StateFn):

# TODO allow normalization somehow?
def __init__(self,
primitive: Optional[OperatorBase] = None,
primitive: OperatorBase,
coeff: Union[int, float, complex, ParameterExpression] = 1.0,
is_measurement: bool = False) -> None:
"""
Expand Down
10 changes: 5 additions & 5 deletions qiskit/aqua/operators/state_fns/state_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __new__(cls,
primitive: Union[str, dict, Result,
list, np.ndarray, Statevector,
QuantumCircuit, Instruction,
OperatorBase] = None,
OperatorBase],
coeff: Union[int, float, complex, ParameterExpression] = 1.0,
is_measurement: bool = False) -> 'StateFn':
""" A factory method to produce the correct type of StateFn subclass
Expand All @@ -77,19 +77,19 @@ def __new__(cls,
# pylint: disable=cyclic-import,import-outside-toplevel
if isinstance(primitive, (str, dict, Result)):
from .dict_state_fn import DictStateFn
return DictStateFn.__new__(DictStateFn)
return DictStateFn.__new__(DictStateFn, primitive)

if isinstance(primitive, (list, np.ndarray, Statevector)):
from .vector_state_fn import VectorStateFn
return VectorStateFn.__new__(VectorStateFn)
return VectorStateFn.__new__(VectorStateFn, primitive)

if isinstance(primitive, (QuantumCircuit, Instruction)):
from .circuit_state_fn import CircuitStateFn
return CircuitStateFn.__new__(CircuitStateFn)
return CircuitStateFn.__new__(CircuitStateFn, primitive)

if isinstance(primitive, OperatorBase):
from .operator_state_fn import OperatorStateFn
return OperatorStateFn.__new__(OperatorStateFn)
return OperatorStateFn.__new__(OperatorStateFn, primitive)

raise TypeError('Unsupported primitive type {} passed into StateFn '
'factory constructor'.format(type(primitive)))
Expand Down
2 changes: 1 addition & 1 deletion qiskit/aqua/operators/state_fns/vector_state_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class VectorStateFn(StateFn):

# TODO allow normalization somehow?
def __init__(self,
primitive: Union[list, np.ndarray, Statevector] = None,
primitive: Union[list, np.ndarray, Statevector],
coeff: Union[int, float, complex, ParameterExpression] = 1.0,
is_measurement: bool = False) -> None:
"""
Expand Down

0 comments on commit c884ebb

Please sign in to comment.