From: Henryk Plötz Date: Sat, 8 Sep 2018 19:15:19 +0000 (+0200) Subject: Use duck typing to break dependency hell X-Git-Tag: v2.0.0~1^2~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd6198058a3ec1a5331930b60378e3f4685a2a03;p=thirdparty%2Fpython-fints.git Use duck typing to break dependency hell --- diff --git a/fints/types.py b/fints/types.py index a44a015..e6e6b4a 100644 --- a/fints/types.py +++ b/fints/types.py @@ -170,10 +170,9 @@ class SegmentSequence: if recurse: for name, field in s._fields.items(): - if isinstance(field, fints.fields.SegmentSequenceField): - val = getattr(s, name) - if val: - yield from val.find_segments(query=query, version=version, callback=callback, recurse=recurse) + val = getattr(s, name) + if val and hasattr(val, 'find_segments'): + yield from val.find_segments(query=query, version=version, callback=callback, recurse=recurse) def find_segment_first(self, *args, **kwargs): """Finds the first matching segment.