diff --git a/src/sisl/geom/nanotube.py b/src/sisl/geom/nanotube.py index 94a03b944e..3d501dbc4f 100644 --- a/src/sisl/geom/nanotube.py +++ b/src/sisl/geom/nanotube.py @@ -1,6 +1,8 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. +from typing import Tuple + import numpy as np from sisl import Atom, Geometry, Lattice @@ -14,7 +16,7 @@ @set_module("sisl.geom") def nanotube(bond: float, atoms=None, - chirality: tuple[int, int]=(1, 1)): + chirality: Tuple[int, int]=(1, 1)): """ Nanotube with user-defined chirality. This routine is implemented as in `ASE`_ with some cosmetic changes. diff --git a/src/sisl/geom/surfaces.py b/src/sisl/geom/surfaces.py index 27e7e7c900..fbebcc7474 100644 --- a/src/sisl/geom/surfaces.py +++ b/src/sisl/geom/surfaces.py @@ -4,7 +4,7 @@ from collections import namedtuple from itertools import groupby from numbers import Integral -from typing import Sequence, Union +from typing import Sequence, Tuple, Union import numpy as np @@ -277,7 +277,7 @@ def iter_func(key, layer): @set_module("sisl.geom") def fcc_slab(alat: float, atoms, - miller: Union[int, str, tuple[int, int, int]], + miller: Union[int, str, Tuple[int, int, int]], layers=None, vacuum: Union[float, Sequence[float]]=20., *, @@ -471,7 +471,7 @@ def fcc_slab(alat: float, @set_module("sisl.geom") def bcc_slab(alat: float, atoms, - miller: Union[int, str, tuple[int, int, int]], + miller: Union[int, str, Tuple[int, int, int]], layers=None, vacuum: Union[float, Sequence[float]]=20., *, @@ -625,7 +625,7 @@ def bcc_slab(alat: float, @set_module("sisl.geom") def rocksalt_slab(alat: float, atoms, - miller: Union[int, str, tuple[int, int, int]], + miller: Union[int, str, Tuple[int, int, int]], layers=None, vacuum: Union[float, Sequence[float]]=20., *, diff --git a/src/sisl/geometry.py b/src/sisl/geometry.py index 489aa9e3d0..96c634fdf3 100644 --- a/src/sisl/geometry.py +++ b/src/sisl/geometry.py @@ -12,7 +12,7 @@ from math import acos from numbers import Integral, Real from pathlib import Path -from typing import TYPE_CHECKING, Iterator, List, Optional, Union +from typing import TYPE_CHECKING, Iterator, List, Optional, Tuple, Union import numpy as np from numpy import ( @@ -933,7 +933,7 @@ def iR(self, def iter_block_rand(self, iR: int=20, R: Optional[float]=None, - atoms: Optional[AtomsArgument]=None) -> Iterator[tuple[ndarray, ndarray]]: + atoms: Optional[AtomsArgument]=None) -> Iterator[Tuple[ndarray, ndarray]]: """Perform the *random* block-iteration by randomly selecting the next center of block """ # We implement yields as we can then do nested iterators @@ -1010,7 +1010,7 @@ def iter_block_rand(self, def iter_block_shape(self, shape=None, iR: int=20, - atoms: Optional[AtomsArgument]=None) -> Iterator[tuple[ndarray, ndarray]]: + atoms: Optional[AtomsArgument]=None) -> Iterator[Tuple[ndarray, ndarray]]: """Perform the *grid* block-iteration by looping a grid """ # We implement yields as we can then do nested iterators @@ -1137,7 +1137,7 @@ def iter_block(self, iR: int=20, R: Optional[float]=None, atoms: Optional[AtomsArgument]=None, - method: str='rand') -> Iterator[tuple[ndarray, ndarray]]: + method: str='rand') -> Iterator[Tuple[ndarray, ndarray]]: """Iterator for performance critical loops NOTE: This requires that `R` has been set correctly as the maximum interaction range. @@ -1209,7 +1209,7 @@ def overlap(self, other: GeometryLikeType, eps: float=0.1, offset=(0., 0., 0.), - offset_other=(0., 0., 0.)) -> tuple[ndarray, ndarray]: + offset_other=(0., 0., 0.)) -> Tuple[ndarray, ndarray]: """ Calculate the overlapping indices between two geometries Find equivalent atoms (in the primary unit-cell only) in two geometries. @@ -1264,7 +1264,7 @@ def overlap(self, other_extend(idx) return _a.arrayi(idx_self), _a.arrayi(idx_other) - def sort(self, **kwargs) -> Union[Geometry, tuple[Geometry, List]]: + def sort(self, **kwargs) -> Union[Geometry, Tuple[Geometry, List]]: r""" Sort atoms in a nested fashion according to various criteria There are many ways to sort a `Geometry`. @@ -4031,7 +4031,7 @@ def isc_tile(isc, n): def a2transpose(self, atoms1: AtomsArgument, - atoms2: Optional[AtomsArgument]=None) -> tuple[ndarray, ndarray]: + atoms2: Optional[AtomsArgument]=None) -> Tuple[ndarray, ndarray]: """Transposes connections from `atoms1` to `atoms2` such that supercell connections are transposed When handling supercell indices it is useful to get the *transposed* connection. I.e. if you have @@ -4095,7 +4095,7 @@ def a2transpose(self, def o2transpose(self, orb1: OrbitalsArgument, - orb2: Optional[OrbitalsArgument]=None) -> tuple[ndarray, ndarray]: + orb2: Optional[OrbitalsArgument]=None) -> Tuple[ndarray, ndarray]: """ Transposes connections from `orb1` to `orb2` such that supercell connections are transposed When handling supercell indices it is useful to get the *transposed* connection. I.e. if you have @@ -4639,7 +4639,7 @@ def within_inf(self, lattice: Lattice, periodic=None, tol: float=1e-5, - origin=None) -> tuple[ndarray, ndarray, ndarray]: + origin=None) -> Tuple[ndarray, ndarray, ndarray]: """ Find all atoms within a provided supercell Note this function is rather different from `close` and `within`.