From fe1245dd389e6f5a989e647d6c903ab43a100cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alice=20Zo=C3=AB=20Bevan=E2=80=93McGregor?= Date: Thu, 24 Aug 2023 16:32:16 -0400 Subject: [PATCH] Minor packaging updates, and a set_trace for stringification of buckets. --- Makefile | 3 ++- pyproject.toml | 4 +++- uri/bucket.py | 1 + uri/part/base.py | 2 +- uri/uri.py | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b125496..2cca26a 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ release: @echo -e "\nView online at: https://pypi.python.org/pypi/${PROJECT} or https://pypi.org/project/${PROJECT}/" @echo -e "Remember to make a release announcement and upload contents of .packaging/release/ folder as a Release on GitHub.\n" -${PROJECT}.egg-info/PKG-INFO: setup.py setup.cfg uri/release.py +${PROJECT}.egg-info/PKG-INFO: pyproject.toml @mkdir -p ${VIRTUAL_ENV}/lib/pip-cache pip install --cache-dir "${VIRTUAL_ENV}/lib/pip-cache" -Ue ".[${USE}]" + diff --git a/pyproject.toml b/pyproject.toml index 3c50f30..8d7efde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ development = [ # Development-time dependencies. 'pytest-cov[toml]', # Coverage reporting. 'pytest-flakes', # Syntax validation. 'pytest-isort', # Import ordering. + 'pytest-mypy', # Static type validation. 'webob', # Request WSGI environment mocking. 'requests', # Support for the http:// and https:// protocols. 'pre-commit', # Commit hooks for code quality. @@ -88,7 +89,8 @@ mongodb = 'uri.scheme:URLScheme' # https://docs.mongodb.com/manual/reference/co [tool.pytest.ini_options] -addopts = '-l -r fEsxw --cov uri --mypy --no-cov-on-fail --cov-report term-missing --cov-report xml --flakes --isort --durations=5 --color=yes test' +addopts = '-l -r fEsxw --cov uri --no-cov-on-fail --cov-report term-missing --cov-report xml --flakes --isort --durations=5 --color=yes test' +#addopts = '-l -r fEsxw --cov uri --mypy --no-cov-on-fail --cov-report term-missing --cov-report xml --flakes --isort --durations=5 --color=yes test' #addopts = [ # '-l', '-r', 'fEsxw', # '--flakes', # PyFlakes formatting. diff --git a/uri/bucket.py b/uri/bucket.py index 5f065d6..7322020 100644 --- a/uri/bucket.py +++ b/uri/bucket.py @@ -58,6 +58,7 @@ def __len__(self): def __str__(self): # Certain symbols are explicitly allowed, ref: http://pretty-rfc.herokuapp.com/RFC3986#query + # XXX: __import__('wdb').set_trace() iterator = (quote_plus(i.encode('utf8')).replace(b'%3F', b'?').replace(b'%2F', b'/') for i in self) if self.valid else self return self.sep.join(iterator) diff --git a/uri/part/base.py b/uri/part/base.py index 2c1df31..1db2a07 100644 --- a/uri/part/base.py +++ b/uri/part/base.py @@ -3,7 +3,7 @@ class Part: - """Descriptor protocol objects for combantorial string parts with validation.""" + """Descriptor protocol objects for combinatorial string parts with validation.""" __slots__ = () diff --git a/uri/uri.py b/uri/uri.py index 59afcf6..2eed9ab 100644 --- a/uri/uri.py +++ b/uri/uri.py @@ -54,7 +54,7 @@ class URI: # Additional Compound Interfaces uri = URIPart(__parts__) # Whole-URI retrieval or storage as string. - safe_uri = URIPart(__safe_parts__, False) # URI retrieval without password component, useful for logging. + safe = safe_uri = URIPart(__safe_parts__, False) # URI retrieval without password component, useful for logging. base = BasePart() summary = URIPart(('host', 'path'), False) resource = URIPart(('path', 'query', 'fragment'), False)