Skip to content

Commit da93685

Browse files
committed
Python: Drop gtype return from read_packager_*()
Python handles the type properly (and can interrogate the object for its type), so don't bother returning the gtype. Signed-off-by: Stephen Gallagher <[email protected]>
1 parent cbcb448 commit da93685

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

bindings/python/gi/overrides/Modulemd.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from ..module import get_introspection_module
1515
from ..overrides import override
1616

17+
import functools
18+
1719
from six import text_type
1820
from gi.repository import GLib
1921

@@ -26,6 +28,17 @@
2628

2729

2830
class ModulemdUtil(object):
31+
def strip_gtype(method):
32+
@functools.wraps(method)
33+
def wrapped(*args, **kwargs):
34+
ret = method(*args, **kwargs)
35+
if len(ret) == 2:
36+
return ret[1]
37+
else:
38+
return ret[1:]
39+
40+
return wrapped
41+
2942
@staticmethod
3043
def variant_str(s):
3144
"""Converts a string to a GLib.Variant"""
@@ -98,6 +111,18 @@ def python_to_variant(obj):
98111

99112
if float(Modulemd._version) >= 2:
100113

114+
if hasattr(Modulemd, "read_packager_file"):
115+
read_packager_file = ModulemdUtil.strip_gtype(
116+
Modulemd.read_packager_file
117+
)
118+
__all__.append("read_packager_file")
119+
120+
if hasattr(Modulemd, "read_packager_string"):
121+
read_packager_string = ModulemdUtil.strip_gtype(
122+
Modulemd.read_packager_string
123+
)
124+
__all__.append("read_packager_string")
125+
101126
if hasattr(Modulemd.ModuleIndex, "add_known_stream"):
102127

103128
class ModuleIndex(Modulemd.ModuleIndex):

0 commit comments

Comments
 (0)