I am using python-gitlab (https://github.com/python-gitlab/python-gitlab)
And in my code I want to get values from project issues:
statistics = project.issuesstatistics.get()
print(statistics)
print(type(statistics))
The output is the following:
<class 'gitlab.v4.objects.ProjectIssuesStatistics'> => {'statistics': {'counts': {'all': 1, 'closed': 0, 'opened': 1}}}
<class 'gitlab.v4.objects.ProjectIssuesStatistics'>
The right side is just a dict and I want to have the value for 'all'.
But how can I get the dict from the right side?
I need something like statistics.values()
The arrow as such does not have any special meaning in this context; the designer of this particular class decided to use this formatting when you
print
the bare object.(In some more detail, when you convert an object into a string, its
__str__
method is called, and should return a string. It could return whatever it wants, like"42"
or"=> => =>"
, though the usual expectation would be for it to return a string which reveals the actual value held by the object in some sort of vaguely human-readable representation.)In the general case, you would consult the documentation for the library, or inspect what methods are available (the
dir()
function is helpful for this, and of course thehelp()
function, which displays any documentation string).