Flip default value for mypy disallow_untyped_defs [6/11] (#127843)

See #127836 for details.

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

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
This file includes private common utilities for FSDP.
"""

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import itertools
import warnings
from enum import auto, Enum

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 collections
import itertools
import os

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import logging
from enum import auto, Enum

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from contextlib import contextmanager
from dataclasses import dataclass, field

View File

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

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
import logging
from collections import abc, defaultdict
from typing import Any, Dict, Iterable, List, Optional, overload, Sequence, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the BSD license found in the

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""
Module ``torch.distributed.launch``.

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

@ -1,4 +1,5 @@
#!/usr/bin/python3
# mypy: allow-untyped-defs
import collections
import io
import sys

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.distributed as dist
from torch.autograd import Function

View File

@ -1,4 +1,5 @@
#!/usr/bin/python3
# mypy: allow-untyped-defs
import importlib
import logging
import os

View File

@ -1,4 +1,5 @@
#!/usr/bin/python3
# mypy: allow-untyped-defs
def get_remote_module_template(enable_moving_cpu_tensors_to_cuda: bool):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import enum
from typing import Any, Callable, Dict, List, Optional, overload, Set, Type

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import copy
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from typing import List, Optional

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from typing import Dict

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import logging
from dataclasses import dataclass

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import logging
from typing import Any, Dict, List, Optional, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import logging
import operator

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
try:
from urllib.parse import urlparse, urlunparse
except ImportError as e:

View File

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

View File

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

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
import torch.distributed as dist
import torch.distributed.rpc as rpc

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
__all__ = ["shutdown", "get_worker_info", "remote", "rpc_sync",
"rpc_async", "RRef", "AllGatherStates", "method_factory", "new_method"]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
__all__ = ["init_backend", "backend_registered", "construct_rpc_backend_options", "register_backend", "BackendType", "BackendValue"]
import collections

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import collections
import copyreg
import io

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from functools import partial
from . import functions

View File

@ -1,4 +1,5 @@
#!/usr/bin/python3
# mypy: allow-untyped-defs
import itertools

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, List, Tuple
import torch.nn as nn

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
from typing import Any, cast, List, Optional, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import contextlib
from typing import cast, Dict, Optional, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from abc import ABC, abstractmethod
from typing import Optional, Union, Tuple, Dict

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.distributions import constraints
from torch.distributions.distribution import Distribution

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch import nan
from torch.distributions import constraints

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
from numbers import Number

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.distributions import constraints
from torch.distributions.gamma import Gamma

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""
PyTorch provides two global :class:`ConstraintRegistry` objects that link
:class:`~torch.distributions.constraints.Constraint` objects to

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""
The following constraints are implemented:

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
from numbers import Number

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.distributions.distribution import Distribution

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
from numbers import Number

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.distributions import constraints
from torch.distributions.gamma import Gamma

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch import nan
from torch.distributions import constraints

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
This closely follows the implementation in NumPyro (https://github.com/pyro-ppl/numpyro).

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.distributions import constraints
from torch.distributions.normal import Normal
from torch.distributions.transformed_distribution import TransformedDistribution

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.distributions import constraints
from torch.distributions.normal import Normal
from torch.distributions.transformed_distribution import TransformedDistribution

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch import inf
from torch.distributions import Categorical, constraints

View File

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

View File

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

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