issue_comments: 1239763997
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/sqlite-utils/issues/484#issuecomment-1239763997 | https://api.github.com/repos/simonw/sqlite-utils/issues/484 | 1239763997 | IC_kwDOCGYnMM5J5Uwd | 9599 | 2022-09-07T18:57:59Z | 2022-09-07T18:58:10Z | OWNER | Here's how to detect defaults in the function signature: ```pycon >>> import inspect >>> def foo(a, b, c=1, d=2): ... pass ... >>> inspect.signature(foo) <Signature (a, b, c=1, d=2)> >>> inspect.signature(foo).parameters mappingproxy(OrderedDict([('a', <Parameter "a">), ('b', <Parameter "b">), ('c', <Parameter "c=1">), ('d', <Parameter "d=2">)])) >>> inspect.signature(foo).parameters['c'] <Parameter "c=1"> >>> dir(inspect.signature(foo).parameters['c']) ['KEYWORD_ONLY', 'POSITIONAL_ONLY', 'POSITIONAL_OR_KEYWORD', 'VAR_KEYWORD', 'VAR_POSITIONAL', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '_annotation', '_default', '_kind', '_name', 'annotation', 'default', 'empty', 'kind', 'name', 'replace'] >>> inspect.signature(foo).parameters['c'].default 1 >>> inspect.signature(foo).parameters['a'].default <class 'inspect._empty'> ``` | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | 1363766973 |