Code Duplication    Length = 13-15 lines in 2 locations

goatools/anno/gpad_reader.py 1 location

@@ 106-120 (lines=15) @@
103
            props]        # 12 Annotation_Properties
104
        return ntgpadobj._make(gpadvals)
105
106
    @staticmethod
107
    def _rd_fld_vals(name, val, set_list_ft=True, qty_min=0, qty_max=None):
108
        """Further split a GPAD value within a single field."""
109
        if not val and qty_min == 0:
110
            return [] if set_list_ft else set()
111
        vals = val.split('|') # Use a pipe to separate entries
112
        num_vals = len(vals)
113
        assert num_vals >= qty_min, \
114
            "FLD({F}): MIN QUANTITY({Q}) WASN'T MET: {V}".format(
115
                F=name, Q=qty_min, V=vals)
116
        if qty_max is not None:
117
            assert num_vals <= qty_max, \
118
                "FLD({F}): MAX QUANTITY({Q}) EXCEEDED: {V}".format(
119
                    F=name, Q=qty_max, V=vals)
120
        return vals if set_list_ft else set(vals)
121
122
    @staticmethod
123
    def _get_taxon(taxon):

goatools/anno/gaf_reader.py 1 location

@@ 229-241 (lines=13) @@
226
                gafvals.append(None)
227
        return self.ntgafobj._make(gafvals)
228
229
    @staticmethod
230
    def _rd_fld_vals(name, val, set_list_ft=True, qty_min=0, qty_max=None):
231
        """Further split a GAF value within a single field."""
232
        if not val and qty_min == 0:
233
            return [] if set_list_ft else set()
234
        vals = val.split('|') # Use a pipe to separate entries
235
        num_vals = len(vals)
236
        assert num_vals >= qty_min, \
237
            "FIELD({F}): MIN QUANTITY({Q}) WASN'T MET: {V}".format(F=name, Q=qty_min, V=vals)
238
        if qty_max is not None:
239
            assert num_vals <= qty_max, \
240
                "FIELD({F}): MAX QUANTITY({Q}) EXCEEDED: {V}".format(F=name, Q=qty_max, V=vals)
241
        return vals if set_list_ft else set(vals)
242
243
    def _chk_qualifier(self, qualifiers):
244
        """Check that qualifiers are expected values."""