Skip to content

Commit 250f129

Browse files
authored
Sort import statements - no change in the effective code (#7195)
Executed check/format-incremental --all --apply Related to #4863
1 parent fa18b82 commit 250f129

File tree

634 files changed

+1400
-1365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

634 files changed

+1400
-1365
lines changed

benchmarks/circuit_construction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import itertools
15-
from typing import Tuple, Set, Sequence
15+
from typing import Sequence, Set, Tuple
1616

1717
import cirq
1818

benchmarks/parameter_resolution.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
# limitations under the License.
1414

1515
import random
16+
1617
import numpy as np
1718
import sympy
19+
1820
import cirq
1921

2022

benchmarks/randomized_benchmarking.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import List, Sequence
1615
import functools
16+
from typing import List, Sequence
17+
1718
import numpy as np
19+
1820
import cirq
19-
from cirq.experiments.qubit_characterizations import _single_qubit_cliffords, _find_inv_matrix
21+
from cirq.experiments.qubit_characterizations import _find_inv_matrix, _single_qubit_cliffords
2022

2123

2224
def dot(args: Sequence[np.ndarray]) -> np.ndarray:

cirq-aqt/cirq_aqt/aqt_sampler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@
2525
import json
2626
import time
2727
import uuid
28-
from typing import Callable, cast, Dict, List, Sequence, Tuple, Union, Literal, TypedDict
28+
from typing import Callable, cast, Dict, List, Literal, Sequence, Tuple, TypedDict, Union
2929
from urllib.parse import urljoin
3030

3131
import numpy as np
32-
from requests import post, get
32+
from requests import get, post
3333

3434
import cirq
3535
from cirq_aqt.aqt_device import AQTSimulator, get_op_string, OperationString
3636

37-
3837
_DEFAULT_HOST = "https://arnica.aqt.eu/api/v1/"
3938

4039

cirq-aqt/cirq_aqt/aqt_sampler_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from unittest import mock
1615
import json
16+
from unittest import mock
17+
1718
import numpy as np
1819
import pytest
1920
import sympy

cirq-aqt/cirq_aqt/aqt_simulator_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
import pytest
1616

1717
import cirq
18-
1918
from cirq_aqt import AQTSimulator
20-
from cirq_aqt.aqt_device import get_aqt_device
21-
from cirq_aqt.aqt_device import AQTNoiseModel
19+
from cirq_aqt.aqt_device import AQTNoiseModel, get_aqt_device
2220

2321

2422
def test_simulator_no_circ():

cirq-aqt/cirq_aqt/aqt_target_gateset_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import cirq
2121
from cirq_aqt import aqt_target_gateset
2222

23-
2423
Q, Q2, Q3, Q4 = cirq.LineQubit.range(4)
2524

2625

cirq-aqt/cirq_aqt/json_test_data/spec.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
import pathlib
1616

1717
import cirq_aqt
18-
from cirq_aqt.json_resolver_cache import _class_resolver_dictionary
19-
2018
from cirq.testing.json import ModuleJsonTestSpec
19+
from cirq_aqt.json_resolver_cache import _class_resolver_dictionary
2120

2221
TestSpec = ModuleJsonTestSpec(
2322
name="cirq_aqt",

cirq-core/cirq/_compat_test.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import traceback
2323
import types
2424
import warnings
25+
from importlib.machinery import ModuleSpec
2526
from types import ModuleType
2627
from typing import Any, Callable, Dict, Optional, Tuple
27-
from importlib.machinery import ModuleSpec
2828
from unittest import mock
2929

3030
import duet
@@ -38,16 +38,16 @@
3838
from cirq._compat import (
3939
block_overlapping_deprecation,
4040
cached_method,
41-
proper_repr,
4241
dataclass_repr,
43-
deprecated,
44-
deprecated_parameter,
45-
proper_eq,
4642
deprecate_attributes,
43+
deprecated,
4744
deprecated_class,
45+
deprecated_parameter,
4846
deprecated_submodule,
49-
DeprecatedModuleLoader,
5047
DeprecatedModuleImportError,
48+
DeprecatedModuleLoader,
49+
proper_eq,
50+
proper_repr,
5151
)
5252

5353

@@ -564,9 +564,10 @@ def _import_deprecated_same_name_in_earlier_subtree():
564564

565565

566566
def _import_top_level_deprecated():
567-
from cirq.testing._compat_test_data.fake_freezegun import api # type: ignore
568567
import time
569568

569+
from cirq.testing._compat_test_data.fake_freezegun import api # type: ignore
570+
570571
assert api.real_time == time.time
571572

572573

@@ -873,11 +874,12 @@ def test_new_module_is_top_level():
873874
def _test_new_module_is_top_level_inner():
874875
# sets up the DeprecationFinders
875876
# pylint: disable=unused-import
876-
import cirq.testing._compat_test_data
877+
import time
877878

878879
# imports a top level module that was also deprecated
879880
from freezegun import api
880-
import time
881+
882+
import cirq.testing._compat_test_data
881883

882884
assert api.real_time == time.time
883885

cirq-core/cirq/_import.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Any, Callable, cast, List, Optional
16-
from types import ModuleType
17-
from importlib.machinery import ModuleSpec
18-
from importlib.abc import Loader
19-
20-
from contextlib import contextmanager
2115
import importlib
22-
from importlib import abc
2316
import sys
17+
from contextlib import contextmanager
18+
from importlib import abc
19+
from importlib.abc import Loader
20+
from importlib.machinery import ModuleSpec
21+
from types import ModuleType
22+
from typing import Any, Callable, cast, List, Optional
2423

2524

2625
class InstrumentedFinder(abc.MetaPathFinder):

cirq-core/cirq/circuits/_block_diagram_drawer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Dict, List, Optional, Tuple
16-
1715
import collections
16+
from typing import Dict, List, Optional, Tuple
1817

1918
from cirq.circuits._box_drawing_character_data import box_draw_character, BoxDrawCharacterSet
2019

cirq-core/cirq/circuits/_block_diagram_drawer_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import cirq
2020
from cirq.circuits._block_diagram_drawer import BlockDiagramDrawer
2121
from cirq.circuits._box_drawing_character_data import (
22-
NORMAL_BOX_CHARS,
23-
BOLD_BOX_CHARS,
24-
DOUBLED_BOX_CHARS,
2522
ASCII_BOX_CHARS,
23+
BOLD_BOX_CHARS,
2624
BoxDrawCharacterSet,
25+
DOUBLED_BOX_CHARS,
26+
NORMAL_BOX_CHARS,
2727
)
2828

2929

cirq-core/cirq/circuits/_box_drawing_character_data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from typing import List, NamedTuple, Optional
1818

19-
2019
_BoxDrawCharacterSet = NamedTuple(
2120
'_BoxDrawCharacterSet',
2221
[

cirq-core/cirq/circuits/_box_drawing_character_data_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
# limitations under the License.
1414

1515
from cirq.circuits._box_drawing_character_data import (
16+
BOLD_BOX_CHARS,
1617
box_draw_character,
18+
DOUBLED_BOX_CHARS,
1719
NORMAL_BOX_CHARS,
1820
NORMAL_THEN_BOLD_MIXED_BOX_CHARS,
19-
BOLD_BOX_CHARS,
20-
DOUBLED_BOX_CHARS,
2121
)
2222

2323

cirq-core/cirq/circuits/_bucket_priority_queue.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
from typing import Any, Generic, Iterable, Iterator, List, Optional, Set, Tuple, TypeVar
1616

17-
1817
TItem = TypeVar('TItem')
1918

2019

cirq-core/cirq/circuits/_bucket_priority_queue_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
import pytest
1616

17-
from cirq.circuits._bucket_priority_queue import BucketPriorityQueue
1817
import cirq
18+
from cirq.circuits._bucket_priority_queue import BucketPriorityQueue
1919

2020

2121
def test_init():

cirq-core/cirq/circuits/circuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
TypeVar,
4949
Union,
5050
)
51-
from typing_extensions import Self
5251

5352
import networkx
5453
import numpy as np
54+
from typing_extensions import Self
5555

5656
import cirq._version
5757
from cirq import _compat, devices, ops, protocols, qis

cirq-core/cirq/circuits/circuit_operation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import numpy as np
4040
import sympy
4141

42-
from cirq import circuits, ops, protocols, value, study
42+
from cirq import circuits, ops, protocols, study, value
4343
from cirq._compat import proper_repr
4444

4545
if TYPE_CHECKING:

cirq-core/cirq/circuits/circuit_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515
import os
1616
import time
1717
from collections import defaultdict
18-
from random import randint, random, sample, randrange
18+
from random import randint, random, randrange, sample
1919
from typing import Iterator, Optional, Tuple, TYPE_CHECKING
2020

2121
import numpy as np
2222
import pytest
2323
import sympy
2424

2525
import cirq
26-
from cirq import circuits
27-
from cirq import ops
26+
from cirq import circuits, ops
2827
from cirq.testing.devices import ValidatingTestDevice
2928

3029

cirq-core/cirq/circuits/frozen_circuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
import numpy as np
3030

31-
from cirq import protocols, _compat
31+
from cirq import _compat, protocols
3232
from cirq.circuits import AbstractCircuit, Alignment, Circuit
3333
from cirq.circuits.insert_strategy import InsertStrategy
3434

cirq-core/cirq/circuits/moment.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,20 @@
2828
Iterator,
2929
List,
3030
Mapping,
31-
overload,
3231
Optional,
32+
overload,
3333
Sequence,
3434
Tuple,
3535
TYPE_CHECKING,
3636
Union,
3737
)
3838

39-
from typing_extensions import Self
40-
4139
import numpy as np
40+
from typing_extensions import Self
4241

43-
from cirq import protocols, ops, qis, _compat
42+
from cirq import _compat, ops, protocols, qis
4443
from cirq._import import LazyLoader
45-
from cirq.ops import raw_types, op_tree
44+
from cirq.ops import op_tree, raw_types
4645
from cirq.protocols import circuit_diagram_info_protocol
4746

4847
if TYPE_CHECKING:

cirq-core/cirq/circuits/optimization_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""Defines the OptimizationPass type."""
1616
import abc
1717
from collections import defaultdict
18-
from typing import Dict, Callable, Iterable, Optional, Sequence, TYPE_CHECKING, Tuple, cast
18+
from typing import Callable, cast, Dict, Iterable, Optional, Sequence, Tuple, TYPE_CHECKING
1919

2020
from cirq import ops
2121

cirq-core/cirq/circuits/optimization_pass_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from typing import Optional, TYPE_CHECKING, Set, List
14+
from typing import List, Optional, Set, TYPE_CHECKING
1515

1616
import pytest
17+
1718
import cirq
18-
from cirq import PointOptimizer, PointOptimizationSummary, Operation
19+
from cirq import Operation, PointOptimizationSummary, PointOptimizer
1920
from cirq.testing import EqualsTester
2021

2122
if TYPE_CHECKING:

cirq-core/cirq/circuits/qasm_output.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
"""Utility classes for representing QASM."""
1616

17-
from typing import Callable, Dict, Iterator, Optional, Sequence, Tuple, Union, TYPE_CHECKING
18-
1917
import re
18+
from typing import Callable, Dict, Iterator, Optional, Sequence, Tuple, TYPE_CHECKING, Union
19+
2020
import numpy as np
2121

22-
from cirq import ops, linalg, protocols, value
22+
from cirq import linalg, ops, protocols, value
2323

2424
if TYPE_CHECKING:
2525
import cirq

cirq-core/cirq/circuits/qasm_output_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
import re
1514
import os
15+
import re
16+
1617
import numpy as np
1718
import pytest
1819

cirq-core/cirq/circuits/text_diagram_drawer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
from cirq import value
3333
from cirq.circuits._block_diagram_drawer import BlockDiagramDrawer
3434
from cirq.circuits._box_drawing_character_data import (
35-
BoxDrawCharacterSet,
36-
NORMAL_BOX_CHARS,
37-
BOLD_BOX_CHARS,
3835
ASCII_BOX_CHARS,
36+
BOLD_BOX_CHARS,
37+
BoxDrawCharacterSet,
3938
DOUBLED_BOX_CHARS,
39+
NORMAL_BOX_CHARS,
4040
)
4141

4242
if TYPE_CHECKING:

0 commit comments

Comments
 (0)