Fix python docstrings (#120)
* fix(py): Return "Args:" if parameters * fix(py): catch typed default parameters
This commit is contained in:
@@ -49,15 +49,8 @@ return {
|
||||
{
|
||||
retrieve = "all",
|
||||
node_type = "typed_default_parameter",
|
||||
extract = true,
|
||||
subtree = {
|
||||
{
|
||||
retrieve = "all",
|
||||
node_type = "identifier",
|
||||
extract = true,
|
||||
as = i.Tparam,
|
||||
},
|
||||
},
|
||||
as = i.Tparam,
|
||||
extract = true
|
||||
},
|
||||
{
|
||||
retrieve = "first",
|
||||
@@ -153,14 +146,14 @@ return {
|
||||
|
||||
local results = helpers.copy({
|
||||
[i.HasParameter] = function(t)
|
||||
return t[i.Parameter] and { true } or nil
|
||||
return (t[i.Parameter] or t[i.Tparam]) and { true }
|
||||
end,
|
||||
[i.HasReturn] = function(t)
|
||||
return (t[i.ReturnTypeHint] or t[i.Return]) and { true }
|
||||
end,
|
||||
[i.Type] = true,
|
||||
[i.Parameter] = function(t)
|
||||
return t[i.Parameter]
|
||||
end,
|
||||
[i.Parameter] = true,
|
||||
[i.Return] = true,
|
||||
[i.HasReturn] = true,
|
||||
[i.ReturnTypeHint] = true,
|
||||
[i.ArbitraryArgs] = true,
|
||||
[i.Kwargs] = true,
|
||||
@@ -168,9 +161,6 @@ return {
|
||||
[i.Tparam] = true,
|
||||
}, res) or {}
|
||||
|
||||
-- Generates a "flag" return
|
||||
results[i.HasReturn] = (results[i.ReturnTypeHint] or results[i.Return]) and { true } or nil
|
||||
|
||||
-- Removes generation for returns that are not typed
|
||||
if results[i.ReturnTypeHint] then
|
||||
results[i.Return] = nil
|
||||
|
||||
Reference in New Issue
Block a user