當前位置: 首頁>>代碼示例>>Python>>正文


Python Dependency.select_trade_area_shape_by_id方法代碼示例

本文整理匯總了Python中common.utilities.inversion_of_control.Dependency.select_trade_area_shape_by_id方法的典型用法代碼示例。如果您正苦於以下問題:Python Dependency.select_trade_area_shape_by_id方法的具體用法?Python Dependency.select_trade_area_shape_by_id怎麽用?Python Dependency.select_trade_area_shape_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common.utilities.inversion_of_control.Dependency的用法示例。


在下文中一共展示了Dependency.select_trade_area_shape_by_id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TradeArea

# 需要導入模塊: from common.utilities.inversion_of_control import Dependency [as 別名]
# 或者: from common.utilities.inversion_of_control.Dependency import select_trade_area_shape_by_id [as 別名]
class TradeArea(object):
    def __init__(self):

        self.trade_area_id = None
        self.store_id = None
        self.threshold_id = None
        self.period_id = None
        self.area = None
        self.__wkt_representation = None
        self.__data_repository = Dependency("DataRepository", HasMethods("insert_trade_area_shape")).value


    @classmethod
    def select_by_id(cls, trade_area_id):
        data_repository = Dependency("DataRepository", HasMethods("get_trade_area_by_id")).value
        return data_repository.get_trade_area_by_id(trade_area_id)


    @classmethod
    def standard_init(cls, trade_area_id, store_id, created_at, updated_at, threshold_id):
        trade_area = TradeArea()
        trade_area.trade_area_id = trade_area_id
        trade_area.store_id = store_id
        trade_area.created_at = created_at
        trade_area.updated_at = updated_at
        trade_area.threshold_id = threshold_id
        return trade_area


    def wkt_representation(self, wkt_representation = None):

        # regardless if the reprentation is set or not, the user is expecting the argument linestring back
        if wkt_representation is not None:
            self.__wkt_representation = wkt_representation
            return self.__wkt_representation

        if self.__wkt_representation is not None:
            return self.__wkt_representation

        elif self.__wkt_representation is None:
            if self.trade_area_id is None:
                raise NotImplementedError('There is no trade area id or preloaded wkt_representation')
            else:

                self.__wkt_representation = self.__data_repository.select_trade_area_shape_by_id(self.trade_area_id)
                return self.__wkt_representation
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:48,代碼來源:trade_area.py


注:本文中的common.utilities.inversion_of_control.Dependency.select_trade_area_shape_by_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。