From 1a384a495eafc02a1fad5afe42ce3f01b60f7ed5 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 12 Feb 2024 11:21:06 +0100 Subject: [PATCH] Update black and reformat all. --- papyri/__init__.py | 1 - papyri/browser.py | 1 + papyri/core.py | 1 + papyri/miniserde.py | 1 - papyri/myst_ast.py | 3 ++- papyri/myst_serialiser.py | 1 - papyri/signature.py | 24 +++++++++++++++--------- papyri/tests/test_signatures.py | 1 + papyri/textual.py | 1 + papyri/vref.py | 1 - 10 files changed, 21 insertions(+), 14 deletions(-) diff --git a/papyri/__init__.py b/papyri/__init__.py index 60ea31d86..e9f2a062a 100644 --- a/papyri/__init__.py +++ b/papyri/__init__.py @@ -163,7 +163,6 @@ """ - import io import sys import zipfile diff --git a/papyri/browser.py b/papyri/browser.py index ad44f12f9..c60516f54 100755 --- a/papyri/browser.py +++ b/papyri/browser.py @@ -1,6 +1,7 @@ """ papyri browser """ + import sys from typing import List diff --git a/papyri/core.py b/papyri/core.py index 6fbff4df3..d7363c5f2 100644 --- a/papyri/core.py +++ b/papyri/core.py @@ -7,6 +7,7 @@ It should likely be the modules with the less dependencies as well as being synchronous, to be usable from most context and minimal installs. """ + from __future__ import annotations import json diff --git a/papyri/miniserde.py b/papyri/miniserde.py index 8e416f99f..b5b9a625f 100644 --- a/papyri/miniserde.py +++ b/papyri/miniserde.py @@ -64,7 +64,6 @@ """ - from functools import lru_cache from typing import Union from typing import get_type_hints as gth diff --git a/papyri/myst_ast.py b/papyri/myst_ast.py index 3ceb34a09..5196897cd 100644 --- a/papyri/myst_ast.py +++ b/papyri/myst_ast.py @@ -1,6 +1,7 @@ """ An attempt to create AST from MyST spec. """ + from typing import List, Union, Optional, Dict from .common_ast import Node, register @@ -310,7 +311,7 @@ class MRoot(Node): "take2.DefList", "take2.DefListItem", "take2.FieldList", - MComment # this seem not right but triggers an error with numpy narrative documentation + MComment, # this seem not right but triggers an error with numpy narrative documentation # MTable, # MFootnoteDefinition, ] diff --git a/papyri/myst_serialiser.py b/papyri/myst_serialiser.py index 2147ab155..28048c182 100644 --- a/papyri/myst_serialiser.py +++ b/papyri/myst_serialiser.py @@ -10,7 +10,6 @@ This is a prototype of serializer that respect this layout. """ - from typing import Union from typing import get_type_hints as gth diff --git a/papyri/signature.py b/papyri/signature.py index 6345e817c..cfb5d375d 100644 --- a/papyri/signature.py +++ b/papyri/signature.py @@ -38,9 +38,11 @@ def to_parameter(self) -> inspect.Parameter: name=self.name, kind=getattr(inspect._ParameterKind, self.kind), default=inspect._empty if isinstance(self.default, Empty) else self.default, - annotation=inspect._empty - if isinstance(self.annotation, Empty) - else self.annotation, + annotation=( + inspect._empty + if isinstance(self.annotation, Empty) + else self.annotation + ), ) @@ -132,18 +134,22 @@ def to_node(self) -> SignatureNode: name=param.name, annotation=annotation, kind=param.kind.name, - default=_empty - if param.default is inspect._empty - else clean_hexaddress(str(param.default)), + default=( + _empty + if param.default is inspect._empty + else clean_hexaddress(str(param.default)) + ), ) ) assert isinstance(kind, str) return SignatureNode( kind=kind, parameters=parameters, - return_annotation=_empty - if self._sig.return_annotation is inspect._empty - else str(self._sig.return_annotation), + return_annotation=( + _empty + if self._sig.return_annotation is inspect._empty + else str(self._sig.return_annotation) + ), target_name=self.target_item.__name__, ) diff --git a/papyri/tests/test_signatures.py b/papyri/tests/test_signatures.py index 36204cc00..0da00e311 100644 --- a/papyri/tests/test_signatures.py +++ b/papyri/tests/test_signatures.py @@ -2,6 +2,7 @@ This file is meant to test the serialisation / deserialization of function signature to JSON. """ + from papyri.signature import Signature as SignatureObject, SignatureNode import json from typing import Union, Optional diff --git a/papyri/textual.py b/papyri/textual.py index e66cb9eb4..9c6b620ba 100644 --- a/papyri/textual.py +++ b/papyri/textual.py @@ -1,6 +1,7 @@ """ papyri textual """ + from pathlib import Path from textual.app import App, ComposeResult, RenderResult diff --git a/papyri/vref.py b/papyri/vref.py index 9b470b724..9431f25dc 100644 --- a/papyri/vref.py +++ b/papyri/vref.py @@ -2,7 +2,6 @@ vestigial things from velin. """ - import numpydoc.docscrape as nds