Code Duplication    Length = 29-29 lines in 2 locations

ci/jenkins/scripts/yaml_processor.py 1 location

@@ 128-156 (lines=29) @@
125
    return _counter
126
127
128
def _obtain_comment(_m_comment, _t_comment):
129
    if not _m_comment or not _t_comment:
130
        return _m_comment or _t_comment
131
132
    _m_counter = _comment_counter(_m_comment)
133
    _t_counter = _comment_counter(_t_comment)
134
135
    if not _m_counter[0] and not _t_counter[1]:
136
        comment = _t_comment + _m_comment
137
    elif not _m_counter[1] and not _t_counter[0]:
138
        comment = _m_comment + _t_comment
139
    elif _t_counter[0] and _t_counter[1]:
140
        comment = _t_comment
141
    elif not _t_counter[0] and not _t_counter[1]:
142
        comment = _m_comment
143
    elif not _m_counter[0] and not _m_counter[1]:
144
        comment = _t_comment
145
    else:
146
        if _t_counter[0]:
147
            comment = _m_comment.replace(_m_counter[0], _t_counter[0], 1)
148
        else:
149
            comment = _m_comment.replace(_m_counter[1], _t_counter[1], 1)
150
151
    i = comment.find("\n\n")
152
    while i >= 0:
153
        comment = comment.replace("\n\n\n", "\n\n", 1)
154
        i = comment.find("\n\n\n")
155
156
    return comment
157
158
159
############################################

tests/milvus_benchmark/ci/scripts/yaml_processor.py 1 location

@@ 128-156 (lines=29) @@
125
    return _counter
126
127
128
def _obtain_comment(_m_comment, _t_comment):
129
    if not _m_comment or not _t_comment:
130
        return _m_comment or _t_comment
131
132
    _m_counter = _comment_counter(_m_comment)
133
    _t_counter = _comment_counter(_t_comment)
134
135
    if not _m_counter[0] and not _t_counter[1]:
136
        comment = _t_comment + _m_comment
137
    elif not _m_counter[1] and not _t_counter[0]:
138
        comment = _m_comment + _t_comment
139
    elif _t_counter[0] and _t_counter[1]:
140
        comment = _t_comment
141
    elif not _t_counter[0] and not _t_counter[1]:
142
        comment = _m_comment
143
    elif not _m_counter[0] and not _m_counter[1]:
144
        comment = _t_comment
145
    else:
146
        if _t_counter[0]:
147
            comment = _m_comment.replace(_m_counter[0], _t_counter[0], 1)
148
        else:
149
            comment = _m_comment.replace(_m_counter[1], _t_counter[1], 1)
150
151
    i = comment.find("\n\n")
152
    while i >= 0:
153
        comment = comment.replace("\n\n\n", "\n\n", 1)
154
        i = comment.find("\n\n\n")
155
156
    return comment
157
158
159
############################################