aloof-angle-91616
06/28/2019, 11:25 PM__doc__
attrhundreds-father-404
06/28/2019, 11:26 PMaloof-angle-91616
06/28/2019, 11:27 PMaloof-angle-91616
06/28/2019, 11:27 PMhundreds-breakfast-49010
06/28/2019, 11:28 PMhundreds-breakfast-49010
06/28/2019, 11:28 PMTargetType
union has no description and that's what I've been testing this againsthundreds-breakfast-49010
06/28/2019, 11:29 PMpretty_print
) wants to print the name of this union as just "type"hundreds-breakfast-49010
06/28/2019, 11:29 PMaloof-angle-91616
06/28/2019, 11:30 PMtype()
constructoraloof-angle-91616
06/28/2019, 11:31 PMaloof-angle-91616
06/28/2019, 11:33 PMaloof-angle-91616
06/28/2019, 11:33 PMpretty_print()
just uses the type's __name__
aloof-angle-91616
06/28/2019, 11:34 PMextern_type_to_str
aloof-angle-91616
06/28/2019, 11:34 PMexterns::project_str(val, "__doc__")
aloof-angle-91616
06/28/2019, 11:35 PM@union
decorator drops the docstringwitty-crayon-22786
06/28/2019, 11:35 PMTargetType
you mean TestTarget
, right?witty-crayon-22786
06/28/2019, 11:35 PMhundreds-breakfast-49010
06/28/2019, 11:35 PMTestTarget
hundreds-breakfast-49010
06/28/2019, 11:35 PMaloof-angle-91616
06/28/2019, 11:36 PMdiff --git a/src/python/pants/engine/rules.py b/src/python/pants/engine/rules.py
index 8d44412e4..f3f49225b 100644
--- a/src/python/pants/engine/rules.py
+++ b/src/python/pants/engine/rules.py
@@ -301,6 +301,7 @@ def union(cls):
# TODO: Check that the union base type is used as a tag and nothing else (e.g. no attributes)!
assert isinstance(cls, type)
return type(cls.__name__, (cls,), {
+ '__doc__': cls.__doc__,
'_is_union': True,
})
should workaloof-angle-91616
06/28/2019, 11:36 PMfunctools.wraps()
still works there, but i'm not sure if that's kosherhundreds-breakfast-49010
06/28/2019, 11:37 PMhundreds-breakfast-49010
06/28/2019, 11:37 PMaloof-angle-91616
06/28/2019, 11:37 PMaloof-angle-91616
06/28/2019, 11:37 PMaloof-angle-91616
06/28/2019, 11:37 PMfunctools.wraps()
forwards the docstring of a wrapped function to the function returned by a decoratoraloof-angle-91616
06/28/2019, 11:40 PMaloof-angle-91616
06/28/2019, 11:40 PM__doc__
seems fine for nowhundreds-breakfast-49010
06/28/2019, 11:43 PMaloof-angle-91616
06/28/2019, 11:44 PMhundreds-breakfast-49010
06/28/2019, 11:47 PMhundreds-breakfast-49010
06/28/2019, 11:48 PMTypeId(c.to_id(type(input_type)))
hundreds-breakfast-49010
06/28/2019, 11:48 PMextern_get_function_for
witty-crayon-22786
06/28/2019, 11:49 PMwitty-crayon-22786
06/28/2019, 11:49 PMwitty-crayon-22786
06/28/2019, 11:49 PMhundreds-breakfast-49010
06/28/2019, 11:50 PMwitty-crayon-22786
06/28/2019, 11:51 PMhundreds-breakfast-49010
06/28/2019, 11:51 PMhundreds-breakfast-49010
06/28/2019, 11:51 PMextern_get_union_for
in the pythonwitty-crayon-22786
06/28/2019, 11:52 PMwitty-crayon-22786
06/28/2019, 11:53 PMwitty-crayon-22786
06/28/2019, 11:53 PMhundreds-breakfast-49010
06/28/2019, 11:59 PMwitty-crayon-22786
06/29/2019, 12:19 AMaloof-angle-91616
06/29/2019, 12:23 AMit makes sense but doesn't seem to work when I try itnot working how?
hundreds-breakfast-49010
06/29/2019, 12:30 AMunion