From 0b5bfad91251d51fe81f5f287891d25a5264ff88 Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Fri, 16 Aug 2024 10:57:41 -0700 Subject: [PATCH 1/5] Can use with other tab libraries Added a :http:example-block: directive for translating and rendering a HTTP request or response anywhere, including in tab directives from other Sphinx extensions. Closes #25 --- docs/conf.py | 4 +- docs/index.rst | 68 +++++++++ docs/requirements.txt | 2 + src/sphinxcontrib/httpexample/__init__.py | 3 +- src/sphinxcontrib/httpexample/directives.py | 146 ++++++++++++-------- 5 files changed, 167 insertions(+), 56 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 7308c15..4cc26c9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,9 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinxcontrib.httpdomain', +extensions = ['sphinx_design', + 'sphinx_inline_tabs', + 'sphinxcontrib.httpdomain', 'sphinxcontrib.httpexample'] try: diff --git a/docs/index.rst b/docs/index.rst index 438533c..0c0b5ce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -50,6 +50,74 @@ The audience for this extension are developers and technical writes documenting Accept: application/json Authorization: Basic YWRtaW46YWRtaW4= +* Compatible with other tab libraries: + + `sphinx-inline-tabs `_: + + .. tab:: http + + .. http:example-block:: http + :request: ../tests/fixtures/001.request.txt + + .. tab:: curl + + .. http:example-block:: curl + :request: ../tests/fixtures/001.request.txt + + .. tab:: wget + + .. http:example-block:: wget + :request: ../tests/fixtures/001.request.txt + + .. tab:: httpie + + .. http:example-block:: httpie + :request: ../tests/fixtures/001.request.txt + + .. tab:: python-requests + + .. http:example-block:: wget + :request: ../tests/fixtures/001.request.txt + + .. tab:: response + + .. http:example-block:: response + :response: ../tests/fixtures/001.response.txt + + `sphinx-design `_: + + .. tab-set:: + + .. tab-item:: http + + .. http:example-block:: http + :request: ../tests/fixtures/001.request.txt + + .. tab-item:: curl + + .. http:example-block:: curl + :request: ../tests/fixtures/001.request.txt + + .. tab-item:: wget + + .. http:example-block:: wget + :request: ../tests/fixtures/001.request.txt + + .. tab-item:: httpie + + .. http:example-block:: httpie + :request: ../tests/fixtures/001.request.txt + + .. tab-item:: python-requests + + .. http:example-block:: wget + :request: ../tests/fixtures/001.request.txt + + .. tab-item:: response + + .. http:example-block:: response + :response: ../tests/fixtures/001.response.txt + * Supported tools: - curl_ diff --git a/docs/requirements.txt b/docs/requirements.txt index bd75659..6ba42b9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -19,6 +19,8 @@ pyyaml rst2pdf snapshottest==0.5.0 sphinx +sphinx-design +sphinx-inline-tabs sphinx-testing sphinx_rtd_theme sphinxcontrib-httpdomain diff --git a/src/sphinxcontrib/httpexample/__init__.py b/src/sphinxcontrib/httpexample/__init__.py index c423e0b..da2724f 100644 --- a/src/sphinxcontrib/httpexample/__init__.py +++ b/src/sphinxcontrib/httpexample/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from sphinxcontrib.httpexample.directives import HTTPExample +from sphinxcontrib.httpexample.directives import HTTPExample, HTTPExampleBlock import os import pkg_resources @@ -28,6 +28,7 @@ def copy_assets(app, exception): def setup(app): app.connect('build-finished', copy_assets) app.add_directive_to_domain('http', 'example', HTTPExample) + app.add_directive_to_domain('http', 'example-block', HTTPExampleBlock) app.add_js_file(JS_FILE) app.add_css_file(CSS_FILE) app.add_config_value('httpexample_scheme', 'http', 'html') diff --git a/src/sphinxcontrib/httpexample/directives.py b/src/sphinxcontrib/httpexample/directives.py index bbe55c3..21c4213 100644 --- a/src/sphinxcontrib/httpexample/directives.py +++ b/src/sphinxcontrib/httpexample/directives.py @@ -41,23 +41,15 @@ class HTTPExample(CodeBlock): 'response': directives.unchanged, }) - def run(self): - config = self.state.document.settings.env.config - - # Read enabled builders; Defaults to None - chosen_builders = choose_builders(self.arguments) - - # Enable 'http' language for http part - self.arguments = ['http'] - - # process 'query' reST fields - if self.content: - raw = ('\r\n'.join(self.content)).encode('utf-8') + @staticmethod + def process_content(content): + if content: + raw = ('\r\n'.join(content)).encode('utf-8') request = parsers.parse_request(raw) params, _ = request.extract_fields('query') params = [(p[1], p[2]) for p in params] new_path = utils.add_url_params(request.path, params) - self.content[0] = ' '.join( + content[0] = ' '.join( [request.command, new_path, request.request_version]) # split the request and optional response in the content. @@ -69,8 +61,8 @@ def run(self): emptylines_count = 0 in_response = False is_field = r':({}) (.+): (.+)'.format('|'.join(AVAILABLE_FIELDS)) - for i, line in enumerate(self.content): - source = self.content.source(i) + for i, line in enumerate(content): + source = content.source(i) if in_response: response_content.append(line, source) else: @@ -93,59 +85,55 @@ def run(self): emptylines_count = 0 - # Load optional external request - cwd = os.path.dirname(self.state.document.current_source) - if 'request' in self.options: - request = utils.resolve_path(self.options['request'], cwd) - with open(request) as fp: - request_content = request_content_no_fields = StringList( - list(map(str.rstrip, fp.readlines())), request) - - # Load optional external response - if 'response' in self.options: - response = utils.resolve_path(self.options['response'], cwd) - with open(response) as fp: - response_content = StringList( - list(map(str.rstrip, fp.readlines())), response) - - # reset the content to the request, stripped of the reST fields - self.content = request_content_no_fields + return (request_content, request_content_no_fields, response_content) + + def run(self): + if self.content: + processed = self.process_content( + StringList(self.content) + ) + have_request = bool(processed[1]) + have_response = bool(processed[2]) + else: + have_request = 'request' in self.options + have_response = 'response' in self.options # Wrap and render main directive as 'http-example-http' klass = 'http-example-http' container = nodes.container('', classes=[klass]) container.append(nodes.caption('', 'http')) - container.extend(super(HTTPExample, self).run()) + block = HTTPExampleBlock( + 'http:example-block', + ['http'], + self.options, + self.content, + self.lineno, + self.content_offset, + self.block_text, + self.state, + self.state_machine + ) + container.extend(block.run()) # Init result node list result = [container] - # reset the content to just the request - self.content = request_content - # Append builder responses - if request_content_no_fields: - raw = ('\r\n'.join(request_content_no_fields)).encode('utf-8') - for name in chosen_builders: - request = parsers.parse_request(raw, config.httpexample_scheme) - builder_, language = AVAILABLE_BUILDERS[name] - + if have_request: + for argument in self.arguments: + name = argument # Setting plone JavaScript tab name name = 'JavaScript' if name == 'plone-javascript' else name - command = builder_(request) - - content = StringList( - [command], request_content_no_fields.source(0)) options = self.options.copy() options.pop('name', None) options.pop('caption', None) - block = CodeBlock( - 'code-block', - [language], + block = HTTPExampleBlock( + 'http:example-block', + [argument], options, - content, + self.content, self.lineno, self.content_offset, self.block_text, @@ -163,16 +151,16 @@ def run(self): result.append(container) # Append optional response - if response_content: + if have_response: options = self.options.copy() options.pop('name', None) options.pop('caption', None) - block = CodeBlock( - 'code-block', + block = HTTPExampleBlock( + 'http:example-block', ['http'], options, - response_content, + self.content, self.lineno, self.content_offset, self.block_text, @@ -194,3 +182,53 @@ def run(self): container_node.extend(result) return [container_node] + + +class HTTPExampleBlock(CodeBlock): + required_arguments = 1 + + option_spec = utils.merge_dicts(CodeBlock.option_spec, { + 'request': directives.unchanged, + 'response': directives.unchanged, + }) + + def read_http_file(self, path): + cwd = os.path.dirname(self.state.document.current_source) + request = utils.resolve_path(path, cwd) + with open(request) as fp: + return StringList(list(map(str.rstrip, fp.readlines())), request) + + def run(self): + if self.arguments == ['http']: + if 'request' in self.options: + self.content = self.read_http_file(self.options['request']) + else: + self.content = HTTPExample.process_content(self.content)[1] + elif self.arguments == ['response']: + if 'response' in self.options: + self.content = self.read_http_file(self.options['response']) + else: + self.content = HTTPExample.process_content(self.content)[2] + + self.arguments = ['http'] + else: + if 'request' in self.options: + request_content_no_fields = self.read_http_file( + self.options['request']) + else: + request_content_no_fields = HTTPExample.process_content( + self.content)[1] + + raw = ('\r\n'.join(request_content_no_fields)).encode('utf-8') + + config = self.env.config + request = parsers.parse_request(raw, config.httpexample_scheme) + name = choose_builders(self.arguments)[0] + builder_, language = AVAILABLE_BUILDERS[name] + self.arguments = [language] + + command = builder_(request) + self.content = StringList( + [command], request_content_no_fields.source(0)) + + return super(HTTPExampleBlock, self).run() From ff8e68703114cb30bdfb941181f89b6fc41e7c08 Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Sun, 18 Aug 2024 14:09:29 +0300 Subject: [PATCH 2/5] Add sphinx-design and sphinx-inline-tabs into test lock files --- Makefile | 18 +++++++++ docs/conf.py | 18 +++++++-- nix/poetry-python310-docutils018.lock | 45 ++++++++++++++++++++++- nix/poetry-python310-docutils018.toml | 2 + nix/poetry-python310-docutils019.lock | 45 ++++++++++++++++++++++- nix/poetry-python310-docutils019.toml | 2 + nix/poetry-python310-docutils020.lock | 45 ++++++++++++++++++++++- nix/poetry-python310-docutils020.toml | 2 + nix/poetry-python311-docutils018.lock | 45 ++++++++++++++++++++++- nix/poetry-python311-docutils018.toml | 2 + nix/poetry-python311-docutils019.lock | 45 ++++++++++++++++++++++- nix/poetry-python311-docutils019.toml | 2 + nix/poetry-python311-docutils020.lock | 45 ++++++++++++++++++++++- nix/poetry-python311-docutils020.toml | 2 + nix/poetry-python39-docutils018.lock | 45 ++++++++++++++++++++++- nix/poetry-python39-docutils018.toml | 2 + nix/poetry-python39-docutils019.lock | 45 ++++++++++++++++++++++- nix/poetry-python39-docutils019.toml | 2 + nix/poetry-python39-docutils020.lock | 45 ++++++++++++++++++++++- nix/poetry-python39-docutils020.toml | 2 + src/sphinxcontrib/httpexample/__init__.py | 3 +- 21 files changed, 448 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e20d13f..7be8590 100644 --- a/Makefile +++ b/Makefile @@ -65,3 +65,21 @@ nix/requirements-python27.nix: .cache nix/requirements-python27.txt nix/requirements-python27.txt: .cache requirements.txt nix develop .#python27-pip2nix --command pip2nix generate -r requirements.txt --output=nix/requirements-python27.nix @grep "pname =\|version =" nix/requirements-python27.nix|awk "ORS=NR%2?FS:RS"|sed 's|.*"\(.*\)";.*version = "\(.*\)".*|\1==\2|' > nix/requirements-python27.txt + +poetry\ add\ --dev\ %: + cp nix/poetry-$(PYTHON)-$(FEATURE).toml pyproject.toml + cp nix/poetry-$(PYTHON)-$(FEATURE).lock poetry.lock + poetry add --group dev $* + mv pyproject.toml nix/poetry-$(PYTHON)-$(FEATURE).toml + mv poetry.lock nix/poetry-$(PYTHON)-$(FEATURE).lock + +every\ poetry\ add\ --dev\ %: + PYTHON=python39 FEATURE=docutils018 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python39 FEATURE=docutils019 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python39 FEATURE=docutils020 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python310 FEATURE=docutils018 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python310 FEATURE=docutils019 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python310 FEATURE=docutils020 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python311 FEATURE=docutils018 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python311 FEATURE=docutils019 $(MAKE) poetry\ add\ --dev\ $* + PYTHON=python311 FEATURE=docutils020 $(MAKE) poetry\ add\ --dev\ $* diff --git a/docs/conf.py b/docs/conf.py index 4cc26c9..03110f0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,10 +29,20 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx_design', - 'sphinx_inline_tabs', - 'sphinxcontrib.httpdomain', - 'sphinxcontrib.httpexample'] +extensions = [ + 'sphinxcontrib.httpdomain', + 'sphinxcontrib.httpexample', +] + +try: + import sphinx_design + import sphinx_inline_tabs + extensions.extend([ + 'sphinx_design', + 'sphinx_inline_tabs', + ]) +except ImportError: + pass try: import rst2pdf diff --git a/nix/poetry-python310-docutils018.lock b/nix/poetry-python310-docutils018.lock index 910d578..a401b9c 100644 --- a/nix/poetry-python310-docutils018.lock +++ b/nix/poetry-python310-docutils018.lock @@ -787,6 +787,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=3.5.0)", "importlib_metadata", "mypy (==1.9.0)", "pytest (>=6.0)", "ruff (==0.3.7)", "sphinx-lint", "tomli", "types-docutils", "types-requests"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=6.0)", "setuptools (>=67.0)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1071,4 +1114,4 @@ test = ["pytest (>=6.0.0)", "setuptools (>=65)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "3bfbefac556463258dfeed4557272c702825b29ef747494b00e3f436d15e3518" +content-hash = "66720a593de2b9c6dd1a08410528c3407d690ad9f8b1110f1c90fe4dcefae718" diff --git a/nix/poetry-python310-docutils018.toml b/nix/poetry-python310-docutils018.toml index edf2815..7792823 100644 --- a/nix/poetry-python310-docutils018.toml +++ b/nix/poetry-python310-docutils018.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python310-docutils019.lock b/nix/poetry-python310-docutils019.lock index 4990c09..c53e0dd 100644 --- a/nix/poetry-python310-docutils019.lock +++ b/nix/poetry-python310-docutils019.lock @@ -787,6 +787,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=3.5.0)", "importlib_metadata", "mypy (==1.9.0)", "pytest (>=6.0)", "ruff (==0.3.7)", "sphinx-lint", "tomli", "types-docutils", "types-requests"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=6.0)", "setuptools (>=67.0)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1071,4 +1114,4 @@ test = ["pytest (>=6.0.0)", "setuptools (>=65)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "7d6a785666bfb4882c88606e5d7892fcd3e541056516448184962fec0cd827ce" +content-hash = "570150009d881bacf6cb4c595de2d36cb7b0223cf8a6e44aecb2f663e467536c" diff --git a/nix/poetry-python310-docutils019.toml b/nix/poetry-python310-docutils019.toml index 7b2f5ac..cd406f8 100644 --- a/nix/poetry-python310-docutils019.toml +++ b/nix/poetry-python310-docutils019.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python310-docutils020.lock b/nix/poetry-python310-docutils020.lock index 856bda2..f82ef86 100644 --- a/nix/poetry-python310-docutils020.lock +++ b/nix/poetry-python310-docutils020.lock @@ -787,6 +787,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=6.0)", "importlib-metadata (>=6.0)", "mypy (==1.10.1)", "pytest (>=6.0)", "ruff (==0.5.2)", "sphinx-lint (>=0.9)", "tomli (>=2)", "types-docutils (==0.21.0.20240711)", "types-requests (>=2.30.0)"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=8.0)", "setuptools (>=70.0)", "typing_extensions (>=4.9)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1071,4 +1114,4 @@ test = ["pytest (>=6.0.0)", "setuptools (>=65)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "c303b2df101c7d3aa641d990d0cb9c7fc18fa3df76bcb6bf45cdcdb434d9bf6a" +content-hash = "aaa9ad76c6b9ca2cedbdc365d4aa3459cdaab8d51e0ba1d1a55f198c59bfeb5c" diff --git a/nix/poetry-python310-docutils020.toml b/nix/poetry-python310-docutils020.toml index a12d091..f8cf72c 100644 --- a/nix/poetry-python310-docutils020.toml +++ b/nix/poetry-python310-docutils020.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python311-docutils018.lock b/nix/poetry-python311-docutils018.lock index 1864b26..2931500 100644 --- a/nix/poetry-python311-docutils018.lock +++ b/nix/poetry-python311-docutils018.lock @@ -768,6 +768,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=3.5.0)", "importlib_metadata", "mypy (==1.9.0)", "pytest (>=6.0)", "ruff (==0.3.7)", "sphinx-lint", "tomli", "types-docutils", "types-requests"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=6.0)", "setuptools (>=67.0)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1030,4 +1073,4 @@ test = ["pytest (>=6.0.0)", "setuptools (>=65)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "c14bba93bd5d32a500d92b3e207bf078c0e677d11595d43aa749dcca5ee77b49" +content-hash = "90b9591e6ca055ee984d75781cf49003d0fcd74ea7a5167dd841b8f49d4d2f6d" diff --git a/nix/poetry-python311-docutils018.toml b/nix/poetry-python311-docutils018.toml index b10e124..0050622 100644 --- a/nix/poetry-python311-docutils018.toml +++ b/nix/poetry-python311-docutils018.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python311-docutils019.lock b/nix/poetry-python311-docutils019.lock index 8ebb83a..38842f0 100644 --- a/nix/poetry-python311-docutils019.lock +++ b/nix/poetry-python311-docutils019.lock @@ -768,6 +768,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=3.5.0)", "importlib_metadata", "mypy (==1.9.0)", "pytest (>=6.0)", "ruff (==0.3.7)", "sphinx-lint", "tomli", "types-docutils", "types-requests"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=6.0)", "setuptools (>=67.0)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1030,4 +1073,4 @@ test = ["pytest (>=6.0.0)", "setuptools (>=65)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "3ee3a967f59ef84c03c15ecc7f921d1e8d29e4a3dccd5fe06dee3ab7fe17a3f9" +content-hash = "963e1c411b78fc4056904aced224d6b4860287eea047570cf6253186730857fa" diff --git a/nix/poetry-python311-docutils019.toml b/nix/poetry-python311-docutils019.toml index 949c9c3..987ee53 100644 --- a/nix/poetry-python311-docutils019.toml +++ b/nix/poetry-python311-docutils019.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python311-docutils020.lock b/nix/poetry-python311-docutils020.lock index dcd5ace..6c357ea 100644 --- a/nix/poetry-python311-docutils020.lock +++ b/nix/poetry-python311-docutils020.lock @@ -768,6 +768,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=6.0)", "importlib-metadata (>=6.0)", "mypy (==1.10.1)", "pytest (>=6.0)", "ruff (==0.5.2)", "sphinx-lint (>=0.9)", "tomli (>=2)", "types-docutils (==0.21.0.20240711)", "types-requests (>=2.30.0)"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=8.0)", "setuptools (>=70.0)", "typing_extensions (>=4.9)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1030,4 +1073,4 @@ test = ["pytest (>=6.0.0)", "setuptools (>=65)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "be7e6f5cdc9ed6aa6daba3dc57fe773fd3f8197e20a24aa3e3a1b9325ff02e27" +content-hash = "d0fcfccaea68c27971e50f7885aefa5b5f5fbecd0afaa6ccab76972a1e233c5e" diff --git a/nix/poetry-python311-docutils020.toml b/nix/poetry-python311-docutils020.toml index 157bab0..c6850a7 100644 --- a/nix/poetry-python311-docutils020.toml +++ b/nix/poetry-python311-docutils020.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python39-docutils018.lock b/nix/poetry-python39-docutils018.lock index ee77493..7f60954 100644 --- a/nix/poetry-python39-docutils018.lock +++ b/nix/poetry-python39-docutils018.lock @@ -807,6 +807,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=3.5.0)", "importlib_metadata", "mypy (==1.9.0)", "pytest (>=6.0)", "ruff (==0.3.7)", "sphinx-lint", "tomli", "types-docutils", "types-requests"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=6.0)", "setuptools (>=67.0)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1106,4 +1149,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "94d0b82ec694186e386987409446dec3cea4d7a7dbbdccc104148e7f6c4ee9df" +content-hash = "57409b5cebd662a71e4130d1ed21371e273df90c87c2ea4934f0e0866749d278" diff --git a/nix/poetry-python39-docutils018.toml b/nix/poetry-python39-docutils018.toml index 49a8a06..e783f6f 100644 --- a/nix/poetry-python39-docutils018.toml +++ b/nix/poetry-python39-docutils018.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python39-docutils019.lock b/nix/poetry-python39-docutils019.lock index 9e37463..d4bfc7a 100644 --- a/nix/poetry-python39-docutils019.lock +++ b/nix/poetry-python39-docutils019.lock @@ -807,6 +807,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=3.5.0)", "importlib_metadata", "mypy (==1.9.0)", "pytest (>=6.0)", "ruff (==0.3.7)", "sphinx-lint", "tomli", "types-docutils", "types-requests"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=6.0)", "setuptools (>=67.0)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1106,4 +1149,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "0d5bc807cd3a263bc8b74c3ec4dec369d0d6fb6934d08e8280e9548951fe4784" +content-hash = "6101c672801ad2c73bfca94f3caec2c4702d83b0cd85ecb502f5f352414eabfd" diff --git a/nix/poetry-python39-docutils019.toml b/nix/poetry-python39-docutils019.toml index f768cdd..8504c75 100644 --- a/nix/poetry-python39-docutils019.toml +++ b/nix/poetry-python39-docutils019.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/nix/poetry-python39-docutils020.lock b/nix/poetry-python39-docutils020.lock index c49d53d..42eb2d5 100644 --- a/nix/poetry-python39-docutils020.lock +++ b/nix/poetry-python39-docutils020.lock @@ -807,6 +807,49 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=6.0)", "importlib-metadata (>=6.0)", "mypy (==1.10.1)", "pytest (>=6.0)", "ruff (==0.5.2)", "sphinx-lint (>=0.9)", "tomli (>=2)", "types-docutils (==0.21.0.20240711)", "types-requests (>=2.30.0)"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=8.0)", "setuptools (>=70.0)", "typing_extensions (>=4.9)"] +[[package]] +name = "sphinx-design" +version = "0.6.1" +description = "A sphinx extension for designing beautiful, view size responsive web components." +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx_design-0.6.1-py3-none-any.whl", hash = "sha256:b11f37db1a802a183d61b159d9a202314d4d2fe29c163437001324fe2f19549c"}, + {file = "sphinx_design-0.6.1.tar.gz", hash = "sha256:b44eea3719386d04d765c1a8257caca2b3e6f8421d7b3a5e742c0fd45f84e632"}, +] + +[package.dependencies] +sphinx = ">=6,<9" + +[package.extras] +code-style = ["pre-commit (>=3,<4)"] +rtd = ["myst-parser (>=2,<4)"] +testing = ["defusedxml", "myst-parser (>=2,<4)", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +testing-no-myst = ["defusedxml", "pytest (>=8.3,<9.0)", "pytest-cov", "pytest-regressions"] +theme-furo = ["furo (>=2024.7.18,<2024.8.0)"] +theme-im = ["sphinx-immaterial (>=0.12.2,<0.13.0)"] +theme-pydata = ["pydata-sphinx-theme (>=0.15.2,<0.16.0)"] +theme-rtd = ["sphinx-rtd-theme (>=2.0,<3.0)"] +theme-sbt = ["sphinx-book-theme (>=1.1,<2.0)"] + +[[package]] +name = "sphinx-inline-tabs" +version = "2023.4.21" +description = "Add inline tabbed content to your Sphinx documentation." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_inline_tabs-2023.4.21-py3-none-any.whl", hash = "sha256:06809ac613f7c48ddd6e2fa588413e3fe92cff2397b56e2ccf0b0218f9ef6a78"}, + {file = "sphinx_inline_tabs-2023.4.21.tar.gz", hash = "sha256:5df2f13f602c158f3f5f6c509e008aeada199a8c76d97ba3aa2822206683bebc"}, +] + +[package.dependencies] +sphinx = ">=3" + +[package.extras] +doc = ["furo", "myst-parser"] +test = ["pytest", "pytest-cov", "pytest-xdist"] + [[package]] name = "sphinx-rtd-theme" version = "2.0.0" @@ -1106,4 +1149,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "2ff98286415655f5d54fa7f6b5024c01f3f2d2217947da1777cfdf1e3ac6ce51" +content-hash = "821adbe7d80e8a2110450ec79aaab0d76ceb4f1d27e37123e6af4b6c7e4efbb3" diff --git a/nix/poetry-python39-docutils020.toml b/nix/poetry-python39-docutils020.toml index 3326146..8063de1 100644 --- a/nix/poetry-python39-docutils020.toml +++ b/nix/poetry-python39-docutils020.toml @@ -44,6 +44,8 @@ sphinx-testing = "^1.0.1" flake8 = "^7.1.1" sphinx-rtd-theme = "^2.0.0" coveralls = "3.3.1" +sphinx-design = "^0.6.1" +sphinx-inline-tabs = "^2023.4.21" [build-system] requires = ["poetry-core"] diff --git a/src/sphinxcontrib/httpexample/__init__.py b/src/sphinxcontrib/httpexample/__init__.py index da2724f..567d5ca 100644 --- a/src/sphinxcontrib/httpexample/__init__.py +++ b/src/sphinxcontrib/httpexample/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -from sphinxcontrib.httpexample.directives import HTTPExample, HTTPExampleBlock +from sphinxcontrib.httpexample.directives import HTTPExample +from sphinxcontrib.httpexample.directives import HTTPExampleBlock import os import pkg_resources From 6e10e4ce19c86d85635b5775b28159112b416ae4 Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Sun, 18 Aug 2024 14:36:26 +0300 Subject: [PATCH 3/5] chore: black --skip-string-normalization --- Makefile | 4 + setup.cfg | 2 + src/sphinxcontrib/httpexample/builders.py | 53 ++-- src/sphinxcontrib/httpexample/directives.py | 68 ++--- src/sphinxcontrib/httpexample/parsers.py | 11 +- src/sphinxcontrib/httpexample/utils.py | 17 +- tests/snapshots/snap_test_builders.py | 260 +++++++++++++++----- tests/test_builders.py | 18 +- tests/test_fixtures.py | 8 +- tests/test_parsers.py | 41 +-- tests/test_utils.py | 47 ++-- 11 files changed, 341 insertions(+), 188 deletions(-) diff --git a/Makefile b/Makefile index 7be8590..db29682 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,10 @@ coverage: .coverage coveralls: .coverage coveralls --service=github +.PHONY: format +format: + black --skip-string-normalization src tests + .PHONY: nix-fmt nix-fmt: nix fmt flake.nix setup.nix diff --git a/setup.cfg b/setup.cfg index c0fd0f9..9aab141 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,6 +61,8 @@ test = pytest [flake8] exclude = .git,__pycache__,build,dist +ignore = E501 +# E501 line too long max-complexity = 20 [isort] diff --git a/src/sphinxcontrib/httpexample/builders.py b/src/sphinxcontrib/httpexample/builders.py index dd74a34..7904d22 100644 --- a/src/sphinxcontrib/httpexample/builders.py +++ b/src/sphinxcontrib/httpexample/builders.py @@ -33,6 +33,7 @@ def unparse(tree): FixUnparser(tree, file=v) return v.getvalue() + try: from shlex import quote as shlex_quote except ImportError: @@ -60,10 +61,8 @@ def shlex_double_quote(s): 'Authorization', 'Host', ] -EXCLUDE_HEADERS_HTTP = EXCLUDE_HEADERS + [ -] -EXCLUDE_HEADERS_REQUESTS = EXCLUDE_HEADERS + [ -] +EXCLUDE_HEADERS_HTTP = EXCLUDE_HEADERS + [] +EXCLUDE_HEADERS_REQUESTS = EXCLUDE_HEADERS + [] def build_curl_command(request): @@ -82,8 +81,8 @@ def build_curl_command(request): for header in sorted(request.headers): if header in EXCLUDE_HEADERS: continue - header_line = shlex_double_quote('{}: {}'.format( - header, request.headers[header]), + header_line = shlex_double_quote( + '{}: {}'.format(header, request.headers[header]), ) parts.append('-H {}'.format(header_line)) @@ -175,15 +174,21 @@ def build_httpie_command(request): for header in sorted(request.headers): if header in EXCLUDE_HEADERS_HTTP: continue - parts.append('{}:{}'.format( - header, shlex_double_quote(request.headers[header]), - )) + parts.append( + '{}:{}'.format( + header, + shlex_double_quote(request.headers[header]), + ) + ) if method != 'Basic' and 'Authorization' in request.headers: header = 'Authorization' - parts.append('{}:{}'.format( - header, shlex_double_quote(request.headers[header]), - )) + parts.append( + '{}:{}'.format( + header, + shlex_double_quote(request.headers[header]), + ) + ) # JSON or raw data data = maybe_str(request.data()) @@ -194,8 +199,8 @@ def build_httpie_command(request): # whitespace handling across Python 2 and 3. See # https://bugs.python.org/issue16333 for details. redir_input = shlex_quote( - json.dumps(data, indent=2, sort_keys=True, - separators=(',', ': '))) + json.dumps(data, indent=2, sort_keys=True, separators=(',', ': ')) + ) else: redir_input = shlex_quote(data) @@ -221,18 +226,19 @@ def build_plone_javascript_command(request): if data: if is_json(request.headers.get('Content-Type', '')): redir_input2 = json.dumps( - data, indent=2, sort_keys=True, + data, + indent=2, + sort_keys=True, separators=(',', ': '), ).encode('utf-8') else: redir_input2 = data # Output string - output_string =\ - "{}\n|\nconst aliasesData = '{}';".format( - maybe_str(javascript_code), - maybe_str(redir_input2), - ) + output_string = "{}\n|\nconst aliasesData = '{}';".format( + maybe_str(javascript_code), + maybe_str(redir_input2), + ) return output_string @@ -270,7 +276,8 @@ def build_requests_command(request): header_values.append(ast.Str(request.headers['Authorization'])) if header_keys and header_values: call.keywords.append( - ast.keyword('headers', ast.Dict(header_keys, header_values))) + ast.keyword('headers', ast.Dict(header_keys, header_values)) + ) # JSON or raw data data = maybe_str(request.data()) @@ -316,7 +323,7 @@ def astify_json_obj(obj): if method == 'Basic': token = maybe_str(token) call.keywords.append( - ast.keyword('auth', ast.Tuple( - tuple(map(ast.Str, token.split(':'))), None))) + ast.keyword('auth', ast.Tuple(tuple(map(ast.Str, token.split(':'))), None)) + ) return unparse(tree).strip() diff --git a/src/sphinxcontrib/httpexample/directives.py b/src/sphinxcontrib/httpexample/directives.py index 21c4213..43415a9 100644 --- a/src/sphinxcontrib/httpexample/directives.py +++ b/src/sphinxcontrib/httpexample/directives.py @@ -17,18 +17,17 @@ 'httpie': (builders.build_httpie_command, 'bash'), 'requests': (builders.build_requests_command, 'python'), 'python-requests': (builders.build_requests_command, 'python'), - 'plone-javascript': (builders.build_plone_javascript_command, - 'javascript'), + 'plone-javascript': (builders.build_plone_javascript_command, 'javascript'), } -AVAILABLE_FIELDS = [ - 'query' -] +AVAILABLE_FIELDS = ['query'] def choose_builders(arguments): - return [directives.choice(argument, AVAILABLE_BUILDERS) - for argument in (arguments or [])] + return [ + directives.choice(argument, AVAILABLE_BUILDERS) + for argument in (arguments or []) + ] class HTTPExample(CodeBlock): @@ -36,10 +35,13 @@ class HTTPExample(CodeBlock): required_arguments = 0 optional_arguments = len(AVAILABLE_BUILDERS) - option_spec = utils.merge_dicts(CodeBlock.option_spec, { - 'request': directives.unchanged, - 'response': directives.unchanged, - }) + option_spec = utils.merge_dicts( + CodeBlock.option_spec, + { + 'request': directives.unchanged, + 'response': directives.unchanged, + }, + ) @staticmethod def process_content(content): @@ -49,8 +51,7 @@ def process_content(content): params, _ = request.extract_fields('query') params = [(p[1], p[2]) for p in params] new_path = utils.add_url_params(request.path, params) - content[0] = ' '.join( - [request.command, new_path, request.request_version]) + content[0] = ' '.join([request.command, new_path, request.request_version]) # split the request and optional response in the content. # The separator is two empty lines followed by a line starting with @@ -66,21 +67,22 @@ def process_content(content): if in_response: response_content.append(line, source) else: - if emptylines_count >= 2 and \ - (line.startswith('HTTP/') or line.startswith('HTTP ')): + if emptylines_count >= 2 and ( + line.startswith('HTTP/') or line.startswith('HTTP ') + ): in_response = True response_content = StringList() response_content.append(line, source) elif line == '': emptylines_count += 1 else: - request_content.extend( - StringList([''] * emptylines_count, source)) + request_content.extend(StringList([''] * emptylines_count, source)) request_content.append(line, source) if not re.match(is_field, line): request_content_no_fields.extend( - StringList([''] * emptylines_count, source)) + StringList([''] * emptylines_count, source) + ) request_content_no_fields.append(line, source) emptylines_count = 0 @@ -89,9 +91,7 @@ def process_content(content): def run(self): if self.content: - processed = self.process_content( - StringList(self.content) - ) + processed = self.process_content(StringList(self.content)) have_request = bool(processed[1]) have_response = bool(processed[2]) else: @@ -111,7 +111,7 @@ def run(self): self.content_offset, self.block_text, self.state, - self.state_machine + self.state_machine, ) container.extend(block.run()) @@ -138,7 +138,7 @@ def run(self): self.content_offset, self.block_text, self.state, - self.state_machine + self.state_machine, ) # Wrap and render main directive as 'http-example-{name}' @@ -165,7 +165,7 @@ def run(self): self.content_offset, self.block_text, self.state, - self.state_machine + self.state_machine, ) # Wrap and render main directive as 'http-example-response' @@ -187,10 +187,13 @@ def run(self): class HTTPExampleBlock(CodeBlock): required_arguments = 1 - option_spec = utils.merge_dicts(CodeBlock.option_spec, { - 'request': directives.unchanged, - 'response': directives.unchanged, - }) + option_spec = utils.merge_dicts( + CodeBlock.option_spec, + { + 'request': directives.unchanged, + 'response': directives.unchanged, + }, + ) def read_http_file(self, path): cwd = os.path.dirname(self.state.document.current_source) @@ -213,11 +216,9 @@ def run(self): self.arguments = ['http'] else: if 'request' in self.options: - request_content_no_fields = self.read_http_file( - self.options['request']) + request_content_no_fields = self.read_http_file(self.options['request']) else: - request_content_no_fields = HTTPExample.process_content( - self.content)[1] + request_content_no_fields = HTTPExample.process_content(self.content)[1] raw = ('\r\n'.join(request_content_no_fields)).encode('utf-8') @@ -228,7 +229,6 @@ def run(self): self.arguments = [language] command = builder_(request) - self.content = StringList( - [command], request_content_no_fields.source(0)) + self.content = StringList([command], request_content_no_fields.source(0)) return super(HTTPExampleBlock, self).run() diff --git a/src/sphinxcontrib/httpexample/parsers.py b/src/sphinxcontrib/httpexample/parsers.py index 8124028..30ff114 100644 --- a/src/sphinxcontrib/httpexample/parsers.py +++ b/src/sphinxcontrib/httpexample/parsers.py @@ -16,9 +16,7 @@ from BaseHTTPServer import BaseHTTPRequestHandler -AVAILABLE_FIELDS = [ - 'query' -] +AVAILABLE_FIELDS = ['query'] class HTTPRequest(BaseHTTPRequestHandler): @@ -72,7 +70,8 @@ def extract_fields(self, field=None, available_fields=None): fields.append((field.strip(), key.strip(), val.strip())) remaining_request = BytesIO( - '\n'.join(remaining_request).encode('utf-8').strip()) + '\n'.join(remaining_request).encode('utf-8').strip() + ) remaining_request.seek(0) self.rfile.seek(cursor) @@ -92,9 +91,7 @@ def auth(self): def url(self): base_url = '{}://{}{}'.format( - self.scheme, - self.headers.get('Host', 'nohost'), - self.path + self.scheme, self.headers.get('Host', 'nohost'), self.path ) params, _ = self.extract_fields('query') diff --git a/src/sphinxcontrib/httpexample/utils.py b/src/sphinxcontrib/httpexample/utils.py index b2791fc..41de289 100644 --- a/src/sphinxcontrib/httpexample/utils.py +++ b/src/sphinxcontrib/httpexample/utils.py @@ -28,8 +28,7 @@ def merge_dicts(a, b): def resolve_path(spec, cwd=''): if os.path.isfile(os.path.normpath(os.path.join(cwd, spec))): return os.path.normpath(os.path.join(cwd, spec)) - elif (spec.count(':') and - pkg_resources.resource_exists(*spec.split(':', 1))): + elif spec.count(':') and pkg_resources.resource_exists(*spec.split(':', 1)): return pkg_resources.resource_filename(*spec.split(':', 1)) else: return spec @@ -38,15 +37,15 @@ def resolve_path(spec, cwd=''): def maybe_str(v): """Convert any strings to local 'str' instances""" if isinstance(v, str) and isinstance(v, bytes): - return v # Python 2 encoded + return v # Python 2 encoded elif str(type(v)) == "": return v.encode('utf-8') # Python 2 unicode elif isinstance(v, bytes): return v.decode('utf-8') # Python 3 encoded elif isinstance(v, str): - return v # Python 3 unicode + return v # Python 3 unicode else: - return v # not a string + return v # not a string def ordered(dict_): @@ -104,8 +103,12 @@ def add_url_params(url, params): new_params = parse_qsl(parsed_url.query) + params new_params_encoded = urlencode(new_params, doseq=True) new_url = ParseResult( - parsed_url.scheme, parsed_url.netloc, parsed_url.path, - parsed_url.params, new_params_encoded, parsed_url.fragment + parsed_url.scheme, + parsed_url.netloc, + parsed_url.path, + parsed_url.params, + new_params_encoded, + parsed_url.fragment, ).geturl() return new_url diff --git a/tests/snapshots/snap_test_builders.py b/tests/snapshots/snap_test_builders.py index 49dad4f..1a622ce 100644 --- a/tests/snapshots/snap_test_builders.py +++ b/tests/snapshots/snap_test_builders.py @@ -7,54 +7,98 @@ snapshots = Snapshot() -snapshots['test_fixture[build_curl_command-fixture_001] 1'] = 'curl -i -X GET http://localhost:8080/Plone/front-page -H "Accept: application/json" --user admin:admin' +snapshots['test_fixture[build_curl_command-fixture_001] 1'] = ( + 'curl -i -X GET http://localhost:8080/Plone/front-page -H "Accept: application/json" --user admin:admin' +) -snapshots['test_fixture[build_curl_command-fixture_002] 1'] = 'curl -i -X POST http://localhost:8080/Plone/folder -H "Accept: application/json" -H "Content-Type: application/json" --data-raw \'{"@type": "Document", "title": "My Document"}\' --user admin:admin' +snapshots['test_fixture[build_curl_command-fixture_002] 1'] = ( + 'curl -i -X POST http://localhost:8080/Plone/folder -H "Accept: application/json" -H "Content-Type: application/json" --data-raw \'{"@type": "Document", "title": "My Document"}\' --user admin:admin' +) -snapshots['test_fixture[build_curl_command-fixture_003] 1'] = 'curl -i -X PATCH http://localhost:8080/Plone/folder/my-document -H "Accept: application/json" -H "Content-Type: application/json" --data-raw \'{"title": "My New Document Title"}\' --user admin:admin' +snapshots['test_fixture[build_curl_command-fixture_003] 1'] = ( + 'curl -i -X PATCH http://localhost:8080/Plone/folder/my-document -H "Accept: application/json" -H "Content-Type: application/json" --data-raw \'{"title": "My New Document Title"}\' --user admin:admin' +) -snapshots['test_fixture[build_curl_command-fixture_004] 1'] = 'curl -i -X GET http://localhost:8080/Plone/front-page -H "Accept: application/json"' +snapshots['test_fixture[build_curl_command-fixture_004] 1'] = ( + 'curl -i -X GET http://localhost:8080/Plone/front-page -H "Accept: application/json"' +) -snapshots['test_fixture[build_curl_command-fixture_005] 1'] = 'curl -i -X GET http://localhost:8080/Plone/front-page -H "Accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI"' +snapshots['test_fixture[build_curl_command-fixture_005] 1'] = ( + 'curl -i -X GET http://localhost:8080/Plone/front-page -H "Accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI"' +) -snapshots['test_fixture[build_curl_command-fixture_006] 1'] = 'curl -i -X PATCH http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f -H "Accept: application/json" -H "Content-Type: application/offset+octet-stream" -H "Tus-Resumable: 1.0.0" -H "Upload-Offset: 3" --data-raw \'defgh\' --user admin:secret' +snapshots['test_fixture[build_curl_command-fixture_006] 1'] = ( + 'curl -i -X PATCH http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f -H "Accept: application/json" -H "Content-Type: application/offset+octet-stream" -H "Tus-Resumable: 1.0.0" -H "Upload-Offset: 3" --data-raw \'defgh\' --user admin:secret' +) -snapshots['test_fixture[build_curl_command-fixture_007] 1'] = 'curl -i -X GET \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' -H "Accept: application/json" --user admin:admin' +snapshots['test_fixture[build_curl_command-fixture_007] 1'] = ( + 'curl -i -X GET \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' -H "Accept: application/json" --user admin:admin' +) -snapshots['test_fixture[build_curl_command-fixture_008] 1'] = 'curl -i -X GET \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' -H "Accept: application/json" -H "Accept-Encoding: gzip, deflate" -H "Cookie: zyx 123" -H "If-None-Match: "\'"\'"abc123"\'"\' -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"' +snapshots['test_fixture[build_curl_command-fixture_008] 1'] = ( + 'curl -i -X GET \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' -H "Accept: application/json" -H "Accept-Encoding: gzip, deflate" -H "Cookie: zyx 123" -H "If-None-Match: "\'"\'"abc123"\'"\' -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"' +) -snapshots['test_fixture[build_curl_command-fixture_009] 1'] = 'curl -i -X PATCH http://localhost:8080/etc/fstab -H "Accept: application/vnd.acme+json" -H "Accept-Encoding: gzip, deflate" -H "Content-Type: application/vnd.acme+json; charset=utf-8" -H "If-None-Match: "\'"\'"abc123"\'"\' -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" --data-raw \'{"/": {"fstype": "btrfs", "readonly": true, "storage": {"device": "/dev/sda1", "type": "disk"}}, "/tmp": {"storage": {"sizeInMB": 64, "type": "tmpfs"}}, "/var": {"fstype": "ext4", "options": ["nosuid"], "storage": {"label": "8f3ba6f4-5c70-46ec-83af-0d5434953e5f", "type": "disk"}}, "/var/www": {"storage": {"remotePath": "/exports/mypath", "server": "my.nfs.server", "type": "nfs"}}}\'' +snapshots['test_fixture[build_curl_command-fixture_009] 1'] = ( + 'curl -i -X PATCH http://localhost:8080/etc/fstab -H "Accept: application/vnd.acme+json" -H "Accept-Encoding: gzip, deflate" -H "Content-Type: application/vnd.acme+json; charset=utf-8" -H "If-None-Match: "\'"\'"abc123"\'"\' -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" --data-raw \'{"/": {"fstype": "btrfs", "readonly": true, "storage": {"device": "/dev/sda1", "type": "disk"}}, "/tmp": {"storage": {"sizeInMB": 64, "type": "tmpfs"}}, "/var": {"fstype": "ext4", "options": ["nosuid"], "storage": {"label": "8f3ba6f4-5c70-46ec-83af-0d5434953e5f", "type": "disk"}}, "/var/www": {"storage": {"remotePath": "/exports/mypath", "server": "my.nfs.server", "type": "nfs"}}}\'' +) -snapshots['test_fixture[build_curl_command-fixture_011] 1'] = 'curl -i -X GET \'http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc\' -H "Accept: application/json" --user admin:admin' +snapshots['test_fixture[build_curl_command-fixture_011] 1'] = ( + 'curl -i -X GET \'http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc\' -H "Accept: application/json" --user admin:admin' +) -snapshots['test_fixture[build_curl_command-fixture_012] 1'] = 'curl -i -X POST http://localhost:8080/metrics -H "Accept: application/json" -H "Content-Type: application/json" --data-raw \'{"max": 0.2, "min": 0.1}\' --user admin:admin' +snapshots['test_fixture[build_curl_command-fixture_012] 1'] = ( + 'curl -i -X POST http://localhost:8080/metrics -H "Accept: application/json" -H "Content-Type: application/json" --data-raw \'{"max": 0.2, "min": 0.1}\' --user admin:admin' +) -snapshots['test_fixture[build_curl_command-fixture_013] 1'] = 'curl -i -X POST http://localhost:8080/@@oauth2-token -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" --data-raw \'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED\'' +snapshots['test_fixture[build_curl_command-fixture_013] 1'] = ( + 'curl -i -X POST http://localhost:8080/@@oauth2-token -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" --data-raw \'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED\'' +) -snapshots['test_fixture[build_curl_command-fixture_014] 1'] = 'curl -i -X POST http://localhost:8080/@@oauth2-token -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" --data-raw \'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED\'' +snapshots['test_fixture[build_curl_command-fixture_014] 1'] = ( + 'curl -i -X POST http://localhost:8080/@@oauth2-token -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" --data-raw \'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED\'' +) -snapshots['test_fixture[build_httpie_command-fixture_001] 1'] = 'http http://localhost:8080/Plone/front-page Accept:application/json -a admin:admin' +snapshots['test_fixture[build_httpie_command-fixture_001] 1'] = ( + 'http http://localhost:8080/Plone/front-page Accept:application/json -a admin:admin' +) -snapshots['test_fixture[build_httpie_command-fixture_002] 1'] = '''echo '{ +snapshots[ + 'test_fixture[build_httpie_command-fixture_002] 1' +] = '''echo '{ "@type": "Document", "title": "My Document" }' | http POST http://localhost:8080/Plone/folder Accept:application/json Content-Type:application/json -a admin:admin''' -snapshots['test_fixture[build_httpie_command-fixture_003] 1'] = '''echo '{ +snapshots[ + 'test_fixture[build_httpie_command-fixture_003] 1' +] = '''echo '{ "title": "My New Document Title" }' | http PATCH http://localhost:8080/Plone/folder/my-document Accept:application/json Content-Type:application/json -a admin:admin''' -snapshots['test_fixture[build_httpie_command-fixture_004] 1'] = 'http http://localhost:8080/Plone/front-page Accept:application/json' +snapshots['test_fixture[build_httpie_command-fixture_004] 1'] = ( + 'http http://localhost:8080/Plone/front-page Accept:application/json' +) -snapshots['test_fixture[build_httpie_command-fixture_005] 1'] = 'http http://localhost:8080/Plone/front-page Accept:application/json Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI"' +snapshots['test_fixture[build_httpie_command-fixture_005] 1'] = ( + 'http http://localhost:8080/Plone/front-page Accept:application/json Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI"' +) -snapshots['test_fixture[build_httpie_command-fixture_006] 1'] = 'echo defgh | http PATCH http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f Accept:application/json Content-Type:"application/offset+octet-stream" Tus-Resumable:1.0.0 Upload-Offset:3 -a admin:secret' +snapshots['test_fixture[build_httpie_command-fixture_006] 1'] = ( + 'echo defgh | http PATCH http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f Accept:application/json Content-Type:"application/offset+octet-stream" Tus-Resumable:1.0.0 Upload-Offset:3 -a admin:secret' +) -snapshots['test_fixture[build_httpie_command-fixture_007] 1'] = "http 'http://localhost:8080/Plone/front-page?foo=bar&bar=foo' Accept:application/json -a admin:admin" +snapshots['test_fixture[build_httpie_command-fixture_007] 1'] = ( + "http 'http://localhost:8080/Plone/front-page?foo=bar&bar=foo' Accept:application/json -a admin:admin" +) -snapshots['test_fixture[build_httpie_command-fixture_008] 1'] = 'http \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' Accept:application/json Accept-Encoding:"gzip, deflate" Cookie:"zyx 123" If-None-Match:\'"\'"abc123"\'"\' Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"' +snapshots['test_fixture[build_httpie_command-fixture_008] 1'] = ( + 'http \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' Accept:application/json Accept-Encoding:"gzip, deflate" Cookie:"zyx 123" If-None-Match:\'"\'"abc123"\'"\' Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"' +) -snapshots['test_fixture[build_httpie_command-fixture_009] 1'] = '''echo '{ +snapshots[ + 'test_fixture[build_httpie_command-fixture_009] 1' +] = '''echo '{ "/": { "fstype": "btrfs", "readonly": true, @@ -88,55 +132,81 @@ } }\' | http PATCH http://localhost:8080/etc/fstab Accept:application/vnd.acme+json Accept-Encoding:"gzip, deflate" Content-Type:"application/vnd.acme+json; charset=utf-8" If-None-Match:\'"\'"abc123"\'"\' Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"''' -snapshots['test_fixture[build_httpie_command-fixture_011] 1'] = "http 'http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc' Accept:application/json -a admin:admin" +snapshots['test_fixture[build_httpie_command-fixture_011] 1'] = ( + "http 'http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc' Accept:application/json -a admin:admin" +) -snapshots['test_fixture[build_httpie_command-fixture_012] 1'] = '''echo '{ +snapshots[ + 'test_fixture[build_httpie_command-fixture_012] 1' +] = '''echo '{ "max": 0.2, "min": 0.1 }' | http POST http://localhost:8080/metrics Accept:application/json Content-Type:application/json -a admin:admin''' -snapshots['test_fixture[build_httpie_command-fixture_013] 1'] = 'echo \'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED\' | http POST http://localhost:8080/@@oauth2-token Accept:application/json Content-Type:"application/x-www-form-urlencoded"' +snapshots['test_fixture[build_httpie_command-fixture_013] 1'] = ( + 'echo \'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED\' | http POST http://localhost:8080/@@oauth2-token Accept:application/json Content-Type:"application/x-www-form-urlencoded"' +) -snapshots['test_fixture[build_httpie_command-fixture_014] 1'] = 'echo \'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED\' | http POST http://localhost:8080/@@oauth2-token Accept:application/json Content-Type:"application/x-www-form-urlencoded"' +snapshots['test_fixture[build_httpie_command-fixture_014] 1'] = ( + 'echo \'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED\' | http POST http://localhost:8080/@@oauth2-token Accept:application/json Content-Type:"application/x-www-form-urlencoded"' +) -snapshots['test_fixture[build_plone_javascript_command-fixture_001] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_001] 1' +] = '''createAliasesMutation | const aliasesData = '';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_002] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_002] 1' +] = '''createAliasesMutation | const aliasesData = '{ "@type": "Document", "title": "My Document" }';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_003] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_003] 1' +] = '''createAliasesMutation | const aliasesData = '{ "title": "My New Document Title" }';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_004] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_004] 1' +] = '''createAliasesMutation | const aliasesData = '';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_005] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_005] 1' +] = '''createAliasesMutation | const aliasesData = '';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_006] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_006] 1' +] = '''createAliasesMutation | const aliasesData = 'defgh';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_007] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_007] 1' +] = '''createAliasesMutation | const aliasesData = '';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_008] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_008] 1' +] = '''createAliasesMutation | const aliasesData = '';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_009] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_009] 1' +] = '''createAliasesMutation | const aliasesData = '{ "/": { @@ -172,73 +242,133 @@ } }';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_011] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_011] 1' +] = '''createAliasesMutation | const aliasesData = '';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_012] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_012] 1' +] = '''createAliasesMutation | const aliasesData = '{ "max": 0.2, "min": 0.1 }';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_013] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_013] 1' +] = '''createAliasesMutation | const aliasesData = 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED';''' -snapshots['test_fixture[build_plone_javascript_command-fixture_014] 1'] = '''createAliasesMutation +snapshots[ + 'test_fixture[build_plone_javascript_command-fixture_014] 1' +] = '''createAliasesMutation | const aliasesData = 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED';''' -snapshots['test_fixture[build_requests_command-fixture_001] 1'] = "requests.get('http://localhost:8080/Plone/front-page', headers={'Accept': 'application/json'}, auth=('admin', 'admin'))" +snapshots['test_fixture[build_requests_command-fixture_001] 1'] = ( + "requests.get('http://localhost:8080/Plone/front-page', headers={'Accept': 'application/json'}, auth=('admin', 'admin'))" +) -snapshots['test_fixture[build_requests_command-fixture_002] 1'] = "requests.post('http://localhost:8080/Plone/folder', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'@type': 'Document', 'title': 'My Document'}, auth=('admin', 'admin'))" +snapshots['test_fixture[build_requests_command-fixture_002] 1'] = ( + "requests.post('http://localhost:8080/Plone/folder', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'@type': 'Document', 'title': 'My Document'}, auth=('admin', 'admin'))" +) -snapshots['test_fixture[build_requests_command-fixture_003] 1'] = "requests.patch('http://localhost:8080/Plone/folder/my-document', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'title': 'My New Document Title'}, auth=('admin', 'admin'))" +snapshots['test_fixture[build_requests_command-fixture_003] 1'] = ( + "requests.patch('http://localhost:8080/Plone/folder/my-document', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'title': 'My New Document Title'}, auth=('admin', 'admin'))" +) -snapshots['test_fixture[build_requests_command-fixture_004] 1'] = "requests.get('http://localhost:8080/Plone/front-page', headers={'Accept': 'application/json'})" +snapshots['test_fixture[build_requests_command-fixture_004] 1'] = ( + "requests.get('http://localhost:8080/Plone/front-page', headers={'Accept': 'application/json'})" +) -snapshots['test_fixture[build_requests_command-fixture_005] 1'] = "requests.get('http://localhost:8080/Plone/front-page', headers={'Accept': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI'})" +snapshots['test_fixture[build_requests_command-fixture_005] 1'] = ( + "requests.get('http://localhost:8080/Plone/front-page', headers={'Accept': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI'})" +) -snapshots['test_fixture[build_requests_command-fixture_006] 1'] = "requests.patch('http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f', headers={'Accept': 'application/json', 'Content-Type': 'application/offset+octet-stream', 'Tus-Resumable': '1.0.0', 'Upload-Offset': '3'}, data='defgh', auth=('admin', 'secret'))" +snapshots['test_fixture[build_requests_command-fixture_006] 1'] = ( + "requests.patch('http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f', headers={'Accept': 'application/json', 'Content-Type': 'application/offset+octet-stream', 'Tus-Resumable': '1.0.0', 'Upload-Offset': '3'}, data='defgh', auth=('admin', 'secret'))" +) -snapshots['test_fixture[build_requests_command-fixture_007] 1'] = "requests.get('http://localhost:8080/Plone/front-page?foo=bar&bar=foo', headers={'Accept': 'application/json'}, auth=('admin', 'admin'))" +snapshots['test_fixture[build_requests_command-fixture_007] 1'] = ( + "requests.get('http://localhost:8080/Plone/front-page?foo=bar&bar=foo', headers={'Accept': 'application/json'}, auth=('admin', 'admin'))" +) -snapshots['test_fixture[build_requests_command-fixture_008] 1'] = 'requests.get(\'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\', headers={\'Accept\': \'application/json\', \'Accept-Encoding\': \'gzip, deflate\', \'Cookie\': \'zyx 123\', \'If-None-Match\': \'"abc123"\', \'Authorization\': \'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\'})' +snapshots['test_fixture[build_requests_command-fixture_008] 1'] = ( + 'requests.get(\'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\', headers={\'Accept\': \'application/json\', \'Accept-Encoding\': \'gzip, deflate\', \'Cookie\': \'zyx 123\', \'If-None-Match\': \'"abc123"\', \'Authorization\': \'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\'})' +) -snapshots['test_fixture[build_requests_command-fixture_009] 1'] = 'requests.patch(\'http://localhost:8080/etc/fstab\', headers={\'Accept\': \'application/vnd.acme+json\', \'Accept-Encoding\': \'gzip, deflate\', \'Content-Type\': \'application/vnd.acme+json; charset=utf-8\', \'If-None-Match\': \'"abc123"\', \'Authorization\': \'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\'}, json={\'/\': {\'fstype\': \'btrfs\', \'readonly\': True, \'storage\': {\'device\': \'/dev/sda1\', \'type\': \'disk\'}}, \'/tmp\': {\'storage\': {\'sizeInMB\': 64, \'type\': \'tmpfs\'}}, \'/var\': {\'fstype\': \'ext4\', \'options\': [\'nosuid\'], \'storage\': {\'label\': \'8f3ba6f4-5c70-46ec-83af-0d5434953e5f\', \'type\': \'disk\'}}, \'/var/www\': {\'storage\': {\'remotePath\': \'/exports/mypath\', \'server\': \'my.nfs.server\', \'type\': \'nfs\'}}})' +snapshots['test_fixture[build_requests_command-fixture_009] 1'] = ( + 'requests.patch(\'http://localhost:8080/etc/fstab\', headers={\'Accept\': \'application/vnd.acme+json\', \'Accept-Encoding\': \'gzip, deflate\', \'Content-Type\': \'application/vnd.acme+json; charset=utf-8\', \'If-None-Match\': \'"abc123"\', \'Authorization\': \'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\'}, json={\'/\': {\'fstype\': \'btrfs\', \'readonly\': True, \'storage\': {\'device\': \'/dev/sda1\', \'type\': \'disk\'}}, \'/tmp\': {\'storage\': {\'sizeInMB\': 64, \'type\': \'tmpfs\'}}, \'/var\': {\'fstype\': \'ext4\', \'options\': [\'nosuid\'], \'storage\': {\'label\': \'8f3ba6f4-5c70-46ec-83af-0d5434953e5f\', \'type\': \'disk\'}}, \'/var/www\': {\'storage\': {\'remotePath\': \'/exports/mypath\', \'server\': \'my.nfs.server\', \'type\': \'nfs\'}}})' +) -snapshots['test_fixture[build_requests_command-fixture_011] 1'] = "requests.get('http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc', headers={'Accept': 'application/json'}, auth=('admin', 'admin'))" +snapshots['test_fixture[build_requests_command-fixture_011] 1'] = ( + "requests.get('http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc', headers={'Accept': 'application/json'}, auth=('admin', 'admin'))" +) -snapshots['test_fixture[build_requests_command-fixture_012] 1'] = "requests.post('http://localhost:8080/metrics', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'max': 0.2, 'min': 0.1}, auth=('admin', 'admin'))" +snapshots['test_fixture[build_requests_command-fixture_012] 1'] = ( + "requests.post('http://localhost:8080/metrics', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'max': 0.2, 'min': 0.1}, auth=('admin', 'admin'))" +) -snapshots['test_fixture[build_requests_command-fixture_013] 1'] = "requests.post('http://localhost:8080/@@oauth2-token', headers={'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}, data={'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion': 'REDACTED'})" +snapshots['test_fixture[build_requests_command-fixture_013] 1'] = ( + "requests.post('http://localhost:8080/@@oauth2-token', headers={'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}, data={'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion': 'REDACTED'})" +) -snapshots['test_fixture[build_requests_command-fixture_014] 1'] = "requests.post('http://localhost:8080/@@oauth2-token', headers={'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}, data={'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion': 'REDACTED'})" +snapshots['test_fixture[build_requests_command-fixture_014] 1'] = ( + "requests.post('http://localhost:8080/@@oauth2-token', headers={'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}, data={'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion': 'REDACTED'})" +) -snapshots['test_fixture[build_wget_command-fixture_001] 1'] = 'wget -S -O- http://localhost:8080/Plone/front-page --header="Accept: application/json" --auth-no-challenge --user=admin --password=admin' +snapshots['test_fixture[build_wget_command-fixture_001] 1'] = ( + 'wget -S -O- http://localhost:8080/Plone/front-page --header="Accept: application/json" --auth-no-challenge --user=admin --password=admin' +) -snapshots['test_fixture[build_wget_command-fixture_002] 1'] = 'wget -S -O- http://localhost:8080/Plone/folder --header="Accept: application/json" --header="Content-Type: application/json" --post-data=\'{"@type": "Document", "title": "My Document"}\' --auth-no-challenge --user=admin --password=admin' +snapshots['test_fixture[build_wget_command-fixture_002] 1'] = ( + 'wget -S -O- http://localhost:8080/Plone/folder --header="Accept: application/json" --header="Content-Type: application/json" --post-data=\'{"@type": "Document", "title": "My Document"}\' --auth-no-challenge --user=admin --password=admin' +) -snapshots['test_fixture[build_wget_command-fixture_003] 1'] = 'wget -S -O- --method=PATCH http://localhost:8080/Plone/folder/my-document --header="Accept: application/json" --header="Content-Type: application/json" --body-data=\'{"title": "My New Document Title"}\' --auth-no-challenge --user=admin --password=admin' +snapshots['test_fixture[build_wget_command-fixture_003] 1'] = ( + 'wget -S -O- --method=PATCH http://localhost:8080/Plone/folder/my-document --header="Accept: application/json" --header="Content-Type: application/json" --body-data=\'{"title": "My New Document Title"}\' --auth-no-challenge --user=admin --password=admin' +) -snapshots['test_fixture[build_wget_command-fixture_004] 1'] = 'wget -S -O- http://localhost:8080/Plone/front-page --header="Accept: application/json"' +snapshots['test_fixture[build_wget_command-fixture_004] 1'] = ( + 'wget -S -O- http://localhost:8080/Plone/front-page --header="Accept: application/json"' +) -snapshots['test_fixture[build_wget_command-fixture_005] 1'] = 'wget -S -O- http://localhost:8080/Plone/front-page --header="Accept: application/json" --header="Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI"' +snapshots['test_fixture[build_wget_command-fixture_005] 1'] = ( + 'wget -S -O- http://localhost:8080/Plone/front-page --header="Accept: application/json" --header="Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmdWxsbmFtZSI6IiIsInN1YiI6ImFkbWluIiwiZXhwIjoxNDY0MDQyMTAzfQ.aOyvMwdcIMV6pzC0GYQ3ZMdGaHR1_W7DxT0W0ok4FxI"' +) -snapshots['test_fixture[build_wget_command-fixture_006] 1'] = 'wget -S -O- --method=PATCH http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f --header="Accept: application/json" --header="Content-Type: application/offset+octet-stream" --header="Tus-Resumable: 1.0.0" --header="Upload-Offset: 3" --body-data=\'defgh\' --auth-no-challenge --user=admin --password=secret' +snapshots['test_fixture[build_wget_command-fixture_006] 1'] = ( + 'wget -S -O- --method=PATCH http://nohost/plone/folder/@upload/032803b64ad746b3ab46d9223ea3d90f --header="Accept: application/json" --header="Content-Type: application/offset+octet-stream" --header="Tus-Resumable: 1.0.0" --header="Upload-Offset: 3" --body-data=\'defgh\' --auth-no-challenge --user=admin --password=secret' +) -snapshots['test_fixture[build_wget_command-fixture_007] 1'] = 'wget -S -O- \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' --header="Accept: application/json" --auth-no-challenge --user=admin --password=admin' +snapshots['test_fixture[build_wget_command-fixture_007] 1'] = ( + 'wget -S -O- \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' --header="Accept: application/json" --auth-no-challenge --user=admin --password=admin' +) -snapshots['test_fixture[build_wget_command-fixture_008] 1'] = 'wget -S -O- \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' --header="Accept: application/json" --header="Accept-Encoding: gzip, deflate" --header="Cookie: zyx 123" --header="If-None-Match: "\'"\'"abc123"\'"\' --header="Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"' +snapshots['test_fixture[build_wget_command-fixture_008] 1'] = ( + 'wget -S -O- \'http://localhost:8080/Plone/front-page?foo=bar&bar=foo\' --header="Accept: application/json" --header="Accept-Encoding: gzip, deflate" --header="Cookie: zyx 123" --header="If-None-Match: "\'"\'"abc123"\'"\' --header="Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"' +) -snapshots['test_fixture[build_wget_command-fixture_009] 1'] = 'wget -S -O- --method=PATCH http://localhost:8080/etc/fstab --header="Accept: application/vnd.acme+json" --header="Accept-Encoding: gzip, deflate" --header="Content-Type: application/vnd.acme+json; charset=utf-8" --header="If-None-Match: "\'"\'"abc123"\'"\' --header="Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" --body-data=\'{"/": {"fstype": "btrfs", "readonly": true, "storage": {"device": "/dev/sda1", "type": "disk"}}, "/tmp": {"storage": {"sizeInMB": 64, "type": "tmpfs"}}, "/var": {"fstype": "ext4", "options": ["nosuid"], "storage": {"label": "8f3ba6f4-5c70-46ec-83af-0d5434953e5f", "type": "disk"}}, "/var/www": {"storage": {"remotePath": "/exports/mypath", "server": "my.nfs.server", "type": "nfs"}}}\'' +snapshots['test_fixture[build_wget_command-fixture_009] 1'] = ( + 'wget -S -O- --method=PATCH http://localhost:8080/etc/fstab --header="Accept: application/vnd.acme+json" --header="Accept-Encoding: gzip, deflate" --header="Content-Type: application/vnd.acme+json; charset=utf-8" --header="If-None-Match: "\'"\'"abc123"\'"\' --header="Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" --body-data=\'{"/": {"fstype": "btrfs", "readonly": true, "storage": {"device": "/dev/sda1", "type": "disk"}}, "/tmp": {"storage": {"sizeInMB": 64, "type": "tmpfs"}}, "/var": {"fstype": "ext4", "options": ["nosuid"], "storage": {"label": "8f3ba6f4-5c70-46ec-83af-0d5434953e5f", "type": "disk"}}, "/var/www": {"storage": {"remotePath": "/exports/mypath", "server": "my.nfs.server", "type": "nfs"}}}\'' +) -snapshots['test_fixture[build_wget_command-fixture_011] 1'] = 'wget -S -O- \'http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc\' --header="Accept: application/json" --auth-no-challenge --user=admin --password=admin' +snapshots['test_fixture[build_wget_command-fixture_011] 1'] = ( + 'wget -S -O- \'http://localhost/items?user_id=12&user_id=13&from=20170101&to=20171231&user_id=15&limit=20&sort=date-asc\' --header="Accept: application/json" --auth-no-challenge --user=admin --password=admin' +) -snapshots['test_fixture[build_wget_command-fixture_012] 1'] = 'wget -S -O- http://localhost:8080/metrics --header="Accept: application/json" --header="Content-Type: application/json" --post-data=\'{"max": 0.2, "min": 0.1}\' --auth-no-challenge --user=admin --password=admin' +snapshots['test_fixture[build_wget_command-fixture_012] 1'] = ( + 'wget -S -O- http://localhost:8080/metrics --header="Accept: application/json" --header="Content-Type: application/json" --post-data=\'{"max": 0.2, "min": 0.1}\' --auth-no-challenge --user=admin --password=admin' +) -snapshots['test_fixture[build_wget_command-fixture_013] 1'] = 'wget -S -O- http://localhost:8080/@@oauth2-token --header="Accept: application/json" --header="Content-Type: application/x-www-form-urlencoded" --post-data=\'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED\'' +snapshots['test_fixture[build_wget_command-fixture_013] 1'] = ( + 'wget -S -O- http://localhost:8080/@@oauth2-token --header="Accept: application/json" --header="Content-Type: application/x-www-form-urlencoded" --post-data=\'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED\'' +) -snapshots['test_fixture[build_wget_command-fixture_014] 1'] = 'wget -S -O- http://localhost:8080/@@oauth2-token --header="Accept: application/json" --header="Content-Type: application/x-www-form-urlencoded" --post-data=\'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED\'' +snapshots['test_fixture[build_wget_command-fixture_014] 1'] = ( + 'wget -S -O- http://localhost:8080/@@oauth2-token --header="Accept: application/json" --header="Content-Type: application/x-www-form-urlencoded" --post-data=\'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED\'' +) diff --git a/tests/test_builders.py b/tests/test_builders.py index aff546a..1528b57 100644 --- a/tests/test_builders.py +++ b/tests/test_builders.py @@ -44,13 +44,17 @@ request_fixtures, ids=[fixture['name'] for fixture in request_fixtures], ) -@pytest.mark.parametrize('builder', ( - build_httpie_command, - build_curl_command, - build_wget_command, - build_requests_command, - build_plone_javascript_command, -), ids=lambda fn: fn.__name__) +@pytest.mark.parametrize( + 'builder', + ( + build_httpie_command, + build_curl_command, + build_wget_command, + build_requests_command, + build_plone_javascript_command, + ), + ids=lambda fn: fn.__name__, +) def test_fixture(request_fixture, builder, snapshot): command = builder(parse_request(request_fixture['data'])) snapshot.assert_match(command) diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 05046e6..f1161eb 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -3,8 +3,12 @@ def read_fixture(filename): - with open(os.path.join(os.path.dirname(__file__), 'fixtures', filename)) as fp: # noqa - return (lambda s: isinstance(s, bytes) and s or s.encode('utf-8'))(fp.read().strip()) # noqa + with open( + os.path.join(os.path.dirname(__file__), 'fixtures', filename) + ) as fp: # noqa + return (lambda s: isinstance(s, bytes) and s or s.encode('utf-8'))( + fp.read().strip() + ) # noqa FIXTURE_001_REQUEST = read_fixture('001.request.txt') diff --git a/tests/test_parsers.py b/tests/test_parsers.py index 69577a4..3ae3561 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -63,10 +63,12 @@ def test_parse_request_data(): def test_parse_bad_request(): with pytest.raises(Exception): - parsers.parse_request(b"""\ + parsers.parse_request( + b"""\ POST /Plone/folder Host: localhost:8080 -""") +""" + ) def test_parse_json_list(): @@ -81,11 +83,13 @@ def test_parse_extract_fields(): request = parsers.parse_request(FIXTURE_011_REQUEST) fields, remainder = request.extract_fields('query') - expected = [('query', 'from', '20170101'), - ('query', 'to', '20171231'), - ('query', 'user_id', '15'), - ('query', 'limit', '20'), - ('query', 'sort', 'date-asc'), ] + expected = [ + ('query', 'from', '20170101'), + ('query', 'to', '20171231'), + ('query', 'user_id', '15'), + ('query', 'limit', '20'), + ('query', 'sort', 'date-asc'), + ] actual = fields assert expected == actual @@ -98,14 +102,17 @@ def test_parse_extract_fields(): request_future_proof = FIXTURE_011_REQUEST + add request = parsers.parse_request(request_future_proof) fields, remainder = request.extract_fields( - field=None, available_fields=['query', 'some-future-field']) - - expected = [('query', 'from', '20170101'), - ('query', 'to', '20171231'), - ('query', 'user_id', '15'), - ('query', 'limit', '20'), - ('query', 'sort', 'date-asc'), - ('some-future-field', 'foo', 'bar'), ] + field=None, available_fields=['query', 'some-future-field'] + ) + + expected = [ + ('query', 'from', '20170101'), + ('query', 'to', '20171231'), + ('query', 'user_id', '15'), + ('query', 'limit', '20'), + ('query', 'sort', 'date-asc'), + ('some-future-field', 'foo', 'bar'), + ] actual = fields assert expected == actual @@ -120,5 +127,5 @@ def test_parse_extract_fields(): with pytest.raises(ValueError): fields, remainder = request.extract_fields( - field='invalid-field', - available_fields=['query', 'some-future-field']) + field='invalid-field', available_fields=['query', 'some-future-field'] + ) diff --git a/tests/test_utils.py b/tests/test_utils.py index fdc9f77..04cbd87 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -15,7 +15,9 @@ def test_resolve_path(): cwd = os.path.dirname(__file__) base = os.path.basename(__file__) assert utils.resolve_path(base, cwd) == __file__ - assert utils.resolve_path('sphinxcontrib.httpexample:utils.py') == utils.__file__ # noqa + assert ( + utils.resolve_path('sphinxcontrib.httpexample:utils.py') == utils.__file__ + ) # noqa assert utils.resolve_path('bar', 'non-existing') == 'bar' @@ -33,24 +35,15 @@ def test_capitalize(): def test_capitalize_dict(): d = {'content-type': 'application/json'} - assert utils.capitalize_keys(d) == { - 'Content-Type': 'application/json' - } + assert utils.capitalize_keys(d) == {'Content-Type': 'application/json'} def test_ordered(): - data = { - 'd': { - 'f': {}, - 'e': {} - }, - 'a': { - 'c': {}, - 'b': {} - } - } - assert json.dumps(utils.ordered(data)) == \ - '{"a": {"b": {}, "c": {}}, "d": {"e": {}, "f": {}}}' + data = {'d': {'f': {}, 'e': {}}, 'a': {'c': {}, 'b': {}}} + assert ( + json.dumps(utils.ordered(data)) + == '{"a": {"b": {}, "c": {}}, "d": {"e": {}, "f": {}}}' + ) def test_add_url_params(): @@ -63,8 +56,7 @@ def test_add_url_params(): url = url + '?user_id=2' params += [('user_id', 3)] - expected = ('www.api.com/items?user_id=2&from=20180101' - '&to=20180131&user_id=3') + expected = 'www.api.com/items?user_id=2&from=20180101' '&to=20180131&user_id=3' actual = utils.add_url_params(url, params) assert expected == actual @@ -74,13 +66,16 @@ def test_add_url_params(): assert expected == actual -@pytest.mark.parametrize('ctype,expected', ( - ('application/json', True), - ('application/json; charset=utf-8', True), - ('application/vnd.acme+json', True), - ('application/vnd.acme+json; charset=utf-8; profile="/foo.schema"', True), - ('application/octet-stream', False), - ('', False), -)) +@pytest.mark.parametrize( + 'ctype,expected', + ( + ('application/json', True), + ('application/json; charset=utf-8', True), + ('application/vnd.acme+json', True), + ('application/vnd.acme+json; charset=utf-8; profile="/foo.schema"', True), + ('application/octet-stream', False), + ('', False), + ), +) def test_is_json(ctype, expected): assert utils.is_json(ctype) is expected From dedce9d6046254d4881bbee864c7b7c6578cd88f Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Sun, 18 Aug 2024 14:40:21 +0300 Subject: [PATCH 4/5] chore: Update requirements.txt(s) to match the current dependencies on Python 3 --- docs/requirements.txt | 27 ++++----------------------- requirements.txt | 33 +++++++++++++-------------------- setup.cfg | 1 - 3 files changed, 17 insertions(+), 44 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 6ba42b9..67991ba 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,28 +1,9 @@ -Jinja2 -MarkupSafe astunparse -coverage -coveralls -docutils==0.17.1 -flake8-blind-except -flake8-coding -flake8-debugger -flake8-isort -flake8-quotes -idna -isort -pep8-naming -pytest -pytest-cov==2.12.1 -pytest-runner -pyyaml -rst2pdf -snapshottest==0.5.0 +docutils +setuptools sphinx +sphinxcontrib-httpdomain sphinx-design sphinx-inline-tabs -sphinx-testing -sphinx_rtd_theme -sphinxcontrib-httpdomain -toml +sphinx-rtd-theme . diff --git a/requirements.txt b/requirements.txt index 66f3d74..710d92e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,25 +1,18 @@ -Jinja2 -MarkupSafe +# Direct dependencies astunparse +docutils +sphinxcontrib-httpdomain +setuptools +sphinx +# Test and development dependencies +black coverage -coveralls -docutils==0.17.1 -flake8-blind-except -flake8-coding -flake8-debugger -flake8-isort -flake8-quotes -idna -isort -pep8-naming pytest -pytest-cov==2.12.1 pytest-runner -pyyaml -rst2pdf -snapshottest==0.5.0 -sphinx +pytest-cov +isort +snapshottest sphinx-testing -sphinx_rtd_theme -sphinxcontrib-httpdomain -toml +flake8 +sphinx-rtd-theme +coveralls diff --git a/setup.cfg b/setup.cfg index 9aab141..fa04764 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,6 @@ classifiers = [options] setup_requires = pytest-runner - wheel install_requires = astunparse docutils From 63ea99d76e9a77371fa178ef9e6a1d43bfc8f431 Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Sun, 18 Aug 2024 14:20:54 +0300 Subject: [PATCH 5/5] ci: Skip coveralls push on pull request builds --- .github/workflows/build.yml | 1 + Makefile | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a7dbc0..0792231 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,7 @@ jobs: docutils: docutils020 env: COVERALLS_REPO_TOKEN: ${{ secrets.github_token }} + COVERALLS_SERVICE_NAME: github steps: - uses: actions/checkout@v4.1.1 - uses: cachix/install-nix-action@v25 diff --git a/Makefile b/Makefile index db29682..66f8fa0 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,9 @@ coverage: .coverage .PHONY: coveralls coveralls: .coverage - coveralls --service=github +ifeq ($(GITHUB_BASE_REF),) + coveralls +endif .PHONY: format format: @@ -87,3 +89,22 @@ every\ poetry\ add\ --dev\ %: PYTHON=python311 FEATURE=docutils018 $(MAKE) poetry\ add\ --dev\ $* PYTHON=python311 FEATURE=docutils019 $(MAKE) poetry\ add\ --dev\ $* PYTHON=python311 FEATURE=docutils020 $(MAKE) poetry\ add\ --dev\ $* + +test\ all: + PYTHON=python27 FEATURE=docutils016 $(MAKE) nix-test + PYTHON=python27 FEATURE=docutils017 $(MAKE) nix-test + PYTHON=python39 FEATURE=docutils016 $(MAKE) nix-test + PYTHON=python39 FEATURE=docutils017 $(MAKE) nix-test + PYTHON=python39 FEATURE=docutils018 $(MAKE) nix-test + PYTHON=python39 FEATURE=docutils019 $(MAKE) nix-test + PYTHON=python39 FEATURE=docutils020 $(MAKE) nix-test + PYTHON=python310 FEATURE=docutils016 $(MAKE) nix-test + PYTHON=python310 FEATURE=docutils017 $(MAKE) nix-test + PYTHON=python310 FEATURE=docutils018 $(MAKE) nix-test + PYTHON=python310 FEATURE=docutils019 $(MAKE) nix-test + PYTHON=python310 FEATURE=docutils020 $(MAKE) nix-test + PYTHON=python311 FEATURE=docutils016 $(MAKE) nix-test + PYTHON=python311 FEATURE=docutils017 $(MAKE) nix-test + PYTHON=python311 FEATURE=docutils018 $(MAKE) nix-test + PYTHON=python311 FEATURE=docutils019 $(MAKE) nix-test + PYTHON=python311 FEATURE=docutils020 $(MAKE) nix-test