Skip to content

Commit f202e84

Browse files
authored
Remove the legacy get_deprecated_arg_names (#14415)
1 parent 2b7cd58 commit f202e84

File tree

5 files changed

+6
-27
lines changed

5 files changed

+6
-27
lines changed

src/pytorch_lightning/CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
8686
- Removed the deprecated `DistributedType` and `DeviceType` enum classes ([#14045](https://github.com/Lightning-AI/lightning/pull/14045))
8787

8888

89-
- 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))
89+
- Removed the legacy and unused `Trainer.get_deprecated_arg_names()` ([#14415](https://github.com/Lightning-AI/lightning/pull/14415))
9090

9191

92-
- 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))
92+
- 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))
93+
94+
95+
- 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))
9396

9497

9598
- 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))

src/pytorch_lightning/core/datamodule.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,6 @@ def get_init_arguments_and_types(cls) -> List[Tuple[str, Tuple, Any]]:
113113
"""
114114
return get_init_arguments_and_types(cls)
115115

116-
@classmethod
117-
def get_deprecated_arg_names(cls) -> List:
118-
"""Returns a list with deprecated DataModule arguments."""
119-
depr_arg_names: List[str] = []
120-
for name, val in cls.__dict__.items():
121-
if name.startswith("DEPRECATED") and isinstance(val, (tuple, list)):
122-
depr_arg_names.extend(val)
123-
return depr_arg_names
124-
125116
@classmethod
126117
def from_datasets(
127118
cls,

src/pytorch_lightning/trainer/trainer.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,15 +2404,6 @@ def default_attributes(cls) -> dict:
24042404
init_signature = inspect.signature(cls)
24052405
return {k: v.default for k, v in init_signature.parameters.items()}
24062406

2407-
@classmethod
2408-
def get_deprecated_arg_names(cls) -> List:
2409-
"""Returns a list with deprecated Trainer arguments."""
2410-
depr_arg_names = []
2411-
for name, val in cls.__dict__.items():
2412-
if name.startswith("DEPRECATED") and isinstance(val, (tuple, list)):
2413-
depr_arg_names.extend(val)
2414-
return depr_arg_names
2415-
24162407
@classmethod
24172408
def from_argparse_args(cls: Any, args: Union[Namespace, ArgumentParser], **kwargs) -> Any:
24182409
return from_argparse_args(cls, args, **kwargs)

src/pytorch_lightning/utilities/argparse.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ def add_argparse_args(
212212
parser = ArgumentParser(parents=[parent_parser], add_help=False)
213213

214214
ignore_arg_names = ["self", "args", "kwargs"]
215-
if hasattr(cls, "get_deprecated_arg_names"):
216-
ignore_arg_names += cls.get_deprecated_arg_names()
217215

218216
allowed_types = (str, int, float, bool)
219217

tests/tests_pytorch/utilities/test_argparse.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import io
22
from argparse import ArgumentParser, Namespace
3-
from typing import Generic, List, TypeVar
3+
from typing import Generic, TypeVar
44
from unittest.mock import MagicMock
55

66
import pytest
@@ -118,10 +118,6 @@ class AddArgparseArgsExampleClass:
118118
def __init__(self, my_parameter: int = 0):
119119
pass
120120

121-
@staticmethod
122-
def get_deprecated_arg_names() -> List[str]:
123-
return []
124-
125121

126122
class AddArgparseArgsExampleClassViaInit:
127123
def __init__(self, my_parameter: int = 0):

0 commit comments

Comments
 (0)