From 326d6f03a8619bca4ae8d18bba2203dfdc241863 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Wed, 19 Jul 2023 12:34:30 +0200 Subject: [PATCH] ArtifactoryPath: Fix glob() in Python 3.11 Python 3.11 replaced _accessor.scandir with _scandir. Override _scandir to still use our implementation. Should be a noop on older Python versions because they didn't have _scandir at all. Fixes: #396 Signed-off-by: Frank Lichtenheld --- artifactory.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/artifactory.py b/artifactory.py index 9d33c03..bef94cb 100755 --- a/artifactory.py +++ b/artifactory.py @@ -1659,6 +1659,12 @@ def rmdir(self): """ self._accessor.rmdir(self) + def _scandir(self): + """ + Override Path._scandir. Only required on Python >= 3.11 + """ + return self._accessor.scandir(self) + def download_stats(self, pathobj=None): """ Item statistics record the number of times an item was downloaded, last download date and last downloader.