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
5b1ad6646a7d573ef1a49ef139c5882ad6079bbc
[ "super().__init__()\nsiiFiles = directory.glob('**/*.sii' if recursive is True else '*.sii')\nsiiFiles = sorted(siiFiles, key=lambda file: file.stat().st_size, reverse=True)\nwith Pool() as pool:\n subDefinitions = pool.map(DefinitionFile, siiFiles)\nfor subDefinition in subDefinitions:\n self.merge(subDefini...
<|body_start_0|> super().__init__() siiFiles = directory.glob('**/*.sii' if recursive is True else '*.sii') siiFiles = sorted(siiFiles, key=lambda file: file.stat().st_size, reverse=True) with Pool() as pool: subDefinitions = pool.map(DefinitionFile, siiFiles) for sub...
SCS definition data (*.sii) represented as a cross-referenced graph of dictionaries, lists and items
Definition
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Definition: """SCS definition data (*.sii) represented as a cross-referenced graph of dictionaries, lists and items""" def __init__(self, directory: Path, recursive=False): """Read a SCS definition files (*.sii) from a directory and merge them into a single in-memory graph""" ...
stack_v2_sparse_classes_36k_train_034500
14,891
permissive
[ { "docstring": "Read a SCS definition files (*.sii) from a directory and merge them into a single in-memory graph", "name": "__init__", "signature": "def __init__(self, directory: Path, recursive=False)" }, { "docstring": "Recursively merge with another definition file and check for duplicate va...
4
stack_v2_sparse_classes_30k_train_006584
Implement the Python class `Definition` described below. Class description: SCS definition data (*.sii) represented as a cross-referenced graph of dictionaries, lists and items Method signatures and docstrings: - def __init__(self, directory: Path, recursive=False): Read a SCS definition files (*.sii) from a director...
Implement the Python class `Definition` described below. Class description: SCS definition data (*.sii) represented as a cross-referenced graph of dictionaries, lists and items Method signatures and docstrings: - def __init__(self, directory: Path, recursive=False): Read a SCS definition files (*.sii) from a director...
735f6a07eab7ccfd8632ea6ec93854b26e1902d0
<|skeleton|> class Definition: """SCS definition data (*.sii) represented as a cross-referenced graph of dictionaries, lists and items""" def __init__(self, directory: Path, recursive=False): """Read a SCS definition files (*.sii) from a directory and merge them into a single in-memory graph""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Definition: """SCS definition data (*.sii) represented as a cross-referenced graph of dictionaries, lists and items""" def __init__(self, directory: Path, recursive=False): """Read a SCS definition files (*.sii) from a directory and merge them into a single in-memory graph""" super().__in...
the_stack_v2_python_sparse
autodrome/policeman/definition.py
OSSDC/autodrome
train
2
95c52ef6fc41df3102fad5d0ffc46d2fdb8b506a
[ "super()._swap(i, j)\nself._data[i]._index = i\nself._data[j]._index = j", "if j > 0 and self._data[j] < self._data[self._parent(j)]:\n self._upheap(j)\nelse:\n self._downheap(j)", "token = self.Locator(key, value, len(self._data))\nself._data.append(token)\nself._upheap(len(self._data) - 1)\nreturn token...
<|body_start_0|> super()._swap(i, j) self._data[i]._index = i self._data[j]._index = j <|end_body_0|> <|body_start_1|> if j > 0 and self._data[j] < self._data[self._parent(j)]: self._upheap(j) else: self._downheap(j) <|end_body_1|> <|body_start_2|> ...
a locator-based priority queue implemented with a binary heap
AdaptableHeapPriorityQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptableHeapPriorityQueue: """a locator-based priority queue implemented with a binary heap""" def _swap(self, i, j): """override swap to record new indices :param i: :param j: :return:""" <|body_0|> def _bubble(self, j): """manages the reinstatement of the heap...
stack_v2_sparse_classes_36k_train_034501
2,951
no_license
[ { "docstring": "override swap to record new indices :param i: :param j: :return:", "name": "_swap", "signature": "def _swap(self, i, j)" }, { "docstring": "manages the reinstatement of the heap-order property when a key has changed at an arbitrary position within the heap, either due to a key up...
5
stack_v2_sparse_classes_30k_train_005681
Implement the Python class `AdaptableHeapPriorityQueue` described below. Class description: a locator-based priority queue implemented with a binary heap Method signatures and docstrings: - def _swap(self, i, j): override swap to record new indices :param i: :param j: :return: - def _bubble(self, j): manages the rein...
Implement the Python class `AdaptableHeapPriorityQueue` described below. Class description: a locator-based priority queue implemented with a binary heap Method signatures and docstrings: - def _swap(self, i, j): override swap to record new indices :param i: :param j: :return: - def _bubble(self, j): manages the rein...
f79b08021cebbfe0ff32abcc8e9dd56af32e4aad
<|skeleton|> class AdaptableHeapPriorityQueue: """a locator-based priority queue implemented with a binary heap""" def _swap(self, i, j): """override swap to record new indices :param i: :param j: :return:""" <|body_0|> def _bubble(self, j): """manages the reinstatement of the heap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaptableHeapPriorityQueue: """a locator-based priority queue implemented with a binary heap""" def _swap(self, i, j): """override swap to record new indices :param i: :param j: :return:""" super()._swap(i, j) self._data[i]._index = i self._data[j]._index = j def _bub...
the_stack_v2_python_sparse
exercises/ch09_priority_queues/AdaptableHeapPriorityQueue.py
rarezhang/data_structures_and_algorithms_in_python
train
0
cc7974301495a200f82301736e6ec4d6d05b4ca2
[ "if current + towers[current] >= len(towers):\n return current + towers[current]\nsub = towers[current + 1:current + towers[current] + 1]\noptions = []\nfor i, v in enumerate(sub):\n if v == 0:\n options.append(v)\n else:\n options.append(v + i)\nif options:\n sub_next = options.index(max(...
<|body_start_0|> if current + towers[current] >= len(towers): return current + towers[current] sub = towers[current + 1:current + towers[current] + 1] options = [] for i, v in enumerate(sub): if v == 0: options.append(v) else: ...
NativeSolution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NativeSolution: def next_step(current, towers): """The following algorithm will try to identify the next best step :param current: :param towers: :return:""" <|body_0|> def is_hopable(towers): """Check if a given seq can be hap till user in position 0 will be able to...
stack_v2_sparse_classes_36k_train_034502
4,795
permissive
[ { "docstring": "The following algorithm will try to identify the next best step :param current: :param towers: :return:", "name": "next_step", "signature": "def next_step(current, towers)" }, { "docstring": "Check if a given seq can be hap till user in position 0 will be able to jump outside the...
2
stack_v2_sparse_classes_30k_train_014237
Implement the Python class `NativeSolution` described below. Class description: Implement the NativeSolution class. Method signatures and docstrings: - def next_step(current, towers): The following algorithm will try to identify the next best step :param current: :param towers: :return: - def is_hopable(towers): Chec...
Implement the Python class `NativeSolution` described below. Class description: Implement the NativeSolution class. Method signatures and docstrings: - def next_step(current, towers): The following algorithm will try to identify the next best step :param current: :param towers: :return: - def is_hopable(towers): Chec...
fd30805aa94332a6c14c9d8631c7044673fb3e2c
<|skeleton|> class NativeSolution: def next_step(current, towers): """The following algorithm will try to identify the next best step :param current: :param towers: :return:""" <|body_0|> def is_hopable(towers): """Check if a given seq can be hap till user in position 0 will be able to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NativeSolution: def next_step(current, towers): """The following algorithm will try to identify the next best step :param current: :param towers: :return:""" if current + towers[current] >= len(towers): return current + towers[current] sub = towers[current + 1:current + tow...
the_stack_v2_python_sparse
algo/problems/tower_hopper_problem.py
avi3tal/knowledgebase
train
0
9838acaf9191e34cd5814edc3f9e10548000e3e1
[ "import operator\nlookups = []\nfor frequency, name in FREQUENCY_CHOICES:\n time = datetime.now() - timedelta(seconds=frequency)\n lookups.append(models.Q(frequency=frequency, last_sent_time__lte=time))\nreturn self.filter(reduce(operator.or_, lookups))", "feed_cache = {}\nfor subscription in self.due():\n ...
<|body_start_0|> import operator lookups = [] for frequency, name in FREQUENCY_CHOICES: time = datetime.now() - timedelta(seconds=frequency) lookups.append(models.Q(frequency=frequency, last_sent_time__lte=time)) return self.filter(reduce(operator.or_, lookups)) <...
SubscriptionManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscriptionManager: def due(self): """Returns a queryset of all ``Subcription`` objects that are due to be sent.""" <|body_0|> def send_due(self, fail_silently=True): """Sends an alerts to each user who has a due ``Subscription`` if there are new items for their sub...
stack_v2_sparse_classes_36k_train_034503
6,918
permissive
[ { "docstring": "Returns a queryset of all ``Subcription`` objects that are due to be sent.", "name": "due", "signature": "def due(self)" }, { "docstring": "Sends an alerts to each user who has a due ``Subscription`` if there are new items for their subscription. *NOTE*: This can potentially take...
2
null
Implement the Python class `SubscriptionManager` described below. Class description: Implement the SubscriptionManager class. Method signatures and docstrings: - def due(self): Returns a queryset of all ``Subcription`` objects that are due to be sent. - def send_due(self, fail_silently=True): Sends an alerts to each ...
Implement the Python class `SubscriptionManager` described below. Class description: Implement the SubscriptionManager class. Method signatures and docstrings: - def due(self): Returns a queryset of all ``Subcription`` objects that are due to be sent. - def send_due(self, fail_silently=True): Sends an alerts to each ...
d07094f9d6b2528d282ed99af0063002480bc00b
<|skeleton|> class SubscriptionManager: def due(self): """Returns a queryset of all ``Subcription`` objects that are due to be sent.""" <|body_0|> def send_due(self, fail_silently=True): """Sends an alerts to each user who has a due ``Subscription`` if there are new items for their sub...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubscriptionManager: def due(self): """Returns a queryset of all ``Subcription`` objects that are due to be sent.""" import operator lookups = [] for frequency, name in FREQUENCY_CHOICES: time = datetime.now() - timedelta(seconds=frequency) lookups.appen...
the_stack_v2_python_sparse
populous/alerts/models.py
caiges/populous
train
2
a1e36dad1270247857b22cc6d3fd457c26d66e85
[ "if not root:\n return ''\nresult = [str(root.val)]\nqueue = deque([(root, result)])\nwhile queue:\n num_nodes = len(queue)\n for _ in range(len(queue)):\n currNode, currPath = queue.popleft()\n if currNode.left:\n currPath.append(str(currNode.left.val))\n queue.append((...
<|body_start_0|> if not root: return '' result = [str(root.val)] queue = deque([(root, result)]) while queue: num_nodes = len(queue) for _ in range(len(queue)): currNode, currPath = queue.popleft() if currNode.left: ...
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_034504
2,046
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:...
cbc38001423cb4facea69bad0c5ba1b49feb4e57
<|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 '' result = [str(root.val)] queue = deque([(root, result)]) while queue: num_nodes = len(queue) for _ in r...
the_stack_v2_python_sparse
297.SerializeAndDeserializeBinaryTree/serialize_deserialize.py
mayanbhadage/LeetCode
train
0
4c886ac1ce9e8d9461b3dfcf7a83fad8e8310861
[ "users_l = []\nfor _p in positions_l:\n related_l = self.filter(position=_p)\n for _r in related_l:\n users_l.append(_r.user)\nreturn users_l", "positions_l = []\nfor _u in users_l:\n related_l = self.filter(user=_u)\n for _r in related_l:\n positions_l.append(_r.position)\nreturn positi...
<|body_start_0|> users_l = [] for _p in positions_l: related_l = self.filter(position=_p) for _r in related_l: users_l.append(_r.user) return users_l <|end_body_0|> <|body_start_1|> positions_l = [] for _u in users_l: related_l...
Custom manager for Comment extending over django's default manager.
CommentManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentManager: """Custom manager for Comment extending over django's default manager.""" def query_on_position(self, positions_l): """Queries for users related to positions in positions_l.""" <|body_0|> def query_on_user(self, users_l): """Queries for positions ...
stack_v2_sparse_classes_36k_train_034505
8,407
no_license
[ { "docstring": "Queries for users related to positions in positions_l.", "name": "query_on_position", "signature": "def query_on_position(self, positions_l)" }, { "docstring": "Queries for positions related to users in users_l.", "name": "query_on_user", "signature": "def query_on_user(s...
2
stack_v2_sparse_classes_30k_train_009920
Implement the Python class `CommentManager` described below. Class description: Custom manager for Comment extending over django's default manager. Method signatures and docstrings: - def query_on_position(self, positions_l): Queries for users related to positions in positions_l. - def query_on_user(self, users_l): Q...
Implement the Python class `CommentManager` described below. Class description: Custom manager for Comment extending over django's default manager. Method signatures and docstrings: - def query_on_position(self, positions_l): Queries for users related to positions in positions_l. - def query_on_user(self, users_l): Q...
a062df4c6cb3118996d38f1a29c3258f2a960d8e
<|skeleton|> class CommentManager: """Custom manager for Comment extending over django's default manager.""" def query_on_position(self, positions_l): """Queries for users related to positions in positions_l.""" <|body_0|> def query_on_user(self, users_l): """Queries for positions ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommentManager: """Custom manager for Comment extending over django's default manager.""" def query_on_position(self, positions_l): """Queries for users related to positions in positions_l.""" users_l = [] for _p in positions_l: related_l = self.filter(position=_p) ...
the_stack_v2_python_sparse
coup/positions/models.py
dsawali/Co-Up
train
0
661f125bb46859dfd6afb06dec9ac6d2c6968f81
[ "self.ser = serial.Serial(port, baud, timeout=timeout)\ntime.sleep(5)\nself.filename = filename\nwith open(filename, 'r') as f:\n self.lines = [line.rstrip('\\n') for line in f]\n for item in self.lines:\n if item in 'ABCDEFGHIJKLMNOPQRSTUVXYZ':\n self.lines.remove(item)\nself.step = 0\nself...
<|body_start_0|> self.ser = serial.Serial(port, baud, timeout=timeout) time.sleep(5) self.filename = filename with open(filename, 'r') as f: self.lines = [line.rstrip('\n') for line in f] for item in self.lines: if item in 'ABCDEFGHIJKLMNOPQRSTUVXY...
.
Writer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Writer: """.""" def __init__(self, filename, port, timeout, baud=9600): """Constructor.""" <|body_0|> def refresh(self): """Read in new data from the file and split it.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ser = serial.Serial(por...
stack_v2_sparse_classes_36k_train_034506
1,258
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, filename, port, timeout, baud=9600)" }, { "docstring": "Read in new data from the file and split it.", "name": "refresh", "signature": "def refresh(self)" } ]
2
stack_v2_sparse_classes_30k_train_013962
Implement the Python class `Writer` described below. Class description: . Method signatures and docstrings: - def __init__(self, filename, port, timeout, baud=9600): Constructor. - def refresh(self): Read in new data from the file and split it.
Implement the Python class `Writer` described below. Class description: . Method signatures and docstrings: - def __init__(self, filename, port, timeout, baud=9600): Constructor. - def refresh(self): Read in new data from the file and split it. <|skeleton|> class Writer: """.""" def __init__(self, filename,...
480d96309746be125c28f3795d78c84931181c00
<|skeleton|> class Writer: """.""" def __init__(self, filename, port, timeout, baud=9600): """Constructor.""" <|body_0|> def refresh(self): """Read in new data from the file and split it.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Writer: """.""" def __init__(self, filename, port, timeout, baud=9600): """Constructor.""" self.ser = serial.Serial(port, baud, timeout=timeout) time.sleep(5) self.filename = filename with open(filename, 'r') as f: self.lines = [line.rstrip('\n') for li...
the_stack_v2_python_sparse
New TRTL Prototype/boardless/serial_writer.py
mkpjnx/MEO_Sat_Tracking
train
0
7524c704a01da2dafe7261aadd7ae98eba7a1c3a
[ "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.
PolicyAppServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolicyAppServiceServicer: """Missing associated documentation comment in .proto file.""" def users_include_access_roles(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def users_include_roles(self, request, context): ...
stack_v2_sparse_classes_36k_train_034507
11,397
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "users_include_access_roles", "signature": "def users_include_access_roles(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "users_include_roles", ...
5
stack_v2_sparse_classes_30k_test_000121
Implement the Python class `PolicyAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def users_include_access_roles(self, request, context): Missing associated documentation comment in .proto file. - def users_include_ro...
Implement the Python class `PolicyAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def users_include_access_roles(self, request, context): Missing associated documentation comment in .proto file. - def users_include_ro...
55d36c068e26e13ee5bae5c033e2e17784c63feb
<|skeleton|> class PolicyAppServiceServicer: """Missing associated documentation comment in .proto file.""" def users_include_access_roles(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def users_include_roles(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolicyAppServiceServicer: """Missing associated documentation comment in .proto file.""" def users_include_access_roles(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Meth...
the_stack_v2_python_sparse
src/resource/proto/_generated/identity/policy_app_service_pb2_grpc.py
arkanmgerges/cafm.identity
train
0
e29ab9eb2e299c470e8d3d6bb3510d61c9bec0ea
[ "self.Whf = np.random.normal(size=(h + i, h))\nself.Whb = np.random.normal(size=(h + i, h))\nself.Wy = np.random.normal(size=(2 * h, o))\nself.bhb = np.zeros((1, h))\nself.bhf = np.zeros((1, h))\nself.by = np.zeros((1, o))", "con = np.concatenate((h_prev, x_t), axis=1)\nh_next = np.tanh(np.matmul(con, self.Whf) +...
<|body_start_0|> self.Whf = np.random.normal(size=(h + i, h)) self.Whb = np.random.normal(size=(h + i, h)) self.Wy = np.random.normal(size=(2 * h, o)) self.bhb = np.zeros((1, h)) self.bhf = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> ...
represents a bidirectional cell of a RNN
BidirectionalCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalCell: """represents a bidirectional cell of a RNN""" def __init__(self, i, h, o): """Constructor @i: dimensionality of the data @h: dimensionality of the hidden state @o: dimensionality of the outputs public instance attributes Whf, Whb, Wy, bhf, bhb, by weights and bias...
stack_v2_sparse_classes_36k_train_034508
1,430
no_license
[ { "docstring": "Constructor @i: dimensionality of the data @h: dimensionality of the hidden state @o: dimensionality of the outputs public instance attributes Whf, Whb, Wy, bhf, bhb, by weights and biases @Whf and bhf are for the hidden states in the forward direction @Whb and bhb are for the hidden states in t...
2
null
Implement the Python class `BidirectionalCell` described below. Class description: represents a bidirectional cell of a RNN Method signatures and docstrings: - def __init__(self, i, h, o): Constructor @i: dimensionality of the data @h: dimensionality of the hidden state @o: dimensionality of the outputs public instan...
Implement the Python class `BidirectionalCell` described below. Class description: represents a bidirectional cell of a RNN Method signatures and docstrings: - def __init__(self, i, h, o): Constructor @i: dimensionality of the data @h: dimensionality of the hidden state @o: dimensionality of the outputs public instan...
e20b284d5f1841952104d7d9a0274cff80eb304d
<|skeleton|> class BidirectionalCell: """represents a bidirectional cell of a RNN""" def __init__(self, i, h, o): """Constructor @i: dimensionality of the data @h: dimensionality of the hidden state @o: dimensionality of the outputs public instance attributes Whf, Whb, Wy, bhf, bhb, by weights and bias...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BidirectionalCell: """represents a bidirectional cell of a RNN""" def __init__(self, i, h, o): """Constructor @i: dimensionality of the data @h: dimensionality of the hidden state @o: dimensionality of the outputs public instance attributes Whf, Whb, Wy, bhf, bhb, by weights and biases @Whf and b...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/5-bi_forward.py
jgadelugo/holbertonschool-machine_learning
train
1
652a1e2e8b6505c8509e78e302d308bdd1f23802
[ "max_texture_size = pyglet.image.get_max_texture_size()\nwidth = min(width, max_texture_size)\nheight = min(height, max_texture_size)\nself.texture = pyglet.image.Texture.create(width, height)\nself.allocator = Allocator(width, height)", "x, y = self.allocator.alloc(img.width + border * 2, img.height + border * 2...
<|body_start_0|> max_texture_size = pyglet.image.get_max_texture_size() width = min(width, max_texture_size) height = min(height, max_texture_size) self.texture = pyglet.image.Texture.create(width, height) self.allocator = Allocator(width, height) <|end_body_0|> <|body_start_1|>...
Collection of images within a texture.
TextureAtlas
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextureAtlas: """Collection of images within a texture.""" def __init__(self, width: int=2048, height: int=2048) -> None: """Create a texture atlas of the given size. :Parameters: `width` : int Width of the underlying texture. `height` : int Height of the underlying texture.""" ...
stack_v2_sparse_classes_36k_train_034509
10,284
permissive
[ { "docstring": "Create a texture atlas of the given size. :Parameters: `width` : int Width of the underlying texture. `height` : int Height of the underlying texture.", "name": "__init__", "signature": "def __init__(self, width: int=2048, height: int=2048) -> None" }, { "docstring": "Add an imag...
2
stack_v2_sparse_classes_30k_train_010755
Implement the Python class `TextureAtlas` described below. Class description: Collection of images within a texture. Method signatures and docstrings: - def __init__(self, width: int=2048, height: int=2048) -> None: Create a texture atlas of the given size. :Parameters: `width` : int Width of the underlying texture. ...
Implement the Python class `TextureAtlas` described below. Class description: Collection of images within a texture. Method signatures and docstrings: - def __init__(self, width: int=2048, height: int=2048) -> None: Create a texture atlas of the given size. :Parameters: `width` : int Width of the underlying texture. ...
094c638f0529fecab4e74556487b92453a78753c
<|skeleton|> class TextureAtlas: """Collection of images within a texture.""" def __init__(self, width: int=2048, height: int=2048) -> None: """Create a texture atlas of the given size. :Parameters: `width` : int Width of the underlying texture. `height` : int Height of the underlying texture.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextureAtlas: """Collection of images within a texture.""" def __init__(self, width: int=2048, height: int=2048) -> None: """Create a texture atlas of the given size. :Parameters: `width` : int Width of the underlying texture. `height` : int Height of the underlying texture.""" max_textur...
the_stack_v2_python_sparse
pyglet/image/atlas.py
pyglet/pyglet
train
1,687
2c5b120378b854c59e6aa7f15a525296597de0e4
[ "content = '\\n\\n {% load static %}\\n Hi {{ taster_first_name }},\\n\\n {% if placed_order %}\\n Thank you so much for attending my Vinely Taste Party and ordering some wine! I hope you had a great time and you and your personality are getting along great. Don\\'t forget to rate your w...
<|body_start_0|> content = '\n\n {% load static %}\n Hi {{ taster_first_name }},\n\n {% if placed_order %}\n Thank you so much for attending my Vinely Taste Party and ordering some wine! I hope you had a great time and you and your personality are getting along great. Don\'t forget t...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> content = '\n\n {% load static %}\n ...
stack_v2_sparse_classes_36k_train_034510
4,891
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_000555
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
c5c7d8a0b1a297e07302870017d3fb03c5dbb009
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" content = '\n\n {% load static %}\n Hi {{ taster_first_name }},\n\n {% if placed_order %}\n Thank you so much for attending my Vinely Taste Party and ordering some wine! I hope you had a gre...
the_stack_v2_python_sparse
cms/migrations/0008_add_thanks_message_section.py
RSV3/nuvine
train
0
9877e8e2fa65092ca98d590584bc5f0f7b15644d
[ "if sandbox_id in sandboxes:\n return (sandboxes[sandbox_id].to_dict(), 200)\nelse:\n return ('', 200)", "if sandbox_id not in sandboxes:\n return (None, 404)\nelse:\n sandbox = sandboxes[sandbox_id]\n sandbox.stop()\n return ({}, 204)" ]
<|body_start_0|> if sandbox_id in sandboxes: return (sandboxes[sandbox_id].to_dict(), 200) else: return ('', 200) <|end_body_0|> <|body_start_1|> if sandbox_id not in sandboxes: return (None, 404) else: sandbox = sandboxes[sandbox_id] ...
The sandbox REST resource.
Sandbox
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sandbox: """The sandbox REST resource.""" def get(self, sandbox_id): """Get the current instance of the sandbox.""" <|body_0|> def delete(self, sandbox_id): """Delete the current sandbox instance.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_034511
11,386
permissive
[ { "docstring": "Get the current instance of the sandbox.", "name": "get", "signature": "def get(self, sandbox_id)" }, { "docstring": "Delete the current sandbox instance.", "name": "delete", "signature": "def delete(self, sandbox_id)" } ]
2
stack_v2_sparse_classes_30k_train_004483
Implement the Python class `Sandbox` described below. Class description: The sandbox REST resource. Method signatures and docstrings: - def get(self, sandbox_id): Get the current instance of the sandbox. - def delete(self, sandbox_id): Delete the current sandbox instance.
Implement the Python class `Sandbox` described below. Class description: The sandbox REST resource. Method signatures and docstrings: - def get(self, sandbox_id): Get the current instance of the sandbox. - def delete(self, sandbox_id): Delete the current sandbox instance. <|skeleton|> class Sandbox: """The sandb...
33c4aa24ca8daf26f2c8f2d2fa38d7f4bf750cfa
<|skeleton|> class Sandbox: """The sandbox REST resource.""" def get(self, sandbox_id): """Get the current instance of the sandbox.""" <|body_0|> def delete(self, sandbox_id): """Delete the current sandbox instance.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sandbox: """The sandbox REST resource.""" def get(self, sandbox_id): """Get the current instance of the sandbox.""" if sandbox_id in sandboxes: return (sandboxes[sandbox_id].to_dict(), 200) else: return ('', 200) def delete(self, sandbox_id): "...
the_stack_v2_python_sparse
tac/gui/launcher/api/resources/sandboxes.py
fetchai/agents-tac
train
30
0138634a824ddfbf85c9d5dda1f3bd62afb2ca90
[ "if not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nd, n = data.shape\nif n < 2:\n raise ValueError('data must contain multiple data points')\nself.mean = np.mean(data, axis=1).reshape(d, 1)\ndev = data - self.mean\nself.cov = np.matmul(dev, dev....
<|body_start_0|> if not isinstance(data, np.ndarray) or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') d, n = data.shape if n < 2: raise ValueError('data must contain multiple data points') self.mean = np.mean(data, axis=1).reshape(d, 1) ...
Class for MultiNormal that represents a multivariate Normal distribution
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """Class for MultiNormal that represents a multivariate Normal distribution""" def __init__(self, data): """constructor @data: np.ndarray shape(d, n) with data set @n: number of data points @d: number of dimensions in each data point""" <|body_0|> def pdf(se...
stack_v2_sparse_classes_36k_train_034512
1,591
no_license
[ { "docstring": "constructor @data: np.ndarray shape(d, n) with data set @n: number of data points @d: number of dimensions in each data point", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Calculates the PDF at a data point @x: is np.ndarray shape(d, 1) data poi...
2
stack_v2_sparse_classes_30k_train_009362
Implement the Python class `MultiNormal` described below. Class description: Class for MultiNormal that represents a multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): constructor @data: np.ndarray shape(d, n) with data set @n: number of data points @d: number of dimensions...
Implement the Python class `MultiNormal` described below. Class description: Class for MultiNormal that represents a multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): constructor @data: np.ndarray shape(d, n) with data set @n: number of data points @d: number of dimensions...
e20b284d5f1841952104d7d9a0274cff80eb304d
<|skeleton|> class MultiNormal: """Class for MultiNormal that represents a multivariate Normal distribution""" def __init__(self, data): """constructor @data: np.ndarray shape(d, n) with data set @n: number of data points @d: number of dimensions in each data point""" <|body_0|> def pdf(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """Class for MultiNormal that represents a multivariate Normal distribution""" def __init__(self, data): """constructor @data: np.ndarray shape(d, n) with data set @n: number of data points @d: number of dimensions in each data point""" if not isinstance(data, np.ndarray) or ...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
jgadelugo/holbertonschool-machine_learning
train
1
7735d0f1280b12d0e40d1491c659c7ad4aae22b4
[ "pattern = '^M?M?M?$'\npattern = '^M{0,3}$'\nfor t in self.case_values[0]:\n r = re.search(pattern, t)\n i = len(t)\n if i < 4:\n assert r is not None, 'ERROR: pattern %s should match %s' % (pattern, t)\n else:\n assert r is None, 'ERROR: pattern %s should NOT match %s' % (pattern, t)", ...
<|body_start_0|> pattern = '^M?M?M?$' pattern = '^M{0,3}$' for t in self.case_values[0]: r = re.search(pattern, t) i = len(t) if i < 4: assert r is not None, 'ERROR: pattern %s should match %s' % (pattern, t) else: a...
RegexMatch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegexMatch: def testMatchM2N(self): """match 0 - 3 M only""" <|body_0|> def testMatchXorY(self): """match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> pattern = '^M?M?M?$' pattern = '...
stack_v2_sparse_classes_36k_train_034513
1,205
no_license
[ { "docstring": "match 0 - 3 M only", "name": "testMatchM2N", "signature": "def testMatchM2N(self)" }, { "docstring": "match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:", "name": "testMatchXorY", "signature": "def testMatchXorY(self)" } ]
2
stack_v2_sparse_classes_30k_train_008725
Implement the Python class `RegexMatch` described below. Class description: Implement the RegexMatch class. Method signatures and docstrings: - def testMatchM2N(self): match 0 - 3 M only - def testMatchXorY(self): match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:
Implement the Python class `RegexMatch` described below. Class description: Implement the RegexMatch class. Method signatures and docstrings: - def testMatchM2N(self): match 0 - 3 M only - def testMatchXorY(self): match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return: <|skeleton|> class RegexMatch: def te...
eb171b45bbf2f29cd1307aefd8e4609b683773d8
<|skeleton|> class RegexMatch: def testMatchM2N(self): """match 0 - 3 M only""" <|body_0|> def testMatchXorY(self): """match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegexMatch: def testMatchM2N(self): """match 0 - 3 M only""" pattern = '^M?M?M?$' pattern = '^M{0,3}$' for t in self.case_values[0]: r = re.search(pattern, t) i = len(t) if i < 4: assert r is not None, 'ERROR: pattern %s shoul...
the_stack_v2_python_sparse
library-demos/regex/regex_m2n.py
lostsquirrel/python_test
train
0
5f9e3e72014e12bc210bdc5615fe9426b3b8ee88
[ "def dfs(node, depth):\n if not node:\n return\n if depth == d - 1:\n left = node.left if node.left else None\n node.left = TreeNode(v)\n node.left.left = left\n right = node.right if node.right else None\n node.right = TreeNode(v)\n node.right.right = right\n ...
<|body_start_0|> def dfs(node, depth): if not node: return if depth == d - 1: left = node.left if node.left else None node.left = TreeNode(v) node.left.left = left right = node.right if node.right else None ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addOneRow(self, root: TreeNode, v: int, d: int) -> TreeNode: """06/20/2020 17:37""" <|body_0|> def addOneRow(self, root: Optional[TreeNode], val: int, depth: int) -> Optional[TreeNode]: """10/21/2022 20:39""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_034514
3,360
no_license
[ { "docstring": "06/20/2020 17:37", "name": "addOneRow", "signature": "def addOneRow(self, root: TreeNode, v: int, d: int) -> TreeNode" }, { "docstring": "10/21/2022 20:39", "name": "addOneRow", "signature": "def addOneRow(self, root: Optional[TreeNode], val: int, depth: int) -> Optional[...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOneRow(self, root: TreeNode, v: int, d: int) -> TreeNode: 06/20/2020 17:37 - def addOneRow(self, root: Optional[TreeNode], val: int, depth: int) -> Optional[TreeNode]: 10/...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOneRow(self, root: TreeNode, v: int, d: int) -> TreeNode: 06/20/2020 17:37 - def addOneRow(self, root: Optional[TreeNode], val: int, depth: int) -> Optional[TreeNode]: 10/...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def addOneRow(self, root: TreeNode, v: int, d: int) -> TreeNode: """06/20/2020 17:37""" <|body_0|> def addOneRow(self, root: Optional[TreeNode], val: int, depth: int) -> Optional[TreeNode]: """10/21/2022 20:39""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addOneRow(self, root: TreeNode, v: int, d: int) -> TreeNode: """06/20/2020 17:37""" def dfs(node, depth): if not node: return if depth == d - 1: left = node.left if node.left else None node.left = TreeNode(v)...
the_stack_v2_python_sparse
leetcode/solved/623_Add_One_Row_to_Tree/solution.py
sungminoh/algorithms
train
0
5b6c6a4254b98d27640723845896c5353c6cf183
[ "store_view_obj = self.pool.get('magento.store.store_view')\nstore_view = store_view_obj.browse(cursor, user, context.get('active_id'))\nstore_view_obj.write(cursor, user, [store_view.id], {'last_order_export_time': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)\nsales = store_view_obj.export_orde...
<|body_start_0|> store_view_obj = self.pool.get('magento.store.store_view') store_view = store_view_obj.browse(cursor, user, context.get('active_id')) store_view_obj.write(cursor, user, [store_view.id], {'last_order_export_time': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context) ...
Export Orders
ExportOrders
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExportOrders: """Export Orders""" def export_orders(self, cursor, user, ids, context): """Export Orders Status to magento for the current store view :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Applic...
stack_v2_sparse_classes_36k_train_034515
2,337
no_license
[ { "docstring": "Export Orders Status to magento for the current store view :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Application context :return: Sale order view", "name": "export_orders", "signature": "def export_ord...
2
stack_v2_sparse_classes_30k_train_008986
Implement the Python class `ExportOrders` described below. Class description: Export Orders Method signatures and docstrings: - def export_orders(self, cursor, user, ids, context): Export Orders Status to magento for the current store view :param cursor: Database cursor :param user: ID of current user :param ids: Lis...
Implement the Python class `ExportOrders` described below. Class description: Export Orders Method signatures and docstrings: - def export_orders(self, cursor, user, ids, context): Export Orders Status to magento for the current store view :param cursor: Database cursor :param user: ID of current user :param ids: Lis...
f661c776973868c0414007791ae6a0b069b1038f
<|skeleton|> class ExportOrders: """Export Orders""" def export_orders(self, cursor, user, ids, context): """Export Orders Status to magento for the current store view :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Applic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExportOrders: """Export Orders""" def export_orders(self, cursor, user, ids, context): """Export Orders Status to magento for the current store view :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Application context...
the_stack_v2_python_sparse
wizard/export_orders.py
openlabs/magento_integration
train
23
5af610523def04185c9f244c5fa023d1230c4532
[ "self.joint_limits = dict()\nself.state_lock = Lock()\nrospy.init_node('JointLimitsRecorder', anonymous=True)\nrospy.Subscriber('/joint_states', JointState, self.jointStateCallback)", "with self.state_lock:\n for joint_id, joint_name in enumerate(data.name):\n if joint_name in self.joint_limits:\n ...
<|body_start_0|> self.joint_limits = dict() self.state_lock = Lock() rospy.init_node('JointLimitsRecorder', anonymous=True) rospy.Subscriber('/joint_states', JointState, self.jointStateCallback) <|end_body_0|> <|body_start_1|> with self.state_lock: for joint_id, join...
Record the mechanical joint limits while the joints are manually moved
JointLimits
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JointLimits: """Record the mechanical joint limits while the joints are manually moved""" def __init__(self): """TODO: to be defined1.""" <|body_0|> def jointStateCallback(self, data): """Receive the joint state updates and store the limits :data: JointState mess...
stack_v2_sparse_classes_36k_train_034516
1,540
permissive
[ { "docstring": "TODO: to be defined1.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Receive the joint state updates and store the limits :data: JointState message", "name": "jointStateCallback", "signature": "def jointStateCallback(self, data)" }, { "...
3
stack_v2_sparse_classes_30k_train_019611
Implement the Python class `JointLimits` described below. Class description: Record the mechanical joint limits while the joints are manually moved Method signatures and docstrings: - def __init__(self): TODO: to be defined1. - def jointStateCallback(self, data): Receive the joint state updates and store the limits :...
Implement the Python class `JointLimits` described below. Class description: Record the mechanical joint limits while the joints are manually moved Method signatures and docstrings: - def __init__(self): TODO: to be defined1. - def jointStateCallback(self, data): Receive the joint state updates and store the limits :...
7858fd3da9b31b4a17cc265722a4647567cda8cd
<|skeleton|> class JointLimits: """Record the mechanical joint limits while the joints are manually moved""" def __init__(self): """TODO: to be defined1.""" <|body_0|> def jointStateCallback(self, data): """Receive the joint state updates and store the limits :data: JointState mess...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JointLimits: """Record the mechanical joint limits while the joints are manually moved""" def __init__(self): """TODO: to be defined1.""" self.joint_limits = dict() self.state_lock = Lock() rospy.init_node('JointLimitsRecorder', anonymous=True) rospy.Subscriber('/j...
the_stack_v2_python_sparse
talos/full-body-calibration/joint_limits.py
agimus/agimus-demos
train
1
2d43ee9133a47b53caef7d151d3fb3622d3d8ba1
[ "self.test_data_true = dictionary_class_helper_true()\nself.test_data_true.set_action(4)\nself.test_data_false = dictionary_class_helper_false()\nself.sock_conn = socketconnection.SocketConnection(self.test_data_true.car_id)\nself.valid_dict = self.test_data_true.get_socket_dictionary()\nself.invalid_dict = self.te...
<|body_start_0|> self.test_data_true = dictionary_class_helper_true() self.test_data_true.set_action(4) self.test_data_false = dictionary_class_helper_false() self.sock_conn = socketconnection.SocketConnection(self.test_data_true.car_id) self.valid_dict = self.test_data_true.get_...
As in :class:`TestSocketResponseAction1`, but for action 4 (return a vehicle).
TestSocketResponseAction4
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSocketResponseAction4: """As in :class:`TestSocketResponseAction1`, but for action 4 (return a vehicle).""" def setUp(self): """It is necessary to instantiate the data classes and extract the relevant dictionaries. This testing suite also requires a socket connection.""" ...
stack_v2_sparse_classes_36k_train_034517
23,291
no_license
[ { "docstring": "It is necessary to instantiate the data classes and extract the relevant dictionaries. This testing suite also requires a socket connection.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests an incorrect car_id", "name": "test_a4_invalid_car_id", ...
6
null
Implement the Python class `TestSocketResponseAction4` described below. Class description: As in :class:`TestSocketResponseAction1`, but for action 4 (return a vehicle). Method signatures and docstrings: - def setUp(self): It is necessary to instantiate the data classes and extract the relevant dictionaries. This tes...
Implement the Python class `TestSocketResponseAction4` described below. Class description: As in :class:`TestSocketResponseAction1`, but for action 4 (return a vehicle). Method signatures and docstrings: - def setUp(self): It is necessary to instantiate the data classes and extract the relevant dictionaries. This tes...
8f68cc2a6ca568e803a6bfea49a452a5b0c1a2cf
<|skeleton|> class TestSocketResponseAction4: """As in :class:`TestSocketResponseAction1`, but for action 4 (return a vehicle).""" def setUp(self): """It is necessary to instantiate the data classes and extract the relevant dictionaries. This testing suite also requires a socket connection.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSocketResponseAction4: """As in :class:`TestSocketResponseAction1`, but for action 4 (return a vehicle).""" def setUp(self): """It is necessary to instantiate the data classes and extract the relevant dictionaries. This testing suite also requires a socket connection.""" self.test_dat...
the_stack_v2_python_sparse
AgentPi/agenttesting.py
JiewenGuan/Iot-Carshare
train
0
94634b0729a07fe5baedd13edede14b272dc39d5
[ "if view.action in ['partial_update']:\n profile_name = request.user.StaffProfileID.Name\n return profile_name in ['Vente', 'Gestion', 'Support']\nreturn True", "if view.action in ['partial_update']:\n if request.user.StaffProfileID.Name in ['Vente', 'Support']:\n return request.user in obj.get_st...
<|body_start_0|> if view.action in ['partial_update']: profile_name = request.user.StaffProfileID.Name return profile_name in ['Vente', 'Gestion', 'Support'] return True <|end_body_0|> <|body_start_1|> if view.action in ['partial_update']: if request.user.Sta...
Permission checking if the staff contact or part of the management team.
IsStaffContactOrManagement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsStaffContactOrManagement: """Permission checking if the staff contact or part of the management team.""" def has_permission(self, request, view): """Check the permission.""" <|body_0|> def has_object_permission(self, request, view, obj): """Check the object per...
stack_v2_sparse_classes_36k_train_034518
3,875
no_license
[ { "docstring": "Check the permission.", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Check the object permission.", "name": "has_object_permission", "signature": "def has_object_permission(self, request, view, obj)" } ]
2
stack_v2_sparse_classes_30k_train_020535
Implement the Python class `IsStaffContactOrManagement` described below. Class description: Permission checking if the staff contact or part of the management team. Method signatures and docstrings: - def has_permission(self, request, view): Check the permission. - def has_object_permission(self, request, view, obj):...
Implement the Python class `IsStaffContactOrManagement` described below. Class description: Permission checking if the staff contact or part of the management team. Method signatures and docstrings: - def has_permission(self, request, view): Check the permission. - def has_object_permission(self, request, view, obj):...
b76df0d62fc56e3c668827b18f0cce61124f0d53
<|skeleton|> class IsStaffContactOrManagement: """Permission checking if the staff contact or part of the management team.""" def has_permission(self, request, view): """Check the permission.""" <|body_0|> def has_object_permission(self, request, view, obj): """Check the object per...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsStaffContactOrManagement: """Permission checking if the staff contact or part of the management team.""" def has_permission(self, request, view): """Check the permission.""" if view.action in ['partial_update']: profile_name = request.user.StaffProfileID.Name ret...
the_stack_v2_python_sparse
settings/permissions.py
FortranVBA/DAP12
train
0
4a2686406b220a6c21244889000fa0b7a858aa81
[ "tests = ['test.1', 'test.2']\nexpected = 'test.1:test.2'\nself.assertEqual(test_apps.get_gtest_filter(tests), expected)", "tests = ['test.1', 'test.2']\nexpected = '-test.1:test.2'\nself.assertEqual(test_apps.get_gtest_filter(tests, invert=True), expected)" ]
<|body_start_0|> tests = ['test.1', 'test.2'] expected = 'test.1:test.2' self.assertEqual(test_apps.get_gtest_filter(tests), expected) <|end_body_0|> <|body_start_1|> tests = ['test.1', 'test.2'] expected = '-test.1:test.2' self.assertEqual(test_apps.get_gtest_filter(tes...
Tests for test_runner.get_gtest_filter.
GetGTestFilterTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetGTestFilterTest: """Tests for test_runner.get_gtest_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_034519
1,492
permissive
[ { "docstring": "Ensures correctness of filter.", "name": "test_correct", "signature": "def test_correct(self)" }, { "docstring": "Ensures correctness of inverted filter.", "name": "test_correct_inverted", "signature": "def test_correct_inverted(self)" } ]
2
stack_v2_sparse_classes_30k_train_006763
Implement the Python class `GetGTestFilterTest` described below. Class description: Tests for test_runner.get_gtest_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter.
Implement the Python class `GetGTestFilterTest` described below. Class description: Tests for test_runner.get_gtest_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter. <|skeleton|> class GetGTest...
64bee65c921db7e78e25d08f1e98da2668b57be5
<|skeleton|> class GetGTestFilterTest: """Tests for test_runner.get_gtest_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetGTestFilterTest: """Tests for test_runner.get_gtest_filter.""" def test_correct(self): """Ensures correctness of filter.""" tests = ['test.1', 'test.2'] expected = 'test.1:test.2' self.assertEqual(test_apps.get_gtest_filter(tests), expected) def test_correct_invert...
the_stack_v2_python_sparse
ios/build/bots/scripts/test_apps_test.py
otcshare/chromium-src
train
18
c6013f131a6b3e35cb594c75e7cd391dcc7d983f
[ "try:\n user = self.get_user(request, username)\nexcept PermissionDenied:\n return redirect(reverse('login') + '?next=' + request.path)\nlinks = Link.objects.select_related('category').filter(user=user).order_by('category__title', 'weight')\npalette = set((link.color for link in links))\ncategorized_links = d...
<|body_start_0|> try: user = self.get_user(request, username) except PermissionDenied: return redirect(reverse('login') + '?next=' + request.path) links = Link.objects.select_related('category').filter(user=user).order_by('category__title', 'weight') palette = set...
LinkView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkView: def get(self, request, username=None): """Get list of links.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def delete(self, request, pk, username=None): """Delete link.""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k_train_034520
30,576
permissive
[ { "docstring": "Get list of links.", "name": "get", "signature": "def get(self, request, username=None)" }, { "docstring": "Form submit.", "name": "post", "signature": "def post(self, request, username=None)" }, { "docstring": "Delete link.", "name": "delete", "signature"...
3
stack_v2_sparse_classes_30k_train_006712
Implement the Python class `LinkView` described below. Class description: Implement the LinkView class. Method signatures and docstrings: - def get(self, request, username=None): Get list of links. - def post(self, request, username=None): Form submit. - def delete(self, request, pk, username=None): Delete link.
Implement the Python class `LinkView` described below. Class description: Implement the LinkView class. Method signatures and docstrings: - def get(self, request, username=None): Get list of links. - def post(self, request, username=None): Form submit. - def delete(self, request, pk, username=None): Delete link. <|s...
51a2ae2b29ae5c91a3cf7171f89edf225cc8a6f0
<|skeleton|> class LinkView: def get(self, request, username=None): """Get list of links.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def delete(self, request, pk, username=None): """Delete link.""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkView: def get(self, request, username=None): """Get list of links.""" try: user = self.get_user(request, username) except PermissionDenied: return redirect(reverse('login') + '?next=' + request.path) links = Link.objects.select_related('category').fi...
the_stack_v2_python_sparse
tool/views/views.py
mikekeda/tools
train
0
aa8e640e78b3314d2df0cdb2c0228830056cab9d
[ "if isinstance(x, valid_type):\n pass\nelse:\n raise TypeError(f'Expected type of {x} is an instance of {valid_type}, but got ``{type(x)}``.')", "if x in valid_value:\n pass\nelse:\n raise ValueError(f'Expected `x` is one of {valid_value}, but got ``{x}``.')", "out = []\nfor each in args:\n if is...
<|body_start_0|> if isinstance(x, valid_type): pass else: raise TypeError(f'Expected type of {x} is an instance of {valid_type}, but got ``{type(x)}``.') <|end_body_0|> <|body_start_1|> if x in valid_value: pass else: raise ValueError(f'Ex...
A class for Parameters Validation Check whether the parameters are valid, including parameter types and parameter values.
Validation
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validation: """A class for Parameters Validation Check whether the parameters are valid, including parameter types and parameter values.""" def validate_type(x, valid_type): """Check whether an object is an instance of `valid_type`. Parameters ---------- x: object object to be verifi...
stack_v2_sparse_classes_36k_train_034521
3,049
permissive
[ { "docstring": "Check whether an object is an instance of `valid_type`. Parameters ---------- x: object object to be verified valid_type: type or tuple of type A tuple, as in ``validate_type(x, (A, B, ...))``, may be given as the target to check against. This is equivalent to ``validate_type(x, A) or validate_t...
3
stack_v2_sparse_classes_30k_train_005854
Implement the Python class `Validation` described below. Class description: A class for Parameters Validation Check whether the parameters are valid, including parameter types and parameter values. Method signatures and docstrings: - def validate_type(x, valid_type): Check whether an object is an instance of `valid_t...
Implement the Python class `Validation` described below. Class description: A class for Parameters Validation Check whether the parameters are valid, including parameter types and parameter values. Method signatures and docstrings: - def validate_type(x, valid_type): Check whether an object is an instance of `valid_t...
238cbc41865ddf629bb6ae92c2e1445be27f98b8
<|skeleton|> class Validation: """A class for Parameters Validation Check whether the parameters are valid, including parameter types and parameter values.""" def validate_type(x, valid_type): """Check whether an object is an instance of `valid_type`. Parameters ---------- x: object object to be verifi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Validation: """A class for Parameters Validation Check whether the parameters are valid, including parameter types and parameter values.""" def validate_type(x, valid_type): """Check whether an object is an instance of `valid_type`. Parameters ---------- x: object object to be verified valid_type...
the_stack_v2_python_sparse
gcastle/castle/algorithms/gradient/corl/torch/utils/validation.py
huawei-noah/trustworthyAI
train
832
2b80a2e2268e322b50264ae32cd1bb5371cb04f8
[ "m, n = (len(mat), len(mat[0]))\nMAX = m * n\nret = [[MAX for _ in range(n)] for _ in range(m)]\ndir = [(1, 0), (0, 1), (-1, 0), (0, -1)]\ndq = collections.deque()\nfor i in range(m):\n for j in range(n):\n if mat[i][j] == 0:\n dq.append((i, j, 0))\nseen = set()\nwhile dq:\n x, y, d = dq.pop...
<|body_start_0|> m, n = (len(mat), len(mat[0])) MAX = m * n ret = [[MAX for _ in range(n)] for _ in range(m)] dir = [(1, 0), (0, 1), (-1, 0), (0, -1)] dq = collections.deque() for i in range(m): for j in range(n): if mat[i][j] == 0: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def updateMatrix2(self, mat: List[List[int]]) -> List[List[int]]: """Updated at 2022/4/15 Runtime: 869 ms, faster than 54.07% Memory Usage: 19.8 MB, less than 6.29% m == mat.length n == mat[i].length 1 <= m, n <= 10^4 1 <= m * n <= 10^4 mat[i][j] is either 0 or 1. There is at l...
stack_v2_sparse_classes_36k_train_034522
4,849
permissive
[ { "docstring": "Updated at 2022/4/15 Runtime: 869 ms, faster than 54.07% Memory Usage: 19.8 MB, less than 6.29% m == mat.length n == mat[i].length 1 <= m, n <= 10^4 1 <= m * n <= 10^4 mat[i][j] is either 0 or 1. There is at least one 0 in mat. :param mat: :return:", "name": "updateMatrix2", "signature":...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def updateMatrix2(self, mat: List[List[int]]) -> List[List[int]]: Updated at 2022/4/15 Runtime: 869 ms, faster than 54.07% Memory Usage: 19.8 MB, less than 6.29% m == mat.length ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def updateMatrix2(self, mat: List[List[int]]) -> List[List[int]]: Updated at 2022/4/15 Runtime: 869 ms, faster than 54.07% Memory Usage: 19.8 MB, less than 6.29% m == mat.length ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def updateMatrix2(self, mat: List[List[int]]) -> List[List[int]]: """Updated at 2022/4/15 Runtime: 869 ms, faster than 54.07% Memory Usage: 19.8 MB, less than 6.29% m == mat.length n == mat[i].length 1 <= m, n <= 10^4 1 <= m * n <= 10^4 mat[i][j] is either 0 or 1. There is at l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def updateMatrix2(self, mat: List[List[int]]) -> List[List[int]]: """Updated at 2022/4/15 Runtime: 869 ms, faster than 54.07% Memory Usage: 19.8 MB, less than 6.29% m == mat.length n == mat[i].length 1 <= m, n <= 10^4 1 <= m * n <= 10^4 mat[i][j] is either 0 or 1. There is at least one 0 in ...
the_stack_v2_python_sparse
src/542-01Matrix.py
Jiezhi/myleetcode
train
1
56b568f68e2cc7147d2dd90f481e11b8ffd74ddb
[ "dest_list = []\ndest_file = open('csv_files/Destinations.csv', 'r')\nreader = csv.DictReader(dest_file)\nfor row in reader:\n dest_id = row['dest_id']\n dest_country = row['country']\n dest_city = row['city']\n dest_airport = row['airport']\n dest_flight_time = row['flight_time']\n dest_distance ...
<|body_start_0|> dest_list = [] dest_file = open('csv_files/Destinations.csv', 'r') reader = csv.DictReader(dest_file) for row in reader: dest_id = row['dest_id'] dest_country = row['country'] dest_city = row['city'] dest_airport = row['air...
DestinationIO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestinationIO: def load_all_destinations(self): """Reads into the database. Returns a list of all destinations as instances""" <|body_0|> def store_new_destination(self, new_destination): """Stores new destination to the existing file""" <|body_1|> def s...
stack_v2_sparse_classes_36k_train_034523
2,033
no_license
[ { "docstring": "Reads into the database. Returns a list of all destinations as instances", "name": "load_all_destinations", "signature": "def load_all_destinations(self)" }, { "docstring": "Stores new destination to the existing file", "name": "store_new_destination", "signature": "def s...
4
stack_v2_sparse_classes_30k_train_015004
Implement the Python class `DestinationIO` described below. Class description: Implement the DestinationIO class. Method signatures and docstrings: - def load_all_destinations(self): Reads into the database. Returns a list of all destinations as instances - def store_new_destination(self, new_destination): Stores new...
Implement the Python class `DestinationIO` described below. Class description: Implement the DestinationIO class. Method signatures and docstrings: - def load_all_destinations(self): Reads into the database. Returns a list of all destinations as instances - def store_new_destination(self, new_destination): Stores new...
5dbce2a3d1cdc8a0614252fb77685211b395c2df
<|skeleton|> class DestinationIO: def load_all_destinations(self): """Reads into the database. Returns a list of all destinations as instances""" <|body_0|> def store_new_destination(self, new_destination): """Stores new destination to the existing file""" <|body_1|> def s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DestinationIO: def load_all_destinations(self): """Reads into the database. Returns a list of all destinations as instances""" dest_list = [] dest_file = open('csv_files/Destinations.csv', 'r') reader = csv.DictReader(dest_file) for row in reader: dest_id = ...
the_stack_v2_python_sparse
DataLayer/DestinationIO.py
svana00/VLN1-NaN-Air
train
0
49340d701dbab51a459efe295fb9b8e7ab9b697e
[ "self.desiredTypes = desiredTypes\nself.result = []\nsuper(_Finder, self).__init__()", "todo = [(0, node)]\ncurrentStack = []\nchildrenTypes = TRAVERSAL_TYPES + self.desiredTypes\nwhile todo:\n index, node = todo[0]\n del todo[0]\n del currentStack[index:]\n is_desired = isinstance(node, self.desiredT...
<|body_start_0|> self.desiredTypes = desiredTypes self.result = [] super(_Finder, self).__init__() <|end_body_0|> <|body_start_1|> todo = [(0, node)] currentStack = [] childrenTypes = TRAVERSAL_TYPES + self.desiredTypes while todo: index, node = todo[...
Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being searched for See the find function for ...
_Finder
[ "LicenseRef-scancode-warranty-disclaimer", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Finder: """Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being sear...
stack_v2_sparse_classes_36k_train_034524
14,994
permissive
[ { "docstring": "Initialize the _Finder object desiredTypes -- sequence of types to be searched for", "name": "__init__", "signature": "def __init__(self, desiredTypes=())" }, { "docstring": "Visit an individual node, search for self.desiredTypes This is a heavily trimmed version of the superclas...
2
stack_v2_sparse_classes_30k_train_004641
Implement the Python class `_Finder` described below. Class description: Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths de...
Implement the Python class `_Finder` described below. Class description: Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths de...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class _Finder: """Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being sear...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Finder: """Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being searched for See ...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/visitor.py
alexus37/AugmentedRealityChess
train
1
f39b6483965651b08ae6daa9797c6b53d66b3d8a
[ "if logger.isEnabledFor(logging.DEBUG):\n logger.debug('Entry with args=(ctx=%s, kwargs=%s, parameters=%s) called by=%s', ctx, kwargs, parameters, '::L'.join((str(i) for i in inspect.getouterframes(inspect.currentframe(), 2)[1][1:3])))\nctx.tapes = kwargs['tapes']\nctx.device = kwargs['device']\nctx.execute_fn =...
<|body_start_0|> if logger.isEnabledFor(logging.DEBUG): logger.debug('Entry with args=(ctx=%s, kwargs=%s, parameters=%s) called by=%s', ctx, kwargs, parameters, '::L'.join((str(i) for i in inspect.getouterframes(inspect.currentframe(), 2)[1][1:3]))) ctx.tapes = kwargs['tapes'] ctx.de...
The signature of this ``torch.autograd.Function`` is designed to work around Torch restrictions. In particular, ``torch.autograd.Function``: - Cannot accept keyword arguments. As a result, we pass a dictionary as the first argument ``kwargs``. This dictionary **must** contain: * ``"tapes"``: the quantum tapes to batch ...
ExecuteTapes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExecuteTapes: """The signature of this ``torch.autograd.Function`` is designed to work around Torch restrictions. In particular, ``torch.autograd.Function``: - Cannot accept keyword arguments. As a result, we pass a dictionary as the first argument ``kwargs``. This dictionary **must** contain: * ...
stack_v2_sparse_classes_36k_train_034525
15,349
permissive
[ { "docstring": "Implements the forward pass batch tape evaluation.", "name": "forward", "signature": "def forward(ctx, kwargs, *parameters)" }, { "docstring": "Returns the vector-Jacobian product with given parameter values p and output gradient dy", "name": "backward", "signature": "def...
2
null
Implement the Python class `ExecuteTapes` described below. Class description: The signature of this ``torch.autograd.Function`` is designed to work around Torch restrictions. In particular, ``torch.autograd.Function``: - Cannot accept keyword arguments. As a result, we pass a dictionary as the first argument ``kwargs`...
Implement the Python class `ExecuteTapes` described below. Class description: The signature of this ``torch.autograd.Function`` is designed to work around Torch restrictions. In particular, ``torch.autograd.Function``: - Cannot accept keyword arguments. As a result, we pass a dictionary as the first argument ``kwargs`...
0843183ff15a013c2622af5e61fea431d18076d3
<|skeleton|> class ExecuteTapes: """The signature of this ``torch.autograd.Function`` is designed to work around Torch restrictions. In particular, ``torch.autograd.Function``: - Cannot accept keyword arguments. As a result, we pass a dictionary as the first argument ``kwargs``. This dictionary **must** contain: * ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExecuteTapes: """The signature of this ``torch.autograd.Function`` is designed to work around Torch restrictions. In particular, ``torch.autograd.Function``: - Cannot accept keyword arguments. As a result, we pass a dictionary as the first argument ``kwargs``. This dictionary **must** contain: * ``"tapes"``: ...
the_stack_v2_python_sparse
pennylane/interfaces/torch.py
PennyLaneAI/pennylane
train
1,431
f14b844b5bcf5cd333c3325c16c84b5fca2a9b41
[ "assert type(screen_name) == str\nfriends = tweepy_getter.get_friends_by_screen_name(screen_name, num_friends)\nuser_friends_setter.store_friends_by_screen_name(screen_name, friends)\nreturn friends", "assert type(id) == int\nfriends = tweepy_getter.get_friends_by_id(id, num_friends)\nuser_friends_setter.store_fr...
<|body_start_0|> assert type(screen_name) == str friends = tweepy_getter.get_friends_by_screen_name(screen_name, num_friends) user_friends_setter.store_friends_by_screen_name(screen_name, friends) return friends <|end_body_0|> <|body_start_1|> assert type(id) == int frie...
Download Twitter Friends for use in future algorithms.
TwitterFriendsDownloader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwitterFriendsDownloader: """Download Twitter Friends for use in future algorithms.""" def gen_friends_by_screen_name(self, screen_name: str, tweepy_getter, user_friends_setter, num_friends=None) -> List[str]: """Retrieves a list of screen_names of friends for the user with the given...
stack_v2_sparse_classes_36k_train_034526
7,540
no_license
[ { "docstring": "Retrieves a list of screen_names of friends for the user with the given screen name @param screen_name the screen name of the user to query on @param tweepy_getter the getter to access twitter with @param user_friends_setter the dao to store the output @param num_friends Optional - if specified,...
3
stack_v2_sparse_classes_30k_train_008662
Implement the Python class `TwitterFriendsDownloader` described below. Class description: Download Twitter Friends for use in future algorithms. Method signatures and docstrings: - def gen_friends_by_screen_name(self, screen_name: str, tweepy_getter, user_friends_setter, num_friends=None) -> List[str]: Retrieves a li...
Implement the Python class `TwitterFriendsDownloader` described below. Class description: Download Twitter Friends for use in future algorithms. Method signatures and docstrings: - def gen_friends_by_screen_name(self, screen_name: str, tweepy_getter, user_friends_setter, num_friends=None) -> List[str]: Retrieves a li...
33a3fa38ad4dcdd54ff583da15dcd67c99ad9701
<|skeleton|> class TwitterFriendsDownloader: """Download Twitter Friends for use in future algorithms.""" def gen_friends_by_screen_name(self, screen_name: str, tweepy_getter, user_friends_setter, num_friends=None) -> List[str]: """Retrieves a list of screen_names of friends for the user with the given...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwitterFriendsDownloader: """Download Twitter Friends for use in future algorithms.""" def gen_friends_by_screen_name(self, screen_name: str, tweepy_getter, user_friends_setter, num_friends=None) -> List[str]: """Retrieves a list of screen_names of friends for the user with the given screen name ...
the_stack_v2_python_sparse
src/process/download/twitter_downloader.py
ReinaKousaka/core
train
0
9106775c35ea030ce6287facdd3a416f412dc686
[ "super(GlobalAveragePool3D, self).__init__(**kwargs)\nself._keepdims = keepdims\nself._causal = causal\nself._frame_count = None", "config = {'keepdims': self._keepdims, 'causal': self._causal}\nbase_config = super(GlobalAveragePool3D, self).get_config()\nreturn dict(list(base_config.items()) + list(config.items(...
<|body_start_0|> super(GlobalAveragePool3D, self).__init__(**kwargs) self._keepdims = keepdims self._causal = causal self._frame_count = None <|end_body_0|> <|body_start_1|> config = {'keepdims': self._keepdims, 'causal': self._causal} base_config = super(GlobalAveragePo...
Creates a global average pooling layer with causal mode. Implements causal mode, which runs a cumulative sum (with `tf.cumsum`) across frames in the time dimension, allowing the use of a stream buffer. Sums any valid input state with the current input to allow state to accumulate over several iterations.
GlobalAveragePool3D
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalAveragePool3D: """Creates a global average pooling layer with causal mode. Implements causal mode, which runs a cumulative sum (with `tf.cumsum`) across frames in the time dimension, allowing the use of a stream buffer. Sums any valid input state with the current input to allow state to acc...
stack_v2_sparse_classes_36k_train_034527
33,772
permissive
[ { "docstring": "Initializes a global average pool layer. Args: keepdims: A `bool`. If True, keep the averaged dimensions. causal: A `bool` of whether to run in causal mode with a cumulative sum across frames. **kwargs: Additional keyword arguments to be passed to this layer. Returns: An output `tf.Tensor`.", ...
4
null
Implement the Python class `GlobalAveragePool3D` described below. Class description: Creates a global average pooling layer with causal mode. Implements causal mode, which runs a cumulative sum (with `tf.cumsum`) across frames in the time dimension, allowing the use of a stream buffer. Sums any valid input state with ...
Implement the Python class `GlobalAveragePool3D` described below. Class description: Creates a global average pooling layer with causal mode. Implements causal mode, which runs a cumulative sum (with `tf.cumsum`) across frames in the time dimension, allowing the use of a stream buffer. Sums any valid input state with ...
192ae544169c1230c21141c033800aa1bd94e9b6
<|skeleton|> class GlobalAveragePool3D: """Creates a global average pooling layer with causal mode. Implements causal mode, which runs a cumulative sum (with `tf.cumsum`) across frames in the time dimension, allowing the use of a stream buffer. Sums any valid input state with the current input to allow state to acc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlobalAveragePool3D: """Creates a global average pooling layer with causal mode. Implements causal mode, which runs a cumulative sum (with `tf.cumsum`) across frames in the time dimension, allowing the use of a stream buffer. Sums any valid input state with the current input to allow state to accumulate over ...
the_stack_v2_python_sparse
official/vision/beta/modeling/layers/nn_layers.py
DemonDamon/mask-detection-based-on-tf2odapi
train
2
a4e1b3eec7650e8686693ace63f9653203d0a427
[ "self.calibrator = calibrators.Calibrator(calibrators.WaveDivider())\nself.signal_start_calibrating = self.calibrator.signal_start_calibrating\nself.signal_stop_calibrating = self.calibrator.signal_stop_calibrating\nself.accumulator = collectors.DataAccumulator(samples=accum_samples)\nself.generator = generator", ...
<|body_start_0|> self.calibrator = calibrators.Calibrator(calibrators.WaveDivider()) self.signal_start_calibrating = self.calibrator.signal_start_calibrating self.signal_stop_calibrating = self.calibrator.signal_stop_calibrating self.accumulator = collectors.DataAccumulator(samples=accum...
Process the EEG transforming it into waves. TODO
WaveProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WaveProcessor: """Process the EEG transforming it into waves. TODO""" def __init__(self, generator, accum_samples=1): """Constructor.""" <|body_0|> def generate(self, timestamp, new_data): """Make a TF analysis of the data and delegates to a processor.""" ...
stack_v2_sparse_classes_36k_train_034528
1,270
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, generator, accum_samples=1)" }, { "docstring": "Make a TF analysis of the data and delegates to a processor.", "name": "generate", "signature": "def generate(self, timestamp, new_data)" } ]
2
stack_v2_sparse_classes_30k_train_007903
Implement the Python class `WaveProcessor` described below. Class description: Process the EEG transforming it into waves. TODO Method signatures and docstrings: - def __init__(self, generator, accum_samples=1): Constructor. - def generate(self, timestamp, new_data): Make a TF analysis of the data and delegates to a ...
Implement the Python class `WaveProcessor` described below. Class description: Process the EEG transforming it into waves. TODO Method signatures and docstrings: - def __init__(self, generator, accum_samples=1): Constructor. - def generate(self, timestamp, new_data): Make a TF analysis of the data and delegates to a ...
38cbb8d55cec730a03899692a37273f0817875eb
<|skeleton|> class WaveProcessor: """Process the EEG transforming it into waves. TODO""" def __init__(self, generator, accum_samples=1): """Constructor.""" <|body_0|> def generate(self, timestamp, new_data): """Make a TF analysis of the data and delegates to a processor.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WaveProcessor: """Process the EEG transforming it into waves. TODO""" def __init__(self, generator, accum_samples=1): """Constructor.""" self.calibrator = calibrators.Calibrator(calibrators.WaveDivider()) self.signal_start_calibrating = self.calibrator.signal_start_calibrating ...
the_stack_v2_python_sparse
backend/engine/processors/waves.py
pdpino/muse-player
train
0
4cb57cab5178e80faf3156cd7422bc0a309559fe
[ "self.K = K\nself.X, self.T = ([], [])\nself.flagKLinReg = flagKLinReg", "self.X, self.T = (np.array(X), np.array(T))\nself.N, self.D = self.X.shape\nself.kdtree = scipy.spatial.KDTree(self.X)", "if K == None:\n K = self.K\nif flagKLinReg == None:\n flagKLinReg = self.flagKLinReg\nnn = self.kdtree.query(x...
<|body_start_0|> self.K = K self.X, self.T = ([], []) self.flagKLinReg = flagKLinReg <|end_body_0|> <|body_start_1|> self.X, self.T = (np.array(X), np.array(T)) self.N, self.D = self.X.shape self.kdtree = scipy.spatial.KDTree(self.X) <|end_body_1|> <|body_start_2|> ...
Class for fast K-Nearest-Neighbor-Regression using KD-trees
KNNRegressifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KNNRegressifier: """Class for fast K-Nearest-Neighbor-Regression using KD-trees""" def __init__(self, K, flagKLinReg=0): """Constructor of class KNNRegressifier :param K: number of nearest neighbors that are used to compute prediction :flagKLinReg: if >0 then the do a linear (least s...
stack_v2_sparse_classes_36k_train_034529
21,971
no_license
[ { "docstring": "Constructor of class KNNRegressifier :param K: number of nearest neighbors that are used to compute prediction :flagKLinReg: if >0 then the do a linear (least squares) regression on the the K nearest neighbors and their target values otherwise just take the mean of the K nearest neighbors target...
3
stack_v2_sparse_classes_30k_val_000827
Implement the Python class `KNNRegressifier` described below. Class description: Class for fast K-Nearest-Neighbor-Regression using KD-trees Method signatures and docstrings: - def __init__(self, K, flagKLinReg=0): Constructor of class KNNRegressifier :param K: number of nearest neighbors that are used to compute pre...
Implement the Python class `KNNRegressifier` described below. Class description: Class for fast K-Nearest-Neighbor-Regression using KD-trees Method signatures and docstrings: - def __init__(self, K, flagKLinReg=0): Constructor of class KNNRegressifier :param K: number of nearest neighbors that are used to compute pre...
de2ba4e2afdad7e2e1ba0c145edbd341f8555802
<|skeleton|> class KNNRegressifier: """Class for fast K-Nearest-Neighbor-Regression using KD-trees""" def __init__(self, K, flagKLinReg=0): """Constructor of class KNNRegressifier :param K: number of nearest neighbors that are used to compute prediction :flagKLinReg: if >0 then the do a linear (least s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KNNRegressifier: """Class for fast K-Nearest-Neighbor-Regression using KD-trees""" def __init__(self, K, flagKLinReg=0): """Constructor of class KNNRegressifier :param K: number of nearest neighbors that are used to compute prediction :flagKLinReg: if >0 then the do a linear (least squares) regre...
the_stack_v2_python_sparse
versuch2/src/V2A2_Regression.py
xsjad0/ias-neuronale-netze
train
1
c20b6ca58ce0a13a1ba70c53ee95c7a26c43fe8c
[ "pre = None\ncur = head\nwhile cur:\n tmp = cur.next\n cur.next = pre\n pre = cur\n cur = tmp\nreturn pre", "p = head\nh = p\ntt = None\nhead = None\nwhile p is not None:\n for _ in range(k - 1):\n if p.next is None:\n if tt is not None:\n tt.next = h\n i...
<|body_start_0|> pre = None cur = head while cur: tmp = cur.next cur.next = pre pre = cur cur = tmp return pre <|end_body_0|> <|body_start_1|> p = head h = p tt = None head = None while p is not None...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> pre = None ...
stack_v2_sparse_classes_36k_train_034530
1,323
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "reverseKGroup", "signature": "def reverseKGroup(self, head, k)" } ]
2
stack_v2_sparse_classes_30k_train_000528
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 reverseKGroup(self, head, k): :type head: ListNode :type k: 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 reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: ListNode <|skeleton|> class Solu...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseKGroup(self, head, k): """:type head: ListNode :type k: 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""" pre = None cur = head while cur: tmp = cur.next cur.next = pre pre = cur cur = tmp return pre def reverseKGroup(self, head, k): ...
the_stack_v2_python_sparse
reverse-nodes-in-k-group/solution.py
uxlsl/leetcode_practice
train
0
c8f1c794c6bd84716bdd8ff7a6712fc363e54a7a
[ "super(Network, self).__init__()\nself.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5, stride=2, padding=2)\nself.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size=5, stride=2, padding=2)\nself.conv3 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=5, stride=2, padding=2)\nself...
<|body_start_0|> super(Network, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5, stride=2, padding=2) self.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size=5, stride=2, padding=2) self.conv3 = nn.Conv2d(in_channels=32, out_channels=64, ...
Network
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Network: def __init__(self): """Define the NN layers and the initialization for the layers with parameters.""" <|body_0|> def forward(self, x, pos, training): """The forward pass of the network. :param x: Input to the NN :return: return the output of the network""" ...
stack_v2_sparse_classes_36k_train_034531
8,776
no_license
[ { "docstring": "Define the NN layers and the initialization for the layers with parameters.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "The forward pass of the network. :param x: Input to the NN :return: return the output of the network", "name": "forward", ...
2
stack_v2_sparse_classes_30k_train_000608
Implement the Python class `Network` described below. Class description: Implement the Network class. Method signatures and docstrings: - def __init__(self): Define the NN layers and the initialization for the layers with parameters. - def forward(self, x, pos, training): The forward pass of the network. :param x: In...
Implement the Python class `Network` described below. Class description: Implement the Network class. Method signatures and docstrings: - def __init__(self): Define the NN layers and the initialization for the layers with parameters. - def forward(self, x, pos, training): The forward pass of the network. :param x: In...
e55e1e5a5e31dc2d9ad3f59b53fe8d2008c6dedf
<|skeleton|> class Network: def __init__(self): """Define the NN layers and the initialization for the layers with parameters.""" <|body_0|> def forward(self, x, pos, training): """The forward pass of the network. :param x: Input to the NN :return: return the output of the network""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Network: def __init__(self): """Define the NN layers and the initialization for the layers with parameters.""" super(Network, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5, stride=2, padding=2) self.conv2 = nn.Conv2d(in_channels=32, out_c...
the_stack_v2_python_sparse
custom_layer/drop_layer.py
adastimes/code
train
0
71830b7ddf96f880bc051c51fb916c4ba0df2edb
[ "t1 = (zconst - rays.origins[Ellipsis, -1]) / rays.directions[Ellipsis, -1]\nxy = rays.origins[Ellipsis, :2] + (t1[Ellipsis, None] * rays.directions)[Ellipsis, :2]\nreturn xy", "st = self.ray_plane_intersection(self.config.st_plane, rays)\nuv = self.ray_plane_intersection(self.config.uv_plane, rays)\nlf_samples =...
<|body_start_0|> t1 = (zconst - rays.origins[Ellipsis, -1]) / rays.directions[Ellipsis, -1] xy = rays.origins[Ellipsis, :2] + (t1[Ellipsis, None] * rays.directions)[Ellipsis, :2] return xy <|end_body_0|> <|body_start_1|> st = self.ray_plane_intersection(self.config.st_plane, rays) ...
A class encapsulation the LightSlab utilities.
LightSlab
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LightSlab: """A class encapsulation the LightSlab utilities.""" def ray_plane_intersection(self, zconst, rays): """Compute intersection of the ray with a plane of the form z=const. Args: zconst: Fixed z-value for the plane. rays: data_type.Rays. Returns: xy: The free-coordinates of i...
stack_v2_sparse_classes_36k_train_034532
3,936
permissive
[ { "docstring": "Compute intersection of the ray with a plane of the form z=const. Args: zconst: Fixed z-value for the plane. rays: data_type.Rays. Returns: xy: The free-coordinates of intersection.", "name": "ray_plane_intersection", "signature": "def ray_plane_intersection(self, zconst, rays)" }, {...
2
null
Implement the Python class `LightSlab` described below. Class description: A class encapsulation the LightSlab utilities. Method signatures and docstrings: - def ray_plane_intersection(self, zconst, rays): Compute intersection of the ray with a plane of the form z=const. Args: zconst: Fixed z-value for the plane. ray...
Implement the Python class `LightSlab` described below. Class description: A class encapsulation the LightSlab utilities. Method signatures and docstrings: - def ray_plane_intersection(self, zconst, rays): Compute intersection of the ray with a plane of the form z=const. Args: zconst: Fixed z-value for the plane. ray...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class LightSlab: """A class encapsulation the LightSlab utilities.""" def ray_plane_intersection(self, zconst, rays): """Compute intersection of the ray with a plane of the form z=const. Args: zconst: Fixed z-value for the plane. rays: data_type.Rays. Returns: xy: The free-coordinates of i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LightSlab: """A class encapsulation the LightSlab utilities.""" def ray_plane_intersection(self, zconst, rays): """Compute intersection of the ray with a plane of the form z=const. Args: zconst: Fixed z-value for the plane. rays: data_type.Rays. Returns: xy: The free-coordinates of intersection."...
the_stack_v2_python_sparse
gen_patch_neural_rendering/src/utils/lf_utils.py
Jimmy-INL/google-research
train
1
a2d6af3d9ec871089d0fe30569f047ec486de9ac
[ "try:\n template_xsl_rendering_object = template_xsl_rendering_api.get_by_id(pk)\n template_xsl_rendering_serializer = TemplateXslRenderingSerializer(template_xsl_rendering_object)\n return Response(template_xsl_rendering_serializer.data)\nexcept exceptions.DoesNotExist:\n content = {'message': 'XSL ren...
<|body_start_0|> try: template_xsl_rendering_object = template_xsl_rendering_api.get_by_id(pk) template_xsl_rendering_serializer = TemplateXslRenderingSerializer(template_xsl_rendering_object) return Response(template_xsl_rendering_serializer.data) except exceptions.D...
TemplateXslRendering details view
TemplateXslRenderingDetail
[ "NIST-Software" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateXslRenderingDetail: """TemplateXslRendering details view""" def get(self, request, pk): """Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering""" <|body_0|> def patch(self, request, pk): """Edit...
stack_v2_sparse_classes_36k_train_034533
14,418
permissive
[ { "docstring": "Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "Edit `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Retur...
3
null
Implement the Python class `TemplateXslRenderingDetail` described below. Class description: TemplateXslRendering details view Method signatures and docstrings: - def get(self, request, pk): Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering - def patch(sel...
Implement the Python class `TemplateXslRenderingDetail` described below. Class description: TemplateXslRendering details view Method signatures and docstrings: - def get(self, request, pk): Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering - def patch(sel...
f032036d95076f92b164389fdbec7415567e7b0f
<|skeleton|> class TemplateXslRenderingDetail: """TemplateXslRendering details view""" def get(self, request, pk): """Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering""" <|body_0|> def patch(self, request, pk): """Edit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemplateXslRenderingDetail: """TemplateXslRendering details view""" def get(self, request, pk): """Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering""" try: template_xsl_rendering_object = template_xsl_rendering_ap...
the_stack_v2_python_sparse
core_main_app/rest/template_xsl_rendering/views.py
usnistgov/core_main_app
train
3
2c194804dbc9b47fe347a9fc64f23402b0fa51d9
[ "if context is None:\n context = {}\nprod = self.pool.get('mrp.production').browse(cr, uid, context.get('active_id', False), context=context)\nsn = prod.serialno\nif not sn:\n sn = self.pool.get('ir.sequence').get(cr, uid, 'lot.sn.seq', context=None)\nreturn sn", "production_id = context.get('active_id', Fa...
<|body_start_0|> if context is None: context = {} prod = self.pool.get('mrp.production').browse(cr, uid, context.get('active_id', False), context=context) sn = prod.serialno if not sn: sn = self.pool.get('ir.sequence').get(cr, uid, 'lot.sn.seq', context=None) ...
mrp_product_produce
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mrp_product_produce: def _get_lot_sn(self, cr, uid, context=None): """To obtain MO SN @return: prod_lot""" <|body_0|> def do_produce(self, cr, uid, ids, context=None): """To create and add prod_lot in moves @param ids: The wizard id @return: Execute production with c...
stack_v2_sparse_classes_36k_train_034534
1,519
no_license
[ { "docstring": "To obtain MO SN @return: prod_lot", "name": "_get_lot_sn", "signature": "def _get_lot_sn(self, cr, uid, context=None)" }, { "docstring": "To create and add prod_lot in moves @param ids: The wizard id @return: Execute production with current MO's lot_id", "name": "do_produce",...
2
stack_v2_sparse_classes_30k_train_014823
Implement the Python class `mrp_product_produce` described below. Class description: Implement the mrp_product_produce class. Method signatures and docstrings: - def _get_lot_sn(self, cr, uid, context=None): To obtain MO SN @return: prod_lot - def do_produce(self, cr, uid, ids, context=None): To create and add prod_l...
Implement the Python class `mrp_product_produce` described below. Class description: Implement the mrp_product_produce class. Method signatures and docstrings: - def _get_lot_sn(self, cr, uid, context=None): To obtain MO SN @return: prod_lot - def do_produce(self, cr, uid, ids, context=None): To create and add prod_l...
c5a5678379649ccdf57a9d55b09b30436428b430
<|skeleton|> class mrp_product_produce: def _get_lot_sn(self, cr, uid, context=None): """To obtain MO SN @return: prod_lot""" <|body_0|> def do_produce(self, cr, uid, ids, context=None): """To create and add prod_lot in moves @param ids: The wizard id @return: Execute production with c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mrp_product_produce: def _get_lot_sn(self, cr, uid, context=None): """To obtain MO SN @return: prod_lot""" if context is None: context = {} prod = self.pool.get('mrp.production').browse(cr, uid, context.get('active_id', False), context=context) sn = prod.serialno ...
the_stack_v2_python_sparse
bpkdomino/mrp_barcode/wizard/product_produce.py
adahra/addons
train
1
32ba18fbe88f3c914c3293bbfd141cb48a61416e
[ "self.username = sUsername\nself.database = pDatabase\npAllUsers = pDatabase.GetAllUsers(sUsername)\nself.emailAddresses = []\nself.phoneNumbers = []\nfor pUser in pAllUsers:\n if pUser['email'] != '':\n self.emailAddresses.append(pUser['email'])\n if pUser['phone'] != '':\n self.phoneNumbers.ap...
<|body_start_0|> self.username = sUsername self.database = pDatabase pAllUsers = pDatabase.GetAllUsers(sUsername) self.emailAddresses = [] self.phoneNumbers = [] for pUser in pAllUsers: if pUser['email'] != '': self.emailAddresses.append(pUser[...
Messaging
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Messaging: def __init__(self, sUsername, pDatabase): """Constructor""" <|body_0|> def broadcastMessage(self, sMessage): """Broadcasts a message""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.username = sUsername self.database = pDataba...
stack_v2_sparse_classes_36k_train_034535
922
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, sUsername, pDatabase)" }, { "docstring": "Broadcasts a message", "name": "broadcastMessage", "signature": "def broadcastMessage(self, sMessage)" } ]
2
null
Implement the Python class `Messaging` described below. Class description: Implement the Messaging class. Method signatures and docstrings: - def __init__(self, sUsername, pDatabase): Constructor - def broadcastMessage(self, sMessage): Broadcasts a message
Implement the Python class `Messaging` described below. Class description: Implement the Messaging class. Method signatures and docstrings: - def __init__(self, sUsername, pDatabase): Constructor - def broadcastMessage(self, sMessage): Broadcasts a message <|skeleton|> class Messaging: def __init__(self, sUsern...
c6954ca0fff935ce1eb8154744f6307743765dc5
<|skeleton|> class Messaging: def __init__(self, sUsername, pDatabase): """Constructor""" <|body_0|> def broadcastMessage(self, sMessage): """Broadcasts a message""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Messaging: def __init__(self, sUsername, pDatabase): """Constructor""" self.username = sUsername self.database = pDatabase pAllUsers = pDatabase.GetAllUsers(sUsername) self.emailAddresses = [] self.phoneNumbers = [] for pUser in pAllUsers: if...
the_stack_v2_python_sparse
server/core/Messaging.py
henryeherman/elixys
train
1
2501aeb7c1d544958d038dd101de797b0c52793a
[ "super(Radar, self).__init__(vehicle_id)\nself.name = name\nself.sens_range = float(sens_range)\nself.sens_angle = float(sens_angle) * np.pi / 180.0\nself.pub_readings = rospy.Publisher(self.name + '_readings', RadarReadings, queue_size=10)", "if not np.any(self.vehicle_states[0] == self.vehicle_id) or not self.v...
<|body_start_0|> super(Radar, self).__init__(vehicle_id) self.name = name self.sens_range = float(sens_range) self.sens_angle = float(sens_angle) * np.pi / 180.0 self.pub_readings = rospy.Publisher(self.name + '_readings', RadarReadings, queue_size=10) <|end_body_0|> <|body_star...
Radar sensor class.
Radar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Radar: """Radar sensor class.""" def __init__(self, vehicle_id, name, sens_range, sens_angle): """Initialize Radar sensor class. @param vehicle_id: I{(int)} ID of the vehicle this sensor belongs to. @param name: I{(str)} Name of the sensor under which it will publish its readings. @p...
stack_v2_sparse_classes_36k_train_034536
5,525
no_license
[ { "docstring": "Initialize Radar sensor class. @param vehicle_id: I{(int)} ID of the vehicle this sensor belongs to. @param name: I{(str)} Name of the sensor under which it will publish its readings. @param sens_range: I{(float)} Range of the randar sensor. @param sens_angle: I{(float)} Opening angle of the rad...
2
stack_v2_sparse_classes_30k_train_005107
Implement the Python class `Radar` described below. Class description: Radar sensor class. Method signatures and docstrings: - def __init__(self, vehicle_id, name, sens_range, sens_angle): Initialize Radar sensor class. @param vehicle_id: I{(int)} ID of the vehicle this sensor belongs to. @param name: I{(str)} Name o...
Implement the Python class `Radar` described below. Class description: Radar sensor class. Method signatures and docstrings: - def __init__(self, vehicle_id, name, sens_range, sens_angle): Initialize Radar sensor class. @param vehicle_id: I{(int)} ID of the vehicle this sensor belongs to. @param name: I{(str)} Name o...
a759b0336b80b5647cc858d99d1fa40a0a9d826d
<|skeleton|> class Radar: """Radar sensor class.""" def __init__(self, vehicle_id, name, sens_range, sens_angle): """Initialize Radar sensor class. @param vehicle_id: I{(int)} ID of the vehicle this sensor belongs to. @param name: I{(str)} Name of the sensor under which it will publish its readings. @p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Radar: """Radar sensor class.""" def __init__(self, vehicle_id, name, sens_range, sens_angle): """Initialize Radar sensor class. @param vehicle_id: I{(int)} ID of the vehicle this sensor belongs to. @param name: I{(str)} Name of the sensor under which it will publish its readings. @param sens_ran...
the_stack_v2_python_sparse
sml_world/scripts/sml_modules/sensor_models.py
marinarantanen/sml_world
train
1
41ad63019fbeb3fdcf3db6c8b09fcde13324cb3b
[ "def result():\n shuffle('test')\nself.assertRaises(TypeError, result)", "list_one = [1]\nshuffle(list_one)\nself.assertEqual(list_one, [1])\nlist_empty = []\nshuffle(list_empty)\nself.assertEqual(list_empty, [])", "small_list = [8, 30, 2, 6]\ntracker = create_tracker_dict(small_list)\nshuffle(small_list)\ns...
<|body_start_0|> def result(): shuffle('test') self.assertRaises(TypeError, result) <|end_body_0|> <|body_start_1|> list_one = [1] shuffle(list_one) self.assertEqual(list_one, [1]) list_empty = [] shuffle(list_empty) self.assertEqual(list_empt...
TestShuffle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestShuffle: def test_raises_typeerror_for_non_list_argument(self): """Raises a new TypeError if the argument for shuffle is not type list""" <|body_0|> def test_returns_input_if_length_less_than_2(self): """Returns the inputted integer list if the length is less tha...
stack_v2_sparse_classes_36k_train_034537
2,026
permissive
[ { "docstring": "Raises a new TypeError if the argument for shuffle is not type list", "name": "test_raises_typeerror_for_non_list_argument", "signature": "def test_raises_typeerror_for_non_list_argument(self)" }, { "docstring": "Returns the inputted integer list if the length is less than 2", ...
4
null
Implement the Python class `TestShuffle` described below. Class description: Implement the TestShuffle class. Method signatures and docstrings: - def test_raises_typeerror_for_non_list_argument(self): Raises a new TypeError if the argument for shuffle is not type list - def test_returns_input_if_length_less_than_2(se...
Implement the Python class `TestShuffle` described below. Class description: Implement the TestShuffle class. Method signatures and docstrings: - def test_raises_typeerror_for_non_list_argument(self): Raises a new TypeError if the argument for shuffle is not type list - def test_returns_input_if_length_less_than_2(se...
27ffb6b32d6d18d279c51cfa45bf305a409be5c2
<|skeleton|> class TestShuffle: def test_raises_typeerror_for_non_list_argument(self): """Raises a new TypeError if the argument for shuffle is not type list""" <|body_0|> def test_returns_input_if_length_less_than_2(self): """Returns the inputted integer list if the length is less tha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestShuffle: def test_raises_typeerror_for_non_list_argument(self): """Raises a new TypeError if the argument for shuffle is not type list""" def result(): shuffle('test') self.assertRaises(TypeError, result) def test_returns_input_if_length_less_than_2(self): ...
the_stack_v2_python_sparse
src/interview-cake/fisher-yates-shuffle/test_fisher_yates_shuffle.py
nwthomas/code-challenges
train
2
63eed6235fcbd320eb4281074d85cb279c3c3c1f
[ "def gotResults(results):\n for name, url, id in results:\n yield (u'\\x02%s\\x02: <%s>;' % (name, url))\n\ndef outputResults(results):\n source.reply(u' '.join(results))\nreturn imdb.searchByTitle(title, exact=False).addCallback(gotResults).addCallback(outputResults)", "def gotInfo(info):\n sourc...
<|body_start_0|> def gotResults(results): for name, url, id in results: yield (u'\x02%s\x02: <%s>;' % (name, url)) def outputResults(results): source.reply(u' '.join(results)) return imdb.searchByTitle(title, exact=False).addCallback(gotResults).addCallba...
IMDB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IMDB: def cmd_search(self, source, title): """Search IMDB for artifacts whose titles match <title>.""" <|body_0|> def cmd_plot(self, source, id): """Retrieve the plot information for an IMDB title with <id>.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_034538
1,477
permissive
[ { "docstring": "Search IMDB for artifacts whose titles match <title>.", "name": "cmd_search", "signature": "def cmd_search(self, source, title)" }, { "docstring": "Retrieve the plot information for an IMDB title with <id>.", "name": "cmd_plot", "signature": "def cmd_plot(self, source, id...
2
stack_v2_sparse_classes_30k_train_013986
Implement the Python class `IMDB` described below. Class description: Implement the IMDB class. Method signatures and docstrings: - def cmd_search(self, source, title): Search IMDB for artifacts whose titles match <title>. - def cmd_plot(self, source, id): Retrieve the plot information for an IMDB title with <id>.
Implement the Python class `IMDB` described below. Class description: Implement the IMDB class. Method signatures and docstrings: - def cmd_search(self, source, title): Search IMDB for artifacts whose titles match <title>. - def cmd_plot(self, source, id): Retrieve the plot information for an IMDB title with <id>. <...
11c80c7024548ce7c41800b077d3d0a738a04875
<|skeleton|> class IMDB: def cmd_search(self, source, title): """Search IMDB for artifacts whose titles match <title>.""" <|body_0|> def cmd_plot(self, source, id): """Retrieve the plot information for an IMDB title with <id>.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IMDB: def cmd_search(self, source, title): """Search IMDB for artifacts whose titles match <title>.""" def gotResults(results): for name, url, id in results: yield (u'\x02%s\x02: <%s>;' % (name, url)) def outputResults(results): source.reply(u' ...
the_stack_v2_python_sparse
eridanusstd/plugindefs/imdb.py
mithrandi/eridanus
train
0
7adb6c04ff21b3aed12c470993a6d0eb2bef5dfd
[ "res = {}\nres[1] = 1\nres[2] = 2\nfor i in range(3, n + 1):\n res[i] = res[i - 1] + res[i - 2]\nreturn res[n]", "a = b = 1\nfor _ in range(n):\n a, b = (b, a + b)\nreturn a" ]
<|body_start_0|> res = {} res[1] = 1 res[2] = 2 for i in range(3, n + 1): res[i] = res[i - 1] + res[i - 2] return res[n] <|end_body_0|> <|body_start_1|> a = b = 1 for _ in range(n): a, b = (b, a + b) return a <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n): """:param n: int :return: int""" <|body_0|> def climbStairs2(self, n): """:param n: int :return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = {} res[1] = 1 res[2] = 2 for i in ...
stack_v2_sparse_classes_36k_train_034539
913
no_license
[ { "docstring": ":param n: int :return: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" }, { "docstring": ":param n: int :return: int", "name": "climbStairs2", "signature": "def climbStairs2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_000071
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :param n: int :return: int - def climbStairs2(self, n): :param n: int :return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :param n: int :return: int - def climbStairs2(self, n): :param n: int :return: int <|skeleton|> class Solution: def climbStairs(self, n): ...
16b6fc4247c91a919d38bf18835f10fc29fccca7
<|skeleton|> class Solution: def climbStairs(self, n): """:param n: int :return: int""" <|body_0|> def climbStairs2(self, n): """:param n: int :return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n): """:param n: int :return: int""" res = {} res[1] = 1 res[2] = 2 for i in range(3, n + 1): res[i] = res[i - 1] + res[i - 2] return res[n] def climbStairs2(self, n): """:param n: int :return: int""" ...
the_stack_v2_python_sparse
problem_79.py
SeanLau/leetcode
train
0
41ec649af4c99f83e1c92288a0d671c9bf7cdfb3
[ "PISM.IP_SSATaucTaoTikhonovProblemLCLListener.__init__(self)\nself.owner = owner\nself.listener = listener", "data = Bunch(tikhonov_penalty=eta, JDesign=objVal, JState=penaltyVal, zeta=d, zeta_step=diff_d, grad_JDesign=grad_d, u=u, residual=diff_u, grad_JState=grad_u, constraints=constraints)\ntry:\n self.list...
<|body_start_0|> PISM.IP_SSATaucTaoTikhonovProblemLCLListener.__init__(self) self.owner = owner self.listener = listener <|end_body_0|> <|body_start_1|> data = Bunch(tikhonov_penalty=eta, JDesign=objVal, JState=penaltyVal, zeta=d, zeta_step=diff_d, grad_JDesign=grad_d, u=u, residual=dif...
Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.
TaucLCLIterationListenerAdaptor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaucLCLIterationListenerAdaptor: """Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.""" def __init__(self, owner, liste...
stack_v2_sparse_classes_36k_train_034540
10,589
no_license
[ { "docstring": ":param owner: The :class:`InvSSATaucSolver_Tikhonov` that constructed us :param listener: The python-based listener.", "name": "__init__", "signature": "def __init__(self, owner, listener)" }, { "docstring": "Called during IP_SSATaucTaoTikhonovProblemLCL iterations. Gathers toget...
2
stack_v2_sparse_classes_30k_train_006237
Implement the Python class `TaucLCLIterationListenerAdaptor` described below. Class description: Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself. ...
Implement the Python class `TaucLCLIterationListenerAdaptor` described below. Class description: Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself. ...
88664f50a2f7075b6e96a06a5976986aac0302ed
<|skeleton|> class TaucLCLIterationListenerAdaptor: """Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.""" def __init__(self, owner, liste...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaucLCLIterationListenerAdaptor: """Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.""" def __init__(self, owner, listener): ...
the_stack_v2_python_sparse
site-packages/PISM/invert/ssa_tao.py
flapo099/test
train
0
473b7264a210362b0ce31e3450bbd7aabd145c1c
[ "t = {}\nfor n in nums:\n if n in t:\n t[n] += 1\n else:\n t[n] = 1\n if t[n] == 2:\n del t[n]\nres = []\nfor key, val in t.items():\n res.append(key)\nreturn res", "d = set()\nfor n in nums:\n if n in d:\n d.remove(n)\n else:\n d.add(n)\nreturn list(d)" ]
<|body_start_0|> t = {} for n in nums: if n in t: t[n] += 1 else: t[n] = 1 if t[n] == 2: del t[n] res = [] for key, val in t.items(): res.append(key) return res <|end_body_0|> <|body_...
https://leetcode.com/problems/single-number-iii/description/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/single-number-iii/description/""" def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_034541
843
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber2", "signature": "def singleNumber2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_005976
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/single-number-iii/description/ Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber2(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/single-number-iii/description/ Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber2(self, nums): :type nums: List[int] :rtype: List[int] <|s...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: """https://leetcode.com/problems/single-number-iii/description/""" def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """https://leetcode.com/problems/single-number-iii/description/""" def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" t = {} for n in nums: if n in t: t[n] += 1 else: t[n] = 1 if...
the_stack_v2_python_sparse
old/Session002/Arrays/SingleNumberIII.py
MaxIakovliev/algorithms
train
0
3bc9dbc5765edcd53722c2f7fe155f4c3644209d
[ "lookup = {}\nrows = len(grid)\ncols = len(grid[0])\nones, overlaps = (0, 0)\nfor i in range(rows):\n for j in range(cols):\n if grid[i][j] == 1:\n ones += 1\n lookup[i, j] = 1\n if (i - 1, j) in lookup:\n overlaps += 1\n if (i + 1, j) in lookup:\...
<|body_start_0|> lookup = {} rows = len(grid) cols = len(grid[0]) ones, overlaps = (0, 0) for i in range(rows): for j in range(cols): if grid[i][j] == 1: ones += 1 lookup[i, j] = 1 if (i - 1, ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def islandPerimeter(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def islandPerimeter2(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> def islandPerimeter3(self, grid): """:type grid: List[L...
stack_v2_sparse_classes_36k_train_034542
2,869
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "islandPerimeter", "signature": "def islandPerimeter(self, grid)" }, { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "islandPerimeter2", "signature": "def islandPerimeter2(self, grid)" }, { "docst...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def islandPerimeter(self, grid): :type grid: List[List[int]] :rtype: int - def islandPerimeter2(self, grid): :type grid: List[List[int]] :rtype: int - def islandPerimeter3(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def islandPerimeter(self, grid): :type grid: List[List[int]] :rtype: int - def islandPerimeter2(self, grid): :type grid: List[List[int]] :rtype: int - def islandPerimeter3(self, ...
602dfdf41b72e84f7d8e2f5e1a9ac6e0f8a71967
<|skeleton|> class Solution: def islandPerimeter(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def islandPerimeter2(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> def islandPerimeter3(self, grid): """:type grid: List[L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def islandPerimeter(self, grid): """:type grid: List[List[int]] :rtype: int""" lookup = {} rows = len(grid) cols = len(grid[0]) ones, overlaps = (0, 0) for i in range(rows): for j in range(cols): if grid[i][j] == 1: ...
the_stack_v2_python_sparse
463_island_perimeter.py
YaohuiZeng/Leetcode
train
0
0471e63d594822bbde055d2572c539bfecce6b1a
[ "for c in inspect.getmro(class_obj):\n if c.__name__ == parent_class_name:\n return True\nreturn False", "if 'type' not in config:\n raise ConfigurationError(\"Section {} does not contain the key 'type' defining the component type\".format(name))\nc_type = config['type']\nif c_type.find('ptp.') != -1...
<|body_start_0|> for c in inspect.getmro(class_obj): if c.__name__ == parent_class_name: return True return False <|end_body_0|> <|body_start_1|> if 'type' not in config: raise ConfigurationError("Section {} does not contain the key 'type' defining the co...
Class instantiating the components using the passed config.
ComponentFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentFactory: """Class instantiating the components using the passed config.""" def check_inheritance(class_obj, parent_class_name): """Checks whether given class inherits (even indirectly) from parent class.""" <|body_0|> def build(name, config): """Method c...
stack_v2_sparse_classes_36k_train_034543
2,795
permissive
[ { "docstring": "Checks whether given class inherits (even indirectly) from parent class.", "name": "check_inheritance", "signature": "def check_inheritance(class_obj, parent_class_name)" }, { "docstring": "Method creates a single component on the basis of configuration section. Raises Configurat...
2
stack_v2_sparse_classes_30k_train_015344
Implement the Python class `ComponentFactory` described below. Class description: Class instantiating the components using the passed config. Method signatures and docstrings: - def check_inheritance(class_obj, parent_class_name): Checks whether given class inherits (even indirectly) from parent class. - def build(na...
Implement the Python class `ComponentFactory` described below. Class description: Class instantiating the components using the passed config. Method signatures and docstrings: - def check_inheritance(class_obj, parent_class_name): Checks whether given class inherits (even indirectly) from parent class. - def build(na...
9cb17271666061cb19fe24197ecd5e4c8d32c5da
<|skeleton|> class ComponentFactory: """Class instantiating the components using the passed config.""" def check_inheritance(class_obj, parent_class_name): """Checks whether given class inherits (even indirectly) from parent class.""" <|body_0|> def build(name, config): """Method c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComponentFactory: """Class instantiating the components using the passed config.""" def check_inheritance(class_obj, parent_class_name): """Checks whether given class inherits (even indirectly) from parent class.""" for c in inspect.getmro(class_obj): if c.__name__ == parent_c...
the_stack_v2_python_sparse
ptp/application/component_factory.py
ConnectionMaster/pytorchpipe
train
1
aa1ac397ff453ac5122e4ba163472945f89a516c
[ "self.archival_target = archival_target\nself.cloud_replication_target = cloud_replication_target\nself.replication_target = replication_target\nself.mtype = mtype", "if dictionary is None:\n return None\narchival_target = cohesity_management_sdk.models.archival_external_target.ArchivalExternalTarget.from_dict...
<|body_start_0|> self.archival_target = archival_target self.cloud_replication_target = cloud_replication_target self.replication_target = replication_target self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None archival_target...
Implementation of the 'SnapshotTargetSettings' model. Specifies settings about a target where a copied Snapshot is stored. A target can be a Remote Cluster or an Archival External Target such as AWS or Tape. Attributes: archival_target (ArchivalExternalTarget): Specifies the Archival External Target for storing a copie...
SnapshotTargetSettings
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnapshotTargetSettings: """Implementation of the 'SnapshotTargetSettings' model. Specifies settings about a target where a copied Snapshot is stored. A target can be a Remote Cluster or an Archival External Target such as AWS or Tape. Attributes: archival_target (ArchivalExternalTarget): Specifie...
stack_v2_sparse_classes_36k_train_034544
4,209
permissive
[ { "docstring": "Constructor for the SnapshotTargetSettings class", "name": "__init__", "signature": "def __init__(self, archival_target=None, cloud_replication_target=None, replication_target=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictiona...
2
stack_v2_sparse_classes_30k_train_020021
Implement the Python class `SnapshotTargetSettings` described below. Class description: Implementation of the 'SnapshotTargetSettings' model. Specifies settings about a target where a copied Snapshot is stored. A target can be a Remote Cluster or an Archival External Target such as AWS or Tape. Attributes: archival_ta...
Implement the Python class `SnapshotTargetSettings` described below. Class description: Implementation of the 'SnapshotTargetSettings' model. Specifies settings about a target where a copied Snapshot is stored. A target can be a Remote Cluster or an Archival External Target such as AWS or Tape. Attributes: archival_ta...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SnapshotTargetSettings: """Implementation of the 'SnapshotTargetSettings' model. Specifies settings about a target where a copied Snapshot is stored. A target can be a Remote Cluster or an Archival External Target such as AWS or Tape. Attributes: archival_target (ArchivalExternalTarget): Specifie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnapshotTargetSettings: """Implementation of the 'SnapshotTargetSettings' model. Specifies settings about a target where a copied Snapshot is stored. A target can be a Remote Cluster or an Archival External Target such as AWS or Tape. Attributes: archival_target (ArchivalExternalTarget): Specifies the Archiva...
the_stack_v2_python_sparse
cohesity_management_sdk/models/snapshot_target_settings.py
cohesity/management-sdk-python
train
24
c498d341c49f21f50670398038b28d76fbda3e5e
[ "super(test_resize_volume_instances, cls).setUpClass()\ncls.dbaas = cls.client.reddwarfclient\nNAME = 'qe-resize_instances'\nFLAVOR = 1\nVOLUME = test_resize_volume_instances.ResizeUpSizes.origLevel\ninstance = test_resize_volume_instances.dbaas.instances.create(name=NAME, flavor_id=FLAVOR, volume={'size': VOLUME},...
<|body_start_0|> super(test_resize_volume_instances, cls).setUpClass() cls.dbaas = cls.client.reddwarfclient NAME = 'qe-resize_instances' FLAVOR = 1 VOLUME = test_resize_volume_instances.ResizeUpSizes.origLevel instance = test_resize_volume_instances.dbaas.instances.creat...
test_resize_volume_instances
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_resize_volume_instances: def setUpClass(cls): """Creating an instance for smoke testing""" <|body_0|> def tearDownClass(cls): """Tearing down: Deleting the instance if in active state""" <|body_1|> def test_resize_volume_instance(self): """R...
stack_v2_sparse_classes_36k_train_034545
30,991
permissive
[ { "docstring": "Creating an instance for smoke testing", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Tearing down: Deleting the instance if in active state", "name": "tearDownClass", "signature": "def tearDownClass(cls)" }, { "docstring": "Resize t...
3
null
Implement the Python class `test_resize_volume_instances` described below. Class description: Implement the test_resize_volume_instances class. Method signatures and docstrings: - def setUpClass(cls): Creating an instance for smoke testing - def tearDownClass(cls): Tearing down: Deleting the instance if in active sta...
Implement the Python class `test_resize_volume_instances` described below. Class description: Implement the test_resize_volume_instances class. Method signatures and docstrings: - def setUpClass(cls): Creating an instance for smoke testing - def tearDownClass(cls): Tearing down: Deleting the instance if in active sta...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class test_resize_volume_instances: def setUpClass(cls): """Creating an instance for smoke testing""" <|body_0|> def tearDownClass(cls): """Tearing down: Deleting the instance if in active state""" <|body_1|> def test_resize_volume_instance(self): """R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_resize_volume_instances: def setUpClass(cls): """Creating an instance for smoke testing""" super(test_resize_volume_instances, cls).setUpClass() cls.dbaas = cls.client.reddwarfclient NAME = 'qe-resize_instances' FLAVOR = 1 VOLUME = test_resize_volume_instan...
the_stack_v2_python_sparse
cloudroast/database/pos_regr/instances.py
RULCSoft/cloudroast
train
1
ec55e7e8567fa0615f54ad5159259e02c2c55149
[ "print('Querying database')\nif sort not in ['created_at', 'cook_time', 'num_of_servings']:\n sort = 'created_at'\nif order not in ['asc', 'desc']:\n order = 'desc'\npaginated_recipes = Recipe.get_all_published(q, page, per_page, sort, order)\nreturn (recipe_pagination_schema.dump(paginated_recipes).data, HTT...
<|body_start_0|> print('Querying database') if sort not in ['created_at', 'cook_time', 'num_of_servings']: sort = 'created_at' if order not in ['asc', 'desc']: order = 'desc' paginated_recipes = Recipe.get_all_published(q, page, per_page, sort, order) retu...
RecipeListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecipeListResource: def get(self, q, page, per_page, sort, order): """Passes three arguments in the get_all_published method and gets the pagination object back. returns the paginated recipes as serialized and back to front end client. The q parameter passed the search string into the AP...
stack_v2_sparse_classes_36k_train_034546
8,070
no_license
[ { "docstring": "Passes three arguments in the get_all_published method and gets the pagination object back. returns the paginated recipes as serialized and back to front end client. The q parameter passed the search string into the API", "name": "get", "signature": "def get(self, q, page, per_page, sort...
2
stack_v2_sparse_classes_30k_train_003393
Implement the Python class `RecipeListResource` described below. Class description: Implement the RecipeListResource class. Method signatures and docstrings: - def get(self, q, page, per_page, sort, order): Passes three arguments in the get_all_published method and gets the pagination object back. returns the paginat...
Implement the Python class `RecipeListResource` described below. Class description: Implement the RecipeListResource class. Method signatures and docstrings: - def get(self, q, page, per_page, sort, order): Passes three arguments in the get_all_published method and gets the pagination object back. returns the paginat...
875b8bc3cc5315efe8ccee8ce9b312056802c49d
<|skeleton|> class RecipeListResource: def get(self, q, page, per_page, sort, order): """Passes three arguments in the get_all_published method and gets the pagination object back. returns the paginated recipes as serialized and back to front end client. The q parameter passed the search string into the AP...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecipeListResource: def get(self, q, page, per_page, sort, order): """Passes three arguments in the get_all_published method and gets the pagination object back. returns the paginated recipes as serialized and back to front end client. The q parameter passed the search string into the API""" p...
the_stack_v2_python_sparse
resources/recipe.py
ShayanRiyaz/TheDailyCook
train
1
4c5e0cb42c5a1c375ca0d6015d511deb485d3905
[ "GeneticAlgorithm.__init__(self, max_iter, max_time, max_f_evals, verbose, verbose_interspace, plot_pareto_front, plot_pareto_solutions, plot_dpi, pop_size)\nself._survival_strategy = MemeticSurvivalStrategy(pop_size, crowding_quantile)\nGradientBasedAlgorithm.__init__(self, max_iter, max_time, max_f_evals, verbose...
<|body_start_0|> GeneticAlgorithm.__init__(self, max_iter, max_time, max_f_evals, verbose, verbose_interspace, plot_pareto_front, plot_pareto_solutions, plot_dpi, pop_size) self._survival_strategy = MemeticSurvivalStrategy(pop_size, crowding_quantile) GradientBasedAlgorithm.__init__(self, max_it...
Abstract class for memetic algorithms The main functions are: - Initialize a memetic algorithm instance; - Add a specified value to the current one(s) of a stopping condition (see StoppingCondition.py); - Update the current value of a stopping condition.
MemeticAlgorithm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemeticAlgorithm: """Abstract class for memetic algorithms The main functions are: - Initialize a memetic algorithm instance; - Add a specified value to the current one(s) of a stopping condition (see StoppingCondition.py); - Update the current value of a stopping condition.""" def __init__(...
stack_v2_sparse_classes_36k_train_034547
8,306
permissive
[ { "docstring": "Initialize a memetic algorithm instance :param max_iter: maximum number of iterations :param max_time: maximum number of elapsed minutes on a problem :param max_f_evals: maximum number of function evaluations :param verbose: if set to True, then the VerboseSystem instance is used during the algo...
3
stack_v2_sparse_classes_30k_train_010847
Implement the Python class `MemeticAlgorithm` described below. Class description: Abstract class for memetic algorithms The main functions are: - Initialize a memetic algorithm instance; - Add a specified value to the current one(s) of a stopping condition (see StoppingCondition.py); - Update the current value of a st...
Implement the Python class `MemeticAlgorithm` described below. Class description: Abstract class for memetic algorithms The main functions are: - Initialize a memetic algorithm instance; - Add a specified value to the current one(s) of a stopping condition (see StoppingCondition.py); - Update the current value of a st...
22610b3dbc308fe89309ac99204992feac048908
<|skeleton|> class MemeticAlgorithm: """Abstract class for memetic algorithms The main functions are: - Initialize a memetic algorithm instance; - Add a specified value to the current one(s) of a stopping condition (see StoppingCondition.py); - Update the current value of a stopping condition.""" def __init__(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MemeticAlgorithm: """Abstract class for memetic algorithms The main functions are: - Initialize a memetic algorithm instance; - Add a specified value to the current one(s) of a stopping condition (see StoppingCondition.py); - Update the current value of a stopping condition.""" def __init__(self, max_ite...
the_stack_v2_python_sparse
algorithms/memetic/memetic_algorithm.py
pierlumanzu/nsma
train
5
d2d27c2d852ca82fa3c013df2f1cf08049f297db
[ "value = proposal['value']\nif value is None:\n return value\nif self.min and self.min > value:\n value = max(value, self.min)\nif self.max and self.max < value:\n value = min(value, self.max)\nreturn value", "min = proposal['value']\nif min is None:\n return min\nif self.max and min > self.max:\n ...
<|body_start_0|> value = proposal['value'] if value is None: return value if self.min and self.min > value: value = max(value, self.min) if self.max and self.max < value: value = min(value, self.max) return value <|end_body_0|> <|body_start_1|...
Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick.value = datetime.date(2019, 7, 9)
DatePicker
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatePicker: """Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick....
stack_v2_sparse_classes_36k_train_034548
2,597
permissive
[ { "docstring": "Cap and floor value", "name": "_validate_value", "signature": "def _validate_value(self, proposal)" }, { "docstring": "Enforce min <= value <= max", "name": "_validate_min", "signature": "def _validate_min(self, proposal)" }, { "docstring": "Enforce min <= value <...
3
null
Implement the Python class `DatePicker` described below. Class description: Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pic...
Implement the Python class `DatePicker` described below. Class description: Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pic...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class DatePicker: """Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatePicker: """Display a widget for picking dates. Parameters ---------- value: datetime.date The current value of the widget. disabled: bool Whether to disable user changes. Examples -------- >>> import datetime >>> import ipywidgets as widgets >>> date_pick = widgets.DatePicker() >>> date_pick.value = datet...
the_stack_v2_python_sparse
contrib/python/ipywidgets/py3/ipywidgets/widgets/widget_date.py
catboost/catboost
train
8,012
bc4ff3761dd848b32d7f57f9ebb29f35d9faa02f
[ "self.folderA = folderA\nself.folderB = folderB\nself.fileMask = fileMask\nself.processedFilesList = []", "try:\n print('- copying \"%s\" -> \"%s\"...' % (fileNameSrc, fileNameDst))\n shutil.copyfile(fileNameSrc, fileNameDst)\n shutil.copystat(fileNameSrc, fileNameDst)\nexcept Exception as error:\n pr...
<|body_start_0|> self.folderA = folderA self.folderB = folderB self.fileMask = fileMask self.processedFilesList = [] <|end_body_0|> <|body_start_1|> try: print('- copying "%s" -> "%s"...' % (fileNameSrc, fileNameDst)) shutil.copyfile(fileNameSrc, fileName...
Синхронизация папок
FolderSync
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FolderSync: """Синхронизация папок""" def __init__(self, folderA, folderB, fileMask): """Инициализация""" <|body_0|> def _CopyFile(self, fileNameSrc, fileNameDst): """Копируем файл и подавляем исключения""" <|body_1|> def _SyncOneWay(self, folder1, f...
stack_v2_sparse_classes_36k_train_034549
2,568
no_license
[ { "docstring": "Инициализация", "name": "__init__", "signature": "def __init__(self, folderA, folderB, fileMask)" }, { "docstring": "Копируем файл и подавляем исключения", "name": "_CopyFile", "signature": "def _CopyFile(self, fileNameSrc, fileNameDst)" }, { "docstring": "Односто...
4
stack_v2_sparse_classes_30k_train_005401
Implement the Python class `FolderSync` described below. Class description: Синхронизация папок Method signatures and docstrings: - def __init__(self, folderA, folderB, fileMask): Инициализация - def _CopyFile(self, fileNameSrc, fileNameDst): Копируем файл и подавляем исключения - def _SyncOneWay(self, folder1, folde...
Implement the Python class `FolderSync` described below. Class description: Синхронизация папок Method signatures and docstrings: - def __init__(self, folderA, folderB, fileMask): Инициализация - def _CopyFile(self, fileNameSrc, fileNameDst): Копируем файл и подавляем исключения - def _SyncOneWay(self, folder1, folde...
d2771bf04aa187dda6d468883a5a167237589369
<|skeleton|> class FolderSync: """Синхронизация папок""" def __init__(self, folderA, folderB, fileMask): """Инициализация""" <|body_0|> def _CopyFile(self, fileNameSrc, fileNameDst): """Копируем файл и подавляем исключения""" <|body_1|> def _SyncOneWay(self, folder1, f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FolderSync: """Синхронизация папок""" def __init__(self, folderA, folderB, fileMask): """Инициализация""" self.folderA = folderA self.folderB = folderB self.fileMask = fileMask self.processedFilesList = [] def _CopyFile(self, fileNameSrc, fileNameDst): ...
the_stack_v2_python_sparse
doorsadmin/tools/sync.py
cash2one/doorscenter
train
0
c598542fa0ca5311f3c2025aaab7e697b148e067
[ "self = real_self.magic\ngf = getFormatter\nargs = {'presentation_of': real_self.directTranslate(Message(u'text_presentation_of', 'recensio', default='presentation of:')), 'in': real_self.directTranslate(Message(u'text_in', 'recensio', default='in:')), 'page': real_self.directTranslate(Message(u'text_pages', 'recen...
<|body_start_0|> self = real_self.magic gf = getFormatter args = {'presentation_of': real_self.directTranslate(Message(u'text_presentation_of', 'recensio', default='presentation of:')), 'in': real_self.directTranslate(Message(u'text_in', 'recensio', default='in:')), 'page': real_self.directTrans...
PresentationCollectionNoMagic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PresentationCollectionNoMagic: def get_citation_string(real_self): """NOTE: There is no differentiation between title and subtitle of the collection book. Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.customCitation = ''...
stack_v2_sparse_classes_36k_train_034550
16,138
no_license
[ { "docstring": "NOTE: There is no differentiation between title and subtitle of the collection book. Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.customCitation = '' >>> at_mock.get = lambda x: None >>> at_mock.authors = [{'firstname': x[0], '...
2
stack_v2_sparse_classes_30k_train_016409
Implement the Python class `PresentationCollectionNoMagic` described below. Class description: Implement the PresentationCollectionNoMagic class. Method signatures and docstrings: - def get_citation_string(real_self): NOTE: There is no differentiation between title and subtitle of the collection book. Either return t...
Implement the Python class `PresentationCollectionNoMagic` described below. Class description: Implement the PresentationCollectionNoMagic class. Method signatures and docstrings: - def get_citation_string(real_self): NOTE: There is no differentiation between title and subtitle of the collection book. Either return t...
acf6ca3c962bfcf50600739087973de3ba7ad124
<|skeleton|> class PresentationCollectionNoMagic: def get_citation_string(real_self): """NOTE: There is no differentiation between title and subtitle of the collection book. Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.customCitation = ''...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PresentationCollectionNoMagic: def get_citation_string(real_self): """NOTE: There is no differentiation between title and subtitle of the collection book. Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.customCitation = '' >>> at_mock.g...
the_stack_v2_python_sparse
recensio/contenttypes/content/presentationcollection.py
syslabcom/recensio.contenttypes
train
0
b1533134e20fed855f4e2c8ac4a02ad0397ba0d2
[ "ImageObj.__init__(self, name, interpolation=interpolation, max_pts=max_pts, parent=parent, transform=transform, verbose=verbose, **kw)\nif isinstance(data, np.ndarray):\n self.set_data(data, sf, f_pha, f_amp, idpac, n_window, clim, cmap, vmin, under, vmax, over, **pac_kw)", "is_tensorpac_installed(raise_error...
<|body_start_0|> ImageObj.__init__(self, name, interpolation=interpolation, max_pts=max_pts, parent=parent, transform=transform, verbose=verbose, **kw) if isinstance(data, np.ndarray): self.set_data(data, sf, f_pha, f_amp, idpac, n_window, clim, cmap, vmin, under, vmax, over, **pac_kw) <|end...
Create a Phase-Amplitude Coupling (PAC) object. The PAC is computed using the tensorpac package. The Pacmap can be used to visualize : * PAC, across time for a fixed phase and several amplitude frequencies * PAC, across time for a fixed amplitude and several phase frequencies * PAC is computed across time for several a...
PacmapObj
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PacmapObj: """Create a Phase-Amplitude Coupling (PAC) object. The PAC is computed using the tensorpac package. The Pacmap can be used to visualize : * PAC, across time for a fixed phase and several amplitude frequencies * PAC, across time for a fixed amplitude and several phase frequencies * PAC ...
stack_v2_sparse_classes_36k_train_034551
5,525
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, name, data=None, sf=1.0, f_pha=[(2, 4), (5, 7), (8, 13)], f_amp=[(40, 60), (60, 100)], idpac=(4, 0, 0), n_window=None, cmap='viridis', clim=None, vmin=None, under='gray', vmax=None, over='red', interpolation='nearest', max_pts=...
2
stack_v2_sparse_classes_30k_test_000727
Implement the Python class `PacmapObj` described below. Class description: Create a Phase-Amplitude Coupling (PAC) object. The PAC is computed using the tensorpac package. The Pacmap can be used to visualize : * PAC, across time for a fixed phase and several amplitude frequencies * PAC, across time for a fixed amplitu...
Implement the Python class `PacmapObj` described below. Class description: Create a Phase-Amplitude Coupling (PAC) object. The PAC is computed using the tensorpac package. The Pacmap can be used to visualize : * PAC, across time for a fixed phase and several amplitude frequencies * PAC, across time for a fixed amplitu...
be096aa8a7058c329e7120d0bdb45d3c9eb8be42
<|skeleton|> class PacmapObj: """Create a Phase-Amplitude Coupling (PAC) object. The PAC is computed using the tensorpac package. The Pacmap can be used to visualize : * PAC, across time for a fixed phase and several amplitude frequencies * PAC, across time for a fixed amplitude and several phase frequencies * PAC ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PacmapObj: """Create a Phase-Amplitude Coupling (PAC) object. The PAC is computed using the tensorpac package. The Pacmap can be used to visualize : * PAC, across time for a fixed phase and several amplitude frequencies * PAC, across time for a fixed amplitude and several phase frequencies * PAC is computed a...
the_stack_v2_python_sparse
visbrain/objects/pacmap_obj.py
lassemadsen/visbrain
train
0
1aa1a0058a6e7d11a04fac660de3b22d5d2813f1
[ "super().__init__(params)\nself.lr = lr\nself.momentum = momentum\nself.v_weights = [np.zeros_like(t.weights) for t in self.params]\nself.v_bias = [np.zeros_like(t.bias) for t in self.params]", "for i, object in enumerate(self.params):\n self.v_weights[i] = self.momentum * self.v_weights[i]\n self.v_bias[i]...
<|body_start_0|> super().__init__(params) self.lr = lr self.momentum = momentum self.v_weights = [np.zeros_like(t.weights) for t in self.params] self.v_bias = [np.zeros_like(t.bias) for t in self.params] <|end_body_0|> <|body_start_1|> for i, object in enumerate(self.par...
GD
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GD: def __init__(self, params, lr=0.001, momentum=0.0): """The Gradient Descent optimizer (GD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent""" <|body_0|> def step(self): """Step p...
stack_v2_sparse_classes_36k_train_034552
3,421
no_license
[ { "docstring": "The Gradient Descent optimizer (GD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent", "name": "__init__", "signature": "def __init__(self, params, lr=0.001, momentum=0.0)" }, { "docstring": "Step...
2
stack_v2_sparse_classes_30k_train_006117
Implement the Python class `GD` described below. Class description: Implement the GD class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, momentum=0.0): The Gradient Descent optimizer (GD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the ve...
Implement the Python class `GD` described below. Class description: Implement the GD class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, momentum=0.0): The Gradient Descent optimizer (GD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the ve...
07ff58ae68264e3a9b820d10e84d82f8a3ca99b5
<|skeleton|> class GD: def __init__(self, params, lr=0.001, momentum=0.0): """The Gradient Descent optimizer (GD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent""" <|body_0|> def step(self): """Step p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GD: def __init__(self, params, lr=0.001, momentum=0.0): """The Gradient Descent optimizer (GD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent""" super().__init__(params) self.lr = lr self.mome...
the_stack_v2_python_sparse
wavegrad/optimizers.py
vlnraf/WaveGrad
train
1
546e546c24584a066a8ba1b280b923c8897bf616
[ "if kwargs and object_id:\n raise Exception('Specify an object id or keyword arguments, but not both')\nif kwargs:\n object_id = self._get_object(**kwargs)['Id']\nurl_template = '{root}/lightning/r/{object_name}/{object_id}/view'\nurl = url_template.format(root=self.cumulusci.org.lightning_base_url, object_na...
<|body_start_0|> if kwargs and object_id: raise Exception('Specify an object id or keyword arguments, but not both') if kwargs: object_id = self._get_object(**kwargs)['Id'] url_template = '{root}/lightning/r/{object_name}/{object_id}/view' url = url_template.forma...
A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a unique user. Example | ${contact_id} ...
DetailPage
[ "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetailPage: """A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a...
stack_v2_sparse_classes_36k_train_034553
16,279
permissive
[ { "docstring": "Go to the detail page for the given record. You may pass in an object id, or you may pass in keyword arguments which can be used to look up the object. Example | Go to page Detail Contact firstName=John lastName=Smith", "name": "_go_to_page", "signature": "def _go_to_page(self, object_id...
2
stack_v2_sparse_classes_30k_train_017958
Implement the Python class `DetailPage` described below. Class description: A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyw...
Implement the Python class `DetailPage` described below. Class description: A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyw...
9ccf3c9566f78c6e9102ac214db30470cef660c1
<|skeleton|> class DetailPage: """A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DetailPage: """A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a unique user....
the_stack_v2_python_sparse
cumulusci/robotframework/pageobjects/BasePageObjects.py
SFDO-Tooling/CumulusCI
train
226
8a16fbe82e5c72ada13cb843d973957b35fc6506
[ "super().__init__()\nmodel_file_name_full_path = os.path.join(resource_manager.getResourceRootDir(), model_file_name)\nif not os.path.exists(model_file_name_full_path):\n raise Exception(f'Missing model file: {model_file_name_full_path}')\nself.model = resource_manager.loadRankLibModel(model_file_name)\nself.fea...
<|body_start_0|> super().__init__() model_file_name_full_path = os.path.join(resource_manager.getResourceRootDir(), model_file_name) if not os.path.exists(model_file_name_full_path): raise Exception(f'Missing model file: {model_file_name_full_path}') self.model = resource_man...
An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).
ClassicRanker
[ "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassicRanker: """An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).""" def __init__(self, resource_manager, feat_extr_file_name, model_file_name): """...
stack_v2_sparse_classes_36k_train_034554
3,723
permissive
[ { "docstring": "Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_name: feature extractor JSON configuration file. :param model_file_name: a (previously trained/created) model file name", "name": "__init__", "signature": "def __init__(self, resource_manager, ...
2
stack_v2_sparse_classes_30k_train_010418
Implement the Python class `ClassicRanker` described below. Class description: An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory). Method signatures and docstrings: - def __init__(self, ...
Implement the Python class `ClassicRanker` described below. Class description: An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory). Method signatures and docstrings: - def __init__(self, ...
0bd3e06735ff705731fb6cee62d3486276beccdf
<|skeleton|> class ClassicRanker: """An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).""" def __init__(self, resource_manager, feat_extr_file_name, model_file_name): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassicRanker: """An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).""" def __init__(self, resource_manager, feat_extr_file_name, model_file_name): """Reranker cons...
the_stack_v2_python_sparse
flexneuart/ranker/classic.py
oaqa/FlexNeuART
train
156
3fbad9abe1ddc3fdf17c50ca1ca108b45440e426
[ "Q = self.coll.Qmat if Q is None else Q\nQI = np.zeros_like(Q) if QI is None else QI\nQE = np.zeros_like(Q) if QE is None else QE\nL = self.level\nme = []\nfor m in range(1, self.coll.num_nodes + 1):\n me.append(L.dt * ((Q - QI)[m, 1] * L.f[1].impl + (Q - QE)[m, 1] * L.f[1].expl))\n for j in range(2, self.col...
<|body_start_0|> Q = self.coll.Qmat if Q is None else Q QI = np.zeros_like(Q) if QI is None else QI QE = np.zeros_like(Q) if QE is None else QE L = self.level me = [] for m in range(1, self.coll.num_nodes + 1): me.append(L.dt * ((Q - QI)[m, 1] * L.f[1].impl + ...
Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.
imex_1st_order_efficient
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class imex_1st_order_efficient: """Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.""" def integrate(self, Q=None, QI=None, QE=None): """Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI...
stack_v2_sparse_classes_36k_train_034555
7,777
permissive
[ { "docstring": "Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI (numpy.ndarray): Implicit preconditioner QE (numpy.ndarray): Explicit preconditioner Returns: list of dtype_u: containing the integral as values", "name": "integrate", "signature": "def int...
2
stack_v2_sparse_classes_30k_train_019783
Implement the Python class `imex_1st_order_efficient` described below. Class description: Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability. Method signatures and docstrings: - def integrate(self, Q=None, QI=None, QE=None): Integrates the right-hand side (here impl...
Implement the Python class `imex_1st_order_efficient` described below. Class description: Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability. Method signatures and docstrings: - def integrate(self, Q=None, QI=None, QE=None): Integrates the right-hand side (here impl...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class imex_1st_order_efficient: """Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.""" def integrate(self, Q=None, QI=None, QE=None): """Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class imex_1st_order_efficient: """Duplicate of `imex_1st_order` sweeper which is slightly more efficient at the cost of code readability.""" def integrate(self, Q=None, QI=None, QE=None): """Integrates the right-hand side (here impl + expl) Args: Q (numpy.ndarray): Full quadrature rule QI (numpy.ndarr...
the_stack_v2_python_sparse
pySDC/projects/Resilience/sweepers.py
Parallel-in-Time/pySDC
train
30
30cc6899eeebca39d6974a9cf1f251b627d138d4
[ "import main\nmain.moteur_1_b.set(position)\nmoteur_bassin_1(position)", "import main\nmain.moteur_2_b.set(position)\nmoteur_bassin_2(position)" ]
<|body_start_0|> import main main.moteur_1_b.set(position) moteur_bassin_1(position) <|end_body_0|> <|body_start_1|> import main main.moteur_2_b.set(position) moteur_bassin_2(position) <|end_body_1|>
pelvis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pelvis: def rocker(position: int): """position en % du mouvement total""" <|body_0|> def rotation(position: int): """position en % du mouvement total""" <|body_1|> <|end_skeleton|> <|body_start_0|> import main main.moteur_1_b.set(position) ...
stack_v2_sparse_classes_36k_train_034556
18,170
no_license
[ { "docstring": "position en % du mouvement total", "name": "rocker", "signature": "def rocker(position: int)" }, { "docstring": "position en % du mouvement total", "name": "rotation", "signature": "def rotation(position: int)" } ]
2
stack_v2_sparse_classes_30k_train_008645
Implement the Python class `pelvis` described below. Class description: Implement the pelvis class. Method signatures and docstrings: - def rocker(position: int): position en % du mouvement total - def rotation(position: int): position en % du mouvement total
Implement the Python class `pelvis` described below. Class description: Implement the pelvis class. Method signatures and docstrings: - def rocker(position: int): position en % du mouvement total - def rotation(position: int): position en % du mouvement total <|skeleton|> class pelvis: def rocker(position: int)...
68872f2845464b151ab0ddc809cef1d758e4a703
<|skeleton|> class pelvis: def rocker(position: int): """position en % du mouvement total""" <|body_0|> def rotation(position: int): """position en % du mouvement total""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class pelvis: def rocker(position: int): """position en % du mouvement total""" import main main.moteur_1_b.set(position) moteur_bassin_1(position) def rotation(position: int): """position en % du mouvement total""" import main main.moteur_2_b.set(positio...
the_stack_v2_python_sparse
body.py
ppgg88/InMoov_app
train
1
f218a16813a9351c677fdbc7a6ebe9d0242e2284
[ "TextAnswerFormRecord._init_map(self)\nFilesAnswerFormRecord._init_map(self)\nsuper(AnswerTextAndFilesMixin, self)._init_map()", "TextAnswerFormRecord._init_metadata(self)\nFilesAnswerFormRecord._init_metadata(self)\nsuper(AnswerTextAndFilesMixin, self)._init_metadata()" ]
<|body_start_0|> TextAnswerFormRecord._init_map(self) FilesAnswerFormRecord._init_map(self) super(AnswerTextAndFilesMixin, self)._init_map() <|end_body_0|> <|body_start_1|> TextAnswerFormRecord._init_metadata(self) FilesAnswerFormRecord._init_metadata(self) super(AnswerT...
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
AnswerTextAndFilesMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnswerTextAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_034557
22,562
permissive
[ { "docstring": "stub", "name": "_init_map", "signature": "def _init_map(self)" }, { "docstring": "stub", "name": "_init_metadata", "signature": "def _init_metadata(self)" } ]
2
stack_v2_sparse_classes_30k_train_013259
Implement the Python class `AnswerTextAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub
Implement the Python class `AnswerTextAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub <|skeleton|> class AnswerTextAndFilesMix...
445f968a175d61c8d92c0f617a3c17dc1dc7c584
<|skeleton|> class AnswerTextAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnswerTextAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" TextAnswerFormRecord._init_map(self) FilesAnswerFormRecord._init_map(self) super(AnswerTextAndFilesMixin, self)._init...
the_stack_v2_python_sparse
dlkit/records/assessment/basic/simple_records.py
mitsei/dlkit
train
2
48b4e75b53c36217b319de28103a3ade9799f768
[ "import os\nfrom MDSplus import Uint32\ndebug = os.getenv('DEBUG_DEVICES')\ntry:\n host = str(self.node.record.data())\nexcept:\n host = 'local'\nif Data.execute('mdsconnect($)', host) == 0:\n raise Exception('Error connecting to host: ' + host)\nboard = int(self.board.record)\nfor i in range(4):\n do_n...
<|body_start_0|> import os from MDSplus import Uint32 debug = os.getenv('DEBUG_DEVICES') try: host = str(self.node.record.data()) except: host = 'local' if Data.execute('mdsconnect($)', host) == 0: raise Exception('Error connecting to h...
Adlink CP7452 DIO
CP7452
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CP7452: """Adlink CP7452 DIO""" def init(self): """Initialize digital outputs of CP7452 cpci board. Connects to the host and for each of the DIGITAL_OUTS nodes which are turned on, write the value to the digital output.""" <|body_0|> def store(self): """Stores th...
stack_v2_sparse_classes_36k_train_034558
5,266
permissive
[ { "docstring": "Initialize digital outputs of CP7452 cpci board. Connects to the host and for each of the DIGITAL_OUTS nodes which are turned on, write the value to the digital output.", "name": "init", "signature": "def init(self)" }, { "docstring": "Stores the digital input values into the tre...
2
null
Implement the Python class `CP7452` described below. Class description: Adlink CP7452 DIO Method signatures and docstrings: - def init(self): Initialize digital outputs of CP7452 cpci board. Connects to the host and for each of the DIGITAL_OUTS nodes which are turned on, write the value to the digital output. - def s...
Implement the Python class `CP7452` described below. Class description: Adlink CP7452 DIO Method signatures and docstrings: - def init(self): Initialize digital outputs of CP7452 cpci board. Connects to the host and for each of the DIGITAL_OUTS nodes which are turned on, write the value to the digital output. - def s...
9cb20ed47249576d100a5e395028605a220e6146
<|skeleton|> class CP7452: """Adlink CP7452 DIO""" def init(self): """Initialize digital outputs of CP7452 cpci board. Connects to the host and for each of the DIGITAL_OUTS nodes which are turned on, write the value to the digital output.""" <|body_0|> def store(self): """Stores th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CP7452: """Adlink CP7452 DIO""" def init(self): """Initialize digital outputs of CP7452 cpci board. Connects to the host and for each of the DIGITAL_OUTS nodes which are turned on, write the value to the digital output.""" import os from MDSplus import Uint32 debug = os.ge...
the_stack_v2_python_sparse
pydevices/MitDevices/cp7452.py
MDSplus/mdsplus
train
61
5c144fc89b07f85459d6b92764fb9c0112265826
[ "self.name = name\nself.dictionary = Dictionary()\nself.res_random = RandomResponder('Random', self.dictionary)\nself.res_what = RepeatResponder('Repeat', self.dictionary)\nself.res_pattern = PatternResponder('Pattern', self.dictionary)", "x = random.randint(0, 100)\nif x <= 60:\n self.responder = self.res_pat...
<|body_start_0|> self.name = name self.dictionary = Dictionary() self.res_random = RandomResponder('Random', self.dictionary) self.res_what = RepeatResponder('Repeat', self.dictionary) self.res_pattern = PatternResponder('Pattern', self.dictionary) <|end_body_0|> <|body_start_1|...
ピティナの本体クラス
Ptna
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ptna: """ピティナの本体クラス""" def __init__(self, name): """Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前""" <|body_0|> def dialogue(self, input): """応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 戻り値 応答文字列""" ...
stack_v2_sparse_classes_36k_train_034559
1,559
no_license
[ { "docstring": "Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 戻り値 応答文字列", "name": "dialogue", "signature": ...
2
stack_v2_sparse_classes_30k_train_000044
Implement the Python class `Ptna` described below. Class description: ピティナの本体クラス Method signatures and docstrings: - def __init__(self, name): Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前 - def dialogue(self, input): 応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 ...
Implement the Python class `Ptna` described below. Class description: ピティナの本体クラス Method signatures and docstrings: - def __init__(self, name): Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前 - def dialogue(self, input): 応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 ...
26126c02cfa0dc4c0db726f2f2cabb162511a5b5
<|skeleton|> class Ptna: """ピティナの本体クラス""" def __init__(self, name): """Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前""" <|body_0|> def dialogue(self, input): """応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 戻り値 応答文字列""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ptna: """ピティナの本体クラス""" def __init__(self, name): """Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前""" self.name = name self.dictionary = Dictionary() self.res_random = RandomResponder('Random', self.dictionary) self.res_what = Repeat...
the_stack_v2_python_sparse
normal/PythonAI/chap05/sec03/Ptna/ptna.py
munezou/PycharmProject
train
2
f0bdc18bbdc65c9e968d24215b8e50bef2352cc7
[ "super(Conv2dSubsampling2, self).__init__()\nself.conv = torch.nn.Sequential(torch.nn.Conv2d(1, odim, 3, 2), torch.nn.ReLU(), torch.nn.Conv2d(odim, odim, 3, 1), torch.nn.ReLU())\nself.out = torch.nn.Sequential(torch.nn.Linear(odim * ((idim - 1) // 2 - 2), odim), pos_enc if pos_enc is not None else PositionalEncodin...
<|body_start_0|> super(Conv2dSubsampling2, self).__init__() self.conv = torch.nn.Sequential(torch.nn.Conv2d(1, odim, 3, 2), torch.nn.ReLU(), torch.nn.Conv2d(odim, odim, 3, 1), torch.nn.ReLU()) self.out = torch.nn.Sequential(torch.nn.Linear(odim * ((idim - 1) // 2 - 2), odim), pos_enc if pos_enc ...
Convolutional 2D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.
Conv2dSubsampling2
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dSubsampling2: """Convolutional 2D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): ...
stack_v2_sparse_classes_36k_train_034560
14,351
permissive
[ { "docstring": "Construct an Conv2dSubsampling2 object.", "name": "__init__", "signature": "def __init__(self, idim, odim, dropout_rate, pos_enc=None)" }, { "docstring": "Subsample x. Args: x (torch.Tensor): Input tensor (#batch, time, idim). x_mask (torch.Tensor): Input mask (#batch, 1, time). ...
3
null
Implement the Python class `Conv2dSubsampling2` described below. Class description: Convolutional 2D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer. Method signatures and docstr...
Implement the Python class `Conv2dSubsampling2` described below. Class description: Convolutional 2D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer. Method signatures and docstr...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class Conv2dSubsampling2: """Convolutional 2D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv2dSubsampling2: """Convolutional 2D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): """Co...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/transformer/subsampling.py
espnet/espnet
train
7,242
92ec0c8402c7a245a8bc3b6c25bf4a1918ca35a6
[ "self.key = key\nself.value = value\nself.prev = prev\nself.next = next", "if self.prev:\n self.prev.next = self.next\nif self.next:\n self.next.prev = self.prev" ]
<|body_start_0|> self.key = key self.value = value self.prev = prev self.next = next <|end_body_0|> <|body_start_1|> if self.prev: self.prev.next = self.next if self.next: self.next.prev = self.prev <|end_body_1|>
ListNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListNode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [ListNode] : Previous ListNode in list, defaults to None :param next [ListNode] ...
stack_v2_sparse_classes_36k_train_034561
6,249
permissive
[ { "docstring": "A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [ListNode] : Previous ListNode in list, defaults to None :param next [ListNode] : Next ListNode in list, defaults to None", "name": "__init__", "si...
2
null
Implement the Python class `ListNode` described below. Class description: Implement the ListNode class. Method signatures and docstrings: - def __init__(self, key, value, prev=None, next=None): A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by ...
Implement the Python class `ListNode` described below. Class description: Implement the ListNode class. Method signatures and docstrings: - def __init__(self, key, value, prev=None, next=None): A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by ...
b0b3d3c6dc3fa397c8c7a492098a02cf75e0ff82
<|skeleton|> class ListNode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [ListNode] : Previous ListNode in list, defaults to None :param next [ListNode] ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListNode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [ListNode] : Previous ListNode in list, defaults to None :param next [ListNode] : Next ListNod...
the_stack_v2_python_sparse
cs/lambda_cs/03_data_structures/lru_cache/lru_cache.py
tobias-fyi/vela
train
0
43f76bd818fece5e38f43c1023ec4a76a3322321
[ "suggestions = super(Partner, self).get_static_mention_suggestions()\ntry:\n employee_group = self.env.ref('base.group_user')\n hr_suggestions = [{'id': user.partner_id.id, 'name': user.name, 'email': user.email} for user in employee_group.users]\n suggestions.append(hr_suggestions)\n return suggestions...
<|body_start_0|> suggestions = super(Partner, self).get_static_mention_suggestions() try: employee_group = self.env.ref('base.group_user') hr_suggestions = [{'id': user.partner_id.id, 'name': user.name, 'email': user.email} for user in employee_group.users] suggestion...
Partner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Partner: def get_static_mention_suggestions(self): """Extend the mail's static mention suggestions by adding the employees.""" <|body_0|> def name_get(self): """Override to allow an employee to see its private address in his profile. This avoids to relax access rules...
stack_v2_sparse_classes_36k_train_034562
1,457
no_license
[ { "docstring": "Extend the mail's static mention suggestions by adding the employees.", "name": "get_static_mention_suggestions", "signature": "def get_static_mention_suggestions(self)" }, { "docstring": "Override to allow an employee to see its private address in his profile. This avoids to rel...
2
null
Implement the Python class `Partner` described below. Class description: Implement the Partner class. Method signatures and docstrings: - def get_static_mention_suggestions(self): Extend the mail's static mention suggestions by adding the employees. - def name_get(self): Override to allow an employee to see its priva...
Implement the Python class `Partner` described below. Class description: Implement the Partner class. Method signatures and docstrings: - def get_static_mention_suggestions(self): Extend the mail's static mention suggestions by adding the employees. - def name_get(self): Override to allow an employee to see its priva...
148dd95d991a348ebbaff9396759a7dd1fe6e101
<|skeleton|> class Partner: def get_static_mention_suggestions(self): """Extend the mail's static mention suggestions by adding the employees.""" <|body_0|> def name_get(self): """Override to allow an employee to see its private address in his profile. This avoids to relax access rules...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Partner: def get_static_mention_suggestions(self): """Extend the mail's static mention suggestions by adding the employees.""" suggestions = super(Partner, self).get_static_mention_suggestions() try: employee_group = self.env.ref('base.group_user') hr_suggestion...
the_stack_v2_python_sparse
addons/hr/models/res_partner.py
marionumza/saas
train
0
6c39e0d144ae45bb76ee7f90bccef400bc802762
[ "count = 0\nsorted_array = sorted(arr)\ns1 = s2 = 0\nfor num1, num2 in zip(arr, sorted_array):\n s1 += num1\n s2 += num2\n if s1 == s2:\n count += 1\nreturn count", "count = max_value = 0\nfor i in range(len(arr)):\n max_value = max(max_value, arr[i])\n if max_value == i:\n count += 1...
<|body_start_0|> count = 0 sorted_array = sorted(arr) s1 = s2 = 0 for num1, num2 in zip(arr, sorted_array): s1 += num1 s2 += num2 if s1 == s2: count += 1 return count <|end_body_0|> <|body_start_1|> count = max_value = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxChunksToSorted(self, arr: List[int]) -> int: """sorting and compare sum""" <|body_0|> def maxChunksToSorted(self, arr: List[int]) -> int: """use index""" <|body_1|> <|end_skeleton|> <|body_start_0|> count = 0 sorted_array = ...
stack_v2_sparse_classes_36k_train_034563
905
no_license
[ { "docstring": "sorting and compare sum", "name": "maxChunksToSorted", "signature": "def maxChunksToSorted(self, arr: List[int]) -> int" }, { "docstring": "use index", "name": "maxChunksToSorted", "signature": "def maxChunksToSorted(self, arr: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_008142
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxChunksToSorted(self, arr: List[int]) -> int: sorting and compare sum - def maxChunksToSorted(self, arr: List[int]) -> int: use index
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxChunksToSorted(self, arr: List[int]) -> int: sorting and compare sum - def maxChunksToSorted(self, arr: List[int]) -> int: use index <|skeleton|> class Solution: def...
fce451090ecaf5471aab5a9413ac0675639ace5d
<|skeleton|> class Solution: def maxChunksToSorted(self, arr: List[int]) -> int: """sorting and compare sum""" <|body_0|> def maxChunksToSorted(self, arr: List[int]) -> int: """use index""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxChunksToSorted(self, arr: List[int]) -> int: """sorting and compare sum""" count = 0 sorted_array = sorted(arr) s1 = s2 = 0 for num1, num2 in zip(arr, sorted_array): s1 += num1 s2 += num2 if s1 == s2: ...
the_stack_v2_python_sparse
array_stack_queue/769MaxChunksToMakeSorted.py
kidexp/91leetcode
train
0
106082d1896bc5e9d7fd85b24424562c75f46632
[ "self.box = box\nself._method = method\nsuper().__init__(hass, _LOGGER, name=name, update_interval=_SCAN_INTERVAL)", "try:\n return await self._method(self.box)\nexcept SFRBoxError as err:\n raise UpdateFailed() from err" ]
<|body_start_0|> self.box = box self._method = method super().__init__(hass, _LOGGER, name=name, update_interval=_SCAN_INTERVAL) <|end_body_0|> <|body_start_1|> try: return await self._method(self.box) except SFRBoxError as err: raise UpdateFailed() from ...
Coordinator to manage data updates.
SFRDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SFRDataUpdateCoordinator: """Coordinator to manage data updates.""" def __init__(self, hass: HomeAssistant, box: SFRBox, name: str, method: Callable[[SFRBox], Coroutine[Any, Any, _T]]) -> None: """Initialize coordinator.""" <|body_0|> async def _async_update_data(self) -...
stack_v2_sparse_classes_36k_train_034564
1,140
permissive
[ { "docstring": "Initialize coordinator.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, box: SFRBox, name: str, method: Callable[[SFRBox], Coroutine[Any, Any, _T]]) -> None" }, { "docstring": "Update data.", "name": "_async_update_data", "signature": "async de...
2
stack_v2_sparse_classes_30k_train_001067
Implement the Python class `SFRDataUpdateCoordinator` described below. Class description: Coordinator to manage data updates. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, box: SFRBox, name: str, method: Callable[[SFRBox], Coroutine[Any, Any, _T]]) -> None: Initialize coordinator. - asyn...
Implement the Python class `SFRDataUpdateCoordinator` described below. Class description: Coordinator to manage data updates. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, box: SFRBox, name: str, method: Callable[[SFRBox], Coroutine[Any, Any, _T]]) -> None: Initialize coordinator. - asyn...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SFRDataUpdateCoordinator: """Coordinator to manage data updates.""" def __init__(self, hass: HomeAssistant, box: SFRBox, name: str, method: Callable[[SFRBox], Coroutine[Any, Any, _T]]) -> None: """Initialize coordinator.""" <|body_0|> async def _async_update_data(self) -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SFRDataUpdateCoordinator: """Coordinator to manage data updates.""" def __init__(self, hass: HomeAssistant, box: SFRBox, name: str, method: Callable[[SFRBox], Coroutine[Any, Any, _T]]) -> None: """Initialize coordinator.""" self.box = box self._method = method super().__in...
the_stack_v2_python_sparse
homeassistant/components/sfr_box/coordinator.py
home-assistant/core
train
35,501
415ba941b0c4e3d0b613fff35a888e305867c049
[ "try:\n user_pk = kwargs['user_pk']\nexcept KeyError:\n return JsonResponse({'Error': 'Not Found'}, status=status.HTTP_404_NOT_FOUND)\nuser = get_object_or_404(User, pk=user_pk, is_active=True)\ndefault_params = DefaultParams.default_value(key=user.group.pk)\ndefault_combustibles_params = default_params.combu...
<|body_start_0|> try: user_pk = kwargs['user_pk'] except KeyError: return JsonResponse({'Error': 'Not Found'}, status=status.HTTP_404_NOT_FOUND) user = get_object_or_404(User, pk=user_pk, is_active=True) default_params = DefaultParams.default_value(key=user.group....
ParamsView requires authenticated advisor get :model:`autodiag_copro.Params`
DefaultParamsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultParamsView: """ParamsView requires authenticated advisor get :model:`autodiag_copro.Params`""" def get(self, request, *args, **kwargs): """Get :model:`autodiag_copro.DefaultParams` by [pk]""" <|body_0|> def patch(self, request, *args, **kwargs): """Update ...
stack_v2_sparse_classes_36k_train_034565
2,999
no_license
[ { "docstring": "Get :model:`autodiag_copro.DefaultParams` by [pk]", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Update :model:`autodiag_copro.DefaultParams` by [pk] Must have default_params.change permission", "name": "patch", "signature": "de...
2
null
Implement the Python class `DefaultParamsView` described below. Class description: ParamsView requires authenticated advisor get :model:`autodiag_copro.Params` Method signatures and docstrings: - def get(self, request, *args, **kwargs): Get :model:`autodiag_copro.DefaultParams` by [pk] - def patch(self, request, *arg...
Implement the Python class `DefaultParamsView` described below. Class description: ParamsView requires authenticated advisor get :model:`autodiag_copro.Params` Method signatures and docstrings: - def get(self, request, *args, **kwargs): Get :model:`autodiag_copro.DefaultParams` by [pk] - def patch(self, request, *arg...
95d21cd6036a99c5f399b700a5426e9e2e17e878
<|skeleton|> class DefaultParamsView: """ParamsView requires authenticated advisor get :model:`autodiag_copro.Params`""" def get(self, request, *args, **kwargs): """Get :model:`autodiag_copro.DefaultParams` by [pk]""" <|body_0|> def patch(self, request, *args, **kwargs): """Update ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultParamsView: """ParamsView requires authenticated advisor get :model:`autodiag_copro.Params`""" def get(self, request, *args, **kwargs): """Get :model:`autodiag_copro.DefaultParams` by [pk]""" try: user_pk = kwargs['user_pk'] except KeyError: return J...
the_stack_v2_python_sparse
autodiag_copro/views/default_params.py
alexandrenorman/mixeur
train
0
a6663d9c1154db81bb9c325d4d87fbf214957add
[ "super(MLP, self).__init__()\nself.neurons = [input_dim] + hidden_dims + [output_class]\nself.layers = []\ndropout_each_layer = dropout\nif not isinstance(dropout_each_layer, (tuple, list)):\n dropout_each_layer = [dropout] * len(hidden_dims)\nfor idx, (in_dim, out_dim, dropout_this_layer) in enumerate(zip(self....
<|body_start_0|> super(MLP, self).__init__() self.neurons = [input_dim] + hidden_dims + [output_class] self.layers = [] dropout_each_layer = dropout if not isinstance(dropout_each_layer, (tuple, list)): dropout_each_layer = [dropout] * len(hidden_dims) for idx...
>>> General class for multilayer perceptron >>> Suitable for MNIST
MLP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """>>> General class for multilayer perceptron >>> Suitable for MNIST""" def __init__(self, input_dim=784, hidden_dims=[], output_class=10, dropout=None): """>>> input_dim, hidden_dims, output_class: the dim of input neurons, hidden neurons and output neurons >>> dropout: the dr...
stack_v2_sparse_classes_36k_train_034566
1,712
no_license
[ { "docstring": ">>> input_dim, hidden_dims, output_class: the dim of input neurons, hidden neurons and output neurons >>> dropout: the dropout rate i.e. the probability to deactivate the neuron, None means no dropout", "name": "__init__", "signature": "def __init__(self, input_dim=784, hidden_dims=[], o...
2
stack_v2_sparse_classes_30k_train_006525
Implement the Python class `MLP` described below. Class description: >>> General class for multilayer perceptron >>> Suitable for MNIST Method signatures and docstrings: - def __init__(self, input_dim=784, hidden_dims=[], output_class=10, dropout=None): >>> input_dim, hidden_dims, output_class: the dim of input neuro...
Implement the Python class `MLP` described below. Class description: >>> General class for multilayer perceptron >>> Suitable for MNIST Method signatures and docstrings: - def __init__(self, input_dim=784, hidden_dims=[], output_class=10, dropout=None): >>> input_dim, hidden_dims, output_class: the dim of input neuro...
14d9bc5b25699dd275466c82b6d3748fd90e6e4e
<|skeleton|> class MLP: """>>> General class for multilayer perceptron >>> Suitable for MNIST""" def __init__(self, input_dim=784, hidden_dims=[], output_class=10, dropout=None): """>>> input_dim, hidden_dims, output_class: the dim of input neurons, hidden neurons and output neurons >>> dropout: the dr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLP: """>>> General class for multilayer perceptron >>> Suitable for MNIST""" def __init__(self, input_dim=784, hidden_dims=[], output_class=10, dropout=None): """>>> input_dim, hidden_dims, output_class: the dim of input neurons, hidden neurons and output neurons >>> dropout: the dropout rate i....
the_stack_v2_python_sparse
pytorch/cv/mnist/models/mlp.py
liuchen11/dl_benchmark
train
0
94daa731248d091e5571f9b46d0d2eefe5c9b118
[ "super().__init__()\nself.channels = in_channels\nself.n_filters = n_filters\npadding = int(kernel_size / 2)\nself.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=n_filters, kernel_size=kernel_size, padding=padding)\nself.conv2 = nn.Conv2d(in_channels=n_filters, out_channels=n_filters, kernel_size=kernel_si...
<|body_start_0|> super().__init__() self.channels = in_channels self.n_filters = n_filters padding = int(kernel_size / 2) self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=n_filters, kernel_size=kernel_size, padding=padding) self.conv2 = nn.Conv2d(in_channels=n...
A residual block that up-samples the input image by a factor of 2.
ResidualBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualBlock: """A residual block that up-samples the input image by a factor of 2.""" def __init__(self, in_channels, n_filters=64, kernel_size=3, dtype=torch.float): """Instantiate the residual block, composed by a 2x up-sampling and two convolutional layers. Args: in_channels (in...
stack_v2_sparse_classes_36k_train_034567
6,461
permissive
[ { "docstring": "Instantiate the residual block, composed by a 2x up-sampling and two convolutional layers. Args: in_channels (int): Number of input channels. n_filters (int): Number of filters, and thus output channels. kernel_size (int): Size of the convolutional kernels. dtype (torch.dtype): Type to be used i...
2
stack_v2_sparse_classes_30k_train_003010
Implement the Python class `ResidualBlock` described below. Class description: A residual block that up-samples the input image by a factor of 2. Method signatures and docstrings: - def __init__(self, in_channels, n_filters=64, kernel_size=3, dtype=torch.float): Instantiate the residual block, composed by a 2x up-sam...
Implement the Python class `ResidualBlock` described below. Class description: A residual block that up-samples the input image by a factor of 2. Method signatures and docstrings: - def __init__(self, in_channels, n_filters=64, kernel_size=3, dtype=torch.float): Instantiate the residual block, composed by a 2x up-sam...
702d3ff3aec40eba20e17c5a1612b5b0b1e2f831
<|skeleton|> class ResidualBlock: """A residual block that up-samples the input image by a factor of 2.""" def __init__(self, in_channels, n_filters=64, kernel_size=3, dtype=torch.float): """Instantiate the residual block, composed by a 2x up-sampling and two convolutional layers. Args: in_channels (in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResidualBlock: """A residual block that up-samples the input image by a factor of 2.""" def __init__(self, in_channels, n_filters=64, kernel_size=3, dtype=torch.float): """Instantiate the residual block, composed by a 2x up-sampling and two convolutional layers. Args: in_channels (int): Number of...
the_stack_v2_python_sparse
networks/decoder_net.py
CampusAI/Hamiltonian-Generative-Networks
train
35
545fed3f1a27a00c8da8f7b56d5a0ab5ff200dce
[ "self.urlroot = urlroot\nself.headers = headers or {}\nself.cookies = cookies or {}", "url = self.urlroot + path\nif self.headers:\n if 'headers' in kwargs:\n headers = self.headers.copy()\n headers.update(kwargs['headers'])\n else:\n headers = self.headers\n kwargs['headers'] = head...
<|body_start_0|> self.urlroot = urlroot self.headers = headers or {} self.cookies = cookies or {} <|end_body_0|> <|body_start_1|> url = self.urlroot + path if self.headers: if 'headers' in kwargs: headers = self.headers.copy() headers....
Proxy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Proxy: def __init__(self, urlroot, headers=None, cookies=None): """:param urlroot: 平台接口根路径(比如 http://mapi.m.jxtbkt.com) :param headers: 自定义头部字典 :param cookies: 自定义cookie字典""" <|body_0|> def post(self, path, data=None, json=None, **kwargs): """Sends a POST request. :p...
stack_v2_sparse_classes_36k_train_034568
4,472
no_license
[ { "docstring": ":param urlroot: 平台接口根路径(比如 http://mapi.m.jxtbkt.com) :param headers: 自定义头部字典 :param cookies: 自定义cookie字典", "name": "__init__", "signature": "def __init__(self, urlroot, headers=None, cookies=None)" }, { "docstring": "Sends a POST request. :param path: 接口路径(比如 \"/account/profile\"...
3
stack_v2_sparse_classes_30k_train_003172
Implement the Python class `Proxy` described below. Class description: Implement the Proxy class. Method signatures and docstrings: - def __init__(self, urlroot, headers=None, cookies=None): :param urlroot: 平台接口根路径(比如 http://mapi.m.jxtbkt.com) :param headers: 自定义头部字典 :param cookies: 自定义cookie字典 - def post(self, path,...
Implement the Python class `Proxy` described below. Class description: Implement the Proxy class. Method signatures and docstrings: - def __init__(self, urlroot, headers=None, cookies=None): :param urlroot: 平台接口根路径(比如 http://mapi.m.jxtbkt.com) :param headers: 自定义头部字典 :param cookies: 自定义cookie字典 - def post(self, path,...
1f08cbfccc1ae2123d92670c0afed9b59ae645b8
<|skeleton|> class Proxy: def __init__(self, urlroot, headers=None, cookies=None): """:param urlroot: 平台接口根路径(比如 http://mapi.m.jxtbkt.com) :param headers: 自定义头部字典 :param cookies: 自定义cookie字典""" <|body_0|> def post(self, path, data=None, json=None, **kwargs): """Sends a POST request. :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Proxy: def __init__(self, urlroot, headers=None, cookies=None): """:param urlroot: 平台接口根路径(比如 http://mapi.m.jxtbkt.com) :param headers: 自定义头部字典 :param cookies: 自定义cookie字典""" self.urlroot = urlroot self.headers = headers or {} self.cookies = cookies or {} def post(self, pa...
the_stack_v2_python_sparse
tbkt/libs/utils/tbktapi.py
GUAN-YE/hd_api_djs
train
1
7c38b8a071d09314ccc063999da239fc84e737f2
[ "self.session: object = session\nself.tcex: object = tcex\nself.args: Namespace = tcex.args\nself.allow_redirects: bool = True\nself.data: Optional[Union[dict, str]] = None\nself.headers: dict = {}\nself.max_mb: int = 500\nself.mt: callable = MimeTypes()\nself.output_prefix: str = self.tcex.ij.output_prefix\nself.p...
<|body_start_0|> self.session: object = session self.tcex: object = tcex self.args: Namespace = tcex.args self.allow_redirects: bool = True self.data: Optional[Union[dict, str]] = None self.headers: dict = {} self.max_mb: int = 500 self.mt: callable = Mime...
App Feature Advanced Request Module Args: session (object): An instance of Requests Session object. tcex (object): An instance of Tcex object. timeout (Optional[int] = 600): The timeout value for the request.
AdvancedRequest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdvancedRequest: """App Feature Advanced Request Module Args: session (object): An instance of Requests Session object. tcex (object): An instance of Tcex object. timeout (Optional[int] = 600): The timeout value for the request.""" def __init__(self, session: object, tcex: object, timeout: O...
stack_v2_sparse_classes_36k_train_034569
6,443
permissive
[ { "docstring": "Initialize class properties.", "name": "__init__", "signature": "def __init__(self, session: object, tcex: object, timeout: Optional[int]=600)" }, { "docstring": "Configure Body Args: tc_adv_req_body (Union[bytes, str]): The request body.", "name": "configure_body", "sign...
5
stack_v2_sparse_classes_30k_val_000838
Implement the Python class `AdvancedRequest` described below. Class description: App Feature Advanced Request Module Args: session (object): An instance of Requests Session object. tcex (object): An instance of Tcex object. timeout (Optional[int] = 600): The timeout value for the request. Method signatures and docstr...
Implement the Python class `AdvancedRequest` described below. Class description: App Feature Advanced Request Module Args: session (object): An instance of Requests Session object. tcex (object): An instance of Tcex object. timeout (Optional[int] = 600): The timeout value for the request. Method signatures and docstr...
7cf04fec048fadc71ff851970045b8a587269ccf
<|skeleton|> class AdvancedRequest: """App Feature Advanced Request Module Args: session (object): An instance of Requests Session object. tcex (object): An instance of Tcex object. timeout (Optional[int] = 600): The timeout value for the request.""" def __init__(self, session: object, tcex: object, timeout: O...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdvancedRequest: """App Feature Advanced Request Module Args: session (object): An instance of Requests Session object. tcex (object): An instance of Tcex object. timeout (Optional[int] = 600): The timeout value for the request.""" def __init__(self, session: object, tcex: object, timeout: Optional[int]=...
the_stack_v2_python_sparse
tcex/app_feature/advanced_request.py
TpyoKnig/tcex
train
0
f14bed489841b35f5cb0103699c0d3c0a3594674
[ "def dfs(root1, root2):\n if root1 is None and root2 is None:\n return True\n if root1 is None or root2 is None:\n return False\n if root1.val != root2.val:\n return False\n return dfs(root1.left, root2.left) and dfs(root1.right, root2.right) or (dfs(root1.left, root2.right) and dfs...
<|body_start_0|> def dfs(root1, root2): if root1 is None and root2 is None: return True if root1 is None or root2 is None: return False if root1.val != root2.val: return False return dfs(root1.left, root2.left) and d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def flipEquiv2(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_034570
2,038
no_license
[ { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "flipEquiv", "signature": "def flipEquiv(self, root1, root2)" }, { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "flipEquiv2", "signature": "def flipEquiv2(self, root1, r...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flipEquiv(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def flipEquiv2(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flipEquiv(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def flipEquiv2(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rty...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def flipEquiv2(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" def dfs(root1, root2): if root1 is None and root2 is None: return True if root1 is None or root2 is None: return False ...
the_stack_v2_python_sparse
7.BINARY TREE and BST/951_flip equivalent binary tree_MED/solution.py
kimmyoo/python_leetcode
train
1
6f0940ad0339e69f7d7e7ef410baa3f2df474e82
[ "user = get_a_user(assetid)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn get_a_user(data=data)", "user = complete_users(assetid)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn complete_users(data=data)", "user = delete_user(asseti...
<|body_start_0|> user = get_a_user(assetid) if not user: api.abort(404) else: return user data = request.json return get_a_user(data=data) <|end_body_0|> <|body_start_1|> user = complete_users(assetid) if not user: api.abort(40...
Assets
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Assets: def get(self, assetid): """get a Assets given its identifier""" <|body_0|> def put(self, assetid): """Assets Updated""" <|body_1|> def delete(self, assetid): """Assets Deleted""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_034571
2,510
no_license
[ { "docstring": "get a Assets given its identifier", "name": "get", "signature": "def get(self, assetid)" }, { "docstring": "Assets Updated", "name": "put", "signature": "def put(self, assetid)" }, { "docstring": "Assets Deleted", "name": "delete", "signature": "def delete...
3
stack_v2_sparse_classes_30k_train_008558
Implement the Python class `Assets` described below. Class description: Implement the Assets class. Method signatures and docstrings: - def get(self, assetid): get a Assets given its identifier - def put(self, assetid): Assets Updated - def delete(self, assetid): Assets Deleted
Implement the Python class `Assets` described below. Class description: Implement the Assets class. Method signatures and docstrings: - def get(self, assetid): get a Assets given its identifier - def put(self, assetid): Assets Updated - def delete(self, assetid): Assets Deleted <|skeleton|> class Assets: def ge...
4fa4042304ee01cf23ecc81f9c27977fd12c31b9
<|skeleton|> class Assets: def get(self, assetid): """get a Assets given its identifier""" <|body_0|> def put(self, assetid): """Assets Updated""" <|body_1|> def delete(self, assetid): """Assets Deleted""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Assets: def get(self, assetid): """get a Assets given its identifier""" user = get_a_user(assetid) if not user: api.abort(404) else: return user data = request.json return get_a_user(data=data) def put(self, assetid): """Asse...
the_stack_v2_python_sparse
main/controller/assets_controller.py
Gauravkumar45/Flask-RESTPlus-API
train
0
706ef83f8504f257c5a7d287bf342f597038bd88
[ "cpacs_path = mif.get_toolinput_file_path('SMUse')\ntixi = cpsf.open_tixi(cpacs_path)\nself.Model = smu.load_surrogate(tixi)\ncpsf.close_tixi(tixi, cpacs_path)\ndf = self.Model.df\ndf.set_index('Name', inplace=True)\nfor name in df.index:\n if df.loc[name, 'type'] == 'obj':\n self.add_output(name)\n el...
<|body_start_0|> cpacs_path = mif.get_toolinput_file_path('SMUse') tixi = cpsf.open_tixi(cpacs_path) self.Model = smu.load_surrogate(tixi) cpsf.close_tixi(tixi, cpacs_path) df = self.Model.df df.set_index('Name', inplace=True) for name in df.index: if ...
Uses a surrogate model to make a prediction
SmComp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmComp: """Uses a surrogate model to make a prediction""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Make a prediction""" <|body_1|> <|end_skeleton|> <|body_start_0|> cpacs_path = mif.get_to...
stack_v2_sparse_classes_36k_train_034572
21,151
permissive
[ { "docstring": "Setup inputs and outputs", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Make a prediction", "name": "compute", "signature": "def compute(self, inputs, outputs)" } ]
2
stack_v2_sparse_classes_30k_val_000446
Implement the Python class `SmComp` described below. Class description: Uses a surrogate model to make a prediction Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Make a prediction
Implement the Python class `SmComp` described below. Class description: Uses a surrogate model to make a prediction Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Make a prediction <|skeleton|> class SmComp: """Uses a surrogate model to make a ...
3cc211507caab176a76213e442238abfa43afa42
<|skeleton|> class SmComp: """Uses a surrogate model to make a prediction""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Make a prediction""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmComp: """Uses a surrogate model to make a prediction""" def setup(self): """Setup inputs and outputs""" cpacs_path = mif.get_toolinput_file_path('SMUse') tixi = cpsf.open_tixi(cpacs_path) self.Model = smu.load_surrogate(tixi) cpsf.close_tixi(tixi, cpacs_path) ...
the_stack_v2_python_sparse
ceasiompy/Optimisation/optimisation.py
schneo/CEASIOMpy
train
0
b468362ab150b41326c9f328203652541a2d3b9d
[ "while left >= 0 and right < len(s) and (s[left] == s[right]):\n left -= 1\n right += 1\nreturn right - left - 1", "if not s or len(s) < 1:\n return ''\nleft = right = 0\nfor index in range(len(s)):\n odd_len = self.expand_center(s, index, index)\n even_len = self.expand_center(s, index, index + 1)...
<|body_start_0|> while left >= 0 and right < len(s) and (s[left] == s[right]): left -= 1 right += 1 return right - left - 1 <|end_body_0|> <|body_start_1|> if not s or len(s) < 1: return '' left = right = 0 for index in range(len(s)): ...
String
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class String: def expand_center(self, s: str, left: int, right: int) -> int: """:param s: :param l: :param r: :return:""" <|body_0|> def longest_palindromic_substring(self, s: str) -> str: """Approach: Expand Center Time Complexity: O(N^2) Space Complexity: O(1) :param s: ...
stack_v2_sparse_classes_36k_train_034573
1,441
no_license
[ { "docstring": ":param s: :param l: :param r: :return:", "name": "expand_center", "signature": "def expand_center(self, s: str, left: int, right: int) -> int" }, { "docstring": "Approach: Expand Center Time Complexity: O(N^2) Space Complexity: O(1) :param s: :return:", "name": "longest_palin...
2
stack_v2_sparse_classes_30k_train_018585
Implement the Python class `String` described below. Class description: Implement the String class. Method signatures and docstrings: - def expand_center(self, s: str, left: int, right: int) -> int: :param s: :param l: :param r: :return: - def longest_palindromic_substring(self, s: str) -> str: Approach: Expand Cente...
Implement the Python class `String` described below. Class description: Implement the String class. Method signatures and docstrings: - def expand_center(self, s: str, left: int, right: int) -> int: :param s: :param l: :param r: :return: - def longest_palindromic_substring(self, s: str) -> str: Approach: Expand Cente...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class String: def expand_center(self, s: str, left: int, right: int) -> int: """:param s: :param l: :param r: :return:""" <|body_0|> def longest_palindromic_substring(self, s: str) -> str: """Approach: Expand Center Time Complexity: O(N^2) Space Complexity: O(1) :param s: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class String: def expand_center(self, s: str, left: int, right: int) -> int: """:param s: :param l: :param r: :return:""" while left >= 0 and right < len(s) and (s[left] == s[right]): left -= 1 right += 1 return right - left - 1 def longest_palindromic_substring(...
the_stack_v2_python_sparse
revisited__2021/math_and_string/longest_palindromic_substring.py
Shiv2157k/leet_code
train
1
49424f28451f9046cae9f98a1b8c11a6feeef880
[ "test = 'aabc'\nd = Palindrom(test)\nself.assertEqual(d.cnt['c'], 1)\nself.assertEqual(d.pcnt['c'], 0)\nself.assertEqual(Palindrom(test).calculate(), 'abba')\ntest = 'aabcd'\nself.assertEqual(Palindrom(test).calculate(), 'abcba')\ntest = 'aabbcccdd'\nself.assertEqual(Palindrom(test).calculate(), 'abcdcdcba')\ntest ...
<|body_start_0|> test = 'aabc' d = Palindrom(test) self.assertEqual(d.cnt['c'], 1) self.assertEqual(d.pcnt['c'], 0) self.assertEqual(Palindrom(test).calculate(), 'abba') test = 'aabcd' self.assertEqual(Palindrom(test).calculate(), 'abcba') test = 'aabbcccd...
unitTests
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class unitTests: def test_single_test(self): """Palindrom class testing""" <|body_0|> def time_limit_test(self, nmax): """Timelimit testing""" <|body_1|> <|end_skeleton|> <|body_start_0|> test = 'aabc' d = Palindrom(test) self.assertEqual(...
stack_v2_sparse_classes_36k_train_034574
3,524
permissive
[ { "docstring": "Palindrom class testing", "name": "test_single_test", "signature": "def test_single_test(self)" }, { "docstring": "Timelimit testing", "name": "time_limit_test", "signature": "def time_limit_test(self, nmax)" } ]
2
stack_v2_sparse_classes_30k_train_021159
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_single_test(self): Palindrom class testing - def time_limit_test(self, nmax): Timelimit testing
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_single_test(self): Palindrom class testing - def time_limit_test(self, nmax): Timelimit testing <|skeleton|> class unitTests: def test_single_test(self): ...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class unitTests: def test_single_test(self): """Palindrom class testing""" <|body_0|> def time_limit_test(self, nmax): """Timelimit testing""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class unitTests: def test_single_test(self): """Palindrom class testing""" test = 'aabc' d = Palindrom(test) self.assertEqual(d.cnt['c'], 1) self.assertEqual(d.pcnt['c'], 0) self.assertEqual(Palindrom(test).calculate(), 'abba') test = 'aabcd' self.asse...
the_stack_v2_python_sparse
codeforces/600C_palindrom.py
snsokolov/contests
train
1
458a9c1bcfbad838e32131bc43236e48ecb6fd87
[ "super(ProcessResourceType, self).setUp()\nfor nodetype in NODE_TYPES:\n nodetype.objects.all().delete()", "ggc.return_value = {'client': self.EmptyClientObject(), 'region': 'Siberia'}\nprocess_resource_type(Image)\nself.assertEqual(PolyResource.objects.count(), 0)", "NODES = [(Image, 'a'), (Image, 'ab'), (I...
<|body_start_0|> super(ProcessResourceType, self).setUp() for nodetype in NODE_TYPES: nodetype.objects.all().delete() <|end_body_0|> <|body_start_1|> ggc.return_value = {'client': self.EmptyClientObject(), 'region': 'Siberia'} process_resource_type(Image) self.assert...
Test utilities.process_resource_type.
ProcessResourceType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessResourceType: """Test utilities.process_resource_type.""" def setUp(self): """Run before every test.""" <|body_0|> def test_empty_rg_empty_cloud(self, ggc): """Nothing in the resource graph, nothing in the cloud. Nothing should be done.""" <|body_1...
stack_v2_sparse_classes_36k_train_034575
22,971
permissive
[ { "docstring": "Run before every test.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Nothing in the resource graph, nothing in the cloud. Nothing should be done.", "name": "test_empty_rg_empty_cloud", "signature": "def test_empty_rg_empty_cloud(self, ggc)" }, {...
4
stack_v2_sparse_classes_30k_train_017598
Implement the Python class `ProcessResourceType` described below. Class description: Test utilities.process_resource_type. Method signatures and docstrings: - def setUp(self): Run before every test. - def test_empty_rg_empty_cloud(self, ggc): Nothing in the resource graph, nothing in the cloud. Nothing should be done...
Implement the Python class `ProcessResourceType` described below. Class description: Test utilities.process_resource_type. Method signatures and docstrings: - def setUp(self): Run before every test. - def test_empty_rg_empty_cloud(self, ggc): Nothing in the resource graph, nothing in the cloud. Nothing should be done...
73d334a9f0df7c044c06989977a9a22dd2ff9b7a
<|skeleton|> class ProcessResourceType: """Test utilities.process_resource_type.""" def setUp(self): """Run before every test.""" <|body_0|> def test_empty_rg_empty_cloud(self, ggc): """Nothing in the resource graph, nothing in the cloud. Nothing should be done.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessResourceType: """Test utilities.process_resource_type.""" def setUp(self): """Run before every test.""" super(ProcessResourceType, self).setUp() for nodetype in NODE_TYPES: nodetype.objects.all().delete() def test_empty_rg_empty_cloud(self, ggc): ""...
the_stack_v2_python_sparse
goldstone/core/tests.py
bhuvan-rk/goldstone-server
train
0
c094085a00556364cd1fd0c5880fedba70cbff66
[ "dp_row, dp_col, dp_len = (len(s1), len(s2), len(s3))\nif dp_row + dp_col != dp_len:\n return False\ndp = [True for _ in xrange(dp_col + 1)]\nfor j in xrange(1, dp_col + 1):\n dp[j] = dp[j - 1] and s2[j - 1] == s3[j - 1]\nfor i in xrange(1, dp_row + 1):\n dp[0] = dp[0] and s1[i - 1] == s3[i - 1]\n for j...
<|body_start_0|> dp_row, dp_col, dp_len = (len(s1), len(s2), len(s3)) if dp_row + dp_col != dp_len: return False dp = [True for _ in xrange(dp_col + 1)] for j in xrange(1, dp_col + 1): dp[j] = dp[j - 1] and s2[j - 1] == s3[j - 1] for i in xrange(1, dp_row ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isInterleave(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool DP, O(n) space beats 80.27%""" <|body_0|> def isInterleave1(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool DFS beats 97.99%""" ...
stack_v2_sparse_classes_36k_train_034576
2,418
no_license
[ { "docstring": ":type s1: str :type s2: str :type s3: str :rtype: bool DP, O(n) space beats 80.27%", "name": "isInterleave", "signature": "def isInterleave(self, s1, s2, s3)" }, { "docstring": ":type s1: str :type s2: str :type s3: str :rtype: bool DFS beats 97.99%", "name": "isInterleave1",...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :rtype: bool DP, O(n) space beats 80.27% - def isInterleave1(self, s1, s2, s3): :type s1: str :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :rtype: bool DP, O(n) space beats 80.27% - def isInterleave1(self, s1, s2, s3): :type s1: str :type ...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def isInterleave(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool DP, O(n) space beats 80.27%""" <|body_0|> def isInterleave1(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool DFS beats 97.99%""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isInterleave(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool DP, O(n) space beats 80.27%""" dp_row, dp_col, dp_len = (len(s1), len(s2), len(s3)) if dp_row + dp_col != dp_len: return False dp = [True for _ in xrange(dp_col +...
the_stack_v2_python_sparse
LeetCode/097_interleaving_string.py
yao23/Machine_Learning_Playground
train
12
1819e7b35e58e1b194098dc0cf6a56c9b7ef8165
[ "super(CnnMaxpoolLayer, self).__init__()\nif not isinstance(filter_size, (tuple, list)):\n filter_size = [filter_size]\nif not isinstance(output_num, (tuple, list)):\n output_num = [output_num] * len(filter_size)\nassert len(filter_size) == len(output_num), 'Filter size len is not equal output_num len'\nprint...
<|body_start_0|> super(CnnMaxpoolLayer, self).__init__() if not isinstance(filter_size, (tuple, list)): filter_size = [filter_size] if not isinstance(output_num, (tuple, list)): output_num = [output_num] * len(filter_size) assert len(filter_size) == len(output_num...
CnnMaxpoolLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CnnMaxpoolLayer: def __init__(self, input_num, output_num, filter_size, stride=1, padding=0, activation='relu', initial_method=None, **kwargs): """cnn+maxpooling的结构做encoder :params input_num int 输入的维度 :params output_num int|list 每个卷积核输出的维度 :params filter_size list 卷积核的大小 :params init_met...
stack_v2_sparse_classes_36k_train_034577
2,594
permissive
[ { "docstring": "cnn+maxpooling的结构做encoder :params input_num int 输入的维度 :params output_num int|list 每个卷积核输出的维度 :params filter_size list 卷积核的大小 :params init_method str 网络参数初始化的方法,默认为xavier_uniform", "name": "__init__", "signature": "def __init__(self, input_num, output_num, filter_size, stride=1, padding=0...
2
stack_v2_sparse_classes_30k_train_013883
Implement the Python class `CnnMaxpoolLayer` described below. Class description: Implement the CnnMaxpoolLayer class. Method signatures and docstrings: - def __init__(self, input_num, output_num, filter_size, stride=1, padding=0, activation='relu', initial_method=None, **kwargs): cnn+maxpooling的结构做encoder :params inp...
Implement the Python class `CnnMaxpoolLayer` described below. Class description: Implement the CnnMaxpoolLayer class. Method signatures and docstrings: - def __init__(self, input_num, output_num, filter_size, stride=1, padding=0, activation='relu', initial_method=None, **kwargs): cnn+maxpooling的结构做encoder :params inp...
5eda8e7c60116735f595f4b21b24547708b36cf5
<|skeleton|> class CnnMaxpoolLayer: def __init__(self, input_num, output_num, filter_size, stride=1, padding=0, activation='relu', initial_method=None, **kwargs): """cnn+maxpooling的结构做encoder :params input_num int 输入的维度 :params output_num int|list 每个卷积核输出的维度 :params filter_size list 卷积核的大小 :params init_met...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CnnMaxpoolLayer: def __init__(self, input_num, output_num, filter_size, stride=1, padding=0, activation='relu', initial_method=None, **kwargs): """cnn+maxpooling的结构做encoder :params input_num int 输入的维度 :params output_num int|list 每个卷积核输出的维度 :params filter_size list 卷积核的大小 :params init_method str 网络参数初始...
the_stack_v2_python_sparse
UNF/modules/encoder/cnn_maxpool.py
Dreamliking/UNF
train
1
735bae795469da88214a623f5221ad6616d7a6e0
[ "try:\n AppUser.objects.get(username__iexact=self.cleaned_data['username'])\nexcept AppUser.DoesNotExist:\n return self.cleaned_data['username']\nraise forms.ValidationError(_('The username already exists. Please try another one.'))", "form_obj = self.cleaned_data\nif 'password1' in form_obj and 'password2'...
<|body_start_0|> try: AppUser.objects.get(username__iexact=self.cleaned_data['username']) except AppUser.DoesNotExist: return self.cleaned_data['username'] raise forms.ValidationError(_('The username already exists. Please try another one.')) <|end_body_0|> <|body_start_...
Registration form.
RegistrationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationForm: """Registration form.""" def clean_username(self): """Method to clean username.""" <|body_0|> def clean(self): """Method to compare passwords.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: AppUser.objects.get...
stack_v2_sparse_classes_36k_train_034578
9,900
no_license
[ { "docstring": "Method to clean username.", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Method to compare passwords.", "name": "clean", "signature": "def clean(self)" } ]
2
null
Implement the Python class `RegistrationForm` described below. Class description: Registration form. Method signatures and docstrings: - def clean_username(self): Method to clean username. - def clean(self): Method to compare passwords.
Implement the Python class `RegistrationForm` described below. Class description: Registration form. Method signatures and docstrings: - def clean_username(self): Method to clean username. - def clean(self): Method to compare passwords. <|skeleton|> class RegistrationForm: """Registration form.""" def clean...
cb392be0402543acf074425fcaf8edf054269012
<|skeleton|> class RegistrationForm: """Registration form.""" def clean_username(self): """Method to clean username.""" <|body_0|> def clean(self): """Method to compare passwords.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegistrationForm: """Registration form.""" def clean_username(self): """Method to clean username.""" try: AppUser.objects.get(username__iexact=self.cleaned_data['username']) except AppUser.DoesNotExist: return self.cleaned_data['username'] raise for...
the_stack_v2_python_sparse
cpovc_auth/forms.py
uonafya/cpims-2.3beta
train
4
76c6f16aa84d897cb725dfded456fc9a9f473b0c
[ "mid = 0\nwhile low < high:\n mid = low + int((high - low) / 2)\n if nums[mid] < target:\n low = mid + 1\n else:\n high = mid\nreturn low", "res = []\nfor i in range(N):\n if not res or treasures[i] > res[-1]:\n res.append(treasures[i])\n else:\n idx = self.binary_search...
<|body_start_0|> mid = 0 while low < high: mid = low + int((high - low) / 2) if nums[mid] < target: low = mid + 1 else: high = mid return low <|end_body_0|> <|body_start_1|> res = [] for i in range(N): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binary_search(self, nums, low, high, target): """根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target""" <|body_0|> def LIS(self, N, treasures): """最长上升子序列 @param: N @param: treasures""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_034579
2,565
no_license
[ { "docstring": "根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target", "name": "binary_search", "signature": "def binary_search(self, nums, low, high, target)" }, { "docstring": "最长上升子序列 @param: N @param: treasures", "name": "LIS", "signature": "def LIS(self, N, treasures)...
2
stack_v2_sparse_classes_30k_train_014275
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, low, high, target): 根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target - def LIS(self, N, treasures): 最长上升子序列 @param: N @param: tre...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, low, high, target): 根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target - def LIS(self, N, treasures): 最长上升子序列 @param: N @param: tre...
32941ee052d0985a9569441d314378700ff4d225
<|skeleton|> class Solution: def binary_search(self, nums, low, high, target): """根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target""" <|body_0|> def LIS(self, N, treasures): """最长上升子序列 @param: N @param: treasures""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def binary_search(self, nums, low, high, target): """根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target""" mid = 0 while low < high: mid = low + int((high - low) / 2) if nums[mid] < target: low = mid + 1 els...
the_stack_v2_python_sparse
cecilia-python/company-title/xiaohongshu/ResellingLoot.py
Cecilia520/algorithmic-learning-leetcode
train
7
c206ec838b481aad4fc7e94ee84a55271c9af01c
[ "if dividend == 0:\n return 0\nif divisor == 1:\n return dividend\nif divisor == -1:\n if dividend > INT_MIN:\n return -dividend\n else:\n return INT_MAX\na = dividend\nb = divisor\nsign = 1\nif a > 0 and b < 0 or (a < 0 and b > 0):\n sign = -1\na = abs(a)\nb = abs(b)\nres = self.div(a,...
<|body_start_0|> if dividend == 0: return 0 if divisor == 1: return dividend if divisor == -1: if dividend > INT_MIN: return -dividend else: return INT_MAX a = dividend b = divisor sign = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def divide(self, dividend, divisor): """Args: dividend: int divisor: int Return: int""" <|body_0|> def div(self, a, b): """Args: a: int b: int Return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if dividend == 0: return...
stack_v2_sparse_classes_36k_train_034580
1,113
no_license
[ { "docstring": "Args: dividend: int divisor: int Return: int", "name": "divide", "signature": "def divide(self, dividend, divisor)" }, { "docstring": "Args: a: int b: int Return: int", "name": "div", "signature": "def div(self, a, b)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def divide(self, dividend, divisor): Args: dividend: int divisor: int Return: int - def div(self, a, b): Args: a: int b: int Return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def divide(self, dividend, divisor): Args: dividend: int divisor: int Return: int - def div(self, a, b): Args: a: int b: int Return: int <|skeleton|> class Solution: def di...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def divide(self, dividend, divisor): """Args: dividend: int divisor: int Return: int""" <|body_0|> def div(self, a, b): """Args: a: int b: int Return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def divide(self, dividend, divisor): """Args: dividend: int divisor: int Return: int""" if dividend == 0: return 0 if divisor == 1: return dividend if divisor == -1: if dividend > INT_MIN: return -dividend ...
the_stack_v2_python_sparse
code/29. 两数相除.py
AiZhanghan/Leetcode
train
0
680703241b85a329c551e73b3e5e6eafb45133dc
[ "pipeline_cfg = cfg.test_dataloader.dataset.pipeline\nif 'meta_keys' in pipeline_cfg[-1]:\n pipeline_cfg[-1]['meta_keys'] = tuple((meta_key for meta_key in pipeline_cfg[-1]['meta_keys'] if meta_key != 'img_id'))\nload_img_idx = self._get_transform_idx(pipeline_cfg, 'LoadImageFromFile')\nif load_img_idx == -1:\n ...
<|body_start_0|> pipeline_cfg = cfg.test_dataloader.dataset.pipeline if 'meta_keys' in pipeline_cfg[-1]: pipeline_cfg[-1]['meta_keys'] = tuple((meta_key for meta_key in pipeline_cfg[-1]['meta_keys'] if meta_key != 'img_id')) load_img_idx = self._get_transform_idx(pipeline_cfg, 'LoadI...
RefImageCaptionInferencer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RefImageCaptionInferencer: def _init_pipeline(self, cfg: ConfigType) -> Compose: """Initialize the test pipeline.""" <|body_0|> def _get_chunk_data(self, inputs: Iterable, chunk_size: int): """Get batch data from inputs. Args: inputs (Iterable): An iterable dataset. ...
stack_v2_sparse_classes_36k_train_034581
11,521
permissive
[ { "docstring": "Initialize the test pipeline.", "name": "_init_pipeline", "signature": "def _init_pipeline(self, cfg: ConfigType) -> Compose" }, { "docstring": "Get batch data from inputs. Args: inputs (Iterable): An iterable dataset. chunk_size (int): Equivalent to batch size. Yields: list: bat...
3
stack_v2_sparse_classes_30k_train_004150
Implement the Python class `RefImageCaptionInferencer` described below. Class description: Implement the RefImageCaptionInferencer class. Method signatures and docstrings: - def _init_pipeline(self, cfg: ConfigType) -> Compose: Initialize the test pipeline. - def _get_chunk_data(self, inputs: Iterable, chunk_size: in...
Implement the Python class `RefImageCaptionInferencer` described below. Class description: Implement the RefImageCaptionInferencer class. Method signatures and docstrings: - def _init_pipeline(self, cfg: ConfigType) -> Compose: Initialize the test pipeline. - def _get_chunk_data(self, inputs: Iterable, chunk_size: in...
f78af7785ada87f1ced75a2313746e4ba3149760
<|skeleton|> class RefImageCaptionInferencer: def _init_pipeline(self, cfg: ConfigType) -> Compose: """Initialize the test pipeline.""" <|body_0|> def _get_chunk_data(self, inputs: Iterable, chunk_size: int): """Get batch data from inputs. Args: inputs (Iterable): An iterable dataset. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RefImageCaptionInferencer: def _init_pipeline(self, cfg: ConfigType) -> Compose: """Initialize the test pipeline.""" pipeline_cfg = cfg.test_dataloader.dataset.pipeline if 'meta_keys' in pipeline_cfg[-1]: pipeline_cfg[-1]['meta_keys'] = tuple((meta_key for meta_key in pipel...
the_stack_v2_python_sparse
projects/XDecoder/xdecoder/inference/image_caption.py
wencheng256/mmdetection
train
0
0800c4305b83ed8a597e5c257d6492c5ad238238
[ "if not space.extruded:\n raise ValueError('The Theta Limiter can only be used on an extruded mesh')\nsub_elements = space.ufl_element().sub_elements()\nif sub_elements[0].family() not in ['Discontinuous Lagrange', 'DQ'] or sub_elements[1].family() != 'Lagrange' or space.ufl_element().degree() != (1, 2):\n ra...
<|body_start_0|> if not space.extruded: raise ValueError('The Theta Limiter can only be used on an extruded mesh') sub_elements = space.ufl_element().sub_elements() if sub_elements[0].family() not in ['Discontinuous Lagrange', 'DQ'] or sub_elements[1].family() != 'Lagrange' or space....
A vertex-based limiter for the degree 1 temperature space. A vertex based limiter for fields in the DG1xCG2 space, i.e. temperature variables in the next-to-lowest order set of spaces. This acts like the vertex-based limiter implemented in Firedrake, but in addition corrects the central nodes to prevent new maxima or m...
ThetaLimiter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThetaLimiter: """A vertex-based limiter for the degree 1 temperature space. A vertex based limiter for fields in the DG1xCG2 space, i.e. temperature variables in the next-to-lowest order set of spaces. This acts like the vertex-based limiter implemented in Firedrake, but in addition corrects the ...
stack_v2_sparse_classes_36k_train_034582
7,242
permissive
[ { "docstring": "Args: space (:class:`FunctionSpace`): the space in which the transported variables lies. It should be a form of the DG1xCG2 space. Raises: ValueError: If the mesh is not extruded. ValueError: If the space is not appropriate for the limiter.", "name": "__init__", "signature": "def __init_...
2
stack_v2_sparse_classes_30k_test_000582
Implement the Python class `ThetaLimiter` described below. Class description: A vertex-based limiter for the degree 1 temperature space. A vertex based limiter for fields in the DG1xCG2 space, i.e. temperature variables in the next-to-lowest order set of spaces. This acts like the vertex-based limiter implemented in F...
Implement the Python class `ThetaLimiter` described below. Class description: A vertex-based limiter for the degree 1 temperature space. A vertex based limiter for fields in the DG1xCG2 space, i.e. temperature variables in the next-to-lowest order set of spaces. This acts like the vertex-based limiter implemented in F...
ab93672a84d4a71019abad4249529403e4b0c8d7
<|skeleton|> class ThetaLimiter: """A vertex-based limiter for the degree 1 temperature space. A vertex based limiter for fields in the DG1xCG2 space, i.e. temperature variables in the next-to-lowest order set of spaces. This acts like the vertex-based limiter implemented in Firedrake, but in addition corrects the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThetaLimiter: """A vertex-based limiter for the degree 1 temperature space. A vertex based limiter for fields in the DG1xCG2 space, i.e. temperature variables in the next-to-lowest order set of spaces. This acts like the vertex-based limiter implemented in Firedrake, but in addition corrects the central nodes...
the_stack_v2_python_sparse
gusto/limiters.py
firedrakeproject/gusto
train
10
ab7fb73c88324b13417d63221146e357fb04be9f
[ "if not prices:\n return 0\n\ndef foo(i):\n if i == 0:\n return [-prices[0], 0, 0]\n sub = foo(i - 1)\n return [max(sub[0], sub[2] - prices[i]), sub[0] + prices[i], max(sub[1], sub[2])]\nreturn max(foo(len(prices) - 1))", "if not prices:\n return 0\nmoney = [-prices[0], 0, 0]\nfor p in price...
<|body_start_0|> if not prices: return 0 def foo(i): if i == 0: return [-prices[0], 0, 0] sub = foo(i - 1) return [max(sub[0], sub[2] - prices[i]), sub[0] + prices[i], max(sub[1], sub[2])] return max(foo(len(prices) - 1)) <|end_bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """12/27/2019 02:51""" <|body_0|> def maxProfit(self, prices: List[int]) -> int: """12/27/2019 02:53""" <|body_1|> def maxProfit(self, prices: List[int]) -> int: """Oct 20, 2021 22:24""" ...
stack_v2_sparse_classes_36k_train_034583
3,236
no_license
[ { "docstring": "12/27/2019 02:51", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "12/27/2019 02:53", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "Oct 20, 2021 22:24", ...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 12/27/2019 02:51 - def maxProfit(self, prices: List[int]) -> int: 12/27/2019 02:53 - def maxProfit(self, prices: List[int]) -> int:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 12/27/2019 02:51 - def maxProfit(self, prices: List[int]) -> int: 12/27/2019 02:53 - def maxProfit(self, prices: List[int]) -> int:...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """12/27/2019 02:51""" <|body_0|> def maxProfit(self, prices: List[int]) -> int: """12/27/2019 02:53""" <|body_1|> def maxProfit(self, prices: List[int]) -> int: """Oct 20, 2021 22:24""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """12/27/2019 02:51""" if not prices: return 0 def foo(i): if i == 0: return [-prices[0], 0, 0] sub = foo(i - 1) return [max(sub[0], sub[2] - prices[i]), sub[0] + p...
the_stack_v2_python_sparse
leetcode/solved/309_Best_Time_to_Buy_and_Sell_Stock_with_Cooldown/solution.py
sungminoh/algorithms
train
0
ae8884b8e062cbaa08adf683663309ab8bc90c97
[ "p = psutil.Process(pid=number)\npname = p.name()\nctime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(p.create_time()))\npcpu = p.cpu_percent()\nmem = p.memory_info().rss / unit['m']\npmen = p.memory_percent()\nwdata = p.io_counters().write_bytes / unit['k']\nreturn [number, pname, ctime, pcpu, pmen, mem, wd...
<|body_start_0|> p = psutil.Process(pid=number) pname = p.name() ctime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(p.create_time())) pcpu = p.cpu_percent() mem = p.memory_info().rss / unit['m'] pmen = p.memory_percent() wdata = p.io_counters().write_bytes ...
MyServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyServer: def getMessage(number): """:param number: 进程号""" <|body_0|> def handle(self): """:return:要想实现并发效果必须重写父类中的handler方法,在此方法中实现服务端的逻辑代码(不用再写连接准备,包括bind()、listen()、accept()方法)""" <|body_1|> <|end_skeleton|> <|body_start_0|> p = psutil.Process(pi...
stack_v2_sparse_classes_36k_train_034584
3,784
no_license
[ { "docstring": ":param number: 进程号", "name": "getMessage", "signature": "def getMessage(number)" }, { "docstring": ":return:要想实现并发效果必须重写父类中的handler方法,在此方法中实现服务端的逻辑代码(不用再写连接准备,包括bind()、listen()、accept()方法)", "name": "handle", "signature": "def handle(self)" } ]
2
stack_v2_sparse_classes_30k_train_006104
Implement the Python class `MyServer` described below. Class description: Implement the MyServer class. Method signatures and docstrings: - def getMessage(number): :param number: 进程号 - def handle(self): :return:要想实现并发效果必须重写父类中的handler方法,在此方法中实现服务端的逻辑代码(不用再写连接准备,包括bind()、listen()、accept()方法)
Implement the Python class `MyServer` described below. Class description: Implement the MyServer class. Method signatures and docstrings: - def getMessage(number): :param number: 进程号 - def handle(self): :return:要想实现并发效果必须重写父类中的handler方法,在此方法中实现服务端的逻辑代码(不用再写连接准备,包括bind()、listen()、accept()方法) <|skeleton|> class MyServ...
8f6c6f806f3f8a8fe4ab8937d5c5a00986522c40
<|skeleton|> class MyServer: def getMessage(number): """:param number: 进程号""" <|body_0|> def handle(self): """:return:要想实现并发效果必须重写父类中的handler方法,在此方法中实现服务端的逻辑代码(不用再写连接准备,包括bind()、listen()、accept()方法)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyServer: def getMessage(number): """:param number: 进程号""" p = psutil.Process(pid=number) pname = p.name() ctime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(p.create_time())) pcpu = p.cpu_percent() mem = p.memory_info().rss / unit['m'] pmen = p.m...
the_stack_v2_python_sparse
QiCrawlEgine/Handler/miniMonitor.py
tiankangbo/dashboard
train
0
b60abee824efde5d51e958cc28248f23a2410e01
[ "username = self.cleaned_data.get('username')\nuser_obj = models.UserInfo.objects.filter(username=username)\nif not user_obj:\n return username\nelse:\n raise ValidationError('该用户已存在')", "password = self.cleaned_data.get('password')\nrepwd = self.cleaned_data.get('re_pwd')\nif password == repwd:\n return...
<|body_start_0|> username = self.cleaned_data.get('username') user_obj = models.UserInfo.objects.filter(username=username) if not user_obj: return username else: raise ValidationError('该用户已存在') <|end_body_0|> <|body_start_1|> password = self.cleaned_data....
注册form表单校验
RegisterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterForm: """注册form表单校验""" def clean_username(self): """校验用户是否存在 :return:""" <|body_0|> def clean(self): """校验两次输入的密码是否一致 :return:""" <|body_1|> def clean_email(self): """校验注册邮箱是否已经注册 :return:""" <|body_2|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_034585
2,622
no_license
[ { "docstring": "校验用户是否存在 :return:", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "校验两次输入的密码是否一致 :return:", "name": "clean", "signature": "def clean(self)" }, { "docstring": "校验注册邮箱是否已经注册 :return:", "name": "clean_email", "signature":...
3
stack_v2_sparse_classes_30k_train_000162
Implement the Python class `RegisterForm` described below. Class description: 注册form表单校验 Method signatures and docstrings: - def clean_username(self): 校验用户是否存在 :return: - def clean(self): 校验两次输入的密码是否一致 :return: - def clean_email(self): 校验注册邮箱是否已经注册 :return:
Implement the Python class `RegisterForm` described below. Class description: 注册form表单校验 Method signatures and docstrings: - def clean_username(self): 校验用户是否存在 :return: - def clean(self): 校验两次输入的密码是否一致 :return: - def clean_email(self): 校验注册邮箱是否已经注册 :return: <|skeleton|> class RegisterForm: """注册form表单校验""" ...
7768b74164ad6e3b9337b1f5aed043ec209fcddb
<|skeleton|> class RegisterForm: """注册form表单校验""" def clean_username(self): """校验用户是否存在 :return:""" <|body_0|> def clean(self): """校验两次输入的密码是否一致 :return:""" <|body_1|> def clean_email(self): """校验注册邮箱是否已经注册 :return:""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterForm: """注册form表单校验""" def clean_username(self): """校验用户是否存在 :return:""" username = self.cleaned_data.get('username') user_obj = models.UserInfo.objects.filter(username=username) if not user_obj: return username else: raise Validatio...
the_stack_v2_python_sparse
files/ce2dcf55-e457-4610-a495-c725f3aa7ace/图书馆系统/cnblog/Blog/blog_forms.py
cs4224485/Flaskd-
train
0
3064504dc9bc70e64d4a51d972c78837678d0c61
[ "features = dict()\nneighbor_config = configs.GraphNeighborConfig()\nsample_features = utils.strip_neighbor_features(features, neighbor_config)\ndummy_tensor = tf.constant(1.0)\nsample_features, dummy_tensor = self.evaluate([sample_features, dummy_tensor])\nself.assertEmpty(sample_features)", "features = {'F0': t...
<|body_start_0|> features = dict() neighbor_config = configs.GraphNeighborConfig() sample_features = utils.strip_neighbor_features(features, neighbor_config) dummy_tensor = tf.constant(1.0) sample_features, dummy_tensor = self.evaluate([sample_features, dummy_tensor]) sel...
Tests removal of neighbor features from a feature dictionary.
StripNeighborFeaturesTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StripNeighborFeaturesTest: """Tests removal of neighbor features from a feature dictionary.""" def testEmptyFeatures(self): """Tests strip_neighbor_features with empty input.""" <|body_0|> def testNoNeighborFeatures(self): """Tests strip_neighbor_features when th...
stack_v2_sparse_classes_36k_train_034586
36,436
permissive
[ { "docstring": "Tests strip_neighbor_features with empty input.", "name": "testEmptyFeatures", "signature": "def testEmptyFeatures(self)" }, { "docstring": "Tests strip_neighbor_features when there are no neighbor features.", "name": "testNoNeighborFeatures", "signature": "def testNoNeig...
4
stack_v2_sparse_classes_30k_train_021449
Implement the Python class `StripNeighborFeaturesTest` described below. Class description: Tests removal of neighbor features from a feature dictionary. Method signatures and docstrings: - def testEmptyFeatures(self): Tests strip_neighbor_features with empty input. - def testNoNeighborFeatures(self): Tests strip_neig...
Implement the Python class `StripNeighborFeaturesTest` described below. Class description: Tests removal of neighbor features from a feature dictionary. Method signatures and docstrings: - def testEmptyFeatures(self): Tests strip_neighbor_features with empty input. - def testNoNeighborFeatures(self): Tests strip_neig...
995064233479e806a3187ede8a395319520db75e
<|skeleton|> class StripNeighborFeaturesTest: """Tests removal of neighbor features from a feature dictionary.""" def testEmptyFeatures(self): """Tests strip_neighbor_features with empty input.""" <|body_0|> def testNoNeighborFeatures(self): """Tests strip_neighbor_features when th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StripNeighborFeaturesTest: """Tests removal of neighbor features from a feature dictionary.""" def testEmptyFeatures(self): """Tests strip_neighbor_features with empty input.""" features = dict() neighbor_config = configs.GraphNeighborConfig() sample_features = utils.strip...
the_stack_v2_python_sparse
neural_structured_learning/lib/utils_test.py
RubensZimbres/neural-structured-learning
train
1
143c7dfca68b77df1dd05ea162b0bdc93aa26a5a
[ "if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\ndp0 = self.rob_helper(nums[0:-1])\ndp1 = self.rob_helper(nums[1:])\ndp2 = self.rob_helper(nums[1:-1])\nreturn max(dp0, dp1, dp2)", "if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\ndp = [0] * len(nums)\ndp[0] = nums[0]\ndp[1] ...
<|body_start_0|> if not nums: return 0 if len(nums) == 1: return nums[0] dp0 = self.rob_helper(nums[0:-1]) dp1 = self.rob_helper(nums[1:]) dp2 = self.rob_helper(nums[1:-1]) return max(dp0, dp1, dp2) <|end_body_0|> <|body_start_1|> if not n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob_helper(self, nums): """maximum sum without the circle formation :param nums: a list of positive integers :return: the maximum sum of a sub-sequence that does not contain 2 conse...
stack_v2_sparse_classes_36k_train_034587
2,455
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": "maximum sum without the circle formation :param nums: a list of positive integers :return: the maximum sum of a sub-sequence that does not contain 2 consecutive elements", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob_helper(self, nums): maximum sum without the circle formation :param nums: a list of positive integers :return: th...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob_helper(self, nums): maximum sum without the circle formation :param nums: a list of positive integers :return: th...
a5b02044ef39154b6a8d32eb57682f447e1632ba
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob_helper(self, nums): """maximum sum without the circle formation :param nums: a list of positive integers :return: the maximum sum of a sub-sequence that does not contain 2 conse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 if len(nums) == 1: return nums[0] dp0 = self.rob_helper(nums[0:-1]) dp1 = self.rob_helper(nums[1:]) dp2 = self.rob_helper(nums[1:-1]) ret...
the_stack_v2_python_sparse
algo/dp/house_robber_II.py
xys234/coding-problems
train
0
5e9bc7871ecf7efbd709d7839bb9b5a7246137c9
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsPhone81CustomConfiguration()", "from .device_configuration import DeviceConfiguration\nfrom .oma_setting import OmaSetting\nfrom .device_configuration import DeviceConfiguration\nfrom .oma_setting import OmaSetting\nfields: Dict...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WindowsPhone81CustomConfiguration() <|end_body_0|> <|body_start_1|> from .device_configuration import DeviceConfiguration from .oma_setting import OmaSetting from .device_configu...
This topic provides descriptions of the declared methods, properties and relationships exposed by the windowsPhone81CustomConfiguration resource.
WindowsPhone81CustomConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsPhone81CustomConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the windowsPhone81CustomConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsPhone81CustomConfigur...
stack_v2_sparse_classes_36k_train_034588
2,607
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: WindowsPhone81CustomConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from...
3
null
Implement the Python class `WindowsPhone81CustomConfiguration` described below. Class description: This topic provides descriptions of the declared methods, properties and relationships exposed by the windowsPhone81CustomConfiguration resource. Method signatures and docstrings: - def create_from_discriminator_value(p...
Implement the Python class `WindowsPhone81CustomConfiguration` described below. Class description: This topic provides descriptions of the declared methods, properties and relationships exposed by the windowsPhone81CustomConfiguration resource. Method signatures and docstrings: - def create_from_discriminator_value(p...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WindowsPhone81CustomConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the windowsPhone81CustomConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsPhone81CustomConfigur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowsPhone81CustomConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the windowsPhone81CustomConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsPhone81CustomConfiguration: ...
the_stack_v2_python_sparse
msgraph/generated/models/windows_phone81_custom_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
b115a1e596447ad5429d1c24cb51e57a030417d0
[ "super().__init__()\nself._google_config = google_config\nself._attr_entity_category = EntityCategory.DIAGNOSTIC\nself._attr_unique_id = f'{project_id}_sync'\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, project_id)}, name='Google Assistant')", "assert self._context\nagent_user_id = self._google_conf...
<|body_start_0|> super().__init__() self._google_config = google_config self._attr_entity_category = EntityCategory.DIAGNOSTIC self._attr_unique_id = f'{project_id}_sync' self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, project_id)}, name='Google Assistant') <|end_body_0...
Representation of a synchronization button.
SyncButton
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncButton: """Representation of a synchronization button.""" def __init__(self, project_id: str, google_config: GoogleConfig) -> None: """Initialize button.""" <|body_0|> async def async_press(self) -> None: """Press the button.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_034589
2,165
permissive
[ { "docstring": "Initialize button.", "name": "__init__", "signature": "def __init__(self, project_id: str, google_config: GoogleConfig) -> None" }, { "docstring": "Press the button.", "name": "async_press", "signature": "async def async_press(self) -> None" } ]
2
null
Implement the Python class `SyncButton` described below. Class description: Representation of a synchronization button. Method signatures and docstrings: - def __init__(self, project_id: str, google_config: GoogleConfig) -> None: Initialize button. - async def async_press(self) -> None: Press the button.
Implement the Python class `SyncButton` described below. Class description: Representation of a synchronization button. Method signatures and docstrings: - def __init__(self, project_id: str, google_config: GoogleConfig) -> None: Initialize button. - async def async_press(self) -> None: Press the button. <|skeleton|...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SyncButton: """Representation of a synchronization button.""" def __init__(self, project_id: str, google_config: GoogleConfig) -> None: """Initialize button.""" <|body_0|> async def async_press(self) -> None: """Press the button.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyncButton: """Representation of a synchronization button.""" def __init__(self, project_id: str, google_config: GoogleConfig) -> None: """Initialize button.""" super().__init__() self._google_config = google_config self._attr_entity_category = EntityCategory.DIAGNOSTIC ...
the_stack_v2_python_sparse
homeassistant/components/google_assistant/button.py
home-assistant/core
train
35,501
6fb7b458440d3ba8dc05dfdda7a028499e11a1f8
[ "xdata = []\nydata = []\nfor i in range(0, len(ls_dataset)):\n xdata.append(ls_dataset[i][0])\n ydata.append(ls_dataset[i][1])\nmatplotlib.rcParams.update({'font.size': 12})\nfig, ax = plt.subplots()\nax.xaxis.set_major_locator(MaxNLocator(integer=True))\nax.plot(xdata, ydata, '.')\nplt.xlabel(x_label, fontsi...
<|body_start_0|> xdata = [] ydata = [] for i in range(0, len(ls_dataset)): xdata.append(ls_dataset[i][0]) ydata.append(ls_dataset[i][1]) matplotlib.rcParams.update({'font.size': 12}) fig, ax = plt.subplots() ax.xaxis.set_major_locator(MaxNLocator(i...
PlotUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotUtil: def PlotData(ls_dataset, x_label, y_label, font_size=14, is_show=True, is_savefig=False, datafile=''): """Function: plot data on fig @arguments: (in) ls_dataset: return line list object""" <|body_0|> def Plotfit(xdata, ydata, x, y, x_label, y_label, plt_title='', f...
stack_v2_sparse_classes_36k_train_034590
9,796
no_license
[ { "docstring": "Function: plot data on fig @arguments: (in) ls_dataset: return line list object", "name": "PlotData", "signature": "def PlotData(ls_dataset, x_label, y_label, font_size=14, is_show=True, is_savefig=False, datafile='')" }, { "docstring": "Function: plot data and fit curve on fig @...
3
stack_v2_sparse_classes_30k_train_018233
Implement the Python class `PlotUtil` described below. Class description: Implement the PlotUtil class. Method signatures and docstrings: - def PlotData(ls_dataset, x_label, y_label, font_size=14, is_show=True, is_savefig=False, datafile=''): Function: plot data on fig @arguments: (in) ls_dataset: return line list ob...
Implement the Python class `PlotUtil` described below. Class description: Implement the PlotUtil class. Method signatures and docstrings: - def PlotData(ls_dataset, x_label, y_label, font_size=14, is_show=True, is_savefig=False, datafile=''): Function: plot data on fig @arguments: (in) ls_dataset: return line list ob...
03ff57e6fe0114ffd2dd953e79a73a893a6bc0ad
<|skeleton|> class PlotUtil: def PlotData(ls_dataset, x_label, y_label, font_size=14, is_show=True, is_savefig=False, datafile=''): """Function: plot data on fig @arguments: (in) ls_dataset: return line list object""" <|body_0|> def Plotfit(xdata, ydata, x, y, x_label, y_label, plt_title='', f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlotUtil: def PlotData(ls_dataset, x_label, y_label, font_size=14, is_show=True, is_savefig=False, datafile=''): """Function: plot data on fig @arguments: (in) ls_dataset: return line list object""" xdata = [] ydata = [] for i in range(0, len(ls_dataset)): xdata.app...
the_stack_v2_python_sparse
GIS_DataAnalysis/proj_py/src/utilities.py
samuelxu999/Research
train
1
c6ef643551dfb8508cda8c878e72f447e75cb54d
[ "value = self.get_capability(COMMAND_TIMEOUTS)\nif value is None:\n return None\nif isinstance(value, dict):\n return {k: timedelta(milliseconds=v) for k, v in value.items()}\nreturn timedelta(milliseconds=int(value))", "if isinstance(value, dict):\n self.set_capability(COMMAND_TIMEOUTS, {k: int(v.total_...
<|body_start_0|> value = self.get_capability(COMMAND_TIMEOUTS) if value is None: return None if isinstance(value, dict): return {k: timedelta(milliseconds=v) for k, v in value.items()} return timedelta(milliseconds=int(value)) <|end_body_0|> <|body_start_1|> ...
CommandTimeoutsOption
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandTimeoutsOption: def command_timeouts(self) -> Optional[Union[Dict[str, timedelta], timedelta]]: """Custom timeout(s) for WDA backend commands execution.""" <|body_0|> def command_timeouts(self, value: Union[Dict[str, timedelta], timedelta, int]) -> None: """Cu...
stack_v2_sparse_classes_36k_train_034591
2,627
permissive
[ { "docstring": "Custom timeout(s) for WDA backend commands execution.", "name": "command_timeouts", "signature": "def command_timeouts(self) -> Optional[Union[Dict[str, timedelta], timedelta]]" }, { "docstring": "Custom timeout for all WDA backend commands execution. This might be useful if WDA ...
2
null
Implement the Python class `CommandTimeoutsOption` described below. Class description: Implement the CommandTimeoutsOption class. Method signatures and docstrings: - def command_timeouts(self) -> Optional[Union[Dict[str, timedelta], timedelta]]: Custom timeout(s) for WDA backend commands execution. - def command_time...
Implement the Python class `CommandTimeoutsOption` described below. Class description: Implement the CommandTimeoutsOption class. Method signatures and docstrings: - def command_timeouts(self) -> Optional[Union[Dict[str, timedelta], timedelta]]: Custom timeout(s) for WDA backend commands execution. - def command_time...
2e49569ed45751df4c6953466f9769336698c033
<|skeleton|> class CommandTimeoutsOption: def command_timeouts(self) -> Optional[Union[Dict[str, timedelta], timedelta]]: """Custom timeout(s) for WDA backend commands execution.""" <|body_0|> def command_timeouts(self, value: Union[Dict[str, timedelta], timedelta, int]) -> None: """Cu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandTimeoutsOption: def command_timeouts(self) -> Optional[Union[Dict[str, timedelta], timedelta]]: """Custom timeout(s) for WDA backend commands execution.""" value = self.get_capability(COMMAND_TIMEOUTS) if value is None: return None if isinstance(value, dict):...
the_stack_v2_python_sparse
appium/options/ios/xcuitest/other/command_timeouts_option.py
appium/python-client
train
1,588
2ddecd9114f9d28791355050c36172b4f42fbdf5
[ "self.text = text_data.get('DetectedText')\nself.kind = text_data.get('Type')\nself.id = text_data.get('Id')\nself.parent_id = text_data.get('ParentId')\nself.confidence = text_data.get('Confidence')\nself.geometry = text_data.get('Geometry')", "rendering = {}\nif self.text is not None:\n rendering['text'] = s...
<|body_start_0|> self.text = text_data.get('DetectedText') self.kind = text_data.get('Type') self.id = text_data.get('Id') self.parent_id = text_data.get('ParentId') self.confidence = text_data.get('Confidence') self.geometry = text_data.get('Geometry') <|end_body_0|> <|...
Encapsulates an Amazon Rekognition text element.
RekognitionText
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RekognitionText: """Encapsulates an Amazon Rekognition text element.""" def __init__(self, text_data): """Initializes the text object. :param text_data: Text data, in the format returned by Amazon Rekognition functions.""" <|body_0|> def to_dict(self): """Renders...
stack_v2_sparse_classes_36k_train_034592
11,689
permissive
[ { "docstring": "Initializes the text object. :param text_data: Text data, in the format returned by Amazon Rekognition functions.", "name": "__init__", "signature": "def __init__(self, text_data)" }, { "docstring": "Renders some of the text data to a dict. :return: A dict that contains the text ...
2
null
Implement the Python class `RekognitionText` described below. Class description: Encapsulates an Amazon Rekognition text element. Method signatures and docstrings: - def __init__(self, text_data): Initializes the text object. :param text_data: Text data, in the format returned by Amazon Rekognition functions. - def t...
Implement the Python class `RekognitionText` described below. Class description: Encapsulates an Amazon Rekognition text element. Method signatures and docstrings: - def __init__(self, text_data): Initializes the text object. :param text_data: Text data, in the format returned by Amazon Rekognition functions. - def t...
dec41fb589043ac9d8667aac36fb88a53c3abe50
<|skeleton|> class RekognitionText: """Encapsulates an Amazon Rekognition text element.""" def __init__(self, text_data): """Initializes the text object. :param text_data: Text data, in the format returned by Amazon Rekognition functions.""" <|body_0|> def to_dict(self): """Renders...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RekognitionText: """Encapsulates an Amazon Rekognition text element.""" def __init__(self, text_data): """Initializes the text object. :param text_data: Text data, in the format returned by Amazon Rekognition functions.""" self.text = text_data.get('DetectedText') self.kind = text...
the_stack_v2_python_sparse
python/example_code/rekognition/rekognition_objects.py
awsdocs/aws-doc-sdk-examples
train
8,240
d1df998163385d3e3106ffdc620f2d659c647e17
[ "device = self.device\nif hasattr(device.api, 'check_sensors'):\n data = await device.async_request(device.api.check_sensors)\n return self.normalize(data, self.coordinator.data)\nawait device.async_request(device.api.update)\nreturn {}", "if data['temperature'] == -7:\n if previous_data is None or previ...
<|body_start_0|> device = self.device if hasattr(device.api, 'check_sensors'): data = await device.async_request(device.api.check_sensors) return self.normalize(data, self.coordinator.data) await device.async_request(device.api.update) return {} <|end_body_0|> <|...
Manages updates for Broadlink remotes.
BroadlinkRMUpdateManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BroadlinkRMUpdateManager: """Manages updates for Broadlink remotes.""" async def async_fetch_data(self): """Fetch data from the device.""" <|body_0|> def normalize(data, previous_data): """Fix firmware issue. See https://github.com/home-assistant/core/issues/4210...
stack_v2_sparse_classes_36k_train_034593
6,174
permissive
[ { "docstring": "Fetch data from the device.", "name": "async_fetch_data", "signature": "async def async_fetch_data(self)" }, { "docstring": "Fix firmware issue. See https://github.com/home-assistant/core/issues/42100.", "name": "normalize", "signature": "def normalize(data, previous_data...
2
stack_v2_sparse_classes_30k_train_006101
Implement the Python class `BroadlinkRMUpdateManager` described below. Class description: Manages updates for Broadlink remotes. Method signatures and docstrings: - async def async_fetch_data(self): Fetch data from the device. - def normalize(data, previous_data): Fix firmware issue. See https://github.com/home-assis...
Implement the Python class `BroadlinkRMUpdateManager` described below. Class description: Manages updates for Broadlink remotes. Method signatures and docstrings: - async def async_fetch_data(self): Fetch data from the device. - def normalize(data, previous_data): Fix firmware issue. See https://github.com/home-assis...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class BroadlinkRMUpdateManager: """Manages updates for Broadlink remotes.""" async def async_fetch_data(self): """Fetch data from the device.""" <|body_0|> def normalize(data, previous_data): """Fix firmware issue. See https://github.com/home-assistant/core/issues/4210...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BroadlinkRMUpdateManager: """Manages updates for Broadlink remotes.""" async def async_fetch_data(self): """Fetch data from the device.""" device = self.device if hasattr(device.api, 'check_sensors'): data = await device.async_request(device.api.check_sensors) ...
the_stack_v2_python_sparse
homeassistant/components/broadlink/updater.py
home-assistant/core
train
35,501
41818c7c5d3901d55346b6f1941abf3c6f4a7b80
[ "self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\nself.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)\ntokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train)\nself.tokenizer_pt = tokenizer_pt\nself.tokenizer_en...
<|body_start_0|> self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) self.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True) tokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train) self.token...
load en-pt lengues dataset and tokenize sentece
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """load en-pt lengues dataset and tokenize sentece""" def __init__(self): """costructor""" <|body_0|> def tokenize_dataset(self, data): """tokenize for return 2 tensor""" <|body_1|> def encode(self, pt, en): """that encodes a transla...
stack_v2_sparse_classes_36k_train_034594
1,933
no_license
[ { "docstring": "costructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "tokenize for return 2 tensor", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" }, { "docstring": "that encodes a translation into tokens", "name":...
3
stack_v2_sparse_classes_30k_train_004949
Implement the Python class `Dataset` described below. Class description: load en-pt lengues dataset and tokenize sentece Method signatures and docstrings: - def __init__(self): costructor - def tokenize_dataset(self, data): tokenize for return 2 tensor - def encode(self, pt, en): that encodes a translation into token...
Implement the Python class `Dataset` described below. Class description: load en-pt lengues dataset and tokenize sentece Method signatures and docstrings: - def __init__(self): costructor - def tokenize_dataset(self, data): tokenize for return 2 tensor - def encode(self, pt, en): that encodes a translation into token...
bda9efa60075afa834433ff1b5179db80f2487ae
<|skeleton|> class Dataset: """load en-pt lengues dataset and tokenize sentece""" def __init__(self): """costructor""" <|body_0|> def tokenize_dataset(self, data): """tokenize for return 2 tensor""" <|body_1|> def encode(self, pt, en): """that encodes a transla...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """load en-pt lengues dataset and tokenize sentece""" def __init__(self): """costructor""" self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) self.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_super...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/1-dataset.py
vandeldiegoc/holbertonschool-machine_learning
train
0
a64070b7ffb6e15f16acce48aca79358f52a620b
[ "super(MultiResolutionSTFTLoss, self).__init__()\nassert len(fft_sizes) == len(hop_sizes) == len(win_lengths)\nself.stft_losses = torch.nn.ModuleList()\nfor fs, ss, wl in zip(fft_sizes, hop_sizes, win_lengths):\n self.stft_losses += [STFTLoss(fs, ss, wl, window)]\nself.factor_sc = factor_sc\nself.factor_mag = fa...
<|body_start_0|> super(MultiResolutionSTFTLoss, self).__init__() assert len(fft_sizes) == len(hop_sizes) == len(win_lengths) self.stft_losses = torch.nn.ModuleList() for fs, ss, wl in zip(fft_sizes, hop_sizes, win_lengths): self.stft_losses += [STFTLoss(fs, ss, wl, window)] ...
Multi resolution STFT loss module.
MultiResolutionSTFTLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiResolutionSTFTLoss: """Multi resolution STFT loss module.""" def __init__(self, fft_sizes=[1024, 2048, 512], hop_sizes=[120, 240, 50], win_lengths=[600, 1200, 240], window='hann_window', factor_sc=0.1, factor_mag=0.1): """Initialize Multi resolution STFT loss module. Args: fft_s...
stack_v2_sparse_classes_36k_train_034595
24,374
no_license
[ { "docstring": "Initialize Multi resolution STFT loss module. Args: fft_sizes (list): List of FFT sizes. hop_sizes (list): List of hop sizes. win_lengths (list): List of window lengths. window (str): Window function type. factor (float): a balancing factor across different losses.", "name": "__init__", ...
2
null
Implement the Python class `MultiResolutionSTFTLoss` described below. Class description: Multi resolution STFT loss module. Method signatures and docstrings: - def __init__(self, fft_sizes=[1024, 2048, 512], hop_sizes=[120, 240, 50], win_lengths=[600, 1200, 240], window='hann_window', factor_sc=0.1, factor_mag=0.1): ...
Implement the Python class `MultiResolutionSTFTLoss` described below. Class description: Multi resolution STFT loss module. Method signatures and docstrings: - def __init__(self, fft_sizes=[1024, 2048, 512], hop_sizes=[120, 240, 50], win_lengths=[600, 1200, 240], window='hann_window', factor_sc=0.1, factor_mag=0.1): ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MultiResolutionSTFTLoss: """Multi resolution STFT loss module.""" def __init__(self, fft_sizes=[1024, 2048, 512], hop_sizes=[120, 240, 50], win_lengths=[600, 1200, 240], window='hann_window', factor_sc=0.1, factor_mag=0.1): """Initialize Multi resolution STFT loss module. Args: fft_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiResolutionSTFTLoss: """Multi resolution STFT loss module.""" def __init__(self, fft_sizes=[1024, 2048, 512], hop_sizes=[120, 240, 50], win_lengths=[600, 1200, 240], window='hann_window', factor_sc=0.1, factor_mag=0.1): """Initialize Multi resolution STFT loss module. Args: fft_sizes (list): ...
the_stack_v2_python_sparse
generated/test_facebookresearch_denoiser.py
jansel/pytorch-jit-paritybench
train
35
534ed75b9977e53a30a6442493d578f1a44c4c3f
[ "self.domain = domain\nself.domain_id = domain_id\nself.id = id\nself.name = name", "if dictionary is None:\n return None\ndomain = cohesity_management_sdk.models.domain.Domain.from_dictionary(dictionary.get('domain')) if dictionary.get('domain') else None\ndomain_id = dictionary.get('domainId')\nid = dictiona...
<|body_start_0|> self.domain = domain self.domain_id = domain_id self.id = id self.name = name <|end_body_0|> <|body_start_1|> if dictionary is None: return None domain = cohesity_management_sdk.models.domain.Domain.from_dictionary(dictionary.get('domain')) i...
Implementation of the 'Project' model. TODO: type description here. Attributes: domain (Domain): Domain to which the project is scoped. domain_id (string): The ID of the domain to which the project is scoped. This field is used in the reponse of Keystone API. id (string): The ID of the project. name (string): The name ...
Project
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Project: """Implementation of the 'Project' model. TODO: type description here. Attributes: domain (Domain): Domain to which the project is scoped. domain_id (string): The ID of the domain to which the project is scoped. This field is used in the reponse of Keystone API. id (string): The ID of th...
stack_v2_sparse_classes_36k_train_034596
2,065
permissive
[ { "docstring": "Constructor for the Project class", "name": "__init__", "signature": "def __init__(self, domain=None, domain_id=None, id=None, name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the obje...
2
null
Implement the Python class `Project` described below. Class description: Implementation of the 'Project' model. TODO: type description here. Attributes: domain (Domain): Domain to which the project is scoped. domain_id (string): The ID of the domain to which the project is scoped. This field is used in the reponse of ...
Implement the Python class `Project` described below. Class description: Implementation of the 'Project' model. TODO: type description here. Attributes: domain (Domain): Domain to which the project is scoped. domain_id (string): The ID of the domain to which the project is scoped. This field is used in the reponse of ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class Project: """Implementation of the 'Project' model. TODO: type description here. Attributes: domain (Domain): Domain to which the project is scoped. domain_id (string): The ID of the domain to which the project is scoped. This field is used in the reponse of Keystone API. id (string): The ID of th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Project: """Implementation of the 'Project' model. TODO: type description here. Attributes: domain (Domain): Domain to which the project is scoped. domain_id (string): The ID of the domain to which the project is scoped. This field is used in the reponse of Keystone API. id (string): The ID of the project. na...
the_stack_v2_python_sparse
cohesity_management_sdk/models/project.py
cohesity/management-sdk-python
train
24
7996a42298386061344a45afe4b427e9a64074c1
[ "try:\n installed_list_file = open(from_location + '/installed.lst')\nexcept IOError:\n pass\nelse:\n for line in installed_list_file:\n l = line.rstrip().split(' ')\n if l:\n self.installed_packages_list[l[0]] = this_package = self.package_info(from_location, l[0], l[1], l[2], url...
<|body_start_0|> try: installed_list_file = open(from_location + '/installed.lst') except IOError: pass else: for line in installed_list_file: l = line.rstrip().split(' ') if l: self.installed_packages_list[l...
dataset_resolver
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dataset_resolver: def read_installed_packages_list(self, from_location): """Reads a given configuration file, and updates the internal installed packages list. :param from_location: a path (string) to a directory containing an installed.lst file""" <|body_0|> def resolve_dat...
stack_v2_sparse_classes_36k_train_034597
3,438
permissive
[ { "docstring": "Reads a given configuration file, and updates the internal installed packages list. :param from_location: a path (string) to a directory containing an installed.lst file", "name": "read_installed_packages_list", "signature": "def read_installed_packages_list(self, from_location)" }, ...
3
null
Implement the Python class `dataset_resolver` described below. Class description: Implement the dataset_resolver class. Method signatures and docstrings: - def read_installed_packages_list(self, from_location): Reads a given configuration file, and updates the internal installed packages list. :param from_location: a...
Implement the Python class `dataset_resolver` described below. Class description: Implement the dataset_resolver class. Method signatures and docstrings: - def read_installed_packages_list(self, from_location): Reads a given configuration file, and updates the internal installed packages list. :param from_location: a...
96edb376ced1b828962c749240059903686da549
<|skeleton|> class dataset_resolver: def read_installed_packages_list(self, from_location): """Reads a given configuration file, and updates the internal installed packages list. :param from_location: a path (string) to a directory containing an installed.lst file""" <|body_0|> def resolve_dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class dataset_resolver: def read_installed_packages_list(self, from_location): """Reads a given configuration file, and updates the internal installed packages list. :param from_location: a path (string) to a directory containing an installed.lst file""" try: installed_list_file = open(f...
the_stack_v2_python_sparse
pylearn2/dataset_get/dataset_resolver.py
Coderx7/pylearn2
train
1
f8c76d2c6a5a6595b6842ab4913feb18e056bb7a
[ "g = Grammar()\ng.train_string('Hello, world!')\nself.assertEqual('0 --(0)--> H e l l o , _ w o r l d ! \\n', g.print_grammar())", "g = Grammar()\ng.train_string('abcabdabcabd')\nself.assertEqual('0 --(0)--> 1 1 \\n1 --(2)--> 2 c 2 d abcabd\\n2 --(2)--> a b ...
<|body_start_0|> g = Grammar() g.train_string('Hello, world!') self.assertEqual('0 --(0)--> H e l l o , _ w o r l d ! \n', g.print_grammar()) <|end_body_0|> <|body_start_1|> g = Grammar() g.train_string('abcabdabcabd') self.assertEqual('0 --(0)--> 1 1 \n1 --(2)--> 2 c 2 ...
TestSequitur
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSequitur: def test_sequitur(self): """docstring for test_sequitur""" <|body_0|> def test_sequitur_base(self): """docstring for test_sequitur_base""" <|body_1|> <|end_skeleton|> <|body_start_0|> g = Grammar() g.train_string('Hello, world!...
stack_v2_sparse_classes_36k_train_034598
696
permissive
[ { "docstring": "docstring for test_sequitur", "name": "test_sequitur", "signature": "def test_sequitur(self)" }, { "docstring": "docstring for test_sequitur_base", "name": "test_sequitur_base", "signature": "def test_sequitur_base(self)" } ]
2
stack_v2_sparse_classes_30k_train_017610
Implement the Python class `TestSequitur` described below. Class description: Implement the TestSequitur class. Method signatures and docstrings: - def test_sequitur(self): docstring for test_sequitur - def test_sequitur_base(self): docstring for test_sequitur_base
Implement the Python class `TestSequitur` described below. Class description: Implement the TestSequitur class. Method signatures and docstrings: - def test_sequitur(self): docstring for test_sequitur - def test_sequitur_base(self): docstring for test_sequitur_base <|skeleton|> class TestSequitur: def test_sequ...
7192f0bf26378d8aacb21c0220cc705cb577c6dc
<|skeleton|> class TestSequitur: def test_sequitur(self): """docstring for test_sequitur""" <|body_0|> def test_sequitur_base(self): """docstring for test_sequitur_base""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSequitur: def test_sequitur(self): """docstring for test_sequitur""" g = Grammar() g.train_string('Hello, world!') self.assertEqual('0 --(0)--> H e l l o , _ w o r l d ! \n', g.print_grammar()) def test_sequitur_base(self): """docstring for test_sequitur_base""...
the_stack_v2_python_sparse
make_demo_discover_rt/pysequitur/sequiturpython/sequitur_test.py
sjtuytc/AAAI21-RoutineAugmentedPolicyLearning
train
15
a6db8d95776f07f9fa129ab238739577057429a4
[ "self.assertEqual(super_algos.find_min(''), -1)\nself.assertEqual(super_algos.sum_all([]), -1)\nself.assertEqual(super_algos.find_min([1, 'a', 5, 6]), -1)\nself.assertEqual(super_algos.find_min([1, 1.3, 5, 6]), -1)\nself.assertEqual(super_algos.find_min([1, 2, 3, 4]), min([1, 2, 3, 4]))", "self.assertEqual(super_...
<|body_start_0|> self.assertEqual(super_algos.find_min(''), -1) self.assertEqual(super_algos.sum_all([]), -1) self.assertEqual(super_algos.find_min([1, 'a', 5, 6]), -1) self.assertEqual(super_algos.find_min([1, 1.3, 5, 6]), -1) self.assertEqual(super_algos.find_min([1, 2, 3, 4]),...
MyTestCases
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTestCases: def test_find_min(self): """Test Function: * Tests if all instructions are followed for find_min(list)""" <|body_0|> def test_sum_all(self): """Test Function: * Tests if all instructions are followed for sum_all(list)""" <|body_1|> def test_...
stack_v2_sparse_classes_36k_train_034599
1,720
no_license
[ { "docstring": "Test Function: * Tests if all instructions are followed for find_min(list)", "name": "test_find_min", "signature": "def test_find_min(self)" }, { "docstring": "Test Function: * Tests if all instructions are followed for sum_all(list)", "name": "test_sum_all", "signature":...
3
stack_v2_sparse_classes_30k_train_009317
Implement the Python class `MyTestCases` described below. Class description: Implement the MyTestCases class. Method signatures and docstrings: - def test_find_min(self): Test Function: * Tests if all instructions are followed for find_min(list) - def test_sum_all(self): Test Function: * Tests if all instructions are...
Implement the Python class `MyTestCases` described below. Class description: Implement the MyTestCases class. Method signatures and docstrings: - def test_find_min(self): Test Function: * Tests if all instructions are followed for find_min(list) - def test_sum_all(self): Test Function: * Tests if all instructions are...
c27509693894b54c077bc40a4d4dfbfa311e029b
<|skeleton|> class MyTestCases: def test_find_min(self): """Test Function: * Tests if all instructions are followed for find_min(list)""" <|body_0|> def test_sum_all(self): """Test Function: * Tests if all instructions are followed for sum_all(list)""" <|body_1|> def test_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyTestCases: def test_find_min(self): """Test Function: * Tests if all instructions are followed for find_min(list)""" self.assertEqual(super_algos.find_min(''), -1) self.assertEqual(super_algos.sum_all([]), -1) self.assertEqual(super_algos.find_min([1, 'a', 5, 6]), -1) ...
the_stack_v2_python_sparse
python_projects/Recurrsion/submission_004-problem/test_algos.py
Mbuso21/WeThinkCode-Projects
train
0