Skip to content

Commit 0be6506

Browse files
malfetpytorchmergebot
authored andcommitted
[BE] Use Literal from typing (pytorch#98846)
Since PyTorch is Python-3.8+ compatible framework Pull Request resolved: pytorch#98846 Approved by: https://github.com/janeyx99, https://github.com/ZainRizvi, https://github.com/Neilblaze
1 parent 6ff32b5 commit 0be6506

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

torchgen/dest/register_dispatch_key.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import itertools
22
import textwrap
33
from dataclasses import dataclass
4-
from typing import List, Optional, Tuple, Union
5-
6-
from typing_extensions import Literal # Python 3.8+
4+
from typing import List, Literal, Optional, Tuple, Union
75

86
import torchgen.api.cpp as cpp
97
import torchgen.api.meta as meta

torchgen/gen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Callable,
1111
Dict,
1212
List,
13+
Literal,
1314
Optional,
1415
Sequence,
1516
Set,
@@ -19,7 +20,6 @@
1920
)
2021

2122
import yaml
22-
from typing_extensions import Literal # Python 3.8+
2323

2424
import torchgen.api.dispatcher as dispatcher
2525
import torchgen.api.meta as meta

torchgen/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Iterable,
1717
Iterator,
1818
List,
19+
Literal,
1920
NoReturn,
2021
Optional,
2122
Sequence,
@@ -25,8 +26,6 @@
2526
Union,
2627
)
2728

28-
from typing_extensions import Literal # Python 3.8+
29-
3029
from torchgen.code_template import CodeTemplate
3130

3231
# Safely load fast C Yaml loader/dumper if they are available

0 commit comments

Comments
 (0)