src/pds_doi_service/core/db/doi_database.py
def _normalize_rows(self, columns, rows):
        """
        Normalize columns from each row to be the data types we expect,
        rather than the types which are convenient for table storage
        """
        for row in rows:
            # Convert the add/update times from Unix epoch back to datetime
            for time_column in ("date_added", "date_updated"):
                time_val = row[columns.index(time_column)]
                time_val = datetime.fromtimestamp(time_val, tz=timezone.utc)
                row[columns.index(time_column)] = time_val

            # Convert status/product type back to Enums
            row[columns.index("status")] = DoiStatus(row[columns.index("status")].lower())
            row[columns.index("type")] = ProductType(row[columns.index("type")].capitalize())

            # Convert is_latest flag back to native Python bool (sqlite returns an int)
            row[columns.index("is_latest")] = bool(row[columns.index("is_latest")])

        return rows

        Normalize columns from each row to be the data types we expect,
        rather than the types which are convenient for table storage
        
Normalize columns from each row to be the data types we expect,
rather than the types which are convenient for table storage
Normalize columns from each row to be the data types we expect rather than the types which are convenient for table storage
def _normalize_rows(self, columns, rows):
        for row in rows:
            for time_column in ("date_added", "date_updated"):
                time_val = row[columns.index(time_column)]
                time_val = datetime.fromtimestamp(time_val, tz=timezone.utc)
                row[columns.index(time_column)] = time_val
            row[columns.index("status")] = DoiStatus(row[columns.index("status")].lower())
            row[columns.index("type")] = ProductType(row[columns.index("type")].capitalize())
            row[columns.index("is_latest")] = bool(row[columns.index("is_latest")])
        return rows
def _normalize_rows ( self , columns , rows ) : for row in rows : for time_column in ( "date_added" , "date_updated" ) : time_val = row [ columns . index ( time_column ) ] time_val = datetime . fromtimestamp ( time_val , tz = timezone . utc ) row [ columns . index ( time_column ) ] = time_val row [ columns . index ( "status" ) ] = DoiStatus ( row [ columns . index ( "status" ) ] . lower ( ) ) row [ columns . index ( "type" ) ] = ProductType ( row [ columns . index ( "type" ) ] . capitalize ( ) ) row [ columns . index ( "is_latest" ) ] = bool ( row [ columns . index ( "is_latest" ) ] ) return rows
Normalize columns from each row to be the data types we expect,
rather than the types which are convenient for table storage
Normalize columns from each row to be the data types we expect rather than the types which are convenient for table storage
"""
        Normalize columns from each row to be the data types we expect,
        rather than the types which are convenient for table storage
        """ # Convert the add/update times from Unix epoch back to datetime # Convert status/product type back to Enums # Convert is_latest flag back to native Python bool (sqlite returns an int)
self
columns
rows