Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9f12c8c

Browse files
muggenhorByron
authored andcommitted
fix(types): get the os.PathLike type as correctly as possible
This should make our internal PathLike type compatible with Python <3.6 and < 3.9.
1 parent0767cc5 commit9f12c8c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎git/types.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
importos# @UnusedImport ## not really unused, is in type string
1+
# -*- coding: utf-8 -*-
2+
# This module is part of GitPython and is released under
3+
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
4+
5+
importos
6+
importsys
27
fromtypingimportUnion,Any
38

49

510
TBD=Any
6-
PathLike=Union[str,'os.PathLike[str]']
11+
12+
ifsys.version_info[:2]< (3,6):
13+
# os.PathLike (PEP-519) only got introduced with Python 3.6
14+
PathLike=str
15+
elifsys.version_info[:2]< (3,9):
16+
# Python >= 3.6, < 3.9
17+
PathLike=Union[str,os.PathLike]
18+
elifsys.version_info[:2]>= (3,9):
19+
# os.PathLike only becomes subscriptable from Python 3.9 onwards
20+
PathLike=Union[str,os.PathLike[str]]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp