Skip to content

Commit caddc4f

Browse files
committed
Prefer dict unpacking instead of converting the items to lists and building a new dict out of those
1 parent 4656cdf commit caddc4f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

swiftype/swiftype.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,22 @@ def destroy_documents(self, engine_id, document_type_id, document_ids=[]):
8787

8888
def search(self, engine_id, query, options={}):
8989
query_string = {'q': query}
90-
full_query = dict(list(query_string.items()) + list(options.items()))
90+
full_query = dict(query_string, **options)
9191
return self.conn._get(self.__search_path(engine_id), data=full_query)
9292

9393
def search_document_type(self, engine_id, document_type_id, query, options={}):
9494
query_string = {'q': query}
95-
full_query = dict(list(query_string.items()) + list(options.items()))
95+
full_query = dict(query_string, **options)
9696
return self.conn._get(self.__document_type_search_path(engine_id, document_type_id), data=full_query)
9797

9898
def suggest(self, engine_id, query, options={}):
9999
query_string = {'q': query}
100-
full_query = dict(list(query_string.items()) + list(options.items()))
100+
full_query = dict(query_string, **options)
101101
return self.conn._get(self.__suggest_path(engine_id), data=full_query)
102102

103103
def suggest_document_type(self, engine_id, document_type_id, query, options={}):
104104
query_string = {'q': query}
105-
full_query = dict(list(query_string.items()) + list(options.items()))
105+
full_query = dict(query_string, **options)
106106
return self.conn._get(self.__document_type_suggest_path(engine_id, document_type_id), data=full_query)
107107

108108
def analytics_searches(self, engine_id, start_date=None, end_date=None):
@@ -144,7 +144,7 @@ def crawl_url(self, engine_id, domain_id, url):
144144

145145
def users(self, page=None, per_page=None):
146146
params = {'client_id': self.client_id, 'client_secret': self.client_secret}
147-
return self.conn._get(self.__users_path(), dict(list(params.items()) + list(self.__pagination_params(page, per_page).items())))
147+
return self.conn._get(self.__users_path(), dict(params, **self.__pagination_params(page, per_page)))
148148

149149
def user(self, user_id):
150150
params = {'client_id': self.client_id, 'client_secret': self.client_secret}

0 commit comments

Comments
 (0)