After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 697356 - Docstrings: List length arguments visible and return values missing
Docstrings: List length arguments visible and return values missing
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-04-05 13:39 UTC by Christoph Reiter (lazka)
Modified: 2014-01-01 14:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christoph Reiter (lazka) 2013-04-05 13:39:15 UTC
>>> from gi.repository import Gtk
>>> Gtk.init_check.__doc__
'init_check(argc:int, argv:list) -> argc:int, argv:list'
>>> Gtk.rc_get_module_dir.__doc__
'rc_get_module_dir()'

should be:

>>> from pgi.repository import Gtk
>>> Gtk.init_check.__doc__
'init_check(argv: list) -> (bool, argv: list)'
>>> Gtk.rc_get_module_dir.__doc__
'rc_get_module_dir() -> str'
Comment 1 Christoph Reiter (lazka) 2013-04-06 09:30:58 UTC
Another nice thing to have (but not strictly necessary for docs creation) would be to include may_return_null and may_be_null:

>>> Gtk.foo.__doc__
foo(argv: list or None)
>> Gtk.foobar.__doc__
foobar() -> (bool, some_out: Gtk.Widget or None)

And if it throws.. but I'm not sure about the syntax there.
Comment 2 Christoph Reiter (lazka) 2013-11-22 15:59:37 UTC
..this is what I use now in pgi:

accelerator_get_default_mod_mask() -> Gdk.ModifierType
accelerator_get_label(accelerator_key: int, accelerator_mods: Gdk.ModifierType) -> str
drag_finish(context: Gdk.DragContext, success: bool, del_: bool, time_: int) -> None
init(argv: [str] or None) -> argv: [str]
init_with_args(argv: [str] or None, parameter_string: str or None, entries: [GLib.OptionEntry], translation_domain: str) raises -> (bool, argv: [str])
rc_get_default_files() -> [str]
targets_include_image(targets: [Gdk.Atom], writable: bool) -> bool
target_table_new_from_list(list_: Gtk.TargetList) -> [Gtk.TargetEntry]
Comment 3 Simon Feltman 2014-01-01 02:02:20 UTC
Array length argument skipping was pushed as:
https://git.gnome.org/browse/pygobject/commit/?id=28a178e
Comment 4 Simon Feltman 2014-01-01 05:59:02 UTC
Commits which fix this:
https://git.gnome.org/browse/pygobject/commit/?id=cebf531
https://git.gnome.org/browse/pygobject/commit/?id=aeccdad
https://git.gnome.org/browse/pygobject/commit/?id=826c0e6

(In reply to comment #1)
> foobar() -> (bool, some_out: Gtk.Widget or None)

I ended up only using may_return_null() because may_be_null() out arguments can give a funny result for functions which accept an optional int pointer, e.g:
 foobar() -> (bool, some_out:int or None)

> And if it throws.. but I'm not sure about the syntax there.

I think eventually we should move the syntax to reStructuredText formatting:

:Parameters:
    context (None) : Gdk.DragContext

:Raises GLib.GError:
    When context is invalid.

:Returns:
    True on success
Comment 5 Christoph Reiter (lazka) 2014-01-01 14:28:16 UTC
(In reply to comment #4)
> Commits which fix this:
> https://git.gnome.org/browse/pygobject/commit/?id=cebf531
> https://git.gnome.org/browse/pygobject/commit/?id=aeccdad
> https://git.gnome.org/browse/pygobject/commit/?id=826c0e6

Nice!

> (In reply to comment #1)
> > foobar() -> (bool, some_out: Gtk.Widget or None)
> 
> I ended up only using may_return_null() because may_be_null() out arguments can
> give a funny result for functions which accept an optional int pointer, e.g:
>  foobar() -> (bool, some_out:int or None)

I've also limited it to in/inout afair.

> > And if it throws.. but I'm not sure about the syntax there.
> 
> I think eventually we should move the syntax to reStructuredText formatting:

The rationale behind the annotation like syntax was that it's faster to parse visually with help, ipython etc. and still can be converted to reST if needed.