@@ -0,0 +1,1425 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom .common import Base, session_scope%0A%0Afrom sqlalchemy import and_%0A%0A%0Aclass BuyoutYear(Base):%0A    __tablename__ = 'buyout_years'%0A    __autoload__ = True%0A%0A    STANDARD_ATTRS = %5B'season', 'cap_hit', 'cost'%5D%0A%0A    def __init__(self, player_id, buyout_id, buyout_year_data_dict):%0A        self.player_id = player_id%0A        self.buyout_id = buyout_id%0A        for attr in self.STANDARD_ATTRS:%0A            if attr in buyout_year_data_dict:%0A                setattr(self, attr, buyout_year_data_dict%5Battr%5D)%0A%0A    @classmethod%0A    def find(self, buyout_id, season):%0A        with session_scope() as session:%0A            try:%0A                buyout_year = session.query(BuyoutYear).filter(%0A                    and_(%0A                        BuyoutYear.buyout_id == buyout_id,%0A                        BuyoutYear.season == season%0A                    )%0A                ).one()%0A            except:%0A                buyout_year = None%0A            return buyout_year%0A%0A    def update(self, other):%0A        for attr in self.STANDARD_ATTRS:%0A            if hasattr(other, attr):%0A                setattr(self, attr, getattr(other, attr))%0A%0A    def __eq__(self, other):%0A        return ((%0A            self.buyout_id, self.season, self.cost, self.cap_hit%0A            ) == (%0A            other.buyout_id, other.season, other.cost, other.cap_hit))%0A%0A    def __ne__(self, other):%0A        return not self == other%0A

Add buyout year item