@@ -26,9 +26,13 @@ def __init__(self, arg):
26
26
27
27
def copy (self ):
28
28
"""
29
+ DEPRECATED
30
+
29
31
Creates and returns a copy of this object
30
32
:return: copy FetchBase derivatives
31
33
"""
34
+ warnings .warn ('Use of `copy` on `fetch` object is deprecated' , stacklevel = 2 )
35
+
32
36
return self .__class__ (self )
33
37
34
38
def _initialize_behavior (self ):
@@ -197,14 +201,13 @@ def __call__(self, *attrs, **kwargs):
197
201
ret [blob_name ] = list (map (unpack_ , ret [blob_name ]))
198
202
199
203
else : # if list of attributes provided
200
- single_output = len (attrs ) == 1
201
204
attributes = [a for a in attrs if a is not PRIMARY_KEY ]
202
205
result = self ._relation .proj (* attributes ).fetch (** total_behavior )
203
206
return_values = [
204
207
list (to_dicts (result [self ._relation .primary_key ]))
205
208
if attribute is PRIMARY_KEY else result [attribute ]
206
209
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
208
211
209
212
return ret
210
213
@@ -305,7 +308,6 @@ def __call__(self, *attrs, **kwargs):
305
308
ret = OrderedDict ((name , unpack_ (ret [name ]) if heading [name ].is_blob else ret [name ])
306
309
for name in heading .names )
307
310
else :
308
- single_output = len (attrs ) == 1
309
311
attributes = [a for a in attrs if a is not PRIMARY_KEY ]
310
312
result = self ._relation .proj (* attributes ).fetch (** ext_behavior )
311
313
if len (result ) != 1 :
@@ -314,7 +316,7 @@ def __call__(self, *attrs, **kwargs):
314
316
next (to_dicts (result [self ._relation .primary_key ]))
315
317
if attribute is PRIMARY_KEY else result [attribute ][0 ]
316
318
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
318
320
319
321
320
322
return ret
0 commit comments