import Sequence et al from collections.abc not typing

This commit is contained in:
Jan Petykiewicz 2024-07-28 19:33:16 -07:00
parent b1d78b9acb
commit 6ec94fb3c3
28 changed files with 45 additions and 28 deletions

View File

@ -1,4 +1,4 @@
from typing import Sequence from collections.abc import Sequence
import numpy import numpy
from numpy import pi from numpy import pi

View File

@ -1,4 +1,4 @@
from typing import Sequence, Mapping from collections.abc import Sequence, Mapping
import numpy import numpy
from numpy import pi from numpy import pi

View File

@ -1,4 +1,5 @@
from typing import Sequence, Callable, Any from typing import Any
from collections.abc import Sequence, Callable
from pprint import pformat from pprint import pformat
import numpy import numpy

View File

@ -1,7 +1,7 @@
""" """
Manual wire routing tutorial: Pather and BasicTool Manual wire routing tutorial: Pather and BasicTool
""" """
from typing import Callable from collections.abc import Callable
from numpy import pi from numpy import pi
from masque import Pather, RenderPather, Library, Pattern, Port, layer_t, map_layers from masque import Pather, RenderPather, Library, Pattern, Port, layer_t, map_layers
from masque.builder.tools import BasicTool, PathTool from masque.builder.tools import BasicTool, PathTool

View File

@ -2,7 +2,7 @@
Routines for creating normalized 2D lattices and common photonic crystal Routines for creating normalized 2D lattices and common photonic crystal
cavity designs. cavity designs.
""" """
from typing import Sequence from collection.abc import Sequence
import numpy import numpy
from numpy.typing import ArrayLike, NDArray from numpy.typing import ArrayLike, NDArray

View File

@ -1,7 +1,7 @@
""" """
Manual wire routing tutorial: RenderPather an PathTool Manual wire routing tutorial: RenderPather an PathTool
""" """
from typing import Callable from collections.abc import Callable
from masque import RenderPather, Library, Pattern, Port, layer_t, map_layers from masque import RenderPather, Library, Pattern, Port, layer_t, map_layers
from masque.builder.tools import PathTool from masque.builder.tools import PathTool
from masque.file.gdsii import writefile from masque.file.gdsii import writefile

View File

@ -1,7 +1,8 @@
""" """
Simplified Pattern assembly (`Builder`) Simplified Pattern assembly (`Builder`)
""" """
from typing import Self, Sequence, Mapping from typing import Self
from collections.abc import Sequence, Mapping
import copy import copy
import logging import logging
from functools import wraps from functools import wraps

View File

@ -1,7 +1,8 @@
""" """
Manual wire/waveguide routing (`Pather`) Manual wire/waveguide routing (`Pather`)
""" """
from typing import Self, Sequence, MutableMapping, Mapping from typing import Self
from collections.abc import Sequence, MutableMapping, Mapping
import copy import copy
import logging import logging
from pprint import pformat from pprint import pformat

View File

@ -1,7 +1,8 @@
""" """
Pather with batched (multi-step) rendering Pather with batched (multi-step) rendering
""" """
from typing import Self, Sequence, Mapping, MutableMapping from typing import Self
from collections.abc import Sequence, Mapping, MutableMapping
import copy import copy
import logging import logging
from collections import defaultdict from collections import defaultdict

View File

