"""File Parsing.""" def get_product_ids_from_csv(filepath): """Get product IDs from CSV.""" product_ids = set() with open(filepath) as f: for index, line in enumerate(f): if line == '\n': continue value = _get_value(line, index == 0) if value: product_ids.add(value) return product_ids def _get_value(line, is_header): if not is_header: return int(line) try: return int(line) except ValueError: pass