Skip to content

libpython-clj2.metadata/pyarglists is not returning 'defaults' #284

@behrica

Description

@behrica

When using fn libpython-clj2.metadata/pyarglists the deafults are not shown, see below.
py-fn-argspec seems to find them, but then they get eaten up, to me on this line:

(map (fn [[k v]] [(symbol k) (keyword k)]))

[(symbol k) (keyword k)] seems wrong, should be: [(symbol k) (keyword v)]
but (keyword x) returns for example "nil" on true, so defaults true are lost.

I think [(symbol k) v] should work, but not sure if for all cases.

(libpython-clj2.python/from-import os fwalk)
(-> 
 (libpython-clj2.metadata/py-fn-argspec fwalk)
 (libpython-clj2.metadata/pyarglists))

;;=> [[& [{top :top, topdown :topdown, onerror :onerror, follow_symlinks :follow_symlinks, dir_fd :dir_fd}]]
;;    [& [{top :top, topdown :topdown, follow_symlinks :follow_symlinks, dir_fd :dir_fd}]]
;;    [& [{top :top, follow_symlinks :follow_symlinks, dir_fd :dir_fd}]]
;;    [& [{follow_symlinks :follow_symlinks, dir_fd :dir_fd}]]]

in python:

>>> import os
>>> help (os.fwalk)
fwalk (top='.', topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=None)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions