Flip default value for mypy disallow_untyped_defs [3/11] (#127840)

See #127836 for details.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127840
Approved by: https://github.com/oulgen
This commit is contained in:
Aaron Orenstein
2024-06-08 11:24:41 -07:00
committed by PyTorch MergeBot
parent ea614fb2b1
commit afe15d2d2f
128 changed files with 128 additions and 0 deletions

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import os
from abc import abstractmethod

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import itertools
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import collections
import typing
from dataclasses import fields

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
try:
import triton
import triton.language as tl

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import builtins
import copy
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import builtins
import contextlib
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import itertools
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Utilities for lowering subgraphs used by higher order operators
"""

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import os

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch.library
from torch import Tensor
from torch.autograd import Function

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import collections

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
This file provides a number of "global" variables/handlers that are actually
thread local and dynamically scoped, with Inductor patching them to various

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import dataclasses
import tempfile
from collections import defaultdict

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
The weak_script annotation needs to be here instead of inside torch/jit/ so it
can be used in other places in torch/ (namely torch.nn) without running into

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import threading
import torch._C._lazy

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import os
import threading
from queue import Empty as EmptyQueue, Queue

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch._C._lazy
import torch._C._lazy_ts_backend

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch._C._lazy

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch._C._lazy

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import threading
from typing import Any, Dict

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import dataclasses
import itertools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch._C._lazy

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch._C._lazy

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch._C._lazy_ts_backend

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import functools
from typing import Callable, Optional

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import dataclasses
from typing import Any, Callable, Optional, Protocol

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import inspect
import weakref
from typing import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import logging
from typing import Any, Dict, Optional, Protocol, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import inspect
import typing

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .abstract_impl import AbstractImplHolder
__all__ = ["SimpleLibraryRegistry", "SimpleOperatorEntry", "singleton"]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import dataclasses
import inspect
import sys

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Various linear algebra utility methods for internal use.
"""

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Locally Optimal Block Preconditioned Conjugate Gradient methods.
"""
# Author: Pearu Peterson

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import hashlib
import itertools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
from enum import Enum
from typing import List, Optional, Sequence, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import OrderedDict
"""

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import ctypes
import importlib

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import itertools
import operator

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from contextlib import nullcontext
from typing import Any, Callable, Dict, Optional, Sequence

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
from typing import Optional

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Callable, Optional
from torch._prims.context import TorchRefsMode

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Optional, Tuple
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import operator

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import inspect
import warnings
from functools import wraps

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import re
import torch._C as C

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import builtins
import collections
import inspect

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch._prims_common as utils

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from functools import partial
from typing import List, Optional, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
from functools import wraps
from typing import Callable, Optional, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
from typing import Optional, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Adds docstrings to torch.Size functions"""
import torch._C

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import ast
import functools
import inspect

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Adds docstrings to Storage functions"""
import torch._C

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from abc import ABC, abstractmethod

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch._strobelight.cli_function_profiler import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch._strobelight.compile_time_profiler import StrobelightCompileTimeProfiler

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import functools
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import warnings
from abc import ABC, abstractmethod

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import contextlib

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copyreg
import enum
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Adds docstrings to Tensor functions"""
import torch._C

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import dataclasses
import math

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Adds docstrings to functions defined in the torch._C module."""
import re

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copyreg
import functools
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import logging
import os

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from typing import Any, Callable, List, Optional, Tuple, Union
from typing_extensions import deprecated

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Unpickler restricted to loading only state dicts
# Restrict constructing types to a list defined in _get_allowed_globals()
# Restrict BUILD operation to `Tensor`, `Parameter` and `OrderedDict` types only

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import collections
import functools
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import inspect

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# torch.ao is a package with a lot of interdependencies.
# We will use lazy import to avoid cyclic dependencies here.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# We are exposing all subpackages to the end-user.
# Because of possible inter-dependency, we want to avoid
# the cyclic imports, thus implementing lazy version

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .modules import * # noqa: F403
from .modules.fused import _FusedModule # noqa: F403

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.nn import Conv1d, Conv2d, Conv3d, ReLU, Linear, BatchNorm1d, BatchNorm2d, BatchNorm3d
from torch.nn.utils.parametrize import type_before_parametrizations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
import torch
import torch.nn as nn

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn as nn
import torch.ao.nn.intrinsic as nni

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.qat as nnqat
import torch.ao.nn.intrinsic as nni

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.quantized.dynamic as nnqd
import torch.ao.nn.intrinsic as nni

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.intrinsic

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.intrinsic
import torch.ao.nn.intrinsic.qat

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.intrinsic

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.quantized as nnq
import torch.ao.nn.intrinsic as nni

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
__all__ = ["Linear"]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn as nn
from torch.nn.modules.utils import _single, _pair, _triple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch import Tensor
import torch.nn as nn

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn as nn
import torch.nn.functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.jit # this is needed to avoid a circular import
from torch import nn

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import numbers
from typing import Optional, Tuple
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""Dynamically quantized convolution modules."""
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.quantized as nnq
from torch.ao.nn.quantized.modules.utils import _quantize_weight

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import numbers
import warnings
from typing_extensions import deprecated

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r""" Functional interface (quantized)."""
from typing import List, Optional
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
# The quantized modules use `torch.nn` and `torch.ao.nn.quantizable`

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from warnings import warn
__all__ = [

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.ao.nn.intrinsic as nni

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""Quantized convolution modules."""
from typing import Optional, List, TypeVar

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
__all__ = ['Dropout']

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn as nn
from torch import Tensor # noqa: F401

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List
import torch

Some files were not shown because too many files have changed in this diff Show More