Flip default value for mypy disallow_untyped_defs [7/11] (#127844)

See #127836 for details.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127844
Approved by: https://github.com/oulgen
ghstack dependencies: #127842, #127843
This commit is contained in:
Aaron Orenstein
2024-06-08 11:41:14 -07:00
committed by PyTorch MergeBot
parent 7c12cc7ce4
commit 038b927590
128 changed files with 128 additions and 0 deletions

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import dataclasses
from enum import auto, Enum
from typing import Collection, Dict, List, Mapping, Optional, Set, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import abc
import copy
import operator

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import (
List, Tuple, Optional, Union, Any, Sequence, TYPE_CHECKING
)

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
from typing import cast, Callable, Generic, List, Optional, Type, TypeVar, Union

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from contextlib import contextmanager
from torch.fx import GraphModule

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import namedtuple
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type

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
from typing import Dict, Optional
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx.proxy import Proxy
from ._compatibility import compatibility

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Optional, Type
__all__ = ["SymDispatchMode", "handle_sym_dispatch", "sym_function_mode"]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import operator
from collections import deque
from typing import Dict, List, Set, NamedTuple, Tuple, Deque

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import re
from typing import Callable, Dict, Optional, Set, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch.fx as fx
def set_trace(gm: fx.GraphModule) -> fx.GraphModule:

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from functools import reduce
import torch
import operator

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.fx.node import Node

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx.experimental.migrate_gradual_types.operation import op_add, op_sub, op_mul, op_div, \
op_mod, op_gt, op_lt, op_neq, op_eq
from torch.fx.tensor_type import TensorType, Dyn

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import operator
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx.experimental.migrate_gradual_types.constraint import Conj, Disj, T, F, BinConstraintT, BVar, is_bool_expr
from torch.fx.experimental.migrate_gradual_types.constraint import BinConstraintD, TVar, DVar
from torch.fx.experimental.migrate_gradual_types.constraint import Prod, is_algebraic_expression, is_dim

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx.experimental.migrate_gradual_types.constraint import TVar, DVar, BinConstraintD, \
BVar
from torch.fx.experimental.migrate_gradual_types.operation import op_leq

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch.fx as fx
from torch.fx.node import Argument, Target
from torch.nn.utils.fusion import fuse_conv_bn_eval

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from enum import Enum
from typing import NamedTuple, Dict, List, Set

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
class Equality:
def __init__(self, lhs, rhs):
self.lhs = lhs

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
This file does three things:
- Contains the definition of SymNode

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections.abc import Iterator # type: ignore[import]
from functools import partial

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .core import unify, reify # type: ignore[attr-defined]
from .variable import isvar
from .utils import _toposort, freeze

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .core import unify, reify # type: ignore[attr-defined]
from .dispatch import dispatch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .utils import _toposort, groupby
from .variadic import isvariadic
import operator

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import OrderedDict
__all__ = ["raises", "expand_tuples", "reverse_dict", "groupby", "typename"]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .utils import typename
__all__ = ["VariadicSignatureType", "isvariadic", "VariadicSignatureMeta", "Variadic"]

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
__all__ = ["hashable", "transitive_get", "raises", "reverse_dict", "xfail", "freeze"]
def hashable(x):
try:

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from contextlib import contextmanager
from .utils import hashable
from .dispatch import dispatch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx.experimental.graph_gradual_typechecker import Refine
from torch.fx.tensor_type import TensorType
from torch.fx.experimental.unification import Var, unify # type: ignore[attr-defined]

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import defaultdict
from .node import Node, Argument, Target, map_arg, _type_repr, _get_qualified_name
import torch.utils._pytree as pytree

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, Dict, Iterable, List, Tuple
from torch.utils._pytree import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .graph_module import GraphModule
from ._lazy_graph_module import _make_graph_module
from .graph import Graph

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.fx.passes.infra.partitioner import CapabilityBasedPartitioner
from torch.fx.passes.operator_support import OperatorSupport

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx.passes.utils.fuser_utils import fuse_by_partitions
import collections
import itertools

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import inspect
import logging
from queue import Queue

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import abc
import typing as t

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.fx import Node
from torch.fx._compatibility import compatibility

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import inspect
from typing import Any, Callable, Dict, List, Optional, Set
from collections import OrderedDict

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple, Type, Union

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Tuple, Union, Dict, Any, Set, Mapping, Optional
import collections
from dataclasses import dataclass

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Dict, Tuple
from torch.fx._compatibility import compatibility

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
from queue import SimpleQueue
from typing import List, Dict, Tuple

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass, field
from torch.fx.graph import Graph
from torch.fx.node import Node

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx.experimental.unification import Var # type: ignore[attr-defined]
from ._compatibility import compatibility

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import traceback
from contextlib import contextmanager
from typing import List, Any, Dict

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Async API.
This module contains the API for parallelism in TorchScript, notably:

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch._jit_internal import _Await
from torch.jit._builtins import _register_builtin

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import cmath
import math
import warnings

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Functions for synthesizing magic methods for JIT-compiled dataclasses
import ast
import dataclasses

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch._ops import OpOverload, OpOverloadPacket

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Freezing.
This is not intended to be imported directly; please use the exposed

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
Tools to help with tensor property propagation.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# These functions are referenced from the pickle archives produced by
# ScriptModule.save()

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# mypy: disable-error-code="type-arg"
from typing import (
Any,

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Serialization.
This module contains functionality for serializing TorchScript modules, notably:

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""JIT-related state.
This module stores various pieces of Python-global state relating to the JIT.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Tracing.
This module contains functionality to support the JIT's tracing frontend, notably:

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import ast
import builtins
import dis

View File

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

View File

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

View File

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

View File

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

View File

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

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