Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitabf1b0d

Browse files
author
Gauvain Pocentek
committed
add a GitlabObject.pretty_print method
1 parentbc9d440 commitabf1b0d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎gitlab.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,23 @@ def __init__(self, gl, data=None, **kwargs):
448448
def__str__(self):
449449
return'%s => %s'% (type(self),str(self.__dict__))
450450

451+
defpretty_print(self,depth=0):
452+
print"%sid: %s"% (" "*depth*2,self.id)
453+
forkinsorted(self.__dict__.keys()):
454+
ifk=="id":
455+
continue
456+
v=self.__dict__[k]
457+
ifisinstance(v,GitlabObject):
458+
ifdepth==0:
459+
print"%s:"%k
460+
v.pretty_print(1)
461+
else:
462+
print"%s: %s"% (k,v.id)
463+
else:
464+
ifisinstance(v,Gitlab):
465+
continue
466+
print"%s%s: %s"% (" "*depth*2,k,v)
467+
451468
defjson(self):
452469
returnjson.dumps(self.__dict__,cls=jsonEncoder)
453470

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp