Skip to content

Commit d9e09df

Browse files
committed
FIX(SPHINXEXT) Convey __doc__ etal from Fn ==> Op; BUG ...
bc Sphinx generated the SAME doc for all FnOperation module data. - drop base.Operation.__name__ @Property. ++++ BUG: annotated function DO NOT APPEAR in Autodocuments.
1 parent f05700e commit d9e09df

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

graphtik/base.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,10 +859,6 @@ class Operation(Plottable, abc.ABC):
859859
provides: Items
860860
op_provides: Items
861861

862-
@property
863-
def __name__(self) -> str:
864-
return self.name
865-
866862
@abc.abstractmethod
867863
def compute(self, named_inputs, outputs=None):
868864
"""

graphtik/fnop.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import logging
1414
import textwrap
1515
from collections import abc as cabc
16-
from functools import wraps
16+
from functools import update_wrapper, wraps
1717
from typing import (
1818
Any,
1919
Callable,
@@ -340,8 +340,22 @@ def __init__(
340340
#: any "parents split by dots(``.``)".
341341
#: :seealso: :ref:`operation-nesting`
342342
self.name = name
343+
343344
#: Fake function attributes.
344-
self.__qualname__ = name
345+
#:
346+
if fn:
347+
update_wrapper(
348+
self,
349+
fn,
350+
assigned=("__module__", "__doc__", "__annotations__"),
351+
updated=(),
352+
)
353+
self.__name__ = name
354+
qname = getattr(fn, "__qualname__", None) or name
355+
if qname:
356+
# "ab.cd" => "ab.NAME", "ab" => "NAME", "" => "NAME"
357+
qname = ".".join((*qname.split(".")[:-1], name))
358+
self.__qualname__ = qname
345359

346360
#: The :term:`needs` almost as given by the user
347361
#: (which may contain MULTI-sideffecteds and dupes),

graphtik/pipeline.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,11 @@ def __init__(
174174
## Set data asap, for debugging, although `net.withset()` will reset them.
175175
self.name = name
176176
#: Fake function attributes.
177-
self.__qualname__ = name
178-
# Remember Outputs for future `compute()`?
177+
self.__name__ = self.__qualname__ = name
178+
179+
#: Remember Outputs for future `compute()`?
179180
self.outputs = outputs
181+
#: Remember Outputs for future `compute()`?
180182
self.predicate = predicate
181183

182184
# Prune network

0 commit comments

Comments
 (0)