psiqdk-workbench 4.45.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- psiqdk/workbench/__init__.py +16 -0
- psiqdk/workbench/__init__.pyi +39 -0
- psiqdk/workbench/_curated_loader.py +389 -0
- psiqdk/workbench/_mapping_expand.py +698 -0
- psiqdk/workbench/arithmetic/__init__.py +16 -0
- psiqdk/workbench/arithmetic/__init__.pyi +34 -0
- psiqdk/workbench/arithmetic/interfaces/__init__.py +16 -0
- psiqdk/workbench/comparators/__init__.py +16 -0
- psiqdk/workbench/comparators/__init__.pyi +13 -0
- psiqdk/workbench/compilation/__init__.py +16 -0
- psiqdk/workbench/compilation/__init__.pyi +64 -0
- psiqdk/workbench/compilation/filters/__init__.py +3 -0
- psiqdk/workbench/compilation/filters/__init__.pyi +34 -0
- psiqdk/workbench/compilation/filters/elementary_filters/__init__.py +3 -0
- psiqdk/workbench/compilation/filters/elementary_filters/__init__.pyi +21 -0
- psiqdk/workbench/compilation/standard_gate_decompositions/__init__.py +3 -0
- psiqdk/workbench/compilation/standard_gate_decompositions/__init__.pyi +43 -0
- psiqdk/workbench/compilation/standard_gate_decompositions/ladders/__init__.py +3 -0
- psiqdk/workbench/compilation/standard_gate_decompositions/ladders/__init__.pyi +14 -0
- psiqdk/workbench/errors/__init__.py +16 -0
- psiqdk/workbench/errors/__init__.pyi +7 -0
- psiqdk/workbench/experimental/__init__.py +16 -0
- psiqdk/workbench/experimental/__init__.pyi +7 -0
- psiqdk/workbench/experimental/active_volume_estimation/__init__.py +16 -0
- psiqdk/workbench/experimental/active_volume_estimation/__init__.pyi +42 -0
- psiqdk/workbench/experimental/active_volume_estimation/utils/__init__.py +16 -0
- psiqdk/workbench/experimental/interoperability/__init__.py +16 -0
- psiqdk/workbench/experimental/symbolics/__init__.py +16 -0
- psiqdk/workbench/experimental/symbolics/__init__.pyi +39 -0
- psiqdk/workbench/filter_machinery/__init__.py +16 -0
- psiqdk/workbench/filter_machinery/__init__.pyi +19 -0
- psiqdk/workbench/filter_presets/__init__.py +16 -0
- psiqdk/workbench/filter_presets/__init__.pyi +13 -0
- psiqdk/workbench/flow_control/__init__.py +16 -0
- psiqdk/workbench/flow_control/__init__.pyi +11 -0
- psiqdk/workbench/integrations/__init__.py +16 -0
- psiqdk/workbench/integrations/__init__.pyi +10 -0
- psiqdk/workbench/integrations/circuit_designer/__init__.py +16 -0
- psiqdk/workbench/integrations/cudaq/__init__.py +16 -0
- psiqdk/workbench/integrations/cudaq/__init__.pyi +8 -0
- psiqdk/workbench/integrations/qasm/__init__.py +16 -0
- psiqdk/workbench/integrations/qasm/__init__.pyi +8 -0
- psiqdk/workbench/integrations/qiskit/__init__.py +16 -0
- psiqdk/workbench/integrations/qiskit/__init__.pyi +8 -0
- psiqdk/workbench/interoperability/__init__.py +16 -0
- psiqdk/workbench/interoperability/__init__.pyi +20 -0
- psiqdk/workbench/opcodes/__init__.py +16 -0
- psiqdk/workbench/opcodes/__init__.pyi +58 -0
- psiqdk/workbench/ops/__init__.py +16 -0
- psiqdk/workbench/ops/__init__.pyi +22 -0
- psiqdk/workbench/phase_gradients/__init__.py +16 -0
- psiqdk/workbench/phase_gradients/__init__.pyi +6 -0
- psiqdk/workbench/qft/__init__.py +16 -0
- psiqdk/workbench/qft/__init__.pyi +6 -0
- psiqdk/workbench/qpu/__init__.py +16 -0
- psiqdk/workbench/qpu/__init__.pyi +9 -0
- psiqdk/workbench/qre/__init__.py +16 -0
- psiqdk/workbench/qre/__init__.pyi +19 -0
- psiqdk/workbench/qre/utils/__init__.py +16 -0
- psiqdk/workbench/qubrick_interfaces/__init__.py +16 -0
- psiqdk/workbench/qubrick_interfaces/__init__.pyi +8 -0
- psiqdk/workbench/qubrick_machinery/__init__.py +16 -0
- psiqdk/workbench/qubrick_machinery/__init__.pyi +7 -0
- psiqdk/workbench/registers/__init__.py +16 -0
- psiqdk/workbench/registers/__init__.pyi +15 -0
- psiqdk/workbench/rotations/__init__.py +16 -0
- psiqdk/workbench/rotations/__init__.pyi +11 -0
- psiqdk/workbench/simulators/__init__.py +16 -0
- psiqdk/workbench/simulators/__init__.pyi +8 -0
- psiqdk/workbench/units/__init__.py +16 -0
- psiqdk/workbench/units/__init__.pyi +8 -0
- psiqdk/workbench/usp/__init__.py +16 -0
- psiqdk/workbench/usp/__init__.pyi +9 -0
- psiqdk/workbench/utility_filters/__init__.py +16 -0
- psiqdk/workbench/utility_filters/__init__.pyi +11 -0
- psiqdk/workbench/utils/__init__.py +16 -0
- psiqdk/workbench/utils/__init__.pyi +18 -0
- psiqdk/workbench/utils/bit_utils/__init__.py +16 -0
- psiqdk/workbench/utils/bit_utils/__init__.pyi +19 -0
- psiqdk/workbench/utils/discrepancies/__init__.py +16 -0
- psiqdk/workbench/utils/discrepancies/__init__.pyi +10 -0
- psiqdk/workbench/utils/matrix/__init__.py +16 -0
- psiqdk/workbench/utils/matrix/__init__.pyi +7 -0
- psiqdk/workbench/utils/misc_utils/__init__.py +16 -0
- psiqdk/workbench/utils/numpy_utils/__init__.py +16 -0
- psiqdk/workbench/utils/numpy_utils/__init__.pyi +14 -0
- psiqdk/workbench/utils/rotation_utils/__init__.py +16 -0
- psiqdk/workbench/utils/rotation_utils/__init__.pyi +19 -0
- psiqdk/workbench/utils/state_vector_utils/__init__.py +16 -0
- psiqdk/workbench/utils/unstable_api_utils/__init__.py +16 -0
- psiqdk/workbench/utils/unstable_api_utils/__init__.pyi +9 -0
- psiqdk/workbench/workbench-curated-mapping.yaml +441 -0
- psiqdk_workbench-4.45.0.dist-info/METADATA +61 -0
- psiqdk_workbench-4.45.0.dist-info/RECORD +335 -0
- psiqdk_workbench-4.45.0.dist-info/WHEEL +4 -0
- psiqdk_workbench-4.45.0.dist-info/entry_points.txt +8 -0
- psiqdk_workbench-4.45.0.dist-info/licenses/LICENSE +202 -0
- psiqworkbench/__init__.py +182 -0
- psiqworkbench/bit_utils.py +13 -0
- psiqworkbench/compilation/Adding extra conditions to filters example.ipynb +2090 -0
- psiqworkbench/compilation/Baseline architecture composite filter example.ipynb +304 -0
- psiqworkbench/compilation/__init__.py +28 -0
- psiqworkbench/compilation/convert_to_av_architecture/__init__.py +0 -0
- psiqworkbench/compilation/filters/__init__.py +22 -0
- psiqworkbench/compilation/filters/composite_filters/__init__.py +2 -0
- psiqworkbench/compilation/filters/composite_filters/baseline_architecture.py +104 -0
- psiqworkbench/compilation/filters/composite_filters/composite_filter_base_class.py +56 -0
- psiqworkbench/compilation/filters/elbow_pair_reduction_utils.py +486 -0
- psiqworkbench/compilation/filters/elementary_filters/__init__.py +35 -0
- psiqworkbench/compilation/filters/elementary_filters/by_operation_type_filter.py +395 -0
- psiqworkbench/compilation/filters/elementary_filters/clean_ladders.py +559 -0
- psiqworkbench/compilation/filters/elementary_filters/cond_clean_dirty_ladder.py +153 -0
- psiqworkbench/compilation/filters/elementary_filters/cond_clean_ladder.py +118 -0
- psiqworkbench/compilation/filters/elementary_filters/dirty_ladders.py +158 -0
- psiqworkbench/compilation/filters/elementary_filters/elbow_pair_reduction.py +76 -0
- psiqworkbench/compilation/filters/elementary_filters/elementary_filter_base_class.py +212 -0
- psiqworkbench/compilation/filters/elementary_filters/hermitian_window_filter.py +73 -0
- psiqworkbench/compilation/filters/elementary_filters/no_control.py +104 -0
- psiqworkbench/compilation/filters/elementary_filters/pauli_product.py +195 -0
- psiqworkbench/compilation/filters/elementary_filters/phase_gradient_addition.py +178 -0
- psiqworkbench/compilation/filters/elementary_filters/qubit_interaction.py +286 -0
- psiqworkbench/compilation/filters/elementary_filters/ross_selinger_synthesis.py +484 -0
- psiqworkbench/compilation/filters/elementary_filters/single_control.py +443 -0
- psiqworkbench/compilation/filters/elementary_filters/swap_push.py +165 -0
- psiqworkbench/compilation/filters/elementary_filters/toffoli_to_ts.py +327 -0
- psiqworkbench/compilation/filters/elementary_filters/tunable_ladder.py +129 -0
- psiqworkbench/compilation/filters/filter_utils.py +76 -0
- psiqworkbench/compilation/rotation_synthesis/__init__.py +0 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/geometry.py +319 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/grid.py +274 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/gridop.py +280 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/gridsolve.py +238 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/groups.py +174 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/intervals.py +135 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/point.py +112 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/prime.py +86 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/ring.py +556 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/ring_approx.py +397 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/ring_decompose.py +298 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/ring_fast.c +11805 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/ring_fast.pyx +168 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/ring_fast_old.py +61 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/setup.py +6 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/synth.py +352 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/synth_approx.py +50 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/test_gridsolve.py +117 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/test_gridtool.py +233 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/test_ring.py +265 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/test_ring_approx.py +137 -0
- psiqworkbench/compilation/rotation_synthesis/ross_selinger_synthesis/test_synth.py +71 -0
- psiqworkbench/compilation/standard_gate_decompositions/__init__.py +39 -0
- psiqworkbench/compilation/standard_gate_decompositions/ladders/__init__.py +12 -0
- psiqworkbench/compilation/standard_gate_decompositions/ladders/clean.py +45 -0
- psiqworkbench/compilation/standard_gate_decompositions/ladders/conditionally_clean.py +271 -0
- psiqworkbench/compilation/standard_gate_decompositions/ladders/dirty.py +74 -0
- psiqworkbench/compilation/standard_gate_decompositions/ladders/tunable_decomposition.py +274 -0
- psiqworkbench/compilation/standard_gate_decompositions/ppr_conversion.py +359 -0
- psiqworkbench/compilation/standard_gate_decompositions/single_control_decomps.py +239 -0
- psiqworkbench/compilation/standard_gate_decompositions/toffoli_to_ts_decomps.py +64 -0
- psiqworkbench/discrepancies/__init__.py +15 -0
- psiqworkbench/discrepancies/registry.py +131 -0
- psiqworkbench/discrepancies/report.py +77 -0
- psiqworkbench/draw/__init__.py +0 -0
- psiqworkbench/draw/draw_core.py +1946 -0
- psiqworkbench/draw/draw_svg.py +358 -0
- psiqworkbench/filter_presets.py +28 -0
- psiqworkbench/integrations/__init__.py +4 -0
- psiqworkbench/integrations/_events.py +347 -0
- psiqworkbench/integrations/_exporter_base.py +174 -0
- psiqworkbench/integrations/_io.py +56 -0
- psiqworkbench/integrations/_labelling.py +64 -0
- psiqworkbench/integrations/_register_tracking.py +242 -0
- psiqworkbench/integrations/_resource_analyzer_common.py +32 -0
- psiqworkbench/integrations/_resource_analyzer_qref.py +138 -0
- psiqworkbench/integrations/_topology_tracking.py +92 -0
- psiqworkbench/integrations/circuit_designer.py +331 -0
- psiqworkbench/integrations/resource_analyzer.py +125 -0
- psiqworkbench/interfaces/__init__.py +14 -0
- psiqworkbench/interfaces/_adders.py +32 -0
- psiqworkbench/interoperability/__init__.py +57 -0
- psiqworkbench/interoperability/_di_container.py +397 -0
- psiqworkbench/interoperability/_tag_class.py +645 -0
- psiqworkbench/interoperability/_tag_definitions.py +18 -0
- psiqworkbench/io/__init__.py +4 -0
- psiqworkbench/io/cudaq/__init__.py +1 -0
- psiqworkbench/io/cudaq/cudaq_sim_filter.py +830 -0
- psiqworkbench/io/qasm/README.md +9 -0
- psiqworkbench/io/qasm/__init__.py +2 -0
- psiqworkbench/io/qasm/antlr/__init__.py +3 -0
- psiqworkbench/io/qasm/antlr/qasm3Lexer.py +823 -0
- psiqworkbench/io/qasm/antlr/qasm3Lexer.tokens +193 -0
- psiqworkbench/io/qasm/antlr/qasm3Parser.py +6988 -0
- psiqworkbench/io/qasm/antlr/qasm3Parser.tokens +193 -0
- psiqworkbench/io/qasm/antlr/qasm3ParserListener.py +759 -0
- psiqworkbench/io/qasm/antlr/qasm3ParserVisitor.py +428 -0
- psiqworkbench/io/qasm/qasm3_export.py +617 -0
- psiqworkbench/io/qasm/qasm3_import.py +484 -0
- psiqworkbench/io/qiskit/__init__.py +4 -0
- psiqworkbench/io/qiskit/qiskit.py +408 -0
- psiqworkbench/io/qiskit/qiskit_qpu.py +479 -0
- psiqworkbench/numpy_utils.py +13 -0
- psiqworkbench/opcode_constants.py +13 -0
- psiqworkbench/opfilter/__init__.py +1 -0
- psiqworkbench/opfilter/base_filters/__init__.py +11 -0
- psiqworkbench/opfilter/base_filters/analysis_filter.py +60 -0
- psiqworkbench/opfilter/base_filters/export_filter.py +40 -0
- psiqworkbench/opfilter/base_filters/transformation_filter.py +45 -0
- psiqworkbench/opfilter/base_filters/utility_filter.py +63 -0
- psiqworkbench/opfilter/stream.py +983 -0
- psiqworkbench/opfilter/stream_connect.py +133 -0
- psiqworkbench/opfilter/stream_jit.py +318 -0
- psiqworkbench/opfilter/stream_qpu.py +424 -0
- psiqworkbench/opfilter/stream_unitary_matrix.py +365 -0
- psiqworkbench/opfilter/stream_window.py +159 -0
- psiqworkbench/opfilter/utility_streams.py +264 -0
- psiqworkbench/ops/__init__.py +0 -0
- psiqworkbench/ops/check_ops.py +368 -0
- psiqworkbench/ops/opcode_constants.py +127 -0
- psiqworkbench/ops/qpu_ops.py +685 -0
- psiqworkbench/qpu/__init__.py +2 -0
- psiqworkbench/qpu/base_qpu.py +1868 -0
- psiqworkbench/qpu/qpu.py +1969 -0
- psiqworkbench/qpu/qpu_capture.py +48 -0
- psiqworkbench/qpu/qpu_debugging.py +522 -0
- psiqworkbench/qpu/qpu_flow_control/__init__.py +0 -0
- psiqworkbench/qpu/qpu_flow_control/async_read.py +632 -0
- psiqworkbench/qpu/qpu_flow_control/fallback_read.py +74 -0
- psiqworkbench/qpu/qpu_flow_control/jump_control.py +171 -0
- psiqworkbench/qpu/qpu_server.py +69 -0
- psiqworkbench/qubits/__init__.py +0 -0
- psiqworkbench/qubits/base_qubits.py +1323 -0
- psiqworkbench/qubits/deprecated_vector_register.py +13 -0
- psiqworkbench/qubits/qint.py +2855 -0
- psiqworkbench/qubits/qpu_alloc.py +278 -0
- psiqworkbench/qubits/qpu_tlb.py +112 -0
- psiqworkbench/qubits/qubit_logic.py +92 -0
- psiqworkbench/qubricks/__init__.py +94 -0
- psiqworkbench/qubricks/qbk_conditionally_clean_arithmetic.py +475 -0
- psiqworkbench/qubricks/qbk_conditionally_clean_arithmetic.pyi +150 -0
- psiqworkbench/qubricks/qbk_gidney_arithmetic.py +1513 -0
- psiqworkbench/qubricks/qbk_gidney_arithmetic.pyi +269 -0
- psiqworkbench/qubricks/qbk_matrix.py +144 -0
- psiqworkbench/qubricks/qbk_matrix.pyi +49 -0
- psiqworkbench/qubricks/qbk_modular_add.py +63 -0
- psiqworkbench/qubricks/qbk_modular_add.pyi +34 -0
- psiqworkbench/qubricks/qbk_qft_arithmetic.py +229 -0
- psiqworkbench/qubricks/qbk_qft_arithmetic.pyi +89 -0
- psiqworkbench/qubricks/qbk_reflect.py +53 -0
- psiqworkbench/qubricks/qbk_reflect.pyi +21 -0
- psiqworkbench/qubricks/qbk_rotation.py +729 -0
- psiqworkbench/qubricks/qbk_rotation.pyi +223 -0
- psiqworkbench/qubricks/qbk_rotation_catalyst.py +326 -0
- psiqworkbench/qubricks/qbk_rotation_catalyst.pyi +104 -0
- psiqworkbench/qubricks/qbk_simple.py +814 -0
- psiqworkbench/qubricks/qbk_simple.pyi +278 -0
- psiqworkbench/qubricks/qbk_sqrt.py +157 -0
- psiqworkbench/qubricks/qbk_sqrt.pyi +27 -0
- psiqworkbench/qubricks/qbk_usp.py +309 -0
- psiqworkbench/qubricks/qbk_usp.pyi +111 -0
- psiqworkbench/qubricks/qubrick.py +1642 -0
- psiqworkbench/resource_estimation/__init__.py +1 -0
- psiqworkbench/resource_estimation/active_volume_lookup.py +288 -0
- psiqworkbench/resource_estimation/active_volume_lookup_v2.py +304 -0
- psiqworkbench/resource_estimation/av_counting/__init__.py +0 -0
- psiqworkbench/resource_estimation/av_counting/active_volume_lookup.py +133 -0
- psiqworkbench/resource_estimation/av_counting/av_functions/__init__.py +4 -0
- psiqworkbench/resource_estimation/av_counting/av_functions/ppm_functions.py +63 -0
- psiqworkbench/resource_estimation/av_counting/av_functions/ppr_functions.py +208 -0
- psiqworkbench/resource_estimation/av_counting/av_functions/qpu_op_functions.py +71 -0
- psiqworkbench/resource_estimation/av_counting/get_av_from_op.py +634 -0
- psiqworkbench/resource_estimation/av_counting/simple_av_counter.py +37 -0
- psiqworkbench/resource_estimation/avg_qubit_estimator.py +83 -0
- psiqworkbench/resource_estimation/qre/__init__.py +72 -0
- psiqworkbench/resource_estimation/qre/_numeric_estimator.py +97 -0
- psiqworkbench/resource_estimation/qre/_resource_dict.py +166 -0
- psiqworkbench/resource_estimation/qre/_resource_estimator.py +111 -0
- psiqworkbench/resource_estimation/qre/_symbolic_estimator.py +263 -0
- psiqworkbench/resource_estimation/qre/_type_aliases.py +17 -0
- psiqworkbench/resource_estimation/reaction_limit_estimator/__init__.py +1 -0
- psiqworkbench/resource_estimation/reaction_limit_estimator/get_dag_from_qpu.py +485 -0
- psiqworkbench/resource_estimation/reaction_limit_estimator/get_reaction_limit.py +123 -0
- psiqworkbench/resource_estimation/reaction_limit_estimator/instruction_selectors.py +82 -0
- psiqworkbench/resource_estimation/reaction_limit_estimator/ordered_qpu_ops.py +54 -0
- psiqworkbench/resource_estimation/reaction_limit_estimator/visualization_tools.py +178 -0
- psiqworkbench/resource_estimation/rotation_synthesis.py +23 -0
- psiqworkbench/resource_estimation/stale_state_counting/__init__.py +12 -0
- psiqworkbench/resource_estimation/stale_state_counting/get_stale_state_count_from_op.py +299 -0
- psiqworkbench/resource_estimation/stale_state_counting/stale_state_count_lookup.py +127 -0
- psiqworkbench/resource_estimation/stale_state_counting/stale_state_functions/__init__.py +1 -0
- psiqworkbench/resource_estimation/stale_state_counting/stale_state_functions/qpu_op_functions.py +31 -0
- psiqworkbench/resource_estimation/utils.py +140 -0
- psiqworkbench/resource_estimation/witness_counter/__init__.py +4 -0
- psiqworkbench/resource_estimation/witness_counter/_default_metrics_functions.py +367 -0
- psiqworkbench/resource_estimation/witness_counter/_op.py +238 -0
- psiqworkbench/resource_estimation/witness_counter/witness_counter.py +790 -0
- psiqworkbench/resource_estimation/witness_counter/witness_metrics_functions.py +331 -0
- psiqworkbench/rotation_utils.py +13 -0
- psiqworkbench/serialization/__init__.py +56 -0
- psiqworkbench/serialization/_plugin_engine.py +341 -0
- psiqworkbench/serialization/_qref.py +969 -0
- psiqworkbench/serialization/common.py +34 -0
- psiqworkbench/serialization/native.py +698 -0
- psiqworkbench/server/__init__.py +0 -0
- psiqworkbench/server/server.js +147 -0
- psiqworkbench/server/worker.js +194 -0
- psiqworkbench/stream_unitary_matrix.py +13 -0
- psiqworkbench/symbolics/__init__.py +35 -0
- psiqworkbench/symbolics/classical_stubs.py +99 -0
- psiqworkbench/symbolics/conditions.py +146 -0
- psiqworkbench/symbolics/filter_helpers.py +469 -0
- psiqworkbench/symbolics/gate_costs.py +372 -0
- psiqworkbench/symbolics/parameter/__init__.py +18 -0
- psiqworkbench/symbolics/parameter/_functions.py +75 -0
- psiqworkbench/symbolics/parameter/parameter.py +406 -0
- psiqworkbench/symbolics/parameter/parameter_old.py +171 -0
- psiqworkbench/symbolics/qubrick_costs.py +80 -0
- psiqworkbench/symbolics/stream_symbolic.py +66 -0
- psiqworkbench/symbolics/symbolic_compilation_filters.py +26 -0
- psiqworkbench/symbolics/symbolic_qint.py +667 -0
- psiqworkbench/symbolics/symbolic_qpu.py +707 -0
- psiqworkbench/symbolics/sympy_compilation_backend.py +60 -0
- psiqworkbench/symbolics/test_helpers.py +2 -0
- psiqworkbench/test_helpers.py +448 -0
- psiqworkbench/typing.py +12 -0
- psiqworkbench/units/__init__.py +4 -0
- psiqworkbench/units/units.py +225 -0
- psiqworkbench/utils/__init__.py +0 -0
- psiqworkbench/utils/bit_utils.py +98 -0
- psiqworkbench/utils/misc_utils.py +140 -0
- psiqworkbench/utils/numpy_utils.py +258 -0
- psiqworkbench/utils/overrides.py +50 -0
- psiqworkbench/utils/pytest_utils.py +12 -0
- psiqworkbench/utils/rotation_utils.py +365 -0
- psiqworkbench/utils/unstable_api_utils.py +53 -0
- psiqworkbench/vector_register_utils.py +70 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
.. Copyright © 2026 PsiQuantum Corp. All rights reserved.
|
|
3
|
+
PSIQUANTUM CORP. CONFIDENTIAL
|
|
4
|
+
This file includes unpublished proprietary source code of PsiQuantum Corp.
|
|
5
|
+
The copyright notice above does not evidence any actual or intended publication
|
|
6
|
+
of such source code. Disclosure of this source code or any related proprietary
|
|
7
|
+
information is strictly prohibited without the express written permission of
|
|
8
|
+
PsiQuantum Corp.
|
|
9
|
+
|
|
10
|
+
Curated namespace package; exports are driven by the YAML mapping co-located with ``_curated_loader.py``.
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from psiqdk.workbench._curated_loader import apply_curated_exports
|
|
15
|
+
|
|
16
|
+
apply_curated_exports(globals())
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Generated by scripts/generate_psiqdk_workbench_stubs.py; do not edit.
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from . import filter_presets as filter_presets
|
|
5
|
+
from . import compilation as compilation
|
|
6
|
+
from . import ops as ops
|
|
7
|
+
from . import opcodes as opcodes
|
|
8
|
+
from . import utils as utils
|
|
9
|
+
from . import flow_control as flow_control
|
|
10
|
+
from . import qubrick_machinery as qubrick_machinery
|
|
11
|
+
from . import qpu as qpu
|
|
12
|
+
from . import filter_machinery as filter_machinery
|
|
13
|
+
from . import utility_filters as utility_filters
|
|
14
|
+
from . import interoperability as interoperability
|
|
15
|
+
from . import registers as registers
|
|
16
|
+
from . import units as units
|
|
17
|
+
from . import arithmetic as arithmetic
|
|
18
|
+
from . import comparators as comparators
|
|
19
|
+
from . import rotations as rotations
|
|
20
|
+
from . import qft as qft
|
|
21
|
+
from . import usp as usp
|
|
22
|
+
from . import phase_gradients as phase_gradients
|
|
23
|
+
from . import qre as qre
|
|
24
|
+
from . import qubrick_interfaces as qubrick_interfaces
|
|
25
|
+
from . import integrations as integrations
|
|
26
|
+
from . import errors as errors
|
|
27
|
+
from . import experimental as experimental
|
|
28
|
+
from . import simulators as simulators
|
|
29
|
+
from psiqworkbench import QPU as QPU
|
|
30
|
+
from psiqworkbench.qpu.base_qpu import BaseQPU as BaseQPU
|
|
31
|
+
from psiqworkbench import Qubits as Qubits
|
|
32
|
+
from psiqworkbench.qubits.base_qubits import BaseQubits as BaseQubits
|
|
33
|
+
from psiqworkbench import Qubrick as Qubrick
|
|
34
|
+
from psiqworkbench import QUInt as QUInt
|
|
35
|
+
from psiqworkbench import QInt as QInt
|
|
36
|
+
from psiqworkbench import QUFixed as QUFixed
|
|
37
|
+
from psiqworkbench import QFixed as QFixed
|
|
38
|
+
|
|
39
|
+
__all__: tuple[str, ...]
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# GENERATED BY create-psiqdk-namespace-package — do not edit by hand.
|
|
2
|
+
# Regenerate via scripts/regenerate_psiqdk_*_namespace.sh in the owning repository.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
.. Copyright © 2026 PsiQuantum Corp. All rights reserved.
|
|
6
|
+
PSIQUANTUM CORP. CONFIDENTIAL
|
|
7
|
+
This file includes unpublished proprietary source code of PsiQuantum Corp.
|
|
8
|
+
The copyright notice above does not evidence any actual or intended publication
|
|
9
|
+
of such source code. Disclosure of this source code or any related proprietary
|
|
10
|
+
information is strictly prohibited without the express written permission of
|
|
11
|
+
PsiQuantum Corp.
|
|
12
|
+
|
|
13
|
+
Loader for the curated ``psiqdk.workbench`` surface defined in ``workbench-curated-mapping.yaml``.
|
|
14
|
+
|
|
15
|
+
The mapping YAML has ``remapped`` (layout-only moves plus optional ``"*"`` root re-export list),
|
|
16
|
+
optional ``renamed``, and optional ``aliased`` (re-exports from another installed package using
|
|
17
|
+
fully-qualified ``<module>.<Symbol>`` leaf specs and the same ``"*"`` wildcard rules as ``remapped``,
|
|
18
|
+
but with fully-qualified module paths). Entries listed under ``unsupported`` are not imported here
|
|
19
|
+
(they remain on the legacy package only). Wildcard domains expand via ``_mapping_expand``.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import copy
|
|
25
|
+
import importlib
|
|
26
|
+
from functools import lru_cache
|
|
27
|
+
from pathlib import Path
|
|
28
|
+
from typing import Any
|
|
29
|
+
|
|
30
|
+
from ._mapping_expand import (
|
|
31
|
+
assert_no_deprecated_root_blocks,
|
|
32
|
+
default_legacy_src_root_next_to_mapping,
|
|
33
|
+
expand_aliased_star_wildcards,
|
|
34
|
+
expand_remapped_module_redirects,
|
|
35
|
+
expand_star_wildcards,
|
|
36
|
+
extract_remapped_star_to_root,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
_MAPPING_PATH = Path(__file__).with_name("workbench-curated-mapping.yaml")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _is_leaf(val: Any) -> bool:
|
|
43
|
+
return isinstance(val, str)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _deep_merge_export_trees(base: dict[str, Any], extra: dict[str, Any], path: str = "") -> None:
|
|
47
|
+
"""Merge ``extra`` into ``base`` (mutates ``base``). Dict + dict recurse; conflict raises."""
|
|
48
|
+
for k, v in extra.items():
|
|
49
|
+
loc = f"{path}.{k}" if path else k
|
|
50
|
+
if k not in base:
|
|
51
|
+
base[k] = copy.deepcopy(v)
|
|
52
|
+
continue
|
|
53
|
+
if isinstance(base[k], dict) and isinstance(v, dict):
|
|
54
|
+
_deep_merge_export_trees(base[k], v, loc)
|
|
55
|
+
else:
|
|
56
|
+
msg = f"Duplicate export at {loc!r} (present in more than one of remapped / renamed / aliased)"
|
|
57
|
+
raise ValueError(msg)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _merge_remapped_renamed(remapped: dict[str, Any], renamed: dict[str, Any]) -> dict[str, Any]:
|
|
61
|
+
out = copy.deepcopy(remapped)
|
|
62
|
+
_deep_merge_export_trees(out, renamed)
|
|
63
|
+
return out
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _validate_remapped_leaf_symmetry(export_key: str, spec: str, loc: str) -> None:
|
|
67
|
+
"""``remapped`` leaves are layout-only: YAML key must match the imported symbol."""
|
|
68
|
+
s = spec.strip()
|
|
69
|
+
imported = s.rsplit(".", 1)[-1] if "." in s else s
|
|
70
|
+
if imported != export_key:
|
|
71
|
+
msg = (
|
|
72
|
+
f"{loc}: export {export_key!r} must match legacy imported symbol {imported!r} from spec "
|
|
73
|
+
f"{spec!r}; put intentional renames under `renamed`."
|
|
74
|
+
)
|
|
75
|
+
raise ValueError(msg)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _walk_validate_remapped_tree(node: dict[str, Any], path: str = "remapped") -> None:
|
|
79
|
+
for k, v in node.items():
|
|
80
|
+
loc = f"{path}.{k}"
|
|
81
|
+
if isinstance(v, dict):
|
|
82
|
+
_walk_validate_remapped_tree(v, loc)
|
|
83
|
+
elif isinstance(v, str):
|
|
84
|
+
_validate_remapped_leaf_symmetry(k, v, loc)
|
|
85
|
+
else:
|
|
86
|
+
msg = f"{loc}: expected dict or str leaf, got {type(v).__name__}"
|
|
87
|
+
raise TypeError(msg)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _validate_aliased_leaf_symmetry(export_key: str, spec: str, loc: str) -> None:
|
|
91
|
+
"""``aliased`` re-exports keep the upstream symbol name as the public name."""
|
|
92
|
+
s = spec.strip()
|
|
93
|
+
if "." not in s:
|
|
94
|
+
msg = f"{loc}: aliased spec must be <fully.qualified.module>.<Symbol>, got {spec!r}"
|
|
95
|
+
raise ValueError(msg)
|
|
96
|
+
sym = s.rsplit(".", 1)[-1]
|
|
97
|
+
if sym != export_key:
|
|
98
|
+
msg = (
|
|
99
|
+
f"{loc}: export {export_key!r} must match upstream symbol {sym!r} from spec {spec!r}; "
|
|
100
|
+
"aliased entries are not for renaming."
|
|
101
|
+
)
|
|
102
|
+
raise ValueError(msg)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _walk_validate_aliased_tree(node: dict[str, Any], path: str = "aliased") -> None:
|
|
106
|
+
for k, v in node.items():
|
|
107
|
+
loc = f"{path}.{k}"
|
|
108
|
+
if isinstance(v, dict):
|
|
109
|
+
_walk_validate_aliased_tree(v, loc)
|
|
110
|
+
elif isinstance(v, str):
|
|
111
|
+
_validate_aliased_leaf_symmetry(k, v, loc)
|
|
112
|
+
else:
|
|
113
|
+
msg = f"{loc}: expected dict or str leaf, got {type(v).__name__}"
|
|
114
|
+
raise TypeError(msg)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _navigate_safe(node: dict[str, Any], segments: list[str]) -> dict[str, Any]:
|
|
118
|
+
cur: Any = node
|
|
119
|
+
for seg in segments:
|
|
120
|
+
if not isinstance(cur, dict) or seg not in cur:
|
|
121
|
+
return {}
|
|
122
|
+
cur = cur[seg]
|
|
123
|
+
return cur if isinstance(cur, dict) else {}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _ordered_subpackage_keys(nleg: dict[str, Any], nal: dict[str, Any]) -> list[str]:
|
|
127
|
+
out: list[str] = []
|
|
128
|
+
seen: set[str] = set()
|
|
129
|
+
for k, v in nleg.items():
|
|
130
|
+
if isinstance(v, dict) and k not in seen:
|
|
131
|
+
seen.add(k)
|
|
132
|
+
out.append(k)
|
|
133
|
+
for k, v in nal.items():
|
|
134
|
+
if isinstance(v, dict) and k not in seen:
|
|
135
|
+
seen.add(k)
|
|
136
|
+
out.append(k)
|
|
137
|
+
return out
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def load_workbook_mapping_at_path(mapping_path: Path) -> tuple[
|
|
141
|
+
str,
|
|
142
|
+
dict[str, Any],
|
|
143
|
+
dict[str, Any],
|
|
144
|
+
dict[str, Any],
|
|
145
|
+
dict[str, Any],
|
|
146
|
+
dict[str, Any],
|
|
147
|
+
dict[str, str],
|
|
148
|
+
dict[str, str],
|
|
149
|
+
]:
|
|
150
|
+
"""
|
|
151
|
+
Load and expand a Workbench-style curated mapping YAML (same semantics as the packaged
|
|
152
|
+
``workbench-curated-mapping.yaml``).
|
|
153
|
+
|
|
154
|
+
Used by the migration assistant and tests that need a non-default mapping path. Prefer
|
|
155
|
+
:func:`mapping_path` + cached :func:`mapping_merged_tree` for normal package resolution.
|
|
156
|
+
"""
|
|
157
|
+
import yaml
|
|
158
|
+
|
|
159
|
+
raw = yaml.safe_load(mapping_path.read_text(encoding="utf-8"))
|
|
160
|
+
assert_no_deprecated_root_blocks(raw)
|
|
161
|
+
domains_old: str = raw["domains"]["old"]
|
|
162
|
+
_src = default_legacy_src_root_next_to_mapping(mapping_path)
|
|
163
|
+
remapped_pre, wr_pre = extract_remapped_star_to_root(raw["remapped"])
|
|
164
|
+
remapped_star: dict[str, Any] = expand_star_wildcards(
|
|
165
|
+
remapped_pre, domains_old, legacy_src_root=_src
|
|
166
|
+
)
|
|
167
|
+
remapped, module_redirects = expand_remapped_module_redirects(
|
|
168
|
+
remapped_star, domains_old, legacy_src_root=_src
|
|
169
|
+
)
|
|
170
|
+
renamed: dict[str, Any] = expand_star_wildcards(
|
|
171
|
+
copy.deepcopy(raw.get("renamed") or {}), domains_old, legacy_src_root=_src
|
|
172
|
+
)
|
|
173
|
+
aliased: dict[str, Any] = expand_aliased_star_wildcards(
|
|
174
|
+
copy.deepcopy(raw.get("aliased") or {}), legacy_src_root=_src
|
|
175
|
+
)
|
|
176
|
+
_walk_validate_remapped_tree(remapped)
|
|
177
|
+
_walk_validate_aliased_tree(aliased)
|
|
178
|
+
merged_legacy = _merge_remapped_renamed(remapped, renamed)
|
|
179
|
+
merged_public = copy.deepcopy(merged_legacy)
|
|
180
|
+
_deep_merge_export_trees(merged_public, copy.deepcopy(aliased))
|
|
181
|
+
root_exports: dict[str, Any] = expand_star_wildcards(wr_pre, domains_old, legacy_src_root=_src)
|
|
182
|
+
_walk_validate_remapped_tree(root_exports, path="remapped['*'] (root exports)")
|
|
183
|
+
_bad = set(merged_public.keys()) & set(root_exports.keys())
|
|
184
|
+
if _bad:
|
|
185
|
+
msg = f"remapped['*'] root export keys conflict with remapped top-level packages: {sorted(_bad)!r}"
|
|
186
|
+
raise ValueError(msg)
|
|
187
|
+
_wr_out: dict[str, str] = {}
|
|
188
|
+
for _k, _v in root_exports.items():
|
|
189
|
+
if not isinstance(_v, str):
|
|
190
|
+
msg = (
|
|
191
|
+
f"remapped['*'] root export {_k!r} must be a string legacy spec after expansion, "
|
|
192
|
+
f"got {type(_v).__name__}"
|
|
193
|
+
)
|
|
194
|
+
raise TypeError(msg)
|
|
195
|
+
_wr_out[_k] = _v
|
|
196
|
+
return (
|
|
197
|
+
domains_old,
|
|
198
|
+
remapped,
|
|
199
|
+
renamed,
|
|
200
|
+
aliased,
|
|
201
|
+
merged_legacy,
|
|
202
|
+
merged_public,
|
|
203
|
+
_wr_out,
|
|
204
|
+
module_redirects,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@lru_cache(maxsize=1)
|
|
209
|
+
def _load_workbook_mapping() -> tuple[
|
|
210
|
+
str,
|
|
211
|
+
dict[str, Any],
|
|
212
|
+
dict[str, Any],
|
|
213
|
+
dict[str, Any],
|
|
214
|
+
dict[str, Any],
|
|
215
|
+
dict[str, Any],
|
|
216
|
+
dict[str, str],
|
|
217
|
+
dict[str, str],
|
|
218
|
+
]:
|
|
219
|
+
return load_workbook_mapping_at_path(_MAPPING_PATH)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def _resolve_legacy_leaf(domains_old: str, spec: Any, *, yaml_key: str | None = None) -> Any:
|
|
223
|
+
if not isinstance(spec, str):
|
|
224
|
+
msg = f"Invalid curated leaf spec: {spec!r}"
|
|
225
|
+
raise TypeError(msg)
|
|
226
|
+
_ctx = f" (YAML entry: {yaml_key!r}: {spec!r})" if yaml_key else f" (spec: {spec!r})"
|
|
227
|
+
if "." in spec:
|
|
228
|
+
mod_path, sym = spec.rsplit(".", 1)
|
|
229
|
+
if mod_path and sym:
|
|
230
|
+
full_mod = f"{domains_old}.{mod_path}"
|
|
231
|
+
try:
|
|
232
|
+
mod = importlib.import_module(full_mod)
|
|
233
|
+
except ImportError as exc:
|
|
234
|
+
msg = (
|
|
235
|
+
f"Cannot import legacy module {full_mod!r}{_ctx}. "
|
|
236
|
+
f"Check that the dotted path in the YAML spec is correct. "
|
|
237
|
+
f"Original error: {exc}"
|
|
238
|
+
)
|
|
239
|
+
raise ImportError(msg) from exc
|
|
240
|
+
try:
|
|
241
|
+
return getattr(mod, sym)
|
|
242
|
+
except AttributeError as exc:
|
|
243
|
+
# Fallback: ``sym`` may be a submodule the parent's ``__init__``
|
|
244
|
+
# doesn't pre-import. Try importing it directly.
|
|
245
|
+
try:
|
|
246
|
+
return importlib.import_module(f"{full_mod}.{sym}")
|
|
247
|
+
except ImportError:
|
|
248
|
+
pass
|
|
249
|
+
msg = (
|
|
250
|
+
f"Module {full_mod!r} has no attribute {sym!r}{_ctx}. "
|
|
251
|
+
f"The symbol may not be re-exported from the package __init__; "
|
|
252
|
+
f"use the full sub-module path in the spec (e.g. "
|
|
253
|
+
f"{mod_path}.submodule.{sym})."
|
|
254
|
+
)
|
|
255
|
+
raise AttributeError(msg) from exc
|
|
256
|
+
try:
|
|
257
|
+
root = importlib.import_module(domains_old)
|
|
258
|
+
return getattr(root, spec)
|
|
259
|
+
except AttributeError as exc:
|
|
260
|
+
# Fallback: ``spec`` may be a submodule of the root package.
|
|
261
|
+
try:
|
|
262
|
+
return importlib.import_module(f"{domains_old}.{spec}")
|
|
263
|
+
except ImportError:
|
|
264
|
+
pass
|
|
265
|
+
msg = (
|
|
266
|
+
f"Package {domains_old!r} has no attribute {spec!r}{_ctx}. "
|
|
267
|
+
f"Check that the symbol is exported from {domains_old}.__init__."
|
|
268
|
+
)
|
|
269
|
+
raise AttributeError(msg) from exc
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def _resolve_fq_leaf(spec: str) -> Any:
|
|
273
|
+
"""Resolve ``package.submodule.Symbol`` from an installed module."""
|
|
274
|
+
if not isinstance(spec, str):
|
|
275
|
+
msg = f"Invalid aliased leaf spec: {spec!r}"
|
|
276
|
+
raise TypeError(msg)
|
|
277
|
+
s = spec.strip()
|
|
278
|
+
if "." not in s:
|
|
279
|
+
msg = f"Invalid aliased leaf spec: {spec!r}"
|
|
280
|
+
raise ValueError(msg)
|
|
281
|
+
mod_path, sym = s.rsplit(".", 1)
|
|
282
|
+
if not mod_path or not sym:
|
|
283
|
+
msg = f"Invalid aliased leaf spec: {spec!r}"
|
|
284
|
+
raise ValueError(msg)
|
|
285
|
+
mod = importlib.import_module(mod_path)
|
|
286
|
+
try:
|
|
287
|
+
return getattr(mod, sym)
|
|
288
|
+
except AttributeError:
|
|
289
|
+
# Fallback: ``sym`` may be a submodule of ``mod_path``.
|
|
290
|
+
return importlib.import_module(f"{mod_path}.{sym}")
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def apply_curated_exports(module_globals: dict[str, Any]) -> None:
|
|
294
|
+
"""
|
|
295
|
+
Populate ``module_globals`` for ``psiqdk.workbench`` or a subpackage,
|
|
296
|
+
using the sibling YAML file as the single source of truth.
|
|
297
|
+
|
|
298
|
+
Resolution is lazy: ``__all__`` is computed up front from the mapping,
|
|
299
|
+
but the legacy modules backing each export are not imported until the
|
|
300
|
+
corresponding attribute is accessed (via PEP 562 ``__getattr__``).
|
|
301
|
+
"""
|
|
302
|
+
name: str = module_globals["__name__"]
|
|
303
|
+
domains_old, _, _, aliased_tree, merged_legacy, _, root_exports, _module_redirects = _load_workbook_mapping()
|
|
304
|
+
|
|
305
|
+
if name == "psiqdk.workbench":
|
|
306
|
+
segments: list[str] = []
|
|
307
|
+
else:
|
|
308
|
+
prefix = "psiqdk.workbench."
|
|
309
|
+
if not name.startswith(prefix):
|
|
310
|
+
msg = f"Unexpected module applying curated exports: {name}"
|
|
311
|
+
raise ValueError(msg)
|
|
312
|
+
suffix = name.removeprefix(prefix)
|
|
313
|
+
segments = suffix.split(".") if suffix else []
|
|
314
|
+
|
|
315
|
+
nleg = _navigate_safe(merged_legacy, segments)
|
|
316
|
+
nal = _navigate_safe(aliased_tree, segments)
|
|
317
|
+
|
|
318
|
+
subpackage_keys: list[str] = list(_ordered_subpackage_keys(nleg, nal))
|
|
319
|
+
leaf_specs: dict[str, str] = {k: v for k, v in nleg.items() if _is_leaf(v)}
|
|
320
|
+
aliased_specs: dict[str, str] = {k: v for k, v in nal.items() if _is_leaf(v)}
|
|
321
|
+
root_specs: dict[str, str] = (
|
|
322
|
+
dict(root_exports) if name == "psiqdk.workbench" else {}
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
exports: list[str] = (
|
|
326
|
+
list(subpackage_keys)
|
|
327
|
+
+ list(root_specs.keys())
|
|
328
|
+
+ list(leaf_specs.keys())
|
|
329
|
+
+ list(aliased_specs.keys())
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
def __getattr__(attr: str) -> Any:
|
|
333
|
+
if attr in subpackage_keys:
|
|
334
|
+
sub = importlib.import_module(f"{name}.{attr}")
|
|
335
|
+
module_globals[attr] = sub
|
|
336
|
+
return sub
|
|
337
|
+
if attr in root_specs:
|
|
338
|
+
val = _resolve_legacy_leaf(domains_old, root_specs[attr], yaml_key=attr)
|
|
339
|
+
module_globals[attr] = val
|
|
340
|
+
return val
|
|
341
|
+
if attr in leaf_specs:
|
|
342
|
+
val = _resolve_legacy_leaf(domains_old, leaf_specs[attr], yaml_key=attr)
|
|
343
|
+
module_globals[attr] = val
|
|
344
|
+
return val
|
|
345
|
+
if attr in aliased_specs:
|
|
346
|
+
val = _resolve_fq_leaf(aliased_specs[attr])
|
|
347
|
+
module_globals[attr] = val
|
|
348
|
+
return val
|
|
349
|
+
msg = f"module {name!r} has no attribute {attr!r}"
|
|
350
|
+
raise AttributeError(msg)
|
|
351
|
+
|
|
352
|
+
def __dir__() -> list[str]:
|
|
353
|
+
return sorted(set(exports) | set(module_globals.keys()))
|
|
354
|
+
|
|
355
|
+
module_globals["__all__"] = tuple(exports)
|
|
356
|
+
module_globals["__getattr__"] = __getattr__
|
|
357
|
+
module_globals["__dir__"] = __dir__
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def mapping_merged_tree() -> dict[str, Any]:
|
|
361
|
+
"""Return the merged ``remapped`` + ``renamed`` + ``aliased`` tree (installed export layout)."""
|
|
362
|
+
return copy.deepcopy(_load_workbook_mapping()[5])
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def mapping_workbench_root() -> dict[str, str]:
|
|
366
|
+
"""Return root star re-exports for ``from psiqdk.workbench import …`` (legacy specs from ``remapped['*']``)."""
|
|
367
|
+
return copy.deepcopy(_load_workbook_mapping()[6])
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def mapping_remapped_tree() -> dict[str, Any]:
|
|
371
|
+
return copy.deepcopy(_load_workbook_mapping()[1])
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def mapping_renamed_tree() -> dict[str, Any]:
|
|
375
|
+
return copy.deepcopy(_load_workbook_mapping()[2])
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
def mapping_aliased_tree() -> dict[str, Any]:
|
|
379
|
+
"""Return the ``aliased`` subtree (dependency re-exports; values are ``<module>.<Symbol>``)."""
|
|
380
|
+
return copy.deepcopy(_load_workbook_mapping()[3])
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
def curated_public_tree() -> dict[str, Any]:
|
|
384
|
+
"""Backward-compatible alias for :func:`mapping_merged_tree`."""
|
|
385
|
+
return mapping_merged_tree()
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
def mapping_path() -> Path:
|
|
389
|
+
return _MAPPING_PATH
|