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


Python inversion_of_control.Dependency類代碼示例

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


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

示例1: test_retail_get_whitespace_stores

    def test_retail_get_whitespace_stores(self):

        main_access = Dependency("CoreAPIProvider").value
        company_id = insert_test_company()

        trade_area_1 = insert_test_geoprocessed_trade_area(home_store_id=1, away_store_id=21, company_id=company_id,
                                                           company_name="woot", opened_date=None, closed_date=None,
                                                           longitude=35, latitude=-40)
        trade_area_2 = insert_test_geoprocessed_trade_area(home_store_id=2, away_store_id=22, company_id=company_id,
                                                           company_name="woot", opened_date=None, closed_date=None,
                                                           longitude=36, latitude=-41)
        trade_area_3 = insert_test_geoprocessed_trade_area(home_store_id=3, away_store_id=23, company_id=999,
                                                           company_name="woot", opened_date=None, closed_date=None,
                                                           longitude=37, latitude=-42)

        params = {
            "bannerIds": [company_id]
        }
        context = {}
        resource = "/data/preset/whitespace/stores"

        data = main_access.call_get_preset(resource, params=params, context=context)
        stores = data["stores"]

        self.test_case.assertEqual(len(stores), 2)
        self.test_case.assertItemsEqual(stores[0][-6], [35, -40])
        self.test_case.assertItemsEqual(stores[1][-6], [36, -41])
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:27,代碼來源:retail_white_space_test_collection.py

示例2: __init__

 def __init__(self, server_ip_address):
     self._rest_provider = Dependency("RestProvider", HasMethods("download_file")).value
     self._config = Dependency("Config", HasAttributes("ArcGIS_timeout", "ArcGIS_max_errors")).value
     self._logger = Dependency("LogManager", HasMethods("error")).value
     self._server_ip_address = server_ip_address
     self._timeout = self._config.ArcGIS_timeout
     self._max_error_count = self._config.ArcGIS_max_errors
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:7,代碼來源:ArcGIS_connection_manager.py

示例3: test_baonline_auth_context

def test_baonline_auth_context():
    # get logging dependency
    logger = Dependency("LogManager").value

    # this is how it would look in geoprocessing (without the debugs of course
    with BAOnlineAuthContext() as bao:
        logger.info("get, token: %s, num_auth_requests: %s", bao.token, bao.num_auth_requests)
        response = get_report_templates(bao)
        logger.info("templates: %s", pprint.pformat(response))
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:9,代碼來源:ba_online_helper.py

示例4: select_count_trade_area_by_store

def select_count_trade_area_by_store(store_id):
    # get dependencies
    core_api_provider = Dependency("CoreAPIProvider").value
    param_builder = Dependency("CoreAPIParamsBuilder").value

    # create params
    filters = { "link.relation_type": "store_trade_area" }
    params = param_builder.create_get_data_entities_params(field_filters = filters)["params"]

    # run query and return first id
    return len(core_api_provider.call_get_data_entities_linked_from("trade_area", "store", store_id, params)["rows"])
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:11,代碼來源:data_access_misc_queries.py

示例5: __init__

    def __init__(self, target_db_name, company_settings):

        # init yo'self
        self.target_db_name = target_db_name
        self.company_settings = company_settings

        # get some dependencies
        self.mds_access = Dependency("CoreAPIProvider").value.mds
        self.mds_params = Dependency("CoreAPIParamsBuilder").value.mds
        
        # get some helpers
        self._fast_date_parser = FastDateParser()
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:12,代碼來源:custom_analytics_loader.py

示例6: __init__

    def __init__(self):
        # get dependencies
        self.logger = Dependency("LogManager").value
        self.config = Dependency("Config", HasAttributes("ba_online_username", "ba_online_password")).value
        self.rest_provider = Dependency("RestProvider").value

        # get username and password
        self.user_name = self.config.ba_online_username
        self.password = self.config.ba_online_password

        # various internal vars
        self.num_auth_requests = 0
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:12,代碼來源:ba_online_helper.py

示例7: setUp

    def setUp(self):

        # call setUp on super class
        super(TestRetailMDSMonitor, self).setUp()

        # register mox dependencies
        register_common_mox_dependencies(self.mox)

        # get mock dependencies that we need to use for recording
        self.mock_rest_provider = Dependency("RestProvider").value
        self.mock_email_provider = Dependency("EmailProvider").value
        
        # helper vars
        self.stats_url = "http://localhost:5001/connection_stats"
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:14,代碼來源:test_retail_mds_monitor.py

