def bulk_compliant_status(cls, imeis): """Method to get IMEIs status from CORE in bulk.""" non_compliant_list, compliant_list = [], [] imei_list = pydash.flatten_deep(imeis) imei_chunks = pydash.chunk(imei_list, 1000) url = cls.core_api_v2 + '/imei-batch' for chunk in imei_chunks: response = requests.post(url, json={'imeis': chunk}) compliant, non_compliant = Utilities.get_bulk_compliant_imeis(response) non_compliant_list = pydash.interleave(non_compliant_list, non_compliant) compliant_list = pydash.interleave(compliant_list, compliant) return compliant_list, non_compliant_list
def test_interleave(case, expected): assert _.interleave(*case) == expected
def _split_token_on(token, char): split = token.split(char) return [ elem for elem in _.interleave(split, [char] * (len(split) - 1)) if not _.is_empty(elem) ]