You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we pass in a class for the docments function, it completely fails. I would expect it to look at the __init__ for all the relevant information it would need (as it's the class constructor). Basic breaking example:
classAdd:
"A basic addition class"def__init__(
self,
a:int=0, # The first number to be addedb:(int, float) =1.5, # The second number to be added
):
self.a=aself.b=bdefadd(
self,
) ->Union[int, float]:
"Adds `self.a` and `self.b`"returnself.a+self.b
docments(Add)
Stack trace:
---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
<ipython-input-101-f7728d42a6d5>in<module>()
---->1docments(Add)
/mnt/d/lib/python3.7/site-packages/fastcore/docments.pyindocments(s, full, returns)
55defdocments(s, full=False, returns=True):
56"`dict` of parameter names to 'docment-style' comments in function or string `s`"--->57comments= {o.start[0]:_clean_comment(o.string) foroin_tokens(s) ifo.type==COMMENT}
58parms=_param_locs(s, returns=returns)
59docs= {arg:_get_comment(line, arg, comments, parms) forline,arginparms.items()}
/mnt/d/lib/python3.7/site-packages/fastcore/docments.pyin_tokens(s)
22"Tokenize Python code in string or function object `s`"23ifisfunction(s): s=getsource(s)
--->24returntokenize(BytesIO(s.encode('utf-8')).readline)
2526_clean_re=re.compile('^\s*#(.*)\s*$')
AttributeError: typeobject'Add'hasnoattribute'encode'
The text was updated successfully, but these errors were encountered:
If we pass in a class for the
docments
function, it completely fails. I would expect it to look at the__init__
for all the relevant information it would need (as it's the class constructor). Basic breaking example:Stack trace:
The text was updated successfully, but these errors were encountered: