Skip to content

Commit dcfa770

Browse files
aorenstepytorchmergebot
authored andcommitted
Flip default value for mypy disallow_untyped_defs [1/11] (pytorch#127838)
See pytorch#127836 for details. Pull Request resolved: pytorch#127838 Approved by: https://github.com/oulgen
1 parent 2369c71 commit dcfa770

File tree

128 files changed

+128
-0
lines changed

Some content is hidden

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

128 files changed

+128
-0
lines changed

caffe2/perfkernels/hp_emblookup_codegen.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12

23

34
import argparse

test/test_bundled_images.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# Owner(s): ["oncall: mobile"]
3+
# mypy: allow-untyped-defs
34

45
import io
56

test/test_bundled_inputs.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# Owner(s): ["oncall: mobile"]
3+
# mypy: allow-untyped-defs
34

45
import io
56
import textwrap

test/test_complex.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# Owner(s): ["module: complex"]
23

34
import torch

test/test_futures.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# Owner(s): ["module: unknown"]
23

34
import threading

test/test_torch.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# Owner(s): ["module: tests"]
23

34
import torch

test/test_type_hints.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# Owner(s): ["module: typing"]
23

34
import doctest

test/test_type_info.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# Owner(s): ["module: typing"]
23

34
from torch.testing._internal.common_utils import (

test/test_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# Owner(s): ["module: unknown"]
23

34
import os

torch/_C/_VariableFunctions.pyi.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ${generated_comment}
22
# mypy: disable-error-code="type-arg"
3+
# mypy: allow-untyped-defs
34

45
import builtins
56
from typing import (

torch/_C/__init__.pyi.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ${generated_comment}
22
# mypy: disable-error-code="type-arg"
3+
# mypy: allow-untyped-defs
34

45
import builtins
56
from enum import Enum, IntEnum

torch/_C/_autograd.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
from enum import Enum
23
from typing import Any, Callable, List, Optional, Set
34

torch/_C/_distributed_autograd.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
from typing import Any, Dict, List, Set
23

34
import torch

torch/_C/_distributed_c10d.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# mypy: disable-error-code="type-arg"
23
from datetime import timedelta
34
from enum import Enum

torch/_C/_distributed_rpc.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# mypy: disable-error-code="type-arg"
23
from datetime import timedelta
34
from typing import Any, Dict, Generic, List, Optional, overload, Tuple, Type, TypeVar

torch/_C/_dynamo/eval_frame.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import types
23
from typing import List, NewType, Optional
34

torch/_C/_dynamo/guards.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
from typing import Any, Dict, List, Optional, Union
23

34
import torch

torch/_C/_functorch.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
from enum import Enum
23
from typing import Optional, Tuple
34

torch/_C/_lazy.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
from typing import List
23

34
from torch import Tensor

torch/_C/_lazy_ts_backend.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# defined in torch/csrc/lazy/python/init.cpp
23

34
from typing import Any, List, Tuple

torch/_C/_nvtx.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# Defined in torch/csrc/cuda/shared/nvtx.cpp
23
def rangePushA(message: str) -> int: ...
34
def rangePop() -> int: ...

torch/_C_flatbuffer/__init__.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
from torch._C import LiteScriptModule, ScriptModule
23

34
def _load_mobile_module_from_file(filename: str): ...

torch/__config__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import torch
23

34

torch/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12

23
r"""
34
The torch package contains data structures for multi-dimensional

torch/_classes.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import types
23

34
import torch._C

torch/_compile.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
"""
23
APIs related to torch.compile which lazily import torch._dynamo to avoid
34
circular dependencies.

torch/_custom_op/autograd.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import torch
23
import torch.utils._pytree as pytree
34
from collections import namedtuple

torch/_custom_op/functional.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import weakref
23

34
import torch

torch/_custom_op/impl.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import dataclasses
23
import functools
34
import inspect

torch/_custom_ops.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import inspect
23

34
from torch._custom_op.impl import (

torch/_decomp/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import inspect
23
from collections import defaultdict
34
from functools import wraps

torch/_decomp/decompositions.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import functools
23
import numbers
34
import operator

torch/_decomp/decompositions_for_jvp.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import inspect
23
from typing import Callable, Dict, List, Optional, Tuple
34

torch/_decomp/decompositions_for_rng.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import functools
23
from collections import defaultdict
34
from typing import Callable, Dict

torch/_deploy.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import io
23

34
import torch

torch/_dispatch/python.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import itertools
23
import unittest.mock
34
from contextlib import contextmanager

torch/_dynamo/_trace_wrapped_higher_order_op.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import torch
23
from torch._C import DispatchKey
34
from torch._higher_order_ops.utils import autograd_not_implemented

torch/_dynamo/bytecode_analysis.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import bisect
23
import dataclasses
34
import dis

torch/_dynamo/bytecode_transformation.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import copy
23
import dataclasses
34
import dis

torch/_dynamo/cache_size.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import logging
23
import types
34
import weakref

torch/_dynamo/callback.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
class CompilationCallbackHandler:
23
def __init__(self):
34
self.start_callbacks = []

torch/_dynamo/code_context.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import types
23

34
from .utils import ExactWeakKeyDictionary

torch/_dynamo/codegen.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import collections
23
import dataclasses
34
import re

torch/_dynamo/compiled_autograd.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import contextlib
23
import functools
34
from typing import Dict, List, Optional, TYPE_CHECKING

torch/_dynamo/comptime.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# This file establishes the public comptime interface to Dynamo.
23
# This allows Dynamo users to execute arbitrary Python code while
34
# Dynamo is symbolically evaluating their original programs.

torch/_dynamo/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import getpass
23
import inspect
34
import os

torch/_dynamo/convert_frame.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import collections
23
import cProfile
34
import dis

torch/_dynamo/create_parameter_op.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import torch
23

34
doc = """

torch/_dynamo/current_scope_id.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import contextlib
23
import threading
34

torch/_dynamo/debug_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# mypy: disable-error-code="method-assign"
23

34
import copy

torch/_dynamo/decorators.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# ruff: noqa: TCH004
23
from dataclasses import dataclass
34
from typing import TYPE_CHECKING

torch/_dynamo/device_interface.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import inspect
23
from typing import Any, Callable, Dict, Iterable, Optional, Tuple, Type, Union
34

torch/_dynamo/eval_frame.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# mypy: disable-error-code="method-assign"
23

34
"""

torch/_dynamo/exc.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import os
23
import textwrap
34
from enum import auto, Enum

torch/_dynamo/external_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# This module contains functions that *will be allowed* by dynamo
23

34
import functools

torch/_dynamo/guards.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
from __future__ import annotations
23

34
import ast

torch/_dynamo/logging.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import itertools
23
import logging
34

torch/_dynamo/mutation_guard.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
# mypy: disable-error-code="method-assign"
23

34
import functools

torch/_dynamo/output_graph.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import collections
23
import contextlib
34
import copy

torch/_dynamo/profiler.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import dataclasses
23
import os
34
from typing import Any, List

torch/_dynamo/replay_record.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import dataclasses
23
from dataclasses import field
34
from types import CodeType, ModuleType

torch/_dynamo/repro/after_aot.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import argparse
23
import copy
34
import functools

torch/_dynamo/repro/after_dynamo.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import argparse
23
import copy
34
import functools

torch/_dynamo/resume_execution.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import copy
23
import dataclasses
34
import sys

torch/_dynamo/side_effects.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import inspect
23
import warnings
34
from typing import Any, Dict, List, Optional, Union

torch/_dynamo/source.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import collections
23
import dataclasses
34
import enum

torch/_dynamo/symbolic_convert.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import collections
23
import collections.abc
34
import contextlib

torch/_dynamo/tensor_version_op.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import torch
23
from torch._prims import _make_prim, RETURN_TYPE
34
from torch._subclasses import FakeTensorMode

torch/_dynamo/test_case.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import contextlib
23
import importlib
34
import logging

torch/_dynamo/test_minifier_common.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import dataclasses
23
import io
34
import logging

torch/_dynamo/testing.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import contextlib
23
import dis
34
import functools

torch/_dynamo/trace_rules.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import _collections_abc
23
import _weakrefset
34
import abc

torch/_dynamo/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import atexit
23
import collections
34
import contextlib

torch/_dynamo/variables/script_object.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import functools
23
from typing import Dict
34

torch/_dynamo/variables/torch.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import functools
23
import inspect
34
import logging

torch/_export/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import copy
23
import dataclasses
34
import functools

torch/_export/converter.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import operator
23

34
from typing import Any, Dict, List, Optional, Set, Tuple, Union

torch/_export/db/case.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: allow-untyped-defs
12
import inspect
23
import re
34
import string

0 commit comments

Comments
 (0)