cut
stringclasses
1 value
version
stringclasses
10 values
idiom_id
stringclasses
53 values
pep
stringclasses
53 values
introduced_in
stringclasses
11 values
form
stringclasses
2 values
file
stringclasses
887 values
code
stringclasses
916 values
source
stringclasses
1 value
origin
stringlengths
15
17
origin_revision
stringclasses
10 values
license
stringclasses
1 value
train
3.9
fstring
498
3.6
modern
fstring/modern_24.py
a = 'some string' f'{a!r}'
pydocs
pep-0498.txt:635
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
fstring
498
3.6
modern
fstring/modern_25.py
f'{repr(a)}'
pydocs
pep-0498.txt:641
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
fstring
498
3.6
modern
fstring/modern_26.py
f'{(lambda x: x*2)(3)}'
pydocs
pep-0498.txt:664
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
fstring
498
3.6
modern
fstring/modern_27.py
extra = '{},waiters:{}'.format(extra, len(self._waiters)) extra = f'{extra},waiters:{len(self._waiters)}'
pydocs
pep-0498.txt:686
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
fstring
498
3.6
modern
fstring/modern_28.py
message.append(" [line {0:2d}]".format(lineno)) message.append(f" [line {lineno:2d}]")
pydocs
pep-0498.txt:691
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
fstring
498
3.6
modern
fstring/modern_29.py
methoddef_name = "{}_METHODDEF".format(c_basename.upper()) methoddef_name = f"{c_basename.upper()}_METHODDEF"
pydocs
pep-0498.txt:696
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
fstring
498
3.6
modern
fstring/modern_30.py
print("Usage: {0} [{1}]".format(sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr) print(f"Usage: {sys.argv[0]} [{'|'.join('--'+opt for opt in valid_opts)}]", file=sys.stderr)
pydocs
pep-0498.txt:701
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_01.py
match = re.match(data) group = match.group(1) if match else None
pydocs
pep-0572.rst:87
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_02.py
group = re.match(data).group(1) if re.match(data) else None
pydocs
pep-0572.rst:92
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_03.py
match1 = pattern1.match(data) match2 = pattern2.match(data) if match1: result = match1.group(1) elif match2: result = match2.group(2) else: result = None
pydocs
pep-0572.rst:97
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_04.py
match1 = pattern1.match(data) if match1: result = match1.group(1) else: match2 = pattern2.match(data) if match2: result = match2.group(2) else: result = None
pydocs
pep-0572.rst:110
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_01.py
# Handle a matched regex if (match := pattern.search(data)) is not None: ... # Do something with match # A loop that can't be trivially rewritten using 2-arg iter() while chunk := file.read(8192): process(chunk) # Reuse a value that's expensive to compute [y := f(x), y**2, y**3] # Share a subexpression be...
pydocs
pep-0572.rst:133
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_02.py
f'{(x:=10)}' # Valid, uses assignment expression x = 10 f'{x:=10}' # Valid, passes '=10' to formatter
pydocs
pep-0572.rst:222
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_03.py
if any((comment := line).startswith('#') for line in lines): print("First comment:", comment) else: print("There are no comments") if all((nonblank := line).strip() == '' for line in lines): print("All lines are blank") else: print("First non-blank line:", nonblank)
pydocs
pep-0572.rst:257
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_04.py
# Compute partial sums in a list comprehension total = 0 partial_sums = [total := total + v for v in values] print("Total:", total)
pydocs
pep-0572.rst:270
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_05.py
[[(j := j) for i in range(5)] for j in range(5)] # INVALID [i := 0 for i, j in stuff] # INVALID [i+1 for i in (i := stuff)] # INVALID
pydocs
pep-0572.rst:287
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_06.py
[False and (i := 0) for i, j in stuff] # INVALID [i for i, j in stuff if True or (j := 1)] # INVALID
pydocs
pep-0572.rst:299
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_07.py
[i+1 for i in (j := stuff)] # INVALID [i+1 for i in range(2) for j in (k := stuff)] # INVALID [i+1 for i in [j for j in (k := stuff)]] # INVALID [i+1 for i in (lambda: (j := stuff))()] # INVALID
pydocs
pep-0572.rst:316
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_08.py
class Example: [(j := i) for i in range(5)] # INVALID
pydocs
pep-0572.rst:327
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_09.py
# Valid if any(len(longline := line) >= 100 for line in lines): print("Extremely long line:", longline)
pydocs
pep-0572.rst:386
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_10.py
x = 1, 2 # Sets x to (1, 2) (x := 1, 2) # Sets x to 1
pydocs
pep-0572.rst:433
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_05.py
env_base = os.environ.get("PYTHONUSERBASE", None) if env_base: return env_base
pydocs
pep-0572.rst:491
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_11.py
if env_base := os.environ.get("PYTHONUSERBASE", None): return env_base
pydocs
pep-0572.rst:497
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_06.py
if self._is_special: ans = self._check_nans(context=context) if ans: return ans
pydocs
pep-0572.rst:507
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_12.py
if self._is_special and (ans := self._check_nans(context=context)): return ans
pydocs
pep-0572.rst:514
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_07.py
reductor = dispatch_table.get(cls) if reductor: rv = reductor(x) else: reductor = getattr(x, "__reduce_ex__", None) if reductor: rv = reductor(4) else: reductor = getattr(x, "__reduce__", None) if reductor: rv = reductor() else: raise Error( ...
pydocs
pep-0572.rst:525
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_13.py
if reductor := dispatch_table.get(cls): rv = reductor(x) elif reductor := getattr(x, "__reduce_ex__", None): rv = reductor(4) elif reductor := getattr(x, "__reduce__", None): rv = reductor() else: raise Error("un(deep)copyable object of type %s" % cls)
pydocs
pep-0572.rst:542
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_08.py
s = _format_time(self._hour, self._minute, self._second, self._microsecond, timespec) tz = self._tzstr() if tz: s += tz return s
pydocs
pep-0572.rst:559
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_14.py
s = _format_time(self._hour, self._minute, self._second, self._microsecond, timespec) if tz := self._tzstr(): s += tz return s
pydocs
pep-0572.rst:569
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_09.py
while True: line = fp.readline() if not line: break m = define_rx.match(line) if m: n, v = m.group(1, 2) try: v = int(v) except ValueError: pass vars[n] = v else: m = undef_rx.match(line) if m: vars[m.group(1...
pydocs
pep-0572.rst:585
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_15.py
while line := fp.readline(): if m := define_rx.match(line): n, v = m.group(1, 2) try: v = int(v) except ValueError: pass vars[n] = v elif m := undef_rx.match(line): vars[m.group(1)] = 0
pydocs
pep-0572.rst:604
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_16.py
results = [(x, y, x/y) for x in input_data if (y := f(x)) > 0]
pydocs
pep-0572.rst:622
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_17.py
stuff = [[y := f(x), x/y] for x in range(5)]
pydocs
pep-0572.rst:627
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_18.py
# Loop-and-a-half while (command := input("> ")) != "quit": print("You entered:", command) # Capturing regular expression match objects # See, for instance, Lib/pydoc.py, which uses a multiline spelling # of this effect if match := re.search(pat, text): print("Found:", match.group(0)) # The same syntax chains ...
pydocs
pep-0572.rst:639
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_19.py
if pid := os.fork(): ... # Parent code else: ... # Child code
pydocs
pep-0572.rst:669
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_20.py
pos = -1 while pos := buffer.find(search_term, pos + 1) >= 0: ...
pydocs
pep-0572.rst:862
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_21.py
(point := (x, y)) (point := x, y)
pydocs
pep-0572.rst:882
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_22.py
foo(x := 1, y) foo(x := (1, y))
pydocs
pep-0572.rst:892
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_23.py
# Top level in if if match := pattern.match(line): return match.group(1) # Short call len(lines := f.readlines())
pydocs
pep-0572.rst:907
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_10.py
mylast = mylast[1] yield mylast[0]
pydocs
pep-0572.rst:996
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_24.py
yield (mylast := mylast[1])[0]
pydocs
pep-0572.rst:1001
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_11.py
while True: old = total total += term if old == total: return total term *= mx2 / (i*(i+1)) i += 2
pydocs
pep-0572.rst:1009
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_25.py
while total != (total := total + term): term *= mx2 / (i*(i+1)) i += 2 return total
pydocs
pep-0572.rst:1019
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_12.py
result = solution(xs, n) if result: ... # use result
pydocs
pep-0572.rst:1037
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_26.py
if result := solution(xs, n): ... # use result
pydocs
pep-0572.rst:1044
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_13.py
reductor = dispatch_table.get(cls) if reductor: rv = reductor(x) else: reductor = getattr(x, "__reduce_ex__", None) if reductor: rv = reductor(4) else: reductor = getattr(x, "__reduce__", None) if reductor: rv = reductor() else: raise Error("un(sha...
pydocs
pep-0572.rst:1057
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_27.py
if reductor := dispatch_table.get(cls): rv = reductor(x) elif reductor := getattr(x, "__reduce_ex__", None): rv = reductor(4) elif reductor := getattr(x, "__reduce__", None): rv = reductor() else: raise Error("un(shallow)copyable object of type %s" % cls)
pydocs
pep-0572.rst:1074
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_14.py
diff = x - x_base if diff: g = gcd(diff, n) if g > 1: return g
pydocs
pep-0572.rst:1091
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_28.py
if (diff := x - x_base) and (g := gcd(diff, n)) > 1: return g
pydocs
pep-0572.rst:1099
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_29.py
while a > (d := x // a**(n-1)): a = ((n-1)*a + d) // n return a
pydocs
pep-0572.rst:1122
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
legacy
walrus/legacy_15.py
while True: d = x // a**(n-1) if a <= d: break a = ((n-1)*a + d) // n return a
pydocs
pep-0572.rst:1140
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_30.py
def f(): a = [TARGET := EXPR for VAR in ITERABLE]
pydocs
pep-0572.rst:1192
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_31.py
def f(): global TARGET a = [TARGET := EXPR for VAR in ITERABLE]
pydocs
pep-0572.rst:1211
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_32.py
def g(): TARGET = ... def f(): nonlocal TARGET a = [TARGET := EXPR for VAR in ITERABLE]
pydocs
pep-0572.rst:1230
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_33.py
def f(): a = [[TARGET := i for i in range(3)] for j in range(2)] # I.e., a = [[0, 1, 2], [0, 1, 2]] print(TARGET) # prints 2
pydocs
pep-0572.rst:1253
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
walrus
572
3.8
modern
walrus/modern_34.py
a = 42 def f(): # `a` is local to `f`, but remains unbound # until the caller executes this genexp: yield ((a := i) for i in range(3)) yield lambda: a + 100 print("done") try: print(f"`a` is bound to {a}") assert False except UnboundLocalError: print("`a` is not yet b...
pydocs
pep-0572.rst:1284
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_01.py
d1 = {'spam': 1} d2 = {'eggs': 2} merged = ChainMap(d2, d1) merged['eggs'] = 999 d2
pydocs
pep-0584.rst:83
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_02.py
d1 = {"spam": 1} d2 = {3665: 2} dict(d1, **d2)
pydocs
pep-0584.rst:98
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_03.py
{'a': 1, 'a': 2} {**d, **e} d.update(e) d[k] = v {k: v for x in (d, e) for (k, v) in x.items()}
pydocs
pep-0584.rst:124
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_01.py
d = {'spam': 1, 'eggs': 2, 'cheese': 3} e = {'cheese': 'cheddar', 'aardvark': 'Ethel'} d | e e | d
pydocs
pep-0584.rst:150
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_02.py
d |= e d
pydocs
pep-0584.rst:159
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_03.py
d | [('spam', 999)] d |= [('spam', 999)] d
pydocs
pep-0584.rst:170
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_04.py
new = {} for d in many_dicts: new |= d
pydocs
pep-0584.rst:270
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_05.py
flags |= WRITEABLE # Probably numeric bitwise-or. DO_NOT_RUN = WEEKENDS | HOLIDAYS # Probably set union. settings = DEFAULT_SETTINGS | user_settings | workspace_settings # Probably dict union.
pydocs
pep-0584.rst:388
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_06.py
d2 | d1 # d1 merged with d2, keeping existing values in d1
pydocs
pep-0584.rst:491
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_07.py
{'a': [1, 2]} | {'a': [3, 4]}
pydocs
pep-0584.rst:501
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_04.py
aliases = dict(kernel_aliases) aliases.update(shell_aliases)
pydocs
pep-0584.rst:670
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_08.py
aliases = kernel_aliases | shell_aliases
pydocs
pep-0584.rst:675
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_05.py
kernel_aliases = dict(base_aliases) kernel_aliases.update({ 'ip' : 'KernelApp.ip', 'hb' : 'KernelApp.hb_port', 'shell' : 'KernelApp.shell_port', 'iopub' : 'KernelApp.iopub_port', 'stdin' : 'KernelApp.stdin_port', 'parent': 'KernelApp.parent', }) if sys.platform.startswith('win'): kernel_alia...
pydocs
pep-0584.rst:684
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_09.py
kernel_aliases = base_aliases | { 'ip' : 'KernelApp.ip', 'hb' : 'KernelApp.hb_port', 'shell' : 'KernelApp.shell_port', 'iopub' : 'KernelApp.iopub_port', 'stdin' : 'KernelApp.stdin_port', 'parent': 'KernelApp.parent', } if sys.platform.startswith('win'): kernel_aliases['interrupt'] = 'KernelA...
pydocs
pep-0584.rst:708
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_06.py
attrib = attrib.copy() attrib.update(extra) attrib = attrib.items()
pydocs
pep-0584.rst:735
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_10.py
attrib = (attrib | extra).items()
pydocs
pep-0584.rst:741
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_07.py
edges = {} edges.update(dict(zip(self.triangle_nodes[border[:,0]][:,1], self.triangle_nodes[border[:,0]][:,2]))) edges.update(dict(zip(self.triangle_nodes[border[:,1]][:,2], self.triangle_nodes[border[:,1]][:,0]))) edges.update(dict(zip(self.triangle_nodes[border[:,2]][:,0], self....
pydocs
pep-0584.rst:750
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_11.py
edges = {} edges |= zip(self.triangle_nodes[border[:,0]][:,1], self.triangle_nodes[border[:,0]][:,2]) edges |= zip(self.triangle_nodes[border[:,1]][:,2], self.triangle_nodes[border[:,1]][:,0]) edges |= zip(self.triangle_nodes[border[:,2]][:,0], self.triangle_nodes[border[:,2]][:,1...
pydocs
pep-0584.rst:760
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_08.py
hm = default_handler_map.copy() hm.update(self._handler_map) return hm
pydocs
pep-0584.rst:775
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_12.py
return default_handler_map | self._handler_map
pydocs
pep-0584.rst:781
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_09.py
_optinfo = {} _optinfo.update(getattr(obj, '_optinfo', {})) _optinfo.update(getattr(obj, '_basedict', {})) if not isinstance(obj, MaskedArray): _optinfo.update(getattr(obj, '__dict__', {}))
pydocs
pep-0584.rst:790
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_13.py
_optinfo = {} _optinfo |= getattr(obj, '_optinfo', {}) _optinfo |= getattr(obj, '_basedict', {}) if not isinstance(obj, MaskedArray): _optinfo |= getattr(obj, '__dict__', {})
pydocs
pep-0584.rst:798
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_10.py
data = {'name': six.text_type(user), 'type': relationship} data.update(kwargs)
pydocs
pep-0584.rst:811
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_14.py
data = {'name': six.text_type(user), 'type': relationship} | kwargs
pydocs
pep-0584.rst:816
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_11.py
kwargs.update(lexer.options) lx = lexer.__class__(**kwargs)
pydocs
pep-0584.rst:825
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_15.py
lx = lexer.__class__(**(kwargs | lexer.options))
pydocs
pep-0584.rst:830
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_12.py
merged_setting = dict_class(to_key_val_list(session_setting)) merged_setting.update(to_key_val_list(request_setting))
pydocs
pep-0584.rst:839
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_16.py
merged_setting = dict_class(to_key_val_list(session_setting)) | to_key_val_list(request_setting)
pydocs
pep-0584.rst:844
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_13.py
self.attrs = self.known_attrs.copy() self.attrs.update(attrs)
pydocs
pep-0584.rst:853
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_17.py
self.attrs = self.known_attrs | attrs
pydocs
pep-0584.rst:858
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_14.py
new_opt = code[0].options.copy() new_opt.update(example.options) example.options = new_opt
pydocs
pep-0584.rst:867
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_18.py
example.options = code[0].options | example.options
pydocs
pep-0584.rst:873
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_15.py
n_attrs = self.default_node_attrs.copy() e_attrs = self.default_edge_attrs.copy() g_attrs.update(graph_attrs) n_attrs.update(node_attrs) e_attrs.update(edge_attrs)
pydocs
pep-0584.rst:882
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_19.py
g_attrs |= graph_attrs n_attrs = self.default_node_attrs | node_attrs e_attrs = self.default_edge_attrs | edge_attrs
pydocs
pep-0584.rst:890
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_16.py
kwargs.update(self.formatter_args) return self.formatter(**kwargs)
pydocs
pep-0584.rst:901
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_20.py
return self.formatter(**(kwargs | self.formatter_args))
pydocs
pep-0584.rst:906
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_17.py
d2 = DEFAULT_VALUE.copy() d2.update(dict(("ext_"+ext, False) for ext in EXTENSIONS)) d2.update(d) d = d2
pydocs
pep-0584.rst:915
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_21.py
d = DEFAULT_VALUE | dict(("ext_"+ext, False) for ext in EXTENSIONS) | d
pydocs
pep-0584.rst:922
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_18.py
clash = {} clash.update(clash1) clash.update(clash2) return clash1, clash2, clash
pydocs
pep-0584.rst:931
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_22.py
return clash1, clash2, clash1 | clash2
pydocs
pep-0584.rst:938
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_19.py
dct = MaximaHelpers.__dict__.copy() dct.update(name_dict) obj = sympify(str, locals=dct)
pydocs
pep-0584.rst:947
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_23.py
obj = sympify(str, locals=MaximaHelpers.__dict__|name_dict)
pydocs
pep-0584.rst:953
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
legacy
dict-union/legacy_20.py
self.known_functions = dict(known_functions) userfuncs = settings.get('user_functions', {}) self.known_functions.update(userfuncs)
pydocs
pep-0584.rst:962
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0
train
3.9
dict-union
584
3.9
modern
dict-union/modern_24.py
self.known_functions = known_functions | settings.get('user_functions', {})
pydocs
pep-0584.rst:968
a95341328c8ee8d84692e5dad85bef668d86c9d5
CC0-1.0