| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d094130 commit c1f779c
45 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -572,7 +572,7 @@ def getvalue(self, key, default=None): | |||
| 572 | 572 | if key in self: | |
| 573 | 573 | value = self[key] | |
| 574 | 574 | if type(value) is type([]): | |
| 575 | - return map(attrgetter('value'), value) | ||
| 575 | + return [x.value for x in value] | ||
| 576 | 576 | else: | |
| 577 | 577 | return value.value | |
| 578 | 578 | else: | |
@@ -594,7 +594,7 @@ def getlist(self, key): | |||
| 594 | 594 | if key in self: | |
| 595 | 595 | value = self[key] | |
| 596 | 596 | if type(value) is type([]): | |
| 597 | - return map(attrgetter('value'), value) | ||
| 597 | + return [x.value for x in value] | ||
| 598 | 598 | else: | |
| 599 | 599 | return [value.value] | |
| 600 | 600 | else: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -253,7 +253,7 @@ def _guess_delimiter(self, data, delimiters): | |||
| 253 | 253 | additional chunks as necessary. | |
| 254 | 254 | """ | |
| 255 | 255 | ||
| 256 | - data = filter(None, data.split('\n')) | ||
| 256 | + data = list(filter(None, data.split('\n'))) | ||
| 257 | 257 | ||
| 258 | 258 | ascii = [chr(c) for c in range(127)] # 7-bit ASCII | |
| 259 | 259 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -841,7 +841,7 @@ def __str__(self, eng = 0, context=None): | |||
| 841 | 841 | if context is None: | |
| 842 | 842 | context = getcontext() | |
| 843 | 843 | ||
| 844 | - tmp = map(str, self._int) | ||
| 844 | + tmp = list(map(str, self._int)) | ||
| 845 | 845 | numdigits = len(self._int) | |
| 846 | 846 | leftdigits = self._exp + numdigits | |
| 847 | 847 | if eng and not self: # self = 0eX wants 0[.0[0]]eY, not [[0]0]0eY | |
@@ -1193,7 +1193,9 @@ def __mul__(self, other, context=None): | |||
| 1193 | 1193 | op1 = _WorkRep(self) | |
| 1194 | 1194 | op2 = _WorkRep(other) | |
| 1195 | 1195 | ||
| 1196 | - ans = Decimal((resultsign, map(int, str(op1.int * op2.int)), resultexp)) | ||
| 1196 | + ans = Decimal((resultsign, | ||
| 1197 | + tuple(map(int, str(op1.int * op2.int))), | ||
| 1198 | + resultexp)) | ||
| 1197 | 1199 | if shouldround: | |
| 1198 | 1200 | ans = ans._fix(context) | |
| 1199 | 1201 | ||
@@ -3145,7 +3147,7 @@ def _string2exact(s): | |||
| 3145 | 3147 | exp -= len(fracpart) | |
| 3146 | 3148 | ||
| 3147 | 3149 | mantissa = intpart + fracpart | |
| 3148 | - tmp = map(int, mantissa) | ||
| 3150 | + tmp = list(map(int, mantissa)) | ||
| 3149 | 3151 | backup = tmp | |
| 3150 | 3152 | while tmp and tmp[0] == 0: | |
| 3151 | 3153 | del tmp[0] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -587,7 +587,7 @@ def get_grouped_opcodes(self, n=3): | |||
| 587 | 587 | Each group is in the same format as returned by get_opcodes(). | |
| 588 | 588 | ||
| 589 | 589 | >>> from pprint import pprint | |
| 590 | - >>> a = map(str, range(1,40)) | ||
| 590 | + >>> a = list(map(str, range(1,40))) | ||
| 591 | 591 | >>> b = a[:] | |
| 592 | 592 | >>> b[8:8] = ['i'] # Make an insertion | |
| 593 | 593 | >>> b[20] += 'x' # Make a replacement | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,8 +112,7 @@ class Distribution: | |||
| 112 | 112 | ('obsoletes', None, | |
| 113 | 113 | "print the list of packages/modules made obsolete") | |
| 114 | 114 | ] | |
| 115 | - display_option_names = map(lambda x: translate_longopt(x[0]), | ||
| 116 | - display_options) | ||
| 115 | + display_option_names = [translate_longopt(x[0]) for x in display_options] | ||
| 117 | 116 | ||
| 118 | 117 | # negative options are options that exclude other options | |
| 119 | 118 | negative_opt = {'quiet': 'verbose'} | |
@@ -805,7 +804,7 @@ def get_command_packages (self): | |||
| 805 | 804 | pkgs = (pkgs or "").split(",") | |
| 806 | 805 | for i in range(len(pkgs)): | |
| 807 | 806 | pkgs[i] = pkgs[i].strip() | |
| 808 | - pkgs = filter(None, pkgs) | ||
| 807 | + pkgs = [p for p in pkgs if p] | ||
| 809 | 808 | if "distutils.command" not in pkgs: | |
| 810 | 809 | pkgs.insert(0, "distutils.command") | |
| 811 | 810 | self.command_packages = pkgs | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -372,7 +372,7 @@ def _init_posix(): | |||
| 372 | 372 | if cur_target == '': | |
| 373 | 373 | cur_target = cfg_target | |
| 374 | 374 | os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target) | |
| 375 | - elif map(int, cfg_target.split('.')) > map(int, cur_target.split('.')): | ||
| 375 | + elif [int(x) for x in cfg_target.split('.')] > [int(x) for x in cur_target.split('.')]: | ||
| 376 | 376 | my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' | |
| 377 | 377 | % (cur_target, cfg_target)) | |
| 378 | 378 | raise DistutilsPlatformError(my_msg) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -148,7 +148,7 @@ def parse (self, vstring): | |||
| 148 | 148 | if patch: | |
| 149 | 149 | self.version = tuple(map(int, [major, minor, patch])) | |
| 150 | 150 | else: | |
| 151 | - self.version = tuple(map(int, [major, minor]) + [0]) | ||
| 151 | + self.version = tuple(map(int, [major, minor])) + (0,) | ||
| 152 | 152 | ||
| 153 | 153 | if prerelease: | |
| 154 | 154 | self.prerelease = (prerelease[0], int(prerelease_num)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ def nameprep(label): | |||
| 38 | 38 | raise UnicodeError("Invalid character %r" % c) | |
| 39 | 39 | ||
| 40 | 40 | # Check bidi | |
| 41 | - RandAL = map(stringprep.in_table_d1, label) | ||
| 41 | + RandAL = [stringprep.in_table_d1(x) for x in label] | ||
| 42 | 42 | for c in RandAL: | |
| 43 | 43 | if c: | |
| 44 | 44 | # There is a RandAL char in the string. Must perform further | |
@@ -47,7 +47,7 @@ def nameprep(label): | |||
| 47 | 47 | # This is table C.8, which was already checked | |
| 48 | 48 | # 2) If a string contains any RandALCat character, the string | |
| 49 | 49 | # MUST NOT contain any LCat character. | |
| 50 | - if filter(stringprep.in_table_d2, label): | ||
| 50 | + if any(stringprep.in_table_d2(x) for x in label): | ||
| 51 | 51 | raise UnicodeError("Violation of BIDI requirement 2") | |
| 52 | 52 | ||
| 53 | 53 | # 3) If a string contains any RandALCat character, a | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -132,9 +132,9 @@ def phase0(self): # Compare everything except common subdirectories | |||
| 132 | 132 | def phase1(self): # Compute common names | |
| 133 | 133 | a = dict(izip(imap(os.path.normcase, self.left_list), self.left_list)) | |
| 134 | 134 | b = dict(izip(imap(os.path.normcase, self.right_list), self.right_list)) | |
| 135 | - self.common = map(a.__getitem__, ifilter(b.__contains__, a)) | ||
| 136 | - self.left_only = map(a.__getitem__, ifilterfalse(b.__contains__, a)) | ||
| 137 | - self.right_only = map(b.__getitem__, ifilterfalse(a.__contains__, b)) | ||
| 135 | + self.common = list(map(a.__getitem__, ifilter(b.__contains__, a))) | ||
| 136 | + self.left_only = list(map(a.__getitem__, ifilterfalse(b.__contains__, a))) | ||
| 137 | + self.right_only = list(map(b.__getitem__, ifilterfalse(a.__contains__, b))) | ||
| 138 | 138 | ||
| 139 | 139 | def phase2(self): # Distinguish files, directories, funnies | |
| 140 | 140 | self.common_dirs = [] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -129,7 +129,7 @@ | |||
| 129 | 129 | __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', | |
| 130 | 130 | 'nlargest', 'nsmallest'] | |
| 131 | 131 | ||
| 132 | - from itertools import islice, repeat, count, imap, izip, tee | ||
| 132 | + from itertools import islice, repeat, count, izip, tee | ||
| 133 | 133 | from operator import itemgetter, neg | |
| 134 | 134 | import bisect | |
| 135 | 135 | ||
@@ -225,7 +225,7 @@ def nsmallest(n, iterable): | |||
| 225 | 225 | # O(m) + O(n log m) comparisons. | |
| 226 | 226 | h = list(iterable) | |
| 227 | 227 | heapify(h) | |
| 228 | - return map(heappop, repeat(h, min(n, len(h)))) | ||
| 228 | + return list(map(heappop, repeat(h, min(n, len(h))))) | ||
| 229 | 229 | ||
| 230 | 230 | # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos | |
| 231 | 231 | # is the index of a leaf with a possibly out-of-order value. Restore the | |
@@ -351,9 +351,9 @@ def nsmallest(n, iterable, key=None): | |||
| 351 | 351 | Equivalent to: sorted(iterable, key=key)[:n] | |
| 352 | 352 | """ | |
| 353 | 353 | in1, in2 = tee(iterable) | |
| 354 | - it = izip(imap(key, in1), count(), in2) # decorate | ||
| 354 | + it = izip(map(key, in1), count(), in2) # decorate | ||
| 355 | 355 | result = _nsmallest(n, it) | |
| 356 | - return map(itemgetter(2), result) # undecorate | ||
| 356 | + return list(map(itemgetter(2), result)) # undecorate | ||
| 357 | 357 | ||
| 358 | 358 | _nlargest = nlargest | |
| 359 | 359 | def nlargest(n, iterable, key=None): | |
@@ -362,9 +362,9 @@ def nlargest(n, iterable, key=None): | |||
| 362 | 362 | Equivalent to: sorted(iterable, key=key, reverse=True)[:n] | |
| 363 | 363 | """ | |
| 364 | 364 | in1, in2 = tee(iterable) | |
| 365 | - it = izip(imap(key, in1), imap(neg, count()), in2) # decorate | ||
| 365 | + it = izip(map(key, in1), map(neg, count()), in2) # decorate | ||
| 366 | 366 | result = _nlargest(n, it) | |
| 367 | - return map(itemgetter(2), result) # undecorate | ||
| 367 | + return list(map(itemgetter(2), result)) # undecorate | ||
| 368 | 368 | ||
| 369 | 369 | if __name__ == "__main__": | |
| 370 | 370 | # Simple sanity test | |
| Back | FazBrowse Home | New Git URL |
0 commit comments