@@ -26,9 +26,13 @@ def __init__(self, arg):
2626
2727 def copy (self ):
2828 """
29+ DEPRECATED
30+
2931 Creates and returns a copy of this object
3032 :return: copy FetchBase derivatives
3133 """
34+ warnings .warn ('Use of `copy` on `fetch` object is deprecated' , stacklevel = 2 )
35+
3236 return self .__class__ (self )
3337
3438 def _initialize_behavior (self ):
@@ -197,14 +201,13 @@ def __call__(self, *attrs, **kwargs):
197201 ret [blob_name ] = list (map (unpack_ , ret [blob_name ]))
198202
199203 else : # if list of attributes provided
200- single_output = len (attrs ) == 1
201204 attributes = [a for a in attrs if a is not PRIMARY_KEY ]
202205 result = self ._relation .proj (* attributes ).fetch (** total_behavior )
203206 return_values = [
204207 list (to_dicts (result [self ._relation .primary_key ]))
205208 if attribute is PRIMARY_KEY else result [attribute ]
206209 for attribute in attrs ]
207- ret = return_values [0 ] if single_output else return_values
210+ ret = return_values [0 ] if len ( attrs ) == 1 else return_values
208211
209212 return ret
210213
@@ -305,7 +308,6 @@ def __call__(self, *attrs, **kwargs):
305308 ret = OrderedDict ((name , unpack_ (ret [name ]) if heading [name ].is_blob else ret [name ])
306309 for name in heading .names )
307310 else :
308- single_output = len (attrs ) == 1
309311 attributes = [a for a in attrs if a is not PRIMARY_KEY ]
310312 result = self ._relation .proj (* attributes ).fetch (** ext_behavior )
311313 if len (result ) != 1 :
@@ -314,7 +316,7 @@ def __call__(self, *attrs, **kwargs):
314316 next (to_dicts (result [self ._relation .primary_key ]))
315317 if attribute is PRIMARY_KEY else result [attribute ][0 ]
316318 for attribute in attrs )
317- ret = return_values [0 ] if single_output else return_values
319+ ret = return_values [0 ] if len ( attrs ) == 1 else return_values
318320
319321
320322 return ret
0 commit comments