source
stringclasses
2 values
version
stringclasses
2 values
module
stringclasses
53 values
function
stringclasses
318 values
input
stringlengths
3
496
expected
stringlengths
0
876
signature
stringclasses
41 values
cpython
3.10
importlib.metadata._text
FoldedCase
>>> "Hello World" in [s]
True
null
cpython
3.10
importlib.metadata._text
FoldedCase
>>> s in ["Hello World"]
True
null
cpython
3.10
importlib.metadata._text
FoldedCase
>>> FoldedCase("Hello World") in {s}
True
null
cpython
3.10
importlib.metadata._text
FoldedCase
>>> s in {FoldedCase("Hello World")}
True
null
cpython
3.10
importlib.metadata._text
FoldedCase
>>> "hello" in FoldedCase("Hello World")
True
null
cpython
3.10
importlib.metadata._text
FoldedCase
>>> FoldedCase('hello') in 'Hello World'
False
null
cpython
3.10
importlib.metadata._text
FoldedCase
>>> FoldedCase('hello').in_('Hello World')
True
null
cpython
3.10
importlib.metadata._text
FoldedCase
>>> FoldedCase('hello') > FoldedCase('Hello')
False
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> class MyClass: ... calls = 0 ... ... @method_cache ... def method(self, value): ... self.calls += 1 ... return value
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a = MyClass()
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a.method(3)
3
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> for x in range(75): ... res = a.method(x)
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a.calls
75
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> b = MyClass()
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> for x in range(35): ... res = b.method(x)
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> b.calls
35
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a.method(0)
0
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a.calls
75
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a.method.cache_clear()
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> c = MyClass()
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> c.method.cache_clear()
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> cache = functools.lru_cache(maxsize=2)
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a = MyClass()
null
cpython
3.10
importlib.metadata._functools
method_cache
>>> a.method2()
3
null
cpython
3.10
importlib.metadata._functools
pass_none
>>> print_text = pass_none(print)
null
cpython
3.10
importlib.metadata._functools
pass_none
>>> print_text('text')
text
null
cpython
3.10
importlib.metadata._functools
pass_none
>>> print_text(None)
null
cpython
3.10
importlib.metadata._collections
FreezableDefaultDict
>>> dd = FreezableDefaultDict(list)
null
cpython
3.10
importlib.metadata._collections
FreezableDefaultDict
>>> dd[0].append('1')
null
cpython
3.10
importlib.metadata._collections
FreezableDefaultDict
>>> dd.freeze()
null
cpython
3.10
importlib.metadata._collections
FreezableDefaultDict
>>> dd[1]
[]
null
cpython
3.10
importlib.metadata._collections
FreezableDefaultDict
>>> len(dd)
1
null
cpython
3.10
importlib.metadata
Sectioned
>>> for item in Sectioned.read(Sectioned._sample): ... print(item)
null
cpython
3.10
importlib.metadata
Sectioned
>>> res = Sectioned.section_pairs(Sectioned._sample)
null
cpython
3.10
importlib.metadata
Sectioned
>>> item = next(res)
null
cpython
3.10
importlib.metadata
Sectioned
>>> item.name
'sec1'
null
cpython
3.10
importlib.metadata
Sectioned
>>> item.value
Pair(name='a', value='1')
null
cpython
3.10
importlib.metadata
Sectioned
>>> item = next(res)
null
cpython
3.10
importlib.metadata
Sectioned
>>> item.value
Pair(name='b', value='2')
null
cpython
3.10
importlib.metadata
Sectioned
>>> item = next(res)
null
cpython
3.10
importlib.metadata
Sectioned
>>> item.name
'sec2'
null
cpython
3.10
importlib.metadata
Sectioned
>>> item.value
Pair(name='a', value='2')
null
cpython
3.10
importlib.metadata
Sectioned
>>> list(res)
[]
null
cpython
3.10
importlib.metadata
EntryPoint
>>> ep = EntryPoint( ... name=None, group=None, value='package.module:attr [extra1, extra2]')
null
cpython
3.10
importlib.metadata
EntryPoint
>>> ep.module
'package.module'
null
cpython
3.10
importlib.metadata
EntryPoint
>>> ep.attr
'attr'
null
cpython
3.10
importlib.metadata
EntryPoint
>>> ep.extras
['extra1', 'extra2']
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep.matches(group='foo')
True
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
True
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep.matches(group='foo', name='other')
False
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep.matches()
True
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep.matches(extras=['extra1', 'extra2'])
True
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep.matches(module='bing')
True
null
cpython
3.10
importlib.metadata
EntryPoint.matches
>>> ep.matches(attr='bong')
True
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> recwarn = getfixture('recwarn')
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl = DeprecatedList(range(3))
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl[0] = 1
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl.append(3)
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> del dl[3]
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl.reverse()
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl.sort()
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl.extend([4])
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl.pop(-1)
4
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl.remove(1)
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl += [5]
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl + [6]
[1, 2, 5, 6]
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl + (6,)
[1, 2, 5, 6]
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl.insert(0, 0)
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl
[0, 1, 2, 5]
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl == [0, 1, 2, 5]
True
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> dl == (0, 1, 2, 5)
True
null
cpython
3.10
importlib.metadata
DeprecatedList
>>> len(recwarn)
1
null
cpython
3.10
importlib.metadata
EntryPoints.groups
>>> EntryPoints().groups
set()
null
cpython
3.10
importlib.metadata
Deprecated
>>> recwarn = getfixture('recwarn')
null
cpython
3.10
importlib.metadata
Deprecated
>>> class DeprecatedDict(Deprecated, dict): pass
null
cpython
3.10
importlib.metadata
Deprecated
>>> dd = DeprecatedDict(foo='bar')
null
cpython
3.10
importlib.metadata
Deprecated
>>> dd.get('baz', None)
null
cpython
3.10
importlib.metadata
Deprecated
>>> dd['foo']
'bar'
null
cpython
3.10
importlib.metadata
Deprecated
>>> list(dd)
['foo']
null
cpython
3.10
importlib.metadata
Deprecated
>>> list(dd.keys())
['foo']
null
cpython
3.10
importlib.metadata
Deprecated
>>> 'foo' in dd
True
null
cpython
3.10
importlib.metadata
Deprecated
>>> list(dd.values())
['bar']
null
cpython
3.10
importlib.metadata
Deprecated
>>> len(recwarn)
1
null
cpython
3.10
importlib.metadata
SelectableGroups.names
>>> SelectableGroups().names
set()
null
cpython
3.10
importlib.metadata
PathDistribution._name_from_stem
>>> PathDistribution._name_from_stem('foo-3.0.egg-info')
'foo'
null
cpython
3.10
importlib.metadata
PathDistribution._name_from_stem
>>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info')
'CherryPy'
null
cpython
3.10
importlib.metadata
PathDistribution._name_from_stem
>>> PathDistribution._name_from_stem('face.egg-info')
'face'
null
cpython
3.10
importlib.metadata
PathDistribution.packages_distributions
>>> import collections.abc
null
cpython
3.10
importlib.metadata
PathDistribution.packages_distributions
>>> pkgs = packages_distributions()
null
cpython
3.10
importlib.metadata
PathDistribution.packages_distributions
>>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
True
null
cpython
3.10
socket
SocketIO.create_server
>>> with create_server(('', 8000)) as server: ... while True: ... conn, addr = server.accept() ... # handle new connection
null
cpython
3.10
http.cookies
__module__
>>> from http import cookies
null
cpython
3.10
http.cookies
__module__
>>> C = cookies.SimpleCookie()
null
cpython
3.10
http.cookies
__module__
>>> C = cookies.SimpleCookie()
null
cpython
3.10
http.cookies
__module__
>>> C["fig"] = "newton"
null
cpython
3.10
http.cookies
__module__
>>> C["sugar"] = "wafer"
null
cpython
3.10
http.cookies
__module__
>>> C.output()
'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer'
null
cpython
3.10
http.cookies
__module__
>>> C = cookies.SimpleCookie()
null