From 4cb5e881d2f6755b273e17da1bd4a818aa7288bc Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Sun, 23 Oct 2022 18:28:50 +0000 Subject: [PATCH 1/3] MutableMapping moves into collections.abc --- tldp/ldpcollection.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tldp/ldpcollection.py b/tldp/ldpcollection.py index 74127f3..48ac3b5 100644 --- a/tldp/ldpcollection.py +++ b/tldp/ldpcollection.py @@ -5,10 +5,15 @@ from __future__ import absolute_import, division, print_function -import collections +import sys + +if sys.version_info[:2] >= (3, 8): # pragma: no cover + from collections.abc import MutableMapping +else: # pragma: no cover + from collections import MutableMapping -class LDPDocumentCollection(collections.MutableMapping): +class LDPDocumentCollection(MutableMapping): '''a dict-like container for DocumentCollection objects Intended to be subclassed. From fafc30ac0e94a7d6f37fcb3218ae75279cee7943 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Sun, 23 Oct 2022 18:45:02 +0000 Subject: [PATCH 2/3] argparse drops private method _ensure_value The `argparse` library refactored to improvem performance of common use cases. Handling a list is not a common scenario and the function _ensure_values (which was obviously private) disappeared. This commit simply uses the same strategy that the upstream `argparse` maintainers used. Since this is a subclass of a private object type anyway, this is expected sort of behaviour. --- tldp/config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tldp/config.py b/tldp/config.py index 2428de9..46b796b 100644 --- a/tldp/config.py +++ b/tldp/config.py @@ -8,7 +8,6 @@ from __future__ import unicode_literals import os import argparse -import copy as _copy import logging @@ -30,7 +29,7 @@ class DirectoriesExist(argparse._AppendAction): message = message % (values, option_string) logger.critical(message) raise ValueError(message) - items = _copy.copy(argparse._ensure_value(namespace, self.dest, [])) + items = getattr(namespace, self.dest, []) items.append(values) setattr(namespace, self.dest, items) From 8be6d145173662df8884cc7601a42c692cfc4239 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Sun, 23 Oct 2022 12:12:22 -0700 Subject: [PATCH 3/3] drop Python2.x testing, support Python3.9+ --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e2abd4f..dc368f0 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py27, py34, py35 +envlist = py39, py310 skip_missing_interpreters = True [testenv]