uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e2d04e7b29de24a3a1efda3a | train | class | class TestCasting(BaseDatetimeTests, base.BaseCastingTests):
pass
| class TestCasting(BaseDatetimeTests, base.BaseCastingTests):
| pass
| # ... but not the rest.
super().test_arith_series_with_scalar(data, all_arithmetic_operators)
def test_divmod_series_array(self):
# GH 23287
# skipping because it is not implemented
pass
class TestCasting(BaseDatetimeTests, base.BaseCastingTests):
| 64 | 64 | 15 | 12 | 51 | arushi-08/pandas | pandas/tests/extension/test_datetime.py | Python | TestCasting | TestCasting | 170 | 171 | 170 | 170 | 7efb46ce0435617d742874a32a3ac246d79aa70f | bigcode/the-stack | train |
f8ccaff2766ac091481df877 | train | class | class TestReshaping(BaseDatetimeTests, base.BaseReshapingTests):
@pytest.mark.skip(reason="We have DatetimeTZBlock")
def test_concat(self, data, in_frame):
pass
| class TestReshaping(BaseDatetimeTests, base.BaseReshapingTests):
@pytest.mark.skip(reason="We have DatetimeTZBlock")
| def test_concat(self, data, in_frame):
pass
| pass
class TestComparisonOps(BaseDatetimeTests, base.BaseComparisonOpsTests):
pass
class TestMissing(BaseDatetimeTests, base.BaseMissingTests):
pass
class TestReshaping(BaseDatetimeTests, base.BaseReshapingTests):
@pytest.mark.skip(reason="We have DatetimeTZBlock")
| 64 | 64 | 44 | 30 | 33 | arushi-08/pandas | pandas/tests/extension/test_datetime.py | Python | TestReshaping | TestReshaping | 182 | 185 | 182 | 183 | c8e85028d8b56e70ee97fcebae6f4f8317176104 | bigcode/the-stack | train |
3e873687960cbaa1424448f3 | train | class | class TestGetitem(BaseDatetimeTests, base.BaseGetitemTests):
pass
| class TestGetitem(BaseDatetimeTests, base.BaseGetitemTests):
| pass
| class TestConstructors(BaseDatetimeTests, base.BaseConstructorsTests):
def test_series_constructor(self, data):
# Series construction drops any .freq attr
data = data._with_freq(None)
super().test_series_constructor(data)
class TestGetitem(BaseDatetimeTests, base.BaseGetitemTests):
| 64 | 64 | 17 | 14 | 50 | arushi-08/pandas | pandas/tests/extension/test_datetime.py | Python | TestGetitem | TestGetitem | 106 | 107 | 106 | 106 | 75063d412cde8cab0f2cfa4f8e2acc1cb92e5d9c | bigcode/the-stack | train |
e0b16c4c24329281f24386bb | train | function | @cli.command()
def run():
# Double check in case the environment variable is sent via Docker,
# which will send empty strings for missing environment variables
hostname = os.environ.get('API_HOST', None)
if not hostname:
hostname = 'localhost'
port = os.environ.get('API_PORT', None)
if ... | @cli.command()
def run():
# Double check in case the environment variable is sent via Docker,
# which will send empty strings for missing environment variables
| hostname = os.environ.get('API_HOST', None)
if not hostname:
hostname = 'localhost'
port = os.environ.get('API_PORT', None)
if not port:
port = '3000'
cors_protection = os.environ.get('CORS_PROTECTION', 'True') == 'True'
# start the web api
settings = {
'bind': '{h... | UBLIC-KEY: {}'.format(keypair.public_key))
click.echo('X-OMI-PRIVATE-KEY: {}'.format(keypair.private_key))
@cli.command()
def run():
# Double check in case the environment variable is sent via Docker,
# which will send empty strings for missing environment variables
| 64 | 64 | 184 | 33 | 31 | COALAIP/omi-mvi-1.0 | omi_api/cli.py | Python | run | run | 34 | 58 | 34 | 37 | 017af34ba3c03c30d03b094185d8c749a9eee787 | bigcode/the-stack | train |
cfd804e454a5730dd1045733 | train | function | @click.group()
def cli():
pass
| @click.group()
def cli():
| pass
| import os
import click
import pymongo
from bigchaindb_driver.crypto import generate_keypair
from omi_api.server import create_server
from omi_api.queries import bdb_coll
@click.group()
def cli():
| 46 | 64 | 9 | 6 | 39 | COALAIP/omi-mvi-1.0 | omi_api/cli.py | Python | cli | cli | 11 | 13 | 11 | 12 | 201840e4288ceca55e5d0afd518a6385af3e61be | bigcode/the-stack | train |
607ed9b9264b4900e64536fd | train | function | @cli.command()
def indexes():
base = 'block.transactions.asset.data'
indexes = ['iswc', 'isrc', 'title', 'artists.name', 'composers.name',
'songwriters.name', 'publishers.name', 'name']
for i in indexes:
bdb_coll().create_index([('{}.{}'.format(base, i),
... | @cli.command()
def indexes():
| base = 'block.transactions.asset.data'
indexes = ['iswc', 'isrc', 'title', 'artists.name', 'composers.name',
'songwriters.name', 'publishers.name', 'name']
for i in indexes:
bdb_coll().create_index([('{}.{}'.format(base, i),
pymongo.ASCENDING)])... | import os
import click
import pymongo
from bigchaindb_driver.crypto import generate_keypair
from omi_api.server import create_server
from omi_api.queries import bdb_coll
@click.group()
def cli():
pass
@cli.command()
def indexes():
| 56 | 64 | 82 | 7 | 48 | COALAIP/omi-mvi-1.0 | omi_api/cli.py | Python | indexes | indexes | 16 | 23 | 16 | 17 | a2e4afca6ab69cb17d5fe9a794a0bff6c3a30777 | bigcode/the-stack | train |
a335e343ee6ca22304cb38fd | train | function | @cli.command()
def keypair():
keypair = generate_keypair()
click.echo('Use these in the headers of your POST requests')
click.echo('X-OMI-PUBLIC-KEY: {}'.format(keypair.public_key))
click.echo('X-OMI-PRIVATE-KEY: {}'.format(keypair.private_key))
| @cli.command()
def keypair():
| keypair = generate_keypair()
click.echo('Use these in the headers of your POST requests')
click.echo('X-OMI-PUBLIC-KEY: {}'.format(keypair.public_key))
click.echo('X-OMI-PRIVATE-KEY: {}'.format(keypair.private_key))
| 'title', 'artists.name', 'composers.name',
'songwriters.name', 'publishers.name', 'name']
for i in indexes:
bdb_coll().create_index([('{}.{}'.format(base, i),
pymongo.ASCENDING)])
@cli.command()
def keypair():
| 63 | 64 | 70 | 8 | 55 | COALAIP/omi-mvi-1.0 | omi_api/cli.py | Python | keypair | keypair | 26 | 31 | 26 | 27 | 1b6ebb73adf4dbaec2404b2fbc8d6ef49fdcf349 | bigcode/the-stack | train |
af3c52407dc4b2a9668afc8b | train | function | def handler_class_for_type(type, re=re.compile('^([^<]+)(<.*>)?$')):
typename = str(type.tag)
match = re.match(typename)
if not match:
return None
klass = match.group(1)
if klass == 'AK::Atomic':
return AKAtomic
elif klass == 'AK::DistinctNumeric':
return AKDistinctNum... | def handler_class_for_type(type, re=re.compile('^([^<]+)(<.*>)?$')):
| typename = str(type.tag)
match = re.match(typename)
if not match:
return None
klass = match.group(1)
if klass == 'AK::Atomic':
return AKAtomic
elif klass == 'AK::DistinctNumeric':
return AKDistinctNumeric
elif klass == 'AK::InlineLinkedList':
return AKInlin... | # Copyright (c) 2021, Gunnar Beutner <gunnar@beutner.name>
#
# SPDX-License-Identifier: BSD-2-Clause
import gdb
import gdb.types
import re
def handler_class_for_type(type, re=re.compile('^([^<]+)(<.*>)?$')):
| 66 | 90 | 302 | 21 | 44 | winfr34k/serenity | Meta/serenity_gdb.py | Python | handler_class_for_type | handler_class_for_type | 10 | 50 | 10 | 10 | 5a25a30113afffb412302c7ef1c93e077f865ffe | bigcode/the-stack | train |
d6727aab6df110006947df99 | train | class | class AKRefPtr:
def __init__(self, val):
self.val = val
def to_string(self):
return AKRefPtr.prettyprint_type(self.val.type)
def get_pointee(self):
inner_type = self.val.type.template_argument(0)
inner_type_ptr = inner_type.pointer()
return self.val["m_bits"]["m_val... | class AKRefPtr:
| def __init__(self, val):
self.val = val
def to_string(self):
return AKRefPtr.prettyprint_type(self.val.type)
def get_pointee(self):
inner_type = self.val.type.template_argument(0)
inner_type_ptr = inner_type.pointer()
return self.val["m_bits"]["m_value"].cast(inner_... | [('*', self.val["m_ptr"])]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::OwnPtr<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}>'
class AKRefPtr:
| 63 | 64 | 148 | 5 | 58 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKRefPtr | AKRefPtr | 177 | 195 | 177 | 177 | ba8ec46922bd580708875dc98b8a7000ef48589a | bigcode/the-stack | train |
db97f4c1c3d6003434aa9f47 | train | class | class SerenityPrettyPrinterLocator(gdb.printing.PrettyPrinter):
def __init__(self):
super(SerenityPrettyPrinterLocator, self).__init__("serenity_pretty_printers", [])
def __call__(self, val):
type = gdb.types.get_basic_type(val.type)
handler = handler_class_for_type(type)
if han... | class SerenityPrettyPrinterLocator(gdb.printing.PrettyPrinter):
| def __init__(self):
super(SerenityPrettyPrinterLocator, self).__init__("serenity_pretty_printers", [])
def __call__(self, val):
type = gdb.types.get_basic_type(val.type)
handler = handler_class_for_type(type)
if handler is UnhandledType:
return None
return ha... | VirtualAddress:
def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_address"]
@classmethod
def prettyprint_type(cls, type):
return 'VirtualAddress'
class SerenityPrettyPrinterLocator(gdb.printing.PrettyPrinter):
| 64 | 64 | 89 | 13 | 51 | winfr34k/serenity | Meta/serenity_gdb.py | Python | SerenityPrettyPrinterLocator | SerenityPrettyPrinterLocator | 359 | 368 | 359 | 359 | ffbeaf8e73a7d281a403f72835421216756d3358 | bigcode/the-stack | train |
9a0bb4c4bb4fc1bb22b12689 | train | class | class AKOwnPtr:
def __init__(self, val):
self.val = val
def to_string(self):
return AKOwnPtr.prettyprint_type(self.val.type)
def children(self):
return [('*', self.val["m_ptr"])]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(... | class AKOwnPtr:
| def __init__(self, val):
self.val = val
def to_string(self):
return AKOwnPtr.prettyprint_type(self.val.type)
def children(self):
return [('*', self.val["m_ptr"])]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
retur... | else:
str_type = gdb.lookup_type("char").array(self.val["m_length"])
return get_field_unalloced(self.val, "m_inline_buffer", str_type)
@classmethod
def prettyprint_type(cls, type):
return 'AK::StringImpl'
class AKOwnPtr:
| 64 | 64 | 103 | 5 | 59 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKOwnPtr | AKOwnPtr | 161 | 174 | 161 | 161 | 7a849d73b469774cf7efab9399c1ebda23032a8f | bigcode/the-stack | train |
2b89d1c8faefa4705c830a9a | train | class | class AKVector:
def __init__(self, val):
self.val = val
def to_string(self):
return f'{AKVector.prettyprint_type(self.val.type)} of len {int(self.val["m_size"])}'
def children(self):
vec_len = int(self.val["m_size"])
if vec_len == 0:
return []
outline_... | class AKVector:
| def __init__(self, val):
self.val = val
def to_string(self):
return f'{AKVector.prettyprint_type(self.val.type)} of len {int(self.val["m_size"])}'
def children(self):
vec_len = int(self.val["m_size"])
if vec_len == 0:
return []
outline_buf = self.val["... | break
return contained_types
@classmethod
def prettyprint_type(cls, ty):
names = ", ".join(handler_class_for_type(t).prettyprint_type(t) for t in AKVariant.resolve_types(ty))
return f'AK::Variant<{names}>'
class AKVector:
| 63 | 64 | 212 | 4 | 59 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKVector | AKVector | 232 | 259 | 232 | 232 | 997ea63feb1603c7a97a0d191d6bba87b933460e | bigcode/the-stack | train |
b8502a24b041f32b96031828 | train | class | class AKInlineLinkedList:
def __init__(self, val):
self.val = val
def to_string(self):
return AKInlineLinkedList.prettyprint_type(self.val.type)
def children(self):
node_type_ptr = self.val.type.template_argument(0).pointer()
elements = []
node = self.val["m_head"]... | class AKInlineLinkedList:
| def __init__(self, val):
self.val = val
def to_string(self):
return AKInlineLinkedList.prettyprint_type(self.val.type)
def children(self):
node_type_ptr = self.val.type.template_argument(0).pointer()
elements = []
node = self.val["m_head"]
while node != 0:
... | ]) for i in range(len(elements))]
@classmethod
def prettyprint_type(cls, type):
template_type = type.template_argument(0)
return f'AK::SinglyLinkedList<{handler_class_for_type(template_type).prettyprint_type(template_type)}>'
class AKInlineLinkedList:
| 63 | 64 | 167 | 6 | 57 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKInlineLinkedList | AKInlineLinkedList | 323 | 344 | 323 | 323 | 1575add9b80e7c0bee6b56ca32de75a852be598f | bigcode/the-stack | train |
774b5b3d96dc1dd4ea3fcf03 | train | class | class AKSinglyLinkedList:
def __init__(self, val):
self.val = val
def to_string(self):
return AKSinglyLinkedList.prettyprint_type(self.val.type)
def children(self):
elements = []
node = self.val["m_head"]
while node != 0:
elements.append(node["value"])
... | class AKSinglyLinkedList:
| def __init__(self, val):
self.val = val
def to_string(self):
return AKSinglyLinkedList.prettyprint_type(self.val.type)
def children(self):
elements = []
node = self.val["m_head"]
while node != 0:
elements.append(node["value"])
node = node["n... | template_types = list(type.template_argument(i) for i in (0, 1))
key, value = list(handler_class_for_type(t).prettyprint_type(t) for t in template_types)
return f'AK::HashMap<{key}, {value}>'
class AKSinglyLinkedList:
| 63 | 64 | 149 | 7 | 56 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKSinglyLinkedList | AKSinglyLinkedList | 300 | 320 | 300 | 300 | 348e44209d02bc6b01655d037560bd199f7348fd | bigcode/the-stack | train |
f372ae86c285e705fd6a5e7b | train | class | class VirtualAddress:
def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_address"]
@classmethod
def prettyprint_type(cls, type):
return 'VirtualAddress'
| class VirtualAddress:
| def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_address"]
@classmethod
def prettyprint_type(cls, type):
return 'VirtualAddress'
| ].dereference()) for i in range(len(elements))]
@classmethod
def prettyprint_type(cls, type):
template_type = type.template_argument(0)
return f'AK::InlineLinkedList<{handler_class_for_type(template_type).prettyprint_type(template_type)}>'
class VirtualAddress:
| 63 | 64 | 52 | 4 | 59 | winfr34k/serenity | Meta/serenity_gdb.py | Python | VirtualAddress | VirtualAddress | 347 | 356 | 347 | 347 | 9c75eb574f47bbde8d8ac2a57d3358e92daba143 | bigcode/the-stack | train |
331c5280b09c94a6b24845c7 | train | class | class AKAtomic:
def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_value"]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::Atomic<{handler_class_for_type(contained_type).prettyprint_type(... | class AKAtomic:
| def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_value"]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::Atomic<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}... |
elif klass == 'AK::Vector':
return AKVector
elif klass == 'VirtualAddress':
return VirtualAddress
else:
return UnhandledType
class UnhandledType:
@classmethod
def prettyprint_type(cls, type):
return type.name
class AKAtomic:
| 64 | 64 | 80 | 4 | 59 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKAtomic | AKAtomic | 59 | 69 | 59 | 59 | 5ab13461b3682a72af4aa1c9262b242bc55f9a09 | bigcode/the-stack | train |
427128dd371e862e2d4a119d | train | class | class AKDistinctNumeric:
def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_value"]
@classmethod
def prettyprint_type(cls, type):
actual_name = type.template_argument(1)
parts = actual_name.name.split("::")
unqualified_name = re.sub(... | class AKDistinctNumeric:
| def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_value"]
@classmethod
def prettyprint_type(cls, type):
actual_name = type.template_argument(1)
parts = actual_name.name.split("::")
unqualified_name = re.sub(r'__(\w+)_tag', r'\1', ac... | _string(self):
return self.val["m_value"]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::Atomic<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}>'
class AKDistinctNumeric:
| 63 | 64 | 174 | 5 | 58 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKDistinctNumeric | AKDistinctNumeric | 72 | 89 | 72 | 72 | 3ab05e55f465952a3dcc52f754381d27201c434b | bigcode/the-stack | train |
96c353a3e094671a1bb42fab | train | class | class AKStringView:
def __init__(self, val):
self.val = val
def to_string(self):
if int(self.val["m_length"]) == 0:
return '""'
else:
characters = self.val["m_characters"]
str_type = characters.type.target().array(self.val["m_length"]).pointer()
... | class AKStringView:
| def __init__(self, val):
self.val = val
def to_string(self):
if int(self.val["m_length"]) == 0:
return '""'
else:
characters = self.val["m_characters"]
str_type = characters.type.target().array(self.val["m_length"]).pointer()
return str(ch... | return '""'
else:
impl = AKRefPtr(self.val["m_impl"]).get_pointee().dereference()
return AKStringImpl(impl).to_string()
@classmethod
def prettyprint_type(cls, type):
return 'AK::String'
class AKStringView:
| 64 | 64 | 107 | 5 | 59 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKStringView | AKStringView | 121 | 135 | 121 | 121 | 87e378a9abd43c45ec1340847bbbd4c79df2c015 | bigcode/the-stack | train |
272d5d165ad0321691a33ef5 | train | class | class AKVariant:
def __init__(self, val):
self.val = val
self.index = int(self.val["m_index"])
self.contained_types = self.resolve_types(self.val.type)
def to_string(self):
return AKVariant.prettyprint_type(self.val.type)
def children(self):
data = self.val["m_data"... | class AKVariant:
| def __init__(self, val):
self.val = val
self.index = int(self.val["m_index"])
self.contained_types = self.resolve_types(self.val.type)
def to_string(self):
return AKVariant.prettyprint_type(self.val.type)
def children(self):
data = self.val["m_data"]
ty = se... | children(self):
return [('*', self.get_pointee())]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::RefPtr<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}>'
class AKVariant:
| 67 | 68 | 228 | 4 | 63 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKVariant | AKVariant | 198 | 229 | 198 | 198 | 50033a55d880ae0a31abe59be515bab1d3fc0c1b | bigcode/the-stack | train |
4211dd084cf170433563b576 | train | class | class AKString:
def __init__(self, val):
self.val = val
def to_string(self):
if int(self.val["m_impl"]["m_bits"]["m_value"]) == 0:
return '""'
else:
impl = AKRefPtr(self.val["m_impl"]).get_pointee().dereference()
return AKStringImpl(impl).to_string()
... | class AKString:
| def __init__(self, val):
self.val = val
def to_string(self):
if int(self.val["m_impl"]["m_bits"]["m_value"]) == 0:
return '""'
else:
impl = AKRefPtr(self.val["m_impl"]).get_pointee().dereference()
return AKStringImpl(impl).to_string()
@classmetho... | ):
return self.val["m_ref_count"]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::RefCounted<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}>'
class AKString:
| 63 | 64 | 103 | 4 | 59 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKString | AKString | 105 | 118 | 105 | 105 | e7f9d286bc441794493734487383850305d8714b | bigcode/the-stack | train |
3a6b68e87a706d8b05ef917c | train | class | class AKHashMapPrettyPrinter:
def __init__(self, val):
self.val = val
@staticmethod
def _iter_hashtable(val, cb):
entry_type_ptr = val.type.template_argument(0).pointer()
buckets = val["m_buckets"]
for i in range(0, val["m_capacity"]):
bucket = buckets[i]
... | class AKHashMapPrettyPrinter:
| def __init__(self, val):
self.val = val
@staticmethod
def _iter_hashtable(val, cb):
entry_type_ptr = val.type.template_argument(0).pointer()
buckets = val["m_buckets"]
for i in range(0, val["m_capacity"]):
bucket = buckets[i]
if bucket["used"]:
... | (self.val, "m_inline_buffer_storage", inner_type_ptr)
return [(f"[{i}]", elements[i]) for i in range(vec_len)]
@classmethod
def prettyprint_type(cls, type):
template_type = type.template_argument(0)
return f'AK::Vector<{handler_class_for_type(template_type).prettyprint_type(template_ty... | 84 | 85 | 285 | 7 | 77 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKHashMapPrettyPrinter | AKHashMapPrettyPrinter | 262 | 297 | 262 | 262 | cdf76467b5b4ed32f023668ac16fa1228a9a6ea0 | bigcode/the-stack | train |
dbb60254f71df884f3e02b1c | train | class | class AKStringImpl:
def __init__(self, val):
self.val = val
def to_string(self):
if int(self.val["m_length"]) == 0:
return '""'
else:
str_type = gdb.lookup_type("char").array(self.val["m_length"])
return get_field_unalloced(self.val, "m_inline_buffer"... | class AKStringImpl:
| def __init__(self, val):
self.val = val
def to_string(self):
if int(self.val["m_length"]) == 0:
return '""'
else:
str_type = gdb.lookup_type("char").array(self.val["m_length"])
return get_field_unalloced(self.val, "m_inline_buffer", str_type)
@cl... | 'gdb.error'> value requires 4294967296 bytes, which is more than max-value-size
# This works around that issue.
return gdb.parse_and_eval(f"*({type}*)(({val.type.name}*){int(val.address)})->{member}")
class AKStringImpl:
| 63 | 64 | 104 | 5 | 58 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKStringImpl | AKStringImpl | 145 | 158 | 145 | 145 | 8bfc4cfeaf5e1647911fddd4bbeeb28d693ae924 | bigcode/the-stack | train |
e102d6b818f5a0377fd77a9e | train | function | def get_field_unalloced(val, member, type):
# Trying to access a variable-length field seems to fail with
# Python Exception <class 'gdb.error'> value requires 4294967296 bytes, which is more than max-value-size
# This works around that issue.
return gdb.parse_and_eval(f"*({type}*)(({val.type.name}*){in... | def get_field_unalloced(val, member, type):
# Trying to access a variable-length field seems to fail with
# Python Exception <class 'gdb.error'> value requires 4294967296 bytes, which is more than max-value-size
# This works around that issue.
| return gdb.parse_and_eval(f"*({type}*)(({val.type.name}*){int(val.address)})->{member}")
| View'
def get_field_unalloced(val, member, type):
# Trying to access a variable-length field seems to fail with
# Python Exception <class 'gdb.error'> value requires 4294967296 bytes, which is more than max-value-size
# This works around that issue.
| 64 | 64 | 90 | 62 | 2 | winfr34k/serenity | Meta/serenity_gdb.py | Python | get_field_unalloced | get_field_unalloced | 138 | 142 | 138 | 141 | 1a84f10f7ba08c4f61db3d49009efdd0d5ceb414 | bigcode/the-stack | train |
9d5c916b0d099fee7427f338 | train | class | class FindThreadCmd(gdb.Command):
"""
Find SerenityOS thread for the specified TID.
find_thread TID
"""
def __init__(self):
super(FindThreadCmd, self).__init__(
"find_thread", gdb.COMMAND_USER
)
def _find_thread(self, tid):
threads = gdb.parse_and_eval("Kern... | class FindThreadCmd(gdb.Command):
| """
Find SerenityOS thread for the specified TID.
find_thread TID
"""
def __init__(self):
super(FindThreadCmd, self).__init__(
"find_thread", gdb.COMMAND_USER
)
def _find_thread(self, tid):
threads = gdb.parse_and_eval("Kernel::Thread::g_tid_map")
th... | ", [])
def __call__(self, val):
type = gdb.types.get_basic_type(val.type)
handler = handler_class_for_type(type)
if handler is UnhandledType:
return None
return handler(val)
gdb.printing.register_pretty_printer(None, SerenityPrettyPrinterLocator(), replace=True)
class ... | 76 | 76 | 255 | 8 | 68 | winfr34k/serenity | Meta/serenity_gdb.py | Python | FindThreadCmd | FindThreadCmd | 374 | 410 | 374 | 374 | 9325137c1352d3f3bb1c817d9e82770656b277ad | bigcode/the-stack | train |
493febde8f26cf46a8b8d4ed | train | class | class UnhandledType:
@classmethod
def prettyprint_type(cls, type):
return type.name
| class UnhandledType:
@classmethod
| def prettyprint_type(cls, type):
return type.name
| return AKStringImpl
elif klass == 'AK::Variant':
return AKVariant
elif klass == 'AK::Vector':
return AKVector
elif klass == 'VirtualAddress':
return VirtualAddress
else:
return UnhandledType
class UnhandledType:
@classmethod
| 64 | 64 | 23 | 9 | 54 | winfr34k/serenity | Meta/serenity_gdb.py | Python | UnhandledType | UnhandledType | 53 | 56 | 53 | 54 | e451d73ee9b5a0af63747fc91a1778f7b1d4e1f5 | bigcode/the-stack | train |
0269ba7bcee9a09efcde83d9 | train | class | class AKRefCounted:
def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_ref_count"]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::RefCounted<{handler_class_for_type(contained_type).prett... | class AKRefCounted:
| def __init__(self, val):
self.val = val
def to_string(self):
return self.val["m_ref_count"]
@classmethod
def prettyprint_type(cls, type):
contained_type = type.template_argument(0)
return f'AK::RefCounted<{handler_class_for_type(contained_type).prettyprint_type(containe... | _name])
return qualified_name
# If the tag is malformed, just print DistinctNumeric<T>
contained_type = type.template_argument(0)
return f'AK::DistinctNumeric<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}>'
class AKRefCounted:
| 63 | 64 | 85 | 6 | 57 | winfr34k/serenity | Meta/serenity_gdb.py | Python | AKRefCounted | AKRefCounted | 92 | 102 | 92 | 92 | 2d2090108f507465b94fb25d17697e4b6e592bea | bigcode/the-stack | train |
60b020947de4a75034b122d7 | train | class | class Panther(Source):
"""
The pairwise orthology calls from Panther DB:
http://pantherdb.org/ encompass 22 species,
from the RefGenome and HCOP projects.
Here, we map the orthology classes to RO homology relationships
This resource may be extended in the future with additional species.
Thi... | class Panther(Source):
| """
The pairwise orthology calls from Panther DB:
http://pantherdb.org/ encompass 22 species,
from the RefGenome and HCOP projects.
Here, we map the orthology classes to RO homology relationships
This resource may be extended in the future with additional species.
This currently makes a gra... | import tarfile
import re
import logging
from dipper.sources.Source import Source
from dipper.models.assoc.OrthologyAssoc import OrthologyAssoc
from dipper.models.Model import Model
__author__ = 'nicole'
LOG = logging.getLogger(__name__)
class Panther(Source):
| 61 | 256 | 3,350 | 4 | 57 | sgml/dipper | dipper/sources/Panther.py | Python | Panther | Panther | 14 | 368 | 14 | 14 | e515d9690d60cbb34ad54d55e771f27ef7d3781e | bigcode/the-stack | train |
dc05d63ffd60199133805a09 | train | function | def resource_mapping():
return {
'OS::Nova::Server': Server,
}
| def resource_mapping():
| return {
'OS::Nova::Server': Server,
}
| _for_replace(self):
# if the server has not been created yet, do nothing
if self.resource_id is None:
return
self.prepare_ports_for_replace()
def restore_prev_rsrc(self, convergence=False):
self.restore_ports_after_rollback(convergence=convergence)
def resource_mapping(... | 64 | 64 | 19 | 4 | 60 | ljzjohnson/heat | heat/engine/resources/openstack/nova/server.py | Python | resource_mapping | resource_mapping | 1,775 | 1,778 | 1,775 | 1,775 | 82d451b33f9e671a3cf8a350d488e8e2939a4cc1 | bigcode/the-stack | train |
784533fe22025a1adbe40e08 | train | class | class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
server_network_mixin.ServerNetworkMixin):
"""A resource for managing Nova instances.
A Server resource manages the running virtual machine instance within an
OpenStack cloud.
"""
PROPERTIES = (
NAME, IMAGE, BLOCK_DEV... | class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
server_network_mixin.ServerNetworkMixin):
| """A resource for managing Nova instances.
A Server resource manages the running virtual machine instance within an
OpenStack cloud.
"""
PROPERTIES = (
NAME, IMAGE, BLOCK_DEVICE_MAPPING, BLOCK_DEVICE_MAPPING_V2,
FLAVOR, FLAVOR_UPDATE_POLICY, IMAGE_UPDATE_POLICY, KEY_NAME,
A... | License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
from oslo_config import cfg
from oslo_log import log as logging
from oslo_... | 256 | 256 | 14,070 | 22 | 234 | ljzjohnson/heat | heat/engine/resources/openstack/nova/server.py | Python | Server | Server | 42 | 1,772 | 42 | 43 | 69819feeee27832dc7b31c246ab56094affbf346 | bigcode/the-stack | train |
58c31171bcf2ab4c3c94b387 | train | class | class CRNLab(object):
'''
Implements high level modeling akin to experimental TX-TL experiments
'''
def __init__(self, name = '', **kwargs):
self.Mixture = Mixture
self.name = name
self.volume = 0
self.crn = None
self.warning_print = True
def mixture(self, na... | class CRNLab(object):
| '''
Implements high level modeling akin to experimental TX-TL experiments
'''
def __init__(self, name = '', **kwargs):
self.Mixture = Mixture
self.name = name
self.volume = 0
self.crn = None
self.warning_print = True
def mixture(self, name, **kwargs):
... |
# Copyright (c) 2019, Build-A-Cell. All rights reserved.
# See LICENSE file in the project root directory for details.
# from .extracts import *
from .mixture import Mixture
from .dna_assembly import DNAassembly
from .mixtures_cell import *
from .mixtures_extract import *
import libsbml
import warnings
import inspec... | 91 | 256 | 1,088 | 6 | 84 | eldad-a/BioCRNPyler | biocrnpyler/crnlab.py | Python | CRNLab | CRNLab | 14 | 129 | 14 | 14 | c03a8c1a053118dacc8d411555076def9743e231 | bigcode/the-stack | train |
37b26376640240b0ffabb3ef | train | class | class WTFPluginConfigInterface(object):
def __init__(self, pid, context, package, config_file, enabled=False, config={}, actions={}, requests={}, **kwargs):
"""
Args:
pid:
context:
package:
config_file:
config: json string of config params... | class WTFPluginConfigInterface(object):
| def __init__(self, pid, context, package, config_file, enabled=False, config={}, actions={}, requests={}, **kwargs):
"""
Args:
pid:
context:
package:
config_file:
config: json string of config params
**kwargs:
"""
... | , function):
self._function = function
#TODO(zpriddy): Get param default values, updated with values passed in, and check for required inputs
def get_default_params(self):
params = dict()
for name, param in self.params.params.iteritems():
params[name] = param.default
... | 219 | 219 | 732 | 7 | 211 | zpriddy/WTF-Plugin-Framework | wtf_plugin/wtf_plugin_interface.py | Python | WTFPluginConfigInterface | WTFPluginConfigInterface | 135 | 223 | 135 | 135 | b06b9ac9b6df50d363fab1771f87add5de41a215 | bigcode/the-stack | train |
2ef39709828793e99c317cbd | train | class | class WTFActionsInterface(object):
def __init__(self, actions):
"""
Args:
actions (WTFActions):
"""
self._actions = dict()
for action_name, action in actions.actions.iteritems():
self._actions[action_name] = WTFActionInterface(action)
def __geta... | class WTFActionsInterface(object):
| def __init__(self, actions):
"""
Args:
actions (WTFActions):
"""
self._actions = dict()
for action_name, action in actions.actions.iteritems():
self._actions[action_name] = WTFActionInterface(action)
def __getattr__(self, item):
if item ... | = WTFActionsInterface(self.config.requests)
@property
def config(self):
return self._plugin_config
@property
def actions(self):
return self._plugin_actions
@property
def requests(self):
return self._plugin_requests
class WTFActionsInterface(object):
| 64 | 64 | 209 | 7 | 56 | zpriddy/WTF-Plugin-Framework | wtf_plugin/wtf_plugin_interface.py | Python | WTFActionsInterface | WTFActionsInterface | 56 | 89 | 56 | 56 | 761ac4096f159f97d08aabef387f4966bdf7dee8 | bigcode/the-stack | train |
65261e6e87d6c730a3f35aca | train | class | class WTFParamInterface(object):
def __init__(self, param, value=None):
# type: (WTFParam, Any) -> None
self._param = param
self._value = None
self.set_value(value)
def set_value(self, value):
if not value and self.param.default_init:
self.value = self.param... | class WTFParamInterface(object):
| def __init__(self, param, value=None):
# type: (WTFParam, Any) -> None
self._param = param
self._value = None
self.set_value(value)
def set_value(self, value):
if not value and self.param.default_init:
self.value = self.param.default
else:
... | property
def package(self):
return self._package
@property
def id(self):
return self._pid
@property
def actions(self):
return self._actions
@property
def requests(self):
return self._requests
class WTFParamInterface(object):
| 64 | 64 | 136 | 6 | 57 | zpriddy/WTF-Plugin-Framework | wtf_plugin/wtf_plugin_interface.py | Python | WTFParamInterface | WTFParamInterface | 226 | 250 | 226 | 226 | 2decc5847a19fec3842577b00bba9f3176ebfae3 | bigcode/the-stack | train |
4a1a5f1d119db44a3cc896ab | train | class | class WTFPluginInterface(object):
def __init__(self, plugin_config):
self._plugin_config = WTFPluginConfigInterface(**plugin_config)
self._plugin_actions = WTFActionsInterface(self.config.actions)
self._plugin_requests = WTFActionsInterface(self.config.requests)
def read_user_config_f... | class WTFPluginInterface(object):
| def __init__(self, plugin_config):
self._plugin_config = WTFPluginConfigInterface(**plugin_config)
self._plugin_actions = WTFActionsInterface(self.config.actions)
self._plugin_requests = WTFActionsInterface(self.config.requests)
def read_user_config_file(self, config_folder='config'):... | #
#################################################################################
import json
from os.path import join, isfile
from typing import Any, Tuple
from wtf_action import WTFActions, WTFActionConfig
from wtf_params import WTFParams, WTFParam
from wtf_request import WTFRequest
import logging
class WTFPlu... | 64 | 64 | 157 | 6 | 57 | zpriddy/WTF-Plugin-Framework | wtf_plugin/wtf_plugin_interface.py | Python | WTFPluginInterface | WTFPluginInterface | 30 | 53 | 30 | 30 | a67495785199d4d9650321e5002203e2afad1562 | bigcode/the-stack | train |
45973cc4d97c41e19c8f66bd | train | class | class WTFActionInterface(WTFActionConfig):
def __init__(self, action, **kwargs):
"""
Args:
action (WTFActionConfig):
"""
super(WTFActionInterface, self).__init__(**action.export_for_action_import())
self._function = None
def set_function(self, function):
... | class WTFActionInterface(WTFActionConfig):
| def __init__(self, action, **kwargs):
"""
Args:
action (WTFActionConfig):
"""
super(WTFActionInterface, self).__init__(**action.export_for_action_import())
self._function = None
def set_function(self, function):
self._function = function
#TODO(z... | return self._actions
@property
def enabled_actions(self):
enabled_actions = list()
for action_name, action in self.actions.iteritems():
if action.enabled:
enabled_actions.append(action_name)
return enabled_actions
def set_action_function(self, action_na... | 83 | 83 | 278 | 9 | 74 | zpriddy/WTF-Plugin-Framework | wtf_plugin/wtf_plugin_interface.py | Python | WTFActionInterface | WTFActionInterface | 92 | 132 | 92 | 92 | 4a19d30e95231f36aa131608ce8bade4a01e467c | bigcode/the-stack | train |
2d0868506ac2db543b30fb1b | train | function | def read_state_file(filename):
assert filename.startswith("state") and filename.endswith("storable")
try:
data = storable.retrieve(filename)
except Exception as e:
print("{0} Error: could read state file {1}: {2}".format(
Symbol.NOK_RED, filename, e))
| def read_state_file(filename):
| assert filename.startswith("state") and filename.endswith("storable")
try:
data = storable.retrieve(filename)
except Exception as e:
print("{0} Error: could read state file {1}: {2}".format(
Symbol.NOK_RED, filename, e))
| plugins[plugin].is_multigraph = (
len(elements) == 3)
settings.domains[domain.text].hosts[host].plugins[plugin].settings = {
'graph_title': link.text,
}
settings.nb_plugins += 1
return settings
def read_state_file(filename):
| 64 | 64 | 66 | 6 | 57 | solact/munin-influxdb | munininfluxdb/munin.py | Python | read_state_file | read_state_file | 141 | 148 | 141 | 141 | 3cb880fff6eef836d2fe902506249e4faaff60af | bigcode/the-stack | train |
f63750fc99cc7632c13b5ab1 | train | function | def discover_from_datafile(settings):
"""
/var/lib/munin/htmlconf.storable contains a copy of all informations required to build the graph (limits, legend, types...)
Parsing it should be much easier and much faster than running munin-run config
@param filename: usually /var/lib/munin/datafile
@retu... | def discover_from_datafile(settings):
| """
/var/lib/munin/htmlconf.storable contains a copy of all informations required to build the graph (limits, legend, types...)
Parsing it should be much easier and much faster than running munin-run config
@param filename: usually /var/lib/munin/datafile
@return: settings
"""
with open(se... | import os
import sys
import pprint
from .utils import ProgressBar, Symbol
from .settings import Settings
import storable
def discover_from_datafile(settings):
| 35 | 194 | 648 | 7 | 27 | solact/munin-influxdb | munininfluxdb/munin.py | Python | discover_from_datafile | discover_from_datafile | 11 | 75 | 11 | 11 | c0362705a7490c6a056469c2a871c23f8864315b | bigcode/the-stack | train |
365ba2984acdd79eb3073052 | train | function | def discover_from_www(settings):
"""
Builds a Munin dashboard structure (domain/host/plugins) by reading the HTML files
rather than listing the cache folder because the later is likely to contain old data
"""
# delayed import since this function should not be used in the "normal" case
try:
... | def discover_from_www(settings):
| """
Builds a Munin dashboard structure (domain/host/plugins) by reading the HTML files
rather than listing the cache folder because the later is likely to contain old data
"""
# delayed import since this function should not be used in the "normal" case
try:
from bs4 import BeautifulSou... | , type_suffix))
_field.xml_filename = os.path.join(settings.paths['xml'], "{0}-{1}-{2}-{3}-{4}.xml".format(
domain, host, plugin.replace(".", "-"), field, type_suffix))
# remove multigraph intermediates
if '.' in plugin:
mg_plugin, mg_field = plugin.split(".")
... | 152 | 152 | 507 | 6 | 145 | solact/munin-influxdb | munininfluxdb/munin.py | Python | discover_from_www | discover_from_www | 78 | 138 | 78 | 78 | 3205fca20d218a7aae6637ac263e635dc217b35a | bigcode/the-stack | train |
862f6ae6cff27604740cdfda | train | function | def test_reverse():
assert ImmutableList.of(1, 2, 3).reverse() == Cons(3, Cons(2, Cons(1, Nil())))
| def test_reverse():
| assert ImmutableList.of(1, 2, 3).reverse() == Cons(3, Cons(2, Cons(1, Nil())))
| , 2, 3) == Cons(1, Cons(2, Cons(3, Nil())))
def test_list_of_list():
assert ImmutableList.of_list([1, 2, 3]) == Cons(1, Cons(2, Cons(3, Nil())))
def test_reverse():
| 63 | 64 | 35 | 4 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_reverse | test_reverse | 34 | 35 | 34 | 34 | 61079dedaddc60b9d4416b60d663c332144769e6 | bigcode/the-stack | train |
bb16e5a254555cf9b2930e82 | train | function | def test_take_right_until():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_right_until(lambda x: x < 3) == ImmutableList.of(3, 4, 5, 6)
| def test_take_right_until():
| assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_right_until(lambda x: x < 3) == ImmutableList.of(3, 4, 5, 6)
| 6)
assert list.take_right(-1) == ImmutableList.empty()
def test_take_right_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take_right(10) == list
def test_take_right_until():
| 64 | 64 | 56 | 6 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_right_until | test_take_right_until | 220 | 221 | 220 | 220 | af5bea1ecb8a44d529b8aedd37f0c47255e22e10 | bigcode/the-stack | train |
6bbf5b9becdadaa35e5baf1d | train | function | def test_or_else_nil():
assert ImmutableList.empty().or_else(ImmutableList.of(1, 2, 3, 4)) == ImmutableList.of(1, 2, 3, 4)
| def test_or_else_nil():
| assert ImmutableList.empty().or_else(ImmutableList.of(1, 2, 3, 4)) == ImmutableList.of(1, 2, 3, 4)
| _while(lambda x: x > 3) == ImmutableList.of(1, 2, 3)
def test_drop_right_while_nil():
list = ImmutableList.empty()
assert list.drop_right_while(lambda x: x > 3) == ImmutableList.empty()
def test_or_else_nil():
| 64 | 64 | 46 | 6 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_or_else_nil | test_or_else_nil | 168 | 169 | 168 | 168 | f6ef7119b0c6420605133750a9b89d63e8b76f51 | bigcode/the-stack | train |
1a5948150cf02ee82e7461d5 | train | function | def test_nil_is_empty():
assert len(Nil()) == 0
assert Nil().is_empty() == True
| def test_nil_is_empty():
| assert len(Nil()) == 0
assert Nil().is_empty() == True
| import pytest
from pytest import fail
from pyvavr import ValueException
from pyvavr.collection.list import Nil, Cons, ImmutableList
def test_nil_is_empty():
| 36 | 64 | 26 | 6 | 29 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_nil_is_empty | test_nil_is_empty | 8 | 10 | 8 | 8 | c496764db997d278d96d2de488632ab23205c1c9 | bigcode/the-stack | train |
23bea0051f691633e5a4c007 | train | function | def test_list_range():
assert ImmutableList.range(0, 5, 1) == Cons(0, Cons(1, Cons(2, Cons(3, Cons(4, Nil())))))
| def test_list_range():
| assert ImmutableList.range(0, 5, 1) == Cons(0, Cons(1, Cons(2, Cons(3, Cons(4, Nil())))))
| == Cons(3, Cons(2, Cons(1, Nil())))
def test_map():
assert ImmutableList.of(1, 2, 3).map(lambda x: x + 2) == Cons(3, Cons(4, Cons(5, Nil())))
def test_list_range():
| 63 | 64 | 43 | 5 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_list_range | test_list_range | 42 | 43 | 42 | 42 | dcfd3facb78c2ee847147737e3e542476c86852d | bigcode/the-stack | train |
f4a6aa2d20e6877de082d2ce | train | function | def test_take_while():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_while(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
| def test_take_while():
| assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_while(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
| .take(10) == list
def test_take_until():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_until(lambda x: x > 3) == ImmutableList.of(1, 2, 3)
def test_take_while():
| 64 | 64 | 53 | 6 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_while | test_take_while | 198 | 199 | 198 | 198 | c5325ac38ece24f7566a5fe27f41a6e9ce7fee23 | bigcode/the-stack | train |
790d103ac8988ce08b674b24 | train | function | def test_filter():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).filter(lambda x: x % 2 == 0) == ImmutableList.of(2, 4, 6)
| def test_filter():
| assert ImmutableList.of(1, 2, 3, 4, 5, 6).filter(lambda x: x % 2 == 0) == ImmutableList.of(2, 4, 6)
| 5, 6)
def test_take_right_while():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_right_while(lambda x: x > 3) == ImmutableList.of(4, 5, 6)
def test_filter():
| 64 | 64 | 52 | 4 | 60 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_filter | test_filter | 228 | 229 | 228 | 228 | 70e8ada68aa997f4667d6bec36c44b1cfaf8e06f | bigcode/the-stack | train |
9f4158499647d5bc51e26133 | train | function | def test_drop_right_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(10) == ImmutableList.empty()
| def test_drop_right_more_than_len():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(10) == ImmutableList.empty()
| == ImmutableList.of(1, 2, 3)
def test_drop_right_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(-1) == list
def test_drop_right_more_than_len():
| 64 | 64 | 45 | 8 | 55 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_right_more_than_len | test_drop_right_more_than_len | 143 | 145 | 143 | 143 | 048a2e55583ac434081352e5aa2363af1958fe3b | bigcode/the-stack | train |
0ae608e9a67fb5cca09bfb1f | train | function | def test_empty_prepend():
assert Nil().prepend(1) == Cons(1, Nil())
| def test_empty_prepend():
| assert Nil().prepend(1) == Cons(1, Nil())
| _is_empty():
assert len(Nil()) == 0
assert Nil().is_empty() == True
def test_cons_is_not_empty():
assert len(Cons(1, Nil())) == 1
assert Cons(1, Nil()).is_empty() == False
def test_empty_prepend():
| 64 | 64 | 21 | 6 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_empty_prepend | test_empty_prepend | 18 | 19 | 18 | 18 | 34db009cc3561f8f1627b5ed181d0d8fb783f66e | bigcode/the-stack | train |
ef08e3bafb19fb9bc8fbb887 | train | function | def test_map():
assert ImmutableList.of(1, 2, 3).map(lambda x: x + 2) == Cons(3, Cons(4, Cons(5, Nil())))
| def test_map():
| assert ImmutableList.of(1, 2, 3).map(lambda x: x + 2) == Cons(3, Cons(4, Cons(5, Nil())))
| 1, 2, 3]) == Cons(1, Cons(2, Cons(3, Nil())))
def test_reverse():
assert ImmutableList.of(1, 2, 3).reverse() == Cons(3, Cons(2, Cons(1, Nil())))
def test_map():
| 63 | 64 | 42 | 4 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_map | test_map | 38 | 39 | 38 | 38 | ad0442fbd4d804c08ecf8217dba4a9a26e4a5dae | bigcode/the-stack | train |
871ed0c75488ad49ba7fd4a4 | train | function | def test_drop_right_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(-1) == list
| def test_drop_right_less_than_zero():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(-1) == list
| ) == ImmutableList.empty()
def test_drop_right():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(3) == ImmutableList.of(1, 2, 3)
def test_drop_right_less_than_zero():
| 64 | 64 | 43 | 8 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_right_less_than_zero | test_drop_right_less_than_zero | 138 | 140 | 138 | 138 | 21dd3faf0b0b6d23845d4572af36d4514ce04652 | bigcode/the-stack | train |
f79ada4017e28ab2bd4e3c6d | train | function | def test_drop_right_while_nil():
list = ImmutableList.empty()
assert list.drop_right_while(lambda x: x > 3) == ImmutableList.empty()
| def test_drop_right_while_nil():
| list = ImmutableList.empty()
assert list.drop_right_while(lambda x: x > 3) == ImmutableList.empty()
| _right_while():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right_while(lambda x: x > 3) == ImmutableList.of(1, 2, 3)
def test_drop_right_while_nil():
| 64 | 64 | 35 | 8 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_right_while_nil | test_drop_right_while_nil | 163 | 165 | 163 | 163 | 001863ad5e182703aba3ff0dcbbb0b2712c86389 | bigcode/the-stack | train |
fcb0cee1d7897979873683ab | train | function | def test_list_of():
assert ImmutableList.of(1, 2, 3) == Cons(1, Cons(2, Cons(3, Nil())))
| def test_list_of():
| assert ImmutableList.of(1, 2, 3) == Cons(1, Cons(2, Cons(3, Nil())))
| test_empty_prepend():
assert Nil().prepend(1) == Cons(1, Nil())
def test_non_empty_prepend():
assert Cons(2, Cons(3, Nil)).prepend(1) == Cons(1, Cons(2, Cons(3, Nil)))
def test_list_of():
| 63 | 64 | 34 | 5 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_list_of | test_list_of | 26 | 27 | 26 | 26 | 980664d13c7c0d92d09e5f5e5b1f3dc700913b16 | bigcode/the-stack | train |
a707b49aa7679db0c2b2ccbe | train | function | def test_take():
assert ImmutableList.of(1, 2, 3, 4, 5).take(3) == ImmutableList.of(1, 2, 3)
| def test_take():
| assert ImmutableList.of(1, 2, 3, 4, 5).take(3) == ImmutableList.of(1, 2, 3)
| (4, 5, 6).or_else(ImmutableList.of(1, 2, 3, 4)) == ImmutableList.of(4, 5, 6)
def test_take_nil():
assert ImmutableList.empty().take(2) == ImmutableList.empty()
def test_take():
| 64 | 64 | 41 | 4 | 60 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take | test_take | 180 | 181 | 180 | 180 | cf57974ffd4f351b5bac65f889efa15097d2191e | bigcode/the-stack | train |
68223bde1839046ddb796a7b | train | function | def test_recusrion_limit():
list = ImmutableList.of(*[i for i in range(0, 2000)])
assert len(list) == 2000
| def test_recusrion_limit():
| list = ImmutableList.of(*[i for i in range(0, 2000)])
assert len(list) == 2000
| (3, Cons(4, Nil())))))
def test_list_range_reversed():
assert ImmutableList.range(5, 0, -1) == Cons(5, Cons(4, Cons(3, Cons(2, Cons(1, Nil())))))
def test_recusrion_limit():
| 63 | 64 | 37 | 7 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_recusrion_limit | test_recusrion_limit | 50 | 52 | 50 | 50 | 87c51dfbd45e61a00aff640c09024e7781e0de29 | bigcode/the-stack | train |
55f9622b6815253c4943ae86 | train | function | def test_drop_right_until_nil():
list = ImmutableList.empty()
assert list.drop_right_until(lambda x: x < 3) == ImmutableList.empty()
| def test_drop_right_until_nil():
| list = ImmutableList.empty()
assert list.drop_right_until(lambda x: x < 3) == ImmutableList.empty()
| def test_drop_right_until():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right_until(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
def test_drop_right_until_nil():
| 64 | 64 | 33 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_right_until_nil | test_drop_right_until_nil | 153 | 155 | 153 | 153 | bebbd98033a1c948229c068e10b1839a596df0af | bigcode/the-stack | train |
d6ffe934fc61c302121b631c | train | function | def test_iterator():
immutable_list = ImmutableList.of_list([1, 2, 3, 4, 5, 6])
result = []
for i in immutable_list:
result.append(i)
assert result == [1, 2, 3, 4, 5, 6]
| def test_iterator():
| immutable_list = ImmutableList.of_list([1, 2, 3, 4, 5, 6])
result = []
for i in immutable_list:
result.append(i)
assert result == [1, 2, 3, 4, 5, 6]
| assert ImmutableList.range(0, 2000).fold_left(0, lambda x, y: x + y) == 1999000
def test_iterator_nil():
immutable_list = ImmutableList.empty()
for i in immutable_list:
fail("Should not reach statement")
def test_iterator():
| 64 | 64 | 68 | 4 | 60 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_iterator | test_iterator | 84 | 90 | 84 | 84 | 3cf7ee7df76704ca7b62822f95f98bb2d1e4df04 | bigcode/the-stack | train |
8fcfd1d81fa1558cab0c2ab3 | train | function | def test_filter_nil():
assert ImmutableList.empty().filter(lambda x: x % 2 == 0) == ImmutableList.empty()
| def test_filter_nil():
| assert ImmutableList.empty().filter(lambda x: x % 2 == 0) == ImmutableList.empty()
| , 5, 6)
def test_filter():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).filter(lambda x: x % 2 == 0) == ImmutableList.of(2, 4, 6)
def test_filter_nil():
| 64 | 64 | 28 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_filter_nil | test_filter_nil | 232 | 233 | 232 | 232 | fd26938fb9afe01d26ef606f9804dac4a6394662 | bigcode/the-stack | train |
6ad6438bd0ce8b70078e833b | train | function | def test_head_cons_returns_first_element():
assert Cons(1, Cons(2, Nil())).head() == 1
| def test_head_cons_returns_first_element():
| assert Cons(1, Cons(2, Nil())).head() == 1
| range(0, 2000)])
assert len(list) == 2000
def test_head_nil_raises():
with pytest.raises(ValueException):
Nil().head()
def test_tail_nil_raises():
with pytest.raises(ValueException):
Nil().tail()
def test_head_cons_returns_first_element():
| 64 | 64 | 26 | 8 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_head_cons_returns_first_element | test_head_cons_returns_first_element | 65 | 66 | 65 | 65 | d63cc8d2c4bf02e9425c8d607e5b17b7ae388f5b | bigcode/the-stack | train |
40733f198390312e5fe095da | train | function | def test_drop_right_until():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right_until(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
| def test_drop_right_until():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right_until(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
| 6)
assert list.drop_right(-1) == list
def test_drop_right_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(10) == ImmutableList.empty()
def test_drop_right_until():
| 64 | 64 | 57 | 6 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_right_until | test_drop_right_until | 148 | 150 | 148 | 148 | 5ee6d5230f967813b2f61ba58094c2564ce14658 | bigcode/the-stack | train |
eddd66367cf1adc149e2569b | train | function | def test_drop_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(10) == ImmutableList.empty()
| def test_drop_more_than_len():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(10) == ImmutableList.empty()
| (3) == ImmutableList.of(4, 5, 6)
def test_drop_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(-1) == list
def test_drop_more_than_len():
| 64 | 64 | 43 | 7 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_more_than_len | test_drop_more_than_len | 108 | 110 | 108 | 108 | f9f90858c8a26ec44028b72d9df3e7c47650c542 | bigcode/the-stack | train |
3a3f0c1b7994d7e9de0d2b71 | train | function | def test_take_right_while():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_right_while(lambda x: x > 3) == ImmutableList.of(4, 5, 6)
| def test_take_right_while():
| assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_right_while(lambda x: x > 3) == ImmutableList.of(4, 5, 6)
|
def test_take_right_until():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_right_until(lambda x: x < 3) == ImmutableList.of(3, 4, 5, 6)
def test_take_right_while():
| 64 | 64 | 55 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_right_while | test_take_right_while | 224 | 225 | 224 | 224 | b3e2ba4cadec167b45d8aa1720eb78d8ae4e4d98 | bigcode/the-stack | train |
bc1214e494efb83d3b58ceb4 | train | function | def test_list_range_reversed():
assert ImmutableList.range(5, 0, -1) == Cons(5, Cons(4, Cons(3, Cons(2, Cons(1, Nil())))))
| def test_list_range_reversed():
| assert ImmutableList.range(5, 0, -1) == Cons(5, Cons(4, Cons(3, Cons(2, Cons(1, Nil())))))
| 3, Cons(4, Cons(5, Nil())))
def test_list_range():
assert ImmutableList.range(0, 5, 1) == Cons(0, Cons(1, Cons(2, Cons(3, Cons(4, Nil())))))
def test_list_range_reversed():
| 63 | 64 | 45 | 7 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_list_range_reversed | test_list_range_reversed | 46 | 47 | 46 | 46 | 976abb5fbd141bef4f9bc02e8e28b2a6449fd2fa | bigcode/the-stack | train |
e11ef828489716e5bc428c34 | train | function | def test_drop_until():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_until(lambda x: x > 3) == ImmutableList.of(4, 5, 6)
| def test_drop_until():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_until(lambda x: x > 3) == ImmutableList.of(4, 5, 6)
| 5, 6)
assert list.drop(-1) == list
def test_drop_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(10) == ImmutableList.empty()
def test_drop_until():
| 64 | 64 | 55 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_until | test_drop_until | 113 | 115 | 113 | 113 | 7816f6ba0c1b8da55787edd3fff07b730866aadf | bigcode/the-stack | train |
c03abbc798de8fe68dbb9c0e | train | function | def test_tail_cons_returns_all_but_first():
assert Cons(1, Cons(2, Nil())).tail() == Cons(2, Nil())
| def test_tail_cons_returns_all_but_first():
| assert Cons(1, Cons(2, Nil())).tail() == Cons(2, Nil())
| .raises(ValueException):
Nil().head()
def test_tail_nil_raises():
with pytest.raises(ValueException):
Nil().tail()
def test_head_cons_returns_first_element():
assert Cons(1, Cons(2, Nil())).head() == 1
def test_tail_cons_returns_all_but_first():
| 64 | 64 | 31 | 10 | 53 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_tail_cons_returns_all_but_first | test_tail_cons_returns_all_but_first | 69 | 70 | 69 | 69 | 23f650b7381557882ff4a7ca7c3a56196a4c8f7e | bigcode/the-stack | train |
c0a9193efe38a172947aaefa | train | function | def test_or_else():
assert ImmutableList.of(4, 5, 6).or_else(ImmutableList.of(1, 2, 3, 4)) == ImmutableList.of(4, 5, 6)
| def test_or_else():
| assert ImmutableList.of(4, 5, 6).or_else(ImmutableList.of(1, 2, 3, 4)) == ImmutableList.of(4, 5, 6)
| (lambda x: x > 3) == ImmutableList.empty()
def test_or_else_nil():
assert ImmutableList.empty().or_else(ImmutableList.of(1, 2, 3, 4)) == ImmutableList.of(1, 2, 3, 4)
def test_or_else():
| 64 | 64 | 50 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_or_else | test_or_else | 172 | 173 | 172 | 172 | e0f03665d24e2ac4c6e91d1577b925e14e1883f1 | bigcode/the-stack | train |
55d7fd44018fb88fafbdc33c | train | function | def test_take_right_nil():
assert ImmutableList.empty().take_right(2) == ImmutableList.empty()
| def test_take_right_nil():
| assert ImmutableList.empty().take_right(2) == ImmutableList.empty()
| 2, 3)
def test_take_while():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_while(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
def test_take_right_nil():
| 64 | 64 | 22 | 6 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_right_nil | test_take_right_nil | 202 | 203 | 202 | 202 | 01f9690e69a0925abab127a25d36dd83850c6f78 | bigcode/the-stack | train |
715d3cb383496c334c6b649b | train | function | def test_tail_nil_raises():
with pytest.raises(ValueException):
Nil().tail()
| def test_tail_nil_raises():
| with pytest.raises(ValueException):
Nil().tail()
| )
def test_recusrion_limit():
list = ImmutableList.of(*[i for i in range(0, 2000)])
assert len(list) == 2000
def test_head_nil_raises():
with pytest.raises(ValueException):
Nil().head()
def test_tail_nil_raises():
| 64 | 64 | 19 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_tail_nil_raises | test_tail_nil_raises | 60 | 62 | 60 | 60 | 10eefc4d217de4f23ae80046335d2a3b5168f6bf | bigcode/the-stack | train |
50b04739e10e66f6b96f993e | train | function | def test_take_until():
assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_until(lambda x: x > 3) == ImmutableList.of(1, 2, 3)
| def test_take_until():
| assert ImmutableList.of(1, 2, 3, 4, 5, 6).take_until(lambda x: x > 3) == ImmutableList.of(1, 2, 3)
| 5, 6)
assert list.take(-1) == ImmutableList.empty()
def test_take_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take(10) == list
def test_take_until():
| 64 | 64 | 51 | 5 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_until | test_take_until | 194 | 195 | 194 | 194 | acbf0ab7bc7d12e92c8457bfed6b3924ab28cab6 | bigcode/the-stack | train |
12be2c5bb2cd4cfdf566262e | train | function | def test_iterator_nil():
immutable_list = ImmutableList.empty()
for i in immutable_list:
fail("Should not reach statement")
| def test_iterator_nil():
| immutable_list = ImmutableList.empty()
for i in immutable_list:
fail("Should not reach statement")
| ImmutableList.range(1, 5).fold_left(0, lambda x, y: x + y) == 10
assert ImmutableList.range(0, 2000).fold_left(0, lambda x, y: x + y) == 1999000
def test_iterator_nil():
| 64 | 64 | 28 | 5 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_iterator_nil | test_iterator_nil | 78 | 81 | 78 | 78 | 901b37f45ae611e1f6e947f58268ff2050fd9c36 | bigcode/the-stack | train |
3721ffe56bad7c2bb3def2aa | train | function | def test_head_nil_raises():
with pytest.raises(ValueException):
Nil().head()
| def test_head_nil_raises():
| with pytest.raises(ValueException):
Nil().head()
| Cons(4, Cons(3, Cons(2, Cons(1, Nil())))))
def test_recusrion_limit():
list = ImmutableList.of(*[i for i in range(0, 2000)])
assert len(list) == 2000
def test_head_nil_raises():
| 64 | 64 | 19 | 7 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_head_nil_raises | test_head_nil_raises | 55 | 57 | 55 | 55 | cebb716e3a9260cc10e90c3556561d56c08b8ab0 | bigcode/the-stack | train |
38dd488a96faaf058c2da208 | train | function | def test_drop_until_nil():
list = ImmutableList.empty()
assert list.drop_until(lambda x: x > 3) == ImmutableList.empty()
| def test_drop_until_nil():
| list = ImmutableList.empty()
assert list.drop_until(lambda x: x > 3) == ImmutableList.empty()
| List.empty()
def test_drop_until():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_until(lambda x: x > 3) == ImmutableList.of(4, 5, 6)
def test_drop_until_nil():
| 64 | 64 | 31 | 6 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_until_nil | test_drop_until_nil | 118 | 120 | 118 | 118 | 2a5972f9fa4165a967e86e02f9e1de78b02cdcf1 | bigcode/the-stack | train |
093377835dd841c4d3a0387e | train | function | def test_cons_is_not_empty():
assert len(Cons(1, Nil())) == 1
assert Cons(1, Nil()).is_empty() == False
| def test_cons_is_not_empty():
| assert len(Cons(1, Nil())) == 1
assert Cons(1, Nil()).is_empty() == False
| import pytest
from pytest import fail
from pyvavr import ValueException
from pyvavr.collection.list import Nil, Cons, ImmutableList
def test_nil_is_empty():
assert len(Nil()) == 0
assert Nil().is_empty() == True
def test_cons_is_not_empty():
| 63 | 64 | 35 | 7 | 55 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_cons_is_not_empty | test_cons_is_not_empty | 13 | 15 | 13 | 13 | 76f8e935cdc3fafc742bacac977ed218a4418c4b | bigcode/the-stack | train |
8ff599be1fe82d0b3d385d92 | train | function | def test_drop_while():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_while(lambda x: x < 3) == ImmutableList.of(3, 4, 5, 6)
| def test_drop_while():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_while(lambda x: x < 3) == ImmutableList.of(3, 4, 5, 6)
| )
assert list.drop_until(lambda x: x > 3) == ImmutableList.of(4, 5, 6)
def test_drop_until_nil():
list = ImmutableList.empty()
assert list.drop_until(lambda x: x > 3) == ImmutableList.empty()
def test_drop_while():
| 64 | 64 | 60 | 6 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_while | test_drop_while | 123 | 125 | 123 | 123 | 40d2adab1b16179ffe1f087287a2cd22381106d3 | bigcode/the-stack | train |
95868d53d44c440242f902fa | train | function | def test_take_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take(-1) == ImmutableList.empty()
| def test_take_less_than_zero():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take(-1) == ImmutableList.empty()
| ():
assert ImmutableList.empty().take(2) == ImmutableList.empty()
def test_take():
assert ImmutableList.of(1, 2, 3, 4, 5).take(3) == ImmutableList.of(1, 2, 3)
def test_take_less_than_zero():
| 64 | 64 | 43 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_less_than_zero | test_take_less_than_zero | 184 | 186 | 184 | 184 | 91d3ebc623a85dd8214e2c8fded5913491d6c198 | bigcode/the-stack | train |
c925a3af2223417d271720f2 | train | function | def test_flat_map():
assert ImmutableList.of(1, 2, 3).flat_map(lambda x: range(0, x)) == ImmutableList.of(0, 0, 1, 0, 1, 2)
| def test_flat_map():
| assert ImmutableList.of(1, 2, 3).flat_map(lambda x: range(0, x)) == ImmutableList.of(0, 0, 1, 0, 1, 2)
| 6)
def test_filter_nil():
assert ImmutableList.empty().filter(lambda x: x % 2 == 0) == ImmutableList.empty()
def test_flat_map_nil():
assert ImmutableList.empty().flat_map(lambda x: range(0, x)) == ImmutableList.empty()
def test_flat_map():
| 64 | 64 | 52 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_flat_map | test_flat_map | 240 | 241 | 240 | 240 | 5222b321df39e973aedfe1c5bcced79eb4bc8d29 | bigcode/the-stack | train |
cce8d5dddf3310fcbd1487ce | train | function | def test_drop_while_nil():
list = ImmutableList.empty()
assert list.drop_while(lambda x: x < 3) == ImmutableList.empty()
| def test_drop_while_nil():
| list = ImmutableList.empty()
assert list.drop_while(lambda x: x < 3) == ImmutableList.empty()
| _while():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_while(lambda x: x < 3) == ImmutableList.of(3, 4, 5, 6)
def test_drop_while_nil():
| 64 | 64 | 33 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_while_nil | test_drop_while_nil | 128 | 130 | 128 | 128 | ae9fd7b3ead00e55f2a24150f51f83b9fdd28d85 | bigcode/the-stack | train |
16f4abad503ca597bd2d59db | train | function | def test_zip():
list_one = ImmutableList.of(1, 2, 3, 4)
list_two = ImmutableList.of(4, 3, 2, 1)
assert list_one.zip(list_two) == ImmutableList.of((1, 4), (2, 3), (3, 2), (4, 1))
| def test_zip():
| list_one = ImmutableList.of(1, 2, 3, 4)
list_two = ImmutableList.of(4, 3, 2, 1)
assert list_one.zip(list_two) == ImmutableList.of((1, 4), (2, 3), (3, 2), (4, 1))
| , 3, 4)
list_two = ImmutableList.of(4, 3, 2, 1)
assert list_one.zip_with(list_two, lambda x, y: x + y) == ImmutableList.of(5, 5, 5, 5)
def test_zip():
| 64 | 64 | 78 | 4 | 60 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_zip | test_zip | 250 | 253 | 250 | 250 | dfef2ff95ad33696bded7742d37e96d7bf9fac7e | bigcode/the-stack | train |
6c47d13fcda112decfc1221b | train | function | def test_drop():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(3) == ImmutableList.of(4, 5, 6)
| def test_drop():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(3) == ImmutableList.of(4, 5, 6)
| result = []
for i in immutable_list:
result.append(i)
assert result == [1, 2, 3, 4, 5, 6]
def test_drop_nil():
empty = ImmutableList.empty()
assert empty.drop(1) == Nil()
def test_drop():
| 64 | 64 | 48 | 4 | 60 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop | test_drop | 98 | 100 | 98 | 98 | e052eee849dcaf371695b663efdfb1b5ec1d91b6 | bigcode/the-stack | train |
4e3b874517eb5a2673f6d09b | train | function | def test_list_of_list():
assert ImmutableList.of_list([1, 2, 3]) == Cons(1, Cons(2, Cons(3, Nil())))
| def test_list_of_list():
| assert ImmutableList.of_list([1, 2, 3]) == Cons(1, Cons(2, Cons(3, Nil())))
| , Nil)).prepend(1) == Cons(1, Cons(2, Cons(3, Nil)))
def test_list_of():
assert ImmutableList.of(1, 2, 3) == Cons(1, Cons(2, Cons(3, Nil())))
def test_list_of_list():
| 63 | 64 | 36 | 6 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_list_of_list | test_list_of_list | 30 | 31 | 30 | 30 | 4aa4cab6db87d8b9d1b13457a6738dccd94b36f7 | bigcode/the-stack | train |
66c10953c2a69856c8a5c45b | train | function | def test_drop_right_while():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right_while(lambda x: x > 3) == ImmutableList.of(1, 2, 3)
| def test_drop_right_while():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right_while(lambda x: x > 3) == ImmutableList.of(1, 2, 3)
| .drop_right_until(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
def test_drop_right_until_nil():
list = ImmutableList.empty()
assert list.drop_right_until(lambda x: x < 3) == ImmutableList.empty()
def test_drop_right_while():
| 64 | 64 | 59 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_right_while | test_drop_right_while | 158 | 160 | 158 | 158 | 978b054edba0727fdaa634302767fc8986c619dd | bigcode/the-stack | train |
96010876dba86ea0de3db86a | train | function | def test_non_empty_prepend():
assert Cons(2, Cons(3, Nil)).prepend(1) == Cons(1, Cons(2, Cons(3, Nil)))
| def test_non_empty_prepend():
| assert Cons(2, Cons(3, Nil)).prepend(1) == Cons(1, Cons(2, Cons(3, Nil)))
|
def test_cons_is_not_empty():
assert len(Cons(1, Nil())) == 1
assert Cons(1, Nil()).is_empty() == False
def test_empty_prepend():
assert Nil().prepend(1) == Cons(1, Nil())
def test_non_empty_prepend():
| 64 | 64 | 38 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_non_empty_prepend | test_non_empty_prepend | 22 | 23 | 22 | 22 | 1acbd2192cda1e0708f05cb301ef3fb4b7a438b2 | bigcode/the-stack | train |
89f35b68b0a46a8d6487d16d | train | function | def test_zip_with():
list_one = ImmutableList.of(1, 2, 3, 4)
list_two = ImmutableList.of(4, 3, 2, 1)
assert list_one.zip_with(list_two, lambda x, y: x + y) == ImmutableList.of(5, 5, 5, 5)
| def test_zip_with():
| list_one = ImmutableList.of(1, 2, 3, 4)
list_two = ImmutableList.of(4, 3, 2, 1)
assert list_one.zip_with(list_two, lambda x, y: x + y) == ImmutableList.of(5, 5, 5, 5)
| x)) == ImmutableList.empty()
def test_flat_map():
assert ImmutableList.of(1, 2, 3).flat_map(lambda x: range(0, x)) == ImmutableList.of(0, 0, 1, 0, 1, 2)
def test_zip_with():
| 64 | 64 | 77 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_zip_with | test_zip_with | 244 | 247 | 244 | 244 | 45d5c71db2894710b527a5f8cd7f2907252df0dc | bigcode/the-stack | train |
5b6c54bba9ce059f3b5faca1 | train | function | def test_take_right_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take_right(10) == list
| def test_take_right_more_than_len():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take_right(10) == list
| .of(3, 4, 5)
def test_take__right_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take_right(-1) == ImmutableList.empty()
def test_take_right_more_than_len():
| 64 | 64 | 43 | 8 | 56 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_right_more_than_len | test_take_right_more_than_len | 215 | 217 | 215 | 215 | 38c926440733c74135dea1017669a335bc5bdfc5 | bigcode/the-stack | train |
c653b75fc04a2803ebaa41a4 | train | function | def test_flat_map_nil():
assert ImmutableList.empty().flat_map(lambda x: range(0, x)) == ImmutableList.empty()
| def test_flat_map_nil():
| assert ImmutableList.empty().flat_map(lambda x: range(0, x)) == ImmutableList.empty()
| 5, 6).filter(lambda x: x % 2 == 0) == ImmutableList.of(2, 4, 6)
def test_filter_nil():
assert ImmutableList.empty().filter(lambda x: x % 2 == 0) == ImmutableList.empty()
def test_flat_map_nil():
| 64 | 64 | 28 | 6 | 58 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_flat_map_nil | test_flat_map_nil | 236 | 237 | 236 | 236 | f55cac1bc86ea36209ac36e55e6e3369cb81aa8b | bigcode/the-stack | train |
46321f55a635de24f5903034 | train | function | def test_take__right_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take_right(-1) == ImmutableList.empty()
| def test_take__right_less_than_zero():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take_right(-1) == ImmutableList.empty()
| .empty().take_right(2) == ImmutableList.empty()
def test_take_right():
assert ImmutableList.of(1, 2, 3, 4, 5).take_right(3) == ImmutableList.of(3, 4, 5)
def test_take__right_less_than_zero():
| 64 | 64 | 46 | 9 | 55 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take__right_less_than_zero | test_take__right_less_than_zero | 210 | 212 | 210 | 210 | 3327cb7fd265e3cf7cb14e9c41d569ec791b9055 | bigcode/the-stack | train |
49abcffe7cdd0dd4cccd6a4a | train | function | def test_fold_left():
assert ImmutableList.range(1, 5).fold_left(0, lambda x, y: x + y) == 10
assert ImmutableList.range(0, 2000).fold_left(0, lambda x, y: x + y) == 1999000
| def test_fold_left():
| assert ImmutableList.range(1, 5).fold_left(0, lambda x, y: x + y) == 10
assert ImmutableList.range(0, 2000).fold_left(0, lambda x, y: x + y) == 1999000
| tail()
def test_head_cons_returns_first_element():
assert Cons(1, Cons(2, Nil())).head() == 1
def test_tail_cons_returns_all_but_first():
assert Cons(1, Cons(2, Nil())).tail() == Cons(2, Nil())
def test_fold_left():
| 64 | 64 | 66 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_fold_left | test_fold_left | 73 | 75 | 73 | 73 | 99eb33b4555c70cd8983bc44bcaff556953a02b9 | bigcode/the-stack | train |
d5920338d8fb48df8ce00531 | train | function | def test_drop_right():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(3) == ImmutableList.of(1, 2, 3)
| def test_drop_right():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop_right(3) == ImmutableList.of(1, 2, 3)
| _while(lambda x: x < 3) == ImmutableList.of(3, 4, 5, 6)
def test_drop_while_nil():
list = ImmutableList.empty()
assert list.drop_while(lambda x: x < 3) == ImmutableList.empty()
def test_drop_right():
| 64 | 64 | 50 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_right | test_drop_right | 133 | 135 | 133 | 133 | d258da539f419bb9cde1d65bcb750e85fd765960 | bigcode/the-stack | train |
7a997d2e68b103967eacf02a | train | function | def test_drop_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(-1) == list
| def test_drop_less_than_zero():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(-1) == list
| assert empty.drop(1) == Nil()
def test_drop():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.drop(3) == ImmutableList.of(4, 5, 6)
def test_drop_less_than_zero():
| 64 | 64 | 41 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_less_than_zero | test_drop_less_than_zero | 103 | 105 | 103 | 103 | c6313ab8d393fab2d54ec2598b50b1c580a70927 | bigcode/the-stack | train |
8b65aee5492faf58d64f6266 | train | function | def test_take_right():
assert ImmutableList.of(1, 2, 3, 4, 5).take_right(3) == ImmutableList.of(3, 4, 5)
| def test_take_right():
| assert ImmutableList.of(1, 2, 3, 4, 5).take_right(3) == ImmutableList.of(3, 4, 5)
| , 3, 4, 5, 6).take_while(lambda x: x <= 3) == ImmutableList.of(1, 2, 3)
def test_take_right_nil():
assert ImmutableList.empty().take_right(2) == ImmutableList.empty()
def test_take_right():
| 64 | 64 | 43 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_right | test_take_right | 206 | 207 | 206 | 206 | 3cdccd2f8fd828ce6f044b67127a64bfcf5db96e | bigcode/the-stack | train |
44434840f20ef27ccd3ca468 | train | function | def test_drop_nil():
empty = ImmutableList.empty()
assert empty.drop(1) == Nil()
| def test_drop_nil():
| empty = ImmutableList.empty()
assert empty.drop(1) == Nil()
| List.of_list([1, 2, 3, 4, 5, 6])
result = []
for i in immutable_list:
result.append(i)
assert result == [1, 2, 3, 4, 5, 6]
def test_drop_nil():
| 64 | 64 | 22 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_drop_nil | test_drop_nil | 93 | 95 | 93 | 93 | ba0c83399f8f5f88055f3c5c66db4fd5856cf31d | bigcode/the-stack | train |
1bc66e597cd03a9bff76a622 | train | function | def test_take_nil():
assert ImmutableList.empty().take(2) == ImmutableList.empty()
| def test_take_nil():
| assert ImmutableList.empty().take(2) == ImmutableList.empty()
| 2, 3, 4)
def test_or_else():
assert ImmutableList.of(4, 5, 6).or_else(ImmutableList.of(1, 2, 3, 4)) == ImmutableList.of(4, 5, 6)
def test_take_nil():
| 64 | 64 | 20 | 5 | 59 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_nil | test_take_nil | 176 | 177 | 176 | 176 | cff4de13a393c20374e57819426598a0ae5fd2bc | bigcode/the-stack | train |
3dea80a737f6b51d5498563c | train | function | def test_take_more_than_len():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take(10) == list
| def test_take_more_than_len():
| list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take(10) == list
| ) == ImmutableList.of(1, 2, 3)
def test_take_less_than_zero():
list = ImmutableList.of(1, 2, 3, 4, 5, 6)
assert list.take(-1) == ImmutableList.empty()
def test_take_more_than_len():
| 64 | 64 | 41 | 7 | 57 | hanbei/pyvavr | tests/collection/list_test.py | Python | test_take_more_than_len | test_take_more_than_len | 189 | 191 | 189 | 189 | c521dc2e80bb6ae9e512cbf4275061545214991f | bigcode/the-stack | train |
fc22e82f7585530b38ae7a10 | train | function | def wrap(x, m, M):
"""
:param x: a scalar
:param m: minimum possible value in range
:param M: maximum possible value in range
Wraps ``x`` so m <= x <= M; but unlike ``bound()`` which
truncates, ``wrap()`` wraps x around the coordinate system defined by m,M.\n
For example, m = -180, M = 180 (... | def wrap(x, m, M):
| """
:param x: a scalar
:param m: minimum possible value in range
:param M: maximum possible value in range
Wraps ``x`` so m <= x <= M; but unlike ``bound()`` which
truncates, ``wrap()`` wraps x around the coordinate system defined by m,M.\n
For example, m = -180, M = 180 (degrees), x = 360 -... | link.set_color(0,.8, .8)
circ = self.viewer.draw_circle(.1)
circ.set_color(.8, .8, 0)
circ.add_attr(jtransform)
return self.viewer.render(return_rgb_array = mode=='rgb_array')
def wrap(x, m, M):
| 64 | 64 | 146 | 8 | 56 | erinaldi/MetaRL | rand_param_envs/gym/envs/classic_control/acrobot.py | Python | wrap | wrap | 210 | 224 | 210 | 210 | 932cc7f83d5874634b9f2a1c350f401abc5d6018 | bigcode/the-stack | train |
e2f18c29644101191ff94cd7 | train | class | class AcrobotEnv(core.Env):
"""
Acrobot is a 2-link pendulum with only the second joint actuated
Intitially, both links point downwards. The goal is to swing the
end-effector at a height at least the length of one link above the base.
Both links can swing freely and can pass by each other, i.e., th... | class AcrobotEnv(core.Env):
| """
Acrobot is a 2-link pendulum with only the second joint actuated
Intitially, both links point downwards. The goal is to swing the
end-effector at a height at least the length of one link above the base.
Both links can swing freely and can pass by each other, i.e., they don't
collide when the... | """classic Acrobot task"""
from rand_param_envs.gym import core, spaces
from rand_param_envs.gym.utils import seeding
import numpy as np
from numpy import sin, cos, pi
import time
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
__credits__ = ["Alborz Geramifard", "Robert H. Klein", "Christoph Dann",
... | 167 | 256 | 2,212 | 7 | 159 | erinaldi/MetaRL | rand_param_envs/gym/envs/classic_control/acrobot.py | Python | AcrobotEnv | AcrobotEnv | 17 | 208 | 17 | 18 | 3a3157f0860af4943a51ac728334c809760bcf11 | bigcode/the-stack | train |
d34d81ef7978c53549b1ac0d | train | function | def rk4(derivs, y0, t, *args, **kwargs):
"""
Integrate 1D or ND system of ODEs using 4-th order Runge-Kutta.
This is a toy implementation which may be useful if you find
yourself stranded on a system w/o scipy. Otherwise use
:func:`scipy.integrate`.
*y0*
initial state vector
*t*
... | def rk4(derivs, y0, t, *args, **kwargs):
| """
Integrate 1D or ND system of ODEs using 4-th order Runge-Kutta.
This is a toy implementation which may be useful if you find
yourself stranded on a system w/o scipy. Otherwise use
:func:`scipy.integrate`.
*y0*
initial state vector
*t*
sample times
*derivs*
re... | (degrees), x = 360 --> returns 0.
"""
diff = M - m
while x > M:
x = x - diff
while x < m:
x = x + diff
return x
def bound(x, m, M=None):
"""
:param x: scalar
Either have m as scalar, so bound(x,m,M) which returns m <= x <= M *OR*
have m as length 2 vector, bound(x,m... | 186 | 186 | 620 | 18 | 168 | erinaldi/MetaRL | rand_param_envs/gym/envs/classic_control/acrobot.py | Python | rk4 | rk4 | 239 | 299 | 239 | 239 | 8826be8eac296c92782d51676e52e82af4aeb9cf | bigcode/the-stack | train |
e354c279e16032d7f7750f82 | train | function | def bound(x, m, M=None):
"""
:param x: scalar
Either have m as scalar, so bound(x,m,M) which returns m <= x <= M *OR*
have m as length 2 vector, bound(x,m, <IGNORED>) returns m[0] <= x <= m[1].
"""
if M is None:
M = m[1]
m = m[0]
# bound x between min (m) and Max (M)
retu... | def bound(x, m, M=None):
| """
:param x: scalar
Either have m as scalar, so bound(x,m,M) which returns m <= x <= M *OR*
have m as length 2 vector, bound(x,m, <IGNORED>) returns m[0] <= x <= m[1].
"""
if M is None:
M = m[1]
m = m[0]
# bound x between min (m) and Max (M)
return min(max(x, m), M)
| M = 180 (degrees), x = 360 --> returns 0.
"""
diff = M - m
while x > M:
x = x - diff
while x < m:
x = x + diff
return x
def bound(x, m, M=None):
| 64 | 64 | 117 | 9 | 54 | erinaldi/MetaRL | rand_param_envs/gym/envs/classic_control/acrobot.py | Python | bound | bound | 226 | 236 | 226 | 226 | f531e5576be8c68d7da1c533f0699d4ccaae1ebd | bigcode/the-stack | train |
874cb6cfe7fdd2b46e424b76 | train | class | class UserDataCreateRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'cloudwf', '2017-03-28', 'UserDataCreate','cloudwf')
def get_UploadFile(self):
return self.get_query_params().get('UploadFile')
def set_UploadFile(self,UploadFile):
self.add_query_param('UploadFile',UploadFile)
... | class UserDataCreateRequest(RpcRequest):
| def __init__(self):
RpcRequest.__init__(self, 'cloudwf', '2017-03-28', 'UserDataCreate','cloudwf')
def get_UploadFile(self):
return self.get_query_params().get('UploadFile')
def set_UploadFile(self,UploadFile):
self.add_query_param('UploadFile',UploadFile)
def get_Name(self):
return self.get_que... | on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from aliyunsdkcore.request import RpcRequest
class UserDataCreateRequest(RpcRequest):
| 64 | 64 | 186 | 9 | 54 | yndu13/aliyun-openapi-python-sdk | aliyun-python-sdk-cloudwf/aliyunsdkcloudwf/request/v20170328/UserDataCreateRequest.py | Python | UserDataCreateRequest | UserDataCreateRequest | 21 | 48 | 21 | 22 | 1b82be25b9842077bf2a83a8ebf08d9f457e8c47 | bigcode/the-stack | train |
6717ebe20d3c0f0d8a7981d9 | train | function | def f ():
return 'London is the town for me\n'
| def f ():
| return 'London is the town for me\n'
| def f ():
| 4 | 64 | 14 | 4 | 0 | rsumner31/Transcrypt | Transcrypt/development/automated_tests/transcrypt/modules/mod2/mod21.py | Python | f | f | 1 | 2 | 1 | 1 | 711945d353a3ea5f7f600d4bb4e2188001012b74 | bigcode/the-stack | train |
e98c933a21970904434b903a | train | class | class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20200129_1108'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(max_length=254, unique=True, verbose_name='email address'),
... | class Migration(migrations.Migration):
| dependencies = [
('core', '0005_auto_20200129_1108'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(max_length=254, unique=True, verbose_name='email address'),
),
]
| # Generated by Django 2.2.10 on 2020-02-05 19:54
from django.db import migrations, models
class Migration(migrations.Migration):
| 38 | 64 | 72 | 7 | 30 | StateArchivesOfNorthCarolina/ratom_server | core/migrations/0006_auto_20200205_1454.py | Python | Migration | Migration | 6 | 18 | 6 | 7 | 7342776317034dc0d1798acf018ed9ffcb682920 | bigcode/the-stack | train |
645a98b9e927b5901e22b57f | train | class | class TestMultilingual(unittest.TestCase):
@classmethod
def setUpClass(self):
self.clear_output_dir()
self.generate_dummy_translation()
self.generate_site()
@classmethod
def clear_output_dir(self):
p = Path(output_dir)
if p.exists():
print("removing "... | class TestMultilingual(unittest.TestCase):
@classmethod
| def setUpClass(self):
self.clear_output_dir()
self.generate_dummy_translation()
self.generate_site()
@classmethod
def clear_output_dir(self):
p = Path(output_dir)
if p.exists():
print("removing " + output_dir)
shutil.rmtree(output_dir)
@c... | import os
import unittest
from pathlib import Path
import shutil
from xml.etree import ElementTree
from pomosite import generate, add_language
from pomosite.translation import extract_translation_units, generate_dummy_translation
base_path = Path(__file__).parent
content_path = Path(base_path, "data/test_multilingual... | 87 | 256 | 1,529 | 12 | 75 | anderskaplan/pomosite | tests/test_multilingual.py | Python | TestMultilingual | TestMultilingual | 15 | 158 | 15 | 16 | b7122eef354a8485e4119232fdd29ec4abcc9e67 | bigcode/the-stack | train |
04c7b6aa06df49d78d0177df | train | class | class SearchExecutionService:
"""A Dependency Injection enabled class that encapsulates the business logic for search operations."""
db: sqlalchemy.orm.Session
def __init__(self, session: sqlalchemy.orm.Session = fastapi.Depends(models.database.get_session)):
"""Initialize the service with a datab... | class SearchExecutionService:
| """A Dependency Injection enabled class that encapsulates the business logic for search operations."""
db: sqlalchemy.orm.Session
def __init__(self, session: sqlalchemy.orm.Session = fastapi.Depends(models.database.get_session)):
"""Initialize the service with a database session provided by Depend... | SELECT base_reg_number
FROM registration
WHERE UPPER(reg_number) = :registration_number
)
GROUP BY base_reg_number
) r2 ON r1.base_reg_number = r2.base_reg_number AND r1.reg_date = r2.max_reg_date
"""
class SearchExecutionService:
| 64 | 64 | 211 | 5 | 59 | bcgov/ppr-deprecated | ppr-api/src/services/search_execution_service.py | Python | SearchExecutionService | SearchExecutionService | 44 | 61 | 44 | 44 | 24a31e26b71a019c4d074a02e200da15e752e9eb | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.