From 8b00da13ec38900d470b7eb08bbcdce5013cb142 Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Mon, 18 Jul 2022 09:38:30 +0200 Subject: [PATCH] Fix RTD build (#114) --- docs/conf.py | 46 +++++++++++++++++++++++++++++++++++-------- parselglossy/types.py | 17 ++++++++-------- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 1955449..0257b81 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,32 @@ # -*- coding: utf-8 -*- +# +# parselglossy -- Generic input parsing library, speaking in tongues +# Copyright (C) 2020 Roberto Di Remigio, Radovan Bast, and contributors. +# +# This file is part of parselglossy. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# For information on the complete list of contributors to the +# parselglossy library, see: + import pathlib import sys @@ -12,18 +39,23 @@ # -- General configuration --------------------------------------------- -extensions = ["sphinx.ext.napoleon", "sphinx.ext.viewcode", "sphinx_inline_tabs", "sphinx_copybutton"] +extensions = [ + "sphinx.ext.napoleon", + "sphinx.ext.viewcode", + "sphinx_inline_tabs", + "sphinx_copybutton", +] templates_path = ["_templates"] source_suffix = ".rst" master_doc = "index" -project = u"parselglossy" -copyright = u"2018, dev-cafe" +project = "parselglossy" +copyright = "2018, dev-cafe" author = _author # The short X.Y version. version = _version # The full version, including alpha/beta/rc tags. release = _version -language = None +language = "en" exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] pygments_style = "sphinx" todo_include_todos = False @@ -32,10 +64,8 @@ html_title = "parselglossy Documentation" html_short_title = f"parselglossy {version}" html_show_sourcelink = False -html_sidebars = { - "**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"] -} -html_theme = 'furo' +html_sidebars = {"**": ["globaltoc.html", "localtoc.html"]} +html_theme = "furo" html_theme_options = { "source_repository": "https://github.com/dev-cafe/parselglossy/", "source_branch": "master", diff --git a/parselglossy/types.py b/parselglossy/types.py index faff564..39c2449 100644 --- a/parselglossy/types.py +++ b/parselglossy/types.py @@ -53,13 +53,12 @@ def type_matches(value: AllowedTypes, expected_type: str) -> Optional[bool]: Parameters ---------- value : AllowedTypes - Value whose type needs to be checked + Value whose type needs to be checked expected_type : str Notes ----- - Allowed types T are: `str`, `int`, `float`, `complex`, `bool`, - as well as `List[T]`. + Allowed types T are: `str`, `int`, `float`, `complex`, `bool`, as well as `List[T]`. Returns ------- @@ -68,18 +67,18 @@ def type_matches(value: AllowedTypes, expected_type: str) -> Optional[bool]: Raises ------ ValueError - If expected_type is not among the allowed types. + If expected_type is not among the allowed types. Notes ----- Complex numbers are a tad more fastidious, as they *might be* read in as strings. To avoid false negatives, we have a nasty hack, for which RDR will forever burn in hell. For complex and List[complex] we will re-run type - checking after type - casting if and only if: - - We expected complex and List[complex]. - - We got a str or List[str]. - - The string are in the right format for the type casting operator. + checking after type casting if and only if: + + - We expected complex and List[complex]. + - We got a str or List[str]. + - The string are in the right format for the type casting operator. """ # first verify whether expected_type is allowed