blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
2f8b3c285eb27e30cdbaf9f62d22c873af84a012
[ "if hyperparameter_config is None:\n hyperparameter_config = configs.encoder_decoder()\nsuper().__init__(name, parent=None, hyperparameter_config=hyperparameter_config, spatial_scale=spatial_scale)\nself.setup_children()\npass", "with tf.variable_scope(self.name.replace(' ', '_')):\n for blockset in self.ch...
<|body_start_0|> if hyperparameter_config is None: hyperparameter_config = configs.encoder_decoder() super().__init__(name, parent=None, hyperparameter_config=hyperparameter_config, spatial_scale=spatial_scale) self.setup_children() pass <|end_body_0|> <|body_start_1|> ...
Controls the creation of an encoder-decoder network (u-net). TODO Attributes:
EncoderDecoderGene
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderDecoderGene: """Controls the creation of an encoder-decoder network (u-net). TODO Attributes:""" def __init__(self, name: str, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, spatial_scale: int=0): """Constructor. Args: name (str): This gene's name. hyperparamet...
stack_v2_sparse_classes_10k_train_003700
3,787
no_license
[ { "docstring": "Constructor. Args: name (str): This gene's name. hyperparameter_config (Optional[mt.HyperparameterConfig]): The HyperparameterConfig governing this Gene's hyperparameters. If none is supplied, use genenet.hyperparameter_config.encoder_decoder(). spatial_scale (int): The spatial scale of the data...
4
stack_v2_sparse_classes_30k_train_000974
Implement the Python class `EncoderDecoderGene` described below. Class description: Controls the creation of an encoder-decoder network (u-net). TODO Attributes: Method signatures and docstrings: - def __init__(self, name: str, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, spatial_scale: int=0): Cons...
Implement the Python class `EncoderDecoderGene` described below. Class description: Controls the creation of an encoder-decoder network (u-net). TODO Attributes: Method signatures and docstrings: - def __init__(self, name: str, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, spatial_scale: int=0): Cons...
6b78dc5e1e793a206ae3f4860d3a9ac887e663e5
<|skeleton|> class EncoderDecoderGene: """Controls the creation of an encoder-decoder network (u-net). TODO Attributes:""" def __init__(self, name: str, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, spatial_scale: int=0): """Constructor. Args: name (str): This gene's name. hyperparamet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncoderDecoderGene: """Controls the creation of an encoder-decoder network (u-net). TODO Attributes:""" def __init__(self, name: str, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, spatial_scale: int=0): """Constructor. Args: name (str): This gene's name. hyperparameter_config (Op...
the_stack_v2_python_sparse
example3/src/_private/genenet/genes/EncoderDecoderGene.py
leapmanlab/examples
train
1
4749b8e0d38408c2e2d5931a4fa4eba07d6533f1
[ "super(GPT2LambadaModel, self).__init__()\nif not is_training:\n config.hidden_dropout = 0.0\nself.vocab_size = config.vocab_size\nself.gpt2 = GPT2Model(config, is_training, use_one_hot_embeddings)\nself.cast = P.Cast()\nself.shape = P.Shape()\nself.log_softmax = P.LogSoftmax(axis=-1)\nself.dtype = config.dtype\...
<|body_start_0|> super(GPT2LambadaModel, self).__init__() if not is_training: config.hidden_dropout = 0.0 self.vocab_size = config.vocab_size self.gpt2 = GPT2Model(config, is_training, use_one_hot_embeddings) self.cast = P.Cast() self.shape = P.Shape() ...
GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets.
GPT2LambadaModel
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GPT2LambadaModel: """GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets.""" def __init__(self, config, is_training, use_one_hot_embeddings=False): """Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune...
stack_v2_sparse_classes_10k_train_003701
2,976
permissive
[ { "docstring": "Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune), `False` for evaluation. use_one_hot_embeddings (bool): default False.", "name": "__init__", "signature": "def __init__(self, config, is_training, use_one_hot_embeddings=False)" }, { "d...
2
null
Implement the Python class `GPT2LambadaModel` described below. Class description: GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets. Method signatures and docstrings: - def __init__(self, config, is_training, use_one_hot_embeddings=False): Args: config: the configuration of G...
Implement the Python class `GPT2LambadaModel` described below. Class description: GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets. Method signatures and docstrings: - def __init__(self, config, is_training, use_one_hot_embeddings=False): Args: config: the configuration of G...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class GPT2LambadaModel: """GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets.""" def __init__(self, config, is_training, use_one_hot_embeddings=False): """Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GPT2LambadaModel: """GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets.""" def __init__(self, config, is_training, use_one_hot_embeddings=False): """Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune), `False` fo...
the_stack_v2_python_sparse
research/nlp/gpt2/src/GPT2ForLambada.py
mindspore-ai/models
train
301
89091c6db1d9b90f868019331266b75d885c2120
[ "class MyGenerator:\n\n def __init__(self, gen):\n self._gen = gen\n\n def __next__(self):\n return next(self._gen)\n\ndef inner_callback(item, *args, **kwargs):\n return MyGenerator(callback(item, inner_callback, *args, **kwargs))\nto_call = list()\nto_call.append(inner_callback(root, *args,...
<|body_start_0|> class MyGenerator: def __init__(self, gen): self._gen = gen def __next__(self): return next(self._gen) def inner_callback(item, *args, **kwargs): return MyGenerator(callback(item, inner_callback, *args, **kwargs)) ...
Class that aggregates functions to traverse the parsed tree.
Traversing
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Traversing: """Class that aggregates functions to traverse the parsed tree.""" def traverse(root, callback, *args, **kwargs): """Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and param...
stack_v2_sparse_classes_10k_train_003702
8,160
permissive
[ { "docstring": "Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and parameters from the parent. Function must yield individual values. Its possible to yield callback c_2 **call** on any node to call the recursion. ...
5
stack_v2_sparse_classes_30k_train_000628
Implement the Python class `Traversing` described below. Class description: Class that aggregates functions to traverse the parsed tree. Method signatures and docstrings: - def traverse(root, callback, *args, **kwargs): Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Fun...
Implement the Python class `Traversing` described below. Class description: Class that aggregates functions to traverse the parsed tree. Method signatures and docstrings: - def traverse(root, callback, *args, **kwargs): Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Fun...
8308a1fd349bf9ea0d267360cc9a4ab20d1629e8
<|skeleton|> class Traversing: """Class that aggregates functions to traverse the parsed tree.""" def traverse(root, callback, *args, **kwargs): """Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and param...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Traversing: """Class that aggregates functions to traverse the parsed tree.""" def traverse(root, callback, *args, **kwargs): """Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and parameters from th...
the_stack_v2_python_sparse
grammpy/transforms/Traversing.py
PatrikValkovic/grammpy
train
2
ec07d5c5713bb83d50412c120871113a2e103d9b
[ "if root != None:\n sum_n = 0\nelse:\n sum_n = 1\nstack = [root]\nres = ''\nwhile stack.__len__() != 0 and stack.__len__() != sum_n:\n node = stack.pop(0)\n if node == None:\n sum_n += 1\n res += 'None/'\n stack.append(None)\n stack.append(None)\n else:\n if node.le...
<|body_start_0|> if root != None: sum_n = 0 else: sum_n = 1 stack = [root] res = '' while stack.__len__() != 0 and stack.__len__() != sum_n: node = stack.pop(0) if node == None: sum_n += 1 res += 'Non...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_003703
2,205
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003885
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
a9fb28f7cfcae8d9c9a460462ec9ee8b5f3b40d8
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root != None: sum_n = 0 else: sum_n = 1 stack = [root] res = '' while stack.__len__() != 0 and stack.__len__() != sum_n: ...
the_stack_v2_python_sparse
code/Codec.py
3wh1te/Leecode
train
0
b4f7e2212b4b22a17b8771713ab4761ca709f65b
[ "path = os.path.join(BASE_DIR, 'librairy/test_files')\nrecursive_import(path)\npicts = Picture.objects.all().count()\nself.assertEqual(picts, 3)", "path = os.path.join(BASE_DIR, 'librairy/test_files/test.zip')\nrecursive_import(path)\npicts = Picture.objects.all().count()\nself.assertEqual(picts, 1)", "recursiv...
<|body_start_0|> path = os.path.join(BASE_DIR, 'librairy/test_files') recursive_import(path) picts = Picture.objects.all().count() self.assertEqual(picts, 3) <|end_body_0|> <|body_start_1|> path = os.path.join(BASE_DIR, 'librairy/test_files/test.zip') recursive_import(pa...
Command line import test class.
RecursiveImportTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecursiveImportTest: """Command line import test class.""" def test_with_folder(self): """Test with one folder path as argument.""" <|body_0|> def test_with_zip_archive(self): """Test with one archive as argument.""" <|body_1|> def test_with_picture(...
stack_v2_sparse_classes_10k_train_003704
44,838
no_license
[ { "docstring": "Test with one folder path as argument.", "name": "test_with_folder", "signature": "def test_with_folder(self)" }, { "docstring": "Test with one archive as argument.", "name": "test_with_zip_archive", "signature": "def test_with_zip_archive(self)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_002729
Implement the Python class `RecursiveImportTest` described below. Class description: Command line import test class. Method signatures and docstrings: - def test_with_folder(self): Test with one folder path as argument. - def test_with_zip_archive(self): Test with one archive as argument. - def test_with_picture(self...
Implement the Python class `RecursiveImportTest` described below. Class description: Command line import test class. Method signatures and docstrings: - def test_with_folder(self): Test with one folder path as argument. - def test_with_zip_archive(self): Test with one archive as argument. - def test_with_picture(self...
ed2e458dfb6247d7fe487f4795a855a5275cfe5f
<|skeleton|> class RecursiveImportTest: """Command line import test class.""" def test_with_folder(self): """Test with one folder path as argument.""" <|body_0|> def test_with_zip_archive(self): """Test with one archive as argument.""" <|body_1|> def test_with_picture(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RecursiveImportTest: """Command line import test class.""" def test_with_folder(self): """Test with one folder path as argument.""" path = os.path.join(BASE_DIR, 'librairy/test_files') recursive_import(path) picts = Picture.objects.all().count() self.assertEqual(pi...
the_stack_v2_python_sparse
src/api/librairy/tests.py
Fenykepy/phiroom
train
1
2662eab3094ce1b4b0db9369edac940ffe9ada52
[ "self.wrapped_exc = exception\nself.status_int = self.wrapped_exc.status_int\nself._body_function = body_function or _default_body_function", "fault_data, metadata = self._body_function(self.wrapped_exc)\ncontent_type = req.best_match_content_type()\nserializer = {'application/json': JSONDictSerializer()}[content...
<|body_start_0|> self.wrapped_exc = exception self.status_int = self.wrapped_exc.status_int self._body_function = body_function or _default_body_function <|end_body_0|> <|body_start_1|> fault_data, metadata = self._body_function(self.wrapped_exc) content_type = req.best_match_co...
Generates an HTTP response from a webob HTTP exception.
Fault
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fault: """Generates an HTTP response from a webob HTTP exception.""" def __init__(self, exception, body_function=None): """Creates a Fault for the given webob.exc.exception.""" <|body_0|> def __call__(self, req): """Generate a WSGI response based on the exception...
stack_v2_sparse_classes_10k_train_003705
29,625
permissive
[ { "docstring": "Creates a Fault for the given webob.exc.exception.", "name": "__init__", "signature": "def __init__(self, exception, body_function=None)" }, { "docstring": "Generate a WSGI response based on the exception passed to ctor.", "name": "__call__", "signature": "def __call__(se...
2
null
Implement the Python class `Fault` described below. Class description: Generates an HTTP response from a webob HTTP exception. Method signatures and docstrings: - def __init__(self, exception, body_function=None): Creates a Fault for the given webob.exc.exception. - def __call__(self, req): Generate a WSGI response b...
Implement the Python class `Fault` described below. Class description: Generates an HTTP response from a webob HTTP exception. Method signatures and docstrings: - def __init__(self, exception, body_function=None): Creates a Fault for the given webob.exc.exception. - def __call__(self, req): Generate a WSGI response b...
dde31aae392b80341f6440eb38db1583563d7d1f
<|skeleton|> class Fault: """Generates an HTTP response from a webob HTTP exception.""" def __init__(self, exception, body_function=None): """Creates a Fault for the given webob.exc.exception.""" <|body_0|> def __call__(self, req): """Generate a WSGI response based on the exception...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Fault: """Generates an HTTP response from a webob HTTP exception.""" def __init__(self, exception, body_function=None): """Creates a Fault for the given webob.exc.exception.""" self.wrapped_exc = exception self.status_int = self.wrapped_exc.status_int self._body_function =...
the_stack_v2_python_sparse
neutron/wsgi.py
openstack/neutron
train
1,174
0101cb4e170a8d168a24134fee231c0d44274d44
[ "LOG.debug('Plumbing VIP for loadbalancer id: %s', loadbalancer[constants.LOADBALANCER_ID])\nsession = db_apis.get_session()\nwith session.begin():\n db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID])\namps_data = self.network_driver.plug_vip(db_lb, db_lb.vip)\nreturn [amp.to...
<|body_start_0|> LOG.debug('Plumbing VIP for loadbalancer id: %s', loadbalancer[constants.LOADBALANCER_ID]) session = db_apis.get_session() with session.begin(): db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID]) amps_data = self.network_d...
Task to plumb a VIP.
PlugVIP
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlugVIP: """Task to plumb a VIP.""" def execute(self, loadbalancer): """Plumb a vip to an amphora.""" <|body_0|> def revert(self, result, loadbalancer, *args, **kwargs): """Handle a failure to plumb a vip.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_003706
44,034
permissive
[ { "docstring": "Plumb a vip to an amphora.", "name": "execute", "signature": "def execute(self, loadbalancer)" }, { "docstring": "Handle a failure to plumb a vip.", "name": "revert", "signature": "def revert(self, result, loadbalancer, *args, **kwargs)" } ]
2
null
Implement the Python class `PlugVIP` described below. Class description: Task to plumb a VIP. Method signatures and docstrings: - def execute(self, loadbalancer): Plumb a vip to an amphora. - def revert(self, result, loadbalancer, *args, **kwargs): Handle a failure to plumb a vip.
Implement the Python class `PlugVIP` described below. Class description: Task to plumb a VIP. Method signatures and docstrings: - def execute(self, loadbalancer): Plumb a vip to an amphora. - def revert(self, result, loadbalancer, *args, **kwargs): Handle a failure to plumb a vip. <|skeleton|> class PlugVIP: """...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class PlugVIP: """Task to plumb a VIP.""" def execute(self, loadbalancer): """Plumb a vip to an amphora.""" <|body_0|> def revert(self, result, loadbalancer, *args, **kwargs): """Handle a failure to plumb a vip.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PlugVIP: """Task to plumb a VIP.""" def execute(self, loadbalancer): """Plumb a vip to an amphora.""" LOG.debug('Plumbing VIP for loadbalancer id: %s', loadbalancer[constants.LOADBALANCER_ID]) session = db_apis.get_session() with session.begin(): db_lb = self.l...
the_stack_v2_python_sparse
octavia/controller/worker/v2/tasks/network_tasks.py
openstack/octavia
train
147
b7f1b6210a1383eb3c61c312eacef2c002b80fab
[ "\"\"\"\n 先计算两个单链表长度,利用两个指针,先让长度更长的单链表前进两者长度差的步数,然后两个指针同步前进,比较是否相等即可\n \"\"\"\nif not headA or not headB:\n return None\nlenA = lenB = 1\npointA, pointB = (headA, headB)\nwhile headA.next:\n headA = headA.next\n lenA += 1\nwhile headB.next:\n lenB += 1\n headB = headB.next\nif lenA > le...
<|body_start_0|> """ 先计算两个单链表长度,利用两个指针,先让长度更长的单链表前进两者长度差的步数,然后两个指针同步前进,比较是否相等即可 """ if not headA or not headB: return None lenA = lenB = 1 pointA, pointB = (headA, headB) while headA.next: headA = headA.next lenA...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode1(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_003707
1,686
no_license
[ { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode1", "signature": "def getIntersectionNo...
2
stack_v2_sparse_classes_30k_train_005615
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode1(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode1(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
e8eae749e77be21716ada6019db4c39d3f00989c
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode1(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" """ 先计算两个单链表长度,利用两个指针,先让长度更长的单链表前进两者长度差的步数,然后两个指针同步前进,比较是否相等即可 """ if not headA or not headB: return None lenA = lenB = 1 ...
the_stack_v2_python_sparse
linked list/160. Intersection of Two Linked Lists.py
zazaliu/leetcode-python
train
1
1bd8a79b187fbde38cebe26939079f961c83d336
[ "super(QDesignatorSortModel, self).__init__(parent)\nself.comparator = QDesignatorComparator()\nself.column = designatorColumn", "try:\n a = left.data().split(',')[0]\n b = right.data().split(',')[0]\n desigs = list(map(self.comparator.getNormalisedDesignator, [a, b]))\nexcept IndexError:\n desigs = [...
<|body_start_0|> super(QDesignatorSortModel, self).__init__(parent) self.comparator = QDesignatorComparator() self.column = designatorColumn <|end_body_0|> <|body_start_1|> try: a = left.data().split(',')[0] b = right.data().split(',')[0] desigs = lis...
Reimplements sorting of the treeview such, that designator and values numbers are properly sorted according to 'normal' perception. Hence U1, U2, U3 and not U1, U10, U11 as by default.
QDesignatorSortModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QDesignatorSortModel: """Reimplements sorting of the treeview such, that designator and values numbers are properly sorted according to 'normal' perception. Hence U1, U2, U3 and not U1, U10, U11 as by default.""" def __init__(self, designatorColumn=0, parent=None): """sorting proxy a...
stack_v2_sparse_classes_10k_train_003708
2,928
no_license
[ { "docstring": "sorting proxy assures that designators are correctly sorted. For this give a column number, which contains designators. This is to identify whether ordinary sorting or string sorting has to be done", "name": "__init__", "signature": "def __init__(self, designatorColumn=0, parent=None)" ...
2
stack_v2_sparse_classes_30k_train_004809
Implement the Python class `QDesignatorSortModel` described below. Class description: Reimplements sorting of the treeview such, that designator and values numbers are properly sorted according to 'normal' perception. Hence U1, U2, U3 and not U1, U10, U11 as by default. Method signatures and docstrings: - def __init_...
Implement the Python class `QDesignatorSortModel` described below. Class description: Reimplements sorting of the treeview such, that designator and values numbers are properly sorted according to 'normal' perception. Hence U1, U2, U3 and not U1, U10, U11 as by default. Method signatures and docstrings: - def __init_...
013a5859fc64aa4b43dfe5b493c058fba6dfdcee
<|skeleton|> class QDesignatorSortModel: """Reimplements sorting of the treeview such, that designator and values numbers are properly sorted according to 'normal' perception. Hence U1, U2, U3 and not U1, U10, U11 as by default.""" def __init__(self, designatorColumn=0, parent=None): """sorting proxy a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QDesignatorSortModel: """Reimplements sorting of the treeview such, that designator and values numbers are properly sorted according to 'normal' perception. Hence U1, U2, U3 and not U1, U10, U11 as by default.""" def __init__(self, designatorColumn=0, parent=None): """sorting proxy assures that d...
the_stack_v2_python_sparse
BOMizator/qdesignatorsortmodel.py
dejfson/BOMizator
train
1
28c0c57fef07c94ff880fe00eabff1d62060c27c
[ "metadata = api.cinder.volume_type_extra_get(request, volume_type_id)\nresult = {x.key: x.value for x in metadata}\nreturn result", "updated = request.DATA['updated']\nremoved = request.DATA['removed']\nif updated:\n api.cinder.volume_type_extra_set(request, volume_type_id, updated)\nif removed:\n api.cinde...
<|body_start_0|> metadata = api.cinder.volume_type_extra_get(request, volume_type_id) result = {x.key: x.value for x in metadata} return result <|end_body_0|> <|body_start_1|> updated = request.DATA['updated'] removed = request.DATA['removed'] if updated: api...
API for getting snapshots metadata
VolumeTypeMetadata
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VolumeTypeMetadata: """API for getting snapshots metadata""" def get(self, request, volume_type_id): """Get a specific volume's metadata http://localhost/api/cinder/volumetypes/1/metadata""" <|body_0|> def patch(self, request, volume_type_id): """Update metadata ...
stack_v2_sparse_classes_10k_train_003709
14,440
permissive
[ { "docstring": "Get a specific volume's metadata http://localhost/api/cinder/volumetypes/1/metadata", "name": "get", "signature": "def get(self, request, volume_type_id)" }, { "docstring": "Update metadata for specific volume http://localhost/api/cinder/volumetypes/1/metadata", "name": "patc...
2
null
Implement the Python class `VolumeTypeMetadata` described below. Class description: API for getting snapshots metadata Method signatures and docstrings: - def get(self, request, volume_type_id): Get a specific volume's metadata http://localhost/api/cinder/volumetypes/1/metadata - def patch(self, request, volume_type_...
Implement the Python class `VolumeTypeMetadata` described below. Class description: API for getting snapshots metadata Method signatures and docstrings: - def get(self, request, volume_type_id): Get a specific volume's metadata http://localhost/api/cinder/volumetypes/1/metadata - def patch(self, request, volume_type_...
7896fd8c77a6766a1156a520946efaf792b76ca5
<|skeleton|> class VolumeTypeMetadata: """API for getting snapshots metadata""" def get(self, request, volume_type_id): """Get a specific volume's metadata http://localhost/api/cinder/volumetypes/1/metadata""" <|body_0|> def patch(self, request, volume_type_id): """Update metadata ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VolumeTypeMetadata: """API for getting snapshots metadata""" def get(self, request, volume_type_id): """Get a specific volume's metadata http://localhost/api/cinder/volumetypes/1/metadata""" metadata = api.cinder.volume_type_extra_get(request, volume_type_id) result = {x.key: x.va...
the_stack_v2_python_sparse
openstack_dashboard/api/rest/cinder.py
openstack/horizon
train
1,060
ce952a93cd42a3c011881d31531be59a61a69d83
[ "extloader = ExtensionLoader()\npipeline = Pipeline(extloader.cats_container)\npipeline.new_category('Preprocessing', 1)\nstandard = Category('Preprocessing')\nself.assertEqual(pipeline.executed_cats[1].name, standard.name)", "extloader = ExtensionLoader()\npipeline = Pipeline(extloader.cats_container)\ncat1 = pi...
<|body_start_0|> extloader = ExtensionLoader() pipeline = Pipeline(extloader.cats_container) pipeline.new_category('Preprocessing', 1) standard = Category('Preprocessing') self.assertEqual(pipeline.executed_cats[1].name, standard.name) <|end_body_0|> <|body_start_1|> ext...
Test_Pipeline
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_Pipeline: def test_new_Category(self): """Testing if the new_category(position) method insert in the executed_cats list at that position a new Category object""" <|body_0|> def test_move_category(self): """Testing if after creating 2 categories in the pipeline a...
stack_v2_sparse_classes_10k_train_003710
4,101
permissive
[ { "docstring": "Testing if the new_category(position) method insert in the executed_cats list at that position a new Category object", "name": "test_new_Category", "signature": "def test_new_Category(self)" }, { "docstring": "Testing if after creating 2 categories in the pipeline and moving one ...
6
stack_v2_sparse_classes_30k_train_001168
Implement the Python class `Test_Pipeline` described below. Class description: Implement the Test_Pipeline class. Method signatures and docstrings: - def test_new_Category(self): Testing if the new_category(position) method insert in the executed_cats list at that position a new Category object - def test_move_catego...
Implement the Python class `Test_Pipeline` described below. Class description: Implement the Test_Pipeline class. Method signatures and docstrings: - def test_new_Category(self): Testing if the new_category(position) method insert in the executed_cats list at that position a new Category object - def test_move_catego...
0dc9becc09da22af3edac90b81b1dd9b1f44fd5b
<|skeleton|> class Test_Pipeline: def test_new_Category(self): """Testing if the new_category(position) method insert in the executed_cats list at that position a new Category object""" <|body_0|> def test_move_category(self): """Testing if after creating 2 categories in the pipeline a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test_Pipeline: def test_new_Category(self): """Testing if the new_category(position) method insert in the executed_cats list at that position a new Category object""" extloader = ExtensionLoader() pipeline = Pipeline(extloader.cats_container) pipeline.new_category('Preprocessin...
the_stack_v2_python_sparse
nefi2/unittests/unittest_model/Test_Pipeline.py
andreasfirczynski/NetworkExtractionFromImages
train
0
5a7342122b64427f7e2a282639173fd793391f3f
[ "super(UserExtended, self).__init__(parent=parent)\nself.applicationInfoWidget = QtWidgets.QLabel()\nself._userId = userId\nself._applications = applications\nself.setLayout(QtWidgets.QVBoxLayout())\nself.user = User(name, userId, group=None, applications=applications)\nself.layout().addWidget(self.user)\nself.layo...
<|body_start_0|> super(UserExtended, self).__init__(parent=parent) self.applicationInfoWidget = QtWidgets.QLabel() self._userId = userId self._applications = applications self.setLayout(QtWidgets.QVBoxLayout()) self.user = User(name, userId, group=None, applications=appli...
Extended user information.
UserExtended
[ "Apache-2.0", "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExtended: """Extended user information.""" def __init__(self, name, userId, applications, group=None, parent=None): """Initialise widget with initial component *value* and *parent*.""" <|body_0|> def updateInformation(self, name, userId, applications): """Upd...
stack_v2_sparse_classes_10k_train_003711
7,036
permissive
[ { "docstring": "Initialise widget with initial component *value* and *parent*.", "name": "__init__", "signature": "def __init__(self, name, userId, applications, group=None, parent=None)" }, { "docstring": "Update widget with *name*, *userId* and *applications*.", "name": "updateInformation"...
2
stack_v2_sparse_classes_30k_train_002192
Implement the Python class `UserExtended` described below. Class description: Extended user information. Method signatures and docstrings: - def __init__(self, name, userId, applications, group=None, parent=None): Initialise widget with initial component *value* and *parent*. - def updateInformation(self, name, userI...
Implement the Python class `UserExtended` described below. Class description: Extended user information. Method signatures and docstrings: - def __init__(self, name, userId, applications, group=None, parent=None): Initialise widget with initial component *value* and *parent*. - def updateInformation(self, name, userI...
f55f52787484fcf931c4653e7e241791f052c04f
<|skeleton|> class UserExtended: """Extended user information.""" def __init__(self, name, userId, applications, group=None, parent=None): """Initialise widget with initial component *value* and *parent*.""" <|body_0|> def updateInformation(self, name, userId, applications): """Upd...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserExtended: """Extended user information.""" def __init__(self, name, userId, applications, group=None, parent=None): """Initialise widget with initial component *value* and *parent*.""" super(UserExtended, self).__init__(parent=parent) self.applicationInfoWidget = QtWidgets.QLa...
the_stack_v2_python_sparse
source/ftrack_connect/ui/widget/user.py
IngenuityEngine/ftrack-connect
train
0
14c4bc9375274d83f0d9cdd9799505ba24934674
[ "assert isinstance(return_tensor, bool)\nassert isinstance(channel_first, bool)\nself.return_tensor = return_tensor\nself.channel_first = channel_first", "assert isinstance(frames, (np.ndarray, torch.Tensor)), 'Array must be a numpy.ndarray or torch.Tensor instance.'\nassert len(frames) > 0, 'Array must contain a...
<|body_start_0|> assert isinstance(return_tensor, bool) assert isinstance(channel_first, bool) self.return_tensor = return_tensor self.channel_first = channel_first <|end_body_0|> <|body_start_1|> assert isinstance(frames, (np.ndarray, torch.Tensor)), 'Array must be a numpy.ndar...
Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.
BatchNormalizeRGB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchNormalizeRGB: """Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, return_tensor=True, channel_first=True): """Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False...
stack_v2_sparse_classes_10k_train_003712
14,169
no_license
[ { "docstring": "Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False}, bool, optional If True then the output is returned as a torch.Tensor instance, by default True. Otherwise the output is returned as a numpy.ndarray instance. channel_first : {True, False}, bool, optional...
2
stack_v2_sparse_classes_30k_train_002915
Implement the Python class `BatchNormalizeRGB` described below. Class description: Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation. Method signatures and docstrings: - def __init__(self, return_tensor=True, channel_first=True): Instantiates a new NormalizeRGB o...
Implement the Python class `BatchNormalizeRGB` described below. Class description: Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation. Method signatures and docstrings: - def __init__(self, return_tensor=True, channel_first=True): Instantiates a new NormalizeRGB o...
a7c30481822ecb945e3ff6ad184d104361a40ed1
<|skeleton|> class BatchNormalizeRGB: """Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, return_tensor=True, channel_first=True): """Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BatchNormalizeRGB: """Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, return_tensor=True, channel_first=True): """Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False}, bool, opti...
the_stack_v2_python_sparse
cheapfake/contrib/transforms.py
hu-simon/cheapfake
train
0
1280ed338b62c620ba48ae107498ae1cf4f1b7f4
[ "workflow_collection_subscription = get_object_or_404(WorkflowCollectionSubscription, id=id, user=request.user.id)\nserializer = WorkflowCollectionSubscriptionSummarySerializer(workflow_collection_subscription, context={'request': request})\nreturn Response(data=serializer.data)", "workflow_collection_subscriptio...
<|body_start_0|> workflow_collection_subscription = get_object_or_404(WorkflowCollectionSubscription, id=id, user=request.user.id) serializer = WorkflowCollectionSubscriptionSummarySerializer(workflow_collection_subscription, context={'request': request}) return Response(data=serializer.data) <|...
**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user.
WorkflowCollectionSubscriptionView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowCollectionSubscriptionView: """**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user....
stack_v2_sparse_classes_10k_train_003713
12,221
permissive
[ { "docstring": "Retrieve a WorkflowCollectionSubscription representation. Path Parameters: id (str): The UUID of the workflow collection subscription to retrieve. Returns: A HTTP response containing a dict-like JSON representation of the workflow collection subscription with a 200 status code. { \"detail\": \"h...
2
stack_v2_sparse_classes_30k_train_000658
Implement the Python class `WorkflowCollectionSubscriptionView` described below. Class description: **Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription res...
Implement the Python class `WorkflowCollectionSubscriptionView` described below. Class description: **Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription res...
dc0e8807263266713d3d7fa46e240e8d72db28d1
<|skeleton|> class WorkflowCollectionSubscriptionView: """**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WorkflowCollectionSubscriptionView: """**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user.""" def ...
the_stack_v2_python_sparse
django_workflow_system/api/views/user/workflows/subscription.py
kwang1971/django-workflow-system
train
0
496d6c0f27d5661dc42b57e1d0732a8168fe47b3
[ "if value == 0:\n return byte & ~(1 << bit)\nelif value == 1:\n return byte | 1 << bit", "i2c__bus = 1\ndevice = platform.uname()[1]\nif device == 'orangepione':\n i2c__bus = 0\nelif device == 'orangepiplus':\n i2c__bus = 0\nelif device == 'orangepipcplus':\n i2c__bus = 0\nelif device == 'linaro-al...
<|body_start_0|> if value == 0: return byte & ~(1 << bit) elif value == 1: return byte | 1 << bit <|end_body_0|> <|body_start_1|> i2c__bus = 1 device = platform.uname()[1] if device == 'orangepione': i2c__bus = 0 elif device == 'orange...
Local Functions used across all Expander Pi classes
_ABEHelpers
[ "Apache-2.0", "GPL-2.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ABEHelpers: """Local Functions used across all Expander Pi classes""" def updatebyte(byte, bit, value): """internal method for setting the value of a single bit within a byte""" <|body_0|> def get_smbus(): """internal method for getting an instance of the i2c bu...
stack_v2_sparse_classes_10k_train_003714
31,508
permissive
[ { "docstring": "internal method for setting the value of a single bit within a byte", "name": "updatebyte", "signature": "def updatebyte(byte, bit, value)" }, { "docstring": "internal method for getting an instance of the i2c bus", "name": "get_smbus", "signature": "def get_smbus()" } ...
2
stack_v2_sparse_classes_30k_train_002533
Implement the Python class `_ABEHelpers` described below. Class description: Local Functions used across all Expander Pi classes Method signatures and docstrings: - def updatebyte(byte, bit, value): internal method for setting the value of a single bit within a byte - def get_smbus(): internal method for getting an i...
Implement the Python class `_ABEHelpers` described below. Class description: Local Functions used across all Expander Pi classes Method signatures and docstrings: - def updatebyte(byte, bit, value): internal method for setting the value of a single bit within a byte - def get_smbus(): internal method for getting an i...
2529ca149d7f584ede780de1cb695a2f55b7031f
<|skeleton|> class _ABEHelpers: """Local Functions used across all Expander Pi classes""" def updatebyte(byte, bit, value): """internal method for setting the value of a single bit within a byte""" <|body_0|> def get_smbus(): """internal method for getting an instance of the i2c bu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _ABEHelpers: """Local Functions used across all Expander Pi classes""" def updatebyte(byte, bit, value): """internal method for setting the value of a single bit within a byte""" if value == 0: return byte & ~(1 << bit) elif value == 1: return byte | 1 << b...
the_stack_v2_python_sparse
reinvent-2020/RhythmCloud/lib/ABElectronics_Python_Libraries/ExpanderPi/ExpanderPi.py
aws-samples/aws-builders-fair-projects
train
89
93d60f57cc66f9ce94190e5d6f34dcefa500a527
[ "self.srv_addr = (srv_host, srv_port)\nself.cli_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.cli_sock.connect(self.srv_addr)", "while True:\n try:\n data = input('> ')\n assert data\n except (EOFError, KeyboardInterrupt, AssertionError) as e:\n print('用户输入异常或为空, 退出...'...
<|body_start_0|> self.srv_addr = (srv_host, srv_port) self.cli_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.cli_sock.connect(self.srv_addr) <|end_body_0|> <|body_start_1|> while True: try: data = input('> ') assert data ...
基于TCP协议的回声客户端.
TCPEchoClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TCPEchoClient: """基于TCP协议的回声客户端.""" def __init__(self, srv_host='127.0.0.1', srv_port=12345): """Client初始化. 1. 创建socket 2. 连接socket到服务器地址+端口号""" <|body_0|> def mainloop(self): """主循环. 1. 发送信息 2. 接受信息 3. 关闭socket连接 异常处理: - 断言非空, 为空抛出异常 - 捕获3类异常(EOFError: UNIX上为Ctr...
stack_v2_sparse_classes_10k_train_003715
1,296
no_license
[ { "docstring": "Client初始化. 1. 创建socket 2. 连接socket到服务器地址+端口号", "name": "__init__", "signature": "def __init__(self, srv_host='127.0.0.1', srv_port=12345)" }, { "docstring": "主循环. 1. 发送信息 2. 接受信息 3. 关闭socket连接 异常处理: - 断言非空, 为空抛出异常 - 捕获3类异常(EOFError: UNIX上为Ctrl+d,Windows上为Ctrl+Z+Enter), 跳出循环 - 关闭s...
2
stack_v2_sparse_classes_30k_train_005945
Implement the Python class `TCPEchoClient` described below. Class description: 基于TCP协议的回声客户端. Method signatures and docstrings: - def __init__(self, srv_host='127.0.0.1', srv_port=12345): Client初始化. 1. 创建socket 2. 连接socket到服务器地址+端口号 - def mainloop(self): 主循环. 1. 发送信息 2. 接受信息 3. 关闭socket连接 异常处理: - 断言非空, 为空抛出异常 - 捕获3类异...
Implement the Python class `TCPEchoClient` described below. Class description: 基于TCP协议的回声客户端. Method signatures and docstrings: - def __init__(self, srv_host='127.0.0.1', srv_port=12345): Client初始化. 1. 创建socket 2. 连接socket到服务器地址+端口号 - def mainloop(self): 主循环. 1. 发送信息 2. 接受信息 3. 关闭socket连接 异常处理: - 断言非空, 为空抛出异常 - 捕获3类异...
43d2f943c703fe99966688c22de2d4493383feb9
<|skeleton|> class TCPEchoClient: """基于TCP协议的回声客户端.""" def __init__(self, srv_host='127.0.0.1', srv_port=12345): """Client初始化. 1. 创建socket 2. 连接socket到服务器地址+端口号""" <|body_0|> def mainloop(self): """主循环. 1. 发送信息 2. 接受信息 3. 关闭socket连接 异常处理: - 断言非空, 为空抛出异常 - 捕获3类异常(EOFError: UNIX上为Ctr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TCPEchoClient: """基于TCP协议的回声客户端.""" def __init__(self, srv_host='127.0.0.1', srv_port=12345): """Client初始化. 1. 创建socket 2. 连接socket到服务器地址+端口号""" self.srv_addr = (srv_host, srv_port) self.cli_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.cli_sock.connect(sel...
the_stack_v2_python_sparse
day14/tcp_echo_client.py
east4ming/pyEdu
train
0
90072b0f890b561817b80cd21124fff2a744ba31
[ "rows = queryset.update(reportable=False)\nif rows == 1:\n bit = '1 harvest'\nelse:\n bit = '%s harvests' % rows\nself.message_user(request, '%s marked as unreportable' % bit)", "rows = queryset.update(reportable=True)\nif rows == 1:\n bit = '1 harvest'\nelse:\n bit = '%s harvests' % rows\nself.messag...
<|body_start_0|> rows = queryset.update(reportable=False) if rows == 1: bit = '1 harvest' else: bit = '%s harvests' % rows self.message_user(request, '%s marked as unreportable' % bit) <|end_body_0|> <|body_start_1|> rows = queryset.update(reportable=True...
HarvestAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HarvestAdmin: def mark_as_unreportable(self, request, queryset): """mark a set of varieties as unreportable""" <|body_0|> def mark_as_reportable(self, request, queryset): """mark a set of varieties as reportable""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_003716
1,476
no_license
[ { "docstring": "mark a set of varieties as unreportable", "name": "mark_as_unreportable", "signature": "def mark_as_unreportable(self, request, queryset)" }, { "docstring": "mark a set of varieties as reportable", "name": "mark_as_reportable", "signature": "def mark_as_reportable(self, r...
2
stack_v2_sparse_classes_30k_val_000218
Implement the Python class `HarvestAdmin` described below. Class description: Implement the HarvestAdmin class. Method signatures and docstrings: - def mark_as_unreportable(self, request, queryset): mark a set of varieties as unreportable - def mark_as_reportable(self, request, queryset): mark a set of varieties as r...
Implement the Python class `HarvestAdmin` described below. Class description: Implement the HarvestAdmin class. Method signatures and docstrings: - def mark_as_unreportable(self, request, queryset): mark a set of varieties as unreportable - def mark_as_reportable(self, request, queryset): mark a set of varieties as r...
ce964d52c3565de45611537f606a4bccc88cae2f
<|skeleton|> class HarvestAdmin: def mark_as_unreportable(self, request, queryset): """mark a set of varieties as unreportable""" <|body_0|> def mark_as_reportable(self, request, queryset): """mark a set of varieties as reportable""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HarvestAdmin: def mark_as_unreportable(self, request, queryset): """mark a set of varieties as unreportable""" rows = queryset.update(reportable=False) if rows == 1: bit = '1 harvest' else: bit = '%s harvests' % rows self.message_user(request, '%...
the_stack_v2_python_sparse
barn/metrics/harvestcount/admin.py
ebrelsford/Farming-Concrete
train
4
92b7e85c3726232f52a212ba133965134926bb68
[ "try:\n from pynao import tddft_iter\nexcept ModuleNotFoundError as err:\n msg = 'running lrtddft with Siesta calculator requires pynao package'\n raise ModuleNotFoundError(msg) from err\nself.initialize = initialize\nself.lrtddft_params = kw\nself.tddft = None\nif 'iter_broadening' in self.lrtddft_params:...
<|body_start_0|> try: from pynao import tddft_iter except ModuleNotFoundError as err: msg = 'running lrtddft with Siesta calculator requires pynao package' raise ModuleNotFoundError(msg) from err self.initialize = initialize self.lrtddft_params = kw ...
Interface for linear response TDDFT for Siesta via [PyNAO](https://mbarbry.website.fr.to/pynao/doc/html/) When using PyNAO please cite the papers indicated at in the PyNAO [documentation](https://mbarbry.website.fr.to/pynao/doc/html/references.html)
SiestaLRTDDFT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SiestaLRTDDFT: """Interface for linear response TDDFT for Siesta via [PyNAO](https://mbarbry.website.fr.to/pynao/doc/html/) When using PyNAO please cite the papers indicated at in the PyNAO [documentation](https://mbarbry.website.fr.to/pynao/doc/html/references.html)""" def __init__(self, in...
stack_v2_sparse_classes_10k_train_003717
6,483
no_license
[ { "docstring": "Parameters ---------- initialize: bool To initialize the tddft calculations before calculating the polarizability Can be useful to calculate multiple frequency range without the need to recalculate the kernel kw: dictionary keywords for the tddft_iter function from PyNAO", "name": "__init__"...
3
stack_v2_sparse_classes_30k_test_000259
Implement the Python class `SiestaLRTDDFT` described below. Class description: Interface for linear response TDDFT for Siesta via [PyNAO](https://mbarbry.website.fr.to/pynao/doc/html/) When using PyNAO please cite the papers indicated at in the PyNAO [documentation](https://mbarbry.website.fr.to/pynao/doc/html/referen...
Implement the Python class `SiestaLRTDDFT` described below. Class description: Interface for linear response TDDFT for Siesta via [PyNAO](https://mbarbry.website.fr.to/pynao/doc/html/) When using PyNAO please cite the papers indicated at in the PyNAO [documentation](https://mbarbry.website.fr.to/pynao/doc/html/referen...
6299b76c0504c5a7f7e94271aba9907a8ce77719
<|skeleton|> class SiestaLRTDDFT: """Interface for linear response TDDFT for Siesta via [PyNAO](https://mbarbry.website.fr.to/pynao/doc/html/) When using PyNAO please cite the papers indicated at in the PyNAO [documentation](https://mbarbry.website.fr.to/pynao/doc/html/references.html)""" def __init__(self, in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SiestaLRTDDFT: """Interface for linear response TDDFT for Siesta via [PyNAO](https://mbarbry.website.fr.to/pynao/doc/html/) When using PyNAO please cite the papers indicated at in the PyNAO [documentation](https://mbarbry.website.fr.to/pynao/doc/html/references.html)""" def __init__(self, initialize=Fals...
the_stack_v2_python_sparse
venv/Lib/site-packages/ase/calculators/siesta/siesta_lrtddft.py
Pratiksha1317/e-shop
train
0
b176edb56f363151fee8af905018296bd7e5f998
[ "url = self.URLBASE + '?sid={}&d=1&dt=S'.format(remote_id)\nr = requests.get(url)\nreturn BeautifulSoup(r.text, 'html.parser')", "form = self.soup(remote_id).find('form', {'name': 'frm_daily'})\ntable = form.findChild('table')\nchildren = table.findChildren('tr')[5].findChildren('td')\ndt = arrow.get(children[0]....
<|body_start_0|> url = self.URLBASE + '?sid={}&d=1&dt=S'.format(remote_id) r = requests.get(url) return BeautifulSoup(r.text, 'html.parser') <|end_body_0|> <|body_start_1|> form = self.soup(remote_id).find('form', {'name': 'frm_daily'}) table = form.findChild('table') ch...
Get flows from Army Corps of Engineers rivergages.mvr.usace.army.mil
Corps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Corps: """Get flows from Army Corps of Engineers rivergages.mvr.usace.army.mil""" def soup(self, remote_id): """Return a beautiful soup object from rivergages.mvr.usace.army.mil""" <|body_0|> def dt_value(self, remote_id): """Return the most recent datetime and v...
stack_v2_sparse_classes_10k_train_003718
1,525
no_license
[ { "docstring": "Return a beautiful soup object from rivergages.mvr.usace.army.mil", "name": "soup", "signature": "def soup(self, remote_id)" }, { "docstring": "Return the most recent datetime and value", "name": "dt_value", "signature": "def dt_value(self, remote_id)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_005594
Implement the Python class `Corps` described below. Class description: Get flows from Army Corps of Engineers rivergages.mvr.usace.army.mil Method signatures and docstrings: - def soup(self, remote_id): Return a beautiful soup object from rivergages.mvr.usace.army.mil - def dt_value(self, remote_id): Return the most ...
Implement the Python class `Corps` described below. Class description: Get flows from Army Corps of Engineers rivergages.mvr.usace.army.mil Method signatures and docstrings: - def soup(self, remote_id): Return a beautiful soup object from rivergages.mvr.usace.army.mil - def dt_value(self, remote_id): Return the most ...
21dfc83758b689410578faef697398afab92fded
<|skeleton|> class Corps: """Get flows from Army Corps of Engineers rivergages.mvr.usace.army.mil""" def soup(self, remote_id): """Return a beautiful soup object from rivergages.mvr.usace.army.mil""" <|body_0|> def dt_value(self, remote_id): """Return the most recent datetime and v...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Corps: """Get flows from Army Corps of Engineers rivergages.mvr.usace.army.mil""" def soup(self, remote_id): """Return a beautiful soup object from rivergages.mvr.usace.army.mil""" url = self.URLBASE + '?sid={}&d=1&dt=S'.format(remote_id) r = requests.get(url) return Beaut...
the_stack_v2_python_sparse
web/app/remote/corps.py
abkfenris/gage-web
train
1
06f176236317003a788e97a3c12681d66656ed60
[ "if self.action == 'list':\n return BaseInterviewSerializer\nelse:\n return InterviewSerializer", "current_user = self.request.user\nparams = self.kwargs\ncompany = get_object_or_404(Company, pk=params['company_pk'])\nqueryset = Interview.objects.filter(Q(candidate=current_user) | Q(interviewees__in=[curren...
<|body_start_0|> if self.action == 'list': return BaseInterviewSerializer else: return InterviewSerializer <|end_body_0|> <|body_start_1|> current_user = self.request.user params = self.kwargs company = get_object_or_404(Company, pk=params['company_pk']) ...
View class for Interviews.
InterviewViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterviewViewSet: """View class for Interviews.""" def get_serializer_class(self): """Get serializer class base on action.""" <|body_0|> def get_queryset(self): """Return interviews where current user is participated.""" <|body_1|> def create(self, r...
stack_v2_sparse_classes_10k_train_003719
3,897
no_license
[ { "docstring": "Get serializer class base on action.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Return interviews where current user is participated.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docs...
4
stack_v2_sparse_classes_30k_test_000071
Implement the Python class `InterviewViewSet` described below. Class description: View class for Interviews. Method signatures and docstrings: - def get_serializer_class(self): Get serializer class base on action. - def get_queryset(self): Return interviews where current user is participated. - def create(self, reque...
Implement the Python class `InterviewViewSet` described below. Class description: View class for Interviews. Method signatures and docstrings: - def get_serializer_class(self): Get serializer class base on action. - def get_queryset(self): Return interviews where current user is participated. - def create(self, reque...
252b0ebd77eefbcc945a0efc3068cc3421f46d5f
<|skeleton|> class InterviewViewSet: """View class for Interviews.""" def get_serializer_class(self): """Get serializer class base on action.""" <|body_0|> def get_queryset(self): """Return interviews where current user is participated.""" <|body_1|> def create(self, r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InterviewViewSet: """View class for Interviews.""" def get_serializer_class(self): """Get serializer class base on action.""" if self.action == 'list': return BaseInterviewSerializer else: return InterviewSerializer def get_queryset(self): """R...
the_stack_v2_python_sparse
app/interviews/views.py
vsokoltsov/Interview360Server
train
2
19010bc22c79b4716d5467797d05bf2d7327b74e
[ "self.c = db.c\nself.connection = db.connection\nself.c.execute(\"CREATE TABLE IF NOT EXISTS 'payment_channel_spend' (payment_txid text unique, payment_tx text, amount integer, is_redeemed integer, deposit_txid text)\")", "insert = 'INSERT INTO payment_channel_spend VALUES (?,?,?,?,?)'\nself.c.execute(insert, (st...
<|body_start_0|> self.c = db.c self.connection = db.connection self.c.execute("CREATE TABLE IF NOT EXISTS 'payment_channel_spend' (payment_txid text unique, payment_tx text, amount integer, is_redeemed integer, deposit_txid text)") <|end_body_0|> <|body_start_1|> insert = 'INSERT INTO p...
SQLite3 binding for the payment model.
PaymentSQLite3
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaymentSQLite3: """SQLite3 binding for the payment model.""" def __init__(self, db): """Instantiate SQLite3 for storing channel payment data.""" <|body_0|> def create(self, deposit_txid, payment_tx, amount): """Create a payment entry.""" <|body_1|> d...
stack_v2_sparse_classes_10k_train_003720
16,798
permissive
[ { "docstring": "Instantiate SQLite3 for storing channel payment data.", "name": "__init__", "signature": "def __init__(self, db)" }, { "docstring": "Create a payment entry.", "name": "create", "signature": "def create(self, deposit_txid, payment_tx, amount)" }, { "docstring": "Lo...
4
stack_v2_sparse_classes_30k_train_000193
Implement the Python class `PaymentSQLite3` described below. Class description: SQLite3 binding for the payment model. Method signatures and docstrings: - def __init__(self, db): Instantiate SQLite3 for storing channel payment data. - def create(self, deposit_txid, payment_tx, amount): Create a payment entry. - def l...
Implement the Python class `PaymentSQLite3` described below. Class description: SQLite3 binding for the payment model. Method signatures and docstrings: - def __init__(self, db): Instantiate SQLite3 for storing channel payment data. - def create(self, deposit_txid, payment_tx, amount): Create a payment entry. - def l...
a5e99fccf11ed75420775ae3e924c9ce94f2e86d
<|skeleton|> class PaymentSQLite3: """SQLite3 binding for the payment model.""" def __init__(self, db): """Instantiate SQLite3 for storing channel payment data.""" <|body_0|> def create(self, deposit_txid, payment_tx, amount): """Create a payment entry.""" <|body_1|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PaymentSQLite3: """SQLite3 binding for the payment model.""" def __init__(self, db): """Instantiate SQLite3 for storing channel payment data.""" self.c = db.c self.connection = db.connection self.c.execute("CREATE TABLE IF NOT EXISTS 'payment_channel_spend' (payment_txid t...
the_stack_v2_python_sparse
two1/bitserv/models.py
shayanb/two1
train
4
42c785c4a9aec3d489f419a51908a0d75ad5f644
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn HostReputation()", "from ..entity import Entity\nfrom .host_reputation_classification import HostReputationClassification\nfrom .host_reputation_rule import HostReputationRule\nfrom ..entity import Entity\nfrom .host_reputation_classif...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return HostReputation() <|end_body_0|> <|body_start_1|> from ..entity import Entity from .host_reputation_classification import HostReputationClassification from .host_reputation_rule i...
HostReputation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostReputation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_10k_train_003721
3,084
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: HostReputation", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
null
Implement the Python class `HostReputation` described below. Class description: Implement the HostReputation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `HostReputation` described below. Class description: Implement the HostReputation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class HostReputation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HostReputation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: HostReputa...
the_stack_v2_python_sparse
msgraph/generated/models/security/host_reputation.py
microsoftgraph/msgraph-sdk-python
train
135
eec7ade4a3829cc27460793150918a5081265d99
[ "def dfs(node, path, path_list):\n if not node:\n return\n current_path = path + [node.val]\n if not node.left and (not node.right):\n path_list.append(current_path)\n if node.left:\n dfs(node.left, current_path, path_list)\n if node.right:\n dfs(node.right, current_path, ...
<|body_start_0|> def dfs(node, path, path_list): if not node: return current_path = path + [node.val] if not node.left and (not node.right): path_list.append(current_path) if node.left: dfs(node.left, current_path, p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def binaryTreePaths_v2(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_1|> def binaryTreePaths2(self, root): """:type root: TreeNo...
stack_v2_sparse_classes_10k_train_003722
3,053
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[str]", "name": "binaryTreePaths", "signature": "def binaryTreePaths(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[str]", "name": "binaryTreePaths_v2", "signature": "def binaryTreePaths_v2(self, root)" }, { "doc...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths_v2(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths_v2(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths2(self, ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def binaryTreePaths_v2(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_1|> def binaryTreePaths2(self, root): """:type root: TreeNo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" def dfs(node, path, path_list): if not node: return current_path = path + [node.val] if not node.left and (not node.right): path_list.appe...
the_stack_v2_python_sparse
src/lt_257.py
oxhead/CodingYourWay
train
0
e9ee71490a9adedf56080c4fb337fe554becf3b7
[ "permission = AdministerOrganizationPermission(orgname)\nif permission.can() or allow_if_superuser():\n try:\n org = model.organization.get_organization(orgname)\n except model.InvalidOrganizationException:\n raise NotFound()\n prototype = model.permission.delete_prototype_permission(org, pro...
<|body_start_0|> permission = AdministerOrganizationPermission(orgname) if permission.can() or allow_if_superuser(): try: org = model.organization.get_organization(orgname) except model.InvalidOrganizationException: raise NotFound() pro...
Resource for managinging individual permission prototypes.
PermissionPrototype
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionPrototype: """Resource for managinging individual permission prototypes.""" def delete(self, orgname, prototypeid): """Delete an existing permission prototype.""" <|body_0|> def put(self, orgname, prototypeid): """Update the role of an existing permissi...
stack_v2_sparse_classes_10k_train_003723
10,847
permissive
[ { "docstring": "Delete an existing permission prototype.", "name": "delete", "signature": "def delete(self, orgname, prototypeid)" }, { "docstring": "Update the role of an existing permission prototype.", "name": "put", "signature": "def put(self, orgname, prototypeid)" } ]
2
stack_v2_sparse_classes_30k_train_006476
Implement the Python class `PermissionPrototype` described below. Class description: Resource for managinging individual permission prototypes. Method signatures and docstrings: - def delete(self, orgname, prototypeid): Delete an existing permission prototype. - def put(self, orgname, prototypeid): Update the role of...
Implement the Python class `PermissionPrototype` described below. Class description: Resource for managinging individual permission prototypes. Method signatures and docstrings: - def delete(self, orgname, prototypeid): Delete an existing permission prototype. - def put(self, orgname, prototypeid): Update the role of...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class PermissionPrototype: """Resource for managinging individual permission prototypes.""" def delete(self, orgname, prototypeid): """Delete an existing permission prototype.""" <|body_0|> def put(self, orgname, prototypeid): """Update the role of an existing permissi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PermissionPrototype: """Resource for managinging individual permission prototypes.""" def delete(self, orgname, prototypeid): """Delete an existing permission prototype.""" permission = AdministerOrganizationPermission(orgname) if permission.can() or allow_if_superuser(): ...
the_stack_v2_python_sparse
endpoints/api/prototype.py
quay/quay
train
2,363
27c729152c67f7ff08ca4035d91291c2cdd65ac1
[ "self.all_snaps = []\nget_snap_calls = 'commands -f \"endpoint~{id} missed_snapshot,method=get\"'\nsnap_calls = get_dicted(self.rbkcli.call_back(get_snap_calls))\nfor calls in snap_calls:\n org_call = calls['endpoint'].split('{id}')[0]\n if 'unmanaged' in org_call:\n continue\n objects = get_dicted(...
<|body_start_0|> self.all_snaps = [] get_snap_calls = 'commands -f "endpoint~{id} missed_snapshot,method=get"' snap_calls = get_dicted(self.rbkcli.call_back(get_snap_calls)) for calls in snap_calls: org_call = calls['endpoint'].split('{id}')[0] if 'unmanaged' in o...
AllMissedSnaps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllMissedSnaps: def execute(self, args): """.""" <|body_0|> def get_snap_from_objects(self, objects, org_call, calls): """.""" <|body_1|> def add_relevant_fields(self, snap, obj, keys, org_call): """.""" <|body_2|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_10k_train_003724
2,588
permissive
[ { "docstring": ".", "name": "execute", "signature": "def execute(self, args)" }, { "docstring": ".", "name": "get_snap_from_objects", "signature": "def get_snap_from_objects(self, objects, org_call, calls)" }, { "docstring": ".", "name": "add_relevant_fields", "signature"...
3
stack_v2_sparse_classes_30k_train_005566
Implement the Python class `AllMissedSnaps` described below. Class description: Implement the AllMissedSnaps class. Method signatures and docstrings: - def execute(self, args): . - def get_snap_from_objects(self, objects, org_call, calls): . - def add_relevant_fields(self, snap, obj, keys, org_call): .
Implement the Python class `AllMissedSnaps` described below. Class description: Implement the AllMissedSnaps class. Method signatures and docstrings: - def execute(self, args): . - def get_snap_from_objects(self, objects, org_call, calls): . - def add_relevant_fields(self, snap, obj, keys, org_call): . <|skeleton|> ...
62bbb20d15c78d2554d7258bdae655452ac826c7
<|skeleton|> class AllMissedSnaps: def execute(self, args): """.""" <|body_0|> def get_snap_from_objects(self, objects, org_call, calls): """.""" <|body_1|> def add_relevant_fields(self, snap, obj, keys, org_call): """.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AllMissedSnaps: def execute(self, args): """.""" self.all_snaps = [] get_snap_calls = 'commands -f "endpoint~{id} missed_snapshot,method=get"' snap_calls = get_dicted(self.rbkcli.call_back(get_snap_calls)) for calls in snap_calls: org_call = calls['endpoint'...
the_stack_v2_python_sparse
scripts/default/all_missed_snapshots.py
rubrikinc/rbkcli
train
12
f14b844b5bcf5cd333c3325c16c84b5fca2a9b41
[ "if start_date and end_date:\n tweets, retweets = tweepy_getter.get_tweets_by_user(id, num_tweets, start_date, end_date)\nelif start_date or end_date:\n raise Exception('Please provide valid start and end dates')\nelse:\n tweets, retweets = tweepy_getter.get_tweets_by_user(id, num_tweets)\ntweet_setter.sto...
<|body_start_0|> if start_date and end_date: tweets, retweets = tweepy_getter.get_tweets_by_user(id, num_tweets, start_date, end_date) elif start_date or end_date: raise Exception('Please provide valid start and end dates') else: tweets, retweets = tweepy_gett...
Download Tweets for use in future algorithms.
TwitterTweetDownloader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwitterTweetDownloader: """Download Tweets for use in future algorithms.""" def gen_user_tweets(self, id: Union[str, int], tweepy_getter, tweet_setter, num_tweets=None, start_date=None, end_date=None) -> List[Tweet]: """Retrieves tweets from twitter from a given user, and stores them...
stack_v2_sparse_classes_10k_train_003725
7,540
no_license
[ { "docstring": "Retrieves tweets from twitter from a given user, and stores them @param id the id or username of the user @param tweepy_getter the dao to retrieve tweets from tweepy @param tweept_setter the dao to store tweets with @param num_tweets the number of tweets to retrieve @param start_date - Optional,...
2
null
Implement the Python class `TwitterTweetDownloader` described below. Class description: Download Tweets for use in future algorithms. Method signatures and docstrings: - def gen_user_tweets(self, id: Union[str, int], tweepy_getter, tweet_setter, num_tweets=None, start_date=None, end_date=None) -> List[Tweet]: Retriev...
Implement the Python class `TwitterTweetDownloader` described below. Class description: Download Tweets for use in future algorithms. Method signatures and docstrings: - def gen_user_tweets(self, id: Union[str, int], tweepy_getter, tweet_setter, num_tweets=None, start_date=None, end_date=None) -> List[Tweet]: Retriev...
33a3fa38ad4dcdd54ff583da15dcd67c99ad9701
<|skeleton|> class TwitterTweetDownloader: """Download Tweets for use in future algorithms.""" def gen_user_tweets(self, id: Union[str, int], tweepy_getter, tweet_setter, num_tweets=None, start_date=None, end_date=None) -> List[Tweet]: """Retrieves tweets from twitter from a given user, and stores them...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TwitterTweetDownloader: """Download Tweets for use in future algorithms.""" def gen_user_tweets(self, id: Union[str, int], tweepy_getter, tweet_setter, num_tweets=None, start_date=None, end_date=None) -> List[Tweet]: """Retrieves tweets from twitter from a given user, and stores them @param id th...
the_stack_v2_python_sparse
src/process/download/twitter_downloader.py
ReinaKousaka/core
train
0
c8ee4933e68a2f9982b9275c472a6df0e654cc69
[ "for task_item in self.tasks:\n if task_item.id == task_id:\n return True\nreturn False", "if self.isExist(task_id):\n forbidden_abort(f\"Task '{task_id}' is already exist!\")\nif task_id[0] == '_':\n forbidden_abort(\"Task name can not start with '_'\")\ntitle = kwargs.get('title')\ndesc = kwargs...
<|body_start_0|> for task_item in self.tasks: if task_item.id == task_id: return True return False <|end_body_0|> <|body_start_1|> if self.isExist(task_id): forbidden_abort(f"Task '{task_id}' is already exist!") if task_id[0] == '_': f...
Index信息存入'.dicer2_base'的字段结构和操作方法
BaseIndex
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseIndex: """Index信息存入'.dicer2_base'的字段结构和操作方法""" def isExist(self, task_id): """判断'.dicer2_base'当前index对象中某个task是否存在 :param task_id: 目标task :return:""" <|body_0|> def add_task(self, task_id, **kwargs): """向'.dicer2_base'当前index对象中添加一个task :param task_id: 目标task...
stack_v2_sparse_classes_10k_train_003726
3,221
permissive
[ { "docstring": "判断'.dicer2_base'当前index对象中某个task是否存在 :param task_id: 目标task :return:", "name": "isExist", "signature": "def isExist(self, task_id)" }, { "docstring": "向'.dicer2_base'当前index对象中添加一个task :param task_id: 目标task :param kwargs: 添加task所需的其他字段 :return:", "name": "add_task", "sig...
6
stack_v2_sparse_classes_30k_train_006230
Implement the Python class `BaseIndex` described below. Class description: Index信息存入'.dicer2_base'的字段结构和操作方法 Method signatures and docstrings: - def isExist(self, task_id): 判断'.dicer2_base'当前index对象中某个task是否存在 :param task_id: 目标task :return: - def add_task(self, task_id, **kwargs): 向'.dicer2_base'当前index对象中添加一个task :...
Implement the Python class `BaseIndex` described below. Class description: Index信息存入'.dicer2_base'的字段结构和操作方法 Method signatures and docstrings: - def isExist(self, task_id): 判断'.dicer2_base'当前index对象中某个task是否存在 :param task_id: 目标task :return: - def add_task(self, task_id, **kwargs): 向'.dicer2_base'当前index对象中添加一个task :...
3d50d3854a087eecaf45a744ddfe2fa2e225951a
<|skeleton|> class BaseIndex: """Index信息存入'.dicer2_base'的字段结构和操作方法""" def isExist(self, task_id): """判断'.dicer2_base'当前index对象中某个task是否存在 :param task_id: 目标task :return:""" <|body_0|> def add_task(self, task_id, **kwargs): """向'.dicer2_base'当前index对象中添加一个task :param task_id: 目标task...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseIndex: """Index信息存入'.dicer2_base'的字段结构和操作方法""" def isExist(self, task_id): """判断'.dicer2_base'当前index对象中某个task是否存在 :param task_id: 目标task :return:""" for task_item in self.tasks: if task_item.id == task_id: return True return False def add_task...
the_stack_v2_python_sparse
App/models/BaseIndexMapping.py
PhenomingZ/dicer2
train
1
27277bcf88c7c453655db83db33a0a516803e3c6
[ "blocked_message = self._message(access_point, message_key)\nif blocked_message is None:\n raise Http404\nreturn render_to_response(blocked_message.template, {})", "message_dict = dict()\nif access_point == self.ENROLLMENT_ACCESS_POINT:\n message_dict = messages.ENROLL_MESSAGES\nelif access_point == self.CO...
<|body_start_0|> blocked_message = self._message(access_point, message_key) if blocked_message is None: raise Http404 return render_to_response(blocked_message.template, {}) <|end_body_0|> <|body_start_1|> message_dict = dict() if access_point == self.ENROLLMENT_ACCE...
Show a message explaining that the user was blocked from a course.
CourseAccessMessageView
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseAccessMessageView: """Show a message explaining that the user was blocked from a course.""" def get(self, request, access_point=None, message_key=None): """Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str...
stack_v2_sparse_classes_10k_train_003727
3,848
permissive
[ { "docstring": "Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str): Either 'enrollment' or 'courseware', indicating how the user is trying to access the restricted content. message_key (str): An identifier for which message to show. See `e...
2
null
Implement the Python class `CourseAccessMessageView` described below. Class description: Show a message explaining that the user was blocked from a course. Method signatures and docstrings: - def get(self, request, access_point=None, message_key=None): Show a message explaining that the user was blocked. Arguments: r...
Implement the Python class `CourseAccessMessageView` described below. Class description: Show a message explaining that the user was blocked from a course. Method signatures and docstrings: - def get(self, request, access_point=None, message_key=None): Show a message explaining that the user was blocked. Arguments: r...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class CourseAccessMessageView: """Show a message explaining that the user was blocked from a course.""" def get(self, request, access_point=None, message_key=None): """Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CourseAccessMessageView: """Show a message explaining that the user was blocked from a course.""" def get(self, request, access_point=None, message_key=None): """Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str): Either 'en...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/embargo/views.py
luque/better-ways-of-thinking-about-software
train
3
736a9fde6c084d8c7280cdfff2befa90245772da
[ "self.privilege_id = privilege_id\nself.additional_categories = additional_categories\nself.category = category\nself.description = description\nself.is_available_on_helios = is_available_on_helios\nself.is_custom_role_default = is_custom_role_default\nself.is_saa_s_only = is_saa_s_only\nself.is_special = is_specia...
<|body_start_0|> self.privilege_id = privilege_id self.additional_categories = additional_categories self.category = category self.description = description self.is_available_on_helios = is_available_on_helios self.is_custom_role_default = is_custom_role_default s...
Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for unique privilege Id values. All below enum va...
PrivilegeInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrivilegeInfo: """Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for uniq...
stack_v2_sparse_classes_10k_train_003728
5,145
permissive
[ { "docstring": "Constructor for the PrivilegeInfo class", "name": "__init__", "signature": "def __init__(self, privilege_id=None, additional_categories=None, category=None, description=None, is_available_on_helios=None, is_custom_role_default=None, is_saa_s_only=None, is_special=None, is_view_only=None,...
2
null
Implement the Python class `PrivilegeInfo` described below. Class description: Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when ...
Implement the Python class `PrivilegeInfo` described below. Class description: Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PrivilegeInfo: """Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for uniq...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrivilegeInfo: """Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for unique privilege ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/privilege_info.py
cohesity/management-sdk-python
train
24
6ed1e559e3fccd97eccce7d0f4114f719e380bf9
[ "p = 1\nn = len(nums)\noutput = []\nfor i in range(0, n):\n output.append(p)\n p = p * nums[i]\np = 1\nfor i in range(n - 1, -1, -1):\n output[i] = output[i] * p\n p = p * nums[i]\nreturn output", "from __builtin__ import xrange\nresult = [1]\nfor i in xrange(1, len(nums)):\n result.append(result[-...
<|body_start_0|> p = 1 n = len(nums) output = [] for i in range(0, n): output.append(p) p = p * nums[i] p = 1 for i in range(n - 1, -1, -1): output[i] = output[i] * p p = p * nums[i] return output <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.""" <|body_0|> def rewrite(self, nums): """:type nums: List[int] :rtype: List[int]""" <...
stack_v2_sparse_classes_10k_train_003729
3,043
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "r...
4
stack_v2_sparse_classes_30k_train_000703
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果. - def rewrite(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果. - def rewrite(self...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.""" <|body_0|> def rewrite(self, nums): """:type nums: List[int] :rtype: List[int]""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int] 掃兩遍. 第一遍由前往後 每個slot為前面的乘積. 第二遍由後往前 每個slot為之前slot的值(即前面的乘積) 乘上 後面的乘積. 第二遍掃完slot存放著結果.""" p = 1 n = len(nums) output = [] for i in range(0, n): output.append(p) ...
the_stack_v2_python_sparse
co_fb/238_Product_of_Array_Except_Self.py
vsdrun/lc_public
train
6
84d71da7ecc685d32d0ac2004fedb3fe9333454b
[ "try:\n doc = Document.objects.get(id=doc_id)\nexcept Document.DoesNotExist:\n raise Http404('Document does not exists')\nif request.user.has_perm(Access.PERM_WRITE, doc):\n page_nums = request.GET.getlist('pages[]')\n page_nums = [int(number) for number in page_nums]\n doc.delete_pages(page_numbers=...
<|body_start_0|> try: doc = Document.objects.get(id=doc_id) except Document.DoesNotExist: raise Http404('Document does not exists') if request.user.has_perm(Access.PERM_WRITE, doc): page_nums = request.GET.getlist('pages[]') page_nums = [int(number...
PagesView
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PagesView: def delete(self, request, doc_id): """Deletes Pages from doc_id document""" <|body_0|> def post(self, request, doc_id): """Reorders pages from doc_id document request.data is expected to be a list of dictionaries: Example: [ {page_num: 2, page_order: 1}, {...
stack_v2_sparse_classes_10k_train_003730
7,101
permissive
[ { "docstring": "Deletes Pages from doc_id document", "name": "delete", "signature": "def delete(self, request, doc_id)" }, { "docstring": "Reorders pages from doc_id document request.data is expected to be a list of dictionaries: Example: [ {page_num: 2, page_order: 1}, {page_num: 1, page_order:...
2
stack_v2_sparse_classes_30k_train_001255
Implement the Python class `PagesView` described below. Class description: Implement the PagesView class. Method signatures and docstrings: - def delete(self, request, doc_id): Deletes Pages from doc_id document - def post(self, request, doc_id): Reorders pages from doc_id document request.data is expected to be a li...
Implement the Python class `PagesView` described below. Class description: Implement the PagesView class. Method signatures and docstrings: - def delete(self, request, doc_id): Deletes Pages from doc_id document - def post(self, request, doc_id): Reorders pages from doc_id document request.data is expected to be a li...
56c10c889e1db4760a3c47f2374a63ec12fcec3b
<|skeleton|> class PagesView: def delete(self, request, doc_id): """Deletes Pages from doc_id document""" <|body_0|> def post(self, request, doc_id): """Reorders pages from doc_id document request.data is expected to be a list of dictionaries: Example: [ {page_num: 2, page_order: 1}, {...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PagesView: def delete(self, request, doc_id): """Deletes Pages from doc_id document""" try: doc = Document.objects.get(id=doc_id) except Document.DoesNotExist: raise Http404('Document does not exists') if request.user.has_perm(Access.PERM_WRITE, doc): ...
the_stack_v2_python_sparse
papermerge/core/views/api.py
zhiliangpersonal/papermerge
train
1
9a9508a4c8549282b4342a83b891d54a39fcd8c6
[ "self._smax = soil_moisture_max\nself._g = beta_parameter\nself._c = bulk_coefficient\nself._l = specific_latent_heat_of_water\nsuper(BucketHydrology, self).__init__(**kwargs)", "beta_factor = 0\nnew_state = initialize_numpy_arrays_with_properties(self.output_properties, state, self.input_properties)\ndiagnostics...
<|body_start_0|> self._smax = soil_moisture_max self._g = beta_parameter self._c = bulk_coefficient self._l = specific_latent_heat_of_water super(BucketHydrology, self).__init__(**kwargs) <|end_body_0|> <|body_start_1|> beta_factor = 0 new_state = initialize_nump...
Manages surface energy and moisture balance This component assumes that the surface is a slab with some heat capacity and moisture holding capacity. Calculates the sensible and latent heat flux, takes precipitation values as input.
BucketHydrology
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BucketHydrology: """Manages surface energy and moisture balance This component assumes that the surface is a slab with some heat capacity and moisture holding capacity. Calculates the sensible and latent heat flux, takes precipitation values as input.""" def __init__(self, soil_moisture_max=...
stack_v2_sparse_classes_10k_train_003731
6,883
permissive
[ { "docstring": "Args: soil_moisture_max: The maximum moisture that can be held by the surface_temperature beta_parameter: A constant value that is used in the beta_factor calculation. bulk_coefficient: The bulk transfer coefficient that is used to calculate maximum evaporation rate and sensible heat flux", ...
2
stack_v2_sparse_classes_30k_train_007279
Implement the Python class `BucketHydrology` described below. Class description: Manages surface energy and moisture balance This component assumes that the surface is a slab with some heat capacity and moisture holding capacity. Calculates the sensible and latent heat flux, takes precipitation values as input. Metho...
Implement the Python class `BucketHydrology` described below. Class description: Manages surface energy and moisture balance This component assumes that the surface is a slab with some heat capacity and moisture holding capacity. Calculates the sensible and latent heat flux, takes precipitation values as input. Metho...
556487e1b5e78011004a9264ace5130c3dc3507a
<|skeleton|> class BucketHydrology: """Manages surface energy and moisture balance This component assumes that the surface is a slab with some heat capacity and moisture holding capacity. Calculates the sensible and latent heat flux, takes precipitation values as input.""" def __init__(self, soil_moisture_max=...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BucketHydrology: """Manages surface energy and moisture balance This component assumes that the surface is a slab with some heat capacity and moisture holding capacity. Calculates the sensible and latent heat flux, takes precipitation values as input.""" def __init__(self, soil_moisture_max=0.15, beta_pa...
the_stack_v2_python_sparse
climt/_components/bucket_hydrology/component.py
CliMT/climt
train
129
c8e8eead69db9b51e606aef7138788aea108fbd9
[ "self._session = session_obj\nself._ctx_ks = KeyStore(self._session)\nself._ctx_key = KeyObject(self._ctx_ks)", "status, object_type, cipher_type = self._ctx_key.get_handle(key_id)\nif status != apis.kStatus_SSS_Success:\n return status\nstatus = self._ctx_ks.erase_key(self._ctx_key)\nself._ctx_key.free()\nret...
<|body_start_0|> self._session = session_obj self._ctx_ks = KeyStore(self._session) self._ctx_key = KeyObject(self._ctx_ks) <|end_body_0|> <|body_start_1|> status, object_type, cipher_type = self._ctx_key.get_handle(key_id) if status != apis.kStatus_SSS_Success: retu...
Erase key operation
Erase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Erase: """Erase key operation""" def __init__(self, session_obj): """constuctor :param session_obj: Instance of session""" <|body_0|> def erase_key(self, key_id): """Erase key operation :param key_id: Key index :return: Status""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k_train_003732
975
permissive
[ { "docstring": "constuctor :param session_obj: Instance of session", "name": "__init__", "signature": "def __init__(self, session_obj)" }, { "docstring": "Erase key operation :param key_id: Key index :return: Status", "name": "erase_key", "signature": "def erase_key(self, key_id)" } ]
2
stack_v2_sparse_classes_30k_val_000197
Implement the Python class `Erase` described below. Class description: Erase key operation Method signatures and docstrings: - def __init__(self, session_obj): constuctor :param session_obj: Instance of session - def erase_key(self, key_id): Erase key operation :param key_id: Key index :return: Status
Implement the Python class `Erase` described below. Class description: Erase key operation Method signatures and docstrings: - def __init__(self, session_obj): constuctor :param session_obj: Instance of session - def erase_key(self, key_id): Erase key operation :param key_id: Key index :return: Status <|skeleton|> c...
ab42459602787e9a557c3a00df40b20a52879fc7
<|skeleton|> class Erase: """Erase key operation""" def __init__(self, session_obj): """constuctor :param session_obj: Instance of session""" <|body_0|> def erase_key(self, key_id): """Erase key operation :param key_id: Key index :return: Status""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Erase: """Erase key operation""" def __init__(self, session_obj): """constuctor :param session_obj: Instance of session""" self._session = session_obj self._ctx_ks = KeyStore(self._session) self._ctx_key = KeyObject(self._ctx_ks) def erase_key(self, key_id): "...
the_stack_v2_python_sparse
src/salt/base/state/secure_element/se05x_sss/sss/erasekey.py
autopi-io/autopi-core
train
141
5543fe00c176efcb18ed150be4f9e9d71e2467c7
[ "self.protocol = protocol\nself.protocol.protocol_flags['MCCP'] = False\nself.protocol.will(MCCP).addCallbacks(self.do_mccp, self.no_mccp)", "if hasattr(self.protocol, 'zlib'):\n del self.protocol.zlib\nself.protocol.protocol_flags['MCCP'] = False\nself.protocol.handshake_done()", "self.protocol.protocol_fla...
<|body_start_0|> self.protocol = protocol self.protocol.protocol_flags['MCCP'] = False self.protocol.will(MCCP).addCallbacks(self.do_mccp, self.no_mccp) <|end_body_0|> <|body_start_1|> if hasattr(self.protocol, 'zlib'): del self.protocol.zlib self.protocol.protocol_f...
Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.
Mccp
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mccp: """Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.""" def __init__(self, protocol): """initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that ...
stack_v2_sparse_classes_10k_train_003733
2,571
permissive
[ { "docstring": "initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that case. Args: protocol (Protocol): The active protocol instance.", "name": "__init__", "signature": "def __init__(self, protocol)" }, { ...
3
null
Implement the Python class `Mccp` described below. Class description: Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up. Method signatures and docstrings: - def __init__(self, protocol): initialize MCCP by storing protocol on ourselves and calling the client to see if it support...
Implement the Python class `Mccp` described below. Class description: Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up. Method signatures and docstrings: - def __init__(self, protocol): initialize MCCP by storing protocol on ourselves and calling the client to see if it support...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class Mccp: """Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.""" def __init__(self, protocol): """initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mccp: """Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.""" def __init__(self, protocol): """initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that case. Args: p...
the_stack_v2_python_sparse
evennia/server/portal/mccp.py
evennia/evennia
train
1,781
b95da1d90ea2e1f57aecf7e28c7c28ea49f71d9c
[ "satSolverName = satSolverName.lower()\nif satSolverName == 'lingeling' or satSolverName == '':\n return SatSolver.LINGELING\nelif satSolverName == 'minisat':\n return SatSolver.MINISAT\nelif satSolverName == 'picosat':\n return SatSolver.PICOSAT\nelse:\n errMsg = 'Unknown backend SAT solver for Boolect...
<|body_start_0|> satSolverName = satSolverName.lower() if satSolverName == 'lingeling' or satSolverName == '': return SatSolver.LINGELING elif satSolverName == 'minisat': return SatSolver.MINISAT elif satSolverName == 'picosat': return SatSolver.PICOSA...
This class represents the SAT solver used by Boolector.
SatSolver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SatSolver: """This class represents the SAT solver used by Boolector.""" def getSatSolver(satSolverName): """Returns the SatSolver representation of the SAT solver whose name is provided. @param satSolverName Name of a SAT solver. @retval SatSolver representation of the SAT solver wh...
stack_v2_sparse_classes_10k_train_003734
5,145
no_license
[ { "docstring": "Returns the SatSolver representation of the SAT solver whose name is provided. @param satSolverName Name of a SAT solver. @retval SatSolver representation of the SAT solver whose name is provided.", "name": "getSatSolver", "signature": "def getSatSolver(satSolverName)" }, { "docs...
2
stack_v2_sparse_classes_30k_train_002323
Implement the Python class `SatSolver` described below. Class description: This class represents the SAT solver used by Boolector. Method signatures and docstrings: - def getSatSolver(satSolverName): Returns the SatSolver representation of the SAT solver whose name is provided. @param satSolverName Name of a SAT solv...
Implement the Python class `SatSolver` described below. Class description: This class represents the SAT solver used by Boolector. Method signatures and docstrings: - def getSatSolver(satSolverName): Returns the SatSolver representation of the SAT solver whose name is provided. @param satSolverName Name of a SAT solv...
43fbd6ae7f83c9ebf55dbedb4f98ce064c04514c
<|skeleton|> class SatSolver: """This class represents the SAT solver used by Boolector.""" def getSatSolver(satSolverName): """Returns the SatSolver representation of the SAT solver whose name is provided. @param satSolverName Name of a SAT solver. @retval SatSolver representation of the SAT solver wh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SatSolver: """This class represents the SAT solver used by Boolector.""" def getSatSolver(satSolverName): """Returns the SatSolver representation of the SAT solver whose name is provided. @param satSolverName Name of a SAT solver. @retval SatSolver representation of the SAT solver whose name is p...
the_stack_v2_python_sparse
build/lib.linux-x86_64-2.7/gametime/smt/solvers/boolectorSolver.py
jerryduan07/gametime
train
0
c2ff7c786abff1a430e6673878044248aa199908
[ "cnt = 0\n\ndef rec(node, acc):\n nonlocal cnt\n if not node:\n return\n if 0 not in acc:\n acc[0] = 0\n acc[0] += 1\n cnt += acc.get(targetSum - node.val, 0)\n rec(node.left, {k + node.val: v for k, v in acc.items()})\n rec(node.right, {k + node.val: v for k, v in acc.items()})\n...
<|body_start_0|> cnt = 0 def rec(node, acc): nonlocal cnt if not node: return if 0 not in acc: acc[0] = 0 acc[0] += 1 cnt += acc.get(targetSum - node.val, 0) rec(node.left, {k + node.val: v for k, v ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root: TreeNode, targetSum: int) -> int: """07/28/2020 00:27""" <|body_0|> def pathSum(self, root: TreeNode, targetSum: int) -> int: """07/28/2020 00:34 Time complexity: O(n) Space complexity: O(n)""" <|body_1|> def pathSum(sel...
stack_v2_sparse_classes_10k_train_003735
3,314
no_license
[ { "docstring": "07/28/2020 00:27", "name": "pathSum", "signature": "def pathSum(self, root: TreeNode, targetSum: int) -> int" }, { "docstring": "07/28/2020 00:34 Time complexity: O(n) Space complexity: O(n)", "name": "pathSum", "signature": "def pathSum(self, root: TreeNode, targetSum: i...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:27 - def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:34 Time complexity: O(n) Spac...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:27 - def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:34 Time complexity: O(n) Spac...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def pathSum(self, root: TreeNode, targetSum: int) -> int: """07/28/2020 00:27""" <|body_0|> def pathSum(self, root: TreeNode, targetSum: int) -> int: """07/28/2020 00:34 Time complexity: O(n) Space complexity: O(n)""" <|body_1|> def pathSum(sel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def pathSum(self, root: TreeNode, targetSum: int) -> int: """07/28/2020 00:27""" cnt = 0 def rec(node, acc): nonlocal cnt if not node: return if 0 not in acc: acc[0] = 0 acc[0] += 1 c...
the_stack_v2_python_sparse
leetcode/solved/437_Path_Sum_III/solution.py
sungminoh/algorithms
train
0
42c8bbb15a1f1955b74b23c755b69fabcac104cb
[ "if self.setting('USE_UNIQUE_USER_ID', False):\n if 'sub' in response:\n return response['sub']\n else:\n return response['id']\nelse:\n return details['email']", "email = response.get('email', '')\nname, given_name, family_name = (response.get('name', ''), response.get('given_name', ''), r...
<|body_start_0|> if self.setting('USE_UNIQUE_USER_ID', False): if 'sub' in response: return response['sub'] else: return response['id'] else: return details['email'] <|end_body_0|> <|body_start_1|> email = response.get('email',...
BaseGoogleAuth
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseGoogleAuth: def get_user_id(self, details, response): """Use google email as unique id""" <|body_0|> def get_user_details(self, response): """Return user details from Google API account""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self.set...
stack_v2_sparse_classes_10k_train_003736
6,302
permissive
[ { "docstring": "Use google email as unique id", "name": "get_user_id", "signature": "def get_user_id(self, details, response)" }, { "docstring": "Return user details from Google API account", "name": "get_user_details", "signature": "def get_user_details(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_003795
Implement the Python class `BaseGoogleAuth` described below. Class description: Implement the BaseGoogleAuth class. Method signatures and docstrings: - def get_user_id(self, details, response): Use google email as unique id - def get_user_details(self, response): Return user details from Google API account
Implement the Python class `BaseGoogleAuth` described below. Class description: Implement the BaseGoogleAuth class. Method signatures and docstrings: - def get_user_id(self, details, response): Use google email as unique id - def get_user_details(self, response): Return user details from Google API account <|skeleto...
cf95380a177e9b8d1f3b4da03543fb2f0d248bf3
<|skeleton|> class BaseGoogleAuth: def get_user_id(self, details, response): """Use google email as unique id""" <|body_0|> def get_user_details(self, response): """Return user details from Google API account""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseGoogleAuth: def get_user_id(self, details, response): """Use google email as unique id""" if self.setting('USE_UNIQUE_USER_ID', False): if 'sub' in response: return response['sub'] else: return response['id'] else: ...
the_stack_v2_python_sparse
social_core/backends/google.py
python-social-auth/social-core
train
831
3eefb62e82fd3443214f95d959ce2141f3de2bdb
[ "self.func = func\nself.task_loader = task_loader\nsuper(Function, self).__init__(**kwargs)", "if isinstance(self.func, ThisObject):\n self.func = getattr(self.flow_class.instance, self.func.name)\nif isinstance(self.task_loader, ThisObject):\n self.task_loader = getattr(self.flow_class.instance, self.task_...
<|body_start_0|> self.func = func self.task_loader = task_loader super(Function, self).__init__(**kwargs) <|end_body_0|> <|body_start_1|> if isinstance(self.func, ThisObject): self.func = getattr(self.flow_class.instance, self.func.name) if isinstance(self.task_loade...
Function task to be executed outside of the flow. Example:: class MyFlow(Flow): ... shipment_received_handler = ( flow.Function( this.on_shipment_receive, task_loader=this.get_shipment_handler_task) .Next(this.end) ) .... @method_decorator(flow.flow_func) def on_shipment_receive(self, activation, shipment): activation....
Function
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Function: """Function task to be executed outside of the flow. Example:: class MyFlow(Flow): ... shipment_received_handler = ( flow.Function( this.on_shipment_receive, task_loader=this.get_shipment_handler_task) .Next(this.end) ) .... @method_decorator(flow.flow_func) def on_shipment_receive(self...
stack_v2_sparse_classes_10k_train_003737
4,920
permissive
[ { "docstring": "Instantiate a Function task. :param func: Callable[activation, **kwargs] :param task_loader: Callable[**kwargs] -> Task `task_loader` could be a `this` reference to the class instance method. You can skip a `task_loader` if the function going to be called with Task instance, ex:: class MyFlow(Fl...
3
stack_v2_sparse_classes_30k_val_000095
Implement the Python class `Function` described below. Class description: Function task to be executed outside of the flow. Example:: class MyFlow(Flow): ... shipment_received_handler = ( flow.Function( this.on_shipment_receive, task_loader=this.get_shipment_handler_task) .Next(this.end) ) .... @method_decorator(flow....
Implement the Python class `Function` described below. Class description: Function task to be executed outside of the flow. Example:: class MyFlow(Flow): ... shipment_received_handler = ( flow.Function( this.on_shipment_receive, task_loader=this.get_shipment_handler_task) .Next(this.end) ) .... @method_decorator(flow....
0267168bb90e8e9c85aecdd715972b9622b82384
<|skeleton|> class Function: """Function task to be executed outside of the flow. Example:: class MyFlow(Flow): ... shipment_received_handler = ( flow.Function( this.on_shipment_receive, task_loader=this.get_shipment_handler_task) .Next(this.end) ) .... @method_decorator(flow.flow_func) def on_shipment_receive(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Function: """Function task to be executed outside of the flow. Example:: class MyFlow(Flow): ... shipment_received_handler = ( flow.Function( this.on_shipment_receive, task_loader=this.get_shipment_handler_task) .Next(this.end) ) .... @method_decorator(flow.flow_func) def on_shipment_receive(self, activation,...
the_stack_v2_python_sparse
Scripts/ict/viewflow/nodes/func.py
mspgeek/Client_Portal
train
6
665cd50210d892cde3bfb470e72fdd30c155e934
[ "n = len(nums)\nnums.sort()\nroots = [_ for _ in range(max(nums) + 1)]\nranks = [1] * len(roots)\n\ndef find(i):\n while roots[i] != i:\n roots[i] = roots[roots[i]]\n i = roots[i]\n return i\n\ndef union(i, j):\n x, y = (find(i), find(j))\n if x != y:\n roots[y] = x\n ranks[x...
<|body_start_0|> n = len(nums) nums.sort() roots = [_ for _ in range(max(nums) + 1)] ranks = [1] * len(roots) def find(i): while roots[i] != i: roots[i] = roots[roots[i]] i = roots[i] return i def union(i, j): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestComponentSizeTLE(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def largestComponentSize(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) nu...
stack_v2_sparse_classes_10k_train_003738
15,402
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "largestComponentSizeTLE", "signature": "def largestComponentSizeTLE(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "largestComponentSize", "signature": "def largestComponentSize(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestComponentSizeTLE(self, nums): :type nums: List[int] :rtype: int - def largestComponentSize(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestComponentSizeTLE(self, nums): :type nums: List[int] :rtype: int - def largestComponentSize(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution:...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def largestComponentSizeTLE(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def largestComponentSize(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def largestComponentSizeTLE(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) nums.sort() roots = [_ for _ in range(max(nums) + 1)] ranks = [1] * len(roots) def find(i): while roots[i] != i: roots[i] = root...
the_stack_v2_python_sparse
L/LargestComponentSizebyCommonFactor.py
bssrdf/pyleet
train
2
c1b2094dd89632c919a0c11c5d605c5dc7b90710
[ "try:\n for item in payload:\n user_record = UserRecord.create_user(email=item['email'], password=item['password'], display_name=item['display_name'], phone_number=item['phone_number'], auth=web_sdk.auth)\n user_record.make_claims({'complete_register': item['complete_register']})\n user = Us...
<|body_start_0|> try: for item in payload: user_record = UserRecord.create_user(email=item['email'], password=item['password'], display_name=item['display_name'], phone_number=item['phone_number'], auth=web_sdk.auth) user_record.make_claims({'complete_register': item[...
UserSeed
UserSeed
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSeed: """UserSeed""" def up(self): """up""" <|body_0|> def down(self): """down""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: for item in payload: user_record = UserRecord.create_user(email=item['email'], pa...
stack_v2_sparse_classes_10k_train_003739
5,514
no_license
[ { "docstring": "up", "name": "up", "signature": "def up(self)" }, { "docstring": "down", "name": "down", "signature": "def down(self)" } ]
2
stack_v2_sparse_classes_30k_train_004427
Implement the Python class `UserSeed` described below. Class description: UserSeed Method signatures and docstrings: - def up(self): up - def down(self): down
Implement the Python class `UserSeed` described below. Class description: UserSeed Method signatures and docstrings: - def up(self): up - def down(self): down <|skeleton|> class UserSeed: """UserSeed""" def up(self): """up""" <|body_0|> def down(self): """down""" <|body_...
828cb0109415b293a38f5c8ea6c11ce4a469a8ea
<|skeleton|> class UserSeed: """UserSeed""" def up(self): """up""" <|body_0|> def down(self): """down""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserSeed: """UserSeed""" def up(self): """up""" try: for item in payload: user_record = UserRecord.create_user(email=item['email'], password=item['password'], display_name=item['display_name'], phone_number=item['phone_number'], auth=web_sdk.auth) ...
the_stack_v2_python_sparse
src/seeds/user.py
andresbermeoq/server
train
0
56c63f6d45c86654e62e879b105769b7b1d71652
[ "user_friends_graph = self.get_user_friends_graph(user, user_friends_getter)\nsocial_graph_setter.store_user_friends_graph(user, user_friends_graph)\nreturn user_friends_graph", "graph = nx.Graph()\nuser_friends_list = user_friends_getter.get_friends_by_name(user)\nlocal = [user] + user_friends_list\nfor agent in...
<|body_start_0|> user_friends_graph = self.get_user_friends_graph(user, user_friends_getter) social_graph_setter.store_user_friends_graph(user, user_friends_graph) return user_friends_graph <|end_body_0|> <|body_start_1|> graph = nx.Graph() user_friends_list = user_friends_gette...
Creates a graph of twitter friends representing a community
SocialGraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_...
stack_v2_sparse_classes_10k_train_003740
2,007
no_license
[ { "docstring": "Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_getter the dao to retrieve the given users friends from @param social_graph_setter the dao to store the computed social graph", "name": "gen_user_friends_graph", "signature"...
2
stack_v2_sparse_classes_30k_train_002171
Implement the Python class `SocialGraph` described below. Class description: Creates a graph of twitter friends representing a community Method signatures and docstrings: - def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): Generates a user friends graph for a given user @param use...
Implement the Python class `SocialGraph` described below. Class description: Creates a graph of twitter friends representing a community Method signatures and docstrings: - def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): Generates a user friends graph for a given user @param use...
33a3fa38ad4dcdd54ff583da15dcd67c99ad9701
<|skeleton|> class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_getter the da...
the_stack_v2_python_sparse
src/process/social_graph/social_graph.py
ReinaKousaka/core
train
0
909421d6d4e5e31627cf7b83c1f263ad0516f704
[ "envelopes.sort(key=lambda x: (x[0], -x[1]))\n\ndef LIS(nums):\n dp = []\n for i in range(len(nums)):\n idx = bisect_left(dp, nums[i])\n if idx == len(dp):\n dp.append(nums[i])\n else:\n dp[idx] = nums[i]\n return len(dp)\nreturn LIS([i[1] for i in envelopes])", ...
<|body_start_0|> envelopes.sort(key=lambda x: (x[0], -x[1])) def LIS(nums): dp = [] for i in range(len(nums)): idx = bisect_left(dp, nums[i]) if idx == len(dp): dp.append(nums[i]) else: dp[id...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> envelopes.s...
stack_v2_sparse_classes_10k_train_003741
1,388
no_license
[ { "docstring": ":type envelopes: List[List[int]] :rtype: int", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes)" }, { "docstring": ":type envelopes: List[List[int]] :rtype: int", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int <|skeleton|> cl...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" envelopes.sort(key=lambda x: (x[0], -x[1])) def LIS(nums): dp = [] for i in range(len(nums)): idx = bisect_left(dp, nums[i]) if idx =...
the_stack_v2_python_sparse
0354_Russian_Doll_Envelopes.py
bingli8802/leetcode
train
0
4738d8686d336f772986315314f05653e51d069e
[ "interaction_info = {}\nhbonds_lig_donors = pl_interaction.hbonds_ldon\nhbonds_rec_donors = pl_interaction.hbonds_pdon\ninteraction_info['rec_acceptors'] = {coords_to_string(hbond.a.coords): 1 for hbond in hbonds_lig_donors}\ninteraction_info['lig_donors'] = {coords_to_string(hbond.d.coords): 1 for hbond in hbonds_...
<|body_start_0|> interaction_info = {} hbonds_lig_donors = pl_interaction.hbonds_ldon hbonds_rec_donors = pl_interaction.hbonds_pdon interaction_info['rec_acceptors'] = {coords_to_string(hbond.a.coords): 1 for hbond in hbonds_lig_donors} interaction_info['lig_donors'] = {coords_t...
Python reimplementation of the gninatyper function, as per https://pubs.acs.org/doi/10.1021/acs.jcim.6b00740 (some code modified from Constantin Schneider, OPIG)
StructuralInteractionParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StructuralInteractionParser: """Python reimplementation of the gninatyper function, as per https://pubs.acs.org/doi/10.1021/acs.jcim.6b00740 (some code modified from Constantin Schneider, OPIG)""" def mol_calculate_interactions(self, mol, pl_interaction): """Return dataframe with int...
stack_v2_sparse_classes_10k_train_003742
5,317
no_license
[ { "docstring": "Return dataframe with interactions from plip mol object", "name": "mol_calculate_interactions", "signature": "def mol_calculate_interactions(self, mol, pl_interaction)" }, { "docstring": "Return dataframe with interactions from one particular plip site.", "name": "featurise_i...
2
stack_v2_sparse_classes_30k_train_002727
Implement the Python class `StructuralInteractionParser` described below. Class description: Python reimplementation of the gninatyper function, as per https://pubs.acs.org/doi/10.1021/acs.jcim.6b00740 (some code modified from Constantin Schneider, OPIG) Method signatures and docstrings: - def mol_calculate_interacti...
Implement the Python class `StructuralInteractionParser` described below. Class description: Python reimplementation of the gninatyper function, as per https://pubs.acs.org/doi/10.1021/acs.jcim.6b00740 (some code modified from Constantin Schneider, OPIG) Method signatures and docstrings: - def mol_calculate_interacti...
d7fb507c22042ea8bd1d4851366f2456a2dffa82
<|skeleton|> class StructuralInteractionParser: """Python reimplementation of the gninatyper function, as per https://pubs.acs.org/doi/10.1021/acs.jcim.6b00740 (some code modified from Constantin Schneider, OPIG)""" def mol_calculate_interactions(self, mol, pl_interaction): """Return dataframe with int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StructuralInteractionParser: """Python reimplementation of the gninatyper function, as per https://pubs.acs.org/doi/10.1021/acs.jcim.6b00740 (some code modified from Constantin Schneider, OPIG)""" def mol_calculate_interactions(self, mol, pl_interaction): """Return dataframe with interactions fro...
the_stack_v2_python_sparse
point_vs/attribution/interaction_parser.py
rsanchezgarc/PointVS
train
0
98a0e702cc5df157fd32d387767acc8b2f588187
[ "super(RNNDEC, self).__init__()\nself.msgs = nn.CellList([nn.SequentialCell([nn.Dense(2 * n_in_node, msg_hid), nn.ReLU(), nn.Dropout(p=do_prob), nn.Dense(msg_hid, msg_out), nn.ReLU()]) for _ in range(edge_types)])\nself.out = nn.SequentialCell([nn.Dense(n_in_node + msg_out, n_hid), nn.ReLU(), nn.Dropout(p=do_prob),...
<|body_start_0|> super(RNNDEC, self).__init__() self.msgs = nn.CellList([nn.SequentialCell([nn.Dense(2 * n_in_node, msg_hid), nn.ReLU(), nn.Dropout(p=do_prob), nn.Dense(msg_hid, msg_out), nn.ReLU()]) for _ in range(edge_types)]) self.out = nn.SequentialCell([nn.Dense(n_in_node + msg_out, n_hid),...
RNN decoder with spatio-temporal message passing mechanisms.
RNNDEC
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNDEC: """RNN decoder with spatio-temporal message passing mechanisms.""" def __init__(self, n_in_node: int, edge_types: int, msg_hid: int, msg_out: int, n_hid: int, do_prob: float=0.0, skip_first: bool=False): """Parameters ---------- n_in_node : int input dimension. edge_types : i...
stack_v2_sparse_classes_10k_train_003743
12,491
permissive
[ { "docstring": "Parameters ---------- n_in_node : int input dimension. edge_types : int number of edge types. msg_hid, msg_out, n_hid: int dimension of different hidden layers. do_prob : float, optional rate of dropout. The default is 0.. skip_first : bool, optional setting the first type of edge as non-edge or...
3
null
Implement the Python class `RNNDEC` described below. Class description: RNN decoder with spatio-temporal message passing mechanisms. Method signatures and docstrings: - def __init__(self, n_in_node: int, edge_types: int, msg_hid: int, msg_out: int, n_hid: int, do_prob: float=0.0, skip_first: bool=False): Parameters -...
Implement the Python class `RNNDEC` described below. Class description: RNN decoder with spatio-temporal message passing mechanisms. Method signatures and docstrings: - def __init__(self, n_in_node: int, edge_types: int, msg_hid: int, msg_out: int, n_hid: int, do_prob: float=0.0, skip_first: bool=False): Parameters -...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class RNNDEC: """RNN decoder with spatio-temporal message passing mechanisms.""" def __init__(self, n_in_node: int, edge_types: int, msg_hid: int, msg_out: int, n_hid: int, do_prob: float=0.0, skip_first: bool=False): """Parameters ---------- n_in_node : int input dimension. edge_types : i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RNNDEC: """RNN decoder with spatio-temporal message passing mechanisms.""" def __init__(self, n_in_node: int, edge_types: int, msg_hid: int, msg_out: int, n_hid: int, do_prob: float=0.0, skip_first: bool=False): """Parameters ---------- n_in_node : int input dimension. edge_types : int number of ...
the_stack_v2_python_sparse
research/gnn/nri-mpm/models/nri.py
mindspore-ai/models
train
301
1310921dc60ff7eec19f424a4298c77c7fc6f917
[ "self.total = total\nself.solved = solved\nself.others = others\nself.locked = locked\nself.time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())\nself.msg = '# Keep thinking, keep alive\\nUntil {}, I have solved **{}** / **{}** problems while **{}** are still locked.\\n\\nCompletion statistic: \\n1. JavaScri...
<|body_start_0|> self.total = total self.solved = solved self.others = others self.locked = locked self.time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) self.msg = '# Keep thinking, keep alive\nUntil {}, I have solved **{}** / **{}** problems while **{}** are s...
generate folder and markdown file update README.md when you finish one problem by some language
Readme
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Readme: """generate folder and markdown file update README.md when you finish one problem by some language""" def __init__(self, total, solved, locked, others=None): """:param total: total problems nums :param solved: solved problem nums :param others: 暂时还没用,我想做扩展""" <|body_0...
stack_v2_sparse_classes_10k_train_003744
10,467
permissive
[ { "docstring": ":param total: total problems nums :param solved: solved problem nums :param others: 暂时还没用,我想做扩展", "name": "__init__", "signature": "def __init__(self, total, solved, locked, others=None)" }, { "docstring": "create REAdME.md :return:", "name": "create_leetcode_readme", "si...
2
stack_v2_sparse_classes_30k_train_006656
Implement the Python class `Readme` described below. Class description: generate folder and markdown file update README.md when you finish one problem by some language Method signatures and docstrings: - def __init__(self, total, solved, locked, others=None): :param total: total problems nums :param solved: solved pr...
Implement the Python class `Readme` described below. Class description: generate folder and markdown file update README.md when you finish one problem by some language Method signatures and docstrings: - def __init__(self, total, solved, locked, others=None): :param total: total problems nums :param solved: solved pr...
f71118e8e05d4bcdcfb2dfc42187c73961b8b926
<|skeleton|> class Readme: """generate folder and markdown file update README.md when you finish one problem by some language""" def __init__(self, total, solved, locked, others=None): """:param total: total problems nums :param solved: solved problem nums :param others: 暂时还没用,我想做扩展""" <|body_0...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Readme: """generate folder and markdown file update README.md when you finish one problem by some language""" def __init__(self, total, solved, locked, others=None): """:param total: total problems nums :param solved: solved problem nums :param others: 暂时还没用,我想做扩展""" self.total = total ...
the_stack_v2_python_sparse
scripts/readme.py
bbruceyuan/algorithms-and-oj
train
11
32c71473b23a1945b6b487bab9f9315bfb2dc9e8
[ "if not root:\n return ''\nqueue = collections.deque([root])\nretval = ''\nwhile queue:\n current = queue.popleft()\n if current != 'null':\n retval += str(current.val) + ','\n else:\n retval += 'null' + ','\n continue\n if current.left:\n queue.append(current.left)\n e...
<|body_start_0|> if not root: return '' queue = collections.deque([root]) retval = '' while queue: current = queue.popleft() if current != 'null': retval += str(current.val) + ',' else: retval += 'null' + ','...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_003745
1,942
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
bbfee57ae89d23cd4f4132fbb62d8931ea654a0e
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' queue = collections.deque([root]) retval = '' while queue: current = queue.popleft() if current != 'nul...
the_stack_v2_python_sparse
Algorithms/Leetcode/449 - Serialize and Deserialize BST.py
timpark0807/self-taught-swe
train
1
51d2390497f97399be477bdffcf83eacae9c3257
[ "res = []\nfor s in [S, T]:\n tmp = []\n for i in s:\n if i is not '#':\n tmp.append(i)\n elif i is '#' and tmp != []:\n tmp.pop()\n res.append(tmp)\nreturn res[0] == res[1]", "def F(S):\n skip = 0\n for x in reversed(S):\n if x == '#':\n skip +...
<|body_start_0|> res = [] for s in [S, T]: tmp = [] for i in s: if i is not '#': tmp.append(i) elif i is '#' and tmp != []: tmp.pop() res.append(tmp) return res[0] == res[1] <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_0|> def backspaceCompare2(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] for s i...
stack_v2_sparse_classes_10k_train_003746
2,087
no_license
[ { "docstring": ":type S: str :type T: str :rtype: bool", "name": "backspaceCompare", "signature": "def backspaceCompare(self, S, T)" }, { "docstring": ":type S: str :type T: str :rtype: bool", "name": "backspaceCompare2", "signature": "def backspaceCompare2(self, S, T)" } ]
2
stack_v2_sparse_classes_30k_test_000229
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backspaceCompare(self, S, T): :type S: str :type T: str :rtype: bool - def backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backspaceCompare(self, S, T): :type S: str :type T: str :rtype: bool - def backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool <|skeleton|> class Solution:...
416fed6e441612e1ad82467d07ee1b5570386a94
<|skeleton|> class Solution: def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_0|> def backspaceCompare2(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" res = [] for s in [S, T]: tmp = [] for i in s: if i is not '#': tmp.append(i) elif i is '#' and tmp != []: ...
the_stack_v2_python_sparse
src/python/backspace_string_compare.py
liadbiz/Leetcode-Solutions
train
1
f910d200d81f62964c2efe9cfe31ad270396a356
[ "stk = []\nfor n in nums[::-1]:\n while stk and stk[-1] <= n:\n stk.pop()\n stk.append(n)\nret = []\nfor n in nums[::-1]:\n while stk and stk[-1] <= n:\n stk.pop()\n ret.append(stk[-1] if stk else -1)\n stk.append(n)\nreturn ret[::-1]", "A = nums + nums\nprint(A)\nret = []\nfor e in n...
<|body_start_0|> stk = [] for n in nums[::-1]: while stk and stk[-1] <= n: stk.pop() stk.append(n) ret = [] for n in nums[::-1]: while stk and stk[-1] <= n: stk.pop() ret.append(stk[-1] if stk else -1) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreaterElements(self, nums): """scan the nums from right to left, since next largest number, you can drop certain information about the A[i:]. Use stack to keep a increasing numbers. if A[i] > any A[i+1: j] but A[i] < A[j], we can safely drop the numbers A[i+1:j] since ...
stack_v2_sparse_classes_10k_train_003747
2,077
permissive
[ { "docstring": "scan the nums from right to left, since next largest number, you can drop certain information about the A[i:]. Use stack to keep a increasing numbers. if A[i] > any A[i+1: j] but A[i] < A[j], we can safely drop the numbers A[i+1:j] since they won't be useful. :type nums: List[int] :rtype: List[i...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElements(self, nums): scan the nums from right to left, since next largest number, you can drop certain information about the A[i:]. Use stack to keep a increasing...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElements(self, nums): scan the nums from right to left, since next largest number, you can drop certain information about the A[i:]. Use stack to keep a increasing...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def nextGreaterElements(self, nums): """scan the nums from right to left, since next largest number, you can drop certain information about the A[i:]. Use stack to keep a increasing numbers. if A[i] > any A[i+1: j] but A[i] < A[j], we can safely drop the numbers A[i+1:j] since ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def nextGreaterElements(self, nums): """scan the nums from right to left, since next largest number, you can drop certain information about the A[i:]. Use stack to keep a increasing numbers. if A[i] > any A[i+1: j] but A[i] < A[j], we can safely drop the numbers A[i+1:j] since they won't be ...
the_stack_v2_python_sparse
503 Next Greater Element II.py
Aminaba123/LeetCode
train
1
49d9eba4735e50bfd3f353f548e0f99e64bb7e5a
[ "if not start_bracket or not end_bracket:\n raise ValueError('Attempted to construct Bracketed segment without specifying brackets.')\nself.start_bracket = start_bracket\nself.end_bracket = end_bracket\nsuper().__init__(segments=segments, pos_marker=pos_marker, uuid=uuid)", "start_brackets = [start_bracket for...
<|body_start_0|> if not start_bracket or not end_bracket: raise ValueError('Attempted to construct Bracketed segment without specifying brackets.') self.start_bracket = start_bracket self.end_bracket = end_bracket super().__init__(segments=segments, pos_marker=pos_marker, uui...
A segment containing a bracketed expression.
BracketedSegment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BracketedSegment: """A segment containing a bracketed expression.""" def __init__(self, segments: Tuple['BaseSegment', ...], start_bracket: Tuple[BaseSegment], end_bracket: Tuple[BaseSegment], pos_marker: Optional[PositionMarker]=None, uuid: Optional[UUID]=None): """Stash the bracket...
stack_v2_sparse_classes_10k_train_003748
2,905
permissive
[ { "docstring": "Stash the bracket segments for later.", "name": "__init__", "signature": "def __init__(self, segments: Tuple['BaseSegment', ...], start_bracket: Tuple[BaseSegment], end_bracket: Tuple[BaseSegment], pos_marker: Optional[PositionMarker]=None, uuid: Optional[UUID]=None)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_002685
Implement the Python class `BracketedSegment` described below. Class description: A segment containing a bracketed expression. Method signatures and docstrings: - def __init__(self, segments: Tuple['BaseSegment', ...], start_bracket: Tuple[BaseSegment], end_bracket: Tuple[BaseSegment], pos_marker: Optional[PositionMa...
Implement the Python class `BracketedSegment` described below. Class description: A segment containing a bracketed expression. Method signatures and docstrings: - def __init__(self, segments: Tuple['BaseSegment', ...], start_bracket: Tuple[BaseSegment], end_bracket: Tuple[BaseSegment], pos_marker: Optional[PositionMa...
a66da908907ee1eaf09d88a731025da29e7fca07
<|skeleton|> class BracketedSegment: """A segment containing a bracketed expression.""" def __init__(self, segments: Tuple['BaseSegment', ...], start_bracket: Tuple[BaseSegment], end_bracket: Tuple[BaseSegment], pos_marker: Optional[PositionMarker]=None, uuid: Optional[UUID]=None): """Stash the bracket...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BracketedSegment: """A segment containing a bracketed expression.""" def __init__(self, segments: Tuple['BaseSegment', ...], start_bracket: Tuple[BaseSegment], end_bracket: Tuple[BaseSegment], pos_marker: Optional[PositionMarker]=None, uuid: Optional[UUID]=None): """Stash the bracket segments for...
the_stack_v2_python_sparse
src/sqlfluff/core/parser/segments/bracketed.py
sqlfluff/sqlfluff
train
5,931
3c30d4554b1013af19b7b35b68268411715019ec
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EntitlementManagementSettings()", "from .access_package_external_user_lifecycle_action import AccessPackageExternalUserLifecycleAction\nfrom .entity import Entity\nfrom .access_package_external_user_lifecycle_action import AccessPackag...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return EntitlementManagementSettings() <|end_body_0|> <|body_start_1|> from .access_package_external_user_lifecycle_action import AccessPackageExternalUserLifecycleAction from .entity import En...
EntitlementManagementSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_10k_train_003749
3,282
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: EntitlementManagementSettings", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
null
Implement the Python class `EntitlementManagementSettings` described below. Class description: Implement the EntitlementManagementSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: Creates a new instance of th...
Implement the Python class `EntitlementManagementSettings` described below. Class description: Implement the EntitlementManagementSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: Creates a new instance of th...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ...
the_stack_v2_python_sparse
msgraph/generated/models/entitlement_management_settings.py
microsoftgraph/msgraph-sdk-python
train
135
fc885b7bc33ad02d9892bd1116f0d75eb7a698b0
[ "if isinstance(headers, dict) or isinstance(headers, wsgiref.headers.Headers):\n headers = headers.items()\nreturn [(name.lower(), value) for name, value in headers]", "expected = self._normalize_headers(expected)\nactual = self._normalize_headers(actual)\nfor name, value in actual:\n self.assertIsInstance(...
<|body_start_0|> if isinstance(headers, dict) or isinstance(headers, wsgiref.headers.Headers): headers = headers.items() return [(name.lower(), value) for name, value in headers] <|end_body_0|> <|body_start_1|> expected = self._normalize_headers(expected) actual = self._norm...
Base class for tests involving requests to a WSGI application.
WSGITestCase
[ "Apache-2.0", "LGPL-2.1-or-later", "BSD-3-Clause", "MIT", "GPL-2.0-or-later", "MPL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WSGITestCase: """Base class for tests involving requests to a WSGI application.""" def _normalize_headers(headers): """Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted ...
stack_v2_sparse_classes_10k_train_003750
6,329
permissive
[ { "docstring": "Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted to a sequence of pairs (if it was not already), with all of the header names lowercased.", "name": "_normalize_headers", "s...
3
null
Implement the Python class `WSGITestCase` described below. Class description: Base class for tests involving requests to a WSGI application. Method signatures and docstrings: - def _normalize_headers(headers): Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsg...
Implement the Python class `WSGITestCase` described below. Class description: Base class for tests involving requests to a WSGI application. Method signatures and docstrings: - def _normalize_headers(headers): Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsg...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class WSGITestCase: """Base class for tests involving requests to a WSGI application.""" def _normalize_headers(headers): """Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WSGITestCase: """Base class for tests involving requests to a WSGI application.""" def _normalize_headers(headers): """Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted to a sequence...
the_stack_v2_python_sparse
AppServer/google/appengine/tools/devappserver2/wsgi_test_utils.py
obino/appscale
train
1
d022351a743e73150d6eff39d9cd1afe36bd4ac6
[ "ImageProcessor.__init__(self, **kwargs)\nself._masks: Dict[str, Dict[str, NDArray[Any]]] = {}\nfor instrument, group in masks.items():\n self._masks[instrument] = {}\n for binning, mask in group.items():\n if isinstance(mask, np.ndarray):\n self._masks[instrument][binning] = mask\n e...
<|body_start_0|> ImageProcessor.__init__(self, **kwargs) self._masks: Dict[str, Dict[str, NDArray[Any]]] = {} for instrument, group in masks.items(): self._masks[instrument] = {} for binning, mask in group.items(): if isinstance(mask, np.ndarray): ...
Add mask to image.
AddMask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddMask: """Add mask to image.""" def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any): """Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'.""" ...
stack_v2_sparse_classes_10k_train_003751
1,856
permissive
[ { "docstring": "Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'.", "name": "__init__", "signature": "def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any)" }, { ...
2
null
Implement the Python class `AddMask` described below. Class description: Add mask to image. Method signatures and docstrings: - def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any): Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument-...
Implement the Python class `AddMask` described below. Class description: Add mask to image. Method signatures and docstrings: - def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any): Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument-...
2d7a06e5485b61b6ca7e51d99b08651ea6021086
<|skeleton|> class AddMask: """Add mask to image.""" def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any): """Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddMask: """Add mask to image.""" def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any): """Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'.""" ImagePr...
the_stack_v2_python_sparse
pyobs/images/processors/misc/addmask.py
pyobs/pyobs-core
train
9
3f937745ec648c3b949aec6a2428cb24753492f3
[ "if not nums:\n return None\n\n@cache\ndef bestScoreDiff(lo, hi):\n if lo > hi:\n return 0\n return max(nums[lo] - bestScoreDiff(lo + 1, hi), nums[hi] - bestScoreDiff(lo, hi - 1))\nreturn bestScoreDiff(0, len(nums) - 1) >= 0", "if not nums:\n return None\nmemo = list(nums)\nfor span in range(1,...
<|body_start_0|> if not nums: return None @cache def bestScoreDiff(lo, hi): if lo > hi: return 0 return max(nums[lo] - bestScoreDiff(lo + 1, hi), nums[hi] - bestScoreDiff(lo, hi - 1)) return bestScoreDiff(0, len(nums) - 1) >= 0 <|end_b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def PredictTheWinner(self, nums: List[int]) -> bool: """Return the best score advantage you can get from: - Playing one valid move - Plug the negation of the best score advantage of the opponent (since it is a negative sum game) Complexity is O(N**2) for this is the number of s...
stack_v2_sparse_classes_10k_train_003752
2,363
no_license
[ { "docstring": "Return the best score advantage you can get from: - Playing one valid move - Plug the negation of the best score advantage of the opponent (since it is a negative sum game) Complexity is O(N**2) for this is the number of sub-solutions (i < j)", "name": "PredictTheWinner", "signature": "d...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def PredictTheWinner(self, nums: List[int]) -> bool: Return the best score advantage you can get from: - Playing one valid move - Plug the negation of the best score advantage of...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def PredictTheWinner(self, nums: List[int]) -> bool: Return the best score advantage you can get from: - Playing one valid move - Plug the negation of the best score advantage of...
3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8
<|skeleton|> class Solution: def PredictTheWinner(self, nums: List[int]) -> bool: """Return the best score advantage you can get from: - Playing one valid move - Plug the negation of the best score advantage of the opponent (since it is a negative sum game) Complexity is O(N**2) for this is the number of s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def PredictTheWinner(self, nums: List[int]) -> bool: """Return the best score advantage you can get from: - Playing one valid move - Plug the negation of the best score advantage of the opponent (since it is a negative sum game) Complexity is O(N**2) for this is the number of sub-solutions (...
the_stack_v2_python_sparse
dp/PredictTheWinner.py
QuentinDuval/PythonExperiments
train
3
2b7a2762a9201f72d07436b272fe3070d6afc522
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MailClusterEvidence()", "from .alert_evidence import AlertEvidence\nfrom .alert_evidence import AlertEvidence\nfields: Dict[str, Callable[[Any], None]] = {'clusterBy': lambda n: setattr(self, 'cluster_by', n.get_str_value()), 'clusterB...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MailClusterEvidence() <|end_body_0|> <|body_start_1|> from .alert_evidence import AlertEvidence from .alert_evidence import AlertEvidence fields: Dict[str, Callable[[Any], None]]...
MailClusterEvidence
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailClusterEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailClusterEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob...
stack_v2_sparse_classes_10k_train_003753
3,430
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: MailClusterEvidence", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
null
Implement the Python class `MailClusterEvidence` described below. Class description: Implement the MailClusterEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailClusterEvidence: Creates a new instance of the appropriate class based on d...
Implement the Python class `MailClusterEvidence` described below. Class description: Implement the MailClusterEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailClusterEvidence: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MailClusterEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailClusterEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MailClusterEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailClusterEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ...
the_stack_v2_python_sparse
msgraph/generated/models/security/mail_cluster_evidence.py
microsoftgraph/msgraph-sdk-python
train
135
2501aeb7c1d544958d038dd101de797b0c52793a
[ "self.vehicle_id = int(vehicle_id)\nself.vehicle_states = np.asarray([[], [], [], [], []])\nrospy.Subscriber('/world_state', WorldState, self.update_state)", "self.vehicle_states = np.asarray([[], [], [], [], []])\nfor vs in ws.vehicle_states:\n self.vehicle_states = np.concatenate((self.vehicle_states, [[vs.v...
<|body_start_0|> self.vehicle_id = int(vehicle_id) self.vehicle_states = np.asarray([[], [], [], [], []]) rospy.Subscriber('/world_state', WorldState, self.update_state) <|end_body_0|> <|body_start_1|> self.vehicle_states = np.asarray([[], [], [], [], []]) for vs in ws.vehicle_s...
Base class for sensors. New sensors inherit from this class which implements the subsciption to the world state and the processing of this subscription.
BaseSensor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSensor: """Base class for sensors. New sensors inherit from this class which implements the subsciption to the world state and the processing of this subscription.""" def __init__(self, vehicle_id): """Initialize class BaseSensor. @param vehicle_id: I{(int)} ID of the vehicle thi...
stack_v2_sparse_classes_10k_train_003754
5,525
no_license
[ { "docstring": "Initialize class BaseSensor. @param vehicle_id: I{(int)} ID of the vehicle this sensor belongs to.", "name": "__init__", "signature": "def __init__(self, vehicle_id)" }, { "docstring": "Callback function for topic 'world_state'.", "name": "update_state", "signature": "def...
2
stack_v2_sparse_classes_30k_train_005633
Implement the Python class `BaseSensor` described below. Class description: Base class for sensors. New sensors inherit from this class which implements the subsciption to the world state and the processing of this subscription. Method signatures and docstrings: - def __init__(self, vehicle_id): Initialize class Base...
Implement the Python class `BaseSensor` described below. Class description: Base class for sensors. New sensors inherit from this class which implements the subsciption to the world state and the processing of this subscription. Method signatures and docstrings: - def __init__(self, vehicle_id): Initialize class Base...
a759b0336b80b5647cc858d99d1fa40a0a9d826d
<|skeleton|> class BaseSensor: """Base class for sensors. New sensors inherit from this class which implements the subsciption to the world state and the processing of this subscription.""" def __init__(self, vehicle_id): """Initialize class BaseSensor. @param vehicle_id: I{(int)} ID of the vehicle thi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseSensor: """Base class for sensors. New sensors inherit from this class which implements the subsciption to the world state and the processing of this subscription.""" def __init__(self, vehicle_id): """Initialize class BaseSensor. @param vehicle_id: I{(int)} ID of the vehicle this sensor belo...
the_stack_v2_python_sparse
sml_world/scripts/sml_modules/sensor_models.py
marinarantanen/sml_world
train
1
02b31d88c8a36a5182eadce04f9ea031272cad49
[ "super(CBFocalLoss, self).__init__()\nself.beta = beta\nself.gamma = gamma\nself._nums = torch.zeros(len(class_num))\nself.sub_beta = torch.zeros(len(class_num))\nfor i in range(len(class_num)):\n self._nums[i] = class_num[i]\n self.sub_beta[i] = (1 - self.beta) / (1 - math.pow(self.beta, class_num[i]))\nself...
<|body_start_0|> super(CBFocalLoss, self).__init__() self.beta = beta self.gamma = gamma self._nums = torch.zeros(len(class_num)) self.sub_beta = torch.zeros(len(class_num)) for i in range(len(class_num)): self._nums[i] = class_num[i] self.sub_beta...
Class Balanced Focal Loss
CBFocalLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBFocalLoss: """Class Balanced Focal Loss""" def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): """初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param...
stack_v2_sparse_classes_10k_train_003755
2,437
no_license
[ { "docstring": "初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param reduction: 可选`mean`和`sum`", "name": "__init__", "signature": "def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: st...
2
stack_v2_sparse_classes_30k_train_006764
Implement the Python class `CBFocalLoss` described below. Class description: Class Balanced Focal Loss Method signatures and docstrings: - def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): 初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总...
Implement the Python class `CBFocalLoss` described below. Class description: Class Balanced Focal Loss Method signatures and docstrings: - def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): 初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总...
aaeeed86341356d9fd061664f6f7bccf2ac353d0
<|skeleton|> class CBFocalLoss: """Class Balanced Focal Loss""" def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): """初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CBFocalLoss: """Class Balanced Focal Loss""" def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): """初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param reduction: 可...
the_stack_v2_python_sparse
src/losses/cb_focal_loss.py
jessie0624/nlp-task
train
0
fadc2499712f508f346f313829dbfbd408c0d380
[ "hashmap = db_api.get_instance()\nmapping_list = []\nmappings_uuid_list = hashmap.list_mappings(group_uuid=group_id)\nfor mapping_uuid in mappings_uuid_list:\n mapping_db = hashmap.get_mapping(uuid=mapping_uuid)\n mapping_list.append(mapping_models.Mapping(**mapping_db.export_model()))\nres = mapping_models.M...
<|body_start_0|> hashmap = db_api.get_instance() mapping_list = [] mappings_uuid_list = hashmap.list_mappings(group_uuid=group_id) for mapping_uuid in mappings_uuid_list: mapping_db = hashmap.get_mapping(uuid=mapping_uuid) mapping_list.append(mapping_models.Mappin...
Controller responsible of groups management.
HashMapGroupsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashMapGroupsController: """Controller responsible of groups management.""" def mappings(self, group_id): """Get the mappings attached to the group. :param group_id: UUID of the group to filter on.""" <|body_0|> def thresholds(self, group_id): """Get the threshol...
stack_v2_sparse_classes_10k_train_003756
5,120
permissive
[ { "docstring": "Get the mappings attached to the group. :param group_id: UUID of the group to filter on.", "name": "mappings", "signature": "def mappings(self, group_id)" }, { "docstring": "Get the thresholds attached to the group. :param group_id: UUID of the group to filter on.", "name": "...
6
stack_v2_sparse_classes_30k_train_000951
Implement the Python class `HashMapGroupsController` described below. Class description: Controller responsible of groups management. Method signatures and docstrings: - def mappings(self, group_id): Get the mappings attached to the group. :param group_id: UUID of the group to filter on. - def thresholds(self, group_...
Implement the Python class `HashMapGroupsController` described below. Class description: Controller responsible of groups management. Method signatures and docstrings: - def mappings(self, group_id): Get the mappings attached to the group. :param group_id: UUID of the group to filter on. - def thresholds(self, group_...
94630b97cd1fb4bdd9a638070ffbbe3625de8aa2
<|skeleton|> class HashMapGroupsController: """Controller responsible of groups management.""" def mappings(self, group_id): """Get the mappings attached to the group. :param group_id: UUID of the group to filter on.""" <|body_0|> def thresholds(self, group_id): """Get the threshol...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HashMapGroupsController: """Controller responsible of groups management.""" def mappings(self, group_id): """Get the mappings attached to the group. :param group_id: UUID of the group to filter on.""" hashmap = db_api.get_instance() mapping_list = [] mappings_uuid_list = h...
the_stack_v2_python_sparse
cloudkitty/rating/hash/controllers/group.py
openstack/cloudkitty
train
103
2630f86cc508c9dce99b7ec7a60bb6069a93454e
[ "k = k % len(nums)\nself.reverse(nums, len(nums) - 1, 0)\nself.reverse(nums, len(nums) - 1, k)\nself.reverse(nums, k - 1, 0)\nreturn nums\n'\\n length = len(nums)\\n k = k % length\\n nums[:k], nums[k:] = nums[length-k:], nums[:length-k]\\n '", "while r > l:\n temp = nums[r]\n nu...
<|body_start_0|> k = k % len(nums) self.reverse(nums, len(nums) - 1, 0) self.reverse(nums, len(nums) - 1, k) self.reverse(nums, k - 1, 0) return nums '\n length = len(nums)\n k = k % length\n nums[:k], nums[k:] = nums[length-k:], nums[:length-k]\n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]""" <|body_0|> def reverse(self, nums, r, l): """:type nums: List[int] :type r : int # the rig...
stack_v2_sparse_classes_10k_train_003757
1,084
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]", "name": "rotate", "signature": "def rotate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type r : int # the right cursor of the arra...
2
stack_v2_sparse_classes_30k_train_003284
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4] - def reverse(sel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4] - def reverse(sel...
a6d0e392134afe19d1aed2dfe7914b674e05ecc6
<|skeleton|> class Solution: def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]""" <|body_0|> def reverse(self, nums, r, l): """:type nums: List[int] :type r : int # the rig...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]""" k = k % len(nums) self.reverse(nums, len(nums) - 1, 0) self.reverse(nums, len(nums) - 1, k) s...
the_stack_v2_python_sparse
189RotateArray.py
Ting007/leetcodePractice
train
0
aa99c930579ca7f638c89e522b860159be785208
[ "MOD = int(1000000000.0 + 7)\n\n@lru_cache(None)\ndef rec(i):\n if i >= len(s):\n return 1\n if s[i] == '0':\n return 0\n if s[i] == '*':\n sub1 = 9 * rec(i + 1)\n else:\n sub1 = rec(i + 1)\n sub2 = 0\n if i < len(s) - 1:\n if s[i] == '1':\n sub2 = (9 ...
<|body_start_0|> MOD = int(1000000000.0 + 7) @lru_cache(None) def rec(i): if i >= len(s): return 1 if s[i] == '0': return 0 if s[i] == '*': sub1 = 9 * rec(i + 1) else: sub1 = rec(i + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numDecodings(self, s: str) -> int: """Recursion Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def numDecodings(self, s: str) -> int: """Bottom up Time complexity: O(n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_003758
4,978
no_license
[ { "docstring": "Recursion Time complexity: O(n) Space complexity: O(n)", "name": "numDecodings", "signature": "def numDecodings(self, s: str) -> int" }, { "docstring": "Bottom up Time complexity: O(n) Space complexity: O(1)", "name": "numDecodings", "signature": "def numDecodings(self, s...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDecodings(self, s: str) -> int: Recursion Time complexity: O(n) Space complexity: O(n) - def numDecodings(self, s: str) -> int: Bottom up Time complexity: O(n) Space compl...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDecodings(self, s: str) -> int: Recursion Time complexity: O(n) Space complexity: O(n) - def numDecodings(self, s: str) -> int: Bottom up Time complexity: O(n) Space compl...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def numDecodings(self, s: str) -> int: """Recursion Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def numDecodings(self, s: str) -> int: """Bottom up Time complexity: O(n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numDecodings(self, s: str) -> int: """Recursion Time complexity: O(n) Space complexity: O(n)""" MOD = int(1000000000.0 + 7) @lru_cache(None) def rec(i): if i >= len(s): return 1 if s[i] == '0': return 0 ...
the_stack_v2_python_sparse
leetcode/solved/639_Decode_Ways_II/solution.py
sungminoh/algorithms
train
0
6440171fe35623d249abf8fe8af270cd9eaf469e
[ "if not root:\n self.smallest = None\n return\nself.stack = []\ncurrent = root\nwhile current is not None:\n self.stack.append(current)\n current = current.left\nself.smallest = self.stack[-1]", "if self.smallest is not None:\n return True\nelse:\n return False", "current = self.smallest\nresu...
<|body_start_0|> if not root: self.smallest = None return self.stack = [] current = root while current is not None: self.stack.append(current) current = current.left self.smallest = self.stack[-1] <|end_body_0|> <|body_start_1|> ...
BSTIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_10k_train_003759
2,077
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasNext(self)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" } ]
3
null
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int <|skeleton|> class BSTIterator: def __init__(self, root...
fcf6c3d5d60d13706950247d8a2327adc5faf17e
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BSTIterator: def __init__(self, root): """:type root: TreeNode""" if not root: self.smallest = None return self.stack = [] current = root while current is not None: self.stack.append(current) current = current.left ...
the_stack_v2_python_sparse
Medium/BinarySearchTreeIterator.py
mangalagb/Leetcode
train
0
033eb2fb968ccc450c809a6587941154c2cf3b8f
[ "if len(trust) == 0:\n return 1\nhashmap = dict()\nfor a, b in trust:\n if a not in hashmap:\n hashmap[a] = [1, 0]\n else:\n hashmap[a][0] += 1\n if b not in hashmap:\n hashmap[b] = [0, 1]\n else:\n hashmap[b][1] += 1\nfor p in hashmap:\n if hashmap[p][0] == 0 and hashm...
<|body_start_0|> if len(trust) == 0: return 1 hashmap = dict() for a, b in trust: if a not in hashmap: hashmap[a] = [1, 0] else: hashmap[a][0] += 1 if b not in hashmap: hashmap[b] = [0, 1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findJudge(self, N: int, trust) -> int: """哈希表 :param N: :param list[list[int]] trust: :return:""" <|body_0|> def findJudge2(self, N: int, trust) -> int: """只有是社会名流的入度-出度=N-1 :param N: :param list[list[int]] trust: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k_train_003760
2,379
no_license
[ { "docstring": "哈希表 :param N: :param list[list[int]] trust: :return:", "name": "findJudge", "signature": "def findJudge(self, N: int, trust) -> int" }, { "docstring": "只有是社会名流的入度-出度=N-1 :param N: :param list[list[int]] trust: :return:", "name": "findJudge2", "signature": "def findJudge2(...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findJudge(self, N: int, trust) -> int: 哈希表 :param N: :param list[list[int]] trust: :return: - def findJudge2(self, N: int, trust) -> int: 只有是社会名流的入度-出度=N-1 :param N: :param l...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findJudge(self, N: int, trust) -> int: 哈希表 :param N: :param list[list[int]] trust: :return: - def findJudge2(self, N: int, trust) -> int: 只有是社会名流的入度-出度=N-1 :param N: :param l...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def findJudge(self, N: int, trust) -> int: """哈希表 :param N: :param list[list[int]] trust: :return:""" <|body_0|> def findJudge2(self, N: int, trust) -> int: """只有是社会名流的入度-出度=N-1 :param N: :param list[list[int]] trust: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findJudge(self, N: int, trust) -> int: """哈希表 :param N: :param list[list[int]] trust: :return:""" if len(trust) == 0: return 1 hashmap = dict() for a, b in trust: if a not in hashmap: hashmap[a] = [1, 0] else: ...
the_stack_v2_python_sparse
华为题库/找到小镇法官.py
2226171237/Algorithmpractice
train
0
474494ce13b5e3f8aa507558a741d146df6d4982
[ "urls = super().get_urls()\nnew_urls = [path('upload-csv/', self.upload_csv), path('update_elastic/', ElasticActions.update_elastic), path('export-elastic/', ElasticActions.export_to_elastic)]\nreturn new_urls + urls", "if request.method == 'POST':\n csv_file = request.FILES['importer_un_fichier']\n if not ...
<|body_start_0|> urls = super().get_urls() new_urls = [path('upload-csv/', self.upload_csv), path('update_elastic/', ElasticActions.update_elastic), path('export-elastic/', ElasticActions.export_to_elastic)] return new_urls + urls <|end_body_0|> <|body_start_1|> if request.method == 'PO...
Modèle de l'administration des laboratoires
LaboratoryAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaboratoryAdmin: """Modèle de l'administration des laboratoires""" def get_urls(self): """Initialise les urls du modèle LaboratoryAdmin""" <|body_0|> def upload_csv(request): """Permet de charger un fichier CSV dans la base de données du modèle Laboratory""" ...
stack_v2_sparse_classes_10k_train_003761
12,279
no_license
[ { "docstring": "Initialise les urls du modèle LaboratoryAdmin", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "Permet de charger un fichier CSV dans la base de données du modèle Laboratory", "name": "upload_csv", "signature": "def upload_csv(request)" } ]
2
stack_v2_sparse_classes_30k_train_000774
Implement the Python class `LaboratoryAdmin` described below. Class description: Modèle de l'administration des laboratoires Method signatures and docstrings: - def get_urls(self): Initialise les urls du modèle LaboratoryAdmin - def upload_csv(request): Permet de charger un fichier CSV dans la base de données du modè...
Implement the Python class `LaboratoryAdmin` described below. Class description: Modèle de l'administration des laboratoires Method signatures and docstrings: - def get_urls(self): Initialise les urls du modèle LaboratoryAdmin - def upload_csv(request): Permet de charger un fichier CSV dans la base de données du modè...
0471d2de17597d97f3209099aff3edc72d615fa2
<|skeleton|> class LaboratoryAdmin: """Modèle de l'administration des laboratoires""" def get_urls(self): """Initialise les urls du modèle LaboratoryAdmin""" <|body_0|> def upload_csv(request): """Permet de charger un fichier CSV dans la base de données du modèle Laboratory""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LaboratoryAdmin: """Modèle de l'administration des laboratoires""" def get_urls(self): """Initialise les urls du modèle LaboratoryAdmin""" urls = super().get_urls() new_urls = [path('upload-csv/', self.upload_csv), path('update_elastic/', ElasticActions.update_elastic), path('expo...
the_stack_v2_python_sparse
elasticHal/admin.py
Patent2net/SoVisu
train
1
9f61664d8d4b343d7e687880daf78b9d2bf28696
[ "self.config_entry = entry\nself.client = Elgato(entry.data[CONF_HOST], port=entry.data[CONF_PORT], session=async_get_clientsession(hass))\nsuper().__init__(hass, LOGGER, name=f'{DOMAIN}_{entry.data[CONF_HOST]}', update_interval=SCAN_INTERVAL)", "try:\n if self.has_battery is None:\n self.has_battery = ...
<|body_start_0|> self.config_entry = entry self.client = Elgato(entry.data[CONF_HOST], port=entry.data[CONF_PORT], session=async_get_clientsession(hass)) super().__init__(hass, LOGGER, name=f'{DOMAIN}_{entry.data[CONF_HOST]}', update_interval=SCAN_INTERVAL) <|end_body_0|> <|body_start_1|> ...
Class to manage fetching Elgato data.
ElgatoDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElgatoDataUpdateCoordinator: """Class to manage fetching Elgato data.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize the coordinator.""" <|body_0|> async def _async_update_data(self) -> ElgatoData: """Fetch data from the Elg...
stack_v2_sparse_classes_10k_train_003762
1,971
permissive
[ { "docstring": "Initialize the coordinator.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None" }, { "docstring": "Fetch data from the Elgato device.", "name": "_async_update_data", "signature": "async def _async_update_data(self) -> E...
2
null
Implement the Python class `ElgatoDataUpdateCoordinator` described below. Class description: Class to manage fetching Elgato data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the coordinator. - async def _async_update_data(self) -> ElgatoData: Fe...
Implement the Python class `ElgatoDataUpdateCoordinator` described below. Class description: Class to manage fetching Elgato data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the coordinator. - async def _async_update_data(self) -> ElgatoData: Fe...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ElgatoDataUpdateCoordinator: """Class to manage fetching Elgato data.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize the coordinator.""" <|body_0|> async def _async_update_data(self) -> ElgatoData: """Fetch data from the Elg...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ElgatoDataUpdateCoordinator: """Class to manage fetching Elgato data.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize the coordinator.""" self.config_entry = entry self.client = Elgato(entry.data[CONF_HOST], port=entry.data[CONF_PORT], session...
the_stack_v2_python_sparse
homeassistant/components/elgato/coordinator.py
home-assistant/core
train
35,501
12dcd5f7096e4684a91a188a73df5dbe52febc66
[ "self.name = name\nself.desired_species = desired_species\nself.considered_species = considered_species", "adopter_score = float(adoption_center.get_number_of_species(self.desired_species))\nnum_other = 0\nfor a in self.considered_species:\n num_other += float(adoption_center.get_number_of_species(a))\nreturn ...
<|body_start_0|> self.name = name self.desired_species = desired_species self.considered_species = considered_species <|end_body_0|> <|body_start_1|> adopter_score = float(adoption_center.get_number_of_species(self.desired_species)) num_other = 0 for a in self.considered...
A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of their desired species
FlexibleAdopter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlexibleAdopter: """A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of ...
stack_v2_sparse_classes_10k_train_003763
4,359
no_license
[ { "docstring": "Initializes FlexibleAdopter, a subclass of Adopter object class considered_species - a list of strings of alternative species that the person is interested in adopting. All of the inputs are the same as the Adopter", "name": "__init__", "signature": "def __init__(self, name, desired_spec...
2
stack_v2_sparse_classes_30k_train_006011
Implement the Python class `FlexibleAdopter` described below. Class description: A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be...
Implement the Python class `FlexibleAdopter` described below. Class description: A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be...
d8750a5d78f042477f6577af67cc46d584f4aede
<|skeleton|> class FlexibleAdopter: """A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlexibleAdopter: """A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of their desired...
the_stack_v2_python_sparse
ProblemSets/ProblemSet07c.py
Greatdane/MITx-6.00.1x
train
0
512fa7d7c5fe95444ef6b8b6d2eae9f9aea660cf
[ "assert not kwargs, kwargs\nattributes = AttributesHelper(self, attributes)\nif not attributes.iswildcard:\n warnings.warn(UnsupportedSelectiveCommunitySetConfig, 'IOS-XR does not support selective community-set configuration.')\n attributes = AttributesHelper(self)\nconfigurations = CliConfigBuilder()\nif Fa...
<|body_start_0|> assert not kwargs, kwargs attributes = AttributesHelper(self, attributes) if not attributes.iswildcard: warnings.warn(UnsupportedSelectiveCommunitySetConfig, 'IOS-XR does not support selective community-set configuration.') attributes = AttributesHelper(s...
DeviceAttributes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceAttributes: def build_config(self, apply=True, attributes=None, **kwargs): """IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.""" <|body_0|> def build_unconfig(self...
stack_v2_sparse_classes_10k_train_003764
7,073
permissive
[ { "docstring": "IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.", "name": "build_config", "signature": "def build_config(self, apply=True, attributes=None, **kwargs)" }, { "docstring": "IOS-...
2
null
Implement the Python class `DeviceAttributes` described below. Class description: Implement the DeviceAttributes class. Method signatures and docstrings: - def build_config(self, apply=True, attributes=None, **kwargs): IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The wh...
Implement the Python class `DeviceAttributes` described below. Class description: Implement the DeviceAttributes class. Method signatures and docstrings: - def build_config(self, apply=True, attributes=None, **kwargs): IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The wh...
e42e51475cddcb10f5c7814d0fe892ac865742ba
<|skeleton|> class DeviceAttributes: def build_config(self, apply=True, attributes=None, **kwargs): """IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.""" <|body_0|> def build_unconfig(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeviceAttributes: def build_config(self, apply=True, attributes=None, **kwargs): """IOS-XR CommunitySet configuration. Note: Selective configuration is not supported on IOS-XR; The whole community-set is always removed and re-configured.""" assert not kwargs, kwargs attributes = Attrib...
the_stack_v2_python_sparse
pkgs/conf-pkg/src/genie/libs/conf/community_set/iosxr/community_set.py
CiscoTestAutomation/genielibs
train
109
60db057abca1525edf81897dfc1b3748b2e430a8
[ "List = []\nfor i in range(len(points) - 2):\n for j in range(i + 1, len(points) - 1):\n for k in range(j + 1, len(points)):\n S = self.TriangleArea(points[i], points[j], points[k])\n List.append(S)\nreturn max(List)", "x1, x2, x3 = (A[0], B[0], C[0])\ny1, y2, y3 = (A[1], B[1], C[1...
<|body_start_0|> List = [] for i in range(len(points) - 2): for j in range(i + 1, len(points) - 1): for k in range(j + 1, len(points)): S = self.TriangleArea(points[i], points[j], points[k]) List.append(S) return max(List) <|end...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestTriangleArea(self, points): """:type points: List[List[int]] :rtype: float""" <|body_0|> def TriangleArea(self, A, B, C): """给定三个坐标,求三角形面积""" <|body_1|> <|end_skeleton|> <|body_start_0|> List = [] for i in range(len(poin...
stack_v2_sparse_classes_10k_train_003765
765
no_license
[ { "docstring": ":type points: List[List[int]] :rtype: float", "name": "largestTriangleArea", "signature": "def largestTriangleArea(self, points)" }, { "docstring": "给定三个坐标,求三角形面积", "name": "TriangleArea", "signature": "def TriangleArea(self, A, B, C)" } ]
2
stack_v2_sparse_classes_30k_train_004384
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestTriangleArea(self, points): :type points: List[List[int]] :rtype: float - def TriangleArea(self, A, B, C): 给定三个坐标,求三角形面积
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestTriangleArea(self, points): :type points: List[List[int]] :rtype: float - def TriangleArea(self, A, B, C): 给定三个坐标,求三角形面积 <|skeleton|> class Solution: def largest...
2df5d3b361bc7d25cd3d2afd5ac1c64fbc303920
<|skeleton|> class Solution: def largestTriangleArea(self, points): """:type points: List[List[int]] :rtype: float""" <|body_0|> def TriangleArea(self, A, B, C): """给定三个坐标,求三角形面积""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def largestTriangleArea(self, points): """:type points: List[List[int]] :rtype: float""" List = [] for i in range(len(points) - 2): for j in range(i + 1, len(points) - 1): for k in range(j + 1, len(points)): S = self.TriangleAre...
the_stack_v2_python_sparse
leetcode_812.py
SongJialiJiali/test
train
0
906366a11bed81d12b5fb926bdd1d88de7927e6e
[ "stack, res, multi = ([], '', 0)\nfor c in s:\n if c == '[':\n stack.append([multi, res])\n res, multi = ('', 0)\n elif c == ']':\n cur_multi, last_res = stack.pop()\n res = last_res + cur_multi * res\n elif '0' <= c <= '9':\n multi = multi * 10 + int(c)\n else:\n ...
<|body_start_0|> stack, res, multi = ([], '', 0) for c in s: if c == '[': stack.append([multi, res]) res, multi = ('', 0) elif c == ']': cur_multi, last_res = stack.pop() res = last_res + cur_multi * res ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def decodeString_1(self, s: str) -> str: """解法一:辅助栈法 时间复杂度 O(N),一次遍历 s; 空间复杂度 O(N),辅助栈在极端情况下需要线性空间,例如 2[2[2[a]]]。 :param s: :return:""" <|body_0|> def decodeString_2(self, s: str) -> str: """解法二:递归法 时间复杂度 O(N),递归会更新索引,因此实际上还是一次遍历 s; 空间复杂度 O(N),极端情况下递归深度将会达到...
stack_v2_sparse_classes_10k_train_003766
2,627
permissive
[ { "docstring": "解法一:辅助栈法 时间复杂度 O(N),一次遍历 s; 空间复杂度 O(N),辅助栈在极端情况下需要线性空间,例如 2[2[2[a]]]。 :param s: :return:", "name": "decodeString_1", "signature": "def decodeString_1(self, s: str) -> str" }, { "docstring": "解法二:递归法 时间复杂度 O(N),递归会更新索引,因此实际上还是一次遍历 s; 空间复杂度 O(N),极端情况下递归深度将会达到线性级别。 :param s: :return...
2
stack_v2_sparse_classes_30k_train_001818
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def decodeString_1(self, s: str) -> str: 解法一:辅助栈法 时间复杂度 O(N),一次遍历 s; 空间复杂度 O(N),辅助栈在极端情况下需要线性空间,例如 2[2[2[a]]]。 :param s: :return: - def decodeString_2(self, s: str) -> str: 解法二:递...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def decodeString_1(self, s: str) -> str: 解法一:辅助栈法 时间复杂度 O(N),一次遍历 s; 空间复杂度 O(N),辅助栈在极端情况下需要线性空间,例如 2[2[2[a]]]。 :param s: :return: - def decodeString_2(self, s: str) -> str: 解法二:递...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def decodeString_1(self, s: str) -> str: """解法一:辅助栈法 时间复杂度 O(N),一次遍历 s; 空间复杂度 O(N),辅助栈在极端情况下需要线性空间,例如 2[2[2[a]]]。 :param s: :return:""" <|body_0|> def decodeString_2(self, s: str) -> str: """解法二:递归法 时间复杂度 O(N),递归会更新索引,因此实际上还是一次遍历 s; 空间复杂度 O(N),极端情况下递归深度将会达到...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def decodeString_1(self, s: str) -> str: """解法一:辅助栈法 时间复杂度 O(N),一次遍历 s; 空间复杂度 O(N),辅助栈在极端情况下需要线性空间,例如 2[2[2[a]]]。 :param s: :return:""" stack, res, multi = ([], '', 0) for c in s: if c == '[': stack.append([multi, res]) res, multi =...
the_stack_v2_python_sparse
LeetCode 热题 HOT 100/decodeString.py
MaoningGuan/LeetCode
train
3
79f72871b84abe662d35840e1283341206ecc088
[ "self.acno = int(raw_input('enter accont no : '))\nself.acname = raw_input('enter accont h name : ')\nself.acbal = float(raw_input('enter accont blance : '))", "self.acno = int(raw_input('enter accont no : '))\nself.acname = raw_input('enter accont h name : ')\nself.acbal = float(raw_input('enter accont blance : ...
<|body_start_0|> self.acno = int(raw_input('enter accont no : ')) self.acname = raw_input('enter accont h name : ') self.acbal = float(raw_input('enter accont blance : ')) <|end_body_0|> <|body_start_1|> self.acno = int(raw_input('enter accont no : ')) self.acname = raw_input('e...
to define account class woth account info and operations
account
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account: """to define account class woth account info and operations""" def __init__(self): """to initialise instance variables""" <|body_0|> def setaccountinfo(self): """to initialise account info""" <|body_1|> def getaccountinfo(self): """t...
stack_v2_sparse_classes_10k_train_003767
1,448
no_license
[ { "docstring": "to initialise instance variables", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "to initialise account info", "name": "setaccountinfo", "signature": "def setaccountinfo(self)" }, { "docstring": "to display account detail", "name": "g...
4
stack_v2_sparse_classes_30k_train_006705
Implement the Python class `account` described below. Class description: to define account class woth account info and operations Method signatures and docstrings: - def __init__(self): to initialise instance variables - def setaccountinfo(self): to initialise account info - def getaccountinfo(self): to display accou...
Implement the Python class `account` described below. Class description: to define account class woth account info and operations Method signatures and docstrings: - def __init__(self): to initialise instance variables - def setaccountinfo(self): to initialise account info - def getaccountinfo(self): to display accou...
a2c3cbbfa740dc39944d8a7e4ca0eaad07f44316
<|skeleton|> class account: """to define account class woth account info and operations""" def __init__(self): """to initialise instance variables""" <|body_0|> def setaccountinfo(self): """to initialise account info""" <|body_1|> def getaccountinfo(self): """t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class account: """to define account class woth account info and operations""" def __init__(self): """to initialise instance variables""" self.acno = int(raw_input('enter accont no : ')) self.acname = raw_input('enter accont h name : ') self.acbal = float(raw_input('enter accont ...
the_stack_v2_python_sparse
class/act2.py
kajal241199/PYTraining
train
0
d23879fbb4919967e4d9b07a7b7b2fdcd1cbabe0
[ "local_path = tempfile.mkdtemp()\nmodel.model.save_pretrained(local_path)\nmodel.tokenizer.save_pretrained(local_path)\ndm.fs.copy_dir(local_path, path, force=True, progress=True, leave_progress=False)\nlogger.info(f'Model saved to {path}')\nif clean_up:\n mapper = dm.fs.get_mapper(local_path)\n mapper.fs.del...
<|body_start_0|> local_path = tempfile.mkdtemp() model.model.save_pretrained(local_path) model.tokenizer.save_pretrained(local_path) dm.fs.copy_dir(local_path, path, force=True, progress=True, leave_progress=False) logger.info(f'Model saved to {path}') if clean_up: ...
HFExperiment
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HFExperiment: def save(cls, model: HFExperiment, path: str, clean_up: bool=False): """Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving""" <|body_...
stack_v2_sparse_classes_10k_train_003768
16,347
permissive
[ { "docstring": "Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving", "name": "save", "signature": "def save(cls, model: HFExperiment, path: str, clean_up: bool=False)" }...
2
stack_v2_sparse_classes_30k_train_005130
Implement the Python class `HFExperiment` described below. Class description: Implement the HFExperiment class. Method signatures and docstrings: - def save(cls, model: HFExperiment, path: str, clean_up: bool=False): Save a hugging face model to a specific path Args: model: model to save path: path to the folder root...
Implement the Python class `HFExperiment` described below. Class description: Implement the HFExperiment class. Method signatures and docstrings: - def save(cls, model: HFExperiment, path: str, clean_up: bool=False): Save a hugging face model to a specific path Args: model: model to save path: path to the folder root...
4390f9fce25fa2da94338227f7c8f33a23e25b2a
<|skeleton|> class HFExperiment: def save(cls, model: HFExperiment, path: str, clean_up: bool=False): """Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving""" <|body_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HFExperiment: def save(cls, model: HFExperiment, path: str, clean_up: bool=False): """Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving""" local_path = tempfile...
the_stack_v2_python_sparse
molfeat/trans/pretrained/hf_transformers.py
datamol-io/molfeat
train
111
143c8b8581b31f024b472ad9bb6ae7f3d8cf07bf
[ "evaluator = SemanticSimilarity(2, 'FREQ')\noutput = evaluator.dist_to_string(self.test_word_pairs)\nself.assertCountEqual(output.strip().split('\\n'), self.expected_similarities)", "evaluator = SemanticSimilarity(2, 'PMI')\noutput = evaluator.dist_to_string(self.test_word_pairs)\nself.assertCountEqual(output.str...
<|body_start_0|> evaluator = SemanticSimilarity(2, 'FREQ') output = evaluator.dist_to_string(self.test_word_pairs) self.assertCountEqual(output.strip().split('\n'), self.expected_similarities) <|end_body_0|> <|body_start_1|> evaluator = SemanticSimilarity(2, 'PMI') output = eval...
This class contains tests for the SemanticSimilarity class
TestSemanticSimilarity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSemanticSimilarity: """This class contains tests for the SemanticSimilarity class""" def test_freq(self): """Test frequency distribution :return: void""" <|body_0|> def test_pmi(self): """Test point-wise mutual information distribution :return: void""" ...
stack_v2_sparse_classes_10k_train_003769
7,621
no_license
[ { "docstring": "Test frequency distribution :return: void", "name": "test_freq", "signature": "def test_freq(self)" }, { "docstring": "Test point-wise mutual information distribution :return: void", "name": "test_pmi", "signature": "def test_pmi(self)" }, { "docstring": "Test con...
3
stack_v2_sparse_classes_30k_train_001941
Implement the Python class `TestSemanticSimilarity` described below. Class description: This class contains tests for the SemanticSimilarity class Method signatures and docstrings: - def test_freq(self): Test frequency distribution :return: void - def test_pmi(self): Test point-wise mutual information distribution :r...
Implement the Python class `TestSemanticSimilarity` described below. Class description: This class contains tests for the SemanticSimilarity class Method signatures and docstrings: - def test_freq(self): Test frequency distribution :return: void - def test_pmi(self): Test point-wise mutual information distribution :r...
7af7b357347ed526de7a3d6f16652843d214dcbf
<|skeleton|> class TestSemanticSimilarity: """This class contains tests for the SemanticSimilarity class""" def test_freq(self): """Test frequency distribution :return: void""" <|body_0|> def test_pmi(self): """Test point-wise mutual information distribution :return: void""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSemanticSimilarity: """This class contains tests for the SemanticSimilarity class""" def test_freq(self): """Test frequency distribution :return: void""" evaluator = SemanticSimilarity(2, 'FREQ') output = evaluator.dist_to_string(self.test_word_pairs) self.assertCountE...
the_stack_v2_python_sparse
SemanticSimilarity/sem_sim.py
zoew2/Projects
train
0
8d20f4a9c275b515ac04961662973dfb7330ef37
[ "store = StoreModel.query.filter_by(id=store_id).first()\nif not store:\n store_api.abort(404, \"Store {} doesn't exist\".format(store_id))\nelse:\n return store", "store = StoreModel.query.filter_by(id=store_id).first()\nif not store:\n store_api.abort(404, 'Store {} not found'.format(store_id))\nstore....
<|body_start_0|> store = StoreModel.query.filter_by(id=store_id).first() if not store: store_api.abort(404, "Store {} doesn't exist".format(store_id)) else: return store <|end_body_0|> <|body_start_1|> store = StoreModel.query.filter_by(id=store_id).first() ...
Store
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Store: def get(self, store_id): """Get a store given its identifier""" <|body_0|> def delete(self, store_id): """Delete a store given its identifier""" <|body_1|> <|end_skeleton|> <|body_start_0|> store = StoreModel.query.filter_by(id=store_id).firs...
stack_v2_sparse_classes_10k_train_003770
4,193
no_license
[ { "docstring": "Get a store given its identifier", "name": "get", "signature": "def get(self, store_id)" }, { "docstring": "Delete a store given its identifier", "name": "delete", "signature": "def delete(self, store_id)" } ]
2
stack_v2_sparse_classes_30k_train_000540
Implement the Python class `Store` described below. Class description: Implement the Store class. Method signatures and docstrings: - def get(self, store_id): Get a store given its identifier - def delete(self, store_id): Delete a store given its identifier
Implement the Python class `Store` described below. Class description: Implement the Store class. Method signatures and docstrings: - def get(self, store_id): Get a store given its identifier - def delete(self, store_id): Delete a store given its identifier <|skeleton|> class Store: def get(self, store_id): ...
f380164e92b70874042364ad4b5b20c5793d6921
<|skeleton|> class Store: def get(self, store_id): """Get a store given its identifier""" <|body_0|> def delete(self, store_id): """Delete a store given its identifier""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Store: def get(self, store_id): """Get a store given its identifier""" store = StoreModel.query.filter_by(id=store_id).first() if not store: store_api.abort(404, "Store {} doesn't exist".format(store_id)) else: return store def delete(self, store_id...
the_stack_v2_python_sparse
project/app/main/controllers/store.py
ArielVilleda/docker-flask-postgres
train
0
44e8df121e660a6ff82b3470bc3f1e53cdd35dc4
[ "self.xhat = x_init\nself.xhatd = x_dinit\nself.alpha = alpha\nself.beta = beta\nself.prev_time = 0.0", "y = self.xhatd + self.alpha * (zk - self.xhat - self.xhatd)\nyd = self.beta * (y - self.xhatd)\nself.xhat = self.xhat + y\nself.xhatd = self.xhatd + yd\nreturn (self.xhat, self.xhatd)" ]
<|body_start_0|> self.xhat = x_init self.xhatd = x_dinit self.alpha = alpha self.beta = beta self.prev_time = 0.0 <|end_body_0|> <|body_start_1|> y = self.xhatd + self.alpha * (zk - self.xhat - self.xhatd) yd = self.beta * (y - self.xhatd) self.xhat = sel...
@brief Exponentially weighted moving average
Ewma
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ewma: """@brief Exponentially weighted moving average""" def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): """@brief initialise Ewma filter for single data point @param x_init initial guess""" <|body_0|> def filter(self, zk, t): """@brief filter f...
stack_v2_sparse_classes_10k_train_003771
1,929
no_license
[ { "docstring": "@brief initialise Ewma filter for single data point @param x_init initial guess", "name": "__init__", "signature": "def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1)" }, { "docstring": "@brief filter for one time step @param zk sensor value @param t time that measu...
2
stack_v2_sparse_classes_30k_train_002217
Implement the Python class `Ewma` described below. Class description: @brief Exponentially weighted moving average Method signatures and docstrings: - def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): @brief initialise Ewma filter for single data point @param x_init initial guess - def filter(self, zk...
Implement the Python class `Ewma` described below. Class description: @brief Exponentially weighted moving average Method signatures and docstrings: - def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): @brief initialise Ewma filter for single data point @param x_init initial guess - def filter(self, zk...
791692cc8a158446c0702f006890820c2019f668
<|skeleton|> class Ewma: """@brief Exponentially weighted moving average""" def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): """@brief initialise Ewma filter for single data point @param x_init initial guess""" <|body_0|> def filter(self, zk, t): """@brief filter f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ewma: """@brief Exponentially weighted moving average""" def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): """@brief initialise Ewma filter for single data point @param x_init initial guess""" self.xhat = x_init self.xhatd = x_dinit self.alpha = alpha ...
the_stack_v2_python_sparse
tos/Node/Filters/DEWMA/python/dewma.py
jbrusey/cogent-house
train
4
86606bc769437f84b37de8eb1be2a52e0111826a
[ "for key in indicts:\n if not key.startswith('text search dictionary '):\n raise KeyError('Unrecognized object type: %s' % key)\n tsd = key[23:]\n self[schema.name, tsd] = tsdict = TSDictionary(schema=schema.name, name=tsd)\n indict = indicts[key]\n if indict:\n for attr, val in list(in...
<|body_start_0|> for key in indicts: if not key.startswith('text search dictionary '): raise KeyError('Unrecognized object type: %s' % key) tsd = key[23:] self[schema.name, tsd] = tsdict = TSDictionary(schema=schema.name, name=tsd) indict = indicts...
The collection of text search dictionaries in a database
TSDictionaryDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSDictionaryDict: """The collection of text search dictionaries in a database""" def from_map(self, schema, indicts): """Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dict...
stack_v2_sparse_classes_10k_train_003772
15,925
permissive
[ { "docstring": "Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dictionaries", "name": "from_map", "signature": "def from_map(self, schema, indicts)" }, { "docstring": "Generate SQL to ...
2
stack_v2_sparse_classes_30k_train_002795
Implement the Python class `TSDictionaryDict` described below. Class description: The collection of text search dictionaries in a database Method signatures and docstrings: - def from_map(self, schema, indicts): Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dict...
Implement the Python class `TSDictionaryDict` described below. Class description: The collection of text search dictionaries in a database Method signatures and docstrings: - def from_map(self, schema, indicts): Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dict...
0133f3bc522890e0564d27de6791824acb4d2773
<|skeleton|> class TSDictionaryDict: """The collection of text search dictionaries in a database""" def from_map(self, schema, indicts): """Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dict...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TSDictionaryDict: """The collection of text search dictionaries in a database""" def from_map(self, schema, indicts): """Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dictionaries""" ...
the_stack_v2_python_sparse
pyrseas/dbobject/textsearch.py
vayerx/Pyrseas
train
1
5f45935372d3cb33d0e21d88a390bcc90e986189
[ "super(Yolo_net, self).__init__()\nself.in_ch = in_ch\nself.anchors = anchors\nself.num_anchors = len(anchors)\nself.num_classes = num_classes\nself.img_dim = img_dim\nself.batch_norm = batch_norm\nself.darknet = Darknet(in_ch)\nindex = self.darknet.first_index + 1\nself.out_net1 = DarknetConvBlock(512, self.num_an...
<|body_start_0|> super(Yolo_net, self).__init__() self.in_ch = in_ch self.anchors = anchors self.num_anchors = len(anchors) self.num_classes = num_classes self.img_dim = img_dim self.batch_norm = batch_norm self.darknet = Darknet(in_ch) index = sel...
Yolo network
Yolo_net
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Yolo_net: """Yolo network""" def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True): """Constructor""" <|body_0|> def forward(self, x, targets=None): """Foward method""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k_train_003773
28,014
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True)" }, { "docstring": "Foward method", "name": "forward", "signature": "def forward(self, x, targets=None)" }...
2
stack_v2_sparse_classes_30k_train_004737
Implement the Python class `Yolo_net` described below. Class description: Yolo network Method signatures and docstrings: - def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True): Constructor - def forward(self, x, targets=None): Foward method
Implement the Python class `Yolo_net` described below. Class description: Yolo network Method signatures and docstrings: - def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True): Constructor - def forward(self, x, targets=None): Foward method <|skeleton|> ...
69edb5ecd569395086cf610df9c8aa345284259a
<|skeleton|> class Yolo_net: """Yolo network""" def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True): """Constructor""" <|body_0|> def forward(self, x, targets=None): """Foward method""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Yolo_net: """Yolo network""" def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True): """Constructor""" super(Yolo_net, self).__init__() self.in_ch = in_ch self.anchors = anchors self.num_anchors = len(anc...
the_stack_v2_python_sparse
python/models/modules.py
dswanderley/detntorch
train
2
36ccda21eaa2d7ed27da4f0d666ca2af786b5327
[ "log.info('Initialize the benchmark-operator object')\nself.args = kwargs\nself.repo = self.args.get('repo', BMO_REPO)\nself.branch = self.args.get('branch', 'master')\nself.namespace = BMO_NAME\nself.pgsql_is_setup = False\nself.ocp = OCP()\nself.ns_obj = OCP(kind='namespace')\nself.pod_obj = OCP(namespace=BMO_NAM...
<|body_start_0|> log.info('Initialize the benchmark-operator object') self.args = kwargs self.repo = self.args.get('repo', BMO_REPO) self.branch = self.args.get('branch', 'master') self.namespace = BMO_NAME self.pgsql_is_setup = False self.ocp = OCP() self...
Workload operation using Benchmark-Operator
BenchmarkOperator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BenchmarkOperator: """Workload operation using Benchmark-Operator""" def __init__(self, **kwargs): """Initializer function. Initialize object variables, clone the benchmark operator repo. and label the worker nodes. Args: kwargs (dict): Following kwargs are valid repo: benchmark-oper...
stack_v2_sparse_classes_10k_train_003774
7,656
permissive
[ { "docstring": "Initializer function. Initialize object variables, clone the benchmark operator repo. and label the worker nodes. Args: kwargs (dict): Following kwargs are valid repo: benchmark-operator repo to used - a github link branch: branch to use from the repo Example Usage: r1 = BenchmarkOperator() r1.d...
6
null
Implement the Python class `BenchmarkOperator` described below. Class description: Workload operation using Benchmark-Operator Method signatures and docstrings: - def __init__(self, **kwargs): Initializer function. Initialize object variables, clone the benchmark operator repo. and label the worker nodes. Args: kwarg...
Implement the Python class `BenchmarkOperator` described below. Class description: Workload operation using Benchmark-Operator Method signatures and docstrings: - def __init__(self, **kwargs): Initializer function. Initialize object variables, clone the benchmark operator repo. and label the worker nodes. Args: kwarg...
5e9e504957403148e413326f65c3769bf9d8eb39
<|skeleton|> class BenchmarkOperator: """Workload operation using Benchmark-Operator""" def __init__(self, **kwargs): """Initializer function. Initialize object variables, clone the benchmark operator repo. and label the worker nodes. Args: kwargs (dict): Following kwargs are valid repo: benchmark-oper...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BenchmarkOperator: """Workload operation using Benchmark-Operator""" def __init__(self, **kwargs): """Initializer function. Initialize object variables, clone the benchmark operator repo. and label the worker nodes. Args: kwargs (dict): Following kwargs are valid repo: benchmark-operator repo to ...
the_stack_v2_python_sparse
ocs_ci/ocs/benchmark_operator.py
red-hat-storage/ocs-ci
train
146
c77535cad3921adab29478d554b0df1ec3998a2d
[ "super().__init__(DOMAIN)\nself.hass: HomeAssistant = hass\nself.client: XboxLiveClient = client", "_, category, url = async_parse_identifier(item)\nkind = category.split('#', 1)[1]\nreturn PlayMedia(url, MIME_TYPE_MAP[kind])", "title, category, _ = async_parse_identifier(item)\nif not title:\n return await ...
<|body_start_0|> super().__init__(DOMAIN) self.hass: HomeAssistant = hass self.client: XboxLiveClient = client <|end_body_0|> <|body_start_1|> _, category, url = async_parse_identifier(item) kind = category.split('#', 1)[1] return PlayMedia(url, MIME_TYPE_MAP[kind]) <|en...
Provide Xbox screenshots and gameclips as media sources.
XboxSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XboxSource: """Provide Xbox screenshots and gameclips as media sources.""" def __init__(self, hass: HomeAssistant, client: XboxLiveClient) -> None: """Initialize Xbox source.""" <|body_0|> async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia: "...
stack_v2_sparse_classes_10k_train_003775
9,043
permissive
[ { "docstring": "Initialize Xbox source.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, client: XboxLiveClient) -> None" }, { "docstring": "Resolve media to a url.", "name": "async_resolve_media", "signature": "async def async_resolve_media(self, item: MediaSo...
5
null
Implement the Python class `XboxSource` described below. Class description: Provide Xbox screenshots and gameclips as media sources. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, client: XboxLiveClient) -> None: Initialize Xbox source. - async def async_resolve_media(self, item: MediaSou...
Implement the Python class `XboxSource` described below. Class description: Provide Xbox screenshots and gameclips as media sources. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, client: XboxLiveClient) -> None: Initialize Xbox source. - async def async_resolve_media(self, item: MediaSou...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class XboxSource: """Provide Xbox screenshots and gameclips as media sources.""" def __init__(self, hass: HomeAssistant, client: XboxLiveClient) -> None: """Initialize Xbox source.""" <|body_0|> async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia: "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class XboxSource: """Provide Xbox screenshots and gameclips as media sources.""" def __init__(self, hass: HomeAssistant, client: XboxLiveClient) -> None: """Initialize Xbox source.""" super().__init__(DOMAIN) self.hass: HomeAssistant = hass self.client: XboxLiveClient = client ...
the_stack_v2_python_sparse
homeassistant/components/xbox/media_source.py
home-assistant/core
train
35,501
a7a709e0f0bd6f3b2c007b79f6dc5f872caa74b3
[ "if not matrix or not matrix[0]:\n self.rmq = None\nelse:\n self.rmq = [[0] * (len(matrix[0]) + 1)] + [[0] + matrix[r] for r in range(len(matrix))]\n for row in range(1, len(matrix) + 1):\n for col in range(1, len(matrix[0]) + 1):\n self.rmq[row][col] += self.rmq[row][col - 1]\n for co...
<|body_start_0|> if not matrix or not matrix[0]: self.rmq = None else: self.rmq = [[0] * (len(matrix[0]) + 1)] + [[0] + matrix[r] for r in range(len(matrix))] for row in range(1, len(matrix) + 1): for col in range(1, len(matrix[0]) + 1): ...
NumMatrix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_003776
1,226
permissive
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
ba84c192fb9995dd48ddc6d81c3153488dd3c698
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if not matrix or not matrix[0]: self.rmq = None else: self.rmq = [[0] * (len(matrix[0]) + 1)] + [[0] + matrix[r] for r in range(len(matrix))] for row in range(1, len(matrix) +...
the_stack_v2_python_sparse
Python/range-sum-query-2d-immutable.py
phucle2411/LeetCode
train
0
5e2bb67efc64eb2b17155acec0568ff8558c3e12
[ "guides = deepcopy(manager.all())\nseen_ids = set(AssistantActivity.objects.filter(user=request.user).values_list('guide_id', flat=True))\nfor _key, v in guides.items():\n v['seen'] = v['id'] in seen_ids\nreturn Response(guides)", "serializer = AssistantSerializer(data=request.data, partial=True)\nif not seria...
<|body_start_0|> guides = deepcopy(manager.all()) seen_ids = set(AssistantActivity.objects.filter(user=request.user).values_list('guide_id', flat=True)) for _key, v in guides.items(): v['seen'] = v['id'] in seen_ids return Response(guides) <|end_body_0|> <|body_start_1|> ...
AssistantEndpoint
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssistantEndpoint: def get(self, request): """Return all the guides with a 'seen' attribute if it has been 'viewed' or 'dismissed'.""" <|body_0|> def put(self, request): """Mark a guide as viewed or dismissed. Request is of the form { 'guide_id': <guide_id>, 'status'...
stack_v2_sparse_classes_10k_train_003777
2,689
permissive
[ { "docstring": "Return all the guides with a 'seen' attribute if it has been 'viewed' or 'dismissed'.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Mark a guide as viewed or dismissed. Request is of the form { 'guide_id': <guide_id>, 'status': 'viewed' / 'dismissed', ...
2
stack_v2_sparse_classes_30k_train_002132
Implement the Python class `AssistantEndpoint` described below. Class description: Implement the AssistantEndpoint class. Method signatures and docstrings: - def get(self, request): Return all the guides with a 'seen' attribute if it has been 'viewed' or 'dismissed'. - def put(self, request): Mark a guide as viewed o...
Implement the Python class `AssistantEndpoint` described below. Class description: Implement the AssistantEndpoint class. Method signatures and docstrings: - def get(self, request): Return all the guides with a 'seen' attribute if it has been 'viewed' or 'dismissed'. - def put(self, request): Mark a guide as viewed o...
36a02ed244c7b59ee1f2523e64e4749e404ab0f7
<|skeleton|> class AssistantEndpoint: def get(self, request): """Return all the guides with a 'seen' attribute if it has been 'viewed' or 'dismissed'.""" <|body_0|> def put(self, request): """Mark a guide as viewed or dismissed. Request is of the form { 'guide_id': <guide_id>, 'status'...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AssistantEndpoint: def get(self, request): """Return all the guides with a 'seen' attribute if it has been 'viewed' or 'dismissed'.""" guides = deepcopy(manager.all()) seen_ids = set(AssistantActivity.objects.filter(user=request.user).values_list('guide_id', flat=True)) for _ke...
the_stack_v2_python_sparse
src/sentry/api/endpoints/assistant.py
commonlims/commonlims
train
4
286ec5fbbed7a877cc04dff967dff3bc804d7a71
[ "super(self.__class__, self).__init__()\nself.hash = hash_f\nself.key_len = key_len\nself.key = ''\nself.key_gen = key_gen", "if self.key_gen is None:\n self.key = random_string(self.key_len)\nelse:\n self.key = self.key_gen()\nreturn self.key", "x1, x2 = x\nif x1 == x2 or self.hash(self.key, x1) == None:...
<|body_start_0|> super(self.__class__, self).__init__() self.hash = hash_f self.key_len = key_len self.key = '' self.key_gen = key_gen <|end_body_0|> <|body_start_1|> if self.key_gen is None: self.key = random_string(self.key_len) else: se...
This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.
GameCR
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameCR: """This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.""" def __init__(self, hash_f, key_len, key_gen=None): """:param hash_f: T...
stack_v2_sparse_classes_10k_train_003778
1,745
no_license
[ { "docstring": ":param hash_f: This is the hash function that the adversary is playing against. It must take two parameters, a key of length key_len and a message. :param key_len: Length of key used by hash function.", "name": "__init__", "signature": "def __init__(self, hash_f, key_len, key_gen=None)" ...
3
stack_v2_sparse_classes_30k_train_000836
Implement the Python class `GameCR` described below. Class description: This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function. Method signatures and docstrings: - def __init...
Implement the Python class `GameCR` described below. Class description: This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function. Method signatures and docstrings: - def __init...
9014f5a9bf7021bef9f5cc4aa5b16424ca83dee9
<|skeleton|> class GameCR: """This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.""" def __init__(self, hash_f, key_len, key_gen=None): """:param hash_f: T...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GameCR: """This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.""" def __init__(self, hash_f, key_len, key_gen=None): """:param hash_f: This is the ha...
the_stack_v2_python_sparse
src/playcrypt/games/game_cr.py
UCSDCSE107/playcrypt
train
2
43605a863d914c979c17b5a9d8673c12532194af
[ "self.A = A\nself.i = 0\nself.q = 0", "while self.i < len(self.A):\n if self.q + n > self.A[self.i]:\n n -= self.A[self.i] - self.q\n self.q = 0\n self.i += 2\n else:\n self.q += n\n return self.A[self.i + 1]\nreturn -1" ]
<|body_start_0|> self.A = A self.i = 0 self.q = 0 <|end_body_0|> <|body_start_1|> while self.i < len(self.A): if self.q + n > self.A[self.i]: n -= self.A[self.i] - self.q self.q = 0 self.i += 2 else: ...
RLEIterator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.A = A self.i = 0 self.q = 0 <|end_body_0|> <|body_start_1|> ...
stack_v2_sparse_classes_10k_train_003779
4,011
permissive
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
null
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
0ba027d9b8bc7c80bc89ce2da3543ce7a49a403c
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RLEIterator: def __init__(self, A): """:type A: List[int]""" self.A = A self.i = 0 self.q = 0 def next(self, n): """:type n: int :rtype: int""" while self.i < len(self.A): if self.q + n > self.A[self.i]: n -= self.A[self.i] - sel...
the_stack_v2_python_sparse
cs15211/RLEIterator.py
JulyKikuAkita/PythonPrac
train
1
85f47f0d3e6a9c0418d427d00de354e8fc2f4223
[ "self.plugin._regrid_and_populate(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube)\nplugin_cubes = [self.plugin.temperature, self.plugin.humidity, self.plugin.pressure, self.plugin.uwind, self.plugin.vwind, self.plugin.topography]\nfor cube in plugin_cubes:\n self.asse...
<|body_start_0|> self.plugin._regrid_and_populate(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube) plugin_cubes = [self.plugin.temperature, self.plugin.humidity, self.plugin.pressure, self.plugin.uwind, self.plugin.vwind, self.plugin.topography] for cu...
Test the _regrid_and_populate method
Test__regrid_and_populate
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__regrid_and_populate: """Test the _regrid_and_populate method""" def test_basic(self): """Test function populates class instance""" <|body_0|> def test_variables(self): """Test variable values are sensible""" <|body_1|> def test_vgradz(self): ...
stack_v2_sparse_classes_10k_train_003780
34,979
permissive
[ { "docstring": "Test function populates class instance", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test variable values are sensible", "name": "test_variables", "signature": "def test_variables(self)" }, { "docstring": "Test values of vgradz are...
3
null
Implement the Python class `Test__regrid_and_populate` described below. Class description: Test the _regrid_and_populate method Method signatures and docstrings: - def test_basic(self): Test function populates class instance - def test_variables(self): Test variable values are sensible - def test_vgradz(self): Test v...
Implement the Python class `Test__regrid_and_populate` described below. Class description: Test the _regrid_and_populate method Method signatures and docstrings: - def test_basic(self): Test function populates class instance - def test_variables(self): Test variable values are sensible - def test_vgradz(self): Test v...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__regrid_and_populate: """Test the _regrid_and_populate method""" def test_basic(self): """Test function populates class instance""" <|body_0|> def test_variables(self): """Test variable values are sensible""" <|body_1|> def test_vgradz(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test__regrid_and_populate: """Test the _regrid_and_populate method""" def test_basic(self): """Test function populates class instance""" self.plugin._regrid_and_populate(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube) plugin_cubes = [se...
the_stack_v2_python_sparse
improver_tests/orographic_enhancement/test_OrographicEnhancement.py
metoppv/improver
train
101
82171a6c0a78b947813eab1a9dd5b4b71882e704
[ "tailA = headA\nwhile tailA.next:\n tailA = tailA.next\ntailA.next = headB\nfast, slow = (headA.next.next, headA.next)\nwhile fast and fast.next and (fast != slow):\n fast = fast.next.next\n slow = slow.next\nif not fast or not fast.next:\n tailA.next = None\n return None\nfast = headA\nwhile fast !=...
<|body_start_0|> tailA = headA while tailA.next: tailA = tailA.next tailA.next = headB fast, slow = (headA.next.next, headA.next) while fast and fast.next and (fast != slow): fast = fast.next.next slow = slow.next if not fast or not fas...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode2(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: """AC: 06/06/2022 Runtime: 213 ms, faster than 48.04% Memory Usage: 29.5 MB, less than 69.35% :param headA: :param headB: The number of nodes of listA is in the m. The number of nodes of lis...
stack_v2_sparse_classes_10k_train_003781
2,970
permissive
[ { "docstring": "AC: 06/06/2022 Runtime: 213 ms, faster than 48.04% Memory Usage: 29.5 MB, less than 69.35% :param headA: :param headB: The number of nodes of listA is in the m. The number of nodes of listB is in the n. 1 <= m, n <= 3 * 10^4 1 <= Node.val <= 10^5 0 <= skipA < m 0 <= skipB < n intersectVal is 0 i...
2
stack_v2_sparse_classes_30k_train_002032
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode2(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: AC: 06/06/2022 Runtime: 213 ms, faster than 48.04% Memory Usage: 29.5 MB, less than 69.35%...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode2(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: AC: 06/06/2022 Runtime: 213 ms, faster than 48.04% Memory Usage: 29.5 MB, less than 69.35%...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def getIntersectionNode2(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: """AC: 06/06/2022 Runtime: 213 ms, faster than 48.04% Memory Usage: 29.5 MB, less than 69.35% :param headA: :param headB: The number of nodes of listA is in the m. The number of nodes of lis...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def getIntersectionNode2(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: """AC: 06/06/2022 Runtime: 213 ms, faster than 48.04% Memory Usage: 29.5 MB, less than 69.35% :param headA: :param headB: The number of nodes of listA is in the m. The number of nodes of listB is in the n...
the_stack_v2_python_sparse
src/160-IntersectionofTwoLinkedLists.py
Jiezhi/myleetcode
train
1
ebb951a27fb23440b35705131762458a37fbc329
[ "self._interval = datetime.timedelta(seconds=interval)\nself._callback = callback\nself._next_run = None\nself.last_success = None\nself.last_attempt = None\nself.retries = 0", "if self.retries == 0:\n interval = self._interval\nelse:\n backoff_secs = 2 ** self.retries * 60\n interval = datetime.timedelt...
<|body_start_0|> self._interval = datetime.timedelta(seconds=interval) self._callback = callback self._next_run = None self.last_success = None self.last_attempt = None self.retries = 0 <|end_body_0|> <|body_start_1|> if self.retries == 0: interval = ...
Throttle_Mixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Throttle_Mixin: def every(self, interval, callback): """Limit the update to a certain number of seconds.""" <|body_0|> def _schedule_next_run(self): """Determine when to run next time""" <|body_1|> def success(self): """Update success variables""...
stack_v2_sparse_classes_10k_train_003782
2,088
permissive
[ { "docstring": "Limit the update to a certain number of seconds.", "name": "every", "signature": "def every(self, interval, callback)" }, { "docstring": "Determine when to run next time", "name": "_schedule_next_run", "signature": "def _schedule_next_run(self)" }, { "docstring": ...
6
stack_v2_sparse_classes_30k_train_004296
Implement the Python class `Throttle_Mixin` described below. Class description: Implement the Throttle_Mixin class. Method signatures and docstrings: - def every(self, interval, callback): Limit the update to a certain number of seconds. - def _schedule_next_run(self): Determine when to run next time - def success(se...
Implement the Python class `Throttle_Mixin` described below. Class description: Implement the Throttle_Mixin class. Method signatures and docstrings: - def every(self, interval, callback): Limit the update to a certain number of seconds. - def _schedule_next_run(self): Determine when to run next time - def success(se...
3a54de98ab107cf1266404400c7eb576007c8b17
<|skeleton|> class Throttle_Mixin: def every(self, interval, callback): """Limit the update to a certain number of seconds.""" <|body_0|> def _schedule_next_run(self): """Determine when to run next time""" <|body_1|> def success(self): """Update success variables""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Throttle_Mixin: def every(self, interval, callback): """Limit the update to a certain number of seconds.""" self._interval = datetime.timedelta(seconds=interval) self._callback = callback self._next_run = None self.last_success = None self.last_attempt = None ...
the_stack_v2_python_sparse
ledmatrix/data/utils/throttle_mixin.py
mattgrogan/ledmatrix
train
1
5d755d25a57408a713ea354bad709ec6e61f0c12
[ "super(Discriminator, self).__init__()\nself.conv_dim = conv_dim\nself.conv1 = conv(3, conv_dim, 4, batch_norm=False)\nself.conv2 = conv(conv_dim, conv_dim * 2, 4)\nself.conv3 = conv(conv_dim * 2, conv_dim * 4, 4)\nself.fc = nn.Linear(conv_dim * 4 * 4 * 4, 1)", "x = F.leaky_relu(self.conv1(x), 0.2)\nx = F.leaky_r...
<|body_start_0|> super(Discriminator, self).__init__() self.conv_dim = conv_dim self.conv1 = conv(3, conv_dim, 4, batch_norm=False) self.conv2 = conv(conv_dim, conv_dim * 2, 4) self.conv3 = conv(conv_dim * 2, conv_dim * 4, 4) self.fc = nn.Linear(conv_dim * 4 * 4 * 4, 1) <...
Discriminator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" <|body_0|> def forward(self, x): """Forward propagation of the neural network :param x: The input to the neural netwo...
stack_v2_sparse_classes_10k_train_003783
12,896
permissive
[ { "docstring": "Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer", "name": "__init__", "signature": "def __init__(self, conv_dim=32)" }, { "docstring": "Forward propagation of the neural network :param x: The input to the neural network :return: Dis...
2
stack_v2_sparse_classes_30k_train_004585
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, conv_dim=32): Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer - def forward(self, x): Forward propaga...
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, conv_dim=32): Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer - def forward(self, x): Forward propaga...
b9b54564f94aadfc3c71ff513da0f05ef85d22a8
<|skeleton|> class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" <|body_0|> def forward(self, x): """Forward propagation of the neural network :param x: The input to the neural netwo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" super(Discriminator, self).__init__() self.conv_dim = conv_dim self.conv1 = conv(3, conv_dim, 4, batch_norm=False) self....
the_stack_v2_python_sparse
dl/pytorch/gan/face_gan.py
xta0/Python-Playground
train
0
36f4eddd7c3ffbb7af96c4c5fde322ae25efe9f7
[ "super().__init__(add_help=False, **kwargs)\nif config_options:\n self.add_argument('-c', '--show-config', action='store_true', default=False, dest='show_config', help='Show the configuration parameters.')\n self.add_argument('-a', '--attributes-level', default=0, type=int, dest='attributes_level', help='Set ...
<|body_start_0|> super().__init__(add_help=False, **kwargs) if config_options: self.add_argument('-c', '--show-config', action='store_true', default=False, dest='show_config', help='Show the configuration parameters.') self.add_argument('-a', '--attributes-level', default=0, type...
The base class for the option parser.
ArgumentParserBase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgumentParserBase: """The base class for the option parser.""" def __init__(self, config_options=False, sort_options=False, **kwargs): """Initialise the class. :param config_options: True/False show configuration options :param sort_options: True/False show argument sorting options"...
stack_v2_sparse_classes_10k_train_003784
39,454
permissive
[ { "docstring": "Initialise the class. :param config_options: True/False show configuration options :param sort_options: True/False show argument sorting options", "name": "__init__", "signature": "def __init__(self, config_options=False, sort_options=False, **kwargs)" }, { "docstring": "Parse th...
3
null
Implement the Python class `ArgumentParserBase` described below. Class description: The base class for the option parser. Method signatures and docstrings: - def __init__(self, config_options=False, sort_options=False, **kwargs): Initialise the class. :param config_options: True/False show configuration options :para...
Implement the Python class `ArgumentParserBase` described below. Class description: The base class for the option parser. Method signatures and docstrings: - def __init__(self, config_options=False, sort_options=False, **kwargs): Initialise the class. :param config_options: True/False show configuration options :para...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class ArgumentParserBase: """The base class for the option parser.""" def __init__(self, config_options=False, sort_options=False, **kwargs): """Initialise the class. :param config_options: True/False show configuration options :param sort_options: True/False show argument sorting options"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArgumentParserBase: """The base class for the option parser.""" def __init__(self, config_options=False, sort_options=False, **kwargs): """Initialise the class. :param config_options: True/False show configuration options :param sort_options: True/False show argument sorting options""" su...
the_stack_v2_python_sparse
src/dials/util/options.py
dials/dials
train
71
2a11ffb30c37628a7335cedc5d71b4d11ccf3514
[ "envelopes.sort()\n\n@lru_cache(None)\ndef dfs(i):\n if i == 0:\n return 1\n ret = 1\n for j in range(i):\n if envelopes[i][0] > envelopes[j][0] and envelopes[i][1] > envelopes[j][1]:\n ret = max(ret, 1 + dfs(j))\n return ret\nreturn max((dfs(i) for i in range(len(envelopes)))) ...
<|body_start_0|> envelopes.sort() @lru_cache(None) def dfs(i): if i == 0: return 1 ret = 1 for j in range(i): if envelopes[i][0] > envelopes[j][0] and envelopes[i][1] > envelopes[j][1]: ret = max(ret, 1 + df...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes: List[List[int]]) -> int: """DFS""" <|body_0|> def maxEnvelopes(self, envelopes: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> def maxEnvelopes(self, envelopes: List[...
stack_v2_sparse_classes_10k_train_003785
5,669
no_license
[ { "docstring": "DFS", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes: List[List[int]]) -> int" }, { "docstring": "Time complexity: O(n^2) Space complexity: O(n^2)", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes: List[List[int]]) -> int" ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes: List[List[int]]) -> int: DFS - def maxEnvelopes(self, envelopes: List[List[int]]) -> int: Time complexity: O(n^2) Space complexity: O(n^2) - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes: List[List[int]]) -> int: DFS - def maxEnvelopes(self, envelopes: List[List[int]]) -> int: Time complexity: O(n^2) Space complexity: O(n^2) - def...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes: List[List[int]]) -> int: """DFS""" <|body_0|> def maxEnvelopes(self, envelopes: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> def maxEnvelopes(self, envelopes: List[...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxEnvelopes(self, envelopes: List[List[int]]) -> int: """DFS""" envelopes.sort() @lru_cache(None) def dfs(i): if i == 0: return 1 ret = 1 for j in range(i): if envelopes[i][0] > envelopes[j][0] ...
the_stack_v2_python_sparse
leetcode/solved/354_Russian_Doll_Envelopes/solution.py
sungminoh/algorithms
train
0
01c9b2533fdc8b368cad4fd2cd0d3d3d2606ec4d
[ "w = [(x2 - x1 + 1) * (y2 - y1 + 1) for x1, y1, x2, y2 in rects]\nself.weights = [i / sum(w) for i in accumulate(w)]\nself.rects = rects", "n_rect = bisect.bisect(self.weights, random.random())\nx1, y1, x2, y2 = self.rects[n_rect]\nreturn [random.randint(x1, x2), random.randint(y1, y2)]" ]
<|body_start_0|> w = [(x2 - x1 + 1) * (y2 - y1 + 1) for x1, y1, x2, y2 in rects] self.weights = [i / sum(w) for i in accumulate(w)] self.rects = rects <|end_body_0|> <|body_start_1|> n_rect = bisect.bisect(self.weights, random.random()) x1, y1, x2, y2 = self.rects[n_rect] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> w = [(x2 - x1 + 1) * (y2 - y1 + 1) for x1, y1, x2, y2 in rects] self.weig...
stack_v2_sparse_classes_10k_train_003786
1,355
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_006569
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
f93380721b8383817fe2b0d728deca1321c9ef45
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" w = [(x2 - x1 + 1) * (y2 - y1 + 1) for x1, y1, x2, y2 in rects] self.weights = [i / sum(w) for i in accumulate(w)] self.rects = rects def pick(self): """:rtype: List[int]""" n_rect = bi...
the_stack_v2_python_sparse
explore/2020/august/Random_Point_in_Non-overlapping_Rectangles.2.py
lixiang2017/leetcode
train
5
395894b682ece2b60e052c6f592624dfa651517f
[ "super().__init__(min_neg=min_neg, batch_size_per_image=batch_size_per_image, positive_fraction=positive_fraction, pool_size=pool_size)\nself._batch_size_per_image = batch_size_per_image\nlogger.info('Sampling hard negatives on a per batch basis')", "batch_size = len(target_labels)\nself.batch_size_per_image = se...
<|body_start_0|> super().__init__(min_neg=min_neg, batch_size_per_image=batch_size_per_image, positive_fraction=positive_fraction, pool_size=pool_size) self._batch_size_per_image = batch_size_per_image logger.info('Sampling hard negatives on a per batch basis') <|end_body_0|> <|body_start_1|> ...
Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anchors per image
HardNegativeSamplerBatched
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HardNegativeSamplerBatched: """Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anc...
stack_v2_sparse_classes_10k_train_003787
13,985
permissive
[ { "docstring": "Args: batch_size_per_image (int): number of elements to be selected per image positive_fraction (float): percentage of positive elements per batch pool_size (float): hard negatives are sampled from a pool of size: batch_size_per_image * (1 - positive_fraction) * pool_size", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_006977
Implement the Python class `HardNegativeSamplerBatched` described below. Class description: Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_s...
Implement the Python class `HardNegativeSamplerBatched` described below. Class description: Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_s...
4f41faa7536dcef8fca7b647dcdca25360e5b58a
<|skeleton|> class HardNegativeSamplerBatched: """Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HardNegativeSamplerBatched: """Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anchors per imag...
the_stack_v2_python_sparse
nndet/core/boxes/sampler.py
dboun/nnDetection
train
1
47ca071d4aa7a0f7e1e52765acc5f58be89da92d
[ "if not root:\n return True\nleft = self.maxDepth(root.left)\nright = self.maxDepth(root.right)\nif abs(left - right) > 1:\n return False\nreturn self.isBalanced(root.left) and self.isBalanced(root.right)", "if not root:\n return 0\nif not root.left and (not root.right):\n return 1\nreturn 1 + max(sel...
<|body_start_0|> if not root: return True left = self.maxDepth(root.left) right = self.maxDepth(root.right) if abs(left - right) > 1: return False return self.isBalanced(root.left) and self.isBalanced(root.right) <|end_body_0|> <|body_start_1|> if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return True left ...
stack_v2_sparse_classes_10k_train_003788
715
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isBalanced", "signature": "def isBalanced(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" } ]
2
stack_v2_sparse_classes_30k_val_000048
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def maxDepth(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def maxDepth(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def isBalanced(self,...
5ab258f04771db37a3beb3cb0c490a06183f7b51
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" if not root: return True left = self.maxDepth(root.left) right = self.maxDepth(root.right) if abs(left - right) > 1: return False return self.isBalanced(root.le...
the_stack_v2_python_sparse
py_solution/p110_tree_balance.py
dengshilong/leetcode
train
0
bec069374fa8aeccb9c709d91a59229897697fa3
[ "self.deal = deal\nself.action = action\nself.bet = bet\nself.player = player", "if self.player == CHANCE:\n return ', '.join((INT2STRING_CARD[c] for c in self.deal))\nelse:\n return INT2STRING_ACTION[self.action]" ]
<|body_start_0|> self.deal = deal self.action = action self.bet = bet self.player = player <|end_body_0|> <|body_start_1|> if self.player == CHANCE: return ', '.join((INT2STRING_CARD[c] for c in self.deal)) else: return INT2STRING_ACTION[self.acti...
Action object of env: Texas Hold'em.
Action
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: """Action object of env: Texas Hold'em.""" def __init__(self, deal=None, action=None, bet=0, player=-1): """Init the action instance.""" <|body_0|> def to_string(self): """Return a string representing this action.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_003789
10,184
no_license
[ { "docstring": "Init the action instance.", "name": "__init__", "signature": "def __init__(self, deal=None, action=None, bet=0, player=-1)" }, { "docstring": "Return a string representing this action.", "name": "to_string", "signature": "def to_string(self)" } ]
2
stack_v2_sparse_classes_30k_train_001181
Implement the Python class `Action` described below. Class description: Action object of env: Texas Hold'em. Method signatures and docstrings: - def __init__(self, deal=None, action=None, bet=0, player=-1): Init the action instance. - def to_string(self): Return a string representing this action.
Implement the Python class `Action` described below. Class description: Action object of env: Texas Hold'em. Method signatures and docstrings: - def __init__(self, deal=None, action=None, bet=0, player=-1): Init the action instance. - def to_string(self): Return a string representing this action. <|skeleton|> class ...
3514a0ea315b36dd9545bd2cfe36bd6c099ee1d7
<|skeleton|> class Action: """Action object of env: Texas Hold'em.""" def __init__(self, deal=None, action=None, bet=0, player=-1): """Init the action instance.""" <|body_0|> def to_string(self): """Return a string representing this action.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Action: """Action object of env: Texas Hold'em.""" def __init__(self, deal=None, action=None, bet=0, player=-1): """Init the action instance.""" self.deal = deal self.action = action self.bet = bet self.player = player def to_string(self): """Return a ...
the_stack_v2_python_sparse
env/texas_holdem/texas_holdem_char.py
orange9426/FOGs
train
1
0852477e5c0e6540406da6c6c0d822dd669e8550
[ "self.fields = fields\nself.object_type = object_type\nself.record_count = record_count", "if dictionary is None:\n return None\nfields = None\nif dictionary.get('fields') != None:\n fields = list()\n for structure in dictionary.get('fields'):\n fields.append(cohesity_management_sdk.models.sfdc_ob...
<|body_start_0|> self.fields = fields self.object_type = object_type self.record_count = record_count <|end_body_0|> <|body_start_1|> if dictionary is None: return None fields = None if dictionary.get('fields') != None: fields = list() ...
Implementation of the 'SfdcObject' model. Specifies an Object containing information about a Salseforce object. Attributes: fields (list of SfdcObjectFields): Type of this object object_type (ObjectTypeEnum): Type of this object Specifies the type of an Universal Data Adapter source entity. 'kStandard' indicates a Univ...
SfdcObject
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SfdcObject: """Implementation of the 'SfdcObject' model. Specifies an Object containing information about a Salseforce object. Attributes: fields (list of SfdcObjectFields): Type of this object object_type (ObjectTypeEnum): Type of this object Specifies the type of an Universal Data Adapter sourc...
stack_v2_sparse_classes_10k_train_003790
2,391
permissive
[ { "docstring": "Constructor for the SfdcObject class", "name": "__init__", "signature": "def __init__(self, fields=None, object_type=None, record_count=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the ...
2
null
Implement the Python class `SfdcObject` described below. Class description: Implementation of the 'SfdcObject' model. Specifies an Object containing information about a Salseforce object. Attributes: fields (list of SfdcObjectFields): Type of this object object_type (ObjectTypeEnum): Type of this object Specifies the ...
Implement the Python class `SfdcObject` described below. Class description: Implementation of the 'SfdcObject' model. Specifies an Object containing information about a Salseforce object. Attributes: fields (list of SfdcObjectFields): Type of this object object_type (ObjectTypeEnum): Type of this object Specifies the ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SfdcObject: """Implementation of the 'SfdcObject' model. Specifies an Object containing information about a Salseforce object. Attributes: fields (list of SfdcObjectFields): Type of this object object_type (ObjectTypeEnum): Type of this object Specifies the type of an Universal Data Adapter sourc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SfdcObject: """Implementation of the 'SfdcObject' model. Specifies an Object containing information about a Salseforce object. Attributes: fields (list of SfdcObjectFields): Type of this object object_type (ObjectTypeEnum): Type of this object Specifies the type of an Universal Data Adapter source entity. 'kS...
the_stack_v2_python_sparse
cohesity_management_sdk/models/sfdc_object.py
cohesity/management-sdk-python
train
24
d371e24d9b9ab89426acb2f2c42d96cbfa19a97a
[ "self._flat_layer_suffix = '_flat'\nself.old_layer = old_layer\nself.new_layer = new_layer\nself.diff_attribs = diff_attribs\nself.focus_attribs = focus_attribs\nself.morph_diff_tagger = DiffTagger(layer_a=old_layer + self._flat_layer_suffix, layer_b=new_layer + self._flat_layer_suffix, output_layer='morph_diff_lay...
<|body_start_0|> self._flat_layer_suffix = '_flat' self.old_layer = old_layer self.new_layer = new_layer self.diff_attribs = diff_attribs self.focus_attribs = focus_attribs self.morph_diff_tagger = DiffTagger(layer_a=old_layer + self._flat_layer_suffix, layer_b=new_layer ...
Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping spans (missing and extra spans) will be lef...
MorphDiffFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MorphDiffFinder: """Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping ...
stack_v2_sparse_classes_10k_train_003791
35,998
no_license
[ { "docstring": "Initializes MorphDiffFinder. A specification of comparable layers must be provided. :param old_layer: str Name of the old morph_analysis layer. :param new_layer: str Name of the new morph_analysis layer. :param diff_attribs: list List containing morph_analysis attributes which will be used for f...
2
stack_v2_sparse_classes_30k_train_003831
Implement the Python class `MorphDiffFinder` described below. Class description: Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified...
Implement the Python class `MorphDiffFinder` described below. Class description: Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified...
d0b498a08a938b204fc34c3ea5e3ee3eb57bb25d
<|skeleton|> class MorphDiffFinder: """Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MorphDiffFinder: """Finds all differences between two (Vabamorf's) morphological analysis layers, and groups differences in modified spans in a way that both matching and mismatching annotations are shown. Note: output grouped differences only cover modified spans; annotations on non-overlapping spans (missin...
the_stack_v2_python_sparse
diff_morph_analysis/morph_eval_utils.py
estnltk/estnltk-workflows
train
0
3ca72b858f0578ee43c1a5deba8e3a2095241c8d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IosHomeScreenApp()", "from .ios_home_screen_item import IosHomeScreenItem\nfrom .ios_home_screen_item import IosHomeScreenItem\nfields: Dict[str, Callable[[Any], None]] = {'bundleID': lambda n: setattr(self, 'bundle_i_d', n.get_str_val...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IosHomeScreenApp() <|end_body_0|> <|body_start_1|> from .ios_home_screen_item import IosHomeScreenItem from .ios_home_screen_item import IosHomeScreenItem fields: Dict[str, Calla...
Represents an icon for an app on the Home Screen
IosHomeScreenApp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IosHomeScreenApp: """Represents an icon for an app on the Home Screen""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenApp: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to ...
stack_v2_sparse_classes_10k_train_003792
2,235
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: IosHomeScreenApp", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_va...
3
null
Implement the Python class `IosHomeScreenApp` described below. Class description: Represents an icon for an app on the Home Screen Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenApp: Creates a new instance of the appropriate class based on...
Implement the Python class `IosHomeScreenApp` described below. Class description: Represents an icon for an app on the Home Screen Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenApp: Creates a new instance of the appropriate class based on...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IosHomeScreenApp: """Represents an icon for an app on the Home Screen""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenApp: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IosHomeScreenApp: """Represents an icon for an app on the Home Screen""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenApp: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read t...
the_stack_v2_python_sparse
msgraph/generated/models/ios_home_screen_app.py
microsoftgraph/msgraph-sdk-python
train
135
71194713f0215f1dec2ce3a5cbd65b629f9f5c3e
[ "super(AngularPenaltySMLoss, self).__init__()\nloss_type = loss_type.lower()\nassert loss_type in ['arcface', 'sphereface', 'cosface']\nif loss_type == 'arcface':\n self.s = 64.0 if not s else s\n self.m = 0.5 if not m else m\nif loss_type == 'sphereface':\n self.s = 64.0 if not s else s\n self.m = 1.35...
<|body_start_0|> super(AngularPenaltySMLoss, self).__init__() loss_type = loss_type.lower() assert loss_type in ['arcface', 'sphereface', 'cosface'] if loss_type == 'arcface': self.s = 64.0 if not s else s self.m = 0.5 if not m else m if loss_type == 'sphe...
AngularPenaltySMLoss
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AngularPenaltySMLoss: def __init__(self, in_features, out_features, loss_type='arcface', eps=1e-07, s=None, m=None): """Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arx...
stack_v2_sparse_classes_10k_train_003793
4,547
permissive
[ { "docstring": "Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arxiv.org/abs/1801.07698 SphereFace: https://arxiv.org/abs/1704.08063 CosFace/Ad Margin: https://arxiv.org/abs/1801.05599", "na...
2
stack_v2_sparse_classes_30k_train_000328
Implement the Python class `AngularPenaltySMLoss` described below. Class description: Implement the AngularPenaltySMLoss class. Method signatures and docstrings: - def __init__(self, in_features, out_features, loss_type='arcface', eps=1e-07, s=None, m=None): Angular Penalty Softmax Loss Three 'loss_types' available: ...
Implement the Python class `AngularPenaltySMLoss` described below. Class description: Implement the AngularPenaltySMLoss class. Method signatures and docstrings: - def __init__(self, in_features, out_features, loss_type='arcface', eps=1e-07, s=None, m=None): Angular Penalty Softmax Loss Three 'loss_types' available: ...
c6f1648a148335babc0a26d8a589120616327548
<|skeleton|> class AngularPenaltySMLoss: def __init__(self, in_features, out_features, loss_type='arcface', eps=1e-07, s=None, m=None): """Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arx...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AngularPenaltySMLoss: def __init__(self, in_features, out_features, loss_type='arcface', eps=1e-07, s=None, m=None): """Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arxiv.org/abs/180...
the_stack_v2_python_sparse
loss_functions.py
arianasatryan/physionet-challenge-2020
train
0
c9006bda98f9120331d6fe47d375fa35fc3a3152
[ "while dup_char != s[left]:\n ch_set.remove(s[left])\n left += 1\nreturn left + 1", "s_len = len(s)\nif s_len <= 1:\n return s_len\nch_set = set()\nch_set.add(s[0])\nmax_len = 1\nleft = 0\nright = 1\nwhile right < s_len:\n ch = s[right]\n if ch not in ch_set:\n ch_set.add(ch)\n max_le...
<|body_start_0|> while dup_char != s[left]: ch_set.remove(s[left]) left += 1 return left + 1 <|end_body_0|> <|body_start_1|> s_len = len(s) if s_len <= 1: return s_len ch_set = set() ch_set.add(s[0]) max_len = 1 left = ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def update_left_index_and_char_set(self, s, left, dup_char, ch_set): """1. find the index of dup char in s[left: right+1]. 2.1. if index of dup char == s[left] then no need to add s[right] in ch_set. 2.2. if index of dup char != s[left] then ch_set should only have chars which ...
stack_v2_sparse_classes_10k_train_003794
1,891
permissive
[ { "docstring": "1. find the index of dup char in s[left: right+1]. 2.1. if index of dup char == s[left] then no need to add s[right] in ch_set. 2.2. if index of dup char != s[left] then ch_set should only have chars which is in s[index of dup char: right+1].", "name": "update_left_index_and_char_set", "...
2
stack_v2_sparse_classes_30k_test_000407
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def update_left_index_and_char_set(self, s, left, dup_char, ch_set): 1. find the index of dup char in s[left: right+1]. 2.1. if index of dup char == s[left] then no need to add s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def update_left_index_and_char_set(self, s, left, dup_char, ch_set): 1. find the index of dup char in s[left: right+1]. 2.1. if index of dup char == s[left] then no need to add s...
c7e5b6692ad6772b38de8be029bddf0e273e0bce
<|skeleton|> class Solution: def update_left_index_and_char_set(self, s, left, dup_char, ch_set): """1. find the index of dup char in s[left: right+1]. 2.1. if index of dup char == s[left] then no need to add s[right] in ch_set. 2.2. if index of dup char != s[left] then ch_set should only have chars which ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def update_left_index_and_char_set(self, s, left, dup_char, ch_set): """1. find the index of dup char in s[left: right+1]. 2.1. if index of dup char == s[left] then no need to add s[right] in ch_set. 2.2. if index of dup char != s[left] then ch_set should only have chars which is in s[index ...
the_stack_v2_python_sparse
arr_str/longest_substring_without_repeating_chars.py
mantoshkumar1/interview_preparation
train
1
505999933a931ff59a7e1dfa82ecd7e3396a79d7
[ "super(RelativisticAdvLoss, self).__init__()\nself.mode = mode\nself.device = device\nself.BCEloss = nn.BCEWithLogitsLoss().to(device)", "mean_fake = torch.mean(fake_dis, dim=0, keepdim=True)\nmean_real = torch.mean(real_dis, dim=0, keepdim=True)\nD_real = real_dis - mean_fake\nD_fake = fake_dis - mean_real\nzero...
<|body_start_0|> super(RelativisticAdvLoss, self).__init__() self.mode = mode self.device = device self.BCEloss = nn.BCEWithLogitsLoss().to(device) <|end_body_0|> <|body_start_1|> mean_fake = torch.mean(fake_dis, dim=0, keepdim=True) mean_real = torch.mean(real_dis, dim=...
RelativisticAdvLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativisticAdvLoss: def __init__(self, mode, device): """:param mode: mode to compute adversarial loss: bce or l1 :param device: device""" <|body_0|> def forward(self, fake_dis, real_dis, model): """:param fake_dis: predicted image from generator output :param real_...
stack_v2_sparse_classes_10k_train_003795
7,116
no_license
[ { "docstring": ":param mode: mode to compute adversarial loss: bce or l1 :param device: device", "name": "__init__", "signature": "def __init__(self, mode, device)" }, { "docstring": ":param fake_dis: predicted image from generator output :param real_dis: real image :param model: generator or di...
2
stack_v2_sparse_classes_30k_train_001875
Implement the Python class `RelativisticAdvLoss` described below. Class description: Implement the RelativisticAdvLoss class. Method signatures and docstrings: - def __init__(self, mode, device): :param mode: mode to compute adversarial loss: bce or l1 :param device: device - def forward(self, fake_dis, real_dis, mod...
Implement the Python class `RelativisticAdvLoss` described below. Class description: Implement the RelativisticAdvLoss class. Method signatures and docstrings: - def __init__(self, mode, device): :param mode: mode to compute adversarial loss: bce or l1 :param device: device - def forward(self, fake_dis, real_dis, mod...
eb9325edb73208ea992eda4be2a92119be867d10
<|skeleton|> class RelativisticAdvLoss: def __init__(self, mode, device): """:param mode: mode to compute adversarial loss: bce or l1 :param device: device""" <|body_0|> def forward(self, fake_dis, real_dis, model): """:param fake_dis: predicted image from generator output :param real_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RelativisticAdvLoss: def __init__(self, mode, device): """:param mode: mode to compute adversarial loss: bce or l1 :param device: device""" super(RelativisticAdvLoss, self).__init__() self.mode = mode self.device = device self.BCEloss = nn.BCEWithLogitsLoss().to(device)...
the_stack_v2_python_sparse
base_model/base_losses/base_losses.py
Oorgien/Scene-Inpainting
train
1
543e780c1b491041ae1f766f2aae297442c4eb1a
[ "parameters = dict()\nparameters['page'] = GraphQLParam(page, 'PageInput', False)\nparameters['filter'] = GraphQLParam(room_filter, 'LabFilter', False)\nparameters['sort'] = GraphQLParam(sort, 'LabSort', False)\nresponse = self._query(name='getLabs', params=parameters, fields=RoomList.fields())\nreturn RoomList(res...
<|body_start_0|> parameters = dict() parameters['page'] = GraphQLParam(page, 'PageInput', False) parameters['filter'] = GraphQLParam(room_filter, 'LabFilter', False) parameters['sort'] = GraphQLParam(sort, 'LabSort', False) response = self._query(name='getLabs', params=parameters...
Mixin to add datacenter room related methods to the GraphQL client
RoomsMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoomsMixin: """Mixin to add datacenter room related methods to the GraphQL client""" def get_rooms(self, page: PageInput=None, room_filter: RoomFilter=None, sort: RoomSort=None) -> RoomList: """Retrieves a list of datacenter room objects :param page: The requested page from the serve...
stack_v2_sparse_classes_10k_train_003796
18,858
permissive
[ { "docstring": "Retrieves a list of datacenter room objects :param page: The requested page from the server. This is an optional argument and if omitted the server will default to returning the first page with a maximum of ``100`` items. :type page: PageInput, optional :param room_filter: A filter object to fil...
4
stack_v2_sparse_classes_30k_train_003620
Implement the Python class `RoomsMixin` described below. Class description: Mixin to add datacenter room related methods to the GraphQL client Method signatures and docstrings: - def get_rooms(self, page: PageInput=None, room_filter: RoomFilter=None, sort: RoomSort=None) -> RoomList: Retrieves a list of datacenter ro...
Implement the Python class `RoomsMixin` described below. Class description: Mixin to add datacenter room related methods to the GraphQL client Method signatures and docstrings: - def get_rooms(self, page: PageInput=None, room_filter: RoomFilter=None, sort: RoomSort=None) -> RoomList: Retrieves a list of datacenter ro...
8ea044096bd18aaccbfb81eca4e26ec29895a18c
<|skeleton|> class RoomsMixin: """Mixin to add datacenter room related methods to the GraphQL client""" def get_rooms(self, page: PageInput=None, room_filter: RoomFilter=None, sort: RoomSort=None) -> RoomList: """Retrieves a list of datacenter room objects :param page: The requested page from the serve...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoomsMixin: """Mixin to add datacenter room related methods to the GraphQL client""" def get_rooms(self, page: PageInput=None, room_filter: RoomFilter=None, sort: RoomSort=None) -> RoomList: """Retrieves a list of datacenter room objects :param page: The requested page from the server. This is an...
the_stack_v2_python_sparse
nebpyclient/api/rooms.py
firefly707/nebpyclient
train
0
8cc2cc6a2ff2ca5c7df26651b2f9d49741f71e3a
[ "env = DummyEnvironment()\nenv['BUILDERS'] = {}\nenv['ENV'] = {}\nenv['PLATFORM'] = 'test'\nt = SCons.Tool.Tool('g++')\nt(env)\nassert env['CXX'] == 'c++' or env['CXX'] == 'g++', env['CXX']\nassert env['INCPREFIX'] == '-I', env['INCPREFIX']\nassert env['TOOLS'] == ['g++'], env['TOOLS']\nexc_caught = None\ntry:\n ...
<|body_start_0|> env = DummyEnvironment() env['BUILDERS'] = {} env['ENV'] = {} env['PLATFORM'] = 'test' t = SCons.Tool.Tool('g++') t(env) assert env['CXX'] == 'c++' or env['CXX'] == 'g++', env['CXX'] assert env['INCPREFIX'] == '-I', env['INCPREFIX'] ...
ToolTestCase
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToolTestCase: def test_Tool(self) -> None: """Test the Tool() function""" <|body_0|> def test_pathfind(self) -> None: """Test that find_program_path() alters PATH only if add_path is true""" <|body_1|> <|end_skeleton|> <|body_start_0|> env = DummyEn...
stack_v2_sparse_classes_10k_train_003797
4,598
permissive
[ { "docstring": "Test the Tool() function", "name": "test_Tool", "signature": "def test_Tool(self) -> None" }, { "docstring": "Test that find_program_path() alters PATH only if add_path is true", "name": "test_pathfind", "signature": "def test_pathfind(self) -> None" } ]
2
null
Implement the Python class `ToolTestCase` described below. Class description: Implement the ToolTestCase class. Method signatures and docstrings: - def test_Tool(self) -> None: Test the Tool() function - def test_pathfind(self) -> None: Test that find_program_path() alters PATH only if add_path is true
Implement the Python class `ToolTestCase` described below. Class description: Implement the ToolTestCase class. Method signatures and docstrings: - def test_Tool(self) -> None: Test the Tool() function - def test_pathfind(self) -> None: Test that find_program_path() alters PATH only if add_path is true <|skeleton|> ...
b2a7d7066a2b854460a334a5fe737ea389655e6e
<|skeleton|> class ToolTestCase: def test_Tool(self) -> None: """Test the Tool() function""" <|body_0|> def test_pathfind(self) -> None: """Test that find_program_path() alters PATH only if add_path is true""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ToolTestCase: def test_Tool(self) -> None: """Test the Tool() function""" env = DummyEnvironment() env['BUILDERS'] = {} env['ENV'] = {} env['PLATFORM'] = 'test' t = SCons.Tool.Tool('g++') t(env) assert env['CXX'] == 'c++' or env['CXX'] == 'g++', ...
the_stack_v2_python_sparse
SCons/Tool/ToolTests.py
SCons/scons
train
1,827
94d722f388d674c4b4bb8fdf9a1434a2c73d061e
[ "super(AgeFilter, self).__init__(order)\nself.age = age\nself.ageField = ageField\nself.ageTolerance = ageTolerance\nif self.ageTolerance < 0:\n self.ageTolerance = 0\nself.minAgeField = minAgeField\nself.maxAgeField = maxAgeField\nself.rejectUnclassified = rejectUnclassified", "for result in results:\n if ...
<|body_start_0|> super(AgeFilter, self).__init__(order) self.age = age self.ageField = ageField self.ageTolerance = ageTolerance if self.ageTolerance < 0: self.ageTolerance = 0 self.minAgeField = minAgeField self.maxAgeField = maxAgeField self....
Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter precedence * age (integer) : the age of t...
AgeFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AgeFilter: """Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter prec...
stack_v2_sparse_classes_10k_train_003798
2,776
permissive
[ { "docstring": "Constructor for AgeFilter", "name": "__init__", "signature": "def __init__(self, age, ageField=None, ageTolerance=3, minAgeField='minAge', maxAgeField='maxAge', order=0, rejectUnclassified=False)" }, { "docstring": "Filters the results according to a given range in which the resu...
2
null
Implement the Python class `AgeFilter` described below. Class description: Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using ...
Implement the Python class `AgeFilter` described below. Class description: Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using ...
ed72aee466649bd834d5b4459eb6e0173df6e2ec
<|skeleton|> class AgeFilter: """Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter prec...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AgeFilter: """Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter precedence * age ...
the_stack_v2_python_sparse
reference-code/puppy/result/filter/ageFilter.py
Granvanoeli/ifind
train
0
e4617a8df60833b78d5bab20ba34a2ae40340e99
[ "scheduler = AsyncIOScheduler()\nscheduler.add_job(job_fn, misfire_grace_time=None, timezone=EASTERN_STANDARD_TIME, **kwargs)\nscheduler.start()\nif not scheduler.running:\n asyncio.get_event_loop().run_forever()", "scheduler = AsyncIOScheduler()\nscheduler.add_job(job_fn, misfire_grace_time=None, timezone=EAS...
<|body_start_0|> scheduler = AsyncIOScheduler() scheduler.add_job(job_fn, misfire_grace_time=None, timezone=EASTERN_STANDARD_TIME, **kwargs) scheduler.start() if not scheduler.running: asyncio.get_event_loop().run_forever() <|end_body_0|> <|body_start_1|> scheduler =...
Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler
DaemonHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DaemonHelper: """Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler""" def add(job_fn, **kwargs) -> None: """Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedula...
stack_v2_sparse_classes_10k_train_003799
1,537
permissive
[ { "docstring": "Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedular", "name": "add", "signature": "def add(job_fn, **kwargs) -> None" }, { "docstring": "Create a simple job with a function for the s...
2
stack_v2_sparse_classes_30k_train_000268
Implement the Python class `DaemonHelper` described below. Class description: Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler Method signatures and docstrings: - def add(job_fn, **kwargs) -> None: Create a simple job with available kwargs from the scheduler Parameters ----------- **kwarg...
Implement the Python class `DaemonHelper` described below. Class description: Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler Method signatures and docstrings: - def add(job_fn, **kwargs) -> None: Create a simple job with available kwargs from the scheduler Parameters ----------- **kwarg...
f438c6a7d1f2c1797755eb8287bc1499c0cf2a88
<|skeleton|> class DaemonHelper: """Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler""" def add(job_fn, **kwargs) -> None: """Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedula...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DaemonHelper: """Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler""" def add(job_fn, **kwargs) -> None: """Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedular""" ...
the_stack_v2_python_sparse
src/core/daemon.py
fugwenna/bunkbot
train
2