Skip to content

Commit

Permalink
Remove redundant import_line from BloqDocSpec (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesyuan314 authored Jul 30, 2024
1 parent 22e5538 commit 18e62ca
Show file tree
Hide file tree
Showing 27 changed files with 27 additions and 114 deletions.
6 changes: 1 addition & 5 deletions qualtran/bloqs/basic_gates/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,4 @@ def _identity() -> Identity:
return identity


_IDENTITY_DOC = BloqDocSpec(
bloq_cls=Identity,
import_line='from qualtran.bloqs.basic_gates import Identity',
examples=[_identity],
)
_IDENTITY_DOC = BloqDocSpec(bloq_cls=Identity, examples=[_identity])
4 changes: 1 addition & 3 deletions qualtran/bloqs/basic_gates/su2_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,5 @@ def _t_gate() -> SU2RotationGate:


_SU2_ROTATION_GATE_DOC = BloqDocSpec(
bloq_cls=SU2RotationGate,
import_line='from qualtran.bloqs.basic_gates import SU2RotationGate',
examples=[_su2_rotation_gate, _hadamard, _t_gate],
bloq_cls=SU2RotationGate, examples=[_su2_rotation_gate, _hadamard, _t_gate]
)
6 changes: 1 addition & 5 deletions qualtran/bloqs/basic_gates/swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,4 @@ def _cswap_large() -> CSwap:
return cswap_large


_CSWAP_DOC = BloqDocSpec(
bloq_cls=CSwap,
import_line='from qualtran.bloqs.basic_gates import CSwap',
examples=(_cswap_symb, _cswap_small, _cswap_large),
)
_CSWAP_DOC = BloqDocSpec(bloq_cls=CSwap, examples=(_cswap_symb, _cswap_small, _cswap_large))
4 changes: 1 addition & 3 deletions qualtran/bloqs/basic_gates/t_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,4 @@ def _t_gate() -> TGate:
return t_gate


_T_GATE_DOC = BloqDocSpec(
bloq_cls=TGate, import_line='from qualtran.bloqs.basic_gates import TGate', examples=[_t_gate]
)
_T_GATE_DOC = BloqDocSpec(bloq_cls=TGate, examples=[_t_gate])
6 changes: 1 addition & 5 deletions qualtran/bloqs/basic_gates/toffoli.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,4 @@ def _toffoli() -> Toffoli:
return toffoli


_TOFFOLI_DOC = BloqDocSpec(
bloq_cls=Toffoli,
import_line='from qualtran.bloqs.basic_gates import Toffoli',
examples=[_toffoli],
)
_TOFFOLI_DOC = BloqDocSpec(bloq_cls=Toffoli, examples=[_toffoli])
4 changes: 1 addition & 3 deletions qualtran/bloqs/block_encoding/block_encoding_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,5 @@ def signal_state(self) -> PrepareOracle:


_BLOCK_ENCODING_DOC = BloqDocSpec(
bloq_cls=BlockEncoding, # type: ignore[type-abstract]
import_line="from qualtran.bloqs.block_encoding import BlockEncoding",
examples=[],
bloq_cls=BlockEncoding, examples=[] # type: ignore[type-abstract]
)
11 changes: 1 addition & 10 deletions qualtran/bloqs/block_encoding/lcu_block_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,20 +450,11 @@ def _black_box_lcu_zero_state_block() -> LCUBlockEncodingZeroState:
return black_box_lcu_zero_state_block


_BLOCK_ENCODING_DOC = BloqDocSpec(
bloq_cls=BlockEncoding, # type: ignore[type-abstract]
import_line="from qualtran.bloqs.block_encoding import BlockEncoding",
examples=[],
)

_LCU_BLOCK_ENCODING_DOC = BloqDocSpec(
bloq_cls=LCUBlockEncoding,
import_line='from qualtran.bloqs.block_encoding import LCUBlockEncoding',
examples=(_lcu_block, _black_box_lcu_block),
bloq_cls=LCUBlockEncoding, examples=(_lcu_block, _black_box_lcu_block)
)

_LCU_ZERO_STATE_BLOCK_ENCODING_DOC = BloqDocSpec(
bloq_cls=LCUBlockEncodingZeroState,
import_line='from qualtran.bloqs.block_encoding import LCUBlockEncodingZeroState',
examples=(_lcu_zero_state_block, _black_box_lcu_zero_state_block),
)
4 changes: 1 addition & 3 deletions qualtran/bloqs/block_encoding/linear_combination.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,5 @@ def _linear_combination_block_encoding() -> LinearCombination:


_LINEAR_COMBINATION_DOC = BloqDocSpec(
bloq_cls=LinearCombination,
import_line="from qualtran.bloqs.block_encoding import LinearCombination",
examples=[_linear_combination_block_encoding],
bloq_cls=LinearCombination, examples=[_linear_combination_block_encoding]
)
6 changes: 1 addition & 5 deletions qualtran/bloqs/block_encoding/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,4 @@ def _phase_block_encoding() -> Phase:
return phase_block_encoding


_PHASE_DOC = BloqDocSpec(
bloq_cls=Phase,
import_line="from qualtran.bloqs.block_encoding import Phase",
examples=[_phase_block_encoding],
)
_PHASE_DOC = BloqDocSpec(bloq_cls=Phase, examples=[_phase_block_encoding])
1 change: 0 additions & 1 deletion qualtran/bloqs/block_encoding/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ def _product_block_encoding_symb() -> Product:

_PRODUCT_DOC = BloqDocSpec(
bloq_cls=Product,
import_line="from qualtran.bloqs.block_encoding import Product",
examples=[
_product_block_encoding,
_product_block_encoding_properties,
Expand Down
1 change: 0 additions & 1 deletion qualtran/bloqs/block_encoding/sparse_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ def _symmetric_banded_matrix_block_encoding() -> SparseMatrix:

_SPARSE_MATRIX_DOC = BloqDocSpec(
bloq_cls=SparseMatrix,
import_line="from qualtran.bloqs.block_encoding import SparseMatrix",
examples=[
_sparse_matrix_block_encoding,
_sparse_matrix_symb_block_encoding,
Expand Down
1 change: 0 additions & 1 deletion qualtran/bloqs/block_encoding/tensor_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ def _tensor_product_block_encoding_symb() -> TensorProduct:

_TENSOR_PRODUCT_DOC = BloqDocSpec(
bloq_cls=TensorProduct,
import_line="from qualtran.bloqs.block_encoding import TensorProduct",
examples=[
_tensor_product_block_encoding,
_tensor_product_block_encoding_properties,
Expand Down
4 changes: 1 addition & 3 deletions qualtran/bloqs/block_encoding/unitary.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,5 @@ def _unitary_block_encoding_properties() -> Unitary:


_UNITARY_DOC = BloqDocSpec(
bloq_cls=Unitary,
import_line="from qualtran.bloqs.block_encoding import Unitary",
examples=[_unitary_block_encoding, _unitary_block_encoding_properties],
bloq_cls=Unitary, examples=[_unitary_block_encoding, _unitary_block_encoding_properties]
)
4 changes: 1 addition & 3 deletions qualtran/bloqs/bookkeeping/auto_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,5 @@ def _auto_partition_unused() -> AutoPartition:


_AUTO_PARTITION_DOC = BloqDocSpec(
bloq_cls=AutoPartition,
import_line="from qualtran.bloqs.bookkeeping import AutoPartition",
examples=[_auto_partition, _auto_partition_unused],
bloq_cls=AutoPartition, examples=[_auto_partition, _auto_partition_unused]
)
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,4 @@ def _prep_hubb() -> PrepareHubbard:
return prep_hubb


_PREPARE_HUBBARD = BloqDocSpec(
bloq_cls=PrepareHubbard,
import_line='from qualtran.bloqs.chemistry.hubbard_model.qubitization import PrepareHubbard',
examples=(_prep_hubb,),
)
_PREPARE_HUBBARD = BloqDocSpec(bloq_cls=PrepareHubbard, examples=(_prep_hubb,))
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,4 @@ def _sel_hubb() -> SelectHubbard:
return sel_hubb


_SELECT_HUBBARD: BloqDocSpec = BloqDocSpec(
bloq_cls=SelectHubbard,
import_line='from qualtran.bloqs.chemistry.hubbard_model.qubitization import SelectHubbard',
examples=(_sel_hubb,),
)
_SELECT_HUBBARD: BloqDocSpec = BloqDocSpec(bloq_cls=SelectHubbard, examples=(_sel_hubb,))
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,9 @@ def _sel_first_quant() -> SelectFirstQuantizationWithProj:


_FIRST_QUANTIZED_WITH_PROJ_PREPARE_DOC = BloqDocSpec(
bloq_cls=PrepareFirstQuantizationWithProj,
import_line='from qualtran.bloqs.chemistry.pbc.first_quantization.projectile import PrepareFirstQuantizationWithProj',
examples=(_prep_first_quant,),
bloq_cls=PrepareFirstQuantizationWithProj, examples=(_prep_first_quant,)
)

_FIRST_QUANTIZED_WITH_PROJ_SELECT_DOC = BloqDocSpec(
bloq_cls=SelectFirstQuantizationWithProj,
import_line='from qualtran.bloqs.chemistry.pbc.first_quantization.projectile import SelectFirstQuantizationWithProj',
examples=(_sel_first_quant,),
bloq_cls=SelectFirstQuantizationWithProj, examples=(_sel_first_quant,)
)
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,9 @@ def _sel_first_quant() -> SelectFirstQuantization:


_FIRST_QUANTIZED_PREPARE_DOC = BloqDocSpec(
bloq_cls=PrepareFirstQuantization,
import_line='from qualtran.bloqs.chemistry.pbc.first_quantization import PrepareFirstQuantization',
examples=(_prep_first_quant,),
bloq_cls=PrepareFirstQuantization, examples=(_prep_first_quant,)
)

_FIRST_QUANTIZED_SELECT_DOC = BloqDocSpec(
bloq_cls=SelectFirstQuantization,
import_line='from qualtran.bloqs.chemistry.pbc.first_quantization import SelectFirstQuantization',
examples=(_sel_first_quant,),
bloq_cls=SelectFirstQuantization, examples=(_sel_first_quant,)
)
10 changes: 2 additions & 8 deletions qualtran/bloqs/mcmt/and_bloq.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ def _and_bloq() -> And:
return and_bloq


_AND_DOC = BloqDocSpec(
bloq_cls=And, import_line='from qualtran.bloqs.mcmt import And', examples=(_and_bloq,)
)
_AND_DOC = BloqDocSpec(bloq_cls=And, examples=(_and_bloq,))


def _to_tuple_or_has_length(
Expand Down Expand Up @@ -372,8 +370,4 @@ def _multi_and_symb() -> MultiAnd:
return multi_and_symb


_MULTI_AND_DOC = BloqDocSpec(
bloq_cls=MultiAnd,
import_line='from qualtran.bloqs.mcmt import MultiAnd',
examples=(_multi_and,),
)
_MULTI_AND_DOC = BloqDocSpec(bloq_cls=MultiAnd, examples=(_multi_and,))
12 changes: 2 additions & 10 deletions qualtran/bloqs/mcmt/multi_control_multi_target_pauli.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ def _c_multi_not() -> MultiTargetCNOT:
return c_multi_not


_C_MULTI_NOT_DOC = BloqDocSpec(
bloq_cls=MultiTargetCNOT,
import_line='from qualtran.bloqs.mcmt import MultiTargetCNOT',
examples=(_c_multi_not_symb, _c_multi_not),
)
_C_MULTI_NOT_DOC = BloqDocSpec(bloq_cls=MultiTargetCNOT, examples=(_c_multi_not_symb, _c_multi_not))


@frozen
Expand Down Expand Up @@ -243,11 +239,7 @@ def _ccpauli_symb() -> MultiControlPauli:
return ccpauli_symb


_CC_PAULI_DOC = BloqDocSpec(
bloq_cls=MultiControlPauli,
import_line='from qualtran.bloqs.mcmt import MultiControlPauli',
examples=(_ccpauli,),
)
_CC_PAULI_DOC = BloqDocSpec(bloq_cls=MultiControlPauli, examples=(_ccpauli,))


@frozen
Expand Down
1 change: 0 additions & 1 deletion qualtran/bloqs/phase_estimation/text_book_qpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ def _textbook_qpe_from_standard_deviation_eps() -> TextbookQPE:

_CC_TEXTBOOK_PHASE_ESTIMATION_DOC = BloqDocSpec(
bloq_cls=TextbookQPE,
import_line='from qualtran.bloqs.phase_estimation import TextbookQPE',
examples=(
_textbook_qpe_small,
_textbook_qpe_using_m_bits,
Expand Down
4 changes: 1 addition & 3 deletions qualtran/bloqs/qubitization/qubitization_walk_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,5 @@ def _walk_op_chem_sparse() -> QubitizationWalkOperator:


_QUBITIZATION_WALK_DOC = BloqDocSpec(
bloq_cls=QubitizationWalkOperator,
import_line='from qualtran.bloqs.qubitization import QubitizationWalkOperator',
examples=(_walk_op, _thc_walk_op, _walk_op_chem_sparse),
bloq_cls=QubitizationWalkOperator, examples=(_walk_op, _thc_walk_op, _walk_op_chem_sparse)
)
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,5 @@ def _c_prep_uniform() -> PrepareUniformSuperposition:


_PREP_UNIFORM_DOC = BloqDocSpec(
bloq_cls=PrepareUniformSuperposition,
import_line='from qualtran.bloqs.state_preparation import PrepareUniformSuperposition',
examples=(_prep_uniform, _c_prep_uniform),
bloq_cls=PrepareUniformSuperposition, examples=(_prep_uniform, _c_prep_uniform)
)
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,7 @@ def _state_prep_alias_symb() -> StatePreparationAliasSampling:


_STATE_PREP_ALIAS_DOC = BloqDocSpec(
bloq_cls=StatePreparationAliasSampling,
import_line='from qualtran.bloqs.state_preparation import StatePreparationAliasSampling',
examples=(_state_prep_alias, _state_prep_alias_symb),
bloq_cls=StatePreparationAliasSampling, examples=(_state_prep_alias, _state_prep_alias_symb)
)


Expand Down
4 changes: 1 addition & 3 deletions qualtran/bloqs/swap_network/cswap_approx.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,5 @@ def _approx_cswap_large() -> CSwapApprox:


_APPROX_CSWAP_DOC = BloqDocSpec(
bloq_cls=CSwapApprox,
import_line='from qualtran.bloqs.swap_network import CSwapApprox',
examples=(_approx_cswap_symb, _approx_cswap_small, _approx_cswap_large),
bloq_cls=CSwapApprox, examples=(_approx_cswap_symb, _approx_cswap_small, _approx_cswap_large)
)
6 changes: 1 addition & 5 deletions qualtran/bloqs/swap_network/multiplexed_cswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,4 @@ def _multiplexed_cswap() -> MultiplexedCSwap:
return multiplexed_cswap


_MULTIPLEXED_CSWAP_DOC = BloqDocSpec(
bloq_cls=MultiplexedCSwap,
import_line='from qualtran.bloqs.swap_network import MultiplexedCSwap',
examples=(_multiplexed_cswap,),
)
_MULTIPLEXED_CSWAP_DOC = BloqDocSpec(bloq_cls=MultiplexedCSwap, examples=(_multiplexed_cswap,))
6 changes: 1 addition & 5 deletions qualtran/bloqs/swap_network/swap_with_zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,4 @@ def _swz_multi_dimensional() -> SwapWithZero:
return swz_multi_dimensional


_SWZ_DOC = BloqDocSpec(
bloq_cls=SwapWithZero,
import_line='from qualtran.bloqs.swap_network import SwapWithZero',
examples=(_swz, _swz_small, _swz_multi_dimensional),
)
_SWZ_DOC = BloqDocSpec(bloq_cls=SwapWithZero, examples=(_swz, _swz_small, _swz_multi_dimensional))

0 comments on commit 18e62ca

Please sign in to comment.