@ -3,7 +3,8 @@ Tools are objects which dynamically generate simple single-use devices (e.g. wir
# TODO document all tools # TODO document all tools
""" """
from typing import Sequence, Literal, Callable, Any from typing import Literal, Any
from collections.abc import Sequence, Callable
from abc import ABCMeta # , abstractmethod # TODO any way to make Tool ok with implementing only one method? from abc import ABCMeta # , abstractmethod # TODO any way to make Tool ok with implementing only one method?
from dataclasses import dataclass from dataclasses import dataclass

View File

@ -1,4 +1,5 @@
from typing import Mapping, Sequence, SupportsFloat, cast, TYPE_CHECKING from typing import SupportsFloat, cast, TYPE_CHECKING
from collections.abc import Mapping, Sequence
from pprint import pformat from pprint import pformat
import numpy import numpy

View File

@ -6,7 +6,8 @@ Notes:
* ezdxf sets creation time, write time, $VERSIONGUID, and $FINGERPRINTGUID * ezdxf sets creation time, write time, $VERSIONGUID, and $FINGERPRINTGUID
to unique values, so byte-for-byte reproducibility is not achievable for now to unique values, so byte-for-byte reproducibility is not achievable for now
""" """
from typing import Any, Callable, Mapping, cast, TextIO, IO from typing import Any, cast, TextIO, IO
from collections.abc import Mapping, Callable
import io import io
import logging import logging
import pathlib import pathlib

View File

@ -19,7 +19,8 @@ Notes:
* GDS creation/modification/access times are set to 1900-01-01 for reproducibility. * GDS creation/modification/access times are set to 1900-01-01 for reproducibility.
* Gzip modification time is set to 0 (start of current epoch, usually 1970-01-01) * Gzip modification time is set to 0 (start of current epoch, usually 1970-01-01)
""" """
from typing import Callable, Iterable, Mapping, IO, cast, Any from typing import IO, cast, Any
from collections.abc import Iterable, Mapping, Callable
import io import io
import mmap import mmap
import logging import logging

View File

@ -14,7 +14,8 @@ Note that OASIS references follow the same convention as `masque`,
Notes: Notes:
* Gzip modification time is set to 0 (start of current epoch, usually 1970-01-01) * Gzip modification time is set to 0 (start of current epoch, usually 1970-01-01)
""" """
from typing import Any, Callable, Iterable, IO, Mapping, cast, Sequence from typing import Any, IO, cast
from collections.abc import Sequence, Iterable, Mapping, Callable
import logging import logging
import pathlib import pathlib
import gzip import gzip

View File

@ -1,7 +1,7 @@
""" """
SVG file format readers and writers SVG file format readers and writers
""" """
from typing import Mapping from collections.abc import Mapping
import warnings import warnings
import numpy import numpy

View File

@ -1,7 +1,8 @@
""" """
Helper functions for file reading and writing Helper functions for file reading and writing
""" """
from typing import IO, Iterator, Mapping from typing import IO
from collections.abc import Iterator, Mapping
import re import re
import pathlib import pathlib
import logging import logging

View File

@ -15,7 +15,7 @@ Classes include:
library. Generated with `ILibraryView.abstract_view()`. library. Generated with `ILibraryView.abstract_view()`.
""" """
from typing import Callable, Self, Type, TYPE_CHECKING, cast, TypeAlias, Protocol, Literal from typing import Callable, Self, Type, TYPE_CHECKING, cast, TypeAlias, Protocol, Literal
from typing import Iterator, Mapping, MutableMapping, Sequence from collections.abc import Iterator, Mapping, MutableMapping, Sequence, Callable
import logging import logging
import base64 import base64
import struct import struct

View File

@ -2,7 +2,8 @@
Object representing a one multi-layer lithographic layout. Object representing a one multi-layer lithographic layout.
A single level of hierarchical references is included. A single level of hierarchical references is included.
""" """
from typing import Callable, Sequence, cast, Mapping, Self, Any, Iterable, TypeVar, MutableMapping from typing import cast, Self, Any, TypeVar
from collections.abc import Sequence, Mapping, MutableMapping, Iterable, Callable
import copy import copy
import logging import logging
import functools import functools

View File

@ -1,4 +1,5 @@
from typing import Iterable, KeysView, ValuesView, overload, Self, Mapping, NoReturn, Any from typing import overload, Self, NoReturn, Any
from collections.abc import Iterable, KeysView, ValuesView, Mapping
import warnings import warnings
import traceback import traceback
import logging import logging

View File

@ -2,7 +2,8 @@
Ref provides basic support for nesting Pattern objects within each other. Ref provides basic support for nesting Pattern objects within each other.
It carries offset, rotation, mirroring, and scaling data for each individual instance. It carries offset, rotation, mirroring, and scaling data for each individual instance.
""" """
from typing import Mapping, TYPE_CHECKING, Self, Any from typing import TYPE_CHECKING, Self, Any
from collections.abc import Mapping
import copy import copy
import functools import functools

View File

@ -1,4 +1,5 @@
from typing import Sequence, Any, cast from typing import Any, cast
from collections.abc import Sequence
import copy import copy
import functools import functools
from enum import Enum from enum import Enum

View File

@ -1,4 +1,5 @@
from typing import Sequence, Any, cast from typing import Any, cast
from collections.abc import Sequence
import copy import copy
import functools import functools

View File

@ -1,4 +1,5 @@
from typing import Callable, TYPE_CHECKING, Any from typing import TYPE_CHECKING, Any
from collections.abc import Callable
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
import numpy import numpy

View File

@ -1,4 +1,4 @@
from typing import Callable from collections.abc import Callable
from functools import wraps from functools import wraps
from ..error import OneShotError from ..error import OneShotError

View File

@ -1,4 +1,5 @@
from typing import Callable, TypeVar, Generic from typing import TypeVar, Generic
from collections.abc import Callable
from functools import lru_cache from functools import lru_cache

View File

@ -1,7 +1,7 @@
""" """
2D bin-packing 2D bin-packing
""" """
from typing import Sequence, Callable, Mapping from collections.abc import Sequence, Mapping, Callable
import numpy import numpy
from numpy.typing import NDArray, ArrayLike from numpy.typing import NDArray, ArrayLike

View File

@ -6,7 +6,7 @@ and retrieving it (`data_to_ports`).
the port locations. This particular approach is just a sensible default; feel free to the port locations. This particular approach is just a sensible default; feel free to
to write equivalent functions for your own format or alternate storage methods. to write equivalent functions for your own format or alternate storage methods.
""" """
from typing import Sequence, Mapping from collections.abc import Sequence, Mapping
import logging import logging
from itertools import chain from itertools import chain

View File

@ -1,7 +1,7 @@
""" """
Geometric transforms Geometric transforms
""" """
from typing import Sequence from collections.abc import Sequence
from functools import lru_cache from functools import lru_cache
import numpy import numpy