blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
1101944ef84db9d1666f2eec3bf1fb61f4b964e6
[ "dummy_head = ListNode(0)\ndummy_head.next = head\ncur = dummy_head\nwhile cur.next is not None:\n if cur.next.val == val:\n cur.next = cur.next.next\n else:\n cur = cur.next\nreturn dummy_head.next", "while head is not None and head.val == val:\n head = head.next\npre = head\ncur = head.ne...
<|body_start_0|> dummy_head = ListNode(0) dummy_head.next = head cur = dummy_head while cur.next is not None: if cur.next.val == val: cur.next = cur.next.next else: cur = cur.next return dummy_head.next <|end_body_0|> <|bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: """带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度 O(1)""" <|body_0|> def removeElements_2(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: """不带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度...
stack_v2_sparse_classes_36k_train_033300
1,803
no_license
[ { "docstring": "带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度 O(1)", "name": "removeElements", "signature": "def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]" }, { "docstring": "不带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度 O(1)", "name": "removeElements_2", "signature": "def remove...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: 带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度 O(1) - def removeElements_2(self, head: Optional[ListNode], val...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: 带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度 O(1) - def removeElements_2(self, head: Optional[ListNode], val...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: """带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度 O(1)""" <|body_0|> def removeElements_2(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: """不带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: """带虚拟头节点的链表 * 时间复杂度 O(n) * 空间复杂度 O(1)""" dummy_head = ListNode(0) dummy_head.next = head cur = dummy_head while cur.next is not None: if cur.next.val == val: ...
the_stack_v2_python_sparse
code_thinking/list_node/203.remove_linked_list_elements.py
EachenKuang/LeetCode
train
28
3f2182fed3b446fed3e3b342c1f22ddb93e5d681
[ "self._dbName = os.environ['MOPS_DBINSTANCE']\nself._instance = mopsInstance = Instance(self._dbName)\nself._conn = self._instance.get_dbh()\nself._cursor = self._conn.cursor()\nsql = 'select o.orbit_id, o.q, o.e, o.i, o.node, o.arg_peri, ' + 'o.time_peri, o.h_v, o.epoch, o.cov_01, o.cov_02, o.cov_03, ' + 'o.cov_04...
<|body_start_0|> self._dbName = os.environ['MOPS_DBINSTANCE'] self._instance = mopsInstance = Instance(self._dbName) self._conn = self._instance.get_dbh() self._cursor = self._conn.cursor() sql = 'select o.orbit_id, o.q, o.e, o.i, o.node, o.arg_peri, ' + 'o.time_peri, o.h_v, o.ep...
OrbitTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrbitTests: def setUp(self): """Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" <|body_0|> def testSave(self): """Test the insertion of a dummy Orbit instance in the DB."...
stack_v2_sparse_classes_36k_train_033301
17,613
no_license
[ { "docstring": "Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the insertion of a dummy Orbit instance in the DB.", "name":...
2
stack_v2_sparse_classes_30k_train_002019
Implement the Python class `OrbitTests` described below. Class description: Implement the OrbitTests class. Method signatures and docstrings: - def setUp(self): Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it. - def testSave(...
Implement the Python class `OrbitTests` described below. Class description: Implement the OrbitTests class. Method signatures and docstrings: - def setUp(self): Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it. - def testSave(...
06858b7e935243da7a3f55b3e5097d6440e0c1c2
<|skeleton|> class OrbitTests: def setUp(self): """Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" <|body_0|> def testSave(self): """Test the insertion of a dummy Orbit instance in the DB."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrbitTests: def setUp(self): """Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" self._dbName = os.environ['MOPS_DBINSTANCE'] self._instance = mopsInstance = Instance(self._dbName) s...
the_stack_v2_python_sparse
python/MOPS/test.py
ldenneau/mopsng
train
0
e7756647069a86917d7b30433236251bb74e00af
[ "logger = OperationLogger(outfile=StringIO())\nlogger.observe(dict(type='operation', phase='start', user='user01', label='testing', lag=0.5))\nlogger.observe(dict(type='operation', phase='end', user='user01', duration=0.35, label='testing', success=True))\nself.assertEqual([], logger.failures())", "logger = Opera...
<|body_start_0|> logger = OperationLogger(outfile=StringIO()) logger.observe(dict(type='operation', phase='start', user='user01', label='testing', lag=0.5)) logger.observe(dict(type='operation', phase='end', user='user01', duration=0.35, label='testing', success=True)) self.assertEqual([...
Tests for L{OperationLogger}.
OperationLoggerTests
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OperationLoggerTests: """Tests for L{OperationLogger}.""" def test_noFailures(self): """If the median lag is below 1 second and the failure rate is below 1%, L{OperationLogger.failures} returns an empty list.""" <|body_0|> def test_lagLimitExceeded(self): """If t...
stack_v2_sparse_classes_36k_train_033302
42,388
permissive
[ { "docstring": "If the median lag is below 1 second and the failure rate is below 1%, L{OperationLogger.failures} returns an empty list.", "name": "test_noFailures", "signature": "def test_noFailures(self)" }, { "docstring": "If the median scheduling lag for any operation in the simulation excee...
4
null
Implement the Python class `OperationLoggerTests` described below. Class description: Tests for L{OperationLogger}. Method signatures and docstrings: - def test_noFailures(self): If the median lag is below 1 second and the failure rate is below 1%, L{OperationLogger.failures} returns an empty list. - def test_lagLimi...
Implement the Python class `OperationLoggerTests` described below. Class description: Tests for L{OperationLogger}. Method signatures and docstrings: - def test_noFailures(self): If the median lag is below 1 second and the failure rate is below 1%, L{OperationLogger.failures} returns an empty list. - def test_lagLimi...
cb2962f1f1927f1e52ea405094fa3e7e180f23cb
<|skeleton|> class OperationLoggerTests: """Tests for L{OperationLogger}.""" def test_noFailures(self): """If the median lag is below 1 second and the failure rate is below 1%, L{OperationLogger.failures} returns an empty list.""" <|body_0|> def test_lagLimitExceeded(self): """If t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OperationLoggerTests: """Tests for L{OperationLogger}.""" def test_noFailures(self): """If the median lag is below 1 second and the failure rate is below 1%, L{OperationLogger.failures} returns an empty list.""" logger = OperationLogger(outfile=StringIO()) logger.observe(dict(type...
the_stack_v2_python_sparse
contrib/performance/loadtest/test_profiles.py
ass-a2s/ccs-calendarserver
train
2
8e6e91d4f005fbba0c6439d91f920fb039832372
[ "start, count = ({}, {})\ndegree, res = (0, len(nums))\nfor i, num in enumerate(nums):\n count[num] = count.get(num, 0) + 1\n if num not in start:\n start[num] = i\n if count[num] == degree:\n res = min(res, i - start[num] + 1)\n elif count[num] > degree:\n degree = count[num]\n ...
<|body_start_0|> start, count = ({}, {}) degree, res = (0, len(nums)) for i, num in enumerate(nums): count[num] = count.get(num, 0) + 1 if num not in start: start[num] = i if count[num] == degree: res = min(res, i - start[num] +...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findShortestSubArray2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> start, count = ({}, {}) ...
stack_v2_sparse_classes_36k_train_033303
2,307
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findShortestSubArray", "signature": "def findShortestSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findShortestSubArray2", "signature": "def findShortestSubArray2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findShortestSubArray(self, nums): :type nums: List[int] :rtype: int - def findShortestSubArray2(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 findShortestSubArray(self, nums): :type nums: List[int] :rtype: int - def findShortestSubArray2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findShortestSubArray2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" start, count = ({}, {}) degree, res = (0, len(nums)) for i, num in enumerate(nums): count[num] = count.get(num, 0) + 1 if num not in start: start[num]...
the_stack_v2_python_sparse
code697DegreeOfAnArray.py
cybelewang/leetcode-python
train
0
90dbd11b6b564557c39d0a29672c08f22feba26a
[ "if model._meta.app_label == 'amavis':\n return 'amavis'\nreturn None", "if model._meta.app_label == 'amavis':\n return 'amavis'\nreturn None", "if obj1._meta.app_label == 'amavis' or obj2._meta.app_label == 'amavis':\n return True\nreturn None", "if db == 'amavis':\n return model._meta.app_label ...
<|body_start_0|> if model._meta.app_label == 'amavis': return 'amavis' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'amavis': return 'amavis' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label == 'amavis' or ob...
A router to control all database operations on models in the amavis application
AmavisRouter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmavisRouter: """A router to control all database operations on models in the amavis application""" def db_for_read(self, model, **hints): """Point all operations on amavis models to 'amavis'""" <|body_0|> def db_for_write(self, model, **hints): """Point all oper...
stack_v2_sparse_classes_36k_train_033304
1,056
permissive
[ { "docstring": "Point all operations on amavis models to 'amavis'", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Point all operations on amavis models to 'amavis'", "name": "db_for_write", "signature": "def db_for_write(self, model, **hin...
4
null
Implement the Python class `AmavisRouter` described below. Class description: A router to control all database operations on models in the amavis application Method signatures and docstrings: - def db_for_read(self, model, **hints): Point all operations on amavis models to 'amavis' - def db_for_write(self, model, **h...
Implement the Python class `AmavisRouter` described below. Class description: A router to control all database operations on models in the amavis application Method signatures and docstrings: - def db_for_read(self, model, **hints): Point all operations on amavis models to 'amavis' - def db_for_write(self, model, **h...
03fce9f5bba87ef00a4beae81e9a7c182c00271a
<|skeleton|> class AmavisRouter: """A router to control all database operations on models in the amavis application""" def db_for_read(self, model, **hints): """Point all operations on amavis models to 'amavis'""" <|body_0|> def db_for_write(self, model, **hints): """Point all oper...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AmavisRouter: """A router to control all database operations on models in the amavis application""" def db_for_read(self, model, **hints): """Point all operations on amavis models to 'amavis'""" if model._meta.app_label == 'amavis': return 'amavis' return None def...
the_stack_v2_python_sparse
modoboa/extensions/amavis/dbrouter.py
kirillsem/modoboa
train
1
4c5638a1199cc7adc23b6925ea962a917c36065c
[ "threading.Thread.__init__(self)\nfor key, function in event_list.iteritems():\n event_function = event_list[key]\n key = str(key).upper()\n if key.find('+') >= 0:\n sub_key, key = key.split('+', 1)\n sub_key = sub_key.strip()\n if sub_key not in SUPPORT_SUB_KEYBOARD_LIST:\n ...
<|body_start_0|> threading.Thread.__init__(self) for key, function in event_list.iteritems(): event_function = event_list[key] key = str(key).upper() if key.find('+') >= 0: sub_key, key = key.split('+', 1) sub_key = sub_key.strip() ...
Keyboard Event Listener Class
KeyboardEvent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyboardEvent: """Keyboard Event Listener Class""" def __init__(self, event_list): """Init keyboard Event Listener :param event_list: dictionary of key and trigger function key name => event function object""" <|body_0|> def on_keyboard_down(self, event): """Func...
stack_v2_sparse_classes_36k_train_033305
3,739
no_license
[ { "docstring": "Init keyboard Event Listener :param event_list: dictionary of key and trigger function key name => event function object", "name": "__init__", "signature": "def __init__(self, event_list)" }, { "docstring": "Function of key down event listener", "name": "on_keyboard_down", ...
4
null
Implement the Python class `KeyboardEvent` described below. Class description: Keyboard Event Listener Class Method signatures and docstrings: - def __init__(self, event_list): Init keyboard Event Listener :param event_list: dictionary of key and trigger function key name => event function object - def on_keyboard_do...
Implement the Python class `KeyboardEvent` described below. Class description: Keyboard Event Listener Class Method signatures and docstrings: - def __init__(self, event_list): Init keyboard Event Listener :param event_list: dictionary of key and trigger function key name => event function object - def on_keyboard_do...
17029e4d3944ffadf042484037ea7aaf28539606
<|skeleton|> class KeyboardEvent: """Keyboard Event Listener Class""" def __init__(self, event_list): """Init keyboard Event Listener :param event_list: dictionary of key and trigger function key name => event function object""" <|body_0|> def on_keyboard_down(self, event): """Func...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeyboardEvent: """Keyboard Event Listener Class""" def __init__(self, event_list): """Init keyboard Event Listener :param event_list: dictionary of key and trigger function key name => event function object""" threading.Thread.__init__(self) for key, function in event_list.iterite...
the_stack_v2_python_sparse
common/keyboardEvent.py
yxw19870806/PyCrawler
train
5
7c5ad5e1a150667f2e6b2edbec5d2933171c7295
[ "super(Subscription, self).__init__(logger)\nself.__context = zmq_context\nself.__addr = remote_address\nself.__socket = self.__context.socket(zmq.SUB)\nself.__socket.setsockopt_string(zmq.SUBSCRIBE, '')\nself.__socket.connect(self.__addr)\nself.__backlog = Queue(1024)\nself.__lock = Lock()", "with self.__lock:\n...
<|body_start_0|> super(Subscription, self).__init__(logger) self.__context = zmq_context self.__addr = remote_address self.__socket = self.__context.socket(zmq.SUB) self.__socket.setsockopt_string(zmq.SUBSCRIBE, '') self.__socket.connect(self.__addr) self.__backlo...
Subscription to a publishing endpoint.
Subscription
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subscription: """Subscription to a publishing endpoint.""" def __init__(self, remote_address, zmq_context, logger): """Subscribe to a publishing endpoint at remote_address. Requires a zmq context.""" <|body_0|> def recv(self, poll_timeout: int=500) -> Optional[str]: ...
stack_v2_sparse_classes_36k_train_033306
7,085
no_license
[ { "docstring": "Subscribe to a publishing endpoint at remote_address. Requires a zmq context.", "name": "__init__", "signature": "def __init__(self, remote_address, zmq_context, logger)" }, { "docstring": "Retrieve a message. Return value None after poll_timeout milliseconds.", "name": "recv...
3
stack_v2_sparse_classes_30k_train_005669
Implement the Python class `Subscription` described below. Class description: Subscription to a publishing endpoint. Method signatures and docstrings: - def __init__(self, remote_address, zmq_context, logger): Subscribe to a publishing endpoint at remote_address. Requires a zmq context. - def recv(self, poll_timeout:...
Implement the Python class `Subscription` described below. Class description: Subscription to a publishing endpoint. Method signatures and docstrings: - def __init__(self, remote_address, zmq_context, logger): Subscribe to a publishing endpoint at remote_address. Requires a zmq context. - def recv(self, poll_timeout:...
afecef14627e297b38331668ed04c844329957b2
<|skeleton|> class Subscription: """Subscription to a publishing endpoint.""" def __init__(self, remote_address, zmq_context, logger): """Subscribe to a publishing endpoint at remote_address. Requires a zmq context.""" <|body_0|> def recv(self, poll_timeout: int=500) -> Optional[str]: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Subscription: """Subscription to a publishing endpoint.""" def __init__(self, remote_address, zmq_context, logger): """Subscribe to a publishing endpoint at remote_address. Requires a zmq context.""" super(Subscription, self).__init__(logger) self.__context = zmq_context s...
the_stack_v2_python_sparse
composte/network/client.py
AlexisGoodfellow/Composte
train
0
de25d5871c4fed7907e799504bdff308a55c6c49
[ "self.freqs = frequencies\nself.chains = chains_seq\nself.evals = evals\nself.bads = pd.DataFrame({'allowed': self.get_worst('allowed'), 'outlier': self.get_worst('outlier')}).fillna(value=0)", "bad_resis = {}\nfor model in self.evals:\n for res in model.residues[which]:\n chain_ind = self.chains.index(...
<|body_start_0|> self.freqs = frequencies self.chains = chains_seq self.evals = evals self.bads = pd.DataFrame({'allowed': self.get_worst('allowed'), 'outlier': self.get_worst('outlier')}).fillna(value=0) <|end_body_0|> <|body_start_1|> bad_resis = {} for model in self.e...
RamachandranEvals
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RamachandranEvals: def __init__(self, evals, chains_seq, frequencies): """:param evals: :param chains_seq: :param frequencies:""" <|body_0|> def get_worst(self, which): """:param which: selected group: allowed or outlier :return: dictionary of cumulative amount of wh...
stack_v2_sparse_classes_36k_train_033307
6,566
no_license
[ { "docstring": ":param evals: :param chains_seq: :param frequencies:", "name": "__init__", "signature": "def __init__(self, evals, chains_seq, frequencies)" }, { "docstring": ":param which: selected group: allowed or outlier :return: dictionary of cumulative amount of which selected residues", ...
4
stack_v2_sparse_classes_30k_train_019749
Implement the Python class `RamachandranEvals` described below. Class description: Implement the RamachandranEvals class. Method signatures and docstrings: - def __init__(self, evals, chains_seq, frequencies): :param evals: :param chains_seq: :param frequencies: - def get_worst(self, which): :param which: selected gr...
Implement the Python class `RamachandranEvals` described below. Class description: Implement the RamachandranEvals class. Method signatures and docstrings: - def __init__(self, evals, chains_seq, frequencies): :param evals: :param chains_seq: :param frequencies: - def get_worst(self, which): :param which: selected gr...
fdb8a1a14bcf0b372ebaf152f2bbb1f5d804172e
<|skeleton|> class RamachandranEvals: def __init__(self, evals, chains_seq, frequencies): """:param evals: :param chains_seq: :param frequencies:""" <|body_0|> def get_worst(self, which): """:param which: selected group: allowed or outlier :return: dictionary of cumulative amount of wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RamachandranEvals: def __init__(self, evals, chains_seq, frequencies): """:param evals: :param chains_seq: :param frequencies:""" self.freqs = frequencies self.chains = chains_seq self.evals = evals self.bads = pd.DataFrame({'allowed': self.get_worst('allowed'), 'outlie...
the_stack_v2_python_sparse
homology_modeling/model_evaluation/_OLD/OLD_maindir/mm_homology_parse_rama.py
michal2am/bioscripts
train
3
468aa25f469ef2be7f2730cf01c783b25cbe4e4e
[ "self.disk_file_name = disk_file_name\nself.length_bytes = length_bytes\nself.number = number\nself.offset_bytes = offset_bytes", "if dictionary is None:\n return None\ndisk_file_name = dictionary.get('diskFileName')\nlength_bytes = dictionary.get('lengthBytes')\nnumber = dictionary.get('number')\noffset_bytes...
<|body_start_0|> self.disk_file_name = disk_file_name self.length_bytes = length_bytes self.number = number self.offset_bytes = offset_bytes <|end_body_0|> <|body_start_1|> if dictionary is None: return None disk_file_name = dictionary.get('diskFileName') ...
Implementation of the 'FilePartitionBlock' model. Defines a leaf node of a device tree. This refers to a logical partition in a virtual disk file. Attributes: disk_file_name (string): Specifies the disk file name where the logical partition is. length_bytes (long|int): Specifies the length of the block in bytes. number...
FilePartitionBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilePartitionBlock: """Implementation of the 'FilePartitionBlock' model. Defines a leaf node of a device tree. This refers to a logical partition in a virtual disk file. Attributes: disk_file_name (string): Specifies the disk file name where the logical partition is. length_bytes (long|int): Spec...
stack_v2_sparse_classes_36k_train_033308
2,389
permissive
[ { "docstring": "Constructor for the FilePartitionBlock class", "name": "__init__", "signature": "def __init__(self, disk_file_name=None, length_bytes=None, number=None, offset_bytes=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dic...
2
stack_v2_sparse_classes_30k_train_018994
Implement the Python class `FilePartitionBlock` described below. Class description: Implementation of the 'FilePartitionBlock' model. Defines a leaf node of a device tree. This refers to a logical partition in a virtual disk file. Attributes: disk_file_name (string): Specifies the disk file name where the logical part...
Implement the Python class `FilePartitionBlock` described below. Class description: Implementation of the 'FilePartitionBlock' model. Defines a leaf node of a device tree. This refers to a logical partition in a virtual disk file. Attributes: disk_file_name (string): Specifies the disk file name where the logical part...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FilePartitionBlock: """Implementation of the 'FilePartitionBlock' model. Defines a leaf node of a device tree. This refers to a logical partition in a virtual disk file. Attributes: disk_file_name (string): Specifies the disk file name where the logical partition is. length_bytes (long|int): Spec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilePartitionBlock: """Implementation of the 'FilePartitionBlock' model. Defines a leaf node of a device tree. This refers to a logical partition in a virtual disk file. Attributes: disk_file_name (string): Specifies the disk file name where the logical partition is. length_bytes (long|int): Specifies the len...
the_stack_v2_python_sparse
cohesity_management_sdk/models/file_partition_block.py
cohesity/management-sdk-python
train
24
cd8aead68725b00364be1e952fa36f51c8ca022e
[ "if scl_pin not in range(PMOD_NUM_DIGITAL_PINS):\n raise ValueError('Valid SCL pin numbers are 0 - {}.'.format(PMOD_NUM_DIGITAL_PINS - 1))\nif sda_pin not in range(PMOD_NUM_DIGITAL_PINS):\n raise ValueError('Valid SDA pin numbers are 0 - {}.'.format(PMOD_NUM_DIGITAL_PINS - 1))\nswitchconfig = []\nfor i in ran...
<|body_start_0|> if scl_pin not in range(PMOD_NUM_DIGITAL_PINS): raise ValueError('Valid SCL pin numbers are 0 - {}.'.format(PMOD_NUM_DIGITAL_PINS - 1)) if sda_pin not in range(PMOD_NUM_DIGITAL_PINS): raise ValueError('Valid SDA pin numbers are 0 - {}.'.format(PMOD_NUM_DIGITAL_PI...
This class controls the Pmod IIC pins. Note ---- The index of the Pmod pins: upper row, from left to right: {vdd,gnd,3,2,1,0}. lower row, from left to right: {vdd,gnd,7,6,5,4}. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module. scl_pin : int The SCL pin number. sda_pin : int The ...
Pmod_IIC
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pmod_IIC: """This class controls the Pmod IIC pins. Note ---- The index of the Pmod pins: upper row, from left to right: {vdd,gnd,3,2,1,0}. lower row, from left to right: {vdd,gnd,7,6,5,4}. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module. scl_pin : int Th...
stack_v2_sparse_classes_36k_train_033309
8,871
permissive
[ { "docstring": "Return a new instance of a Pmod IIC object. Parameters ---------- mb_info : dict A dictionary storing Microblaze information, such as the IP name and the reset name. scl_pin : int The SCL pin number. sda_pin : int The SDA pin number. iic_addr : int The IIC device address.", "name": "__init__...
4
stack_v2_sparse_classes_30k_train_006955
Implement the Python class `Pmod_IIC` described below. Class description: This class controls the Pmod IIC pins. Note ---- The index of the Pmod pins: upper row, from left to right: {vdd,gnd,3,2,1,0}. lower row, from left to right: {vdd,gnd,7,6,5,4}. Attributes ---------- microblaze : Pmod Microblaze processor instanc...
Implement the Python class `Pmod_IIC` described below. Class description: This class controls the Pmod IIC pins. Note ---- The index of the Pmod pins: upper row, from left to right: {vdd,gnd,3,2,1,0}. lower row, from left to right: {vdd,gnd,7,6,5,4}. Attributes ---------- microblaze : Pmod Microblaze processor instanc...
38e9fcee46f0839e83e123cf22af76b13671a574
<|skeleton|> class Pmod_IIC: """This class controls the Pmod IIC pins. Note ---- The index of the Pmod pins: upper row, from left to right: {vdd,gnd,3,2,1,0}. lower row, from left to right: {vdd,gnd,7,6,5,4}. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module. scl_pin : int Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pmod_IIC: """This class controls the Pmod IIC pins. Note ---- The index of the Pmod pins: upper row, from left to right: {vdd,gnd,3,2,1,0}. lower row, from left to right: {vdd,gnd,7,6,5,4}. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module. scl_pin : int The SCL pin num...
the_stack_v2_python_sparse
pynq/lib/pmod/pmod_iic.py
yunqu/PYNQ
train
8
c7e7bbab7a917f3c30e63a1489d52a55a4aeb721
[ "if not num:\n return '0'\nres = []\nchs = '0123456789abcdef'\nif num < 0:\n num += 4294967296\nwhile num:\n res.append(chs[num & 15])\n num >>= 4\nreturn ''.join(res[::-1])", "if not num:\n return '0'\nresult = []\nchs = '0123456789abcdef'\nwhile num and len(result) != 8:\n result.append(chs[nu...
<|body_start_0|> if not num: return '0' res = [] chs = '0123456789abcdef' if num < 0: num += 4294967296 while num: res.append(chs[num & 15]) num >>= 4 return ''.join(res[::-1]) <|end_body_0|> <|body_start_1|> if not...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def toHex(self, num): """:type num: int :rtype: str""" <|body_0|> def to_hex(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not num: return '0' res = [] chs = '01234...
stack_v2_sparse_classes_36k_train_033310
1,572
no_license
[ { "docstring": ":type num: int :rtype: str", "name": "toHex", "signature": "def toHex(self, num)" }, { "docstring": ":type num: int :rtype: str", "name": "to_hex", "signature": "def to_hex(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def toHex(self, num): :type num: int :rtype: str - def to_hex(self, num): :type num: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def toHex(self, num): :type num: int :rtype: str - def to_hex(self, num): :type num: int :rtype: str <|skeleton|> class Solution: def toHex(self, num): """:type num...
215d513b3564a7a76db3d2b29e4acc341a68e8ee
<|skeleton|> class Solution: def toHex(self, num): """:type num: int :rtype: str""" <|body_0|> def to_hex(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def toHex(self, num): """:type num: int :rtype: str""" if not num: return '0' res = [] chs = '0123456789abcdef' if num < 0: num += 4294967296 while num: res.append(chs[num & 15]) num >>= 4 return ...
the_stack_v2_python_sparse
python/bit-manipulation/convert-number-hexadecimal.py
euxuoh/leetcode
train
0
cc5d894753cfeaf387e145fa24773090082f6239
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
DropboxSecretServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DropboxSecretServiceServicer: """Missing associated documentation comment in .proto file.""" def getDropboxSecret(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def createDropboxSecret(self, request, context): "...
stack_v2_sparse_classes_36k_train_033311
8,451
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "getDropboxSecret", "signature": "def getDropboxSecret(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "createDropboxSecret", "signature": "de...
4
stack_v2_sparse_classes_30k_test_000548
Implement the Python class `DropboxSecretServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def getDropboxSecret(self, request, context): Missing associated documentation comment in .proto file. - def createDropboxSecret(se...
Implement the Python class `DropboxSecretServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def getDropboxSecret(self, request, context): Missing associated documentation comment in .proto file. - def createDropboxSecret(se...
c69e14b409add099d151434b9add711e41f41b20
<|skeleton|> class DropboxSecretServiceServicer: """Missing associated documentation comment in .proto file.""" def getDropboxSecret(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def createDropboxSecret(self, request, context): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DropboxSecretServiceServicer: """Missing associated documentation comment in .proto file.""" def getDropboxSecret(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not...
the_stack_v2_python_sparse
python-sdk/src/airavata_mft_sdk/dropbox/DropboxSecretService_pb2_grpc.py
apache/airavata-mft
train
23
bb37afd52d3794544c9db054d1051e4e0b485807
[ "def atMostK(k: int) -> int:\n \"\"\"子数组的最大值不大于k的子数组个数\"\"\"\n res, dp = (0, 0)\n for num in nums:\n if num <= k:\n dp += 1\n else:\n dp = 0\n res += dp\n return res\nreturn (atMostK(right) - atMostK(left - 1)) % MOD", "n = len(nums)\nres = 0\npos1, pos2 = (-...
<|body_start_0|> def atMostK(k: int) -> int: """子数组的最大值不大于k的子数组个数""" res, dp = (0, 0) for num in nums: if num <= k: dp += 1 else: dp = 0 res += dp return res return (at...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int: """解法1:容斥""" <|body_0|> def numSubarrayBoundedMax2(self, nums: List[int], lower: int, upper: int) -> int: """解法2:定界子数组""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_033312
1,422
no_license
[ { "docstring": "解法1:容斥", "name": "numSubarrayBoundedMax", "signature": "def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int" }, { "docstring": "解法2:定界子数组", "name": "numSubarrayBoundedMax2", "signature": "def numSubarrayBoundedMax2(self, nums: List[int], lower: ...
2
stack_v2_sparse_classes_30k_train_004757
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int: 解法1:容斥 - def numSubarrayBoundedMax2(self, nums: List[int], lower: int, upper: int) -> int: 解法2:定界子...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int: 解法1:容斥 - def numSubarrayBoundedMax2(self, nums: List[int], lower: int, upper: int) -> int: 解法2:定界子...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int: """解法1:容斥""" <|body_0|> def numSubarrayBoundedMax2(self, nums: List[int], lower: int, upper: int) -> int: """解法2:定界子数组""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int: """解法1:容斥""" def atMostK(k: int) -> int: """子数组的最大值不大于k的子数组个数""" res, dp = (0, 0) for num in nums: if num <= k: dp += 1 ...
the_stack_v2_python_sparse
22_专题/atMoskK/最大值在范围内的子数组个数.py
981377660LMT/algorithm-study
train
225
9fd25c9e5ad8751e86f1a0636a895838b8dbd8fd
[ "args = self.parser.parse_args()\ndata = self.build_data(args=args, collection='github_scheduler')\nreturn data", "args = self.parse_args(add_github_scheduler_fields)\nname = args.pop('name')\nkeyword = args.pop('keyword')\nkeyword = keyword.strip()\ncron = args.pop('cron')\nif not keyword:\n return utils.buil...
<|body_start_0|> args = self.parser.parse_args() data = self.build_data(args=args, collection='github_scheduler') return data <|end_body_0|> <|body_start_1|> args = self.parse_args(add_github_scheduler_fields) name = args.pop('name') keyword = args.pop('keyword') ...
ARLGithubScheduler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ARLGithubScheduler: def get(self): """Github 监控任务信息查询""" <|body_0|> def post(self): """Github 监控任务添加""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = self.parser.parse_args() data = self.build_data(args=args, collection='github_schedul...
stack_v2_sparse_classes_36k_train_033313
6,973
no_license
[ { "docstring": "Github 监控任务信息查询", "name": "get", "signature": "def get(self)" }, { "docstring": "Github 监控任务添加", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `ARLGithubScheduler` described below. Class description: Implement the ARLGithubScheduler class. Method signatures and docstrings: - def get(self): Github 监控任务信息查询 - def post(self): Github 监控任务添加
Implement the Python class `ARLGithubScheduler` described below. Class description: Implement the ARLGithubScheduler class. Method signatures and docstrings: - def get(self): Github 监控任务信息查询 - def post(self): Github 监控任务添加 <|skeleton|> class ARLGithubScheduler: def get(self): """Github 监控任务信息查询""" ...
5ca64806252b9e7e6d2b31a6bfaeecbfdc4baf06
<|skeleton|> class ARLGithubScheduler: def get(self): """Github 监控任务信息查询""" <|body_0|> def post(self): """Github 监控任务添加""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ARLGithubScheduler: def get(self): """Github 监控任务信息查询""" args = self.parser.parse_args() data = self.build_data(args=args, collection='github_scheduler') return data def post(self): """Github 监控任务添加""" args = self.parse_args(add_github_scheduler_fields) ...
the_stack_v2_python_sparse
app/routes/github_scheduler.py
QmF0c3UK/ARL
train
0
8f98070c522168a4c16dec9236f9246f91e67875
[ "if config.IS_WINDOWS:\n path = str(config.my_datadir / 'prints')\nelse:\n doc_dir = storagepath.get_documents_dir()\n recommended_path = os.path.join(doc_dir, filename)\n path = filechooser.choose_dir(multiple=False, path=recommended_path)\nif isinstance(path, List):\n if len(path) > 0:\n pat...
<|body_start_0|> if config.IS_WINDOWS: path = str(config.my_datadir / 'prints') else: doc_dir = storagepath.get_documents_dir() recommended_path = os.path.join(doc_dir, filename) path = filechooser.choose_dir(multiple=False, path=recommended_path) ...
A service to handle all of the printing needs of the application Due to difficulties with cross platform apis, this class creates a relevant pdf file and instructs the system to open it allowing the user to print
PrintService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrintService: """A service to handle all of the printing needs of the application Due to difficulties with cross platform apis, this class creates a relevant pdf file and instructs the system to open it allowing the user to print""" def _get_output_pdf_name(self, filename='printme'): ...
stack_v2_sparse_classes_36k_train_033314
6,875
no_license
[ { "docstring": "Finds out where to save the pdf to Currently asks the user but could be changed to give a tmp directory before sending the file to the printer", "name": "_get_output_pdf_name", "signature": "def _get_output_pdf_name(self, filename='printme')" }, { "docstring": "Create an address ...
4
stack_v2_sparse_classes_30k_train_004144
Implement the Python class `PrintService` described below. Class description: A service to handle all of the printing needs of the application Due to difficulties with cross platform apis, this class creates a relevant pdf file and instructs the system to open it allowing the user to print Method signatures and docst...
Implement the Python class `PrintService` described below. Class description: A service to handle all of the printing needs of the application Due to difficulties with cross platform apis, this class creates a relevant pdf file and instructs the system to open it allowing the user to print Method signatures and docst...
7be0791d8bc0ba30c984d6c99a1094c5267479e6
<|skeleton|> class PrintService: """A service to handle all of the printing needs of the application Due to difficulties with cross platform apis, this class creates a relevant pdf file and instructs the system to open it allowing the user to print""" def _get_output_pdf_name(self, filename='printme'): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrintService: """A service to handle all of the printing needs of the application Due to difficulties with cross platform apis, this class creates a relevant pdf file and instructs the system to open it allowing the user to print""" def _get_output_pdf_name(self, filename='printme'): """Finds out...
the_stack_v2_python_sparse
services/print_service.py
eperegrine/ECM2429-StockManager
train
1
47a3047af5163b39d387bc307425cd0236ce6312
[ "super(IBMCNN, self).__init__()\nself.params = params\nif params.train_embeddings:\n self.embedding = nn.Embedding(num_embeddings=params.num_embeddings, embedding_dim=params.embedding_dim)\nself.convs = nn.ModuleList([nn.Conv2d(in_channels=1, out_channels=params.num_filters, kernel_size=(fs, params.embedding_dim...
<|body_start_0|> super(IBMCNN, self).__init__() self.params = params if params.train_embeddings: self.embedding = nn.Embedding(num_embeddings=params.num_embeddings, embedding_dim=params.embedding_dim) self.convs = nn.ModuleList([nn.Conv2d(in_channels=1, out_channels=params.nu...
CNN Model from IBM paper.
IBMCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IBMCNN: """CNN Model from IBM paper.""" def __init__(self, params): """params: hyperparameters / settings of the model train_embeddings: train new embeddings? num_embeddings: number of embeddings (i.e. # of tokens) embedding dim: word embedding dimension (200) positional_embedding di...
stack_v2_sparse_classes_36k_train_033315
9,205
no_license
[ { "docstring": "params: hyperparameters / settings of the model train_embeddings: train new embeddings? num_embeddings: number of embeddings (i.e. # of tokens) embedding dim: word embedding dimension (200) positional_embedding dim (50) (optional) TODO: what is this? POS embedding dim (20) (optional) TODO: what ...
2
null
Implement the Python class `IBMCNN` described below. Class description: CNN Model from IBM paper. Method signatures and docstrings: - def __init__(self, params): params: hyperparameters / settings of the model train_embeddings: train new embeddings? num_embeddings: number of embeddings (i.e. # of tokens) embedding di...
Implement the Python class `IBMCNN` described below. Class description: CNN Model from IBM paper. Method signatures and docstrings: - def __init__(self, params): params: hyperparameters / settings of the model train_embeddings: train new embeddings? num_embeddings: number of embeddings (i.e. # of tokens) embedding di...
5440470024a080e77f29374569f9d09f913280e7
<|skeleton|> class IBMCNN: """CNN Model from IBM paper.""" def __init__(self, params): """params: hyperparameters / settings of the model train_embeddings: train new embeddings? num_embeddings: number of embeddings (i.e. # of tokens) embedding dim: word embedding dimension (200) positional_embedding di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IBMCNN: """CNN Model from IBM paper.""" def __init__(self, params): """params: hyperparameters / settings of the model train_embeddings: train new embeddings? num_embeddings: number of embeddings (i.e. # of tokens) embedding dim: word embedding dimension (200) positional_embedding dim (50) (optio...
the_stack_v2_python_sparse
train_model/cnn_model.py
jacobjinkelly/clinical-ad
train
3
a1c715954f37ba2956a93a61d5e22e7dbf74cff4
[ "self.failed_processes = []\nself.cnt_proc_total = 0\nself.cnt_proc_ok = 0\nself.cnt_proc_fail = 0\ncontext.initialise(config_file_name, verbose, dry_run, global_overrides)", "logger.info('Starting the load.')\nself.failed_processes = []\nself.cnt_proc_total = 0\nself.cnt_proc_ok = 0\nself.cnt_proc_fail = 0\nfor ...
<|body_start_0|> self.failed_processes = [] self.cnt_proc_total = 0 self.cnt_proc_ok = 0 self.cnt_proc_fail = 0 context.initialise(config_file_name, verbose, dry_run, global_overrides) <|end_body_0|> <|body_start_1|> logger.info('Starting the load.') self.failed_...
A flexible data loader driven by a configuration file, that is passed in the constructor.
Loader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Loader: """A flexible data loader driven by a configuration file, that is passed in the constructor.""" def __init__(self, config_file_name: str, verbose: [bool, None], dry_run: bool, global_overrides: dict): """Constructor. :param config_file_name: Path to the configuration file in ...
stack_v2_sparse_classes_36k_train_033316
5,880
no_license
[ { "docstring": "Constructor. :param config_file_name: Path to the configuration file in JSON format. :param verbose: Whether verbose logging is to be used. If not None, overrides logging verbosity setting given in the configuration file. :param dry_run: Whether to avoid making changes to DB. :param global_overr...
3
stack_v2_sparse_classes_30k_train_007753
Implement the Python class `Loader` described below. Class description: A flexible data loader driven by a configuration file, that is passed in the constructor. Method signatures and docstrings: - def __init__(self, config_file_name: str, verbose: [bool, None], dry_run: bool, global_overrides: dict): Constructor. :p...
Implement the Python class `Loader` described below. Class description: A flexible data loader driven by a configuration file, that is passed in the constructor. Method signatures and docstrings: - def __init__(self, config_file_name: str, verbose: [bool, None], dry_run: bool, global_overrides: dict): Constructor. :p...
0e7e13fa30091880ad70014965c5638854987d7e
<|skeleton|> class Loader: """A flexible data loader driven by a configuration file, that is passed in the constructor.""" def __init__(self, config_file_name: str, verbose: [bool, None], dry_run: bool, global_overrides: dict): """Constructor. :param config_file_name: Path to the configuration file in ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Loader: """A flexible data loader driven by a configuration file, that is passed in the constructor.""" def __init__(self, config_file_name: str, verbose: [bool, None], dry_run: bool, global_overrides: dict): """Constructor. :param config_file_name: Path to the configuration file in JSON format. ...
the_stack_v2_python_sparse
pkg/etl/loader.py
yktoo/rattle
train
0
d0886dea4a083db79b295d4d67930d37342e563d
[ "if not root:\n return ''\nstack = [root]\nres = []\nwhile stack:\n node = stack.pop()\n if node:\n res.append(str(node.val))\n stack.append(node.left)\n stack.append(node.right)\n else:\n res.append('null')\nreturn ','.join(res)", "if not data:\n return None\nvals = dat...
<|body_start_0|> if not root: return '' stack = [root] res = [] while stack: node = stack.pop() if node: res.append(str(node.val)) stack.append(node.left) stack.append(node.right) else: ...
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_36k_train_033317
3,621
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:...
dbdb227e12f329e4ca064b338f1fbdca42f3a848
<|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_36k
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 '' stack = [root] res = [] while stack: node = stack.pop() if node: res.append(str(node.va...
the_stack_v2_python_sparse
LC297.py
Qiao-Liang/LeetCode
train
0
f4cf9c45504c6104bd3ee264b91dff8d1f1f1cd7
[ "\"\"\"\n https: // blog.csdn.net / qq_17550379 / article / details / 85234090\n 判断4个点到中点的距离是否一致即可判断矩形!!\n \"\"\"\nfrom itertools import combinations, permutations\n\ndef isRectangle(p1, p2, p3, p4):\n\n def _dis(p1, p2):\n return (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2\n x_c =...
<|body_start_0|> """ https: // blog.csdn.net / qq_17550379 / article / details / 85234090 判断4个点到中点的距离是否一致即可判断矩形!! """ from itertools import combinations, permutations def isRectangle(p1, p2, p3, p4): def _dis(p1, p2): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minAreaFreeRect(self, points): """:type points: List[List[int]] :rtype: float overtime""" <|body_0|> def minAreaFreeRect_1(self, points): """:type points: List[List[int]] :rtype: float 120 ms 13.3 MB""" <|body_1|> def minAreaFreeRect_2(self...
stack_v2_sparse_classes_36k_train_033318
5,573
no_license
[ { "docstring": ":type points: List[List[int]] :rtype: float overtime", "name": "minAreaFreeRect", "signature": "def minAreaFreeRect(self, points)" }, { "docstring": ":type points: List[List[int]] :rtype: float 120 ms 13.3 MB", "name": "minAreaFreeRect_1", "signature": "def minAreaFreeRec...
3
stack_v2_sparse_classes_30k_train_001106
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaFreeRect(self, points): :type points: List[List[int]] :rtype: float overtime - def minAreaFreeRect_1(self, points): :type points: List[List[int]] :rtype: float 120 ms ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaFreeRect(self, points): :type points: List[List[int]] :rtype: float overtime - def minAreaFreeRect_1(self, points): :type points: List[List[int]] :rtype: float 120 ms ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def minAreaFreeRect(self, points): """:type points: List[List[int]] :rtype: float overtime""" <|body_0|> def minAreaFreeRect_1(self, points): """:type points: List[List[int]] :rtype: float 120 ms 13.3 MB""" <|body_1|> def minAreaFreeRect_2(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minAreaFreeRect(self, points): """:type points: List[List[int]] :rtype: float overtime""" """ https: // blog.csdn.net / qq_17550379 / article / details / 85234090 判断4个点到中点的距离是否一致即可判断矩形!! """ from itertools import combination...
the_stack_v2_python_sparse
MinimumAreaRectangleII_MID_963.py
953250587/leetcode-python
train
2
f34ed7cefef032834977ea80bb5298dd76215b3e
[ "warning_suffix = 'which will cause some Telemetry tests to stall when run on a headless machine (e.g. perf bot).'\nif keychain_helper.IsKeychainLocked():\n logging.warning('The default keychain is locked, %s', warning_suffix)\nif keychain_helper.DoesKeychainHaveTimeout():\n logging.warning('The default keych...
<|body_start_0|> warning_suffix = 'which will cause some Telemetry tests to stall when run on a headless machine (e.g. perf bot).' if keychain_helper.IsKeychainLocked(): logging.warning('The default keychain is locked, %s', warning_suffix) if keychain_helper.DoesKeychainHaveTimeout()...
KeychainMetric gathers keychain statistics from the browser object. This includes the number of times that the keychain was accessed.
KeychainMetric
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeychainMetric: """KeychainMetric gathers keychain statistics from the browser object. This includes the number of times that the keychain was accessed.""" def _CheckKeychainConfiguration(): """On OSX, it is possible for a misconfigured keychain to cause the Telemetry tests to stall....
stack_v2_sparse_classes_36k_train_033319
2,966
permissive
[ { "docstring": "On OSX, it is possible for a misconfigured keychain to cause the Telemetry tests to stall. This method confirms that the keychain is in a sane state that will not cause this behavior. Three conditions are checked: - The keychain is unlocked. - The keychain will not auto-lock after a period of ti...
3
stack_v2_sparse_classes_30k_train_020735
Implement the Python class `KeychainMetric` described below. Class description: KeychainMetric gathers keychain statistics from the browser object. This includes the number of times that the keychain was accessed. Method signatures and docstrings: - def _CheckKeychainConfiguration(): On OSX, it is possible for a misc...
Implement the Python class `KeychainMetric` described below. Class description: KeychainMetric gathers keychain statistics from the browser object. This includes the number of times that the keychain was accessed. Method signatures and docstrings: - def _CheckKeychainConfiguration(): On OSX, it is possible for a misc...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class KeychainMetric: """KeychainMetric gathers keychain statistics from the browser object. This includes the number of times that the keychain was accessed.""" def _CheckKeychainConfiguration(): """On OSX, it is possible for a misconfigured keychain to cause the Telemetry tests to stall....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeychainMetric: """KeychainMetric gathers keychain statistics from the browser object. This includes the number of times that the keychain was accessed.""" def _CheckKeychainConfiguration(): """On OSX, it is possible for a misconfigured keychain to cause the Telemetry tests to stall. This method ...
the_stack_v2_python_sparse
tools/perf/metrics/keychain_metric.py
metux/chromium-suckless
train
5
f5a0fd43b0d104e3a05d49c794231261362352e3
[ "review: Review = self.get_object()\nif review.company.reviews.filter(is_top=True).count() >= 10:\n raise MaxFavoriteReview\nreview.is_top = True\nreview.save()\nserializer: ReviewSerializer = self.get_serializer(instance=review)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)", "review: Revi...
<|body_start_0|> review: Review = self.get_object() if review.company.reviews.filter(is_top=True).count() >= 10: raise MaxFavoriteReview review.is_top = True review.save() serializer: ReviewSerializer = self.get_serializer(instance=review) return Response(data...
Review favorite view.
ReviewTop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewTop: """Review favorite view.""" def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Set the review as favorite. :param request: Request :return: Review instance""" <|body_0|> def delete(self, request: Request, *args: tuple, **kwargs: dic...
stack_v2_sparse_classes_36k_train_033320
5,590
no_license
[ { "docstring": "Set the review as favorite. :param request: Request :return: Review instance", "name": "post", "signature": "def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response" }, { "docstring": "Unset the review as favorite. :param request: Request :return: Review instan...
2
null
Implement the Python class `ReviewTop` described below. Class description: Review favorite view. Method signatures and docstrings: - def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Set the review as favorite. :param request: Request :return: Review instance - def delete(self, request: Requ...
Implement the Python class `ReviewTop` described below. Class description: Review favorite view. Method signatures and docstrings: - def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Set the review as favorite. :param request: Request :return: Review instance - def delete(self, request: Requ...
713b9d84ac70d964d46f189ab1f9c7b944b9684b
<|skeleton|> class ReviewTop: """Review favorite view.""" def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Set the review as favorite. :param request: Request :return: Review instance""" <|body_0|> def delete(self, request: Request, *args: tuple, **kwargs: dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReviewTop: """Review favorite view.""" def post(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Set the review as favorite. :param request: Request :return: Review instance""" review: Review = self.get_object() if review.company.reviews.filter(is_top=True).co...
the_stack_v2_python_sparse
jobadvisor/reviews/views/review.py
ewgen19892/jobadvisor
train
0
13e5ed456a5487e73014f09daee43e92150b07d3
[ "nums = []\np = head\nwhile p is not None:\n nums.append(p.val)\n p = p.next\nreturn self.sortedArrayToBST(nums)", "if len(nums) == 0:\n return None\nmid_index = len(nums) >> 1\nnode = TreeNode(nums[mid_index])\nnode.left = self.sortedArrayToBST(nums[:mid_index])\nnode.right = self.sortedArrayToBST(nums[...
<|body_start_0|> nums = [] p = head while p is not None: nums.append(p.val) p = p.next return self.sortedArrayToBST(nums) <|end_body_0|> <|body_start_1|> if len(nums) == 0: return None mid_index = len(nums) >> 1 node = TreeNode...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = [] p = head ...
stack_v2_sparse_classes_36k_train_033321
864
permissive
[ { "docstring": ":type head: ListNode :rtype: TreeNode", "name": "sortedListToBST", "signature": "def sortedListToBST(self, head)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "sortedArrayToBST", "signature": "def sortedArrayToBST(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode <|skeleton|> class Solution: ...
3f05fff7758d650469862bc28df9e4aa7b1d3203
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" nums = [] p = head while p is not None: nums.append(p.val) p = p.next return self.sortedArrayToBST(nums) def sortedArrayToBST(self, nums): """:typ...
the_stack_v2_python_sparse
solutions/solution109.py
Satily/leetcode_python_solution
train
3
ab90881aa96dca170e0e8e8b851f933ec9d18576
[ "if context is None:\n context = {}\nvalue = {}\nif not begin_production_date:\n return value\nif not end_production_date and (not production_duration):\n duration = 1.0\n value[production_duration] = duration\nstart = datetime.strptime(begin_production_date, '%Y-%m-%d %H:%M:%S')\nif end_production_date...
<|body_start_0|> if context is None: context = {} value = {} if not begin_production_date: return value if not end_production_date and (not production_duration): duration = 1.0 value[production_duration] = duration start = datetime....
mrp_production
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mrp_production: def onchange_production_dates(self, cr, uid, ids, begin_production_date, end_production_date, production_duration, context=None): """Returns duration and/or end date based on values passed""" <|body_0|> def _calculate_emps_cost(self, cr, uid, ids, name, args,...
stack_v2_sparse_classes_36k_train_033322
16,568
no_license
[ { "docstring": "Returns duration and/or end date based on values passed", "name": "onchange_production_dates", "signature": "def onchange_production_dates(self, cr, uid, ids, begin_production_date, end_production_date, production_duration, context=None)" }, { "docstring": "Functional field metho...
3
null
Implement the Python class `mrp_production` described below. Class description: Implement the mrp_production class. Method signatures and docstrings: - def onchange_production_dates(self, cr, uid, ids, begin_production_date, end_production_date, production_duration, context=None): Returns duration and/or end date bas...
Implement the Python class `mrp_production` described below. Class description: Implement the mrp_production class. Method signatures and docstrings: - def onchange_production_dates(self, cr, uid, ids, begin_production_date, end_production_date, production_duration, context=None): Returns duration and/or end date bas...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class mrp_production: def onchange_production_dates(self, cr, uid, ids, begin_production_date, end_production_date, production_duration, context=None): """Returns duration and/or end date based on values passed""" <|body_0|> def _calculate_emps_cost(self, cr, uid, ids, name, args,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mrp_production: def onchange_production_dates(self, cr, uid, ids, begin_production_date, end_production_date, production_duration, context=None): """Returns duration and/or end date based on values passed""" if context is None: context = {} value = {} if not begin_p...
the_stack_v2_python_sparse
v_7/GDS/shamil_v3/production_costs/mrp_production.py
musabahmed/baba
train
0
48b2e6ab04d420b27bf456ea452c39997d7260d2
[ "super().__init__()\nif equivalence_library is None:\n from qiskit.circuit.library.standard_gates.equivalence_library import _sel\n equivalence_library = _sel\nif target is not None:\n supported_gates = target.operation_names\nelif supported_gates is None:\n raise ValueError('One of ``supported_gates`` ...
<|body_start_0|> super().__init__() if equivalence_library is None: from qiskit.circuit.library.standard_gates.equivalence_library import _sel equivalence_library = _sel if target is not None: supported_gates = target.operation_names elif supported_gat...
Translate parameterized gates to a supported basis set. Once a parameterized instruction is found that is not in the ``supported_gates`` list, the instruction is decomposed one level and the parameterized sub-blocks are recursively decomposed. The recursion is stopped once all parameterized gates are in ``supported_gat...
TranslateParameterizedGates
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TranslateParameterizedGates: """Translate parameterized gates to a supported basis set. Once a parameterized instruction is found that is not in the ``supported_gates`` list, the instruction is decomposed one level and the parameterized sub-blocks are recursively decomposed. The recursion is stop...
stack_v2_sparse_classes_36k_train_033323
7,377
permissive
[ { "docstring": "Args: supported_gates: A list of suppported basis gates specified as string. If ``None``, a ``target`` must be provided. equivalence_library: The equivalence library to translate the gates. Defaults to the equivalence library of all Qiskit standard gates. target: A :class:`.Target` containing th...
2
null
Implement the Python class `TranslateParameterizedGates` described below. Class description: Translate parameterized gates to a supported basis set. Once a parameterized instruction is found that is not in the ``supported_gates`` list, the instruction is decomposed one level and the parameterized sub-blocks are recurs...
Implement the Python class `TranslateParameterizedGates` described below. Class description: Translate parameterized gates to a supported basis set. Once a parameterized instruction is found that is not in the ``supported_gates`` list, the instruction is decomposed one level and the parameterized sub-blocks are recurs...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class TranslateParameterizedGates: """Translate parameterized gates to a supported basis set. Once a parameterized instruction is found that is not in the ``supported_gates`` list, the instruction is decomposed one level and the parameterized sub-blocks are recursively decomposed. The recursion is stop...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TranslateParameterizedGates: """Translate parameterized gates to a supported basis set. Once a parameterized instruction is found that is not in the ``supported_gates`` list, the instruction is decomposed one level and the parameterized sub-blocks are recursively decomposed. The recursion is stopped once all ...
the_stack_v2_python_sparse
qiskit/transpiler/passes/basis/translate_parameterized.py
1ucian0/qiskit-terra
train
6
aef611da3744d541965cbd13495847386d6e053c
[ "generic_numbers = deepcopy(self.generic_numbers)\nmerged_num = False\nfor ns, segments in generic_numbers.items():\n for segment, positions in segments.items():\n for pos, dns in positions.items():\n if not dns:\n self.generic_numbers[ns][segment][pos] = ''\n elif len...
<|body_start_0|> generic_numbers = deepcopy(self.generic_numbers) merged_num = False for ns, segments in generic_numbers.items(): for segment, positions in segments.items(): for pos, dns in positions.items(): if not dns: sel...
A class representing a protein sequence alignment, with or without a reference sequence
Alignment
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Alignment: """A class representing a protein sequence alignment, with or without a reference sequence""" def merge_generic_numbers(self): """Check whether there are many display numbers for each position, and merge them if there are""" <|body_0|> def format_generic_numbe...
stack_v2_sparse_classes_36k_train_033324
4,473
permissive
[ { "docstring": "Check whether there are many display numbers for each position, and merge them if there are", "name": "merge_generic_numbers", "signature": "def merge_generic_numbers(self)" }, { "docstring": "Format a generic number for display in alignment viewer", "name": "format_generic_n...
2
null
Implement the Python class `Alignment` described below. Class description: A class representing a protein sequence alignment, with or without a reference sequence Method signatures and docstrings: - def merge_generic_numbers(self): Check whether there are many display numbers for each position, and merge them if ther...
Implement the Python class `Alignment` described below. Class description: A class representing a protein sequence alignment, with or without a reference sequence Method signatures and docstrings: - def merge_generic_numbers(self): Check whether there are many display numbers for each position, and merge them if ther...
75993654db2b36e2a8f67fa38f9c9428ee4b4d90
<|skeleton|> class Alignment: """A class representing a protein sequence alignment, with or without a reference sequence""" def merge_generic_numbers(self): """Check whether there are many display numbers for each position, and merge them if there are""" <|body_0|> def format_generic_numbe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Alignment: """A class representing a protein sequence alignment, with or without a reference sequence""" def merge_generic_numbers(self): """Check whether there are many display numbers for each position, and merge them if there are""" generic_numbers = deepcopy(self.generic_numbers) ...
the_stack_v2_python_sparse
common/alignment_gpcr.py
protwis/protwis
train
31
62dc864dc36fc2972df3aa3bd2511b7647f79019
[ "self.tr_list = []\nif not isinstance(list_of_op_obj_pairs, list):\n raise ValueError('Needs List of (operation, obj) pairs')\nfor pair in list_of_op_obj_pairs:\n if not isinstance(pair, tuple):\n raise ValueError('Needs List of (operation, obj) pairs')\n op = pair[0]\n op_map = {'create': self.c...
<|body_start_0|> self.tr_list = [] if not isinstance(list_of_op_obj_pairs, list): raise ValueError('Needs List of (operation, obj) pairs') for pair in list_of_op_obj_pairs: if not isinstance(pair, tuple): raise ValueError('Needs List of (operation, obj) pa...
CPSTransaction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CPSTransaction: def __init__(self, list_of_op_obj_pairs=[]): """Constructor for a transaction object. @list_of_op_obj_pairs - list of tupples which contains the type of operation("create","set","delete","rpc") and the object. Based on the type of operation it will add the object to trans...
stack_v2_sparse_classes_36k_train_033325
3,331
permissive
[ { "docstring": "Constructor for a transaction object. @list_of_op_obj_pairs - list of tupples which contains the type of operation(\"create\",\"set\",\"delete\",\"rpc\") and the object. Based on the type of operation it will add the object to transaction list.", "name": "__init__", "signature": "def __i...
6
stack_v2_sparse_classes_30k_train_016950
Implement the Python class `CPSTransaction` described below. Class description: Implement the CPSTransaction class. Method signatures and docstrings: - def __init__(self, list_of_op_obj_pairs=[]): Constructor for a transaction object. @list_of_op_obj_pairs - list of tupples which contains the type of operation("creat...
Implement the Python class `CPSTransaction` described below. Class description: Implement the CPSTransaction class. Method signatures and docstrings: - def __init__(self, list_of_op_obj_pairs=[]): Constructor for a transaction object. @list_of_op_obj_pairs - list of tupples which contains the type of operation("creat...
3c4f0e1dfa1fa8df1dd85d99414820ce8c733a55
<|skeleton|> class CPSTransaction: def __init__(self, list_of_op_obj_pairs=[]): """Constructor for a transaction object. @list_of_op_obj_pairs - list of tupples which contains the type of operation("create","set","delete","rpc") and the object. Based on the type of operation it will add the object to trans...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CPSTransaction: def __init__(self, list_of_op_obj_pairs=[]): """Constructor for a transaction object. @list_of_op_obj_pairs - list of tupples which contains the type of operation("create","set","delete","rpc") and the object. Based on the type of operation it will add the object to transaction list.""...
the_stack_v2_python_sparse
scripts/lib/cps_operations.py
HolyShitMan/sonic-object-library
train
0
f0cb0dcc3309ea1fc00afd7d0543b4e64691ef4d
[ "super().__init__(intrinsic_signal_provider_arch=intrinsic_signal_provider_arch, **kwargs)\nself._gradient_clipping = gradient_clipping\nself._gradient_norm_clipping = gradient_norm_clipping\nself._device = torch.device(device if torch.cuda.is_available() and device != 'cpu' else 'cpu')", "if self._gradient_clipp...
<|body_start_0|> super().__init__(intrinsic_signal_provider_arch=intrinsic_signal_provider_arch, **kwargs) self._gradient_clipping = gradient_clipping self._gradient_norm_clipping = gradient_norm_clipping self._device = torch.device(device if torch.cuda.is_available() and device != 'cpu'...
TorchAgent
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchAgent: def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), intrinsic_signal_provider_arch: IntrinsicSignalProvider=BraindeadIntrinsic...
stack_v2_sparse_classes_36k_train_033326
6,650
permissive
[ { "docstring": ":param device: :param gradient_clipping: :param grad_clip_low: :param grad_clip_high: :param kwargs:", "name": "__init__", "signature": "def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clip...
2
stack_v2_sparse_classes_30k_train_014918
Implement the Python class `TorchAgent` described below. Class description: Implement the TorchAgent class. Method signatures and docstrings: - def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=...
Implement the Python class `TorchAgent` described below. Class description: Implement the TorchAgent class. Method signatures and docstrings: - def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=...
21e3564696062b67151b013fd5e47df46cf44aa5
<|skeleton|> class TorchAgent: def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), intrinsic_signal_provider_arch: IntrinsicSignalProvider=BraindeadIntrinsic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TorchAgent: def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), intrinsic_signal_provider_arch: IntrinsicSignalProvider=BraindeadIntrinsicSignalProvider...
the_stack_v2_python_sparse
neodroidagent/agents/torch_agents/torch_agent.py
sintefneodroid/agent
train
9
b687a082f7bdae588d2931076c735d695c8e0477
[ "self.name = name\nself.failed = failed\nself.trimmed_messages = trimmed_messages\nself.messages = messages", "all_messages = self.messages[:]\nstatus_message = '%s %s check %s' % ((FAILED_MESSAGE_PREFIX, self.name, 'failed') if self.failed else (SUCCESS_MESSAGE_PREFIX, self.name, 'passed'))\nall_messages.append(...
<|body_start_0|> self.name = name self.failed = failed self.trimmed_messages = trimmed_messages self.messages = messages <|end_body_0|> <|body_start_1|> all_messages = self.messages[:] status_message = '%s %s check %s' % ((FAILED_MESSAGE_PREFIX, self.name, 'failed') if s...
Task result for concurrent_task_utils.
TaskResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskResult: """Task result for concurrent_task_utils.""" def __init__(self, name: str, failed: bool, trimmed_messages: List[str], messages: List[str]) -> None: """Constructs a TaskResult object. Args: name: str. The name of the task. failed: bool. The boolean value representing wheth...
stack_v2_sparse_classes_36k_train_033327
7,841
permissive
[ { "docstring": "Constructs a TaskResult object. Args: name: str. The name of the task. failed: bool. The boolean value representing whether the task failed. trimmed_messages: list(str). List of error messages that are trimmed to keep main part of messages. messages: list(str). List of full messages returned by ...
2
stack_v2_sparse_classes_30k_train_004616
Implement the Python class `TaskResult` described below. Class description: Task result for concurrent_task_utils. Method signatures and docstrings: - def __init__(self, name: str, failed: bool, trimmed_messages: List[str], messages: List[str]) -> None: Constructs a TaskResult object. Args: name: str. The name of the...
Implement the Python class `TaskResult` described below. Class description: Task result for concurrent_task_utils. Method signatures and docstrings: - def __init__(self, name: str, failed: bool, trimmed_messages: List[str], messages: List[str]) -> None: Constructs a TaskResult object. Args: name: str. The name of the...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class TaskResult: """Task result for concurrent_task_utils.""" def __init__(self, name: str, failed: bool, trimmed_messages: List[str], messages: List[str]) -> None: """Constructs a TaskResult object. Args: name: str. The name of the task. failed: bool. The boolean value representing wheth...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskResult: """Task result for concurrent_task_utils.""" def __init__(self, name: str, failed: bool, trimmed_messages: List[str], messages: List[str]) -> None: """Constructs a TaskResult object. Args: name: str. The name of the task. failed: bool. The boolean value representing whether the task f...
the_stack_v2_python_sparse
scripts/concurrent_task_utils.py
oppia/oppia
train
6,172
3024ef2c5cf655e8cdec3c7599e7fc864aa608fb
[ "self.set = set()\nself.table = collections.defaultdict(int)\nself.total = 0", "self.set.add(timestamp)\nself.table[timestamp] += 1\nself.total += 1\ntmp = min(self.set)\nwhile timestamp - tmp >= 300:\n self.total -= self.table[tmp]\n self.table[tmp] = 0\n self.set.remove(tmp)\n tmp = min(self.set)", ...
<|body_start_0|> self.set = set() self.table = collections.defaultdict(int) self.total = 0 <|end_body_0|> <|body_start_1|> self.set.add(timestamp) self.table[timestamp] += 1 self.total += 1 tmp = min(self.set) while timestamp - tmp >= 300: sel...
HitCounter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granularity).""" <|body_1|> def getHits(self, timestamp: in...
stack_v2_sparse_classes_36k_train_033328
1,412
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Record a hit. @param timestamp - The current timestamp (in seconds granularity).", "name": "hit", "signature": "def hit(self, timestamp: int) -> None" }, { ...
3
stack_v2_sparse_classes_30k_train_016509
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp: int) -> None: Record a hit. @param timestamp - The current timestamp (in seconds granulari...
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp: int) -> None: Record a hit. @param timestamp - The current timestamp (in seconds granulari...
54d0b3c237e0ffed8782915d6b75b7c6a0fe0de7
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granularity).""" <|body_1|> def getHits(self, timestamp: in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HitCounter: def __init__(self): """Initialize your data structure here.""" self.set = set() self.table = collections.defaultdict(int) self.total = 0 def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granula...
the_stack_v2_python_sparse
0362_Design_Hit_Counter/try_2.py
novayo/LeetCode
train
8
d435ec027339a4203f66d52808c84280c99b60be
[ "caption = 'Test caption'\nr = ReviewRequest.objects.filter(public=True, status='P', submitter=self.user)[0]\nr.screenshots = []\nr.save()\nself.selenium.open(r.get_absolute_url())\nself.selenium.click('upload-screenshot-link')\nself.selenium.type('id_caption', caption)\nself.selenium.focus('id_path')\nself.seleniu...
<|body_start_0|> caption = 'Test caption' r = ReviewRequest.objects.filter(public=True, status='P', submitter=self.user)[0] r.screenshots = [] r.save() self.selenium.open(r.get_absolute_url()) self.selenium.click('upload-screenshot-link') self.selenium.type('id_ca...
Testing screenshot functionality.
ScreenshotTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScreenshotTests: """Testing screenshot functionality.""" def test_upload_screenshot(self): """Testing uploading a screenshot""" <|body_0|> def test_modify_screenshot_caption(self): """Testing modifying a screenshot's caption on a review request""" <|body_...
stack_v2_sparse_classes_36k_train_033329
42,469
permissive
[ { "docstring": "Testing uploading a screenshot", "name": "test_upload_screenshot", "signature": "def test_upload_screenshot(self)" }, { "docstring": "Testing modifying a screenshot's caption on a review request", "name": "test_modify_screenshot_caption", "signature": "def test_modify_scr...
3
stack_v2_sparse_classes_30k_train_011664
Implement the Python class `ScreenshotTests` described below. Class description: Testing screenshot functionality. Method signatures and docstrings: - def test_upload_screenshot(self): Testing uploading a screenshot - def test_modify_screenshot_caption(self): Testing modifying a screenshot's caption on a review reque...
Implement the Python class `ScreenshotTests` described below. Class description: Testing screenshot functionality. Method signatures and docstrings: - def test_upload_screenshot(self): Testing uploading a screenshot - def test_modify_screenshot_caption(self): Testing modifying a screenshot's caption on a review reque...
2095bcf4e36961ad12f8917a14f5670a4ec1408c
<|skeleton|> class ScreenshotTests: """Testing screenshot functionality.""" def test_upload_screenshot(self): """Testing uploading a screenshot""" <|body_0|> def test_modify_screenshot_caption(self): """Testing modifying a screenshot's caption on a review request""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScreenshotTests: """Testing screenshot functionality.""" def test_upload_screenshot(self): """Testing uploading a screenshot""" caption = 'Test caption' r = ReviewRequest.objects.filter(public=True, status='P', submitter=self.user)[0] r.screenshots = [] r.save() ...
the_stack_v2_python_sparse
webtests/tests.py
dorothyk/reviewboard
train
1
7778a269b3ec39862b6e8813fa22c03c03665439
[ "logger.debug('CreateNSView::get')\nret = GetNSInfoService().get_ns_info()\nlogger.debug('CreateNSView::get::ret=%s', ret)\nresp_serializer = _QueryNsRespSerializer(data=ret, many=True)\nif not resp_serializer.is_valid():\n raise NSLCMException(resp_serializer.errors)\nreturn Response(data=ret, status=status.HTT...
<|body_start_0|> logger.debug('CreateNSView::get') ret = GetNSInfoService().get_ns_info() logger.debug('CreateNSView::get::ret=%s', ret) resp_serializer = _QueryNsRespSerializer(data=ret, many=True) if not resp_serializer.is_valid(): raise NSLCMException(resp_serializ...
CreateNSView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateNSView: def get(self, request): """Query multiple NS instances :param request: :return:""" <|body_0|> def post(self, request): """Create a NS instance resource :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> logger.deb...
stack_v2_sparse_classes_36k_train_033330
4,085
permissive
[ { "docstring": "Query multiple NS instances :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create a NS instance resource :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `CreateNSView` described below. Class description: Implement the CreateNSView class. Method signatures and docstrings: - def get(self, request): Query multiple NS instances :param request: :return: - def post(self, request): Create a NS instance resource :param request: :return:
Implement the Python class `CreateNSView` described below. Class description: Implement the CreateNSView class. Method signatures and docstrings: - def get(self, request): Query multiple NS instances :param request: :return: - def post(self, request): Create a NS instance resource :param request: :return: <|skeleton...
129029584597941bb7603dd7440b7d37f823ef96
<|skeleton|> class CreateNSView: def get(self, request): """Query multiple NS instances :param request: :return:""" <|body_0|> def post(self, request): """Create a NS instance resource :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateNSView: def get(self, request): """Query multiple NS instances :param request: :return:""" logger.debug('CreateNSView::get') ret = GetNSInfoService().get_ns_info() logger.debug('CreateNSView::get::ret=%s', ret) resp_serializer = _QueryNsRespSerializer(data=ret, ma...
the_stack_v2_python_sparse
lcm/ns/views/deprecated/create_ns_view.py
onap/vfc-nfvo-lcm
train
5
a2984eecb8dfee6b19b0387ce74318ca53f0fcdf
[ "self.density = density\nself.repetitions = repetitions\nself.iteration = 0\nself.num_points = num_points", "ndims = roi.dims()\nvolume = np.prod(roi.get_shape())\nif self.iteration % self.repetitions == 0:\n if self.num_points is None:\n self.points = np.random.random((int(self.density * volume), ndims...
<|body_start_0|> self.density = density self.repetitions = repetitions self.iteration = 0 self.num_points = num_points <|end_body_0|> <|body_start_1|> ndims = roi.dims() volume = np.prod(roi.get_shape()) if self.iteration % self.repetitions == 0: if s...
RandomPointGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomPointGenerator: def __init__(self, density=None, repetitions=1, num_points=None): """Create random points in a provided ROI with the given density. Args: density (float): The expected number of points per world unit cube. If, for example, the ROI passed to `get_random_points(roi)` ...
stack_v2_sparse_classes_36k_train_033331
4,306
no_license
[ { "docstring": "Create random points in a provided ROI with the given density. Args: density (float): The expected number of points per world unit cube. If, for example, the ROI passed to `get_random_points(roi)` has a 2D size of (10, 10) and the density is 1.0, 100 uniformly distributed points will be returned...
2
stack_v2_sparse_classes_30k_train_004800
Implement the Python class `RandomPointGenerator` described below. Class description: Implement the RandomPointGenerator class. Method signatures and docstrings: - def __init__(self, density=None, repetitions=1, num_points=None): Create random points in a provided ROI with the given density. Args: density (float): Th...
Implement the Python class `RandomPointGenerator` described below. Class description: Implement the RandomPointGenerator class. Method signatures and docstrings: - def __init__(self, density=None, repetitions=1, num_points=None): Create random points in a provided ROI with the given density. Args: density (float): Th...
188c9296e38e9be2161732ecd0f7da273d1492d2
<|skeleton|> class RandomPointGenerator: def __init__(self, density=None, repetitions=1, num_points=None): """Create random points in a provided ROI with the given density. Args: density (float): The expected number of points per world unit cube. If, for example, the ROI passed to `get_random_points(roi)` ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomPointGenerator: def __init__(self, density=None, repetitions=1, num_points=None): """Create random points in a provided ROI with the given density. Args: density (float): The expected number of points per world unit cube. If, for example, the ROI passed to `get_random_points(roi)` has a 2D size ...
the_stack_v2_python_sparse
lisl/gp/random_point_source.py
funkelab/lisl
train
1
b43aa27c654d6054ec637626dbb3bc02b27797f4
[ "if not root:\n return []\nqueue = [root]\norder = []\nwhile queue:\n level = []\n n = len(queue)\n for _ in range(n):\n node = queue.pop(0)\n level.append(node.val)\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\n ...
<|body_start_0|> if not root: return [] queue = [root] order = [] while queue: level = [] n = len(queue) for _ in range(n): node = queue.pop(0) level.append(node.val) if node.left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """BFS 队列""" <|body_0|> def levelOrderRecursion(self, root: TreeNode) -> List[List[int]]: """DFS 递归""" <|body_1|> def levelOrderStack(self, root: TreeNode) -> List[List[int]]: """...
stack_v2_sparse_classes_36k_train_033332
2,718
no_license
[ { "docstring": "BFS 队列", "name": "levelOrder", "signature": "def levelOrder(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "DFS 递归", "name": "levelOrderRecursion", "signature": "def levelOrderRecursion(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "DFS ...
3
stack_v2_sparse_classes_30k_train_005735
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: BFS 队列 - def levelOrderRecursion(self, root: TreeNode) -> List[List[int]]: DFS 递归 - def levelOrderStack(self, root: TreeN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: BFS 队列 - def levelOrderRecursion(self, root: TreeNode) -> List[List[int]]: DFS 递归 - def levelOrderStack(self, root: TreeN...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """BFS 队列""" <|body_0|> def levelOrderRecursion(self, root: TreeNode) -> List[List[int]]: """DFS 递归""" <|body_1|> def levelOrderStack(self, root: TreeNode) -> List[List[int]]: """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """BFS 队列""" if not root: return [] queue = [root] order = [] while queue: level = [] n = len(queue) for _ in range(n): node = queue.pop(0)...
the_stack_v2_python_sparse
102.二叉树的层序遍历/solution.py
QtTao/daily_leetcode
train
0
182528531a7f5d4ac25622e507bd9a12062b9ccb
[ "if not nums:\n return 0\nn = len(nums)\ndp = [1] * n\nfor i in range(1, n):\n for j in range(i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[i], dp[j] + 1)\nreturn max(dp)", "if not nums:\n return 0\nd = []\nfor n in nums:\n if not d or n > d[-1]:\n d.append(n)\n else:\n ...
<|body_start_0|> if not nums: return 0 n = len(nums) dp = [1] * n for i in range(1, n): for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] + 1) return max(dp) <|end_body_0|> <|body_start_1|> if no...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS2(self, nums): """:type nums: List[int] :rtype: int 贪心 + 二分""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 ...
stack_v2_sparse_classes_36k_train_033333
1,692
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 贪心 + 二分", "name": "lengthOfLIS2", "signature": "def lengthOfLIS2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_002482
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS2(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 lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS2(self, nums): :type nums: List[int] :rtype: int 贪心 + 二分 <|skeleton|> class Solution: def le...
5450beff0115e74bd7ecaa5edb076e942fe4f046
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS2(self, nums): """:type nums: List[int] :rtype: int 贪心 + 二分""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 n = len(nums) dp = [1] * n for i in range(1, n): for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[i], ...
the_stack_v2_python_sparse
src/longest_increasing_subsequence_300.py
reflectc/leetcode_program
train
2
7b05857373af0795a2cddb278e3a79c607fafa69
[ "bsz = ys.size(0)\nseqlen = ys.size(1)\ninputs = ys.narrow(1, 0, seqlen - 1)\nif (ys[:, 0] == self.START_IDX).any():\n raise AssertionError('The Beginning of Sentence token is automatically added to the label in decode_forced, but you included it in the label. This means your model will have a double BOS token, ...
<|body_start_0|> bsz = ys.size(0) seqlen = ys.size(1) inputs = ys.narrow(1, 0, seqlen - 1) if (ys[:, 0] == self.START_IDX).any(): raise AssertionError('The Beginning of Sentence token is automatically added to the label in decode_forced, but you included it in the label. This...
Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations
TransformerGeneratorReturnLatentModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerGeneratorReturnLatentModel: """Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations""" def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torc...
stack_v2_sparse_classes_36k_train_033334
37,138
permissive
[ { "docstring": "Override TGM.decode_forced to return latent states. Nearly copied verbatim, except for return type.", "name": "decode_forced", "signature": "def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torch.Tensor, torch.BoolTensor]"...
2
stack_v2_sparse_classes_30k_val_000050
Implement the Python class `TransformerGeneratorReturnLatentModel` described below. Class description: Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations Method signatures and docstrings: - def decode_forced(self, encoder_states: Tuple[Any],...
Implement the Python class `TransformerGeneratorReturnLatentModel` described below. Class description: Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations Method signatures and docstrings: - def decode_forced(self, encoder_states: Tuple[Any],...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class TransformerGeneratorReturnLatentModel: """Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations""" def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerGeneratorReturnLatentModel: """Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations""" def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torch.Tensor, tor...
the_stack_v2_python_sparse
projects/light_whoami/agents/multi_objective.py
facebookresearch/ParlAI
train
10,943
002f67433459759d321996193c437db7ac0ea29b
[ "Parametre.__init__(self, 'membres', 'members')\nself.tronquer = True\nself.schema = '<cle>'\nself.aide_courte = \"affiche les membres d'une guilde\"\nself.aide_longue = \"Cette commande vous permet de consulter la liste des membres d'une guilde, de connaître leur rang et leur avancement en pourcentage. Seuls les j...
<|body_start_0|> Parametre.__init__(self, 'membres', 'members') self.tronquer = True self.schema = '<cle>' self.aide_courte = "affiche les membres d'une guilde" self.aide_longue = "Cette commande vous permet de consulter la liste des membres d'une guilde, de connaître leur rang e...
Commande 'guilde membres'.
PrmMembres
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmMembres: """Commande 'guilde membres'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre....
stack_v2_sparse_classes_36k_train_033335
3,631
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmMembres` described below. Class description: Commande 'guilde membres'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmMembres` described below. Class description: Commande 'guilde membres'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmMembres: """Commande 'guilde...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmMembres: """Commande 'guilde membres'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmMembres: """Commande 'guilde membres'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'membres', 'members') self.tronquer = True self.schema = '<cle>' self.aide_courte = "affiche les membres d'une guilde" self.aide_longue...
the_stack_v2_python_sparse
src/secondaires/crafting/commandes/guilde/membres.py
vincent-lg/tsunami
train
5
d448ae38e9c60446f77edf25aae476cb7fbe29bd
[ "vim_connection = pecan.request.vim.open_connection()\nvim_connection.send(rpc_request.serialize())\nmsg = vim_connection.receive()\nif msg is None:\n DLOG.error('No response received for %s.' % rpc_request)\n return httplib.INTERNAL_SERVER_ERROR\nresponse = rpc.RPCMessage.deserialize(msg)\nif rpc.RPC_MSG_RES...
<|body_start_0|> vim_connection = pecan.request.vim.open_connection() vim_connection.send(rpc_request.serialize()) msg = vim_connection.receive() if msg is None: DLOG.error('No response received for %s.' % rpc_request) return httplib.INTERNAL_SERVER_ERROR ...
Virtualised Resources - Computes Migrate API
ComputeMigrateAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComputeMigrateAPI: """Virtualised Resources - Computes Migrate API""" def _do_migrate(rpc_request): """Return an image details""" <|body_0|> def post(self, compute_id, request_data): """Perform a migrate against a virtual compute resource""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_033336
23,213
permissive
[ { "docstring": "Return an image details", "name": "_do_migrate", "signature": "def _do_migrate(rpc_request)" }, { "docstring": "Perform a migrate against a virtual compute resource", "name": "post", "signature": "def post(self, compute_id, request_data)" } ]
2
stack_v2_sparse_classes_30k_train_001556
Implement the Python class `ComputeMigrateAPI` described below. Class description: Virtualised Resources - Computes Migrate API Method signatures and docstrings: - def _do_migrate(rpc_request): Return an image details - def post(self, compute_id, request_data): Perform a migrate against a virtual compute resource
Implement the Python class `ComputeMigrateAPI` described below. Class description: Virtualised Resources - Computes Migrate API Method signatures and docstrings: - def _do_migrate(rpc_request): Return an image details - def post(self, compute_id, request_data): Perform a migrate against a virtual compute resource <|...
6dba3df3e3c4e5f4ae20ae0c4a48ae72e6d6e274
<|skeleton|> class ComputeMigrateAPI: """Virtualised Resources - Computes Migrate API""" def _do_migrate(rpc_request): """Return an image details""" <|body_0|> def post(self, compute_id, request_data): """Perform a migrate against a virtual compute resource""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComputeMigrateAPI: """Virtualised Resources - Computes Migrate API""" def _do_migrate(rpc_request): """Return an image details""" vim_connection = pecan.request.vim.open_connection() vim_connection.send(rpc_request.serialize()) msg = vim_connection.receive() if msg...
the_stack_v2_python_sparse
nfv/nfv-vim/nfv_vim/api/controllers/v1/virtualised_resources/_computes_api.py
starlingx/nfv
train
3
8399b7c5ef7535c5c2eea149b8b4b83eb3410465
[ "self.y_var = y_var\nself.x_var = x_var\nself.df = df.reset_index(drop=True)\nself.method = method\nself.model = None\nself.k_fold = k_fold\nif param is None:\n max_k = max(int(len(self.df) / (self.k_fold * 2)), 1)\n param = {'n_neighbors': list(range(1, max_k, 2)), 'weights': ['uniform', 'distance'], 'metric...
<|body_start_0|> self.y_var = y_var self.x_var = x_var self.df = df.reset_index(drop=True) self.method = method self.model = None self.k_fold = k_fold if param is None: max_k = max(int(len(self.df) / (self.k_fold * 2)), 1) param = {'n_neigh...
K-Nearest Neighbour (KNN) module. Objective: - Build `KNN <https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm>`_ model and determine optimal k Parameters ---------- df : pandas.DataFrame Pandas dataframe containing the `y_var` and `x_var` y_var : str Dependant variable x_var : List[str] Independant variables m...
KNN
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KNN: """K-Nearest Neighbour (KNN) module. Objective: - Build `KNN <https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm>`_ model and determine optimal k Parameters ---------- df : pandas.DataFrame Pandas dataframe containing the `y_var` and `x_var` y_var : str Dependant variable x_var : Li...
stack_v2_sparse_classes_36k_train_033337
6,681
permissive
[ { "docstring": "Initialize variables for module ``KNN``.", "name": "__init__", "signature": "def __init__(self, df: pd.DataFrame, y_var: str, x_var: List[str], method: str='regression', k_fold: int=5, param: Dict=None)" }, { "docstring": "Pre-process the data, one hot encoding and normalizing.",...
5
stack_v2_sparse_classes_30k_train_010076
Implement the Python class `KNN` described below. Class description: K-Nearest Neighbour (KNN) module. Objective: - Build `KNN <https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm>`_ model and determine optimal k Parameters ---------- df : pandas.DataFrame Pandas dataframe containing the `y_var` and `x_var` y_...
Implement the Python class `KNN` described below. Class description: K-Nearest Neighbour (KNN) module. Objective: - Build `KNN <https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm>`_ model and determine optimal k Parameters ---------- df : pandas.DataFrame Pandas dataframe containing the `y_var` and `x_var` y_...
edc506cf5f0c13493fbfb1a28bb41f7b0bcf8618
<|skeleton|> class KNN: """K-Nearest Neighbour (KNN) module. Objective: - Build `KNN <https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm>`_ model and determine optimal k Parameters ---------- df : pandas.DataFrame Pandas dataframe containing the `y_var` and `x_var` y_var : str Dependant variable x_var : Li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KNN: """K-Nearest Neighbour (KNN) module. Objective: - Build `KNN <https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm>`_ model and determine optimal k Parameters ---------- df : pandas.DataFrame Pandas dataframe containing the `y_var` and `x_var` y_var : str Dependant variable x_var : List[str] Indep...
the_stack_v2_python_sparse
mllib/lib/knn.py
bdiptesh/CodeLib
train
1
6420d70b7357a13f00e3f107df7832798e1d70a4
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
JoinOrderServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinOrderServicer: """Missing associated documentation comment in .proto file.""" def TestJoinNode(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetAction(self, request, context): """Missing associated docu...
stack_v2_sparse_classes_36k_train_033338
9,709
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "TestJoinNode", "signature": "def TestJoinNode(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetAction", "signature": "def GetAction(self, ...
3
stack_v2_sparse_classes_30k_train_004726
Implement the Python class `JoinOrderServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def TestJoinNode(self, request, context): Missing associated documentation comment in .proto file. - def GetAction(self, request, context): Mi...
Implement the Python class `JoinOrderServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def TestJoinNode(self, request, context): Missing associated documentation comment in .proto file. - def GetAction(self, request, context): Mi...
af490823a1b016867d8119a7e0bb5e0c3e2a60a9
<|skeleton|> class JoinOrderServicer: """Missing associated documentation comment in .proto file.""" def TestJoinNode(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetAction(self, request, context): """Missing associated docu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JoinOrderServicer: """Missing associated documentation comment in .proto file.""" def TestJoinNode(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!')...
the_stack_v2_python_sparse
joinorder_rpc/server/join_order_pb2_grpc.py
ehds/learned-tidb
train
0
fbfa9b9d67280b16f0fb2f9c791ed05f867d9a2e
[ "super().__init__(n_in=7, n_out=2)\nself._separate_cls = separate_cls\nself._n_heads = n_heads\nself._dropout = dropout\nself._mode = mode", "location_bias, context_bias, pos_emb, q, k, v, mask = inputs\nd_feature = q.shape[-1]\nn_heads = self._n_heads\nif d_feature % n_heads != 0:\n raise ValueError(f'Dimensi...
<|body_start_0|> super().__init__(n_in=7, n_out=2) self._separate_cls = separate_cls self._n_heads = n_heads self._dropout = dropout self._mode = mode <|end_body_0|> <|body_start_1|> location_bias, context_bias, pos_emb, q, k, v, mask = inputs d_feature = q.shape...
Relative attention layer. Layer that maps (location_bias, context_bias, pos_emb, q, k, v, mask) to (activations, mask). This layer type performs the inner workings of one pass of multi-head self-attention. It: - splits queries, keys, and values into multiple 'heads', - splits positional embeddings into multiple 'heads'...
RelativeAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativeAttention: """Relative attention layer. Layer that maps (location_bias, context_bias, pos_emb, q, k, v, mask) to (activations, mask). This layer type performs the inner workings of one pass of multi-head self-attention. It: - splits queries, keys, and values into multiple 'heads', - split...
stack_v2_sparse_classes_36k_train_033339
18,993
permissive
[ { "docstring": "Returns a new PureAttention instance. Args: separate_cls: True/False if we separate_cls in calculations. n_heads: Number of attention heads. dropout: Probabilistic rate for dropout applied to attention strengths (based on query-key pairs) before applying them to values. mode: One of `'train'`, `...
2
null
Implement the Python class `RelativeAttention` described below. Class description: Relative attention layer. Layer that maps (location_bias, context_bias, pos_emb, q, k, v, mask) to (activations, mask). This layer type performs the inner workings of one pass of multi-head self-attention. It: - splits queries, keys, an...
Implement the Python class `RelativeAttention` described below. Class description: Relative attention layer. Layer that maps (location_bias, context_bias, pos_emb, q, k, v, mask) to (activations, mask). This layer type performs the inner workings of one pass of multi-head self-attention. It: - splits queries, keys, an...
1bb3b89427f669f2f0ec84633952e21b68964a23
<|skeleton|> class RelativeAttention: """Relative attention layer. Layer that maps (location_bias, context_bias, pos_emb, q, k, v, mask) to (activations, mask). This layer type performs the inner workings of one pass of multi-head self-attention. It: - splits queries, keys, and values into multiple 'heads', - split...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelativeAttention: """Relative attention layer. Layer that maps (location_bias, context_bias, pos_emb, q, k, v, mask) to (activations, mask). This layer type performs the inner workings of one pass of multi-head self-attention. It: - splits queries, keys, and values into multiple 'heads', - splits positional ...
the_stack_v2_python_sparse
trax/layers/research/rel_attention.py
google/trax
train
8,180
d561dd6ad0557cda488cff9082d1654f11b012ae
[ "self._nhc = nhc\nself.hass = hass\nself.available = True\nself.data = {}\nself._system_info = None", "_LOGGER.debug('Fetching async state in bulk')\ntry:\n self.data = await self.hass.async_add_executor_job(self._nhc.list_actions_raw)\n self.available = True\nexcept OSError as ex:\n _LOGGER.error('Unabl...
<|body_start_0|> self._nhc = nhc self.hass = hass self.available = True self.data = {} self._system_info = None <|end_body_0|> <|body_start_1|> _LOGGER.debug('Fetching async state in bulk') try: self.data = await self.hass.async_add_executor_job(self....
The class for handling data retrieval.
NikoHomeControlData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NikoHomeControlData: """The class for handling data retrieval.""" def __init__(self, hass, nhc): """Set up Niko Home Control Data object.""" <|body_0|> async def async_update(self): """Get the latest data from the NikoHomeControl API.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_033340
4,084
permissive
[ { "docstring": "Set up Niko Home Control Data object.", "name": "__init__", "signature": "def __init__(self, hass, nhc)" }, { "docstring": "Get the latest data from the NikoHomeControl API.", "name": "async_update", "signature": "async def async_update(self)" }, { "docstring": "F...
3
stack_v2_sparse_classes_30k_train_013472
Implement the Python class `NikoHomeControlData` described below. Class description: The class for handling data retrieval. Method signatures and docstrings: - def __init__(self, hass, nhc): Set up Niko Home Control Data object. - async def async_update(self): Get the latest data from the NikoHomeControl API. - def g...
Implement the Python class `NikoHomeControlData` described below. Class description: The class for handling data retrieval. Method signatures and docstrings: - def __init__(self, hass, nhc): Set up Niko Home Control Data object. - async def async_update(self): Get the latest data from the NikoHomeControl API. - def g...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class NikoHomeControlData: """The class for handling data retrieval.""" def __init__(self, hass, nhc): """Set up Niko Home Control Data object.""" <|body_0|> async def async_update(self): """Get the latest data from the NikoHomeControl API.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NikoHomeControlData: """The class for handling data retrieval.""" def __init__(self, hass, nhc): """Set up Niko Home Control Data object.""" self._nhc = nhc self.hass = hass self.available = True self.data = {} self._system_info = None async def async_...
the_stack_v2_python_sparse
homeassistant/components/niko_home_control/light.py
home-assistant/core
train
35,501
bba167eab6302db1318c271f291acd6d4cb5e417
[ "res = []\nfor i in range(0, len(nums) - 1):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n res.append(nums[i])\n res.append(nums[j])\nreturn res", "lookup = {}\nfor i, num in enumerate(nums):\n if target - num in lookup:\n return [lookup[target -...
<|body_start_0|> res = [] for i in range(0, len(nums) - 1): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: res.append(nums[i]) res.append(nums[j]) return res <|end_body_0|> <|body_start_1|> lookup = {...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum_ugly(self, nums, target): """:param nums: list[int] :param target: int :return: list[int]""" <|body_0|> def twoSum(self, nums, target): """:param nums: :param target: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> res ...
stack_v2_sparse_classes_36k_train_033341
755
no_license
[ { "docstring": ":param nums: list[int] :param target: int :return: list[int]", "name": "twoSum_ugly", "signature": "def twoSum_ugly(self, nums, target)" }, { "docstring": ":param nums: :param target: :return:", "name": "twoSum", "signature": "def twoSum(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_train_006810
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_ugly(self, nums, target): :param nums: list[int] :param target: int :return: list[int] - def twoSum(self, nums, target): :param nums: :param target: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_ugly(self, nums, target): :param nums: list[int] :param target: int :return: list[int] - def twoSum(self, nums, target): :param nums: :param target: :return: <|skelet...
84bd4a00160e6b2a723a57e149474c6bb38bcce2
<|skeleton|> class Solution: def twoSum_ugly(self, nums, target): """:param nums: list[int] :param target: int :return: list[int]""" <|body_0|> def twoSum(self, nums, target): """:param nums: :param target: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum_ugly(self, nums, target): """:param nums: list[int] :param target: int :return: list[int]""" res = [] for i in range(0, len(nums) - 1): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: res.append(nums...
the_stack_v2_python_sparse
1_num2sum.py
yanghongkai/yhkleetcode
train
0
a2fb375cf3b451de6164ead2874ac719ac4f2a54
[ "self.list = []\n\ndef dfs(node):\n if not node:\n return\n self.list.append(node.val)\n dfs(node.left)\n dfs(node.right)\ndfs(root)\nreturn ','.join(map(str, self.list))", "if not data:\n return None\nlist = [int(d) for d in data.split(',')]\n\ndef recurse(list, lower, upper):\n if not l...
<|body_start_0|> self.list = [] def dfs(node): if not node: return self.list.append(node.val) dfs(node.left) dfs(node.right) dfs(root) return ','.join(map(str, self.list)) <|end_body_0|> <|body_start_1|> if not dat...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.list = []...
stack_v2_sparse_classes_36k_train_033342
1,397
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
73a7b069746631717bd5739df5ded2d6866b0c8c
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" self.list = [] def dfs(node): if not node: return self.list.append(node.val) dfs(node.left) dfs(node.right) dfs(root) ...
the_stack_v2_python_sparse
Interview/Amazon/serializeDeserializeBST.py
Urvashi-91/Urvashi_Git_Repo
train
0
fe822199076e2f754b7545029325ed80aebe53fb
[ "user = get_jwt_identity()\ndata = request.get_json()\noid = ObjectId(user)\nauthorized: bool = Courses.objects.get(id=data['course'])['instructor']['id'] == oid\nauthorized = authorized or Users.objects.get(id=user).roles.admin\nif authorized:\n try:\n quiz = Quizzes(**data).save()\n except Validation...
<|body_start_0|> user = get_jwt_identity() data = request.get_json() oid = ObjectId(user) authorized: bool = Courses.objects.get(id=data['course'])['instructor']['id'] == oid authorized = authorized or Users.objects.get(id=user).roles.admin if authorized: try:...
Flask-resftul resource for returning db.quiz collection.
QuizzesApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuizzesApi: """Flask-resftul resource for returning db.quiz collection.""" def post(self) -> Response: """POST response method for creating a quiz. JSON Web Token is required. Authorization is required: role must be instructor""" <|body_0|> def get(self) -> Response: ...
stack_v2_sparse_classes_36k_train_033343
6,369
no_license
[ { "docstring": "POST response method for creating a quiz. JSON Web Token is required. Authorization is required: role must be instructor", "name": "post", "signature": "def post(self) -> Response" }, { "docstring": "GET response method for all documents in quiz collection. JSON Web Token is requ...
2
stack_v2_sparse_classes_30k_train_013970
Implement the Python class `QuizzesApi` described below. Class description: Flask-resftul resource for returning db.quiz collection. Method signatures and docstrings: - def post(self) -> Response: POST response method for creating a quiz. JSON Web Token is required. Authorization is required: role must be instructor ...
Implement the Python class `QuizzesApi` described below. Class description: Flask-resftul resource for returning db.quiz collection. Method signatures and docstrings: - def post(self) -> Response: POST response method for creating a quiz. JSON Web Token is required. Authorization is required: role must be instructor ...
7f44c736c95866aaf820627ea54d3f00b3ada779
<|skeleton|> class QuizzesApi: """Flask-resftul resource for returning db.quiz collection.""" def post(self) -> Response: """POST response method for creating a quiz. JSON Web Token is required. Authorization is required: role must be instructor""" <|body_0|> def get(self) -> Response: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuizzesApi: """Flask-resftul resource for returning db.quiz collection.""" def post(self) -> Response: """POST response method for creating a quiz. JSON Web Token is required. Authorization is required: role must be instructor""" user = get_jwt_identity() data = request.get_json()...
the_stack_v2_python_sparse
backend/uimpactify/controller/quiz.py
ObaidaSaleh/E-learning-app
train
1
9aca58e1644e1047bf2b5e09f220a8db419cab95
[ "super().__init__(system=system, exchange_dimensions={self._parameter_name: s_range}, exchange_criterium=exchange_criterium, steps_between_trials=steps_between_trials)\nif exchange_trajs:\n self.exchange_param = 'trajectory'\nelse:\n self.exchange_param = '_currentPosition'\nself._exchange_pattern = exchange_...
<|body_start_0|> super().__init__(system=system, exchange_dimensions={self._parameter_name: s_range}, exchange_criterium=exchange_criterium, steps_between_trials=steps_between_trials) if exchange_trajs: self.exchange_param = 'trajectory' else: self.exchange_param = '_curr...
replicaExchangeEnvelopingDistributionSampling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class replicaExchangeEnvelopingDistributionSampling: def __init__(self, system: systemCls, s_range: Iterable=np.logspace(start=1, stop=-4, num=3), exchange_criterium=None, steps_between_trials=20, exchange_trajs: bool=False): """constructs a replic exchange enveloping distribution sampling (RE...
stack_v2_sparse_classes_36k_train_033344
5,333
permissive
[ { "docstring": "constructs a replic exchange enveloping distribution sampling (RE-EDS) ensemble. This approach was developed by Sidler, Schwaninger and Riniker 2016. It exchanges the smoothing parameter s during the simulations. Parameters ---------- system: systemCls system class that is the basis of the ensem...
2
stack_v2_sparse_classes_30k_train_013813
Implement the Python class `replicaExchangeEnvelopingDistributionSampling` described below. Class description: Implement the replicaExchangeEnvelopingDistributionSampling class. Method signatures and docstrings: - def __init__(self, system: systemCls, s_range: Iterable=np.logspace(start=1, stop=-4, num=3), exchange_c...
Implement the Python class `replicaExchangeEnvelopingDistributionSampling` described below. Class description: Implement the replicaExchangeEnvelopingDistributionSampling class. Method signatures and docstrings: - def __init__(self, system: systemCls, s_range: Iterable=np.logspace(start=1, stop=-4, num=3), exchange_c...
f8f9eb9381498d6cba21182ebfb5ee6eca2a3310
<|skeleton|> class replicaExchangeEnvelopingDistributionSampling: def __init__(self, system: systemCls, s_range: Iterable=np.logspace(start=1, stop=-4, num=3), exchange_criterium=None, steps_between_trials=20, exchange_trajs: bool=False): """constructs a replic exchange enveloping distribution sampling (RE...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class replicaExchangeEnvelopingDistributionSampling: def __init__(self, system: systemCls, s_range: Iterable=np.logspace(start=1, stop=-4, num=3), exchange_criterium=None, steps_between_trials=20, exchange_trajs: bool=False): """constructs a replic exchange enveloping distribution sampling (RE-EDS) ensemble...
the_stack_v2_python_sparse
ensembler/ensemble/replica_exchange.py
Bio-Otto/Ensembler
train
0
b721db91b090e3eca710a4396d5e868d0a25c179
[ "self._window_size = window_size\nself._batch_size = batch_size\nself._smoothing_perc = smoothing_perc\nself._n_predictions = n_predictions\nself._l_s = l_s\nself._error_buffer = error_buffer\nself._p = p\nself.window_size = self._window_size\nself.n_windows = int((channel.y_test.shape[0] - self._batch_size * self....
<|body_start_0|> self._window_size = window_size self._batch_size = batch_size self._smoothing_perc = smoothing_perc self._n_predictions = n_predictions self._l_s = l_s self._error_buffer = error_buffer self._p = p self.window_size = self._window_size ...
Errors
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Errors: def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p): """Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single ch...
stack_v2_sparse_classes_36k_train_033345
22,066
permissive
[ { "docstring": "Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single channel config (obj): Config object containing parameters for processing run_id (str): Datetime referencing set of predictions i...
4
stack_v2_sparse_classes_30k_train_004290
Implement the Python class `Errors` described below. Class description: Implement the Errors class. Method signatures and docstrings: - def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p): Batch processing of errors between actual and predicted values for a channe...
Implement the Python class `Errors` described below. Class description: Implement the Errors class. Method signatures and docstrings: - def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p): Batch processing of errors between actual and predicted values for a channe...
314dd6efc6ed3f8d25e100b08de4115edc636e14
<|skeleton|> class Errors: def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p): """Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single ch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Errors: def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p): """Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single channel config (...
the_stack_v2_python_sparse
tods/detection_algorithm/core/utils/errors.py
datamllab/tods
train
1,094
a8c9f5438970f8a96db50e9077261a9652e32f19
[ "C = self.COEFFS[imt]\nmean = self._get_magnitude_scaling_term(C, rup.mag) + self._get_distance_scaling_term(C, rup.mag, dists.rrup) + self._get_style_of_faulting_term(C, rup.rake) + self._get_site_scaling_term(C, sites.vs30)\nstddevs = self._get_stddevs(imt, rup.mag, len(dists.rrup), stddev_types)\nreturn (mean, s...
<|body_start_0|> C = self.COEFFS[imt] mean = self._get_magnitude_scaling_term(C, rup.mag) + self._get_distance_scaling_term(C, rup.mag, dists.rrup) + self._get_style_of_faulting_term(C, rup.rake) + self._get_site_scaling_term(C, sites.vs30) stddevs = self._get_stddevs(imt, rup.mag, len(dists.rru...
Implements GMPE developed by Idriss 2014 and published as "An NGA-West2 Empirical Model for Estimating the Horizontal Spectral Values Generated by Shallow Crustal Earthquakes. (2014, Earthquake Spectra, Volume 30, No. 3, pages 1155 - 1177). Idriss (2014) defines the GMPE only for the case in which Vs30 >= 450 m/s. In t...
Idriss2014
[ "AGPL-3.0-only", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Idriss2014: """Implements GMPE developed by Idriss 2014 and published as "An NGA-West2 Empirical Model for Estimating the Horizontal Spectral Values Generated by Shallow Crustal Earthquakes. (2014, Earthquake Spectra, Volume 30, No. 3, pages 1155 - 1177). Idriss (2014) defines the GMPE only for t...
stack_v2_sparse_classes_36k_train_033346
8,985
permissive
[ { "docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Returns the magnitu...
6
stack_v2_sparse_classes_30k_train_000480
Implement the Python class `Idriss2014` described below. Class description: Implements GMPE developed by Idriss 2014 and published as "An NGA-West2 Empirical Model for Estimating the Horizontal Spectral Values Generated by Shallow Crustal Earthquakes. (2014, Earthquake Spectra, Volume 30, No. 3, pages 1155 - 1177). Id...
Implement the Python class `Idriss2014` described below. Class description: Implements GMPE developed by Idriss 2014 and published as "An NGA-West2 Empirical Model for Estimating the Horizontal Spectral Values Generated by Shallow Crustal Earthquakes. (2014, Earthquake Spectra, Volume 30, No. 3, pages 1155 - 1177). Id...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class Idriss2014: """Implements GMPE developed by Idriss 2014 and published as "An NGA-West2 Empirical Model for Estimating the Horizontal Spectral Values Generated by Shallow Crustal Earthquakes. (2014, Earthquake Spectra, Volume 30, No. 3, pages 1155 - 1177). Idriss (2014) defines the GMPE only for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Idriss2014: """Implements GMPE developed by Idriss 2014 and published as "An NGA-West2 Empirical Model for Estimating the Horizontal Spectral Values Generated by Shallow Crustal Earthquakes. (2014, Earthquake Spectra, Volume 30, No. 3, pages 1155 - 1177). Idriss (2014) defines the GMPE only for the case in wh...
the_stack_v2_python_sparse
openquake/hazardlib/gsim/idriss_2014.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
a86b02581f06d22d5907fefdb2ff7bb64f911b59
[ "self.x = np.array(x)\nself.xmin = self.x.min()\nself.xmax = self.x.max()\nself.y = np.array(y)\nself.ymin = self.y.min()\nself.ymax = self.y.max()\npol, cov = np.polyfit(self.x, self.y, deg, cov=True)\nPolynomial.__init__(self, pol, cov)", "if restrict:\n x = np.array(x)\n for i in range(len(x)):\n ...
<|body_start_0|> self.x = np.array(x) self.xmin = self.x.min() self.xmax = self.x.max() self.y = np.array(y) self.ymin = self.y.min() self.ymax = self.y.max() pol, cov = np.polyfit(self.x, self.y, deg, cov=True) Polynomial.__init__(self, pol, cov) <|end_bo...
Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)
PolyFit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolyFit: """Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)""" def __init__(self, x, y, deg=1): """Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : i...
stack_v2_sparse_classes_36k_train_033347
35,535
permissive
[ { "docstring": "Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : int Degree of the fitting polynomial. (default: 1)", "name": "__init__", "signature": "def __init__(self, x, y, deg=1)" }, { ...
2
stack_v2_sparse_classes_30k_train_010970
Implement the Python class `PolyFit` described below. Class description: Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit) Method signatures and docstrings: - def __init__(self, x, y, deg=1): Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,)...
Implement the Python class `PolyFit` described below. Class description: Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit) Method signatures and docstrings: - def __init__(self, x, y, deg=1): Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,)...
99107a0d4935296b673f67469c1e2bd258954b9b
<|skeleton|> class PolyFit: """Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)""" def __init__(self, x, y, deg=1): """Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolyFit: """Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)""" def __init__(self, x, y, deg=1): """Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : int Degree of ...
the_stack_v2_python_sparse
maths.py
yketa/active_work
train
1
3eb543f19fef7fe35fd0503d05c76772610b332f
[ "request_json = {'mode': 'test'}\nr = requests.post('http://localhost:{}/train'.format(port), json=request_json)\ntrain_complete = re.sub('\\\\W+', '', r.text)\nself.assertEqual(train_complete, 'true')", "r = requests.post('http://localhost:{}/predict'.format(port))\nself.assertEqual(re.sub('\\n|\"', '', r.text),...
<|body_start_0|> request_json = {'mode': 'test'} r = requests.post('http://localhost:{}/train'.format(port), json=request_json) train_complete = re.sub('\\W+', '', r.text) self.assertEqual(train_complete, 'true') <|end_body_0|> <|body_start_1|> r = requests.post('http://localhos...
test the essential functionality
ApiTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiTest: """test the essential functionality""" def test_01_train(self): """test the train functionality""" <|body_0|> def test_02_predict_empty(self): """ensure appropriate failure types""" <|body_1|> def test_03_predict(self): """test the p...
stack_v2_sparse_classes_36k_train_033348
3,077
no_license
[ { "docstring": "test the train functionality", "name": "test_01_train", "signature": "def test_01_train(self)" }, { "docstring": "ensure appropriate failure types", "name": "test_02_predict_empty", "signature": "def test_02_predict_empty(self)" }, { "docstring": "test the predict...
4
stack_v2_sparse_classes_30k_train_006288
Implement the Python class `ApiTest` described below. Class description: test the essential functionality Method signatures and docstrings: - def test_01_train(self): test the train functionality - def test_02_predict_empty(self): ensure appropriate failure types - def test_03_predict(self): test the predict function...
Implement the Python class `ApiTest` described below. Class description: test the essential functionality Method signatures and docstrings: - def test_01_train(self): test the train functionality - def test_02_predict_empty(self): ensure appropriate failure types - def test_03_predict(self): test the predict function...
0b68917effa6128862d997c61dcae1d0df8ff109
<|skeleton|> class ApiTest: """test the essential functionality""" def test_01_train(self): """test the train functionality""" <|body_0|> def test_02_predict_empty(self): """ensure appropriate failure types""" <|body_1|> def test_03_predict(self): """test the p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiTest: """test the essential functionality""" def test_01_train(self): """test the train functionality""" request_json = {'mode': 'test'} r = requests.post('http://localhost:{}/train'.format(port), json=request_json) train_complete = re.sub('\\W+', '', r.text) se...
the_stack_v2_python_sparse
unittests/api_tests.py
ryusat/capstonepeerreveiw
train
0
6ed48615e9255011ec0f1db018864ebb26fc3012
[ "query_params = request.query_params.copy()\nordering_query_params = query_params.getlist(self.ordering_param, [])\n__ordering_params = []\nfor query_param in ordering_query_params:\n __key = query_param.lstrip('-')\n __direction = '-' if query_param.startswith('-') else ''\n if __key in view.ordering_fiel...
<|body_start_0|> query_params = request.query_params.copy() ordering_query_params = query_params.getlist(self.ordering_param, []) __ordering_params = [] for query_param in ordering_query_params: __key = query_param.lstrip('-') __direction = '-' if query_param.star...
Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from .documents import ArticleDocument >>> >>> # Local...
OrderingFilterBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderingFilterBackend: """Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from ...
stack_v2_sparse_classes_36k_train_033349
8,440
no_license
[ { "docstring": "Get ordering query params. :param request: Django REST framework request. :param view: View. :type request: rest_framework.request.Request :type view: rest_framework.viewsets.ReadOnlyModelViewSet :return: Ordering params to be used for ordering. :rtype: list", "name": "get_ordering_query_par...
2
stack_v2_sparse_classes_30k_train_005396
Implement the Python class `OrderingFilterBackend` described below. Class description: Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Loca...
Implement the Python class `OrderingFilterBackend` described below. Class description: Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Loca...
51d04b4fd0c201b543fde9c3c94d2dab6e7eee50
<|skeleton|> class OrderingFilterBackend: """Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderingFilterBackend: """Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from .documents im...
the_stack_v2_python_sparse
book_es/src/django_elasticsearch_dsl_drf/filter_backends/ordering/common.py
kabrice/book-django
train
1
2768a94678051e1936abaac060d27f333c602d37
[ "k %= len(nums)\nself.reverse(nums, 0, len(nums) - 1)\nself.reverse(nums, 0, k - 1)\nself.reverse(nums, k, len(nums) - 1)", "while start < end:\n nums[start], nums[end] = (nums[end], nums[start])\n start += 1\n end -= 1" ]
<|body_start_0|> k %= len(nums) self.reverse(nums, 0, len(nums) - 1) self.reverse(nums, 0, k - 1) self.reverse(nums, k, len(nums) - 1) <|end_body_0|> <|body_start_1|> while start < end: nums[start], nums[end] = (nums[end], nums[start]) start += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, nums, k): """Do not return anything, modify nums in-place instead. Args: nums: list[int] k: int""" <|body_0|> def reverse(self, nums, start, end): """Args: nums: list[int] start: int end: int""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_033350
1,342
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead. Args: nums: list[int] k: int", "name": "rotate", "signature": "def rotate(self, nums, k)" }, { "docstring": "Args: nums: list[int] start: int end: int", "name": "reverse", "signature": "def reverse(self, nums, start, e...
2
stack_v2_sparse_classes_30k_train_020992
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): Do not return anything, modify nums in-place instead. Args: nums: list[int] k: int - def reverse(self, nums, start, end): Args: nums: list[int] start: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): Do not return anything, modify nums in-place instead. Args: nums: list[int] k: int - def reverse(self, nums, start, end): Args: nums: list[int] start: ...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def rotate(self, nums, k): """Do not return anything, modify nums in-place instead. Args: nums: list[int] k: int""" <|body_0|> def reverse(self, nums, start, end): """Args: nums: list[int] start: int end: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, nums, k): """Do not return anything, modify nums in-place instead. Args: nums: list[int] k: int""" k %= len(nums) self.reverse(nums, 0, len(nums) - 1) self.reverse(nums, 0, k - 1) self.reverse(nums, k, len(nums) - 1) def reverse(self, num...
the_stack_v2_python_sparse
code/189. 旋转数组.py
AiZhanghan/Leetcode
train
0
d870bc14e27f410951e7876aeb88f69f19ec363f
[ "params = base.get_params(None, locals())\nrequest = http.Request('GET', self.get_url(), params)\nreturn (request, parsers.parse_json)", "self.require_collection()\nrequest = http.Request('POST', self.get_url(), self.wrap_object(obj))\nreturn (request, parsers.parse_json)", "self.require_item()\nrequest = http....
<|body_start_0|> params = base.get_params(None, locals()) request = http.Request('GET', self.get_url(), params) return (request, parsers.parse_json) <|end_body_0|> <|body_start_1|> self.require_collection() request = http.Request('POST', self.get_url(), self.wrap_object(obj)) ...
UserVoiceResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserVoiceResource: def get(self, page=None, per_page=None, sort=None): """For single-object resources, fetch the object's data. For collections, fetch all of the objects. :var page: For collections, where should paging start. If left as `None`, the first page is returned. :vartype page: ...
stack_v2_sparse_classes_36k_train_033351
2,920
permissive
[ { "docstring": "For single-object resources, fetch the object's data. For collections, fetch all of the objects. :var page: For collections, where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: For collections, how many objects sould be returned. If left as...
3
stack_v2_sparse_classes_30k_train_012616
Implement the Python class `UserVoiceResource` described below. Class description: Implement the UserVoiceResource class. Method signatures and docstrings: - def get(self, page=None, per_page=None, sort=None): For single-object resources, fetch the object's data. For collections, fetch all of the objects. :var page: ...
Implement the Python class `UserVoiceResource` described below. Class description: Implement the UserVoiceResource class. Method signatures and docstrings: - def get(self, page=None, per_page=None, sort=None): For single-object resources, fetch the object's data. For collections, fetch all of the objects. :var page: ...
25caa745a104c8dc209584fa359294c65dbf88bb
<|skeleton|> class UserVoiceResource: def get(self, page=None, per_page=None, sort=None): """For single-object resources, fetch the object's data. For collections, fetch all of the objects. :var page: For collections, where should paging start. If left as `None`, the first page is returned. :vartype page: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserVoiceResource: def get(self, page=None, per_page=None, sort=None): """For single-object resources, fetch the object's data. For collections, fetch all of the objects. :var page: For collections, where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_p...
the_stack_v2_python_sparse
libsaas/services/uservoice/resource.py
piplcom/libsaas
train
1
fb42951a51294cfff88ca441eb07fc9529dc8ddd
[ "super(RpcPikaIncomingMessage, self).__init__(pika_engine, channel, method, properties, body)\nself.reply_q = properties.reply_to\nself.msg_id = properties.correlation_id", "if self.reply_q is None:\n return\nreply_outgoing_message = RpcReplyPikaOutgoingMessage(self._pika_engine, self.msg_id, reply=reply, fail...
<|body_start_0|> super(RpcPikaIncomingMessage, self).__init__(pika_engine, channel, method, properties, body) self.reply_q = properties.reply_to self.msg_id = properties.correlation_id <|end_body_0|> <|body_start_1|> if self.reply_q is None: return reply_outgoing_mes...
PikaIncomingMessage implementation for RPC messages. It expects extra RPC related fields in message body (msg_id and reply_q). Also 'reply' method added to allow consumer to send RPC reply back to the RPC client
RpcPikaIncomingMessage
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RpcPikaIncomingMessage: """PikaIncomingMessage implementation for RPC messages. It expects extra RPC related fields in message body (msg_id and reply_q). Also 'reply' method added to allow consumer to send RPC reply back to the RPC client""" def __init__(self, pika_engine, channel, method, p...
stack_v2_sparse_classes_36k_train_033352
24,684
permissive
[ { "docstring": "Defines default values of msg_id and reply_q fields and just call super.__init__ method :param pika_engine: PikaEngine, shared object with configuration and shared driver functionality :param channel: Channel, RabbitMQ channel which was used for this message delivery, used for sending ack back. ...
2
stack_v2_sparse_classes_30k_train_019427
Implement the Python class `RpcPikaIncomingMessage` described below. Class description: PikaIncomingMessage implementation for RPC messages. It expects extra RPC related fields in message body (msg_id and reply_q). Also 'reply' method added to allow consumer to send RPC reply back to the RPC client Method signatures ...
Implement the Python class `RpcPikaIncomingMessage` described below. Class description: PikaIncomingMessage implementation for RPC messages. It expects extra RPC related fields in message body (msg_id and reply_q). Also 'reply' method added to allow consumer to send RPC reply back to the RPC client Method signatures ...
c01951b33e278de9e769c2d0609c0be61d2cb26b
<|skeleton|> class RpcPikaIncomingMessage: """PikaIncomingMessage implementation for RPC messages. It expects extra RPC related fields in message body (msg_id and reply_q). Also 'reply' method added to allow consumer to send RPC reply back to the RPC client""" def __init__(self, pika_engine, channel, method, p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RpcPikaIncomingMessage: """PikaIncomingMessage implementation for RPC messages. It expects extra RPC related fields in message body (msg_id and reply_q). Also 'reply' method added to allow consumer to send RPC reply back to the RPC client""" def __init__(self, pika_engine, channel, method, properties, bo...
the_stack_v2_python_sparse
filesystems/vnx_rootfs_lxc_ubuntu64-16.04-v025-openstack-compute/rootfs/usr/lib/python2.7/dist-packages/oslo_messaging/_drivers/pika_driver/pika_message.py
juancarlosdiaztorres/Ansible-OpenStack
train
0
4b4e7277606bf97672736ffe0a2e2cdb68e1f5fc
[ "self.strike = kwargs['strike']\nself.rate = kwargs['rate']\nself.dividend = kwargs['dividend']\nself.maturity = kwargs['maturity']\nself.volatility = kwargs['volatility']\nself.cp = kwargs['cp']\nself.date_type = kwargs['date_type']\nself.nominal_num = kwargs['nominal_num']\nself.factor_name = '{}:{}'.format(self....
<|body_start_0|> self.strike = kwargs['strike'] self.rate = kwargs['rate'] self.dividend = kwargs['dividend'] self.maturity = kwargs['maturity'] self.volatility = kwargs['volatility'] self.cp = kwargs['cp'] self.date_type = kwargs['date_type'] self.nominal...
示例反向对冲买入择时类,混入BuyPutMixin,即向下突破触发买入event, 适用于看跌期权
AbuFactorBuyPutEuroOptionHedge
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbuFactorBuyPutEuroOptionHedge: """示例反向对冲买入择时类,混入BuyPutMixin,即向下突破触发买入event, 适用于看跌期权""" def _init_self(self, **kwargs): """kwargs中必须包含: 期权各参数""" <|body_0|> def fit_day(self, today, holding_cnt): """针对每一个交易日拟合买入交易策略,寻找向上突破买入机会 :param today: 当前驱动的交易日金融时间序列数据 :param...
stack_v2_sparse_classes_36k_train_033353
3,898
no_license
[ { "docstring": "kwargs中必须包含: 期权各参数", "name": "_init_self", "signature": "def _init_self(self, **kwargs)" }, { "docstring": "针对每一个交易日拟合买入交易策略,寻找向上突破买入机会 :param today: 当前驱动的交易日金融时间序列数据 :param holding_cnt: 交易发生之前的持仓量 :return:", "name": "fit_day", "signature": "def fit_day(self, today, holdi...
2
stack_v2_sparse_classes_30k_train_002873
Implement the Python class `AbuFactorBuyPutEuroOptionHedge` described below. Class description: 示例反向对冲买入择时类,混入BuyPutMixin,即向下突破触发买入event, 适用于看跌期权 Method signatures and docstrings: - def _init_self(self, **kwargs): kwargs中必须包含: 期权各参数 - def fit_day(self, today, holding_cnt): 针对每一个交易日拟合买入交易策略,寻找向上突破买入机会 :param today: 当前...
Implement the Python class `AbuFactorBuyPutEuroOptionHedge` described below. Class description: 示例反向对冲买入择时类,混入BuyPutMixin,即向下突破触发买入event, 适用于看跌期权 Method signatures and docstrings: - def _init_self(self, **kwargs): kwargs中必须包含: 期权各参数 - def fit_day(self, today, holding_cnt): 针对每一个交易日拟合买入交易策略,寻找向上突破买入机会 :param today: 当前...
6f9dabecb17b65a02a370134e178722c169b2cd2
<|skeleton|> class AbuFactorBuyPutEuroOptionHedge: """示例反向对冲买入择时类,混入BuyPutMixin,即向下突破触发买入event, 适用于看跌期权""" def _init_self(self, **kwargs): """kwargs中必须包含: 期权各参数""" <|body_0|> def fit_day(self, today, holding_cnt): """针对每一个交易日拟合买入交易策略,寻找向上突破买入机会 :param today: 当前驱动的交易日金融时间序列数据 :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbuFactorBuyPutEuroOptionHedge: """示例反向对冲买入择时类,混入BuyPutMixin,即向下突破触发买入event, 适用于看跌期权""" def _init_self(self, **kwargs): """kwargs中必须包含: 期权各参数""" self.strike = kwargs['strike'] self.rate = kwargs['rate'] self.dividend = kwargs['dividend'] self.maturity = kwargs['mat...
the_stack_v2_python_sparse
abupy/FactorBuyBu/ABuFactorBuyEuroOptionHedge.py
Leo70kg/Backtesting
train
1
b3b1be996a4a22cb182e212e5c0bb1df8d70eab2
[ "service = self._client.create(name=service_name, type=service_type, enabled=enabled, description=description)\nif check:\n self.check_service_presence(service)\n assert_that(service.name, equal_to(service_name))\n assert_that(service.type, equal_to(service_type))\n assert_that(service.enabled, equal_to...
<|body_start_0|> service = self._client.create(name=service_name, type=service_type, enabled=enabled, description=description) if check: self.check_service_presence(service) assert_that(service.name, equal_to(service_name)) assert_that(service.type, equal_to(service_t...
Services steps.
ServiceSteps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceSteps: """Services steps.""" def create_service(self, service_name, service_type=None, enabled=True, description=None, check=True): """Step to create service. Args: service_name (str): service name service_type (str): service type enabled (bool): whether the service appears in...
stack_v2_sparse_classes_36k_train_033354
4,538
no_license
[ { "docstring": "Step to create service. Args: service_name (str): service name service_type (str): service type enabled (bool): whether the service appears in the catalog description (str): the description of the service check (bool): flag whether to check step or not Raises: AssertionError: if check failed Ret...
5
null
Implement the Python class `ServiceSteps` described below. Class description: Services steps. Method signatures and docstrings: - def create_service(self, service_name, service_type=None, enabled=True, description=None, check=True): Step to create service. Args: service_name (str): service name service_type (str): se...
Implement the Python class `ServiceSteps` described below. Class description: Services steps. Method signatures and docstrings: - def create_service(self, service_name, service_type=None, enabled=True, description=None, check=True): Step to create service. Args: service_name (str): service name service_type (str): se...
e7583444cd24893ec6ae237b47db7c605b99b0c5
<|skeleton|> class ServiceSteps: """Services steps.""" def create_service(self, service_name, service_type=None, enabled=True, description=None, check=True): """Step to create service. Args: service_name (str): service name service_type (str): service type enabled (bool): whether the service appears in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceSteps: """Services steps.""" def create_service(self, service_name, service_type=None, enabled=True, description=None, check=True): """Step to create service. Args: service_name (str): service name service_type (str): service type enabled (bool): whether the service appears in the catalog ...
the_stack_v2_python_sparse
stepler/keystone/steps/services.py
Mirantis/stepler
train
16
3bc784104e0805686c38d92603a4cf0b04d585a5
[ "@lru_cache(None)\ndef dfs(cur: str) -> int:\n if not cur:\n return 0\n res = INF\n for select in counters:\n if cur[0] not in select:\n continue\n next = replace(select, cur)\n res = min(res, dfs(next) + 1)\n return res\n\ndef replace(counter: Counter, word: str) ...
<|body_start_0|> @lru_cache(None) def dfs(cur: str) -> int: if not cur: return 0 res = INF for select in counters: if cur[0] not in select: continue next = replace(select, cur) res = m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minStickers(self, stickers: List[str], target: str) -> int: """记忆化dfs,不用状压,状压的写法反而更慢""" <|body_0|> def minStickers2(self, stickers: List[str], target: str) -> int: """bfs求无权图最短路""" <|body_1|> <|end_skeleton|> <|body_start_0|> @lru_cach...
stack_v2_sparse_classes_36k_train_033355
2,678
no_license
[ { "docstring": "记忆化dfs,不用状压,状压的写法反而更慢", "name": "minStickers", "signature": "def minStickers(self, stickers: List[str], target: str) -> int" }, { "docstring": "bfs求无权图最短路", "name": "minStickers2", "signature": "def minStickers2(self, stickers: List[str], target: str) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minStickers(self, stickers: List[str], target: str) -> int: 记忆化dfs,不用状压,状压的写法反而更慢 - def minStickers2(self, stickers: List[str], target: str) -> int: bfs求无权图最短路
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minStickers(self, stickers: List[str], target: str) -> int: 记忆化dfs,不用状压,状压的写法反而更慢 - def minStickers2(self, stickers: List[str], target: str) -> int: bfs求无权图最短路 <|skeleton|> ...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minStickers(self, stickers: List[str], target: str) -> int: """记忆化dfs,不用状压,状压的写法反而更慢""" <|body_0|> def minStickers2(self, stickers: List[str], target: str) -> int: """bfs求无权图最短路""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minStickers(self, stickers: List[str], target: str) -> int: """记忆化dfs,不用状压,状压的写法反而更慢""" @lru_cache(None) def dfs(cur: str) -> int: if not cur: return 0 res = INF for select in counters: if cur[0] not in s...
the_stack_v2_python_sparse
13_回溯算法/剪枝优化/691. 贴纸拼词-搜索剪枝.py
981377660LMT/algorithm-study
train
225
d54452894bbb8b7bd306f630a213cf58d69c3220
[ "sleep(2)\ntype_string = os.path.join(os.getcwd(), TESTDATA[section1][u'data_folder'], TESTDATA[section2][u'ca_cert_file_name'])\nprint(type_string)\nself.common_lib.type_file_name_pyautogui(type_string)\nprint('done upload')\nsleep(2)", "self.cs_cert_services.click_button_id_ca_add()\nself.cs_cert_services_inser...
<|body_start_0|> sleep(2) type_string = os.path.join(os.getcwd(), TESTDATA[section1][u'data_folder'], TESTDATA[section2][u'ca_cert_file_name']) print(type_string) self.common_lib.type_file_name_pyautogui(type_string) print('done upload') sleep(2) <|end_body_0|> <|body_st...
Components common to central server certification services view Changelog: * 11.07.2017 | Documentation updated
Component_cs_cert_services
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Component_cs_cert_services: """Components common to central server certification services view Changelog: * 11.07.2017 | Documentation updated""" def upload_ca_certificate(self, section1=u'paths', section2=u'cs_url'): """Uploda ca certificate :param section1: Test data section name :...
stack_v2_sparse_classes_36k_train_033356
3,521
permissive
[ { "docstring": "Uploda ca certificate :param section1: Test data section name :param section2: Test data section name", "name": "upload_ca_certificate", "signature": "def upload_ca_certificate(self, section1=u'paths', section2=u'cs_url')" }, { "docstring": "Add certification service and upload c...
3
null
Implement the Python class `Component_cs_cert_services` described below. Class description: Components common to central server certification services view Changelog: * 11.07.2017 | Documentation updated Method signatures and docstrings: - def upload_ca_certificate(self, section1=u'paths', section2=u'cs_url'): Uploda...
Implement the Python class `Component_cs_cert_services` described below. Class description: Components common to central server certification services view Changelog: * 11.07.2017 | Documentation updated Method signatures and docstrings: - def upload_ca_certificate(self, section1=u'paths', section2=u'cs_url'): Uploda...
e030661a0ad8ceab74dd8122b751e88025a3474a
<|skeleton|> class Component_cs_cert_services: """Components common to central server certification services view Changelog: * 11.07.2017 | Documentation updated""" def upload_ca_certificate(self, section1=u'paths', section2=u'cs_url'): """Uploda ca certificate :param section1: Test data section name :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Component_cs_cert_services: """Components common to central server certification services view Changelog: * 11.07.2017 | Documentation updated""" def upload_ca_certificate(self, section1=u'paths', section2=u'cs_url'): """Uploda ca certificate :param section1: Test data section name :param section...
the_stack_v2_python_sparse
common/xrd-ui-tests-qautomate/common_lib/component_cs_cert_services.py
nordic-institute/X-Road-tests
train
2
61a5cc55b6fb87ab34a7ec00f5914b1dfaaadda2
[ "self.access_time_bucket_name = access_time_bucket_name\nself.access_time_end_days = access_time_end_days\nself.access_time_start_days = access_time_start_days", "if dictionary is None:\n return None\naccess_time_bucket_name = dictionary.get('accessTimeBucketName')\naccess_time_end_days = dictionary.get('acces...
<|body_start_0|> self.access_time_bucket_name = access_time_bucket_name self.access_time_end_days = access_time_end_days self.access_time_start_days = access_time_start_days <|end_body_0|> <|body_start_1|> if dictionary is None: return None access_time_bucket_name = ...
Implementation of the 'NasAnalysisJobParams_AccessTimeBucket' model. TODO: type description here. Attributes: access_time_bucket_name (string): Tag representing the bucket for access time of file. e.g. "1mo-3mo" represents 1 month to 3 month. access_time_end_days (long|int): End time e.g. 1 year. Stored in days precisi...
NasAnalysisJobParams_AccessTimeBucket
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NasAnalysisJobParams_AccessTimeBucket: """Implementation of the 'NasAnalysisJobParams_AccessTimeBucket' model. TODO: type description here. Attributes: access_time_bucket_name (string): Tag representing the bucket for access time of file. e.g. "1mo-3mo" represents 1 month to 3 month. access_time_...
stack_v2_sparse_classes_36k_train_033357
2,305
permissive
[ { "docstring": "Constructor for the NasAnalysisJobParams_AccessTimeBucket class", "name": "__init__", "signature": "def __init__(self, access_time_bucket_name=None, access_time_end_days=None, access_time_start_days=None)" }, { "docstring": "Creates an instance of this model from a dictionary Arg...
2
null
Implement the Python class `NasAnalysisJobParams_AccessTimeBucket` described below. Class description: Implementation of the 'NasAnalysisJobParams_AccessTimeBucket' model. TODO: type description here. Attributes: access_time_bucket_name (string): Tag representing the bucket for access time of file. e.g. "1mo-3mo" repr...
Implement the Python class `NasAnalysisJobParams_AccessTimeBucket` described below. Class description: Implementation of the 'NasAnalysisJobParams_AccessTimeBucket' model. TODO: type description here. Attributes: access_time_bucket_name (string): Tag representing the bucket for access time of file. e.g. "1mo-3mo" repr...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NasAnalysisJobParams_AccessTimeBucket: """Implementation of the 'NasAnalysisJobParams_AccessTimeBucket' model. TODO: type description here. Attributes: access_time_bucket_name (string): Tag representing the bucket for access time of file. e.g. "1mo-3mo" represents 1 month to 3 month. access_time_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NasAnalysisJobParams_AccessTimeBucket: """Implementation of the 'NasAnalysisJobParams_AccessTimeBucket' model. TODO: type description here. Attributes: access_time_bucket_name (string): Tag representing the bucket for access time of file. e.g. "1mo-3mo" represents 1 month to 3 month. access_time_end_days (lon...
the_stack_v2_python_sparse
cohesity_management_sdk/models/nas_analysis_job_params_access_time_bucket.py
cohesity/management-sdk-python
train
24
1d7ee4d6487cb006fa1123eb93463030b1521eab
[ "super(GraphConvolution, self).__init__()\nself.use_bias = use_bias\nself.weight = nn.Parameter(torch.Tensor(input_dim, output_dim))\nif self.use_bias:\n self.bias = nn.Parameter(torch.Tensor(output_dim))\nelse:\n self.register_parameter('bias', None)\nself.__init_parameters()\nreturn", "nn.init.kaiming_nor...
<|body_start_0|> super(GraphConvolution, self).__init__() self.use_bias = use_bias self.weight = nn.Parameter(torch.Tensor(input_dim, output_dim)) if self.use_bias: self.bias = nn.Parameter(torch.Tensor(output_dim)) else: self.register_parameter('bias', No...
图卷积层
GraphConvolution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphConvolution: """图卷积层""" def __init__(self, input_dim, output_dim, use_bias=True): """图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置""" <|body_0|> def __init_parameters(self): """初始...
stack_v2_sparse_classes_36k_train_033358
5,537
permissive
[ { "docstring": "图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置", "name": "__init__", "signature": "def __init__(self, input_dim, output_dim, use_bias=True)" }, { "docstring": "初始化权重和偏置", "name": "__init_parameters"...
3
stack_v2_sparse_classes_30k_train_001619
Implement the Python class `GraphConvolution` described below. Class description: 图卷积层 Method signatures and docstrings: - def __init__(self, input_dim, output_dim, use_bias=True): 图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 - def __init...
Implement the Python class `GraphConvolution` described below. Class description: 图卷积层 Method signatures and docstrings: - def __init__(self, input_dim, output_dim, use_bias=True): 图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 - def __init...
ee16c37fd065ba4c732138096f715f04c0ad6fcf
<|skeleton|> class GraphConvolution: """图卷积层""" def __init__(self, input_dim, output_dim, use_bias=True): """图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置""" <|body_0|> def __init_parameters(self): """初始...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GraphConvolution: """图卷积层""" def __init__(self, input_dim, output_dim, use_bias=True): """图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置""" super(GraphConvolution, self).__init__() self.use_bias = use_bi...
the_stack_v2_python_sparse
Graph/SAGPool/script/layers.py
robbinc91/GNN-Pytorch
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_36k_train_033359
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_018535
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_36k
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
0448bb395c42a0d4bdfe8142c0f139af1b8d74df
[ "lst = []\nfor i in A:\n if i not in lst:\n lst.append(i)\n else:\n lst.remove(i)\nreturn lst[0]", "ret = 0\nfor i in A:\n ret ^= i\nreturn ret" ]
<|body_start_0|> lst = [] for i in A: if i not in lst: lst.append(i) else: lst.remove(i) return lst[0] <|end_body_0|> <|body_start_1|> ret = 0 for i in A: ret ^= i return ret <|end_body_1|>
@param: A: An integer array @return: An integer
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """@param: A: An integer array @return: An integer""" def singleNumber_1(self, A): """第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数""" <|body_0|> def singleNumber(self, A): """异或""" <|body_1|> <|end_skeleton|> <|body_start_0|> lst = [] for i i...
stack_v2_sparse_classes_36k_train_033360
859
no_license
[ { "docstring": "第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数", "name": "singleNumber_1", "signature": "def singleNumber_1(self, A)" }, { "docstring": "异或", "name": "singleNumber", "signature": "def singleNumber(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_016815
Implement the Python class `Solution` described below. Class description: @param: A: An integer array @return: An integer Method signatures and docstrings: - def singleNumber_1(self, A): 第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数 - def singleNumber(self, A): 异或
Implement the Python class `Solution` described below. Class description: @param: A: An integer array @return: An integer Method signatures and docstrings: - def singleNumber_1(self, A): 第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数 - def singleNumber(self, A): 异或 <|skeleton|> class Solution: """@param: A: An integer array @ret...
87592a39d67d8e734e693327d6b063be334b37e2
<|skeleton|> class Solution: """@param: A: An integer array @return: An integer""" def singleNumber_1(self, A): """第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数""" <|body_0|> def singleNumber(self, A): """异或""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """@param: A: An integer array @return: An integer""" def singleNumber_1(self, A): """第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数""" lst = [] for i in A: if i not in lst: lst.append(i) else: lst.remove(i) return lst[0] ...
the_stack_v2_python_sparse
LintCode/LintCode-82:落单的数.py
hoshizorahikari/PythonExercise
train
0
21d7dbccebc56acfccc3f16e7634cca5e6df2ef1
[ "self.nrows_written = 0\nself.fout = fout\nself.line_limit = line_limit", "if self.line_limit is not None:\n if self.nrows_written == self.line_limit:\n raise LineLimitException('exceeded the limit of %d lines of output' % self.line_limit)\n(print >> self.fout, '\\t'.join(row))\nself.nrows_written += 1"...
<|body_start_0|> self.nrows_written = 0 self.fout = fout self.line_limit = line_limit <|end_body_0|> <|body_start_1|> if self.line_limit is not None: if self.nrows_written == self.line_limit: raise LineLimitException('exceeded the limit of %d lines of output'...
RowWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RowWriter: def __init__(self, fout, line_limit=None): """@param fout: a file open for writing @param line_limit: limit the number of lines written""" <|body_0|> def write_row(self, row): """@param row: a sequence of strings""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_033361
3,779
no_license
[ { "docstring": "@param fout: a file open for writing @param line_limit: limit the number of lines written", "name": "__init__", "signature": "def __init__(self, fout, line_limit=None)" }, { "docstring": "@param row: a sequence of strings", "name": "write_row", "signature": "def write_row...
2
null
Implement the Python class `RowWriter` described below. Class description: Implement the RowWriter class. Method signatures and docstrings: - def __init__(self, fout, line_limit=None): @param fout: a file open for writing @param line_limit: limit the number of lines written - def write_row(self, row): @param row: a s...
Implement the Python class `RowWriter` described below. Class description: Implement the RowWriter class. Method signatures and docstrings: - def __init__(self, fout, line_limit=None): @param fout: a file open for writing @param line_limit: limit the number of lines written - def write_row(self, row): @param row: a s...
91c6f8331f18c914eb3dfc51bc166915998c5081
<|skeleton|> class RowWriter: def __init__(self, fout, line_limit=None): """@param fout: a file open for writing @param line_limit: limit the number of lines written""" <|body_0|> def write_row(self, row): """@param row: a sequence of strings""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RowWriter: def __init__(self, fout, line_limit=None): """@param fout: a file open for writing @param line_limit: limit the number of lines written""" self.nrows_written = 0 self.fout = fout self.line_limit = line_limit def write_row(self, row): """@param row: a seq...
the_stack_v2_python_sparse
20090826a.py
argriffing/xgcode
train
1
85f47f0d3e6a9c0418d427d00de354e8fc2f4223
[ "orogenh = self.plugin.process(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube)\nself.assertIsInstance(orogenh, iris.cube.Cube)\nself.assertEqual(orogenh.data.dtype, 'float32')\nfor coord in orogenh.coords(dim_coords=True):\n self.assertEqual(coord.points.dtype, 'float...
<|body_start_0|> orogenh = self.plugin.process(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube) self.assertIsInstance(orogenh, iris.cube.Cube) self.assertEqual(orogenh.data.dtype, 'float32') for coord in orogenh.coords(dim_coords=True): ...
Test the process method
Test_process
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_process: """Test the process method""" def test_basic(self): """Test output is float32 cube with float32 coordinates""" <|body_0|> def test_unmatched_coords(self): """Test error thrown if input variable cubes do not match""" <|body_1|> def test_...
stack_v2_sparse_classes_36k_train_033362
34,979
permissive
[ { "docstring": "Test output is float32 cube with float32 coordinates", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test error thrown if input variable cubes do not match", "name": "test_unmatched_coords", "signature": "def test_unmatched_coords(self)" }...
5
stack_v2_sparse_classes_30k_train_007430
Implement the Python class `Test_process` described below. Class description: Test the process method Method signatures and docstrings: - def test_basic(self): Test output is float32 cube with float32 coordinates - def test_unmatched_coords(self): Test error thrown if input variable cubes do not match - def test_extr...
Implement the Python class `Test_process` described below. Class description: Test the process method Method signatures and docstrings: - def test_basic(self): Test output is float32 cube with float32 coordinates - def test_unmatched_coords(self): Test error thrown if input variable cubes do not match - def test_extr...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_process: """Test the process method""" def test_basic(self): """Test output is float32 cube with float32 coordinates""" <|body_0|> def test_unmatched_coords(self): """Test error thrown if input variable cubes do not match""" <|body_1|> def test_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_process: """Test the process method""" def test_basic(self): """Test output is float32 cube with float32 coordinates""" orogenh = self.plugin.process(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube) self.assertIsInstance(orogenh, ir...
the_stack_v2_python_sparse
improver_tests/orographic_enhancement/test_OrographicEnhancement.py
metoppv/improver
train
101
ebefb7727799fa0d1e25ed8aa85f57905afa5370
[ "if root is None:\n return []\nelse:\n path_list = []\n self.binaryTreePathsHelper(root, '', path_list)\n return path_list", "if root is None:\n return\nif curr_path == '':\n curr_path += str(root.val)\nelse:\n curr_path += '->' + str(root.val)\nif root.left is None and root.right is None:\n ...
<|body_start_0|> if root is None: return [] else: path_list = [] self.binaryTreePathsHelper(root, '', path_list) return path_list <|end_body_0|> <|body_start_1|> if root is None: return if curr_path == '': curr_path...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def binaryTreePathsHelper(self, root, curr_path, path_list): """:type root: TreeNode :type path_list[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_033363
885
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[str]", "name": "binaryTreePaths", "signature": "def binaryTreePaths(self, root)" }, { "docstring": ":type root: TreeNode :type path_list[str]", "name": "binaryTreePathsHelper", "signature": "def binaryTreePathsHelper(self, root, curr_path...
2
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 binaryTreePathsHelper(self, root, curr_path, path_list): :type root: TreeNode :type path_list[str]
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 binaryTreePathsHelper(self, root, curr_path, path_list): :type root: TreeNode :type path_list[str] ...
c17653832269ab1bb3e411f7d74bef4c8e9985b3
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def binaryTreePathsHelper(self, root, curr_path, path_list): """:type root: TreeNode :type path_list[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" if root is None: return [] else: path_list = [] self.binaryTreePathsHelper(root, '', path_list) return path_list def binaryTreePathsHelper(self, ...
the_stack_v2_python_sparse
Python/binary_tree_paths/binary_tree_paths.py
lqs4188980/CodingPractice
train
0
04e56764d5a4c05096e2388a99b526e66617a596
[ "self.output_dir = outputDir\nself.package = package\nself.generate_id = uuid.uuid4\nself.pages = pages\nself.itemStr = ''\nself.resStr = ''", "filename = 'imsmanifest.xml'\nout = open(self.output_dir / filename, 'w', encoding='utf-8')\nout.write(self.createXML())\nout.close()\nlrm = model_to_dict(self.package.du...
<|body_start_0|> self.output_dir = outputDir self.package = package self.generate_id = uuid.uuid4 self.pages = pages self.itemStr = '' self.resStr = '' <|end_body_0|> <|body_start_1|> filename = 'imsmanifest.xml' out = open(self.output_dir / filename, 'w'...
Represents an imsmanifest xml file
Manifest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manifest: """Represents an imsmanifest xml file""" def __init__(self, outputDir, package, pages): """Initialize 'output_dir' is the directory that we read the html from and also output the mainfest.xml""" <|body_0|> def save(self): """Save a imsmanifest file and ...
stack_v2_sparse_classes_36k_train_033364
6,218
no_license
[ { "docstring": "Initialize 'output_dir' is the directory that we read the html from and also output the mainfest.xml", "name": "__init__", "signature": "def __init__(self, outputDir, package, pages)" }, { "docstring": "Save a imsmanifest file and metadata to self.output_dir", "name": "save",...
4
stack_v2_sparse_classes_30k_train_021032
Implement the Python class `Manifest` described below. Class description: Represents an imsmanifest xml file Method signatures and docstrings: - def __init__(self, outputDir, package, pages): Initialize 'output_dir' is the directory that we read the html from and also output the mainfest.xml - def save(self): Save a ...
Implement the Python class `Manifest` described below. Class description: Represents an imsmanifest xml file Method signatures and docstrings: - def __init__(self, outputDir, package, pages): Initialize 'output_dir' is the directory that we read the html from and also output the mainfest.xml - def save(self): Save a ...
2cf50de25cdb8427668ec98c5ae3b17f3c2edbcf
<|skeleton|> class Manifest: """Represents an imsmanifest xml file""" def __init__(self, outputDir, package, pages): """Initialize 'output_dir' is the directory that we read the html from and also output the mainfest.xml""" <|body_0|> def save(self): """Save a imsmanifest file and ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Manifest: """Represents an imsmanifest xml file""" def __init__(self, outputDir, package, pages): """Initialize 'output_dir' is the directory that we read the html from and also output the mainfest.xml""" self.output_dir = outputDir self.package = package self.generate_id ...
the_stack_v2_python_sparse
exeapp/views/export/imsexport.py
TUM-MZ/creyoco
train
1
cc65871d127c4b6724dff20c675b187c81eb99c4
[ "self.frameList = settings.FrameList().getFromValue('Frame List', self, [])\nself.animationLineQuickening = settings.FloatSpinUpdate().getFromValue(0.5, 'Animation Line Quickening (ratio):', self, 4.5, 1.0)\nself.animationSlideShowRate = settings.FloatSpinUpdate().getFromValue(1.0, 'Animation Slide Show Rate (layer...
<|body_start_0|> self.frameList = settings.FrameList().getFromValue('Frame List', self, []) self.animationLineQuickening = settings.FloatSpinUpdate().getFromValue(0.5, 'Animation Line Quickening (ratio):', self, 4.5, 1.0) self.animationSlideShowRate = settings.FloatSpinUpdate().getFromValue(1.0,...
The viewer base repository class.
TableauRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TableauRepository: """The viewer base repository class.""" def addAnimation(self): """Add the animation settings.""" <|body_0|> def addScaleScreenSlide(self): """Add the scale, screen and slide show settings.""" <|body_1|> def setToDisplaySave(self, ...
stack_v2_sparse_classes_36k_train_033365
33,354
no_license
[ { "docstring": "Add the animation settings.", "name": "addAnimation", "signature": "def addAnimation(self)" }, { "docstring": "Add the scale, screen and slide show settings.", "name": "addScaleScreenSlide", "signature": "def addScaleScreenSlide(self)" }, { "docstring": "Set the s...
3
stack_v2_sparse_classes_30k_train_002613
Implement the Python class `TableauRepository` described below. Class description: The viewer base repository class. Method signatures and docstrings: - def addAnimation(self): Add the animation settings. - def addScaleScreenSlide(self): Add the scale, screen and slide show settings. - def setToDisplaySave(self, even...
Implement the Python class `TableauRepository` described below. Class description: The viewer base repository class. Method signatures and docstrings: - def addAnimation(self): Add the animation settings. - def addScaleScreenSlide(self): Add the scale, screen and slide show settings. - def setToDisplaySave(self, even...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class TableauRepository: """The viewer base repository class.""" def addAnimation(self): """Add the animation settings.""" <|body_0|> def addScaleScreenSlide(self): """Add the scale, screen and slide show settings.""" <|body_1|> def setToDisplaySave(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TableauRepository: """The viewer base repository class.""" def addAnimation(self): """Add the animation settings.""" self.frameList = settings.FrameList().getFromValue('Frame List', self, []) self.animationLineQuickening = settings.FloatSpinUpdate().getFromValue(0.5, 'Animation Li...
the_stack_v2_python_sparse
skeinforge_tools/analyze_plugins/analyze_utilities/tableau.py
bmander/skeinforge
train
34
898844c574a735ddd0b2c73f92daf849c700c4e1
[ "adm = ApplikationsAdministration()\nverbund = adm.get_anwenderverbund_by_id(id)\nif verbund is not None:\n mitglieder_id = adm.mitglieder_zum_anwenderverbund_ausgeben(verbund)\n benutze_objekte = []\n for i in mitglieder_id:\n benutze_objekt = adm.get_benutzer_by_id(i)\n benutze_objekte.appe...
<|body_start_0|> adm = ApplikationsAdministration() verbund = adm.get_anwenderverbund_by_id(id) if verbund is not None: mitglieder_id = adm.mitglieder_zum_anwenderverbund_ausgeben(verbund) benutze_objekte = [] for i in mitglieder_id: benutze_ob...
AnwenderverbundRelatedBenutzerOperations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnwenderverbundRelatedBenutzerOperations: def get(self, id): """Auslesen aller Mitglieder in einem durch Id definierten Anwenderverbund""" <|body_0|> def post(self, id): """Hinzufügen eines Benutzers in einen Anwenderverbund""" <|body_1|> def delete(self...
stack_v2_sparse_classes_36k_train_033366
23,456
no_license
[ { "docstring": "Auslesen aller Mitglieder in einem durch Id definierten Anwenderverbund", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Hinzufügen eines Benutzers in einen Anwenderverbund", "name": "post", "signature": "def post(self, id)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_015979
Implement the Python class `AnwenderverbundRelatedBenutzerOperations` described below. Class description: Implement the AnwenderverbundRelatedBenutzerOperations class. Method signatures and docstrings: - def get(self, id): Auslesen aller Mitglieder in einem durch Id definierten Anwenderverbund - def post(self, id): H...
Implement the Python class `AnwenderverbundRelatedBenutzerOperations` described below. Class description: Implement the AnwenderverbundRelatedBenutzerOperations class. Method signatures and docstrings: - def get(self, id): Auslesen aller Mitglieder in einem durch Id definierten Anwenderverbund - def post(self, id): H...
d4a2b196f21a5379188cb78b31c59d69f739964f
<|skeleton|> class AnwenderverbundRelatedBenutzerOperations: def get(self, id): """Auslesen aller Mitglieder in einem durch Id definierten Anwenderverbund""" <|body_0|> def post(self, id): """Hinzufügen eines Benutzers in einen Anwenderverbund""" <|body_1|> def delete(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnwenderverbundRelatedBenutzerOperations: def get(self, id): """Auslesen aller Mitglieder in einem durch Id definierten Anwenderverbund""" adm = ApplikationsAdministration() verbund = adm.get_anwenderverbund_by_id(id) if verbund is not None: mitglieder_id = adm.mitg...
the_stack_v2_python_sparse
src/main.py
SvenjaHolzinger/SoftwarePraktikum
train
0
db764bd8f2b1f941f276c0f489b22c6ea1ff800e
[ "try:\n val = field.data.strip()\n if val:\n float(val)\n return True\nexcept ValueError:\n raise ValidationError('Invalid number provided(only numbers and 1 period allowed)')", "if not validator_names:\n return field\nfor i in xrange(0, len(validator_names)):\n if validator_names[i] == '...
<|body_start_0|> try: val = field.data.strip() if val: float(val) return True except ValueError: raise ValidationError('Invalid number provided(only numbers and 1 period allowed)') <|end_body_0|> <|body_start_1|> if not validator_n...
Form to add a new media item
AddMediaForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddMediaForm: """Form to add a new media item""" def isNum(form, field): """Check if the field"s value is a number(integer or floating value)""" <|body_0|> def removeValidators(self, field, validator_names=None): """Remove validator from the field's validator lis...
stack_v2_sparse_classes_36k_train_033367
4,448
no_license
[ { "docstring": "Check if the field\"s value is a number(integer or floating value)", "name": "isNum", "signature": "def isNum(form, field)" }, { "docstring": "Remove validator from the field's validator list", "name": "removeValidators", "signature": "def removeValidators(self, field, va...
2
stack_v2_sparse_classes_30k_train_015751
Implement the Python class `AddMediaForm` described below. Class description: Form to add a new media item Method signatures and docstrings: - def isNum(form, field): Check if the field"s value is a number(integer or floating value) - def removeValidators(self, field, validator_names=None): Remove validator from the ...
Implement the Python class `AddMediaForm` described below. Class description: Form to add a new media item Method signatures and docstrings: - def isNum(form, field): Check if the field"s value is a number(integer or floating value) - def removeValidators(self, field, validator_names=None): Remove validator from the ...
320ae68ce21b24dfa5902e8e5b6f4bb0cf1d504e
<|skeleton|> class AddMediaForm: """Form to add a new media item""" def isNum(form, field): """Check if the field"s value is a number(integer or floating value)""" <|body_0|> def removeValidators(self, field, validator_names=None): """Remove validator from the field's validator lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddMediaForm: """Form to add a new media item""" def isNum(form, field): """Check if the field"s value is a number(integer or floating value)""" try: val = field.data.strip() if val: float(val) return True except ValueError: ...
the_stack_v2_python_sparse
mad/modules/media/forms.py
jorluft/fla
train
0
7d8f8d81b0c6dbcbe3081e6687b254a9c7f16a9f
[ "def cal(s1: str, s2: str) -> int:\n res = 0\n maxSum, maxSumWithS2 = (0, -int(1000000000.0))\n for char in s:\n if char == s1:\n maxSum += 1\n maxSumWithS2 += 1\n elif char == s2:\n maxSum -= 1\n maxSumWithS2 = maxSum\n if maxSum < 0:\n ...
<|body_start_0|> def cal(s1: str, s2: str) -> int: res = 0 maxSum, maxSumWithS2 = (0, -int(1000000000.0)) for char in s: if char == s1: maxSum += 1 maxSumWithS2 += 1 elif char == s2: m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestVariance(self, s: str) -> int: """时间复杂度O(26*26*n) max 换成 if 2964 ms""" <|body_0|> def largestVariance2(self, s: str) -> int: """时间复杂度O(26*26*n) 用 max 7536 ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> def cal(s1: str, s2: s...
stack_v2_sparse_classes_36k_train_033368
2,462
no_license
[ { "docstring": "时间复杂度O(26*26*n) max 换成 if 2964 ms", "name": "largestVariance", "signature": "def largestVariance(self, s: str) -> int" }, { "docstring": "时间复杂度O(26*26*n) 用 max 7536 ms", "name": "largestVariance2", "signature": "def largestVariance2(self, s: str) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestVariance(self, s: str) -> int: 时间复杂度O(26*26*n) max 换成 if 2964 ms - def largestVariance2(self, s: str) -> int: 时间复杂度O(26*26*n) 用 max 7536 ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestVariance(self, s: str) -> int: 时间复杂度O(26*26*n) max 换成 if 2964 ms - def largestVariance2(self, s: str) -> int: 时间复杂度O(26*26*n) 用 max 7536 ms <|skeleton|> class Solutio...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def largestVariance(self, s: str) -> int: """时间复杂度O(26*26*n) max 换成 if 2964 ms""" <|body_0|> def largestVariance2(self, s: str) -> int: """时间复杂度O(26*26*n) 用 max 7536 ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestVariance(self, s: str) -> int: """时间复杂度O(26*26*n) max 换成 if 2964 ms""" def cal(s1: str, s2: str) -> int: res = 0 maxSum, maxSumWithS2 = (0, -int(1000000000.0)) for char in s: if char == s1: maxSum += 1...
the_stack_v2_python_sparse
chore/py/python的max函数很慢.py
981377660LMT/algorithm-study
train
225
2ea15cf44b4fd5622fc0e931fe4ed287652c1b6c
[ "self.trec_eval_command = trec_eval_command\nself.relevant_metrics = relevant_metrics\nself.q_rel_file = q_rel_file\nself.temp_run_file = '/tmp/temp_run_by_carlos.run'\nself.run_file_exporter = RUN_File_Transform_Exporter(self.temp_run_file, model_name='temp_model_by_carlos')", "self.run_file_exporter(samples)\nr...
<|body_start_0|> self.trec_eval_command = trec_eval_command self.relevant_metrics = relevant_metrics self.q_rel_file = q_rel_file self.temp_run_file = '/tmp/temp_run_by_carlos.run' self.run_file_exporter = RUN_File_Transform_Exporter(self.temp_run_file, model_name='temp_model_by_...
TREC_Eval_Command_Experiment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TREC_Eval_Command_Experiment: def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metrics=['ndcg_cut_3', 'ndcg_cut_5', 'ndcg_cut_1000', 'map_cut_1000', 'recall_500', 'recall_1000'], q_rel_file='datasets/TREC_CAsT/2...
stack_v2_sparse_classes_36k_train_033369
13,210
no_license
[ { "docstring": "This is an experiment transform that uses the official trec_eval command to compute scores for each query and return valid results according to the command specified.", "name": "__init__", "signature": "def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,2...
2
stack_v2_sparse_classes_30k_val_000986
Implement the Python class `TREC_Eval_Command_Experiment` described below. Class description: Implement the TREC_Eval_Command_Experiment class. Method signatures and docstrings: - def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metr...
Implement the Python class `TREC_Eval_Command_Experiment` described below. Class description: Implement the TREC_Eval_Command_Experiment class. Method signatures and docstrings: - def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metr...
92dd4d41ad6f2be5b5c4e296e2a355bb14b9a1db
<|skeleton|> class TREC_Eval_Command_Experiment: def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metrics=['ndcg_cut_3', 'ndcg_cut_5', 'ndcg_cut_1000', 'map_cut_1000', 'recall_500', 'recall_1000'], q_rel_file='datasets/TREC_CAsT/2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TREC_Eval_Command_Experiment: def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metrics=['ndcg_cut_3', 'ndcg_cut_5', 'ndcg_cut_1000', 'map_cut_1000', 'recall_500', 'recall_1000'], q_rel_file='datasets/TREC_CAsT/2020qrels.txt')...
the_stack_v2_python_sparse
notebooks/src/Experiments.py
carlos-gemmell/Glasgow-NLP
train
0
68d3022df6a0e7b227195cf70677aa33c8a96290
[ "self.specs = specs\nself.has_exclusions = specs.has_exclusions()\nself.has_all_inclusions = specs.has_all_inclusions()\nself.indexer = Indexer(self.specs.specs_final)\nself.indexer.builder()\nself.index = self.indexer.index\nself.includes_out_of_order = self.indexer.includes_out_of_order\nself.includes_repeats = s...
<|body_start_0|> self.specs = specs self.has_exclusions = specs.has_exclusions() self.has_all_inclusions = specs.has_all_inclusions() self.indexer = Indexer(self.specs.specs_final) self.indexer.builder() self.index = self.indexer.index self.includes_out_of_order =...
Manages the evaluation of record numbers against spec for a single spec_type It uses the Specification List[SpecRecord] structure as input and supports the evaluation of col or row numbers aginst these specs.
SpecProcessor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecProcessor: """Manages the evaluation of record numbers against spec for a single spec_type It uses the Specification List[SpecRecord] structure as input and supports the evaluation of col or row numbers aginst these specs.""" def __init__(self, specs) -> None: """Args: specs: a L...
stack_v2_sparse_classes_36k_train_033370
23,596
permissive
[ { "docstring": "Args: specs: a List of SpecRecords Public Methods: specs_evaluator: evaluates an offset against the list of specs Notes: Automatically generates self.index - which is a list of offsets. This supports a fast alternative method of evaluating cols & recs.", "name": "__init__", "signature": ...
3
stack_v2_sparse_classes_30k_train_007518
Implement the Python class `SpecProcessor` described below. Class description: Manages the evaluation of record numbers against spec for a single spec_type It uses the Specification List[SpecRecord] structure as input and supports the evaluation of col or row numbers aginst these specs. Method signatures and docstrin...
Implement the Python class `SpecProcessor` described below. Class description: Manages the evaluation of record numbers against spec for a single spec_type It uses the Specification List[SpecRecord] structure as input and supports the evaluation of col or row numbers aginst these specs. Method signatures and docstrin...
133e927d150fa05317784246df69591dada648bb
<|skeleton|> class SpecProcessor: """Manages the evaluation of record numbers against spec for a single spec_type It uses the Specification List[SpecRecord] structure as input and supports the evaluation of col or row numbers aginst these specs.""" def __init__(self, specs) -> None: """Args: specs: a L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpecProcessor: """Manages the evaluation of record numbers against spec for a single spec_type It uses the Specification List[SpecRecord] structure as input and supports the evaluation of col or row numbers aginst these specs.""" def __init__(self, specs) -> None: """Args: specs: a List of SpecRe...
the_stack_v2_python_sparse
datagristle/slice_specs.py
kenfar/DataGristle
train
91
d318fbed9392837edd71967e45d25aa827dc9bf5
[ "Sprite.__init__(self)\nself.pose = np.array([x, y, theta])\nself.pose_velocity = np.array([0, 0, 0])\nself.mask = mask\nself.color = color\nself.image = Surface([width, height])\nself.image.set_colorkey(simulation.SIMULATION_BG_COLOR)\nself.dims = [width, height]\nself.rect = self.image.get_rect()\nself.autoscale ...
<|body_start_0|> Sprite.__init__(self) self.pose = np.array([x, y, theta]) self.pose_velocity = np.array([0, 0, 0]) self.mask = mask self.color = color self.image = Surface([width, height]) self.image.set_colorkey(simulation.SIMULATION_BG_COLOR) self.dims ...
Abstraction of a simulated object with a pose and a sprite.
SimulationObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulationObject: """Abstraction of a simulated object with a pose and a sprite.""" def __init__(self, x, y, theta, width=0, height=0, color=(0, 0, 0), mask=MASK_RECT): """Parameters ---------- x: float horizontal position in units y: float vertical position in units theta: heading i...
stack_v2_sparse_classes_36k_train_033371
4,642
permissive
[ { "docstring": "Parameters ---------- x: float horizontal position in units y: float vertical position in units theta: heading in radians width: float width in units height: float height in units color: tuple (r, g, b) mask: int sprite mask (circle or rectangle)", "name": "__init__", "signature": "def _...
5
stack_v2_sparse_classes_30k_train_000576
Implement the Python class `SimulationObject` described below. Class description: Abstraction of a simulated object with a pose and a sprite. Method signatures and docstrings: - def __init__(self, x, y, theta, width=0, height=0, color=(0, 0, 0), mask=MASK_RECT): Parameters ---------- x: float horizontal position in u...
Implement the Python class `SimulationObject` described below. Class description: Abstraction of a simulated object with a pose and a sprite. Method signatures and docstrings: - def __init__(self, x, y, theta, width=0, height=0, color=(0, 0, 0), mask=MASK_RECT): Parameters ---------- x: float horizontal position in u...
4e91e86c86bfbdd8d4639b0994e96e890a2f741e
<|skeleton|> class SimulationObject: """Abstraction of a simulated object with a pose and a sprite.""" def __init__(self, x, y, theta, width=0, height=0, color=(0, 0, 0), mask=MASK_RECT): """Parameters ---------- x: float horizontal position in units y: float vertical position in units theta: heading i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulationObject: """Abstraction of a simulated object with a pose and a sprite.""" def __init__(self, x, y, theta, width=0, height=0, color=(0, 0, 0), mask=MASK_RECT): """Parameters ---------- x: float horizontal position in units y: float vertical position in units theta: heading in radians wid...
the_stack_v2_python_sparse
tools/simulator/r5engine/object.py
ut-ras/r5-2019
train
5
905fd479c6a5d7f920b82a4b3a834d6e4e84d440
[ "increasing = decreasing = True\nfor i in range(len(A) - 1):\n if A[i] > A[i + 1]:\n increasing = False\n if A[i] < A[i + 1]:\n decreasing = False\nreturn increasing or decreasing", "store = 0\nfor i in range(len(A) - 1):\n c = get_comparison(A[i], A[i + 1])\n if c:\n if c != stor...
<|body_start_0|> increasing = decreasing = True for i in range(len(A) - 1): if A[i] > A[i + 1]: increasing = False if A[i] < A[i + 1]: decreasing = False return increasing or decreasing <|end_body_0|> <|body_start_1|> store = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMonotonic(self, A): """One pass""" <|body_0|> def isMonotonic1(self, A): """One pass""" <|body_1|> def isMonotonic(self, A): """Two passes""" <|body_2|> <|end_skeleton|> <|body_start_0|> increasing = decreasing =...
stack_v2_sparse_classes_36k_train_033372
1,628
no_license
[ { "docstring": "One pass", "name": "isMonotonic", "signature": "def isMonotonic(self, A)" }, { "docstring": "One pass", "name": "isMonotonic1", "signature": "def isMonotonic1(self, A)" }, { "docstring": "Two passes", "name": "isMonotonic", "signature": "def isMonotonic(se...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMonotonic(self, A): One pass - def isMonotonic1(self, A): One pass - def isMonotonic(self, A): Two passes
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMonotonic(self, A): One pass - def isMonotonic1(self, A): One pass - def isMonotonic(self, A): Two passes <|skeleton|> class Solution: def isMonotonic(self, A): ...
42c6eb8656e85b76f1c0043dcddc9c526ae12ba1
<|skeleton|> class Solution: def isMonotonic(self, A): """One pass""" <|body_0|> def isMonotonic1(self, A): """One pass""" <|body_1|> def isMonotonic(self, A): """Two passes""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isMonotonic(self, A): """One pass""" increasing = decreasing = True for i in range(len(A) - 1): if A[i] > A[i + 1]: increasing = False if A[i] < A[i + 1]: decreasing = False return increasing or decreasing ...
the_stack_v2_python_sparse
Arrays/Tasks/leetcode(896).py
Invalid-coder/Data-Structures-and-algorithms
train
0
4c55d1d11be9471bd623e486fc8554279b5ba68d
[ "if source.ctype not in ConstructType.features:\n raise ValueError(\"Expected source to be of ctype 'features'.\")\nsuper().__init__(expected=(source,))\nself.interface = interface\nself.temperature = temperature", "strengths, = self.extract_inputs(inputs)\ncmds_by_dims = group_by_dims(self.interface.cmds)\npa...
<|body_start_0|> if source.ctype not in ConstructType.features: raise ValueError("Expected source to be of ctype 'features'.") super().__init__(expected=(source,)) self.interface = interface self.temperature = temperature <|end_body_0|> <|body_start_1|> strengths, = ...
Selects actions and paramaters according to Boltzmann distributions. Action and parameter features are selected from a given client interface. For parameter features, if a parameter feature is found to be of a singleton dimension (i.e., a dimension with only one value), it is treated like a continuous parameter and its...
ActionSelector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionSelector: """Selects actions and paramaters according to Boltzmann distributions. Action and parameter features are selected from a given client interface. For parameter features, if a parameter feature is found to be of a singleton dimension (i.e., a dimension with only one value), it is t...
stack_v2_sparse_classes_36k_train_033373
7,721
permissive
[ { "docstring": "Initialize an ``ActionSelector`` instance. :param dims: Registered action dimensions. :param temperature: Temperature of the Boltzmann distribution.", "name": "__init__", "signature": "def __init__(self, source, interface, temperature)" }, { "docstring": "Select actionable chunks...
2
stack_v2_sparse_classes_30k_train_014316
Implement the Python class `ActionSelector` described below. Class description: Selects actions and paramaters according to Boltzmann distributions. Action and parameter features are selected from a given client interface. For parameter features, if a parameter feature is found to be of a singleton dimension (i.e., a ...
Implement the Python class `ActionSelector` described below. Class description: Selects actions and paramaters according to Boltzmann distributions. Action and parameter features are selected from a given client interface. For parameter features, if a parameter feature is found to be of a singleton dimension (i.e., a ...
d8ff4c545785ec6cddc989dded9c1a9d3dd91514
<|skeleton|> class ActionSelector: """Selects actions and paramaters according to Boltzmann distributions. Action and parameter features are selected from a given client interface. For parameter features, if a parameter feature is found to be of a singleton dimension (i.e., a dimension with only one value), it is t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActionSelector: """Selects actions and paramaters according to Boltzmann distributions. Action and parameter features are selected from a given client interface. For parameter features, if a parameter feature is found to be of a singleton dimension (i.e., a dimension with only one value), it is treated like a...
the_stack_v2_python_sparse
pyClarion/components/propagators.py
HZeng3/pyClarion
train
0
4bfee2faea424795dc873b98c2462abb6422829f
[ "super(StateActor, self).__init__(*args, steps_per_run, episodes_per_run, **kwargs)\nself._driver = drivers.StatePyDriver(self._env, self._policy, self._observers, max_steps=steps_per_run, max_episodes=episodes_per_run)\nself.reset()", "super().write_metric_summaries()\nif self._metrics is None:\n return\nwith...
<|body_start_0|> super(StateActor, self).__init__(*args, steps_per_run, episodes_per_run, **kwargs) self._driver = drivers.StatePyDriver(self._env, self._policy, self._observers, max_steps=steps_per_run, max_episodes=episodes_per_run) self.reset() <|end_body_0|> <|body_start_1|> super()...
An Actor that adds uses the StatePyDriver.
StateActor
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateActor: """An Actor that adds uses the StatePyDriver.""" def __init__(self, *args, steps_per_run=None, episodes_per_run=None, **kwargs): """Initializes a StateActor. Args: *args: See superclass. steps_per_run: Number of steps evaluated per run call. episodes_per_run: Number of ep...
stack_v2_sparse_classes_36k_train_033374
3,607
permissive
[ { "docstring": "Initializes a StateActor. Args: *args: See superclass. steps_per_run: Number of steps evaluated per run call. episodes_per_run: Number of episodes evaluated per run call. **kwargs: See superclass.", "name": "__init__", "signature": "def __init__(self, *args, steps_per_run=None, episodes_...
2
stack_v2_sparse_classes_30k_train_019239
Implement the Python class `StateActor` described below. Class description: An Actor that adds uses the StatePyDriver. Method signatures and docstrings: - def __init__(self, *args, steps_per_run=None, episodes_per_run=None, **kwargs): Initializes a StateActor. Args: *args: See superclass. steps_per_run: Number of ste...
Implement the Python class `StateActor` described below. Class description: An Actor that adds uses the StatePyDriver. Method signatures and docstrings: - def __init__(self, *args, steps_per_run=None, episodes_per_run=None, **kwargs): Initializes a StateActor. Args: *args: See superclass. steps_per_run: Number of ste...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class StateActor: """An Actor that adds uses the StatePyDriver.""" def __init__(self, *args, steps_per_run=None, episodes_per_run=None, **kwargs): """Initializes a StateActor. Args: *args: See superclass. steps_per_run: Number of steps evaluated per run call. episodes_per_run: Number of ep...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateActor: """An Actor that adds uses the StatePyDriver.""" def __init__(self, *args, steps_per_run=None, episodes_per_run=None, **kwargs): """Initializes a StateActor. Args: *args: See superclass. steps_per_run: Number of steps evaluated per run call. episodes_per_run: Number of episodes evalua...
the_stack_v2_python_sparse
social_rl/multiagent_tfagents/joint_attention/utils.py
Jimmy-INL/google-research
train
1
e46cfcd3f40f76248b8e0b88734e1db0e747a6ab
[ "with QuantumTape() as tape:\n qml.RX(0.1, wires=0)\nwith pytest.raises(qml.queuing.QueuingError, match='Cannot stop recording'):\n with tape.stop_recording():\n pass", "with QuantumTape() as tape1:\n qml.RX(0.1, wires=0)\n with QuantumTape() as tape2:\n qml.RX(0.1, wires=0)\n wit...
<|body_start_0|> with QuantumTape() as tape: qml.RX(0.1, wires=0) with pytest.raises(qml.queuing.QueuingError, match='Cannot stop recording'): with tape.stop_recording(): pass <|end_body_0|> <|body_start_1|> with QuantumTape() as tape1: qml.RX...
Test that the stop_recording function works as expected
TestStopRecording
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestStopRecording: """Test that the stop_recording function works as expected""" def test_tape_not_recording(self): """Test that an error is raised if the tape is no longer recording""" <|body_0|> def test_nested_tape_not_recording(self): """Test that an error is...
stack_v2_sparse_classes_36k_train_033375
49,877
permissive
[ { "docstring": "Test that an error is raised if the tape is no longer recording", "name": "test_tape_not_recording", "signature": "def test_tape_not_recording(self)" }, { "docstring": "Test that an error is raised if the tape is no longer recording", "name": "test_nested_tape_not_recording",...
5
stack_v2_sparse_classes_30k_test_000751
Implement the Python class `TestStopRecording` described below. Class description: Test that the stop_recording function works as expected Method signatures and docstrings: - def test_tape_not_recording(self): Test that an error is raised if the tape is no longer recording - def test_nested_tape_not_recording(self): ...
Implement the Python class `TestStopRecording` described below. Class description: Test that the stop_recording function works as expected Method signatures and docstrings: - def test_tape_not_recording(self): Test that an error is raised if the tape is no longer recording - def test_nested_tape_not_recording(self): ...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestStopRecording: """Test that the stop_recording function works as expected""" def test_tape_not_recording(self): """Test that an error is raised if the tape is no longer recording""" <|body_0|> def test_nested_tape_not_recording(self): """Test that an error is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestStopRecording: """Test that the stop_recording function works as expected""" def test_tape_not_recording(self): """Test that an error is raised if the tape is no longer recording""" with QuantumTape() as tape: qml.RX(0.1, wires=0) with pytest.raises(qml.queuing.Que...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_v02/pennylane/pennylane#1243/before/test_tape.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
c0ed1d997f630ce95ea7ed65564f048e09c10537
[ "bidcycle = BidCycle.objects.filter(active=True).latest('cycle_start_date')\naccepting_bids_query = Subquery(bidcycle.annotated_positions.filter(accepting_bids=value).values_list('id', flat=True))\nreturn queryset.filter(id__in=accepting_bids_query)", "start = timezone.now()\nend = start + relativedelta(years=val...
<|body_start_0|> bidcycle = BidCycle.objects.filter(active=True).latest('cycle_start_date') accepting_bids_query = Subquery(bidcycle.annotated_positions.filter(accepting_bids=value).values_list('id', flat=True)) return queryset.filter(id__in=accepting_bids_query) <|end_body_0|> <|body_start_1|>...
PositionFilter
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionFilter: def filter_available_in_current_bidcycle(self, queryset, name, value): """Returns a queryset of all positions who are in the latest active bidcycle and do not have any bids with handshake or above status""" <|body_0|> def filter_vacancy_in_years(self, queryse...
stack_v2_sparse_classes_36k_train_033376
7,305
permissive
[ { "docstring": "Returns a queryset of all positions who are in the latest active bidcycle and do not have any bids with handshake or above status", "name": "filter_available_in_current_bidcycle", "signature": "def filter_available_in_current_bidcycle(self, queryset, name, value)" }, { "docstring...
2
stack_v2_sparse_classes_30k_val_000007
Implement the Python class `PositionFilter` described below. Class description: Implement the PositionFilter class. Method signatures and docstrings: - def filter_available_in_current_bidcycle(self, queryset, name, value): Returns a queryset of all positions who are in the latest active bidcycle and do not have any b...
Implement the Python class `PositionFilter` described below. Class description: Implement the PositionFilter class. Method signatures and docstrings: - def filter_available_in_current_bidcycle(self, queryset, name, value): Returns a queryset of all positions who are in the latest active bidcycle and do not have any b...
cf71acd2ea0957aa2d599da8e1185d8519d8b013
<|skeleton|> class PositionFilter: def filter_available_in_current_bidcycle(self, queryset, name, value): """Returns a queryset of all positions who are in the latest active bidcycle and do not have any bids with handshake or above status""" <|body_0|> def filter_vacancy_in_years(self, queryse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionFilter: def filter_available_in_current_bidcycle(self, queryset, name, value): """Returns a queryset of all positions who are in the latest active bidcycle and do not have any bids with handshake or above status""" bidcycle = BidCycle.objects.filter(active=True).latest('cycle_start_dat...
the_stack_v2_python_sparse
talentmap_api/position/filters.py
18F/State-TalentMAP-API
train
5
2a56771e62894f6e7641f749f15d054604071868
[ "maintenance_requests = request.env['maintenance.equipment'].sudo().search([])\nmaintenance_team = request.env['maintenance.team'].sudo().search([])\nuser = request.env.user.id\nemployee = request.env['hr.employee'].sudo().search([('user_id', '=', user)])\nrequest_dict = []\nteam_name = []\nfor record in maintenanc...
<|body_start_0|> maintenance_requests = request.env['maintenance.equipment'].sudo().search([]) maintenance_team = request.env['maintenance.team'].sudo().search([]) user = request.env.user.id employee = request.env['hr.employee'].sudo().search([('user_id', '=', user)]) request_dic...
MaintenanceRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaintenanceRequest: def request(self, **post): """Browses all maintenance teams and equipments in backend and returns them to the web page""" <|body_0|> def send_request(self, **post): """Searches for related employee of the currently logged in user. The maintenance ...
stack_v2_sparse_classes_36k_train_033377
3,467
no_license
[ { "docstring": "Browses all maintenance teams and equipments in backend and returns them to the web page", "name": "request", "signature": "def request(self, **post)" }, { "docstring": "Searches for related employee of the currently logged in user. The maintenance request is only created if the ...
2
stack_v2_sparse_classes_30k_val_000061
Implement the Python class `MaintenanceRequest` described below. Class description: Implement the MaintenanceRequest class. Method signatures and docstrings: - def request(self, **post): Browses all maintenance teams and equipments in backend and returns them to the web page - def send_request(self, **post): Searches...
Implement the Python class `MaintenanceRequest` described below. Class description: Implement the MaintenanceRequest class. Method signatures and docstrings: - def request(self, **post): Browses all maintenance teams and equipments in backend and returns them to the web page - def send_request(self, **post): Searches...
bb6453404e4f28060643f23c1c6311587f7d2925
<|skeleton|> class MaintenanceRequest: def request(self, **post): """Browses all maintenance teams and equipments in backend and returns them to the web page""" <|body_0|> def send_request(self, **post): """Searches for related employee of the currently logged in user. The maintenance ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaintenanceRequest: def request(self, **post): """Browses all maintenance teams and equipments in backend and returns them to the web page""" maintenance_requests = request.env['maintenance.equipment'].sudo().search([]) maintenance_team = request.env['maintenance.team'].sudo().search([...
the_stack_v2_python_sparse
website_maintenance_hr/controllers/controllers.py
aaltinisik/CybroAddons
train
1
439092842f45eac0e5acdf36221db19a811828e0
[ "self.mixing_ratio = np.array([0.1, 0.2, 0.3], dtype=np.float32)\nself.specific_heat = np.array([1089.5, 1174.0, 1258.5], dtype=np.float32)\nself.latent_heat = np.array([2531771.0, 2508371.0, 2484971.0], dtype=np.float32)\nself.temperature = np.array([185.0, 260.65, 338.15], dtype=np.float32)", "expected = np.arr...
<|body_start_0|> self.mixing_ratio = np.array([0.1, 0.2, 0.3], dtype=np.float32) self.specific_heat = np.array([1089.5, 1174.0, 1258.5], dtype=np.float32) self.latent_heat = np.array([2531771.0, 2508371.0, 2484971.0], dtype=np.float32) self.temperature = np.array([185.0, 260.65, 338.15],...
Test calculations of one-line variables: svp in air, latent heat, mixing ratios, etc
Test_psychrometric_variables
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_psychrometric_variables: """Test calculations of one-line variables: svp in air, latent heat, mixing ratios, etc""" def setUp(self): """Set up shared input data""" <|body_0|> def test_calculate_specific_heat(self): """Test specific heat calculation""" ...
stack_v2_sparse_classes_36k_train_033378
11,562
permissive
[ { "docstring": "Set up shared input data", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test specific heat calculation", "name": "test_calculate_specific_heat", "signature": "def test_calculate_specific_heat(self)" }, { "docstring": "Basic calculation of som...
4
stack_v2_sparse_classes_30k_train_013982
Implement the Python class `Test_psychrometric_variables` described below. Class description: Test calculations of one-line variables: svp in air, latent heat, mixing ratios, etc Method signatures and docstrings: - def setUp(self): Set up shared input data - def test_calculate_specific_heat(self): Test specific heat ...
Implement the Python class `Test_psychrometric_variables` described below. Class description: Test calculations of one-line variables: svp in air, latent heat, mixing ratios, etc Method signatures and docstrings: - def setUp(self): Set up shared input data - def test_calculate_specific_heat(self): Test specific heat ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_psychrometric_variables: """Test calculations of one-line variables: svp in air, latent heat, mixing ratios, etc""" def setUp(self): """Set up shared input data""" <|body_0|> def test_calculate_specific_heat(self): """Test specific heat calculation""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_psychrometric_variables: """Test calculations of one-line variables: svp in air, latent heat, mixing ratios, etc""" def setUp(self): """Set up shared input data""" self.mixing_ratio = np.array([0.1, 0.2, 0.3], dtype=np.float32) self.specific_heat = np.array([1089.5, 1174.0, 1...
the_stack_v2_python_sparse
improver_tests/psychrometric_calculations/wet_bulb_temperature/test_WetBulbTemperature.py
metoppv/improver
train
101
90be4e4f890b28942af4a8f24311f8e105ab6a03
[ "if not len(times) == len(values):\n raise PaaError('Lengths of times and values did not match')\nself.t = np.array(times)\nself.v = np.array(values)", "v = self.v\nt = self.t\nstart_pos = 0\nend_pos = 0\nwhile start_pos < len(t):\n t_start = t[start_pos]\n end_pos = np.searchsorted(t[start_pos:], t_star...
<|body_start_0|> if not len(times) == len(values): raise PaaError('Lengths of times and values did not match') self.t = np.array(times) self.v = np.array(values) <|end_body_0|> <|body_start_1|> v = self.v t = self.t start_pos = 0 end_pos = 0 w...
Paa
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Paa: def __init__(self, times, values): """Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values""" <|body_0|> def paa(self, interval): """Calcul...
stack_v2_sparse_classes_36k_train_033379
1,451
no_license
[ { "docstring": "Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values", "name": "__init__", "signature": "def __init__(self, times, values)" }, { "docstring": "Calculate PAA....
2
stack_v2_sparse_classes_30k_train_014496
Implement the Python class `Paa` described below. Class description: Implement the Paa class. Method signatures and docstrings: - def __init__(self, times, values): Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values...
Implement the Python class `Paa` described below. Class description: Implement the Paa class. Method signatures and docstrings: - def __init__(self, times, values): Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values...
c1a9bcd9e40837ceb267b454b7ebdd541dd7368b
<|skeleton|> class Paa: def __init__(self, times, values): """Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values""" <|body_0|> def paa(self, interval): """Calcul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Paa: def __init__(self, times, values): """Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values""" if not len(times) == len(values): raise PaaError('Lengths of...
the_stack_v2_python_sparse
services/sax/sax/paa.py
t0mmyt/msc-mk2
train
0
191f0a9757d2661a8c4edc560051284288866f28
[ "self._para_limit = para_limit\nself._ques_limit = ques_limit\nself._char_limit = char_limit\nself._word_vocab = word_vocab\nself._char_vocab = char_vocab\nself._is_cased_embedding = is_cased_embedding", "if not self._is_cased_embedding:\n return self._word_vocab[[word.lower() for word in words]]\nresult = np....
<|body_start_0|> self._para_limit = para_limit self._ques_limit = ques_limit self._char_limit = char_limit self._word_vocab = word_vocab self._char_vocab = char_vocab self._is_cased_embedding = is_cased_embedding <|end_body_0|> <|body_start_1|> if not self._is_ca...
Class that converts tokenized examples into featurized
SQuADDataFeaturizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQuADDataFeaturizer: """Class that converts tokenized examples into featurized""" def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding): """Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char...
stack_v2_sparse_classes_36k_train_033380
37,229
permissive
[ { "docstring": "Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char_vocab : Vocab Char-level vocabulary para_limit : int Maximum characters in a paragraph ques_limit : int Maximum characters in a question char_limit : int Maximum characters in a token is_cased_emb...
3
stack_v2_sparse_classes_30k_test_000004
Implement the Python class `SQuADDataFeaturizer` described below. Class description: Class that converts tokenized examples into featurized Method signatures and docstrings: - def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding): Init SQuADDataFeaturizer object Parameters...
Implement the Python class `SQuADDataFeaturizer` described below. Class description: Class that converts tokenized examples into featurized Method signatures and docstrings: - def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding): Init SQuADDataFeaturizer object Parameters...
1d54ad8058ec4f8d54b8585ef0819d39140fa74c
<|skeleton|> class SQuADDataFeaturizer: """Class that converts tokenized examples into featurized""" def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding): """Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQuADDataFeaturizer: """Class that converts tokenized examples into featurized""" def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding): """Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char_vocab : Voca...
the_stack_v2_python_sparse
scripts/question_answering/data_pipeline.py
MoisesHer/gluon-nlp
train
1
2d3ff3d774d3fb15eebdf3e159e3f2f4b9f12ddc
[ "name = cls.__name__.lower()\nif name.endswith('view'):\n name = name[:-4]\nreturn name", "def decorator(cls):\n name = endpoint or getattr(cls, 'endpoint', None)\n if name is None:\n name = self._get_endpoint_name(cls)\n self.add_url_rule(rule, view_func=cls.as_view(name), **kwargs)\n retur...
<|body_start_0|> name = cls.__name__.lower() if name.endswith('view'): name = name[:-4] return name <|end_body_0|> <|body_start_1|> def decorator(cls): name = endpoint or getattr(cls, 'endpoint', None) if name is None: name = self._get...
Extends the base Flask Blueprint
Blueprint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blueprint: """Extends the base Flask Blueprint""" def _get_endpoint_name(cls): """Get a sensible endpoint name from a MethodView class""" <|body_0|> def route_class(self, rule='', endpoint=None, **kwargs): """Adds a class based view to a blueprint The endpoint na...
stack_v2_sparse_classes_36k_train_033381
6,490
permissive
[ { "docstring": "Get a sensible endpoint name from a MethodView class", "name": "_get_endpoint_name", "signature": "def _get_endpoint_name(cls)" }, { "docstring": "Adds a class based view to a blueprint The endpoint name is fetched from: - The endpoint argument given to route_class() - The endpoi...
2
stack_v2_sparse_classes_30k_train_006025
Implement the Python class `Blueprint` described below. Class description: Extends the base Flask Blueprint Method signatures and docstrings: - def _get_endpoint_name(cls): Get a sensible endpoint name from a MethodView class - def route_class(self, rule='', endpoint=None, **kwargs): Adds a class based view to a blue...
Implement the Python class `Blueprint` described below. Class description: Extends the base Flask Blueprint Method signatures and docstrings: - def _get_endpoint_name(cls): Get a sensible endpoint name from a MethodView class - def route_class(self, rule='', endpoint=None, **kwargs): Adds a class based view to a blue...
6e6e9715b96005f0b23889fd1d8068f632aefb50
<|skeleton|> class Blueprint: """Extends the base Flask Blueprint""" def _get_endpoint_name(cls): """Get a sensible endpoint name from a MethodView class""" <|body_0|> def route_class(self, rule='', endpoint=None, **kwargs): """Adds a class based view to a blueprint The endpoint na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Blueprint: """Extends the base Flask Blueprint""" def _get_endpoint_name(cls): """Get a sensible endpoint name from a MethodView class""" name = cls.__name__.lower() if name.endswith('view'): name = name[:-4] return name def route_class(self, rule='', endp...
the_stack_v2_python_sparse
tentd/lib/flask.py
pytent/pytentd
train
3
31b154925f9a604c62bb35e5799899b58b3f24d8
[ "self.shared_state_key = kwargs.pop('shared_state_key', None)\nif self.shared_state_key is None:\n raise ValueError('No shared_state_key provided!')\nsuper().__init__(**kwargs)", "data = self.context.shared_state.get(self.shared_state_key, b'{}')\nformatted_data = self._format_data(data)\nreturn formatted_data...
<|body_start_0|> self.shared_state_key = kwargs.pop('shared_state_key', None) if self.shared_state_key is None: raise ValueError('No shared_state_key provided!') super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> data = self.context.shared_state.get(self.shared_state...
This class defines a strategy for the agent.
Strategy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Strategy: """This class defines a strategy for the agent.""" def __init__(self, **kwargs: Any) -> None: """Initialize the strategy of the agent. :param kwargs: keyword arguments""" <|body_0|> def collect_from_data_source(self) -> Dict[str, str]: """Build the data...
stack_v2_sparse_classes_36k_train_033382
2,518
permissive
[ { "docstring": "Initialize the strategy of the agent. :param kwargs: keyword arguments", "name": "__init__", "signature": "def __init__(self, **kwargs: Any) -> None" }, { "docstring": "Build the data payload. :return: a dict of the data found in the shared state.", "name": "collect_from_data...
3
null
Implement the Python class `Strategy` described below. Class description: This class defines a strategy for the agent. Method signatures and docstrings: - def __init__(self, **kwargs: Any) -> None: Initialize the strategy of the agent. :param kwargs: keyword arguments - def collect_from_data_source(self) -> Dict[str,...
Implement the Python class `Strategy` described below. Class description: This class defines a strategy for the agent. Method signatures and docstrings: - def __init__(self, **kwargs: Any) -> None: Initialize the strategy of the agent. :param kwargs: keyword arguments - def collect_from_data_source(self) -> Dict[str,...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class Strategy: """This class defines a strategy for the agent.""" def __init__(self, **kwargs: Any) -> None: """Initialize the strategy of the agent. :param kwargs: keyword arguments""" <|body_0|> def collect_from_data_source(self) -> Dict[str, str]: """Build the data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Strategy: """This class defines a strategy for the agent.""" def __init__(self, **kwargs: Any) -> None: """Initialize the strategy of the agent. :param kwargs: keyword arguments""" self.shared_state_key = kwargs.pop('shared_state_key', None) if self.shared_state_key is None: ...
the_stack_v2_python_sparse
packages/fetchai/skills/simple_seller/strategy.py
fetchai/agents-aea
train
192
fca13e569fe6ea5faa14a61146b874364f31086d
[ "Handler.__init__(self, config)\nself.log_token = self.config.get('log_token', None)\nself.queue_size = int(self.config['queue_size'])\nself.queue = deque([])\nif self.log_token is None:\n raise Exception", "config = super(LogentriesDiamondHandler, self).get_default_config_help()\nconfig.update({'log_token': '...
<|body_start_0|> Handler.__init__(self, config) self.log_token = self.config.get('log_token', None) self.queue_size = int(self.config['queue_size']) self.queue = deque([]) if self.log_token is None: raise Exception <|end_body_0|> <|body_start_1|> config = sup...
Implements the abstract Handler class
LogentriesDiamondHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogentriesDiamondHandler: """Implements the abstract Handler class""" def __init__(self, config=None): """New instance of LogentriesDiamondHandler class""" <|body_0|> def get_default_config_help(self): """Help text""" <|body_1|> def get_default_confi...
stack_v2_sparse_classes_36k_train_033383
2,341
permissive
[ { "docstring": "New instance of LogentriesDiamondHandler class", "name": "__init__", "signature": "def __init__(self, config=None)" }, { "docstring": "Help text", "name": "get_default_config_help", "signature": "def get_default_config_help(self)" }, { "docstring": "Return default...
5
null
Implement the Python class `LogentriesDiamondHandler` described below. Class description: Implements the abstract Handler class Method signatures and docstrings: - def __init__(self, config=None): New instance of LogentriesDiamondHandler class - def get_default_config_help(self): Help text - def get_default_config(se...
Implement the Python class `LogentriesDiamondHandler` described below. Class description: Implements the abstract Handler class Method signatures and docstrings: - def __init__(self, config=None): New instance of LogentriesDiamondHandler class - def get_default_config_help(self): Help text - def get_default_config(se...
461caf29e84db8cbf46f9fc4c895f56353e10c61
<|skeleton|> class LogentriesDiamondHandler: """Implements the abstract Handler class""" def __init__(self, config=None): """New instance of LogentriesDiamondHandler class""" <|body_0|> def get_default_config_help(self): """Help text""" <|body_1|> def get_default_confi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogentriesDiamondHandler: """Implements the abstract Handler class""" def __init__(self, config=None): """New instance of LogentriesDiamondHandler class""" Handler.__init__(self, config) self.log_token = self.config.get('log_token', None) self.queue_size = int(self.config[...
the_stack_v2_python_sparse
src/diamond/handler/logentries_diamond.py
python-diamond/Diamond
train
1,874
98c80389e6ee2255af75371286c908275f788e6c
[ "results = {}\nif cls.return_expr.match(node, results):\n return True\nfor child in node.children:\n if child.type not in (syms.funcdef, syms.classdef):\n if cls.has_return_exprs(child):\n return True\nreturn False", "text = text.strip()\nif not text:\n return Node(syms.file_input, [Lea...
<|body_start_0|> results = {} if cls.return_expr.match(node, results): return True for child in node.children: if child.type not in (syms.funcdef, syms.classdef): if cls.has_return_exprs(child): return True return False <|end_bo...
Utility functions for working with Nodes.
Util
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Util: """Utility functions for working with Nodes.""" def has_return_exprs(cls, node): """Traverse the tree below node looking for 'return expr'. Args: node: The AST node at the root of the subtree. Returns: True if 'return' or 'return expr' is found, False otherwise.""" <|bo...
stack_v2_sparse_classes_36k_train_033384
29,305
permissive
[ { "docstring": "Traverse the tree below node looking for 'return expr'. Args: node: The AST node at the root of the subtree. Returns: True if 'return' or 'return expr' is found, False otherwise.", "name": "has_return_exprs", "signature": "def has_return_exprs(cls, node)" }, { "docstring": "Use l...
2
stack_v2_sparse_classes_30k_train_010444
Implement the Python class `Util` described below. Class description: Utility functions for working with Nodes. Method signatures and docstrings: - def has_return_exprs(cls, node): Traverse the tree below node looking for 'return expr'. Args: node: The AST node at the root of the subtree. Returns: True if 'return' or...
Implement the Python class `Util` described below. Class description: Utility functions for working with Nodes. Method signatures and docstrings: - def has_return_exprs(cls, node): Traverse the tree below node looking for 'return expr'. Args: node: The AST node at the root of the subtree. Returns: True if 'return' or...
44b1f6f7cddccb326abac4c21b4f26688369764e
<|skeleton|> class Util: """Utility functions for working with Nodes.""" def has_return_exprs(cls, node): """Traverse the tree below node looking for 'return expr'. Args: node: The AST node at the root of the subtree. Returns: True if 'return' or 'return expr' is found, False otherwise.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Util: """Utility functions for working with Nodes.""" def has_return_exprs(cls, node): """Traverse the tree below node looking for 'return expr'. Args: node: The AST node at the root of the subtree. Returns: True if 'return' or 'return expr' is found, False otherwise.""" results = {} ...
the_stack_v2_python_sparse
pytype/tools/merge_pyi/merge_pyi.py
priyansh19/pytype
train
2
0bcb7d6d7d90d3232f7425f31387dde1980d2d6d
[ "if head is None:\n return None\nif head.next is None:\n return head\nhead_copy = head\nwhile head.next.next:\n head = head.next\nlast_node = head.next\nhead.next = None\nlast_node.next = self.reverseList(head_copy)\nreturn last_node", "if head is None:\n return None\nheader = ListNode(-999)\nheader.n...
<|body_start_0|> if head is None: return None if head.next is None: return head head_copy = head while head.next.next: head = head.next last_node = head.next head.next = None last_node.next = self.reverseList(head_copy) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseBetween(self, head, m, n): """:type head: ListNode :type m: int :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if...
stack_v2_sparse_classes_36k_train_033385
1,843
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :type m: int :type n: int :rtype: ListNode", "name": "reverseBetween", "signature": "def reverseBetween(self, head, m, n)" }...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseBetween(self, head, m, n): :type head: ListNode :type m: int :type n: int :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseBetween(self, head, m, n): :type head: ListNode :type m: int :type n: int :rtype: ListNode <|skel...
5664a83b0bbb3ae37a88c52dbbc28a3e60c16020
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseBetween(self, head, m, n): """:type head: ListNode :type m: int :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" if head is None: return None if head.next is None: return head head_copy = head while head.next.next: head = head.next last_node = head.next ...
the_stack_v2_python_sparse
codes/MartinMa28/python3/0092_reverse_linked_list_2.py
neu-velocity/code-camp-debut
train
5
56b1da541bb8cca70306510fc8dafc9dd4a818b9
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DelegatedAdminRelationshipRequest()", "from .delegated_admin_relationship_request_action import DelegatedAdminRelationshipRequestAction\nfrom .delegated_admin_relationship_request_status import DelegatedAdminRelationshipRequestStatus\n...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DelegatedAdminRelationshipRequest() <|end_body_0|> <|body_start_1|> from .delegated_admin_relationship_request_action import DelegatedAdminRelationshipRequestAction from .delegated_admin...
DelegatedAdminRelationshipRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DelegatedAdminRelationshipRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipRequest: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_36k_train_033386
3,825
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: DelegatedAdminRelationshipRequest", "name": "create_from_discriminator_value", "signature": "def create_from...
3
stack_v2_sparse_classes_30k_train_004468
Implement the Python class `DelegatedAdminRelationshipRequest` described below. Class description: Implement the DelegatedAdminRelationshipRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipRequest: Creates a new in...
Implement the Python class `DelegatedAdminRelationshipRequest` described below. Class description: Implement the DelegatedAdminRelationshipRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipRequest: Creates a new in...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DelegatedAdminRelationshipRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipRequest: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DelegatedAdminRelationshipRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipRequest: """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...
the_stack_v2_python_sparse
msgraph/generated/models/delegated_admin_relationship_request.py
microsoftgraph/msgraph-sdk-python
train
135
037b940fe4291be01c39290c594952d90b365fd5
[ "self.name = name\nself.proto = proto\nself.data = data\nks = keeping.Keeper(name=self.name, temp=False)\nself.ksDoer = keeping.KeeperDoer(keeper=ks)\ndb = basing.Baser(name=self.name, temp=False, reload=True)\nself.dbDoer = basing.BaserDoer(baser=db)\nself.hab = habbing.Habitat(name=self.name, ks=ks, db=db, temp=F...
<|body_start_0|> self.name = name self.proto = proto self.data = data ks = keeping.Keeper(name=self.name, temp=False) self.ksDoer = keeping.KeeperDoer(keeper=ks) db = basing.Baser(name=self.name, temp=False, reload=True) self.dbDoer = basing.BaserDoer(baser=db) ...
DoDoer that launches Doers needed to create an interaction event and publication of the event to all appropriate witnesses
InteractDoer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractDoer: """DoDoer that launches Doers needed to create an interaction event and publication of the event to all appropriate witnesses""" def __init__(self, name, proto, data: list=None): """Returns DoDoer with all registered Doers needed to perform interaction event. Parameters...
stack_v2_sparse_classes_36k_train_033387
4,389
permissive
[ { "docstring": "Returns DoDoer with all registered Doers needed to perform interaction event. Parameters: name is human readable str of identifier proto is tcp or http method for communicating with Witness data is list of dicts of committed data such as seals", "name": "__init__", "signature": "def __in...
2
null
Implement the Python class `InteractDoer` described below. Class description: DoDoer that launches Doers needed to create an interaction event and publication of the event to all appropriate witnesses Method signatures and docstrings: - def __init__(self, name, proto, data: list=None): Returns DoDoer with all registe...
Implement the Python class `InteractDoer` described below. Class description: DoDoer that launches Doers needed to create an interaction event and publication of the event to all appropriate witnesses Method signatures and docstrings: - def __init__(self, name, proto, data: list=None): Returns DoDoer with all registe...
467f952912b17dede8a8f4ebce73241408b63e8c
<|skeleton|> class InteractDoer: """DoDoer that launches Doers needed to create an interaction event and publication of the event to all appropriate witnesses""" def __init__(self, name, proto, data: list=None): """Returns DoDoer with all registered Doers needed to perform interaction event. Parameters...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InteractDoer: """DoDoer that launches Doers needed to create an interaction event and publication of the event to all appropriate witnesses""" def __init__(self, name, proto, data: list=None): """Returns DoDoer with all registered Doers needed to perform interaction event. Parameters: name is hum...
the_stack_v2_python_sparse
src/keri/app/cli/commands/interact.py
dlandi/keripy-1
train
0
1f9abfc2b2e3389924d02d87ffc02caf2d3b2d71
[ "if end not in bank:\n return -1\nqueue = deque([(start, 0)])\nvisited = set([start])\nwhile queue:\n v, step = queue.popleft()\n if v == end:\n return step\n for i in range(8):\n for c in 'ACGT':\n n = v[:i] + c + v[i + 1:]\n if n in bank and n not in visited:\n ...
<|body_start_0|> if end not in bank: return -1 queue = deque([(start, 0)]) visited = set([start]) while queue: v, step = queue.popleft() if v == end: return step for i in range(8): for c in 'ACGT': ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minMutation(self, start, end, bank): """:type start: str :type end: str :type bank: List[str] :rtype: int bfs思想,队列中保持每个遍历的有效字符串和其突变的基因个数元组,即(start, step)元组。类似走迷宫,四个方向就是可变的四 个字母"ACGT",当突变后的字符串在bank中就step+1,终止条件就是突变后的字符串==end。其中增加visited来保存已经遇到过的有效 突变字符串,以增加运算速度。 Runtime: 12 ...
stack_v2_sparse_classes_36k_train_033388
2,730
no_license
[ { "docstring": ":type start: str :type end: str :type bank: List[str] :rtype: int bfs思想,队列中保持每个遍历的有效字符串和其突变的基因个数元组,即(start, step)元组。类似走迷宫,四个方向就是可变的四 个字母\"ACGT\",当突变后的字符串在bank中就step+1,终止条件就是突变后的字符串==end。其中增加visited来保存已经遇到过的有效 突变字符串,以增加运算速度。 Runtime: 12 ms, faster than 88.32% of Python online submissions for Mini...
2
stack_v2_sparse_classes_30k_train_014415
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMutation(self, start, end, bank): :type start: str :type end: str :type bank: List[str] :rtype: int bfs思想,队列中保持每个遍历的有效字符串和其突变的基因个数元组,即(start, step)元组。类似走迷宫,四个方向就是可变的四 个字母"...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMutation(self, start, end, bank): :type start: str :type end: str :type bank: List[str] :rtype: int bfs思想,队列中保持每个遍历的有效字符串和其突变的基因个数元组,即(start, step)元组。类似走迷宫,四个方向就是可变的四 个字母"...
bad06f681d8d3f2b841cb3c8a969198b8643f864
<|skeleton|> class Solution: def minMutation(self, start, end, bank): """:type start: str :type end: str :type bank: List[str] :rtype: int bfs思想,队列中保持每个遍历的有效字符串和其突变的基因个数元组,即(start, step)元组。类似走迷宫,四个方向就是可变的四 个字母"ACGT",当突变后的字符串在bank中就step+1,终止条件就是突变后的字符串==end。其中增加visited来保存已经遇到过的有效 突变字符串,以增加运算速度。 Runtime: 12 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minMutation(self, start, end, bank): """:type start: str :type end: str :type bank: List[str] :rtype: int bfs思想,队列中保持每个遍历的有效字符串和其突变的基因个数元组,即(start, step)元组。类似走迷宫,四个方向就是可变的四 个字母"ACGT",当突变后的字符串在bank中就step+1,终止条件就是突变后的字符串==end。其中增加visited来保存已经遇到过的有效 突变字符串,以增加运算速度。 Runtime: 12 ms, faster tha...
the_stack_v2_python_sparse
433_mini_genetic_mutation.py
subicWang/leetcode_aotang
train
0
fac4bbd5aeead4d418ed6febd646313290cb0202
[ "try:\n return OaiHarvesterMetadataFormatSet.objects.get(harvester_metadata_format=oai_harvester_metadata_format, harvester_set=oai_harvester_set)\nexcept mongoengine_errors.DoesNotExist as e:\n raise exceptions.DoesNotExist(str(e))\nexcept Exception as e:\n raise exceptions.ModelError(str(e))", "try:\n ...
<|body_start_0|> try: return OaiHarvesterMetadataFormatSet.objects.get(harvester_metadata_format=oai_harvester_metadata_format, harvester_set=oai_harvester_set) except mongoengine_errors.DoesNotExist as e: raise exceptions.DoesNotExist(str(e)) except Exception as e: ...
Association table between OaiHarvesterMetadataFormat and OaiHarvesterSet
OaiHarvesterMetadataFormatSet
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OaiHarvesterMetadataFormatSet: """Association table between OaiHarvesterMetadataFormat and OaiHarvesterSet""" def get_by_metadata_format_and_set(oai_harvester_metadata_format, oai_harvester_set): """Get an OaiHarvesterMetadataFormatSet by its OaiHarvesterMetadataFormat and OaiHarvest...
stack_v2_sparse_classes_36k_train_033389
2,525
permissive
[ { "docstring": "Get an OaiHarvesterMetadataFormatSet by its OaiHarvesterMetadataFormat and OaiHarvesterSet. Args: oai_harvester_metadata_format: oai_harvester_set: Returns: OaiHarvesterMetadataFormatSet instance.", "name": "get_by_metadata_format_and_set", "signature": "def get_by_metadata_format_and_se...
2
stack_v2_sparse_classes_30k_train_020831
Implement the Python class `OaiHarvesterMetadataFormatSet` described below. Class description: Association table between OaiHarvesterMetadataFormat and OaiHarvesterSet Method signatures and docstrings: - def get_by_metadata_format_and_set(oai_harvester_metadata_format, oai_harvester_set): Get an OaiHarvesterMetadataF...
Implement the Python class `OaiHarvesterMetadataFormatSet` described below. Class description: Association table between OaiHarvesterMetadataFormat and OaiHarvesterSet Method signatures and docstrings: - def get_by_metadata_format_and_set(oai_harvester_metadata_format, oai_harvester_set): Get an OaiHarvesterMetadataF...
e41fd9c5a75b51dc626995e753a5840f238a557d
<|skeleton|> class OaiHarvesterMetadataFormatSet: """Association table between OaiHarvesterMetadataFormat and OaiHarvesterSet""" def get_by_metadata_format_and_set(oai_harvester_metadata_format, oai_harvester_set): """Get an OaiHarvesterMetadataFormatSet by its OaiHarvesterMetadataFormat and OaiHarvest...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OaiHarvesterMetadataFormatSet: """Association table between OaiHarvesterMetadataFormat and OaiHarvesterSet""" def get_by_metadata_format_and_set(oai_harvester_metadata_format, oai_harvester_set): """Get an OaiHarvesterMetadataFormatSet by its OaiHarvesterMetadataFormat and OaiHarvesterSet. Args: ...
the_stack_v2_python_sparse
core_oaipmh_harvester_app/components/oai_harvester_metadata_format_set/models.py
faical-yannick-congo/core_oaipmh_harvester_app
train
0
da814904d40b66b3e6bd2b8a43af2e420a90ad77
[ "super(EncoderLayer, self).__init__()\nself.multi_head_attention = MultiHeadAttention(d_model, number_of_heads)\nself.feed_forward_network = point_wise_feed_forward_network(d_model, dff)\nself.normalization_layer1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.normalization_layer2 = tf.keras.layers.Layer...
<|body_start_0|> super(EncoderLayer, self).__init__() self.multi_head_attention = MultiHeadAttention(d_model, number_of_heads) self.feed_forward_network = point_wise_feed_forward_network(d_model, dff) self.normalization_layer1 = tf.keras.layers.LayerNormalization(epsilon=1e-06) s...
Encoder layer consists of multi-head attention followed by normalization layer and point wised feed forward network followed with normalization layer
EncoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderLayer: """Encoder layer consists of multi-head attention followed by normalization layer and point wised feed forward network followed with normalization layer""" def __init__(self, d_model, number_of_heads, dff, rate=0.1): """Constructor for encoder layer :param d_model: dime...
stack_v2_sparse_classes_36k_train_033390
11,425
no_license
[ { "docstring": "Constructor for encoder layer :param d_model: dimension of the word embedding vector :param number_of_heads: number of heads to work in parallel :param dff: inner-layer dimensionality :param rate: dropout rate", "name": "__init__", "signature": "def __init__(self, d_model, number_of_head...
2
stack_v2_sparse_classes_30k_train_004776
Implement the Python class `EncoderLayer` described below. Class description: Encoder layer consists of multi-head attention followed by normalization layer and point wised feed forward network followed with normalization layer Method signatures and docstrings: - def __init__(self, d_model, number_of_heads, dff, rate...
Implement the Python class `EncoderLayer` described below. Class description: Encoder layer consists of multi-head attention followed by normalization layer and point wised feed forward network followed with normalization layer Method signatures and docstrings: - def __init__(self, d_model, number_of_heads, dff, rate...
f164c21ed852dfd10a4701f4050d72dc87bd302a
<|skeleton|> class EncoderLayer: """Encoder layer consists of multi-head attention followed by normalization layer and point wised feed forward network followed with normalization layer""" def __init__(self, d_model, number_of_heads, dff, rate=0.1): """Constructor for encoder layer :param d_model: dime...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderLayer: """Encoder layer consists of multi-head attention followed by normalization layer and point wised feed forward network followed with normalization layer""" def __init__(self, d_model, number_of_heads, dff, rate=0.1): """Constructor for encoder layer :param d_model: dimension of the ...
the_stack_v2_python_sparse
backend/code/transformer_model.py
sovaso/NewsHeadlineGenerator
train
3
b9b149b2b78d9611ce71b794833735cffeeccbfb
[ "if request.method == 'PUT':\n if 'bio' not in data or 'website' not in data:\n raise ValidationError('Missing one or more fields.')", "if data is None:\n raise ValidationError('No data was provided')\nreturn Artist(**data)" ]
<|body_start_0|> if request.method == 'PUT': if 'bio' not in data or 'website' not in data: raise ValidationError('Missing one or more fields.') <|end_body_0|> <|body_start_1|> if data is None: raise ValidationError('No data was provided') return Artist(*...
Class to serialize and deserialize Artist objects.
ArtistSchema
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArtistSchema: """Class to serialize and deserialize Artist objects.""" def validate_on_put_request(self, data, **kwargs): """Raise a ValidationError if certain fields are not sent during a PUT request.""" <|body_0|> def make_object(self, data, **kwargs): """Retur...
stack_v2_sparse_classes_36k_train_033391
1,406
no_license
[ { "docstring": "Raise a ValidationError if certain fields are not sent during a PUT request.", "name": "validate_on_put_request", "signature": "def validate_on_put_request(self, data, **kwargs)" }, { "docstring": "Return an artist object from the validated data.", "name": "make_object", ...
2
stack_v2_sparse_classes_30k_test_000573
Implement the Python class `ArtistSchema` described below. Class description: Class to serialize and deserialize Artist objects. Method signatures and docstrings: - def validate_on_put_request(self, data, **kwargs): Raise a ValidationError if certain fields are not sent during a PUT request. - def make_object(self, d...
Implement the Python class `ArtistSchema` described below. Class description: Class to serialize and deserialize Artist objects. Method signatures and docstrings: - def validate_on_put_request(self, data, **kwargs): Raise a ValidationError if certain fields are not sent during a PUT request. - def make_object(self, d...
d5ae552d383f5f971e29a38055c518fc68172f32
<|skeleton|> class ArtistSchema: """Class to serialize and deserialize Artist objects.""" def validate_on_put_request(self, data, **kwargs): """Raise a ValidationError if certain fields are not sent during a PUT request.""" <|body_0|> def make_object(self, data, **kwargs): """Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArtistSchema: """Class to serialize and deserialize Artist objects.""" def validate_on_put_request(self, data, **kwargs): """Raise a ValidationError if certain fields are not sent during a PUT request.""" if request.method == 'PUT': if 'bio' not in data or 'website' not in dat...
the_stack_v2_python_sparse
server/app/api/schemas/artist.py
EricMontague/MailChimp-Newsletter-Project
train
0
e7006182bc3f9a55106d69e7a908bd54208a51d8
[ "prohibited_url_words = ['index', 'home', 'default']\nerror_message = _(\"Sorry! We're growing fast. That website name is \\n already in use. Please choose another.\")\nregex_validation = RegexValidator(regex='^[\\\\w]+$', message=error_message)\nad_rep_url = self.cleaned_data.get('ad_rep_url', '').lower...
<|body_start_0|> prohibited_url_words = ['index', 'home', 'default'] error_message = _("Sorry! We're growing fast. That website name is \n already in use. Please choose another.") regex_validation = RegexValidator(regex='^[\\w]+$', message=error_message) ad_rep_url = self.clea...
Ad rep url form.
AdRepUrlForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdRepUrlForm: """Ad rep url form.""" def clean_ad_rep_url(self): """Validate url and check if it is already in use by existing ad reps.""" <|body_0|> def save(self, ad_rep): """Save url to ad rep.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_033392
7,830
no_license
[ { "docstring": "Validate url and check if it is already in use by existing ad reps.", "name": "clean_ad_rep_url", "signature": "def clean_ad_rep_url(self)" }, { "docstring": "Save url to ad rep.", "name": "save", "signature": "def save(self, ad_rep)" } ]
2
null
Implement the Python class `AdRepUrlForm` described below. Class description: Ad rep url form. Method signatures and docstrings: - def clean_ad_rep_url(self): Validate url and check if it is already in use by existing ad reps. - def save(self, ad_rep): Save url to ad rep.
Implement the Python class `AdRepUrlForm` described below. Class description: Ad rep url form. Method signatures and docstrings: - def clean_ad_rep_url(self): Validate url and check if it is already in use by existing ad reps. - def save(self, ad_rep): Save url to ad rep. <|skeleton|> class AdRepUrlForm: """Ad r...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class AdRepUrlForm: """Ad rep url form.""" def clean_ad_rep_url(self): """Validate url and check if it is already in use by existing ad reps.""" <|body_0|> def save(self, ad_rep): """Save url to ad rep.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdRepUrlForm: """Ad rep url form.""" def clean_ad_rep_url(self): """Validate url and check if it is already in use by existing ad reps.""" prohibited_url_words = ['index', 'home', 'default'] error_message = _("Sorry! We're growing fast. That website name is \n already i...
the_stack_v2_python_sparse
firestorm/forms.py
wcirillo/ten
train
0
71c75b31a09f7d93ea8035a59b9b32f0b482f86a
[ "self.affine_layer = Affine()\nself.relu_layer = ReLU()\nif batch_norm_param is not None:\n self.batch_norm_layer = BatchNorm(eps=batch_norm_param['eps'], momentum=batch_norm_param['momentum'], running_mean=batch_norm_param.get('running_mean', None), running_var=batch_norm_param.get('running_var', None))\nelse:\...
<|body_start_0|> self.affine_layer = Affine() self.relu_layer = ReLU() if batch_norm_param is not None: self.batch_norm_layer = BatchNorm(eps=batch_norm_param['eps'], momentum=batch_norm_param['momentum'], running_mean=batch_norm_param.get('running_mean', None), running_var=batch_nor...
AffineBatchNormReLU
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AffineBatchNormReLU: def __init__(self, batch_norm_param=None): """Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input...
stack_v2_sparse_classes_36k_train_033393
2,695
no_license
[ { "docstring": "Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input has shape (N, D), then this is array of shape (D,) - running_var: if input...
3
null
Implement the Python class `AffineBatchNormReLU` described below. Class description: Implement the AffineBatchNormReLU class. Method signatures and docstrings: - def __init__(self, batch_norm_param=None): Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stabi...
Implement the Python class `AffineBatchNormReLU` described below. Class description: Implement the AffineBatchNormReLU class. Method signatures and docstrings: - def __init__(self, batch_norm_param=None): Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stabi...
7da789ef34d5e5bcf9033cfbe0ff5df607b2437a
<|skeleton|> class AffineBatchNormReLU: def __init__(self, batch_norm_param=None): """Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AffineBatchNormReLU: def __init__(self, batch_norm_param=None): """Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input has shape (N,...
the_stack_v2_python_sparse
convolutional_neural_networks/conv_net/composite/affine_batch_norm_relu.py
calvinfeng/machine-learning-notebook
train
38
7cf58d3906fd27930ab2a46116a517948ff7d12d
[ "tx_power_idx_to_tx_power: Dict = {}\nfor channel, info in hardware_config['tx_power_idx_to_tx_power'].items():\n tx_power_idx_to_tx_power[channel] = {}\n for mcs, tx_data in info.items():\n tx_power_idx_to_tx_power[channel][mcs] = {}\n for tx_power_idx, tx_power in tx_data.items():\n ...
<|body_start_0|> tx_power_idx_to_tx_power: Dict = {} for channel, info in hardware_config['tx_power_idx_to_tx_power'].items(): tx_power_idx_to_tx_power[channel] = {} for mcs, tx_data in info.items(): tx_power_idx_to_tx_power[channel][mcs] = {} for ...
HardwareConfig
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HardwareConfig: def set_config(cls, hardware_config: Dict) -> None: """Set all hardware config params.""" <|body_0|> def get_pwr_offset(cls, target_pwr_idx: Optional[int]=None, ref_pwr_idx: Optional[int]=None, channel: Optional[str]=None, mcs: Optional[str]=None) -> int: ...
stack_v2_sparse_classes_36k_train_033394
4,491
permissive
[ { "docstring": "Set all hardware config params.", "name": "set_config", "signature": "def set_config(cls, hardware_config: Dict) -> None" }, { "docstring": "Estimate inr offset on target power idx, given inr at reference power idx.", "name": "get_pwr_offset", "signature": "def get_pwr_of...
3
stack_v2_sparse_classes_30k_train_003332
Implement the Python class `HardwareConfig` described below. Class description: Implement the HardwareConfig class. Method signatures and docstrings: - def set_config(cls, hardware_config: Dict) -> None: Set all hardware config params. - def get_pwr_offset(cls, target_pwr_idx: Optional[int]=None, ref_pwr_idx: Optiona...
Implement the Python class `HardwareConfig` described below. Class description: Implement the HardwareConfig class. Method signatures and docstrings: - def set_config(cls, hardware_config: Dict) -> None: Set all hardware config params. - def get_pwr_offset(cls, target_pwr_idx: Optional[int]=None, ref_pwr_idx: Optiona...
93c0c4bef28c1ed15dc61e9fd340a9faef4902e3
<|skeleton|> class HardwareConfig: def set_config(cls, hardware_config: Dict) -> None: """Set all hardware config params.""" <|body_0|> def get_pwr_offset(cls, target_pwr_idx: Optional[int]=None, ref_pwr_idx: Optional[int]=None, channel: Optional[str]=None, mcs: Optional[str]=None) -> int: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HardwareConfig: def set_config(cls, hardware_config: Dict) -> None: """Set all hardware config params.""" tx_power_idx_to_tx_power: Dict = {} for channel, info in hardware_config['tx_power_idx_to_tx_power'].items(): tx_power_idx_to_tx_power[channel] = {} for mcs...
the_stack_v2_python_sparse
scan_service/scan_service/utils/hardware_config.py
terragraph/tgnms
train
15
e720d7ab130c3b9c9b948ceec477ecb80dabe8db
[ "diff = [g - c for g, c in zip(gas, cost)]\nif sum(diff) < 0:\n return -1\ntank = 0\nlength = len(gas)\nfor index in range(length):\n tmp_index = index\n while True:\n tank += gas[tmp_index]\n tank -= cost[tmp_index]\n if tank < 0:\n break\n tmp_index = (tmp_index + 1...
<|body_start_0|> diff = [g - c for g, c in zip(gas, cost)] if sum(diff) < 0: return -1 tank = 0 length = len(gas) for index in range(length): tmp_index = index while True: tank += gas[tmp_index] tank -= cost[tmp_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit2(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_033395
2,266
no_license
[ { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit2", "signature": "def canCo...
2
stack_v2_sparse_classes_30k_train_021143
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit2(self, gas, cost): :type gas: List[int] :type cost: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit2(self, gas, cost): :type gas: List[int] :type cost: List[...
a8b59573dc201438ebd5a5ab64e9ac61255a4abd
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit2(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" diff = [g - c for g, c in zip(gas, cost)] if sum(diff) < 0: return -1 tank = 0 length = len(gas) for index in range(length): t...
the_stack_v2_python_sparse
summer/2018_07_21/gas-station.py
shaheming/leecode
train
0
ed136f158db0dbd2b6f1117708ef09c7b9e3f6d3
[ "hashmap = defaultdict(int)\nfor i in range(0, len(nums)):\n if hashmap[target - nums[i]] != 0:\n if prev_target not in [i + 1, nums.index(target - nums[i]) + 1]:\n return [i + 1, nums.index(target - nums[i]) + 1]\n hashmap[nums[i]] = 1\nreturn []", "results = []\nfor i in range(0, len(num...
<|body_start_0|> hashmap = defaultdict(int) for i in range(0, len(nums)): if hashmap[target - nums[i]] != 0: if prev_target not in [i + 1, nums.index(target - nums[i]) + 1]: return [i + 1, nums.index(target - nums[i]) + 1] hashmap[nums[i]] = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, prev_target, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_033396
1,528
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, prev_target, nums, target)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_010073
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, prev_target, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, prev_target, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] ...
f0eb8d77a71737b677df57b49c27fb6a1b926249
<|skeleton|> class Solution: def twoSum(self, prev_target, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, prev_target, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" hashmap = defaultdict(int) for i in range(0, len(nums)): if hashmap[target - nums[i]] != 0: if prev_target not in [i + 1, nums.index(target...
the_stack_v2_python_sparse
ARRAY/pair_sum.py
shelly2904/DSA-Practice
train
0
60453fcbbf226df7d4d6a33405b9fc37ebb3d6b0
[ "self.equipment = {'Fins': 'Fins come in many shapes.', 'Mask': 'You always have to carry one extra mask with you.', 'Drysuit': 'Wear a drysuit in cold waters!', 'Bottles': 'Better be careful how you handle them', 'Computer': 'Always do the safety stops', 'Reel': 'Never go cave diving without it', 'Cookies': 'They ...
<|body_start_0|> self.equipment = {'Fins': 'Fins come in many shapes.', 'Mask': 'You always have to carry one extra mask with you.', 'Drysuit': 'Wear a drysuit in cold waters!', 'Bottles': 'Better be careful how you handle them', 'Computer': 'Always do the safety stops', 'Reel': 'Never go cave diving without it...
Equipment class
Equipment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Equipment: """Equipment class""" def __init__(self): """Initialize game equipment""" <|body_0|> def choose_equipment(self): """Prints the chosen equipment""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.equipment = {'Fins': 'Fins come in ma...
stack_v2_sparse_classes_36k_train_033397
2,871
no_license
[ { "docstring": "Initialize game equipment", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Prints the chosen equipment", "name": "choose_equipment", "signature": "def choose_equipment(self)" } ]
2
stack_v2_sparse_classes_30k_train_002617
Implement the Python class `Equipment` described below. Class description: Equipment class Method signatures and docstrings: - def __init__(self): Initialize game equipment - def choose_equipment(self): Prints the chosen equipment
Implement the Python class `Equipment` described below. Class description: Equipment class Method signatures and docstrings: - def __init__(self): Initialize game equipment - def choose_equipment(self): Prints the chosen equipment <|skeleton|> class Equipment: """Equipment class""" def __init__(self): ...
44be8376a16ce9cc8c66fe9f61b2203327f9301d
<|skeleton|> class Equipment: """Equipment class""" def __init__(self): """Initialize game equipment""" <|body_0|> def choose_equipment(self): """Prints the chosen equipment""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Equipment: """Equipment class""" def __init__(self): """Initialize game equipment""" self.equipment = {'Fins': 'Fins come in many shapes.', 'Mask': 'You always have to carry one extra mask with you.', 'Drysuit': 'Wear a drysuit in cold waters!', 'Bottles': 'Better be careful how you handl...
the_stack_v2_python_sparse
lpthw/ex45/equipment.py
io-ma/Zed-Shaw-s-books
train
1
d03817b18ff7246c3819d1184a32db3990788fae
[ "S_lst = list(S)\nJ_lst = list(J)\ncount = 0\nfor j in J_lst:\n for s in S_lst:\n if j == s:\n count += 1\nreturn count", "S_lst = list(S)\nJ_lst = list(J)\ncount = 0\nfor j in J_lst:\n count += S_lst.count(j)\nreturn count" ]
<|body_start_0|> S_lst = list(S) J_lst = list(J) count = 0 for j in J_lst: for s in S_lst: if j == s: count += 1 return count <|end_body_0|> <|body_start_1|> S_lst = list(S) J_lst = list(J) count = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_0|> def numJewelsInStones_fast(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> S_lst = list(S) ...
stack_v2_sparse_classes_36k_train_033398
1,474
no_license
[ { "docstring": ":type J: str :type S: str :rtype: int", "name": "numJewelsInStones", "signature": "def numJewelsInStones(self, J, S)" }, { "docstring": ":type J: str :type S: str :rtype: int", "name": "numJewelsInStones_fast", "signature": "def numJewelsInStones_fast(self, J, S)" } ]
2
stack_v2_sparse_classes_30k_train_010145
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numJewelsInStones(self, J, S): :type J: str :type S: str :rtype: int - def numJewelsInStones_fast(self, J, S): :type J: str :type S: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numJewelsInStones(self, J, S): :type J: str :type S: str :rtype: int - def numJewelsInStones_fast(self, J, S): :type J: str :type S: str :rtype: int <|skeleton|> class Solut...
96e2faaa8c18636c173883cca55b2c228c81477a
<|skeleton|> class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_0|> def numJewelsInStones_fast(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" S_lst = list(S) J_lst = list(J) count = 0 for j in J_lst: for s in S_lst: if j == s: count += 1 return count def numJewe...
the_stack_v2_python_sparse
py/JewelsAndStones.py
ZihengZZH/LeetCode
train
1
aad2d493d2b0b72831f52977cb20e5226e7916d5
[ "path = '/'.join(['', _zone, 'exp', instrument, experiment, type])\nh.checkAccess(path)\nmodel = IrodsModel()\nruns = []\nfor r in self._allRuns(model, path):\n run_url = h.url_for(action='show', instrument=instrument, experiment=experiment, type=type, runs=str(r), qualified=True)\n runs.append(dict(run=r, ur...
<|body_start_0|> path = '/'.join(['', _zone, 'exp', instrument, experiment, type]) h.checkAccess(path) model = IrodsModel() runs = [] for r in self._allRuns(model, path): run_url = h.url_for(action='show', instrument=instrument, experiment=experiment, type=type, runs=...
RunsController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunsController: def index(self, instrument, experiment, type): """GET /runs/{instrument}/{experiment}/{type}""" <|body_0|> def show(self, instrument, experiment, type, runs): """GET /runs/{instrument}/{experiment}/{type}/{runs}""" <|body_1|> def _runList...
stack_v2_sparse_classes_36k_train_033399
5,244
no_license
[ { "docstring": "GET /runs/{instrument}/{experiment}/{type}", "name": "index", "signature": "def index(self, instrument, experiment, type)" }, { "docstring": "GET /runs/{instrument}/{experiment}/{type}/{runs}", "name": "show", "signature": "def show(self, instrument, experiment, type, run...
4
null
Implement the Python class `RunsController` described below. Class description: Implement the RunsController class. Method signatures and docstrings: - def index(self, instrument, experiment, type): GET /runs/{instrument}/{experiment}/{type} - def show(self, instrument, experiment, type, runs): GET /runs/{instrument}...
Implement the Python class `RunsController` described below. Class description: Implement the RunsController class. Method signatures and docstrings: - def index(self, instrument, experiment, type): GET /runs/{instrument}/{experiment}/{type} - def show(self, instrument, experiment, type, runs): GET /runs/{instrument}...
f32870a987a7493e7bf0f0a5c1712a5a030ef199
<|skeleton|> class RunsController: def index(self, instrument, experiment, type): """GET /runs/{instrument}/{experiment}/{type}""" <|body_0|> def show(self, instrument, experiment, type, runs): """GET /runs/{instrument}/{experiment}/{type}/{runs}""" <|body_1|> def _runList...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunsController: def index(self, instrument, experiment, type): """GET /runs/{instrument}/{experiment}/{type}""" path = '/'.join(['', _zone, 'exp', instrument, experiment, type]) h.checkAccess(path) model = IrodsModel() runs = [] for r in self._allRuns(model, pat...
the_stack_v2_python_sparse
iRODSAccess/tags/V00-00-03/web/irodsws/controllers/runs.py
connectthefuture/psdmrepo
train
0