|
15 | 15 | def list_or_args(keys, args): |
16 | 16 | # returns a single list combining keys and args |
17 | 17 | try: |
18 | | - i = iter(keys) |
| 18 | + iter(keys) |
19 | 19 | # a string can be iterated, but indicates |
20 | 20 | # keys wasn't passed as a list |
21 | 21 | if isinstance(keys, basestring): |
@@ -457,8 +457,8 @@ def mget(self, keys, *args): |
457 | 457 | """ |
458 | 458 | Returns a list of values ordered identically to ``keys`` |
459 | 459 | """ |
460 | | - keys = list_or_args(keys, args) |
461 | | - return self.execute_command('MGET', *keys) |
| 460 | + args = list_or_args(keys, args) |
| 461 | + return self.execute_command('MGET', *args) |
462 | 462 |
|
463 | 463 | def mset(self, mapping): |
464 | 464 | "Sets each key in the ``mapping`` dict to its corresponding value" |
@@ -777,29 +777,29 @@ def scard(self, name): |
777 | 777 |
|
778 | 778 | def sdiff(self, keys, *args): |
779 | 779 | "Return the difference of sets specified by ``keys``" |
780 | | - keys = list_or_args(keys, args) |
781 | | - return self.execute_command('SDIFF', *keys) |
| 780 | + args = list_or_args(keys, args) |
| 781 | + return self.execute_command('SDIFF', *args) |
782 | 782 |
|
783 | 783 | def sdiffstore(self, dest, keys, *args): |
784 | 784 | """ |
785 | 785 | Store the difference of sets specified by ``keys`` into a new |
786 | 786 | set named ``dest``. Returns the number of keys in the new set. |
787 | 787 | """ |
788 | | - keys = list_or_args(keys, args) |
789 | | - return self.execute_command('SDIFFSTORE', dest, *keys) |
| 788 | + args = list_or_args(keys, args) |
| 789 | + return self.execute_command('SDIFFSTORE', dest, *args) |
790 | 790 |
|
791 | 791 | def sinter(self, keys, *args): |
792 | 792 | "Return the intersection of sets specified by ``keys``" |
793 | | - keys = list_or_args(keys, args) |
794 | | - return self.execute_command('SINTER', *keys) |
| 793 | + args = list_or_args(keys, args) |
| 794 | + return self.execute_command('SINTER', *args) |
795 | 795 |
|
796 | 796 | def sinterstore(self, dest, keys, *args): |
797 | 797 | """ |
798 | 798 | Store the intersection of sets specified by ``keys`` into a new |
799 | 799 | set named ``dest``. Returns the number of keys in the new set. |
800 | 800 | """ |
801 | | - keys = list_or_args(keys, args) |
802 | | - return self.execute_command('SINTERSTORE', dest, *keys) |
| 801 | + args = list_or_args(keys, args) |
| 802 | + return self.execute_command('SINTERSTORE', dest, *args) |
803 | 803 |
|
804 | 804 | def sismember(self, name, value): |
805 | 805 | "Return a boolean indicating if ``value`` is a member of set ``name``" |
@@ -827,16 +827,16 @@ def srem(self, name, *values): |
827 | 827 |
|
828 | 828 | def sunion(self, keys, *args): |
829 | 829 | "Return the union of sets specifiued by ``keys``" |
830 | | - keys = list_or_args(keys, args) |
831 | | - return self.execute_command('SUNION', *keys) |
| 830 | + args = list_or_args(keys, args) |
| 831 | + return self.execute_command('SUNION', *args) |
832 | 832 |
|
833 | 833 | def sunionstore(self, dest, keys, *args): |
834 | 834 | """ |
835 | 835 | Store the union of sets specified by ``keys`` into a new |
836 | 836 | set named ``dest``. Returns the number of keys in the new set. |
837 | 837 | """ |
838 | | - keys = list_or_args(keys, args) |
839 | | - return self.execute_command('SUNIONSTORE', dest, *keys) |
| 838 | + args = list_or_args(keys, args) |
| 839 | + return self.execute_command('SUNIONSTORE', dest, *args) |
840 | 840 |
|
841 | 841 |
|
842 | 842 | #### SORTED SET COMMANDS #### |
@@ -1089,9 +1089,10 @@ def hmset(self, name, mapping): |
1089 | 1089 | items.extend(pair) |
1090 | 1090 | return self.execute_command('HMSET', name, *items) |
1091 | 1091 |
|
1092 | | - def hmget(self, name, keys): |
| 1092 | + def hmget(self, name, keys, *args): |
1093 | 1093 | "Returns a list of values ordered identically to ``keys``" |
1094 | | - return self.execute_command('HMGET', name, *keys) |
| 1094 | + args = list_or_args(keys, args) |
| 1095 | + return self.execute_command('HMGET', name, *args) |
1095 | 1096 |
|
1096 | 1097 | def hvals(self, name): |
1097 | 1098 | "Return the list of values within hash ``name``" |
|
0 commit comments