Skip to content

Remove the broken and unused get_deprecated_arg_names #14415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/pytorch_lightning/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed the deprecated `DistributedType` and `DeviceType` enum classes ([#14045](https://github.com/Lightning-AI/lightning/pull/14045))


- Remove the deprecated `on_train_batch_end(outputs)` format when multiple optimizers are used and TBPTT is enabled ([#14373](https://github.com/PyTorchLightning/pytorch-lightning/pull/14373))
- Removed the legacy and unused `Trainer.get_deprecated_arg_names()` ([#14415](https://github.com/Lightning-AI/lightning/pull/14415))


- Remove the deprecated `training_epoch_end(outputs)` format when multiple optimizers are used and TBPTT is enabled ([#14373](https://github.com/PyTorchLightning/pytorch-lightning/pull/14373))
- Removed the deprecated `on_train_batch_end(outputs)` format when multiple optimizers are used and TBPTT is enabled ([#14373](https://github.com/PyTorchLightning/pytorch-lightning/pull/14373))


- Removed the deprecated `training_epoch_end(outputs)` format when multiple optimizers are used and TBPTT is enabled ([#14373](https://github.com/PyTorchLightning/pytorch-lightning/pull/14373))


- Removed the experimental `pytorch_lightning.utiltiies.meta` functions in favor of built-in https://github.com/pytorch/torchdistx support ([#13868](https://github.com/Lightning-AI/lightning/pull/13868))
Expand Down
9 changes: 0 additions & 9 deletions src/pytorch_lightning/core/datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ def get_init_arguments_and_types(cls) -> List[Tuple[str, Tuple, Any]]:
"""
return get_init_arguments_and_types(cls)

@classmethod
def get_deprecated_arg_names(cls) -> List:
"""Returns a list with deprecated DataModule arguments."""
depr_arg_names: List[str] = []
for name, val in cls.__dict__.items():
if name.startswith("DEPRECATED") and isinstance(val, (tuple, list)):
depr_arg_names.extend(val)
return depr_arg_names

@classmethod
def from_datasets(
cls,
Expand Down
9 changes: 0 additions & 9 deletions src/pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2434,15 +2434,6 @@ def default_attributes(cls) -> dict:
init_signature = inspect.signature(cls)
return {k: v.default for k, v in init_signature.parameters.items()}

@classmethod
def get_deprecated_arg_names(cls) -> List:
"""Returns a list with deprecated Trainer arguments."""
depr_arg_names = []
for name, val in cls.__dict__.items():
if name.startswith("DEPRECATED") and isinstance(val, (tuple, list)):
depr_arg_names.extend(val)
return depr_arg_names

@classmethod
def from_argparse_args(cls: Any, args: Union[Namespace, ArgumentParser], **kwargs) -> Any:
return from_argparse_args(cls, args, **kwargs)
Expand Down
2 changes: 0 additions & 2 deletions src/pytorch_lightning/utilities/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ def add_argparse_args(
parser = ArgumentParser(parents=[parent_parser], add_help=False)

ignore_arg_names = ["self", "args", "kwargs"]
if hasattr(cls, "get_deprecated_arg_names"):
ignore_arg_names += cls.get_deprecated_arg_names()

allowed_types = (str, int, float, bool)

Expand Down
6 changes: 1 addition & 5 deletions tests/tests_pytorch/utilities/test_argparse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import io
from argparse import ArgumentParser, Namespace
from typing import Generic, List, TypeVar
from typing import Generic, TypeVar
from unittest.mock import MagicMock

import pytest
Expand Down Expand Up @@ -118,10 +118,6 @@ class AddArgparseArgsExampleClass:
def __init__(self, my_parameter: int = 0):
pass

@staticmethod
def get_deprecated_arg_names() -> List[str]:
return []


class AddArgparseArgsExampleClassViaInit:
def __init__(self, my_parameter: int = 0):
Expand Down