Skip to content

Commit 7e5f4ee

Browse files
committed
Revert "feat(downloads): add conditional dependency on literal for python 3.7"
This reverts commit efd8b48.
1 parent 4b31b51 commit 7e5f4ee

File tree

9 files changed

+48
-60
lines changed

9 files changed

+48
-60
lines changed

gitlab/mixins.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18-
import sys
1918
from types import ModuleType
2019
from typing import (
2120
Any,
2221
Callable,
2322
Dict,
2423
Iterator,
2524
List,
25+
Literal,
2626
Optional,
2727
Tuple,
2828
Type,
@@ -38,11 +38,6 @@
3838
from gitlab import types as g_types
3939
from gitlab import utils
4040

41-
if sys.version_info >= (3, 8):
42-
from typing import Literal
43-
else:
44-
from typing_extensions import Literal
45-
4641
__all__ = [
4742
"GetMixin",
4843
"GetWithoutIdMixin",

gitlab/utils.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,13 @@
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
import pathlib
19-
import sys
2019
import traceback
2120
import urllib.parse
2221
import warnings
23-
from typing import Any, Callable, Dict, Iterator, Optional, Type, Union
22+
from typing import Any, Callable, Dict, Iterator, Literal, Optional, Type, Union
2423

2524
import requests
2625

27-
if sys.version_info >= (3, 8):
28-
from typing import Literal
29-
else:
30-
from typing_extensions import Literal
31-
3226

3327
class _StdoutStream:
3428
def __call__(self, chunk: Any) -> None:

gitlab/v4/objects/artifacts.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
GitLab API:
33
https://docs.gitlab.com/ee/api/job_artifacts.html
44
"""
5-
import sys
6-
from typing import Any, Callable, Iterator, Optional, TYPE_CHECKING, Union
5+
from typing import Any, Callable, Iterator, Literal, Optional, TYPE_CHECKING, Union
76

87
import requests
98

@@ -12,11 +11,6 @@
1211
from gitlab import utils
1312
from gitlab.base import RESTManager, RESTObject
1413

15-
if sys.version_info >= (3, 8):
16-
from typing import Literal
17-
else:
18-
from typing_extensions import Literal
19-
2014
__all__ = ["ProjectArtifact", "ProjectArtifactManager"]
2115

2216

gitlab/v4/objects/files.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import base64
2-
import sys
32
from typing import (
43
Any,
54
Callable,
65
cast,
76
Dict,
87
Iterator,
98
List,
9+
Literal,
1010
Optional,
1111
TYPE_CHECKING,
1212
Union,
@@ -27,11 +27,6 @@
2727
UpdateMixin,
2828
)
2929

30-
if sys.version_info >= (3, 8):
31-
from typing import Literal
32-
else:
33-
from typing_extensions import Literal
34-
3530
__all__ = [
3631
"ProjectFile",
3732
"ProjectFileManager",

gitlab/v4/objects/jobs.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import sys
2-
from typing import Any, Callable, cast, Dict, Iterator, Optional, TYPE_CHECKING, Union
1+
from typing import (
2+
Any,
3+
Callable,
4+
cast,
5+
Dict,
6+
Iterator,
7+
Literal,
8+
Optional,
9+
TYPE_CHECKING,
10+
Union,
11+
)
312

413
import requests
514

@@ -9,11 +18,6 @@
918
from gitlab.base import RESTManager, RESTObject
1019
from gitlab.mixins import RefreshMixin, RetrieveMixin
1120

12-
if sys.version_info >= (3, 8):
13-
from typing import Literal
14-
else:
15-
from typing_extensions import Literal
16-
1721
__all__ = [
1822
"ProjectJob",
1923
"ProjectJobManager",

gitlab/v4/objects/packages.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44
https://docs.gitlab.com/ee/user/packages/generic_packages/
55
"""
66

7-
import sys
87
from pathlib import Path
9-
from typing import Any, Callable, cast, Iterator, Optional, TYPE_CHECKING, Union
8+
from typing import (
9+
Any,
10+
Callable,
11+
cast,
12+
Iterator,
13+
Literal,
14+
Optional,
15+
TYPE_CHECKING,
16+
Union,
17+
)
1018

1119
import requests
1220

@@ -16,11 +24,6 @@
1624
from gitlab.base import RESTManager, RESTObject
1725
from gitlab.mixins import DeleteMixin, GetMixin, ListMixin, ObjectDeleteMixin
1826

19-
if sys.version_info >= (3, 8):
20-
from typing import Literal
21-
else:
22-
from typing_extensions import Literal
23-
2427
__all__ = [
2528
"GenericPackage",
2629
"GenericPackageManager",

gitlab/v4/objects/projects.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import sys
21
from typing import (
32
Any,
43
Callable,
54
cast,
65
Dict,
76
Iterator,
87
List,
8+
Literal,
99
Optional,
1010
TYPE_CHECKING,
1111
Union,
@@ -82,11 +82,6 @@
8282
from .variables import ProjectVariableManager # noqa: F401
8383
from .wikis import ProjectWikiManager # noqa: F401
8484

85-
if sys.version_info >= (3, 8):
86-
from typing import Literal
87-
else:
88-
from typing_extensions import Literal
89-
9085
__all__ = [
9186
"GroupProject",
9287
"GroupProjectManager",

gitlab/v4/objects/repositories.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
44
Currently this module only contains repository-related methods for projects.
55
"""
6-
import sys
7-
from typing import Any, Callable, Dict, Iterator, List, Optional, TYPE_CHECKING, Union
6+
from typing import (
7+
Any,
8+
Callable,
9+
Dict,
10+
Iterator,
11+
List,
12+
Literal,
13+
Optional,
14+
TYPE_CHECKING,
15+
Union,
16+
)
817

918
import requests
1019

@@ -13,11 +22,6 @@
1322
from gitlab import exceptions as exc
1423
from gitlab import utils
1524

16-
if sys.version_info >= (3, 8):
17-
from typing import Literal
18-
else:
19-
from typing_extensions import Literal
20-
2125
if TYPE_CHECKING:
2226
# When running mypy we use these as the base classes
2327
_RestObjectBase = gitlab.base.RESTObject

gitlab/v4/objects/snippets.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import sys
2-
from typing import Any, Callable, cast, Iterator, List, Optional, TYPE_CHECKING, Union
1+
from typing import (
2+
Any,
3+
Callable,
4+
cast,
5+
Iterator,
6+
List,
7+
Literal,
8+
Optional,
9+
TYPE_CHECKING,
10+
Union,
11+
)
312

413
import requests
514

@@ -13,11 +22,6 @@
1322
from .discussions import ProjectSnippetDiscussionManager # noqa: F401
1423
from .notes import ProjectSnippetNoteManager # noqa: F401
1524

16-
if sys.version_info >= (3, 8):
17-
from typing import Literal
18-
else:
19-
from typing_extensions import Literal
20-
2125
__all__ = [
2226
"Snippet",
2327
"SnippetManager",

0 commit comments

Comments
 (0)