示例8: setUp

    def setUp(self):

        # call parent set up
        super(TestCustomAnalyticsExecutor, self).setUp()

        # register mock dependencies
        register_common_mox_dependencies(self.mox)

        # get some mock dependencies
        self.mock_deployment_provider = Dependency("DeploymentProvider").value
        self.mock_cloud_provider = Dependency("CloudProviderNewEnvironment").value
        self.mock_logger = Dependency("LogManager").value
        self.mock_email_provider = Dependency("EmailProvider").value
        self.mock_config = Dependency("Config").value
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:14,代碼來源:test_custom_analytics_executor.py

示例9: __init__

    def __init__(self):
        self.__data_repository = Dependency("DataRepository").value
        self.store_id = None
        self.company_id = None
        self.address_id = None
        self.phone_number = None
        self.note = None
        self.store_format = None
        self.company_generated_store_number = None

        # id from core
        self.core_store_id = None

        # these are derived parameters that are generated for the loader.  they are not "pure" store properties
        self.change_type = None
        self.mismatched_parameters = []

        # these are protected members.  they should be accessed by their properties below
        self._opened_date = None
        self._closed_date = None
        self._assumed_opened_date = None
        self._assumed_closed_date = None

        # for lazy loading
        self.__problem_longitude = None
        self.__problem_latitude = None
        self.__address = None
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:27,代碼來源:store.py

示例10: setUp

    def setUp(self):

        # call parent set up
        super(GP16Tests, self).setUp()

        # register mock dependencies
        register_mox_gp_dependencies(self.mox)

        # Set mock attributes on WorkflowService instance for calls to ignore
        self.mock_main_access = Dependency("CoreAPIProvider").value
        self.mock_mds_access = Dependency("MDSMongoAccess").value

        # create the mock trade _area
        self.trade_area_id = 11
        self.store_id = "woot!"
        self.trade_area = {
            "_id" : self.trade_area_id,
            "data" : {
                "store_id": self.store_id,
                "company_id": "buddy!",
                "latitude" : 1,
                "longitude" : -1,
                "store_opened_date": "2012-01-01",
                "store_closed_date": "2013-12-31"
            }
        }

        # create the test gp
        self.gp = GP16GetStoreWeather()
        self.gp._entity = self.trade_area
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:30,代碼來源:test_gp16.py

示例11: delete_competitive_stores

def delete_competitive_stores(trade_area_id):
    # get dependency
    core_api_provider = Dependency("CoreAPIProvider").value
    param_builder = Dependency("CoreAPIParamsBuilder").value

    # create params
    filters = { "link.relation_type": "store_trade_area_competition" }
    params = param_builder.create_get_data_entities_params(field_filters = filters)["params"]

    # get links and store_ids
    links = core_api_provider.call_get_data_entities_linked_from("store", "trade_area", trade_area_id, params)["rows"]

    # for each store, delete link
    for link in links:

        # bomboj for
        core_api_provider.mds.call_del_link_without_id("store", link["to._id"], "away_store", "trade_area", trade_area_id, "trade_area", "store_trade_area_competition")
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:17,代碼來源:data_access_misc_queries.py

示例12: setUp

    def setUp(self):
        # call super init
        super(MDSParamsBuilderTests, self).setUp()
        
        # register mox dependencies
        register_common_mox_dependencies(self.mox)

        # get mocked params builder
        self.mds_params_builder = Dependency("CoreAPIParamsBuilder").value.mds
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:9,代碼來源:test_mds_params_builder.py

示例13: __init__

    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
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:9,代碼來源:trade_area.py

示例14: initialize

    def initialize(self):

        self.user_id = '[email protected]'
        self.source = "main_test_collection.py"
        self.context = {"user_id": self.user_id, "source": self.source}
        self.remote_dirs = ['integration_test_files/', 'integration_test_files/chuck_norris/']
        self.local_dir = 'implementation/data/'
        self.main_params = Dependency("CoreAPIParamsBuilder").value
        self.store_helper = StoreHelper()
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:9,代碼來源:main_test_collection.py

示例15: delete_test_competitors

def delete_test_competitors(company_id):
    # get dependency
    core_api_provider = Dependency("CoreAPIProvider").value
    param_builder = Dependency("CoreAPIParamsBuilder").value

    # create params
    filters = {
        "link.relation_type": "company_competition"
    }
    params = param_builder.create_get_data_entities_params(field_filters = filters)["params"]

    # get links
    links = core_api_provider.call_get_data_entities_linked_from("company", "company", company_id, params)["rows"]

    # delete links
    for link in links:

        # bomboj for
        core_api_provider.mds.call_del_link_without_id("company", company_id, "competitor", "company", link["to._id"], "competitor", "company_competition")
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:19,代碼來源:data_access_misc_queries.py


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