|
51 | 51 | from dohq_artifactory.admin import User |
52 | 52 | from dohq_artifactory.auth import XJFrogArtApiAuth |
53 | 53 | from dohq_artifactory.auth import XJFrogArtBearerAuth |
54 | | -from dohq_artifactory.compat import * # noqa: this helper only contains version flags |
| 54 | +from dohq_artifactory.compat import IS_PYTHON_2 |
| 55 | +from dohq_artifactory.compat import IS_PYTHON_3_10_OR_NEWER |
| 56 | +from dohq_artifactory.compat import IS_PYTHON_3_12_OR_NEWER |
55 | 57 | from dohq_artifactory.exception import ArtifactoryException |
56 | 58 | from dohq_artifactory.exception import raise_for_status |
57 | 59 | from dohq_artifactory.logger import logger |
|
73 | 75 | default_config_path = "~/.artifactory_python.cfg" |
74 | 76 | global_config = None |
75 | 77 |
|
76 | | -# Pathlib.Path changed significantly in 3.12, so we will not need several |
77 | | -# parts of the code once python3.11 is no longer supported. This constant helps |
78 | | -# identifying those. |
79 | | -_IS_PYTHON_3_12_OR_NEWER = sys.version_info >= (3, 12) |
80 | | - |
81 | 78 |
|
82 | 79 | def read_config(config_path=default_config_path): |
83 | 80 | """ |
@@ -429,7 +426,7 @@ def quote_url(url): |
429 | 426 | return quoted_url |
430 | 427 |
|
431 | 428 |
|
432 | | -class _ArtifactoryFlavour(object if _IS_PYTHON_3_12_OR_NEWER else pathlib._Flavour): |
| 429 | +class _ArtifactoryFlavour(object if IS_PYTHON_3_12_OR_NEWER else pathlib._Flavour): |
433 | 430 | """ |
434 | 431 | Implements Artifactory-specific pure path manipulations. |
435 | 432 | I.e. what is 'drive', 'root' and 'path' and how to split full path into |
@@ -1554,7 +1551,7 @@ def __new__(cls, *args, **kwargs): |
1554 | 1551 | """ |
1555 | 1552 |
|
1556 | 1553 | obj = pathlib.Path.__new__(cls, *args, **kwargs) |
1557 | | - if _IS_PYTHON_3_12_OR_NEWER: |
| 1554 | + if IS_PYTHON_3_12_OR_NEWER: |
1558 | 1555 | # After python 3.12, all this logic can be moved to __init__ |
1559 | 1556 | return obj |
1560 | 1557 |
|
@@ -1611,7 +1608,7 @@ def _init(self, *args, **kwargs): |
1611 | 1608 | def __init__(self, *args, **kwargs): |
1612 | 1609 | # Up until python3.12, pathlib.Path was not designed to be initialized |
1613 | 1610 | # through __init__, so all that logic is in the __new__ method. |
1614 | | - if not _IS_PYTHON_3_12_OR_NEWER: |
| 1611 | + if not IS_PYTHON_3_12_OR_NEWER: |
1615 | 1612 | return |
1616 | 1613 |
|
1617 | 1614 | super().__init__(*args, **kwargs) |
|
0 commit comments