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
1ee90cbb7495ba135af500e9a2018bd183348032
[ "pg.init()\nself.running = True\nself.clock = pg.time.Clock()\nself.screen = pg.display.set_mode(SCREENSIZE)\npg.display.set_caption('RCA')\nself.accept_input = True\nself.key_indices = []\nself.game = game(self)", "while self.running:\n self.events()\n self.game.logic()\n self.draw()\n pg.display.fli...
<|body_start_0|> pg.init() self.running = True self.clock = pg.time.Clock() self.screen = pg.display.set_mode(SCREENSIZE) pg.display.set_caption('RCA') self.accept_input = True self.key_indices = [] self.game = game(self) <|end_body_0|> <|body_start_1|> ...
Engine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Engine: def __init__(self, game): """Must do the following: - Start pygame - Set up the configuration - Define and open a new window - Set up all your sprites and backgrounds""" <|body_0|> def mainloop(self): """Running this function will execute the initialized game...
stack_v2_sparse_classes_36k_train_029600
3,188
no_license
[ { "docstring": "Must do the following: - Start pygame - Set up the configuration - Define and open a new window - Set up all your sprites and backgrounds", "name": "__init__", "signature": "def __init__(self, game)" }, { "docstring": "Running this function will execute the initialized game. The ...
4
stack_v2_sparse_classes_30k_train_012229
Implement the Python class `Engine` described below. Class description: Implement the Engine class. Method signatures and docstrings: - def __init__(self, game): Must do the following: - Start pygame - Set up the configuration - Define and open a new window - Set up all your sprites and backgrounds - def mainloop(sel...
Implement the Python class `Engine` described below. Class description: Implement the Engine class. Method signatures and docstrings: - def __init__(self, game): Must do the following: - Start pygame - Set up the configuration - Define and open a new window - Set up all your sprites and backgrounds - def mainloop(sel...
ce073b101dcc2700192312bd9ebab5b4d71e1e14
<|skeleton|> class Engine: def __init__(self, game): """Must do the following: - Start pygame - Set up the configuration - Define and open a new window - Set up all your sprites and backgrounds""" <|body_0|> def mainloop(self): """Running this function will execute the initialized game...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Engine: def __init__(self, game): """Must do the following: - Start pygame - Set up the configuration - Define and open a new window - Set up all your sprites and backgrounds""" pg.init() self.running = True self.clock = pg.time.Clock() self.screen = pg.display.set_mode...
the_stack_v2_python_sparse
rca/engine.py
flythereddflagg/RCA
train
1
79f5ad33c3b213df679c819b41c060746b18252e
[ "if not root:\n return '[]'\nqueue = collections.deque()\nqueue.append(root)\nres = []\nwhile queue:\n node = queue.popleft()\n if node:\n res.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\n else:\n res.append('null')\nreturn '[' + ','.join(res) +...
<|body_start_0|> if not root: return '[]' queue = collections.deque() queue.append(root) res = [] while queue: node = queue.popleft() if node: res.append(str(node.val)) queue.append(node.left) que...
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_029601
1,977
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003918
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:...
809424acee0e63b795a46fdc51c5aef6e669d547
<|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 '[]' queue = collections.deque() queue.append(root) res = [] while queue: node = queue.popleft() i...
the_stack_v2_python_sparse
python_offer/37_序列化二叉树.py
Madanfeng/JianZhiOffer
train
0
75c417275544c5d9faf8c430ac76ad405b576c65
[ "a = args[0]\ndtype = a.dtype\nprecision = a.precision\nreturn (dtype, precision)", "a = args[0]\nrank = a.rank\nshape = a.shape\nreturn (shape, rank)" ]
<|body_start_0|> a = args[0] dtype = a.dtype precision = a.precision return (dtype, precision) <|end_body_0|> <|body_start_1|> a = args[0] rank = a.rank shape = a.shape return (shape, rank) <|end_body_1|>
Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator
PyccelUnaryOperator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyccelUnaryOperator: """Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator""" def _calculate_dtype(*args): """Sets the dtype and precision They are chosen to match the argument""" ...
stack_v2_sparse_classes_36k_train_029602
35,482
permissive
[ { "docstring": "Sets the dtype and precision They are chosen to match the argument", "name": "_calculate_dtype", "signature": "def _calculate_dtype(*args)" }, { "docstring": "Sets the shape and rank They are chosen to match the argument", "name": "_calculate_shape_rank", "signature": "de...
2
null
Implement the Python class `PyccelUnaryOperator` described below. Class description: Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator Method signatures and docstrings: - def _calculate_dtype(*args): Sets the dtype an...
Implement the Python class `PyccelUnaryOperator` described below. Class description: Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator Method signatures and docstrings: - def _calculate_dtype(*args): Sets the dtype an...
1896b761ba662c90b14c195bbb6eb5cddc57cbfc
<|skeleton|> class PyccelUnaryOperator: """Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator""" def _calculate_dtype(*args): """Sets the dtype and precision They are chosen to match the argument""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PyccelUnaryOperator: """Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator""" def _calculate_dtype(*args): """Sets the dtype and precision They are chosen to match the argument""" a = args[...
the_stack_v2_python_sparse
pyccel/ast/operators.py
pyccel/pyccel
train
307
a0f4cd9f4e432148002ac1deed7828a87d509312
[ "self.dt = 1.0 / 365\nself.S_0_1 = 100.0\nself.S_0_2 = 110.0\nself.gamma_0 = 0.0\nself.sigma_1 = 0.2\nself.sigma_2 = 0.15\nself.sigma_gamma = 0.2\nself.theta = 0.15\nself.rho = 0.8\nself.drift_1 = -0.5 * self.sigma_1 * self.sigma_1 * self.dt\nself.drift_2 = -0.5 * self.sigma_2 * self.sigma_2 * self.dt\nself.drift_g...
<|body_start_0|> self.dt = 1.0 / 365 self.S_0_1 = 100.0 self.S_0_2 = 110.0 self.gamma_0 = 0.0 self.sigma_1 = 0.2 self.sigma_2 = 0.15 self.sigma_gamma = 0.2 self.theta = 0.15 self.rho = 0.8 self.drift_1 = -0.5 * self.sigma_1 * self.sigma_1 *...
Class that simulates the paths for two risky assets with a mean-reverting spread process.
CointegratedSeriesGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CointegratedSeriesGenerator: """Class that simulates the paths for two risky assets with a mean-reverting spread process.""" def __init__(self): """Constructor.""" <|body_0|> def run(self, n_steps): """Simulate the model. Parameters ---------- n_steps: int Number...
stack_v2_sparse_classes_36k_train_029603
4,905
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Simulate the model. Parameters ---------- n_steps: int Number of steps to simulate", "name": "run", "signature": "def run(self, n_steps)" }, { "docstring": "Dumps data in .csv ...
3
stack_v2_sparse_classes_30k_val_001060
Implement the Python class `CointegratedSeriesGenerator` described below. Class description: Class that simulates the paths for two risky assets with a mean-reverting spread process. Method signatures and docstrings: - def __init__(self): Constructor. - def run(self, n_steps): Simulate the model. Parameters ---------...
Implement the Python class `CointegratedSeriesGenerator` described below. Class description: Class that simulates the paths for two risky assets with a mean-reverting spread process. Method signatures and docstrings: - def __init__(self): Constructor. - def run(self, n_steps): Simulate the model. Parameters ---------...
1a3ae97023acff1ee5e2d197a446734117a6fb99
<|skeleton|> class CointegratedSeriesGenerator: """Class that simulates the paths for two risky assets with a mean-reverting spread process.""" def __init__(self): """Constructor.""" <|body_0|> def run(self, n_steps): """Simulate the model. Parameters ---------- n_steps: int Number...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CointegratedSeriesGenerator: """Class that simulates the paths for two risky assets with a mean-reverting spread process.""" def __init__(self): """Constructor.""" self.dt = 1.0 / 365 self.S_0_1 = 100.0 self.S_0_2 = 110.0 self.gamma_0 = 0.0 self.sigma_1 = 0...
the_stack_v2_python_sparse
Code/Preprocessing/generate_cointegrated_series.py
fdoperezi/Thesis
train
0
785a0d8ace5814fc0b171658892c5f18bd0fd885
[ "super().__init__()\nself._use_condition = use_condition\nself._model = tf.keras.Sequential([tf.keras.layers.Conv2D(128, [5, 5], strides=2, padding='same'), tf.keras.layers.BatchNormalization(), tf.keras.layers.LeakyReLU(), tf.keras.layers.Conv2D(256, [5, 5], strides=2, padding='same'), tf.keras.layers.BatchNormali...
<|body_start_0|> super().__init__() self._use_condition = use_condition self._model = tf.keras.Sequential([tf.keras.layers.Conv2D(128, [5, 5], strides=2, padding='same'), tf.keras.layers.BatchNormalization(), tf.keras.layers.LeakyReLU(), tf.keras.layers.Conv2D(256, [5, 5], strides=2, padding='sa...
Embedding conditioned discriminator. This discriminator is used by CUB, Flowers, MSCOCO datasets. Attributes:
EmbeddingConditionedDiscriminator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingConditionedDiscriminator: """Embedding conditioned discriminator. This discriminator is used by CUB, Flowers, MSCOCO datasets. Attributes:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" <|b...
stack_v2_sparse_classes_36k_train_029604
12,085
no_license
[ { "docstring": "Initializes the object. Args: use_condition: compression_size:", "name": "__init__", "signature": "def __init__(self, use_condition, compression_size)" }, { "docstring": "Applies the model to the inputs. Args: image: embedding: Returns:", "name": "call", "signature": "def...
2
stack_v2_sparse_classes_30k_train_015598
Implement the Python class `EmbeddingConditionedDiscriminator` described below. Class description: Embedding conditioned discriminator. This discriminator is used by CUB, Flowers, MSCOCO datasets. Attributes: Method signatures and docstrings: - def __init__(self, use_condition, compression_size): Initializes the obje...
Implement the Python class `EmbeddingConditionedDiscriminator` described below. Class description: Embedding conditioned discriminator. This discriminator is used by CUB, Flowers, MSCOCO datasets. Attributes: Method signatures and docstrings: - def __init__(self, use_condition, compression_size): Initializes the obje...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class EmbeddingConditionedDiscriminator: """Embedding conditioned discriminator. This discriminator is used by CUB, Flowers, MSCOCO datasets. Attributes:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmbeddingConditionedDiscriminator: """Embedding conditioned discriminator. This discriminator is used by CUB, Flowers, MSCOCO datasets. Attributes:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" super().__init__...
the_stack_v2_python_sparse
gan.py
gaotianxiang/text-to-image-synthesis
train
0
e164d03f42dd416496a7eb3f319d96463de3790a
[ "if not preorder or not inorder:\n return None\nresult = TreeNode(val=preorder[0])\nmiddleindex = inorder.index(preorder[0])\nleftpart = self.buildTree(preorder[1:middleindex + 1], inorder[:middleindex])\nrightpart = self.buildTree(preorder[middleindex + 1:], inorder[middleindex + 1:])\nresult.left = leftpart\nr...
<|body_start_0|> if not preorder or not inorder: return None result = TreeNode(val=preorder[0]) middleindex = inorder.index(preorder[0]) leftpart = self.buildTree(preorder[1:middleindex + 1], inorder[:middleindex]) rightpart = self.buildTree(preorder[middleindex + 1:]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_0|> def bstFromPreorder(self, preorder): """:type preorder: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_029605
1,158
no_license
[ { "docstring": ":type preorder: List[int] :type inorder: List[int] :rtype: TreeNode", "name": "buildTree", "signature": "def buildTree(self, preorder, inorder)" }, { "docstring": ":type preorder: List[int] :rtype: TreeNode", "name": "bstFromPreorder", "signature": "def bstFromPreorder(se...
2
stack_v2_sparse_classes_30k_val_000786
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode - def bstFromPreorder(self, preorder): :type preorder: List[int] :rtyp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode - def bstFromPreorder(self, preorder): :type preorder: List[int] :rtyp...
96fdc45d15b4150cefe12361b236de6aae3bdc6a
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_0|> def bstFromPreorder(self, preorder): """:type preorder: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def buildTree(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" if not preorder or not inorder: return None result = TreeNode(val=preorder[0]) middleindex = inorder.index(preorder[0]) leftpart = sel...
the_stack_v2_python_sparse
python/1008 - Construct Binary Search Tree from Preorder Traversal/main.py
or0986113303/LeetCodeLearn
train
0
ee7b20c899045c355f143aaf05dd736a276a9ae8
[ "self.session = Session()\nself.encode = 'utf-8'\nself.headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6', 'Cache-Control': 'max-age=0', 'Connection': 'keep-alive', 'Host': 'www...
<|body_start_0|> self.session = Session() self.encode = 'utf-8' self.headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6', 'Cache-Control': 'max-age=0', 'Conne...
父类
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """父类""" def __init__(self, encode=None): """init""" <|body_0|> def request(self, url): """request active""" <|body_1|> def parse(self, html, path): """parse page element""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_029606
2,967
no_license
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, encode=None)" }, { "docstring": "request active", "name": "request", "signature": "def request(self, url)" }, { "docstring": "parse page element", "name": "parse", "signature": "def parse(self, ht...
3
stack_v2_sparse_classes_30k_train_020578
Implement the Python class `Base` described below. Class description: 父类 Method signatures and docstrings: - def __init__(self, encode=None): init - def request(self, url): request active - def parse(self, html, path): parse page element
Implement the Python class `Base` described below. Class description: 父类 Method signatures and docstrings: - def __init__(self, encode=None): init - def request(self, url): request active - def parse(self, html, path): parse page element <|skeleton|> class Base: """父类""" def __init__(self, encode=None): ...
b8dd4dd6dafaf9899e97bbb75a3ef80246ec427b
<|skeleton|> class Base: """父类""" def __init__(self, encode=None): """init""" <|body_0|> def request(self, url): """request active""" <|body_1|> def parse(self, html, path): """parse page element""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """父类""" def __init__(self, encode=None): """init""" self.session = Session() self.encode = 'utf-8' self.headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language'...
the_stack_v2_python_sparse
fourth_week/seventh_day/encapsulation.py
czkun1986/Let-s-go-python-
train
0
a012293ade129d98d8c85dc89b94c564b4280007
[ "try:\n app_id_list = get_cc_app_id_by_user()\n data_result = machine_statistics(table_set=KafkaBroker, field='ip', app_id_list=app_id_list)\n return JsonResponse({'result': True, 'code': 0, 'data': data_result, 'message': 'query success'})\nexcept Exception as err:\n logger.error(f'kafka机器查询汇总失败:{err}'...
<|body_start_0|> try: app_id_list = get_cc_app_id_by_user() data_result = machine_statistics(table_set=KafkaBroker, field='ip', app_id_list=app_id_list) return JsonResponse({'result': True, 'code': 0, 'data': data_result, 'message': 'query success'}) except Exception ...
kafka broker信息表视图
KafkaBrokerViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KafkaBrokerViewSet: """kafka broker信息表视图""" def get_machine_statistics(self, request, *args, **kwargs): """POST /kafka/brokers/get_machine_statistics 统计kafka投入已使用的机器数量""" <|body_0|> def get_machine_statistics_top_five(self, request, *args, **kwargs): """POST /kaf...
stack_v2_sparse_classes_36k_train_029607
12,453
no_license
[ { "docstring": "POST /kafka/brokers/get_machine_statistics 统计kafka投入已使用的机器数量", "name": "get_machine_statistics", "signature": "def get_machine_statistics(self, request, *args, **kwargs)" }, { "docstring": "POST /kafka/brokers/get_machine_statistics_top_five 根据用户已有业务权限,查询每个业务的机器投入数量,输出TOP5", ...
4
stack_v2_sparse_classes_30k_train_008451
Implement the Python class `KafkaBrokerViewSet` described below. Class description: kafka broker信息表视图 Method signatures and docstrings: - def get_machine_statistics(self, request, *args, **kwargs): POST /kafka/brokers/get_machine_statistics 统计kafka投入已使用的机器数量 - def get_machine_statistics_top_five(self, request, *args,...
Implement the Python class `KafkaBrokerViewSet` described below. Class description: kafka broker信息表视图 Method signatures and docstrings: - def get_machine_statistics(self, request, *args, **kwargs): POST /kafka/brokers/get_machine_statistics 统计kafka投入已使用的机器数量 - def get_machine_statistics_top_five(self, request, *args,...
97cfac2ba94d67980d837f0b541caae70b68a595
<|skeleton|> class KafkaBrokerViewSet: """kafka broker信息表视图""" def get_machine_statistics(self, request, *args, **kwargs): """POST /kafka/brokers/get_machine_statistics 统计kafka投入已使用的机器数量""" <|body_0|> def get_machine_statistics_top_five(self, request, *args, **kwargs): """POST /kaf...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KafkaBrokerViewSet: """kafka broker信息表视图""" def get_machine_statistics(self, request, *args, **kwargs): """POST /kafka/brokers/get_machine_statistics 统计kafka投入已使用的机器数量""" try: app_id_list = get_cc_app_id_by_user() data_result = machine_statistics(table_set=KafkaBro...
the_stack_v2_python_sparse
apps/kafka/views.py
sdgdsffdsfff/bk-dop
train
0
f321cee70d7e0c76285329f076cdf0e01f773820
[ "QWidget.__init__(self, parent)\nself.setupUi(self)\nself.machine = None\nself.b_mmf.clicked.connect(self.plot_mmf)", "self.machine = machine\ndesc_dict = self.machine.comp_desc_dict()\nself.tab_param.clear()\nself.tab_param.setColumnCount(2)\nitem = QTableWidgetItem('Name')\nself.tab_param.setHorizontalHeaderIte...
<|body_start_0|> QWidget.__init__(self, parent) self.setupUi(self) self.machine = None self.b_mmf.clicked.connect(self.plot_mmf) <|end_body_0|> <|body_start_1|> self.machine = machine desc_dict = self.machine.comp_desc_dict() self.tab_param.clear() self.t...
Table to display the main paramaters of the machine
WMachineTable
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WMachineTable: """Table to display the main paramaters of the machine""" def __init__(self, parent=None): """Initialize the GUI Parameters ---------- self : SWindCond A SWindCond widget""" <|body_0|> def update_tab(self, machine): """Update the table to match the...
stack_v2_sparse_classes_36k_train_029608
2,138
permissive
[ { "docstring": "Initialize the GUI Parameters ---------- self : SWindCond A SWindCond widget", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Update the table to match the machine Parameters ---------- self : WMachineTable A WMachineTable object", "name...
3
null
Implement the Python class `WMachineTable` described below. Class description: Table to display the main paramaters of the machine Method signatures and docstrings: - def __init__(self, parent=None): Initialize the GUI Parameters ---------- self : SWindCond A SWindCond widget - def update_tab(self, machine): Update t...
Implement the Python class `WMachineTable` described below. Class description: Table to display the main paramaters of the machine Method signatures and docstrings: - def __init__(self, parent=None): Initialize the GUI Parameters ---------- self : SWindCond A SWindCond widget - def update_tab(self, machine): Update t...
29e6b4358420754993af1a43048aa12d1538774e
<|skeleton|> class WMachineTable: """Table to display the main paramaters of the machine""" def __init__(self, parent=None): """Initialize the GUI Parameters ---------- self : SWindCond A SWindCond widget""" <|body_0|> def update_tab(self, machine): """Update the table to match the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WMachineTable: """Table to display the main paramaters of the machine""" def __init__(self, parent=None): """Initialize the GUI Parameters ---------- self : SWindCond A SWindCond widget""" QWidget.__init__(self, parent) self.setupUi(self) self.machine = None self.b...
the_stack_v2_python_sparse
pyleecan/GUI/Dialog/DMachineSetup/SPreview/WMachineTable/WMachineTable.py
BonneelP/pyleecan
train
2
1b9f329a2926b022178a0e16b162b3c9e3c9466d
[ "re = cloudparking_service().mockCarInOut(send_data['carNum'], 0, send_data['StrictRule_inClientID'])\nresult = re\nAssertions().assert_in_text(result, expect['mockCarInMessage'])", "re = CarInOutHandle(sentryLogin).carInOutHandle(send_data['carNum'], send_data['carInHandleType'], send_data['carIn_jobId'])\nresul...
<|body_start_0|> re = cloudparking_service().mockCarInOut(send_data['carNum'], 0, send_data['StrictRule_inClientID']) result = re Assertions().assert_in_text(result, expect['mockCarInMessage']) <|end_body_0|> <|body_start_1|> re = CarInOutHandle(sentryLogin).carInOutHandle(send_data['ca...
岗亭收费处理:进场、离场消息
TestSentryMessage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSentryMessage: """岗亭收费处理:进场、离场消息""" def test_mockCarIn(self, sentryLogin, send_data, expect): """模拟进场""" <|body_0|> def test_checkMessageIn(self, sentryLogin, send_data, expect): """登记放行""" <|body_1|> def test_mockCarOut(self, send_data, expect):...
stack_v2_sparse_classes_36k_train_029609
2,638
no_license
[ { "docstring": "模拟进场", "name": "test_mockCarIn", "signature": "def test_mockCarIn(self, sentryLogin, send_data, expect)" }, { "docstring": "登记放行", "name": "test_checkMessageIn", "signature": "def test_checkMessageIn(self, sentryLogin, send_data, expect)" }, { "docstring": "模拟离场",...
5
stack_v2_sparse_classes_30k_train_014289
Implement the Python class `TestSentryMessage` described below. Class description: 岗亭收费处理:进场、离场消息 Method signatures and docstrings: - def test_mockCarIn(self, sentryLogin, send_data, expect): 模拟进场 - def test_checkMessageIn(self, sentryLogin, send_data, expect): 登记放行 - def test_mockCarOut(self, send_data, expect): 模拟离...
Implement the Python class `TestSentryMessage` described below. Class description: 岗亭收费处理:进场、离场消息 Method signatures and docstrings: - def test_mockCarIn(self, sentryLogin, send_data, expect): 模拟进场 - def test_checkMessageIn(self, sentryLogin, send_data, expect): 登记放行 - def test_mockCarOut(self, send_data, expect): 模拟离...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class TestSentryMessage: """岗亭收费处理:进场、离场消息""" def test_mockCarIn(self, sentryLogin, send_data, expect): """模拟进场""" <|body_0|> def test_checkMessageIn(self, sentryLogin, send_data, expect): """登记放行""" <|body_1|> def test_mockCarOut(self, send_data, expect):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSentryMessage: """岗亭收费处理:进场、离场消息""" def test_mockCarIn(self, sentryLogin, send_data, expect): """模拟进场""" re = cloudparking_service().mockCarInOut(send_data['carNum'], 0, send_data['StrictRule_inClientID']) result = re Assertions().assert_in_text(result, expect['mockCar...
the_stack_v2_python_sparse
test_suite/sentryDutyRoom/carInOutHandle/test_messageInAndOut_strict.py
oyebino/pomp_api
train
1
42bb99899a670c6f12420e86c653c46af24dbe82
[ "startTime = datetime.datetime.now()\nprint('')\nprint('inserting zillow search data...')\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('ekmak_gzhou_kaylaipp_shen99', 'ekmak_gzhou_kaylaipp_shen99')\nurl = 'http://datamechanics.io/data/zillow_getsearchresults_data.json'\nresponse = urlli...
<|body_start_0|> startTime = datetime.datetime.now() print('') print('inserting zillow search data...') client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ekmak_gzhou_kaylaipp_shen99', 'ekmak_gzhou_kaylaipp_shen99') url = 'http://datamechanic...
get_zillow_search_data
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class get_zillow_search_data: def execute(trial=True): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing ev...
stack_v2_sparse_classes_36k_train_029610
7,270
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=True)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new do...
2
stack_v2_sparse_classes_30k_train_018532
Implement the Python class `get_zillow_search_data` described below. Class description: Implement the get_zillow_search_data class. Method signatures and docstrings: - def execute(trial=True): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), ...
Implement the Python class `get_zillow_search_data` described below. Class description: Implement the get_zillow_search_data class. Method signatures and docstrings: - def execute(trial=True): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), ...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class get_zillow_search_data: def execute(trial=True): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing ev...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class get_zillow_search_data: def execute(trial=True): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() print('') print('inserting zillow search data...') client = dml.pymongo.MongoClient() repo = c...
the_stack_v2_python_sparse
ekmak_gzhou_kaylaipp_shen99/get_zillow_search_data.py
maximega/course-2019-spr-proj
train
2
6c6668ad53cd5df9ea3038623302422decae94a3
[ "self.close_on_completion = close_on_completion\nself.file_format = file_format\nself.log_level = DEFAULT_LOG_LEVEL if log_level is None else log_level\nself.cdlfile = None\nself.ncdataset = None\nself.init_logger()\nself.lexer = lex.lex(module=self, debug=kwargs.get('debug', 0))\nself.parser = yacc.yacc(module=sel...
<|body_start_0|> self.close_on_completion = close_on_completion self.file_format = file_format self.log_level = DEFAULT_LOG_LEVEL if log_level is None else log_level self.cdlfile = None self.ncdataset = None self.init_logger() self.lexer = lex.lex(module=self, deb...
Base class for a CDL lexer/parser that has tokens and rules defined as methods. Client code should instantiate concrete subclasses, such as CDL3Parser, rather than this abstract base class.
CDLParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CDLParser: """Base class for a CDL lexer/parser that has tokens and rules defined as methods. Client code should instantiate concrete subclasses, such as CDL3Parser, rather than this abstract base class.""" def __init__(self, close_on_completion=False, file_format='NETCDF3_CLASSIC', log_leve...
stack_v2_sparse_classes_36k_train_029611
45,168
permissive
[ { "docstring": "The currently supported keyword arguments, with their default values, are described below. Any other keyword argments are passed through as-is to the PLY parser (via the yacc.yacc function). For more information about the latter, visit http://www.dabeaz.com/ply/ply.html :param close_on_completio...
4
stack_v2_sparse_classes_30k_train_015744
Implement the Python class `CDLParser` described below. Class description: Base class for a CDL lexer/parser that has tokens and rules defined as methods. Client code should instantiate concrete subclasses, such as CDL3Parser, rather than this abstract base class. Method signatures and docstrings: - def __init__(self...
Implement the Python class `CDLParser` described below. Class description: Base class for a CDL lexer/parser that has tokens and rules defined as methods. Client code should instantiate concrete subclasses, such as CDL3Parser, rather than this abstract base class. Method signatures and docstrings: - def __init__(self...
b8ec71eaca51ac25ed1c680f92292134d8ca341c
<|skeleton|> class CDLParser: """Base class for a CDL lexer/parser that has tokens and rules defined as methods. Client code should instantiate concrete subclasses, such as CDL3Parser, rather than this abstract base class.""" def __init__(self, close_on_completion=False, file_format='NETCDF3_CLASSIC', log_leve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CDLParser: """Base class for a CDL lexer/parser that has tokens and rules defined as methods. Client code should instantiate concrete subclasses, such as CDL3Parser, rather than this abstract base class.""" def __init__(self, close_on_completion=False, file_format='NETCDF3_CLASSIC', log_level=None, **kwa...
the_stack_v2_python_sparse
CMR/cdl2echo10.py
TerraFusion/basicFusion
train
5
fed8143e97905cbcc969f639dd818279870a36cb
[ "if isinstance(data, type(None)):\n raise TypeError('data must be a 2D numpy.ndarray')\nif not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\ndata = data.T\nmean ...
<|body_start_0|> if isinstance(data, type(None)): raise TypeError('data must be a 2D numpy.ndarray') if not isinstance(data, np.ndarray) or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data mu...
Represents a Multivariate Normal distribution
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """Represents a Multivariate Normal distribution""" def __init__(self, data): """class constructor Args: - data: numpy.ndarray Array of shape (d, n) containing the dataset: - n int number of data points - d int number of dimensions in each data point If data is not a 2D ...
stack_v2_sparse_classes_36k_train_029612
3,111
no_license
[ { "docstring": "class constructor Args: - data: numpy.ndarray Array of shape (d, n) containing the dataset: - n int number of data points - d int number of dimensions in each data point If data is not a 2D numpy.ndarray, raise a TypeError with the msg: data must be a 2D numpy.ndarray If n is less than 2, raise ...
2
null
Implement the Python class `MultiNormal` described below. Class description: Represents a Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): class constructor Args: - data: numpy.ndarray Array of shape (d, n) containing the dataset: - n int number of data points - d int num...
Implement the Python class `MultiNormal` described below. Class description: Represents a Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): class constructor Args: - data: numpy.ndarray Array of shape (d, n) containing the dataset: - n int number of data points - d int num...
eb47cd4d12e2f0627bb5e5af28cc0802ff13d0d9
<|skeleton|> class MultiNormal: """Represents a Multivariate Normal distribution""" def __init__(self, data): """class constructor Args: - data: numpy.ndarray Array of shape (d, n) containing the dataset: - n int number of data points - d int number of dimensions in each data point If data is not a 2D ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """Represents a Multivariate Normal distribution""" def __init__(self, data): """class constructor Args: - data: numpy.ndarray Array of shape (d, n) containing the dataset: - n int number of data points - d int number of dimensions in each data point If data is not a 2D numpy.ndarray...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
rodrigocruz13/holbertonschool-machine_learning
train
4
54ebebd9743d02d1010166895bb95a2b63a8a954
[ "self.safe_update(**kwargs)\nif butler is not None:\n self.log.warn('Ignoring butler in extract()')\ndtables = stack_summary_table(data, self, tablename='outliers', keep_cols=['nbad_total', 'nbad_rows', 'nbad_cols', 'slot', 'amp'])\nreturn dtables", "self.safe_update(**kwargs)\nconfig_table = get_run_config_ta...
<|body_start_0|> self.safe_update(**kwargs) if butler is not None: self.log.warn('Ignoring butler in extract()') dtables = stack_summary_table(data, self, tablename='outliers', keep_cols=['nbad_total', 'nbad_rows', 'nbad_cols', 'slot', 'amp']) return dtables <|end_body_0|> <...
Summarize the results for the superbias outlier analysis
SuperdarkOutlierSummaryTask
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperdarkOutlierSummaryTask: """Summarize the results for the superbias outlier analysis""" def extract(self, butler, data, **kwargs): """Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) con...
stack_v2_sparse_classes_36k_train_029613
14,784
permissive
[ { "docstring": "Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the input data kwargs Used to override default configuration Returns ------- dtables : `TableDict` The resulting data", "name": "extract", ...
2
stack_v2_sparse_classes_30k_train_011854
Implement the Python class `SuperdarkOutlierSummaryTask` described below. Class description: Summarize the results for the superbias outlier analysis Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data...
Implement the Python class `SuperdarkOutlierSummaryTask` described below. Class description: Summarize the results for the superbias outlier analysis Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data...
28418284fdaf2b2fb0afbeccd4324f7ad3e676c8
<|skeleton|> class SuperdarkOutlierSummaryTask: """Summarize the results for the superbias outlier analysis""" def extract(self, butler, data, **kwargs): """Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperdarkOutlierSummaryTask: """Summarize the results for the superbias outlier analysis""" def extract(self, butler, data, **kwargs): """Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the inpu...
the_stack_v2_python_sparse
python/lsst/eo_utils/dark/superdark.py
lsst-camera-dh/EO-utilities
train
2
531643a663cc78577ce3c72e0f981626a20e6f08
[ "super().setUp()\nself.height_points = np.array([5.0, 10.0, 20.0])\nheight_attribute = {'positive': 'up'}\ndata = np.array([[-88.15, -13.266943, 60.81063]], dtype=np.float32)\nself.wet_bulb_temperature = set_up_variable_cube(data, name='wet_bulb_temperature', units='Celsius')\nself.wet_bulb_temperature = add_coordi...
<|body_start_0|> super().setUp() self.height_points = np.array([5.0, 10.0, 20.0]) height_attribute = {'positive': 'up'} data = np.array([[-88.15, -13.266943, 60.81063]], dtype=np.float32) self.wet_bulb_temperature = set_up_variable_cube(data, name='wet_bulb_temperature', units='C...
Test the calculation of the wet bulb temperature integral from temperature, pressure, and relative humidity information using the process function. Integration is calculated in the vertical. The wet bulb temperature calculated at each level, and the difference in height between the levels are used to calculate an integ...
Test_process
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_process: """Test the calculation of the wet bulb temperature integral from temperature, pressure, and relative humidity information using the process function. Integration is calculated in the vertical. The wet bulb temperature calculated at each level, and the difference in height between t...
stack_v2_sparse_classes_36k_train_029614
4,943
permissive
[ { "docstring": "Set up temperature, pressure, and relative humidity cubes that contain multiple height levels; in this case the values of these diagnostics are identical on each level.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the wet bulb temperature integra...
4
null
Implement the Python class `Test_process` described below. Class description: Test the calculation of the wet bulb temperature integral from temperature, pressure, and relative humidity information using the process function. Integration is calculated in the vertical. The wet bulb temperature calculated at each level,...
Implement the Python class `Test_process` described below. Class description: Test the calculation of the wet bulb temperature integral from temperature, pressure, and relative humidity information using the process function. Integration is calculated in the vertical. The wet bulb temperature calculated at each level,...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_process: """Test the calculation of the wet bulb temperature integral from temperature, pressure, and relative humidity information using the process function. Integration is calculated in the vertical. The wet bulb temperature calculated at each level, and the difference in height between t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_process: """Test the calculation of the wet bulb temperature integral from temperature, pressure, and relative humidity information using the process function. Integration is calculated in the vertical. The wet bulb temperature calculated at each level, and the difference in height between the levels are...
the_stack_v2_python_sparse
improver_tests/psychrometric_calculations/wet_bulb_temperature/test_WetBulbTemperatureIntegral.py
metoppv/improver
train
101
f2a628db3d06f0fc9b078b4fef9d0910707f1a66
[ "request_command = self.parser_invoker.verify_passcode_command_bytes(self.sequence_id, self.product_id, screen_type, length, passcode)\nresponse_command_content = self.connectObj.send_receive_command(request_command)\nreturn response_command_content", "request_command = self.parser_invoker.get_alarm_sound_type_co...
<|body_start_0|> request_command = self.parser_invoker.verify_passcode_command_bytes(self.sequence_id, self.product_id, screen_type, length, passcode) response_command_content = self.connectObj.send_receive_command(request_command) return response_command_content <|end_body_0|> <|body_start_1|>...
This class is used to define all related methods with device maintenance.
Maintenance
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Maintenance: """This class is used to define all related methods with device maintenance.""" def verify_passcode(self, screen_type, length, passcode): """This method is used to verify passcode. :param screen_type: Safety 0x00, Maintenance 0x01 passcode: custom field :return: screen_t...
stack_v2_sparse_classes_36k_train_029615
4,496
permissive
[ { "docstring": "This method is used to verify passcode. :param screen_type: Safety 0x00, Maintenance 0x01 passcode: custom field :return: screen_type: Safety 0x00, Maintenance 0x01 Success:1/Fail:0", "name": "verify_passcode", "signature": "def verify_passcode(self, screen_type, length, passcode)" }, ...
6
stack_v2_sparse_classes_30k_train_019624
Implement the Python class `Maintenance` described below. Class description: This class is used to define all related methods with device maintenance. Method signatures and docstrings: - def verify_passcode(self, screen_type, length, passcode): This method is used to verify passcode. :param screen_type: Safety 0x00, ...
Implement the Python class `Maintenance` described below. Class description: This class is used to define all related methods with device maintenance. Method signatures and docstrings: - def verify_passcode(self, screen_type, length, passcode): This method is used to verify passcode. :param screen_type: Safety 0x00, ...
c2a4884a36f4c6c6552fa942143ae5d21c120b41
<|skeleton|> class Maintenance: """This class is used to define all related methods with device maintenance.""" def verify_passcode(self, screen_type, length, passcode): """This method is used to verify passcode. :param screen_type: Safety 0x00, Maintenance 0x01 passcode: custom field :return: screen_t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Maintenance: """This class is used to define all related methods with device maintenance.""" def verify_passcode(self, screen_type, length, passcode): """This method is used to verify passcode. :param screen_type: Safety 0x00, Maintenance 0x01 passcode: custom field :return: screen_type: Safety 0...
the_stack_v2_python_sparse
.svn/pristine/1a/1a3bb935cd59c9e11bb15af335e6199b241f1816.svn-base
cassie01/PumpLibrary
train
0
12477a2df882b824a02852aef0afbc8b087b6776
[ "matVal = in_value.split(',')\nnum_rows = 0\nnum_cols = 0\ncurrent_row = 0\ncurrent_col = 0\nif matVal[0] == 'A':\n num_cols = int(matVal[5])\n current_row = matVal[1]\nif matVal[0] == 'B':\n num_rows = int(matVal[4])\n current_col = matVal[2]\nif current_row != 0:\n for i in range(num_cols):\n ...
<|body_start_0|> matVal = in_value.split(',') num_rows = 0 num_cols = 0 current_row = 0 current_col = 0 if matVal[0] == 'A': num_cols = int(matVal[5]) current_row = matVal[1] if matVal[0] == 'B': num_rows = int(matVal[4]) ...
Given a matrix A and a matrix B, compute the product A*B = C (matrix multiplication)
MatMul
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatMul: """Given a matrix A and a matrix B, compute the product A*B = C (matrix multiplication)""" def mapper(self, in_key, in_value): """mapper function, which process a key-value pair in the data and generate intermediate key-value pair(s) Input: in_key: the key of a data record (i...
stack_v2_sparse_classes_36k_train_029616
5,623
no_license
[ { "docstring": "mapper function, which process a key-value pair in the data and generate intermediate key-value pair(s) Input: in_key: the key of a data record (in this example, can be ignored) in_value: the value of a data record, (in this example, it is a line of text string in the data file, check 'matrix.cs...
2
null
Implement the Python class `MatMul` described below. Class description: Given a matrix A and a matrix B, compute the product A*B = C (matrix multiplication) Method signatures and docstrings: - def mapper(self, in_key, in_value): mapper function, which process a key-value pair in the data and generate intermediate key...
Implement the Python class `MatMul` described below. Class description: Given a matrix A and a matrix B, compute the product A*B = C (matrix multiplication) Method signatures and docstrings: - def mapper(self, in_key, in_value): mapper function, which process a key-value pair in the data and generate intermediate key...
b083f0c28ee7ee2624b3539868b497fb82da72f3
<|skeleton|> class MatMul: """Given a matrix A and a matrix B, compute the product A*B = C (matrix multiplication)""" def mapper(self, in_key, in_value): """mapper function, which process a key-value pair in the data and generate intermediate key-value pair(s) Input: in_key: the key of a data record (i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatMul: """Given a matrix A and a matrix B, compute the product A*B = C (matrix multiplication)""" def mapper(self, in_key, in_value): """mapper function, which process a key-value pair in the data and generate intermediate key-value pair(s) Input: in_key: the key of a data record (in this exampl...
the_stack_v2_python_sparse
Homework/Homework_3/MapReduce/problem2.py
kratika1008/DS501_Introduction_To_DataScience
train
2
5bb8cdfa78315be53d1982702c1364c72f18cf35
[ "base.Widget.__init__(self)\nself._spacing = spacing\nself._columns = columns", "base.Widget.render(self, width)\nx = 0\nfor col_width, col in self._columns:\n self.setxy(0, x)\n if col_width is None:\n col_max_width = width - self.cursor[1]\n col_width = 0\n else:\n col_max_width = ...
<|body_start_0|> base.Widget.__init__(self) self._spacing = spacing self._columns = columns <|end_body_0|> <|body_start_1|> base.Widget.render(self, width) x = 0 for col_width, col in self._columns: self.setxy(0, x) if col_width is None: ...
ColumnWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnWidget: def __init__(self, columns, spacing=0): """Create text columns :param columns: list containing (column width, [list of widgets to put into this column]) :type columns: [(int, [...]), ...] :param spacing: number of spaces to use between columns :type spacing: int""" ...
stack_v2_sparse_classes_36k_train_029617
7,653
no_license
[ { "docstring": "Create text columns :param columns: list containing (column width, [list of widgets to put into this column]) :type columns: [(int, [...]), ...] :param spacing: number of spaces to use between columns :type spacing: int", "name": "__init__", "signature": "def __init__(self, columns, spac...
2
stack_v2_sparse_classes_30k_train_016156
Implement the Python class `ColumnWidget` described below. Class description: Implement the ColumnWidget class. Method signatures and docstrings: - def __init__(self, columns, spacing=0): Create text columns :param columns: list containing (column width, [list of widgets to put into this column]) :type columns: [(int...
Implement the Python class `ColumnWidget` described below. Class description: Implement the ColumnWidget class. Method signatures and docstrings: - def __init__(self, columns, spacing=0): Create text columns :param columns: list containing (column width, [list of widgets to put into this column]) :type columns: [(int...
6976d7e1d8af45b1432cbf4f1461076ca04349e0
<|skeleton|> class ColumnWidget: def __init__(self, columns, spacing=0): """Create text columns :param columns: list containing (column width, [list of widgets to put into this column]) :type columns: [(int, [...]), ...] :param spacing: number of spaces to use between columns :type spacing: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColumnWidget: def __init__(self, columns, spacing=0): """Create text columns :param columns: list containing (column width, [list of widgets to put into this column]) :type columns: [(int, [...]), ...] :param spacing: number of spaces to use between columns :type spacing: int""" base.Widget.__...
the_stack_v2_python_sparse
rootfs/usr/lib64/python2.7/site-packages/pyanaconda/ui/tui/simpleline/widgets.py
outstanding-mjy/make_rootfs
train
0
cb43760b3ed69ffd8414e0397ccf4b2895c838fb
[ "logger.info('Reading zipcodes from %s', filename)\nwith open(filename, 'r') as f:\n reader = csv.reader(f, delimiter=cls.DELIMITER)\n zipcodes = dict(((zipcode, (float(latitude), float(longitude))) for zipcode, latitude, longitude in reader))\nlogger.info('Loaded %d zipcodes', len(zipcodes))\nreturn zipcodes...
<|body_start_0|> logger.info('Reading zipcodes from %s', filename) with open(filename, 'r') as f: reader = csv.reader(f, delimiter=cls.DELIMITER) zipcodes = dict(((zipcode, (float(latitude), float(longitude))) for zipcode, latitude, longitude in reader)) logger.info('Load...
Helper class for storage of geocoded zipcode data in a CSV file. Each line in the file is: zipcode,latitude_degrees,longitude_degrees
GeocodedZipCodeCsv
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeocodedZipCodeCsv: """Helper class for storage of geocoded zipcode data in a CSV file. Each line in the file is: zipcode,latitude_degrees,longitude_degrees""" def read(cls, filename): """Returns dictionary of zipcode, (latitude, longitude) pairs.""" <|body_0|> def write...
stack_v2_sparse_classes_36k_train_029618
8,013
permissive
[ { "docstring": "Returns dictionary of zipcode, (latitude, longitude) pairs.", "name": "read", "signature": "def read(cls, filename)" }, { "docstring": "Writes series of zipcode, (latitude, longitude) pairs to file.", "name": "write", "signature": "def write(cls, f, data)" } ]
2
stack_v2_sparse_classes_30k_train_009083
Implement the Python class `GeocodedZipCodeCsv` described below. Class description: Helper class for storage of geocoded zipcode data in a CSV file. Each line in the file is: zipcode,latitude_degrees,longitude_degrees Method signatures and docstrings: - def read(cls, filename): Returns dictionary of zipcode, (latitud...
Implement the Python class `GeocodedZipCodeCsv` described below. Class description: Helper class for storage of geocoded zipcode data in a CSV file. Each line in the file is: zipcode,latitude_degrees,longitude_degrees Method signatures and docstrings: - def read(cls, filename): Returns dictionary of zipcode, (latitud...
7c63c31fd6bb95ed4f7d368f1e1252175f0c71ca
<|skeleton|> class GeocodedZipCodeCsv: """Helper class for storage of geocoded zipcode data in a CSV file. Each line in the file is: zipcode,latitude_degrees,longitude_degrees""" def read(cls, filename): """Returns dictionary of zipcode, (latitude, longitude) pairs.""" <|body_0|> def write...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeocodedZipCodeCsv: """Helper class for storage of geocoded zipcode data in a CSV file. Each line in the file is: zipcode,latitude_degrees,longitude_degrees""" def read(cls, filename): """Returns dictionary of zipcode, (latitude, longitude) pairs.""" logger.info('Reading zipcodes from %s'...
the_stack_v2_python_sparse
cfgov/housing_counselor/geocoder.py
raft-tech/cfgov-refresh
train
4
85adb625b5050f6939e0e0611478cbe599c34d21
[ "def flatten_(root):\n if not root:\n return (None, None)\n t = root\n hl, tl = flatten_(root.left)\n hr, tr = flatten_(root.right)\n if hl:\n root.right = hl\n t = tl\n if hr:\n t.right = hr\n t = tr\n root.left = None\n return (root, t)\nflatten_(root)\nr...
<|body_start_0|> def flatten_(root): if not root: return (None, None) t = root hl, tl = flatten_(root.left) hr, tr = flatten_(root.right) if hl: root.right = hl t = tl if hr: t...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, root): """05/07/2018 14:19""" <|body_0|> def flatten(self, root: TreeNode) -> None: """05/27/2021 06:25""" <|body_1|> def flatten(self, root: Optional[TreeNode]) -> None: """08/06/2022 22:42""" <|body_2|> <|en...
stack_v2_sparse_classes_36k_train_029619
3,446
no_license
[ { "docstring": "05/07/2018 14:19", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": "05/27/2021 06:25", "name": "flatten", "signature": "def flatten(self, root: TreeNode) -> None" }, { "docstring": "08/06/2022 22:42", "name": "flatten", "signatu...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): 05/07/2018 14:19 - def flatten(self, root: TreeNode) -> None: 05/27/2021 06:25 - def flatten(self, root: Optional[TreeNode]) -> None: 08/06/2022 22:42
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): 05/07/2018 14:19 - def flatten(self, root: TreeNode) -> None: 05/27/2021 06:25 - def flatten(self, root: Optional[TreeNode]) -> None: 08/06/2022 22:42 <...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def flatten(self, root): """05/07/2018 14:19""" <|body_0|> def flatten(self, root: TreeNode) -> None: """05/27/2021 06:25""" <|body_1|> def flatten(self, root: Optional[TreeNode]) -> None: """08/06/2022 22:42""" <|body_2|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten(self, root): """05/07/2018 14:19""" def flatten_(root): if not root: return (None, None) t = root hl, tl = flatten_(root.left) hr, tr = flatten_(root.right) if hl: root.right = hl ...
the_stack_v2_python_sparse
leetcode/solved/114_Flatten_Binary_Tree_to_Linked_List/solution.py
sungminoh/algorithms
train
0
95e3177b9171172f8e40d2f6ed2f224b9e553734
[ "if not vals.get('name', False):\n emp_job = self.pool.get('hr.job').read(cr, uid, vals['job_id'], ['name'], context=context)\n emp_level = self.pool.get('hr.employee.level').read(cr, uid, vals['level_id'], ['name'], context=context)\n vals['name'] = emp_job['name'] + ' ' + emp_level['name']\nreturn super(...
<|body_start_0|> if not vals.get('name', False): emp_job = self.pool.get('hr.job').read(cr, uid, vals['job_id'], ['name'], context=context) emp_level = self.pool.get('hr.employee.level').read(cr, uid, vals['level_id'], ['name'], context=context) vals['name'] = emp_job['name']...
hr_employee_grade
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hr_employee_grade: def create(self, cr, uid, vals, context=None): """Override fnct: Get grade name""" <|body_0|> def write(self, cr, uid, ids, vals, context=None): """Override fnct: Get grade name""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n...
stack_v2_sparse_classes_36k_train_029620
1,858
no_license
[ { "docstring": "Override fnct: Get grade name", "name": "create", "signature": "def create(self, cr, uid, vals, context=None)" }, { "docstring": "Override fnct: Get grade name", "name": "write", "signature": "def write(self, cr, uid, ids, vals, context=None)" } ]
2
stack_v2_sparse_classes_30k_train_003911
Implement the Python class `hr_employee_grade` described below. Class description: Implement the hr_employee_grade class. Method signatures and docstrings: - def create(self, cr, uid, vals, context=None): Override fnct: Get grade name - def write(self, cr, uid, ids, vals, context=None): Override fnct: Get grade name
Implement the Python class `hr_employee_grade` described below. Class description: Implement the hr_employee_grade class. Method signatures and docstrings: - def create(self, cr, uid, vals, context=None): Override fnct: Get grade name - def write(self, cr, uid, ids, vals, context=None): Override fnct: Get grade name ...
673dd0f2a7c0b69a984342b20f55164a97a00529
<|skeleton|> class hr_employee_grade: def create(self, cr, uid, vals, context=None): """Override fnct: Get grade name""" <|body_0|> def write(self, cr, uid, ids, vals, context=None): """Override fnct: Get grade name""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class hr_employee_grade: def create(self, cr, uid, vals, context=None): """Override fnct: Get grade name""" if not vals.get('name', False): emp_job = self.pool.get('hr.job').read(cr, uid, vals['job_id'], ['name'], context=context) emp_level = self.pool.get('hr.employee.level'...
the_stack_v2_python_sparse
addons/app-trobz-hr/__unported__/trobz_hr_payslip_parameter/model/hr_employee_grade.py
TinPlusIT05/tms
train
0
c61dab69b9537108ec2c5cb87c91beade45b4257
[ "zip = meter.buildingmetadata()['zip']\ngroup = self.buildings[grouping_variable]\nmeters = group.elec\ntimewindow = meter.metadata.get_timewindow()\nreturn meters.load(cols=variables, ignore_missing_columns=True, timewindow=timewindow)", "if isinstance(elec, MeterGroup):\n elec = elec.meters[0]\nzip = elec.bu...
<|body_start_0|> zip = meter.buildingmetadata()['zip'] group = self.buildings[grouping_variable] meters = group.elec timewindow = meter.metadata.get_timewindow() return meters.load(cols=variables, ignore_missing_columns=True, timewindow=timewindow) <|end_body_0|> <|body_start_1|...
This is just like the normal dataset but extends it by the simple functionality to detect the correct dataset for a certain metering device. Each ExternDataSet has stored in its metadata under which property its data is referencable. Eg. zip. When a meter is then handed in, it automatically determines the best dataset.
ExternDataSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternDataSet: """This is just like the normal dataset but extends it by the simple functionality to detect the correct dataset for a certain metering device. Each ExternDataSet has stored in its metadata under which property its data is referencable. Eg. zip. When a meter is then handed in, it a...
stack_v2_sparse_classes_36k_train_029621
3,630
permissive
[ { "docstring": "Returns the meter, which contains the fitting data for the building. External Data is aways related to buildings not measurements as things which are that specific that they belong to the meter would be counted as measurement data itself. AT THE MOMENT ALWAYS JUST LOOKING FOR THE FIRST THREE NUM...
3
stack_v2_sparse_classes_30k_train_000932
Implement the Python class `ExternDataSet` described below. Class description: This is just like the normal dataset but extends it by the simple functionality to detect the correct dataset for a certain metering device. Each ExternDataSet has stored in its metadata under which property its data is referencable. Eg. zi...
Implement the Python class `ExternDataSet` described below. Class description: This is just like the normal dataset but extends it by the simple functionality to detect the correct dataset for a certain metering device. Each ExternDataSet has stored in its metadata under which property its data is referencable. Eg. zi...
e9b06bcb43a40010ccc40a534a7067ee520fb3a7
<|skeleton|> class ExternDataSet: """This is just like the normal dataset but extends it by the simple functionality to detect the correct dataset for a certain metering device. Each ExternDataSet has stored in its metadata under which property its data is referencable. Eg. zip. When a meter is then handed in, it a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExternDataSet: """This is just like the normal dataset but extends it by the simple functionality to detect the correct dataset for a certain metering device. Each ExternDataSet has stored in its metadata under which property its data is referencable. Eg. zip. When a meter is then handed in, it automatically ...
the_stack_v2_python_sparse
nilmtk/externdataset.py
BaluJr/energytk
train
3
c32c42ab4926d403e45b5a49266aa218e0a646ff
[ "Process.__init__(self)\nself.rojo = array_rojo\nself.verde = array_verde\nself.azul = array_azul\nself.inicio = inicio\nself.final = final\nself.colores = colores", "max_rojo = self.colores['rojos'][0]\nmin_rojo = self.colores['rojos'][1]\nrango_rojo = max_rojo - min_rojo\nfor j in range(self.inicio, self.final)...
<|body_start_0|> Process.__init__(self) self.rojo = array_rojo self.verde = array_verde self.azul = array_azul self.inicio = inicio self.final = final self.colores = colores <|end_body_0|> <|body_start_1|> max_rojo = self.colores['rojos'][0] min_r...
Clase que hereda del objeto Process (módulo multiprocessing).
Ecualizar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ecualizar: """Clase que hereda del objeto Process (módulo multiprocessing).""" def __init__(self, array_rojo, array_verde, array_azul, inicio, final, colores): """Inicializa el objeto.""" <|body_0|> def run(self): """Código que se ejecuta al lanzar el proceso. En...
stack_v2_sparse_classes_36k_train_029622
14,973
no_license
[ { "docstring": "Inicializa el objeto.", "name": "__init__", "signature": "def __init__(self, array_rojo, array_verde, array_azul, inicio, final, colores)" }, { "docstring": "Código que se ejecuta al lanzar el proceso. En este caso, la normalización de los píxeles teniendo en cuenta los máximos y...
2
stack_v2_sparse_classes_30k_train_008019
Implement the Python class `Ecualizar` described below. Class description: Clase que hereda del objeto Process (módulo multiprocessing). Method signatures and docstrings: - def __init__(self, array_rojo, array_verde, array_azul, inicio, final, colores): Inicializa el objeto. - def run(self): Código que se ejecuta al ...
Implement the Python class `Ecualizar` described below. Class description: Clase que hereda del objeto Process (módulo multiprocessing). Method signatures and docstrings: - def __init__(self, array_rojo, array_verde, array_azul, inicio, final, colores): Inicializa el objeto. - def run(self): Código que se ejecuta al ...
bb906dcdaa39c0580f14bb6cef0956e7acd536ea
<|skeleton|> class Ecualizar: """Clase que hereda del objeto Process (módulo multiprocessing).""" def __init__(self, array_rojo, array_verde, array_azul, inicio, final, colores): """Inicializa el objeto.""" <|body_0|> def run(self): """Código que se ejecuta al lanzar el proceso. En...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ecualizar: """Clase que hereda del objeto Process (módulo multiprocessing).""" def __init__(self, array_rojo, array_verde, array_azul, inicio, final, colores): """Inicializa el objeto.""" Process.__init__(self) self.rojo = array_rojo self.verde = array_verde self.a...
the_stack_v2_python_sparse
images-equalization/ecualizador.py
nevinwu/IT-code
train
0
20688b987b561da92bdd627c61e6b0f1723f4926
[ "cache_len = 100000\nself.random_prob_cache = np.random.random(size=(cache_len,))\nself.random_prob_ptr = cache_len - 1", "value = self.random_prob_cache[self.random_prob_ptr]\nself.random_prob_ptr -= 1\nif self.random_prob_ptr == -1:\n self.reset_random_prob()\nreturn value" ]
<|body_start_0|> cache_len = 100000 self.random_prob_cache = np.random.random(size=(cache_len,)) self.random_prob_ptr = cache_len - 1 <|end_body_0|> <|body_start_1|> value = self.random_prob_cache[self.random_prob_ptr] self.random_prob_ptr -= 1 if self.random_prob_ptr ==...
A base class that generate multiple random numbers at the same time.
EfficientRandomGen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EfficientRandomGen: """A base class that generate multiple random numbers at the same time.""" def reset_random_prob(self): """Generate many random numbers at the same time and cache them.""" <|body_0|> def get_random_prob(self): """Get a random number.""" ...
stack_v2_sparse_classes_36k_train_029623
5,955
no_license
[ { "docstring": "Generate many random numbers at the same time and cache them.", "name": "reset_random_prob", "signature": "def reset_random_prob(self)" }, { "docstring": "Get a random number.", "name": "get_random_prob", "signature": "def get_random_prob(self)" } ]
2
stack_v2_sparse_classes_30k_train_021128
Implement the Python class `EfficientRandomGen` described below. Class description: A base class that generate multiple random numbers at the same time. Method signatures and docstrings: - def reset_random_prob(self): Generate many random numbers at the same time and cache them. - def get_random_prob(self): Get a ran...
Implement the Python class `EfficientRandomGen` described below. Class description: A base class that generate multiple random numbers at the same time. Method signatures and docstrings: - def reset_random_prob(self): Generate many random numbers at the same time and cache them. - def get_random_prob(self): Get a ran...
65d0c023f9a6be96b7f607b7558ecab0765f43a0
<|skeleton|> class EfficientRandomGen: """A base class that generate multiple random numbers at the same time.""" def reset_random_prob(self): """Generate many random numbers at the same time and cache them.""" <|body_0|> def get_random_prob(self): """Get a random number.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EfficientRandomGen: """A base class that generate multiple random numbers at the same time.""" def reset_random_prob(self): """Generate many random numbers at the same time and cache them.""" cache_len = 100000 self.random_prob_cache = np.random.random(size=(cache_len,)) s...
the_stack_v2_python_sparse
trans_event_extraction/language_classification/text_augment.py
xiaojie2018/nlp_study
train
4
71dcb7af8b505d5860e919f76f88f5855927a0e7
[ "if not headA or not headB:\n return None\nnodeA, nodeB = (headA, headB)\nl1, l2 = (0, 0)\nwhile nodeA:\n l1 += 1\n nodeA = nodeA.next\nwhile nodeB:\n l2 += 1\n nodeB = nodeB.next\nwhile l1 > l2:\n l2 += 1\n headA = headA.next\nwhile l2 > l1:\n l1 += 1\n headB = headB.next\nwhile headA an...
<|body_start_0|> if not headA or not headB: return None nodeA, nodeB = (headA, headB) l1, l2 = (0, 0) while nodeA: l1 += 1 nodeA = nodeA.next while nodeB: l2 += 1 nodeB = nodeB.next while l1 > l2: l2 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_029624
1,478
permissive
[ { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode2", "signature": "def getIntersectionNo...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
577c0225b1d4aff091d60489920f3a95afb660bd
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" if not headA or not headB: return None nodeA, nodeB = (headA, headB) l1, l2 = (0, 0) while nodeA: l1 += 1 nodeA = nodeA.next ...
the_stack_v2_python_sparse
leetcode/0-250/154-160. Intersection of Two Linked Lists.py
nurnisi/algorithms-and-data-structures
train
26
12d6cc0e7a4280815de75540f0745b3aa4a4ec77
[ "follow_cache = {}\nfor cur in graph:\n self.process(cur, follow_cache)\nreturn [node for node, _ in sorted(follow_cache.iteritems(), key=lambda x: -x[1])]", "if cur in follow_cache:\n return follow_cache[cur]\nfollow = 0\nfor n in cur.neighbors:\n follow = max(follow, self.process(n, follow_cache))\nfol...
<|body_start_0|> follow_cache = {} for cur in graph: self.process(cur, follow_cache) return [node for node, _ in sorted(follow_cache.iteritems(), key=lambda x: -x[1])] <|end_body_0|> <|body_start_1|> if cur in follow_cache: return follow_cache[cur] follow...
@param graph: A list of Directed graph node @return: Any topological order for the given graph.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """@param graph: A list of Directed graph node @return: Any topological order for the given graph.""" def topSort(self, graph): """傻缓存最大深度""" <|body_0|> def process(self, cur, follow_cache): """当前来到cur点,请返回cur点所到之处,所有的点次! follow_cache 缓存 key : 某一个点的点次,之...
stack_v2_sparse_classes_36k_train_029625
1,426
no_license
[ { "docstring": "傻缓存最大深度", "name": "topSort", "signature": "def topSort(self, graph)" }, { "docstring": "当前来到cur点,请返回cur点所到之处,所有的点次! follow_cache 缓存 key : 某一个点的点次,之前算过了, value : 最大深度", "name": "process", "signature": "def process(self, cur, follow_cache)" } ]
2
stack_v2_sparse_classes_30k_train_016118
Implement the Python class `Solution` described below. Class description: @param graph: A list of Directed graph node @return: Any topological order for the given graph. Method signatures and docstrings: - def topSort(self, graph): 傻缓存最大深度 - def process(self, cur, follow_cache): 当前来到cur点,请返回cur点所到之处,所有的点次! follow_cac...
Implement the Python class `Solution` described below. Class description: @param graph: A list of Directed graph node @return: Any topological order for the given graph. Method signatures and docstrings: - def topSort(self, graph): 傻缓存最大深度 - def process(self, cur, follow_cache): 当前来到cur点,请返回cur点所到之处,所有的点次! follow_cac...
429aa7916ec5196737ae53a1ddfefb38d432f052
<|skeleton|> class Solution: """@param graph: A list of Directed graph node @return: Any topological order for the given graph.""" def topSort(self, graph): """傻缓存最大深度""" <|body_0|> def process(self, cur, follow_cache): """当前来到cur点,请返回cur点所到之处,所有的点次! follow_cache 缓存 key : 某一个点的点次,之...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """@param graph: A list of Directed graph node @return: Any topological order for the given graph.""" def topSort(self, graph): """傻缓存最大深度""" follow_cache = {} for cur in graph: self.process(cur, follow_cache) return [node for node, _ in sorted(follow...
the_stack_v2_python_sparse
Python2/class16/Code03_TopologicalOrderDFS1.py
shi0524/algorithmbasic2020_python
train
0
185752dc8c9f2c2df4ff599f4e0f22b79474a0ae
[ "super().__init__()\nself.max_area_only = max_area_only\nself.use_rotated_box = use_rotated_box", "mask_expand = mask.copy()\ncontours, _ = cv2.findContours(mask_expand, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)\napprox_curve = []\nif self.max_area_only:\n contour_areas = [cv2.contourArea(contour) for contour ...
<|body_start_0|> super().__init__() self.max_area_only = max_area_only self.use_rotated_box = use_rotated_box <|end_body_0|> <|body_start_1|> mask_expand = mask.copy() contours, _ = cv2.findContours(mask_expand, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) approx_curve = []...
Get the contour of the mask area and format output.
PostMaskRCNNSpot
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostMaskRCNNSpot: """Get the contour of the mask area and format output.""" def __init__(self, max_area_only=True, use_rotated_box=False): """Args: max_area_only (boolean): whether to consider only one (maximum) region in each proposal regions. use_rotated_box (boolean): whether to u...
stack_v2_sparse_classes_36k_train_029626
4,785
permissive
[ { "docstring": "Args: max_area_only (boolean): whether to consider only one (maximum) region in each proposal regions. use_rotated_box (boolean): whether to use minAreaRect to represent text regions (or use contour polygon)", "name": "__init__", "signature": "def __init__(self, max_area_only=True, use_r...
3
stack_v2_sparse_classes_30k_train_005877
Implement the Python class `PostMaskRCNNSpot` described below. Class description: Get the contour of the mask area and format output. Method signatures and docstrings: - def __init__(self, max_area_only=True, use_rotated_box=False): Args: max_area_only (boolean): whether to consider only one (maximum) region in each ...
Implement the Python class `PostMaskRCNNSpot` described below. Class description: Get the contour of the mask area and format output. Method signatures and docstrings: - def __init__(self, max_area_only=True, use_rotated_box=False): Args: max_area_only (boolean): whether to consider only one (maximum) region in each ...
fb47a96d1a38f5ce634c6f12d710ed5300cc89fc
<|skeleton|> class PostMaskRCNNSpot: """Get the contour of the mask area and format output.""" def __init__(self, max_area_only=True, use_rotated_box=False): """Args: max_area_only (boolean): whether to consider only one (maximum) region in each proposal regions. use_rotated_box (boolean): whether to u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostMaskRCNNSpot: """Get the contour of the mask area and format output.""" def __init__(self, max_area_only=True, use_rotated_box=False): """Args: max_area_only (boolean): whether to consider only one (maximum) region in each proposal regions. use_rotated_box (boolean): whether to use minAreaRec...
the_stack_v2_python_sparse
davarocr/davarocr/davar_spotting/core/post_processing/post_mask_rcnn_spot.py
OCRWorld/DAVAR-Lab-OCR
train
0
ecf8987c17870b9818691d5a1434b9bb6c143743
[ "article = Article.objects.filter(pk=article_id, is_deleted=False).first()\nif not article:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\nif article.status == 'draft':\n me = self.get_user_profile(request)\n if not me:\n return self.error(errorcode.MSG_LOGIN_REQUIRED, errorcode.LOGI...
<|body_start_0|> article = Article.objects.filter(pk=article_id, is_deleted=False).first() if not article: return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA) if article.status == 'draft': me = self.get_user_profile(request) if not me: ...
ArticleDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleDetailView: def get(self, request, article_id): """查看文章详情,只有作者能查看草稿""" <|body_0|> def delete(self, request, article_id): """删除文章""" <|body_1|> <|end_skeleton|> <|body_start_0|> article = Article.objects.filter(pk=article_id, is_deleted=False)...
stack_v2_sparse_classes_36k_train_029627
12,861
no_license
[ { "docstring": "查看文章详情,只有作者能查看草稿", "name": "get", "signature": "def get(self, request, article_id)" }, { "docstring": "删除文章", "name": "delete", "signature": "def delete(self, request, article_id)" } ]
2
stack_v2_sparse_classes_30k_train_013669
Implement the Python class `ArticleDetailView` described below. Class description: Implement the ArticleDetailView class. Method signatures and docstrings: - def get(self, request, article_id): 查看文章详情,只有作者能查看草稿 - def delete(self, request, article_id): 删除文章
Implement the Python class `ArticleDetailView` described below. Class description: Implement the ArticleDetailView class. Method signatures and docstrings: - def get(self, request, article_id): 查看文章详情,只有作者能查看草稿 - def delete(self, request, article_id): 删除文章 <|skeleton|> class ArticleDetailView: def get(self, req...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class ArticleDetailView: def get(self, request, article_id): """查看文章详情,只有作者能查看草稿""" <|body_0|> def delete(self, request, article_id): """删除文章""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArticleDetailView: def get(self, request, article_id): """查看文章详情,只有作者能查看草稿""" article = Article.objects.filter(pk=article_id, is_deleted=False).first() if not article: return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA) if article.status == 'draft': ...
the_stack_v2_python_sparse
apps/articles/views.py
Slowhalfframe/fanyijiang-API
train
0
790ef45e98a17ae5eed75659957cbd47a09b95dc
[ "if isinstance(key, int):\n return LinkType(key)\nif key not in LinkType._member_map_:\n return extend_enum(LinkType, key, default)\nreturn LinkType[key]", "if not (isinstance(value, int) and 0 <= value <= 4294967295):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nreturn extend_enum...
<|body_start_0|> if isinstance(key, int): return LinkType(key) if key not in LinkType._member_map_: return extend_enum(LinkType, key, default) return LinkType[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 4294967295): ...
[LinkType] Link-Layer Header Type Values
LinkType
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkType: """[LinkType] Link-Layer Header Type Values""" def get(key: 'int | str', default: 'int'=-1) -> 'LinkType': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def _missing_(c...
stack_v2_sparse_classes_36k_train_029628
37,484
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'LinkType'" }, { "docstring": "Lookup function used when value is not found. Ar...
2
null
Implement the Python class `LinkType` described below. Class description: [LinkType] Link-Layer Header Type Values Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'LinkType': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. ...
Implement the Python class `LinkType` described below. Class description: [LinkType] Link-Layer Header Type Values Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'LinkType': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. ...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class LinkType: """[LinkType] Link-Layer Header Type Values""" def get(key: 'int | str', default: 'int'=-1) -> 'LinkType': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def _missing_(c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkType: """[LinkType] Link-Layer Header Type Values""" def get(key: 'int | str', default: 'int'=-1) -> 'LinkType': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int): return ...
the_stack_v2_python_sparse
pcapkit/const/reg/linktype.py
JarryShaw/PyPCAPKit
train
204
194b6d27a9aead13a53161b098f6ec5ed6f26cec
[ "self.config = configuration_data\nself.sections = list(self.config.keys())\nself.jobs: Dict[str, Job] = {}\nself.lists: Dict[str, Dict[str, str]] = {}\nself.custom_packs: Dict[str, Pack] = {}\nself.marketplace_packs: Dict[str, Pack] = {}\nself.integration_instances: Dict[str, IntegrationInstance] = {}\nself.load_j...
<|body_start_0|> self.config = configuration_data self.sections = list(self.config.keys()) self.jobs: Dict[str, Job] = {} self.lists: Dict[str, Dict[str, str]] = {} self.custom_packs: Dict[str, Pack] = {} self.marketplace_packs: Dict[str, Pack] = {} self.integrati...
Configuration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configuration: def __init__(self, configuration_data: Dict): """Configuration object for the configuration file. Args: configuration_data (Dict): The configuration data parsed from the configuration file.""" <|body_0|> def load_custom_packs(self) -> None: """Iterates...
stack_v2_sparse_classes_36k_train_029629
10,020
permissive
[ { "docstring": "Configuration object for the configuration file. Args: configuration_data (Dict): The configuration data parsed from the configuration file.", "name": "__init__", "signature": "def __init__(self, configuration_data: Dict)" }, { "docstring": "Iterates through the Packs sections an...
6
null
Implement the Python class `Configuration` described below. Class description: Implement the Configuration class. Method signatures and docstrings: - def __init__(self, configuration_data: Dict): Configuration object for the configuration file. Args: configuration_data (Dict): The configuration data parsed from the c...
Implement the Python class `Configuration` described below. Class description: Implement the Configuration class. Method signatures and docstrings: - def __init__(self, configuration_data: Dict): Configuration object for the configuration file. Args: configuration_data (Dict): The configuration data parsed from the c...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class Configuration: def __init__(self, configuration_data: Dict): """Configuration object for the configuration file. Args: configuration_data (Dict): The configuration data parsed from the configuration file.""" <|body_0|> def load_custom_packs(self) -> None: """Iterates...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Configuration: def __init__(self, configuration_data: Dict): """Configuration object for the configuration file. Args: configuration_data (Dict): The configuration data parsed from the configuration file.""" self.config = configuration_data self.sections = list(self.config.keys()) ...
the_stack_v2_python_sparse
Packs/ContentManagement/Scripts/ConfigurationSetup/ConfigurationSetup.py
demisto/content
train
1,023
ab1d8f0e6ce58038a646e462bc58ae2ec5083286
[ "self._callback = callback\nself._creds = {'principal': principal, 'type': 'creds_v1.0'}\nif auth_scheme == 'mac':\n self._creds['mac'] = {'mac_key_identifier': mac.MACKeyIdentifier.generate(), 'mac_key': mac.MACKey.generate(), 'mac_algorithm': mac.MAC.algorithm}\nelse:\n self._creds['basic'] = {'api_key': ba...
<|body_start_0|> self._callback = callback self._creds = {'principal': principal, 'type': 'creds_v1.0'} if auth_scheme == 'mac': self._creds['mac'] = {'mac_key_identifier': mac.MACKeyIdentifier.generate(), 'mac_key': mac.MACKey.generate(), 'mac_algorithm': mac.MAC.algorithm} ...
```AsyncCredsCreator``` implements the async action pattern for creating credentials.
AsyncCredsCreator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncCredsCreator: """```AsyncCredsCreator``` implements the async action pattern for creating credentials.""" def create(self, principal, auth_scheme, callback): """Create a set of credentials for ```principal```, save the credentials to the key store and when all of that is done ca...
stack_v2_sparse_classes_36k_train_029630
1,938
permissive
[ { "docstring": "Create a set of credentials for ```principal```, save the credentials to the key store and when all of that is done call ```callback``` with a single argument = the newly created credentials. If ```auth_scheme``` equals 'mac' credentials for an MAC authentication scheme are created otherwise cre...
2
stack_v2_sparse_classes_30k_val_000131
Implement the Python class `AsyncCredsCreator` described below. Class description: ```AsyncCredsCreator``` implements the async action pattern for creating credentials. Method signatures and docstrings: - def create(self, principal, auth_scheme, callback): Create a set of credentials for ```principal```, save the cre...
Implement the Python class `AsyncCredsCreator` described below. Class description: ```AsyncCredsCreator``` implements the async action pattern for creating credentials. Method signatures and docstrings: - def create(self, principal, auth_scheme, callback): Create a set of credentials for ```principal```, save the cre...
1e09147b9ae0176f6c26a9eda119230802662830
<|skeleton|> class AsyncCredsCreator: """```AsyncCredsCreator``` implements the async action pattern for creating credentials.""" def create(self, principal, auth_scheme, callback): """Create a set of credentials for ```principal```, save the credentials to the key store and when all of that is done ca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsyncCredsCreator: """```AsyncCredsCreator``` implements the async action pattern for creating credentials.""" def create(self, principal, auth_scheme, callback): """Create a set of credentials for ```principal```, save the credentials to the key store and when all of that is done call ```callbac...
the_stack_v2_python_sparse
yar/key_service/async_creds_creator.py
simonsdave/yar
train
0
d8af31a9b93ae2105cee8fac2f9837f4640f559c
[ "self.capacity = capacity\nself.stacks = []\nself.q = []", "while self.q and self.q[0] < len(self.stacks) and (len(self.stacks[self.q[0]]) == self.capacity):\n heapq.heappop(self.q)\nif not self.q:\n heapq.heappush(self.q, len(self.stacks))\nif self.q[0] == len(self.stacks):\n self.stacks.append([])\nsel...
<|body_start_0|> self.capacity = capacity self.stacks = [] self.q = [] <|end_body_0|> <|body_start_1|> while self.q and self.q[0] < len(self.stacks) and (len(self.stacks[self.q[0]]) == self.capacity): heapq.heappop(self.q) if not self.q: heapq.heappush(se...
DinnerPlates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def push(self, val): """:type val: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def popAtStack(self, index): """:t...
stack_v2_sparse_classes_36k_train_029631
1,958
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type val: int :rtype: None", "name": "push", "signature": "def push(self, val)" }, { "docstring": ":rtype: int", "name": "pop", "signature": "def pop(...
4
null
Implement the Python class `DinnerPlates` described below. Class description: Implement the DinnerPlates class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def push(self, val): :type val: int :rtype: None - def pop(self): :rtype: int - def popAtStack(self, index): :type ind...
Implement the Python class `DinnerPlates` described below. Class description: Implement the DinnerPlates class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def push(self, val): :type val: int :rtype: None - def pop(self): :rtype: int - def popAtStack(self, index): :type ind...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def push(self, val): """:type val: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def popAtStack(self, index): """:t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.stacks = [] self.q = [] def push(self, val): """:type val: int :rtype: None""" while self.q and self.q[0] < len(self.stacks) and (len(self.stacks[self.q[0]])...
the_stack_v2_python_sparse
字节/餐盘栈.py
2226171237/Algorithmpractice
train
0
45fd979c1c67288958ca14a0b5be7f2a81dfbcce
[ "chat_id = self.env.context.get('active_id', False)\nding_chat = self.env['dingding.chat'].browse(chat_id)\nurl = self.env['ali.dindin.system.conf'].search([('key', '=', 'chat_send')]).value\ntoken = self.env['ali.dindin.system.conf'].search([('key', '=', 'token')]).value\ndata = {'chatid': ding_chat.chat_id, 'msg'...
<|body_start_0|> chat_id = self.env.context.get('active_id', False) ding_chat = self.env['dingding.chat'].browse(chat_id) url = self.env['ali.dindin.system.conf'].search([('key', '=', 'chat_send')]).value token = self.env['ali.dindin.system.conf'].search([('key', '=', 'token')]).value ...
DingDingSendChatMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DingDingSendChatMessage: def send_dingding_test_message(self): """点击群会话发送群消息按钮 :return:""" <|body_0|> def send_message(self, ding_chat, body): """发送群会话消息 :return:""" <|body_1|> def send_work_message(self, userstr, message): """发送工作消息到指定员工列表 :para...
stack_v2_sparse_classes_36k_train_029632
22,701
permissive
[ { "docstring": "点击群会话发送群消息按钮 :return:", "name": "send_dingding_test_message", "signature": "def send_dingding_test_message(self)" }, { "docstring": "发送群会话消息 :return:", "name": "send_message", "signature": "def send_message(self, ding_chat, body)" }, { "docstring": "发送工作消息到指定员工列表 ...
3
stack_v2_sparse_classes_30k_train_004069
Implement the Python class `DingDingSendChatMessage` described below. Class description: Implement the DingDingSendChatMessage class. Method signatures and docstrings: - def send_dingding_test_message(self): 点击群会话发送群消息按钮 :return: - def send_message(self, ding_chat, body): 发送群会话消息 :return: - def send_work_message(self...
Implement the Python class `DingDingSendChatMessage` described below. Class description: Implement the DingDingSendChatMessage class. Method signatures and docstrings: - def send_dingding_test_message(self): 点击群会话发送群消息按钮 :return: - def send_message(self, ding_chat, body): 发送群会话消息 :return: - def send_work_message(self...
deaf38151d022a621096e84c8495b1a51265a991
<|skeleton|> class DingDingSendChatMessage: def send_dingding_test_message(self): """点击群会话发送群消息按钮 :return:""" <|body_0|> def send_message(self, ding_chat, body): """发送群会话消息 :return:""" <|body_1|> def send_work_message(self, userstr, message): """发送工作消息到指定员工列表 :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DingDingSendChatMessage: def send_dingding_test_message(self): """点击群会话发送群消息按钮 :return:""" chat_id = self.env.context.get('active_id', False) ding_chat = self.env['dingding.chat'].browse(chat_id) url = self.env['ali.dindin.system.conf'].search([('key', '=', 'chat_send')]).value...
the_stack_v2_python_sparse
dindin_message/models/dingding_chat.py
007gzs/odooDingDing
train
2
c5990096f3b4ed3aabb1da476f06adc2f1488199
[ "self.filename = filename\nself.imaname = os.path.basename(filename[:filename.rfind('.')])\nself.imgHDU = self._makeImgHDU(self.filename, self.imaname)", "imgHDU = None\nfitsHDU = pyfits.open(filename, 'update')\nindex = 0\nfor HDU in fitsHDU:\n if HDU.data != None:\n HDU.header['IMANAME'] = imaname\n ...
<|body_start_0|> self.filename = filename self.imaname = os.path.basename(filename[:filename.rfind('.')]) self.imgHDU = self._makeImgHDU(self.filename, self.imaname) <|end_body_0|> <|body_start_1|> imgHDU = None fitsHDU = pyfits.open(filename, 'update') index = 0 ...
Class for one image template
ArtImage
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArtImage: """Class for one image template""" def __init__(self, filename): """Initializer for the class @param filename: name of the spectrum @type filename: string""" <|body_0|> def _makeImgHDU(self, filename, imaname): """Extract and return the first non-empty ...
stack_v2_sparse_classes_36k_train_029633
6,339
permissive
[ { "docstring": "Initializer for the class @param filename: name of the spectrum @type filename: string", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Extract and return the first non-empty image HDU from the fits The method opens a fits image and goes along ...
3
null
Implement the Python class `ArtImage` described below. Class description: Class for one image template Method signatures and docstrings: - def __init__(self, filename): Initializer for the class @param filename: name of the spectrum @type filename: string - def _makeImgHDU(self, filename, imaname): Extract and return...
Implement the Python class `ArtImage` described below. Class description: Class for one image template Method signatures and docstrings: - def __init__(self, filename): Initializer for the class @param filename: name of the spectrum @type filename: string - def _makeImgHDU(self, filename, imaname): Extract and return...
043c173fd5497c18c2b1bfe8bcff65180bca3996
<|skeleton|> class ArtImage: """Class for one image template""" def __init__(self, filename): """Initializer for the class @param filename: name of the spectrum @type filename: string""" <|body_0|> def _makeImgHDU(self, filename, imaname): """Extract and return the first non-empty ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArtImage: """Class for one image template""" def __init__(self, filename): """Initializer for the class @param filename: name of the spectrum @type filename: string""" self.filename = filename self.imaname = os.path.basename(filename[:filename.rfind('.')]) self.imgHDU = se...
the_stack_v2_python_sparse
stsdas/pkg/analysis/slitless/axe/axesrc/templateimages.py
spacetelescope/stsdas_stripped
train
1
23f1df6b2ef8eca1c99d6ce8d8f44d77a86cdf89
[ "if not structure.is_ordered:\n raise ValueError('JARVIS Atoms only supports ordered structures')\nif not jarvis_loaded:\n raise ImportError('JarvisAtomsAdaptor requires jarvis-tools package.\\nUse `pip install -U jarvis-tools`')\nelements = [str(site.specie.symbol) for site in structure]\ncoords = [site.frac...
<|body_start_0|> if not structure.is_ordered: raise ValueError('JARVIS Atoms only supports ordered structures') if not jarvis_loaded: raise ImportError('JarvisAtomsAdaptor requires jarvis-tools package.\nUse `pip install -U jarvis-tools`') elements = [str(site.specie.symb...
Adaptor serves as a bridge between JARVIS Atoms and pymatgen objects.
JarvisAtomsAdaptor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JarvisAtomsAdaptor: """Adaptor serves as a bridge between JARVIS Atoms and pymatgen objects.""" def get_atoms(structure): """Returns JARVIS Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure Returns: JARVIS Atoms object""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_029634
1,720
permissive
[ { "docstring": "Returns JARVIS Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure Returns: JARVIS Atoms object", "name": "get_atoms", "signature": "def get_atoms(structure)" }, { "docstring": "Returns pymatgen structure from JARVIS Atoms. Args: atoms: JARVIS...
2
stack_v2_sparse_classes_30k_train_020858
Implement the Python class `JarvisAtomsAdaptor` described below. Class description: Adaptor serves as a bridge between JARVIS Atoms and pymatgen objects. Method signatures and docstrings: - def get_atoms(structure): Returns JARVIS Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structur...
Implement the Python class `JarvisAtomsAdaptor` described below. Class description: Adaptor serves as a bridge between JARVIS Atoms and pymatgen objects. Method signatures and docstrings: - def get_atoms(structure): Returns JARVIS Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structur...
cc0b7b4aee40287ceb1a2b547e8f8ff74b98eee5
<|skeleton|> class JarvisAtomsAdaptor: """Adaptor serves as a bridge between JARVIS Atoms and pymatgen objects.""" def get_atoms(structure): """Returns JARVIS Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure Returns: JARVIS Atoms object""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JarvisAtomsAdaptor: """Adaptor serves as a bridge between JARVIS Atoms and pymatgen objects.""" def get_atoms(structure): """Returns JARVIS Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure Returns: JARVIS Atoms object""" if not structure.is_ordered:...
the_stack_v2_python_sparse
pymatgen/io/jarvis.py
mattmcdermott/pymatgen
train
1
f1de54cc7267c85685d6c233c784a6a85cc91fce
[ "self._logger = logger\nself._api_client = api_client\nself._project_manager = project_manager\nself._project_config_manager = project_config_manager\nself._last_file = None", "projects_to_push = sorted(projects_to_push)\ncloud_projects = self._api_client.projects.get_all()\nfor index, project in enumerate(projec...
<|body_start_0|> self._logger = logger self._api_client = api_client self._project_manager = project_manager self._project_config_manager = project_config_manager self._last_file = None <|end_body_0|> <|body_start_1|> projects_to_push = sorted(projects_to_push) c...
The PushManager class is responsible for synchronizing local projects to the cloud.
PushManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushManager: """The PushManager class is responsible for synchronizing local projects to the cloud.""" def __init__(self, logger: Logger, api_client: APIClient, project_manager: ProjectManager, project_config_manager: ProjectConfigManager) -> None: """Creates a new PushManager instan...
stack_v2_sparse_classes_36k_train_029635
7,506
permissive
[ { "docstring": "Creates a new PushManager instance. :param logger: the logger to use when printing messages :param api_client: the APIClient instance to use when communicating with the cloud :param project_manager: the ProjectManager to use when looking for certain projects :param project_config_manager: the Pr...
5
null
Implement the Python class `PushManager` described below. Class description: The PushManager class is responsible for synchronizing local projects to the cloud. Method signatures and docstrings: - def __init__(self, logger: Logger, api_client: APIClient, project_manager: ProjectManager, project_config_manager: Projec...
Implement the Python class `PushManager` described below. Class description: The PushManager class is responsible for synchronizing local projects to the cloud. Method signatures and docstrings: - def __init__(self, logger: Logger, api_client: APIClient, project_manager: ProjectManager, project_config_manager: Projec...
c1051bd3e8851ae96f6e84f608a7116b1689c9e9
<|skeleton|> class PushManager: """The PushManager class is responsible for synchronizing local projects to the cloud.""" def __init__(self, logger: Logger, api_client: APIClient, project_manager: ProjectManager, project_config_manager: ProjectConfigManager) -> None: """Creates a new PushManager instan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PushManager: """The PushManager class is responsible for synchronizing local projects to the cloud.""" def __init__(self, logger: Logger, api_client: APIClient, project_manager: ProjectManager, project_config_manager: ProjectConfigManager) -> None: """Creates a new PushManager instance. :param lo...
the_stack_v2_python_sparse
lean/components/cloud/push_manager.py
xdpknx/lean-cli
train
0
3f9034bea459ef6a7774ada1ec7908ea3685705a
[ "WeatherStation.__init__(self, *args, **kwargs)\nself.filename = filename\nself.time = time\nself.timezone = None if timezone is None else pytz.timezone(timezone)\nself.columns = columns\nself.separator = separator", "for field, typ in self.columns.items():\n if 'name' in typ and 'unit' in typ:\n sensor...
<|body_start_0|> WeatherStation.__init__(self, *args, **kwargs) self.filename = filename self.time = time self.timezone = None if timezone is None else pytz.timezone(timezone) self.columns = columns self.separator = separator <|end_body_0|> <|body_start_1|> for f...
The CSV weather station reads current weather information from a CSV file.
CSV
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSV: """The CSV weather station reads current weather information from a CSV file.""" def __init__(self, filename: str, columns: dict, time: int=0, timezone: str=None, separator: str=',', *args, **kwargs): """Creates a new weather station that reads its data from a CSV file. A typica...
stack_v2_sparse_classes_36k_train_029636
4,995
no_license
[ { "docstring": "Creates a new weather station that reads its data from a CSV file. A typical JSON configuration for this weather station might look like this: | { | \"filename\": \"/wetter/wento/wento_log.txt\", | \"time\": 0, | \"columns\": { | \"2\": {\"code\": \"temp\", \"name\": \"Temperature\", \"unit\": \...
4
stack_v2_sparse_classes_30k_train_020989
Implement the Python class `CSV` described below. Class description: The CSV weather station reads current weather information from a CSV file. Method signatures and docstrings: - def __init__(self, filename: str, columns: dict, time: int=0, timezone: str=None, separator: str=',', *args, **kwargs): Creates a new weat...
Implement the Python class `CSV` described below. Class description: The CSV weather station reads current weather information from a CSV file. Method signatures and docstrings: - def __init__(self, filename: str, columns: dict, time: int=0, timezone: str=None, separator: str=',', *args, **kwargs): Creates a new weat...
f375dc77878ab7c6ee306401c6501237d1521610
<|skeleton|> class CSV: """The CSV weather station reads current weather information from a CSV file.""" def __init__(self, filename: str, columns: dict, time: int=0, timezone: str=None, separator: str=',', *args, **kwargs): """Creates a new weather station that reads its data from a CSV file. A typica...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSV: """The CSV weather station reads current weather information from a CSV file.""" def __init__(self, filename: str, columns: dict, time: int=0, timezone: str=None, separator: str=',', *args, **kwargs): """Creates a new weather station that reads its data from a CSV file. A typical JSON config...
the_stack_v2_python_sparse
pyobs_weather/weather/stations/csv.py
pyobs/pyobs-weather
train
0
d39823a34feae34742e57b0e0c6eda887490b684
[ "n = len(s)\nwordDict = set(wordDict)\nD = [None] * n\n\ndef helper(idx):\n if idx == len(s):\n return True\n if idx > len(s):\n return False\n if D[idx] != None:\n return D[idx]\n D[idx] = False\n for i in xrange(idx + 1, len(s) + 1):\n if s[idx:i] in wordDict and helper(...
<|body_start_0|> n = len(s) wordDict = set(wordDict) D = [None] * n def helper(idx): if idx == len(s): return True if idx > len(s): return False if D[idx] != None: return D[idx] D[idx] = Fals...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> def wordBreak(self, s, wordDict): ...
stack_v2_sparse_classes_36k_train_029637
1,882
no_license
[ { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" }, { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" }, ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - de...
3a7f20f79281fcaedb10696723dcb39c816ce258
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> def wordBreak(self, s, wordDict): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" n = len(s) wordDict = set(wordDict) D = [None] * n def helper(idx): if idx == len(s): return True if idx > len(s): ...
the_stack_v2_python_sparse
139_word_break.py
haohanz/Leetcode-Solution
train
1
b197dcd77ba18449e04ba06d7b33c0ca6da10a1f
[ "context = req.environ[wsgi.CONTEXT_KEY]\nvolume_type = models.VolumeType.load(id, context=context)\nreturn wsgi.Result(views.VolumeTypeView(volume_type, req).data(), 200)", "context = req.environ[wsgi.CONTEXT_KEY]\nvolume_types = models.VolumeTypes(context=context)\nreturn wsgi.Result(views.VolumeTypesView(volum...
<|body_start_0|> context = req.environ[wsgi.CONTEXT_KEY] volume_type = models.VolumeType.load(id, context=context) return wsgi.Result(views.VolumeTypeView(volume_type, req).data(), 200) <|end_body_0|> <|body_start_1|> context = req.environ[wsgi.CONTEXT_KEY] volume_types = models...
A controller for the Cinder Volume Types functionality.
VolumeTypesController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VolumeTypesController: """A controller for the Cinder Volume Types functionality.""" def show(self, req, tenant_id, id): """Return a single volume type.""" <|body_0|> def index(self, req, tenant_id): """Return all volume types.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_029638
1,437
permissive
[ { "docstring": "Return a single volume type.", "name": "show", "signature": "def show(self, req, tenant_id, id)" }, { "docstring": "Return all volume types.", "name": "index", "signature": "def index(self, req, tenant_id)" } ]
2
stack_v2_sparse_classes_30k_train_008607
Implement the Python class `VolumeTypesController` described below. Class description: A controller for the Cinder Volume Types functionality. Method signatures and docstrings: - def show(self, req, tenant_id, id): Return a single volume type. - def index(self, req, tenant_id): Return all volume types.
Implement the Python class `VolumeTypesController` described below. Class description: A controller for the Cinder Volume Types functionality. Method signatures and docstrings: - def show(self, req, tenant_id, id): Return a single volume type. - def index(self, req, tenant_id): Return all volume types. <|skeleton|> ...
2d301d0a21863c6c0fbb9e854c7eb8ad8f19bbc1
<|skeleton|> class VolumeTypesController: """A controller for the Cinder Volume Types functionality.""" def show(self, req, tenant_id, id): """Return a single volume type.""" <|body_0|> def index(self, req, tenant_id): """Return all volume types.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VolumeTypesController: """A controller for the Cinder Volume Types functionality.""" def show(self, req, tenant_id, id): """Return a single volume type.""" context = req.environ[wsgi.CONTEXT_KEY] volume_type = models.VolumeType.load(id, context=context) return wsgi.Result(...
the_stack_v2_python_sparse
trove/volume_type/service.py
phunv-bka/trove
train
1
d5a6b6a8a8df0ae39b7386884723d6489b5e9c55
[ "transactions = get_all_transactions()\nif not transactions:\n api.abort(417)\nelse:\n return (transactions, 200)", "data = request.json\nfeedback = save_new_transaction(data=data)\nif not feedback.get('error', None):\n response_object = {'status': 'success', 'message': 'Transaction Successfully', 'body'...
<|body_start_0|> transactions = get_all_transactions() if not transactions: api.abort(417) else: return (transactions, 200) <|end_body_0|> <|body_start_1|> data = request.json feedback = save_new_transaction(data=data) if not feedback.get('error',...
TransactionList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransactionList: def get(self): """get all transaction history""" <|body_0|> def post(self): """transfer funds from one wallet to another""" <|body_1|> <|end_skeleton|> <|body_start_0|> transactions = get_all_transactions() if not transactio...
stack_v2_sparse_classes_36k_train_029639
1,841
no_license
[ { "docstring": "get all transaction history", "name": "get", "signature": "def get(self)" }, { "docstring": "transfer funds from one wallet to another", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_005047
Implement the Python class `TransactionList` described below. Class description: Implement the TransactionList class. Method signatures and docstrings: - def get(self): get all transaction history - def post(self): transfer funds from one wallet to another
Implement the Python class `TransactionList` described below. Class description: Implement the TransactionList class. Method signatures and docstrings: - def get(self): get all transaction history - def post(self): transfer funds from one wallet to another <|skeleton|> class TransactionList: def get(self): ...
8ff4a78856f187f6ff975a4a8a312f28a1d3e361
<|skeleton|> class TransactionList: def get(self): """get all transaction history""" <|body_0|> def post(self): """transfer funds from one wallet to another""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransactionList: def get(self): """get all transaction history""" transactions = get_all_transactions() if not transactions: api.abort(417) else: return (transactions, 200) def post(self): """transfer funds from one wallet to another""" ...
the_stack_v2_python_sparse
app/main/controller/transaction_controller.py
Greyacey/RichVest
train
0
7c511a6602f391e3bffb9781f6f1a91ddf583559
[ "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn ...
<|body_start_0|> if x is None or x == 'None': return False return True <|end_body_0|> <|body_start_1|> if x is None or x == 'None': return False return True <|end_body_1|> <|body_start_2|> if x is None or x == 'None': return False ret...
MDF_Unit_validator_nonstandard_geocodes
[ "LicenseRef-scancode-public-domain", "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MDF_Unit_validator_nonstandard_geocodes: def is_valid_TABBLKST(self, x): """2020 Tabulation State (FIPS)""" <|body_0|> def is_valid_TABBLKCOU(self, x): """2020 Tabulation County (FIPS)""" <|body_1|> def is_valid_TABTRACTCE(self, x): """2020 Tabul...
stack_v2_sparse_classes_36k_train_029640
23,123
permissive
[ { "docstring": "2020 Tabulation State (FIPS)", "name": "is_valid_TABBLKST", "signature": "def is_valid_TABBLKST(self, x)" }, { "docstring": "2020 Tabulation County (FIPS)", "name": "is_valid_TABBLKCOU", "signature": "def is_valid_TABBLKCOU(self, x)" }, { "docstring": "2020 Tabula...
5
stack_v2_sparse_classes_30k_train_000080
Implement the Python class `MDF_Unit_validator_nonstandard_geocodes` described below. Class description: Implement the MDF_Unit_validator_nonstandard_geocodes class. Method signatures and docstrings: - def is_valid_TABBLKST(self, x): 2020 Tabulation State (FIPS) - def is_valid_TABBLKCOU(self, x): 2020 Tabulation Coun...
Implement the Python class `MDF_Unit_validator_nonstandard_geocodes` described below. Class description: Implement the MDF_Unit_validator_nonstandard_geocodes class. Method signatures and docstrings: - def is_valid_TABBLKST(self, x): 2020 Tabulation State (FIPS) - def is_valid_TABBLKCOU(self, x): 2020 Tabulation Coun...
7f7ba44055da15d13b191180249e656e1bd398c6
<|skeleton|> class MDF_Unit_validator_nonstandard_geocodes: def is_valid_TABBLKST(self, x): """2020 Tabulation State (FIPS)""" <|body_0|> def is_valid_TABBLKCOU(self, x): """2020 Tabulation County (FIPS)""" <|body_1|> def is_valid_TABTRACTCE(self, x): """2020 Tabul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MDF_Unit_validator_nonstandard_geocodes: def is_valid_TABBLKST(self, x): """2020 Tabulation State (FIPS)""" if x is None or x == 'None': return False return True def is_valid_TABBLKCOU(self, x): """2020 Tabulation County (FIPS)""" if x is None or x == '...
the_stack_v2_python_sparse
das_decennial/programs/writer/cef_2020/mdf_validator_classes_nonstandard_geocodes.py
p-b-j/uscb-das-container-public
train
1
29e57a4f565e9897faf5446f054de4afc94d1fca
[ "sum = 0\nq = queue.Queue()\nq.put(root)\nwhile not q.empty():\n n = q.get()\n v = n.val\n if v >= L and v <= R:\n sum += v\n if n.left != None:\n q.put(n.left)\n if n.right != None:\n q.put(n.right)\nreturn sum", "def dfs(nd):\n if not nd:\n return\n if nd.val <= ...
<|body_start_0|> sum = 0 q = queue.Queue() q.put(root) while not q.empty(): n = q.get() v = n.val if v >= L and v <= R: sum += v if n.left != None: q.put(n.left) if n.right != None: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rangeSumBST1(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int""" <|body_0|> def rangeSumBST2(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int""" <|body_1|> def rangeSumBST3(sel...
stack_v2_sparse_classes_36k_train_029641
2,147
no_license
[ { "docstring": ":type root: TreeNode :type L: int :type R: int :rtype: int", "name": "rangeSumBST1", "signature": "def rangeSumBST1(self, root, L, R)" }, { "docstring": ":type root: TreeNode :type L: int :type R: int :rtype: int", "name": "rangeSumBST2", "signature": "def rangeSumBST2(se...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeSumBST1(self, root, L, R): :type root: TreeNode :type L: int :type R: int :rtype: int - def rangeSumBST2(self, root, L, R): :type root: TreeNode :type L: int :type R: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeSumBST1(self, root, L, R): :type root: TreeNode :type L: int :type R: int :rtype: int - def rangeSumBST2(self, root, L, R): :type root: TreeNode :type L: int :type R: in...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class Solution: def rangeSumBST1(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int""" <|body_0|> def rangeSumBST2(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int""" <|body_1|> def rangeSumBST3(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rangeSumBST1(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int""" sum = 0 q = queue.Queue() q.put(root) while not q.empty(): n = q.get() v = n.val if v >= L and v <= R: sum ...
the_stack_v2_python_sparse
leetcode/938.py
liuweilin17/algorithm
train
3
6df6ae704ecc89105b950956ffc6364afbc8bb30
[ "num_of_lists = len(lists)\nif num_of_lists == 0:\n return None\nelif num_of_lists == 1:\n return lists[0]\nelif num_of_lists == 2:\n return self.mergeTwoLists(lists[0], lists[1])\nelse:\n return self.mergeTwoLists(self.mergeKLists(lists[:num_of_lists / 2]), self.mergeKLists(lists[num_of_lists / 2:]))",...
<|body_start_0|> num_of_lists = len(lists) if num_of_lists == 0: return None elif num_of_lists == 1: return lists[0] elif num_of_lists == 2: return self.mergeTwoLists(lists[0], lists[1]) else: return self.mergeTwoLists(self.mergeKLi...
Solution_recursive
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_recursive: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_029642
3,012
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" } ]
2
stack_v2_sparse_classes_30k_train_000879
Implement the Python class `Solution_recursive` described below. Class description: Implement the Solution_recursive class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: Li...
Implement the Python class `Solution_recursive` described below. Class description: Implement the Solution_recursive class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: Li...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution_recursive: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_recursive: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" num_of_lists = len(lists) if num_of_lists == 0: return None elif num_of_lists == 1: return lists[0] elif num_of_lists == 2: return se...
the_stack_v2_python_sparse
23_merge_k_sorted_lists/sol.py
lianke123321/leetcode_sol
train
0
21e8d5a6898928e2152dbd0ef0a141912c4d703d
[ "if self.action in ['create', 'list']:\n permission_classes = [permissions.IsUserFromUnitReferralRequesters | permissions.IsRequestReferralLinkedUser | permissions.IsRequestReferralLinkedUnitMember]\nelif self.action in ['retrieve']:\n permission_classes = [permissions.IsLinkedReferralLinkedUser | permissions...
<|body_start_0|> if self.action in ['create', 'list']: permission_classes = [permissions.IsUserFromUnitReferralRequesters | permissions.IsRequestReferralLinkedUser | permissions.IsRequestReferralLinkedUnitMember] elif self.action in ['retrieve']: permission_classes = [permissions...
API endpoints for referral messages.
ReferralMessageViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReferralMessageViewSet: """API endpoints for referral messages.""" def get_permissions(self): """Manage permissions for default methods separately, delegating to @action defined permissions for other actions.""" <|body_0|> def create(self, request, *args, **kwargs): ...
stack_v2_sparse_classes_36k_train_029643
4,228
permissive
[ { "docstring": "Manage permissions for default methods separately, delegating to @action defined permissions for other actions.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Create a new referral message as the client issues a POST on the referralmessag...
3
stack_v2_sparse_classes_30k_train_007357
Implement the Python class `ReferralMessageViewSet` described below. Class description: API endpoints for referral messages. Method signatures and docstrings: - def get_permissions(self): Manage permissions for default methods separately, delegating to @action defined permissions for other actions. - def create(self,...
Implement the Python class `ReferralMessageViewSet` described below. Class description: API endpoints for referral messages. Method signatures and docstrings: - def get_permissions(self): Manage permissions for default methods separately, delegating to @action defined permissions for other actions. - def create(self,...
22e4afa728a851bb4c2479fbb6f5944a75984b9b
<|skeleton|> class ReferralMessageViewSet: """API endpoints for referral messages.""" def get_permissions(self): """Manage permissions for default methods separately, delegating to @action defined permissions for other actions.""" <|body_0|> def create(self, request, *args, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReferralMessageViewSet: """API endpoints for referral messages.""" def get_permissions(self): """Manage permissions for default methods separately, delegating to @action defined permissions for other actions.""" if self.action in ['create', 'list']: permission_classes = [permi...
the_stack_v2_python_sparse
src/backend/partaj/core/api/referral_message.py
MTES-MCT/partaj
train
4
53d8c8b24bf0eb0ba4633ee36abcd71612b8b05f
[ "h5_filename = tdc_Filenames.get_full_filename(calc_id, self.__default_Filename)\nfile_id = h5py.h5f.open(h5_filename, flags=h5py.h5f.ACC_RDONLY)\ndset_name = '/Mesh/CellBoundaries'\ndset = h5py.h5d.open(file_id, dset_name)\ndtype = dset.get_type()\ndspace = dset.get_space()\nself.nx, = dspace.get_simple_extent_dim...
<|body_start_0|> h5_filename = tdc_Filenames.get_full_filename(calc_id, self.__default_Filename) file_id = h5py.h5f.open(h5_filename, flags=h5py.h5f.ACC_RDONLY) dset_name = '/Mesh/CellBoundaries' dset = h5py.h5d.open(file_id, dset_name) dtype = dset.get_type() dspace = ds...
This class contains coordinates of cell boundaries and function for transforming x coordinate in to a cell number Members: -------- x_b coordinates of cell boundaries dx cell width xmin x_b[0] xmax x_b[-1]
tdc_Mesh
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tdc_Mesh: """This class contains coordinates of cell boundaries and function for transforming x coordinate in to a cell number Members: -------- x_b coordinates of cell boundaries dx cell width xmin x_b[0] xmax x_b[-1]""" def __init__(self, calc_id, **kwargs): """Opens mesh.h5 file, ...
stack_v2_sparse_classes_36k_train_029644
2,002
no_license
[ { "docstring": "Opens mesh.h5 file, reads positions", "name": "__init__", "signature": "def __init__(self, calc_id, **kwargs)" }, { "docstring": "Transforms positions x into cell boundaries numbers xx Positions ()=> Cell #s", "name": "x2cell", "signature": "def x2cell(self, xx)" }, {...
3
stack_v2_sparse_classes_30k_train_015186
Implement the Python class `tdc_Mesh` described below. Class description: This class contains coordinates of cell boundaries and function for transforming x coordinate in to a cell number Members: -------- x_b coordinates of cell boundaries dx cell width xmin x_b[0] xmax x_b[-1] Method signatures and docstrings: - de...
Implement the Python class `tdc_Mesh` described below. Class description: This class contains coordinates of cell boundaries and function for transforming x coordinate in to a cell number Members: -------- x_b coordinates of cell boundaries dx cell width xmin x_b[0] xmax x_b[-1] Method signatures and docstrings: - de...
775dc841b1d8538584c8c68a5f75ae997191e685
<|skeleton|> class tdc_Mesh: """This class contains coordinates of cell boundaries and function for transforming x coordinate in to a cell number Members: -------- x_b coordinates of cell boundaries dx cell width xmin x_b[0] xmax x_b[-1]""" def __init__(self, calc_id, **kwargs): """Opens mesh.h5 file, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tdc_Mesh: """This class contains coordinates of cell boundaries and function for transforming x coordinate in to a cell number Members: -------- x_b coordinates of cell boundaries dx cell width xmin x_b[0] xmax x_b[-1]""" def __init__(self, calc_id, **kwargs): """Opens mesh.h5 file, reads positio...
the_stack_v2_python_sparse
Auxiliary/tdc_mesh.py
atimokhin/tdc_vis
train
0
3694971f01b24daa55d3a895dd647792851e66eb
[ "n = len(days)\ndp = [INF] * (n + 1)\ndp[0] = 0\nfor i in range(n):\n cur = days[i]\n for retain, price in tickets:\n pre = cur - retain + 1\n pos = bisect_left(days, pre)\n dp[i + 1] = min(dp[i + 1], dp[pos] + price)\nreturn dp[-1]", "n = days[-1]\ndSet = set(days)\ndp = [0] * (n + 1)\...
<|body_start_0|> n = len(days) dp = [INF] * (n + 1) dp[0] = 0 for i in range(n): cur = days[i] for retain, price in tickets: pre = cur - retain + 1 pos = bisect_left(days, pre) dp[i + 1] = min(dp[i + 1], dp[pos] + pr...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minCostToTravelOnDays(self, days: List[int], tickets: List[List[int]]) -> int: """https://leetcode.cn/contest/autox2023/problems/BjAFy9/""" <|body_0|> def mincostTickets(self, days: List[int], costs: List[int]) -> int: """https://leetcode.cn/problems/mi...
stack_v2_sparse_classes_36k_train_029645
3,670
no_license
[ { "docstring": "https://leetcode.cn/contest/autox2023/problems/BjAFy9/", "name": "minCostToTravelOnDays", "signature": "def minCostToTravelOnDays(self, days: List[int], tickets: List[List[int]]) -> int" }, { "docstring": "https://leetcode.cn/problems/minimum-cost-for-tickets/", "name": "minc...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCostToTravelOnDays(self, days: List[int], tickets: List[List[int]]) -> int: https://leetcode.cn/contest/autox2023/problems/BjAFy9/ - def mincostTickets(self, days: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCostToTravelOnDays(self, days: List[int], tickets: List[List[int]]) -> int: https://leetcode.cn/contest/autox2023/problems/BjAFy9/ - def mincostTickets(self, days: List[in...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minCostToTravelOnDays(self, days: List[int], tickets: List[List[int]]) -> int: """https://leetcode.cn/contest/autox2023/problems/BjAFy9/""" <|body_0|> def mincostTickets(self, days: List[int], costs: List[int]) -> int: """https://leetcode.cn/problems/mi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minCostToTravelOnDays(self, days: List[int], tickets: List[List[int]]) -> int: """https://leetcode.cn/contest/autox2023/problems/BjAFy9/""" n = len(days) dp = [INF] * (n + 1) dp[0] = 0 for i in range(n): cur = days[i] for retain, pr...
the_stack_v2_python_sparse
11_动态规划/dp分类/线性dp/983. 最低票价.py
981377660LMT/algorithm-study
train
225
cb95696a435f5bbd8193a085e84124929fe8861a
[ "self._object_id = object_id\nself._object_sensor = object_sensor\nself._grid_map = grid_map\nself._robot_id = robot_id\ntransition_model = AdversarialTransitionModel(object_id, robot_id, grid_map, motion_policy)\nobservation_model = AdversarialObservationModel(object_id, robot_id)\nreward_model = AdversarialReward...
<|body_start_0|> self._object_id = object_id self._object_sensor = object_sensor self._grid_map = grid_map self._robot_id = robot_id transition_model = AdversarialTransitionModel(object_id, robot_id, grid_map, motion_policy) observation_model = AdversarialObservationModel...
AdversarialTarget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdversarialTarget: def __init__(self, object_id, init_object_state, object_sensor, motion_policy, grid_map, robot_id, robot_sensor, **kwargs): """kwargs include: sigma, epsilon (observation model parameters) belief_rep="histogram" (belief representation) prior={}, # does the target know ...
stack_v2_sparse_classes_36k_train_029646
13,574
no_license
[ { "docstring": "kwargs include: sigma, epsilon (observation model parameters) belief_rep=\"histogram\" (belief representation) prior={}, # does the target know where the robot is? grid_map, big=100, small=1, action_prior=None", "name": "__init__", "signature": "def __init__(self, object_id, init_object_...
2
stack_v2_sparse_classes_30k_train_018326
Implement the Python class `AdversarialTarget` described below. Class description: Implement the AdversarialTarget class. Method signatures and docstrings: - def __init__(self, object_id, init_object_state, object_sensor, motion_policy, grid_map, robot_id, robot_sensor, **kwargs): kwargs include: sigma, epsilon (obse...
Implement the Python class `AdversarialTarget` described below. Class description: Implement the AdversarialTarget class. Method signatures and docstrings: - def __init__(self, object_id, init_object_state, object_sensor, motion_policy, grid_map, robot_id, robot_sensor, **kwargs): kwargs include: sigma, epsilon (obse...
0baf8e9e3410b19ea0bc7b87dc638328eae2d5d2
<|skeleton|> class AdversarialTarget: def __init__(self, object_id, init_object_state, object_sensor, motion_policy, grid_map, robot_id, robot_sensor, **kwargs): """kwargs include: sigma, epsilon (observation model parameters) belief_rep="histogram" (belief representation) prior={}, # does the target know ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdversarialTarget: def __init__(self, object_id, init_object_state, object_sensor, motion_policy, grid_map, robot_id, robot_sensor, **kwargs): """kwargs include: sigma, epsilon (observation model parameters) belief_rep="histogram" (belief representation) prior={}, # does the target know where the robo...
the_stack_v2_python_sparse
adversarial_mos/adversary/agent.py
zkytony/dynamic-object-search
train
0
7ea4836bfb4e29491a2d51a4ddd058b7e09476b4
[ "self._data = numpy.array([data]).T\nself._gmm = mixture.GaussianMixture(n_components=_NUM_COMPONENTS, covariance_type=_COVAR_TYPE).fit(self._data)\nself._label_by_index = dict(list(zip([0, 1], numpy.argsort(self._gmm.means_[:, 0]).tolist())))\nself._label_by_index_fn = numpy.vectorize(lambda x: self._label_by_inde...
<|body_start_0|> self._data = numpy.array([data]).T self._gmm = mixture.GaussianMixture(n_components=_NUM_COMPONENTS, covariance_type=_COVAR_TYPE).fit(self._data) self._label_by_index = dict(list(zip([0, 1], numpy.argsort(self._gmm.means_[:, 0]).tolist()))) self._label_by_index_fn = nump...
Emits class labels from Gaussian Mixture given input data. Input data is encoded as 1-D arrays. Allows for an optional ambiguous label between the two modelled Gaussian distributions. Without the optional ambigouous category, the two labels are: 0 - For values more likely derived from the Gaussian with smaller mean 2 -...
TwoGaussianMixtureModelLabeler
[ "AFL-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoGaussianMixtureModelLabeler: """Emits class labels from Gaussian Mixture given input data. Input data is encoded as 1-D arrays. Allows for an optional ambiguous label between the two modelled Gaussian distributions. Without the optional ambigouous category, the two labels are: 0 - For values m...
stack_v2_sparse_classes_36k_train_029647
3,616
permissive
[ { "docstring": "Constructor. Args: data: (numpy.ndarray or list) Input data to model with Gaussian Mixture. Input data is presumed to be in the form [x1, x2, ...., xn].", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Provides model labels for input value(s) using...
2
stack_v2_sparse_classes_30k_train_016190
Implement the Python class `TwoGaussianMixtureModelLabeler` described below. Class description: Emits class labels from Gaussian Mixture given input data. Input data is encoded as 1-D arrays. Allows for an optional ambiguous label between the two modelled Gaussian distributions. Without the optional ambigouous categor...
Implement the Python class `TwoGaussianMixtureModelLabeler` described below. Class description: Emits class labels from Gaussian Mixture given input data. Input data is encoded as 1-D arrays. Allows for an optional ambiguous label between the two modelled Gaussian distributions. Without the optional ambigouous categor...
bcc4079f13aee56636976fef35a7b0784303b9c2
<|skeleton|> class TwoGaussianMixtureModelLabeler: """Emits class labels from Gaussian Mixture given input data. Input data is encoded as 1-D arrays. Allows for an optional ambiguous label between the two modelled Gaussian distributions. Without the optional ambigouous category, the two labels are: 0 - For values m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwoGaussianMixtureModelLabeler: """Emits class labels from Gaussian Mixture given input data. Input data is encoded as 1-D arrays. Allows for an optional ambiguous label between the two modelled Gaussian distributions. Without the optional ambigouous category, the two labels are: 0 - For values more likely de...
the_stack_v2_python_sparse
collect_tasks/helpers.py
barthelemymp/FLIP
train
0
75cc663c082a95699681eb8777454f0e5b175e6c
[ "n = len(T)\nres = [0] * n\nfor i in range(n):\n for j in range(i, n):\n if T[j] > T[i]:\n res[i] = j - i\n break\nreturn res", "stack = []\nn = len(T)\nres = [0] * n\nfor i in range(n - 1):\n if T[i + 1] > T[i]:\n res[i] = 1\n while stack and T[i + 1] > T[stack[-1...
<|body_start_0|> n = len(T) res = [0] * n for i in range(n): for j in range(i, n): if T[j] > T[i]: res[i] = j - i break return res <|end_body_0|> <|body_start_1|> stack = [] n = len(T) res = [0] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def dailyTemperatures_1(self, T: List[int]) -> List[int]: """双层遍历, 超时""" <|body_0|> def dailyTemperatures(self, T: List[int]) -> List[int]: """栈""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(T) res = [0] * n for i...
stack_v2_sparse_classes_36k_train_029648
1,785
no_license
[ { "docstring": "双层遍历, 超时", "name": "dailyTemperatures_1", "signature": "def dailyTemperatures_1(self, T: List[int]) -> List[int]" }, { "docstring": "栈", "name": "dailyTemperatures", "signature": "def dailyTemperatures(self, T: List[int]) -> List[int]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dailyTemperatures_1(self, T: List[int]) -> List[int]: 双层遍历, 超时 - def dailyTemperatures(self, T: List[int]) -> List[int]: 栈
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dailyTemperatures_1(self, T: List[int]) -> List[int]: 双层遍历, 超时 - def dailyTemperatures(self, T: List[int]) -> List[int]: 栈 <|skeleton|> class Solution: def dailyTempera...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def dailyTemperatures_1(self, T: List[int]) -> List[int]: """双层遍历, 超时""" <|body_0|> def dailyTemperatures(self, T: List[int]) -> List[int]: """栈""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def dailyTemperatures_1(self, T: List[int]) -> List[int]: """双层遍历, 超时""" n = len(T) res = [0] * n for i in range(n): for j in range(i, n): if T[j] > T[i]: res[i] = j - i break return res ...
the_stack_v2_python_sparse
.leetcode/739.每日温度.py
xiaoruijiang/algorithm
train
0
49b58f5e203aa1443ad7f6e1a283e782746d5881
[ "if re.match('^[+-]?[0-9]*(\\\\.[0-9]*)?([eE][+-]?[0-9]+)?$', s):\n return True\nelse:\n return False", "try:\n float(s)\nexcept:\n return False\nreturn True" ]
<|body_start_0|> if re.match('^[+-]?[0-9]*(\\.[0-9]*)?([eE][+-]?[0-9]+)?$', s): return True else: return False <|end_body_0|> <|body_start_1|> try: float(s) except: return False return True <|end_body_1|>
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isNumeric(self, s): """正则表达式""" <|body_0|> def isNumeric2(self, s): """作弊法""" <|body_1|> <|end_skeleton|> <|body_start_0|> if re.match('^[+-]?[0-9]*(\\.[0-9]*)?([eE][+-]?[0-9]+)?$', s): return True else: ...
stack_v2_sparse_classes_36k_train_029649
1,224
permissive
[ { "docstring": "正则表达式", "name": "isNumeric", "signature": "def isNumeric(self, s)" }, { "docstring": "作弊法", "name": "isNumeric2", "signature": "def isNumeric2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_019176
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isNumeric(self, s): 正则表达式 - def isNumeric2(self, s): 作弊法
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isNumeric(self, s): 正则表达式 - def isNumeric2(self, s): 作弊法 <|skeleton|> class Solution: def isNumeric(self, s): """正则表达式""" <|body_0|> def isNumeric2...
889d8fa489f1f2719c5a0dafd3ae51df7b4bf978
<|skeleton|> class Solution: def isNumeric(self, s): """正则表达式""" <|body_0|> def isNumeric2(self, s): """作弊法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isNumeric(self, s): """正则表达式""" if re.match('^[+-]?[0-9]*(\\.[0-9]*)?([eE][+-]?[0-9]+)?$', s): return True else: return False def isNumeric2(self, s): """作弊法""" try: float(s) except: return False...
the_stack_v2_python_sparse
剑指offer/20-表示数值的字符串/isNumeric.py
jinbooooom/coding-for-algorithms
train
14
e1c9c01bdfdd2fe01b387b97e9f1af288986718b
[ "self.matchit_personal_info = matchit_personal_info\nself.matchit_company_info = matchit_company_info\nself.difi_company_info = difi_company_info\nself.personal_credit_check = personal_credit_check\nself.business_credit_check = business_credit_check\nself.official_personal_info = official_personal_info\nself.aml_b_...
<|body_start_0|> self.matchit_personal_info = matchit_personal_info self.matchit_company_info = matchit_company_info self.difi_company_info = difi_company_info self.personal_credit_check = personal_credit_check self.business_credit_check = business_credit_check self.offic...
Implementation of the 'Results' model. TODO: type model description here. Attributes: matchit_personal_info (string): TODO: type description here. matchit_company_info (string): TODO: type description here. difi_company_info (string): TODO: type description here. personal_credit_check (string): TODO: type description h...
Results
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Results: """Implementation of the 'Results' model. TODO: type model description here. Attributes: matchit_personal_info (string): TODO: type description here. matchit_company_info (string): TODO: type description here. difi_company_info (string): TODO: type description here. personal_credit_check...
stack_v2_sparse_classes_36k_train_029650
4,044
permissive
[ { "docstring": "Constructor for the Results class", "name": "__init__", "signature": "def __init__(self, matchit_personal_info=None, matchit_company_info=None, difi_company_info=None, personal_credit_check=None, business_credit_check=None, official_personal_info=None, aml_b_2_c_identify_and_screening=No...
2
null
Implement the Python class `Results` described below. Class description: Implementation of the 'Results' model. TODO: type model description here. Attributes: matchit_personal_info (string): TODO: type description here. matchit_company_info (string): TODO: type description here. difi_company_info (string): TODO: type ...
Implement the Python class `Results` described below. Class description: Implementation of the 'Results' model. TODO: type model description here. Attributes: matchit_personal_info (string): TODO: type description here. matchit_company_info (string): TODO: type description here. difi_company_info (string): TODO: type ...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Results: """Implementation of the 'Results' model. TODO: type model description here. Attributes: matchit_personal_info (string): TODO: type description here. matchit_company_info (string): TODO: type description here. difi_company_info (string): TODO: type description here. personal_credit_check...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Results: """Implementation of the 'Results' model. TODO: type model description here. Attributes: matchit_personal_info (string): TODO: type description here. matchit_company_info (string): TODO: type description here. difi_company_info (string): TODO: type description here. personal_credit_check (string): TO...
the_stack_v2_python_sparse
idfy_rest_client/models/results.py
dealflowteam/Idfy
train
0
0dbfa9d6cea73580bfcdfc592d6443642a5155d6
[ "super().__init__(reduction_data, bandwidth=None, percentile=None, period=None, smoothing=None, interval=[5, 95])\nself.arias_stream = None\nself.result = self.get_arias()", "arias_intensities = {}\narias_stream = StationStream([])\nfor trace in self.reduction_data:\n dt = trace.stats['delta']\n acc = trace...
<|body_start_0|> super().__init__(reduction_data, bandwidth=None, percentile=None, period=None, smoothing=None, interval=[5, 95]) self.arias_stream = None self.result = self.get_arias() <|end_body_0|> <|body_start_1|> arias_intensities = {} arias_stream = StationStream([]) ...
Class for calculation of arias intensity.
Arias
[ "Unlicense", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Arias: """Class for calculation of arias intensity.""" def __init__(self, reduction_data, bandwidth=None, percentile=None, period=None, smoothing=None, interval=[5, 95]): """Args: reduction_data (obspy.core.stream.Stream or numpy.ndarray): Intensity measurement component. bandwidth (...
stack_v2_sparse_classes_36k_train_029651
2,675
permissive
[ { "docstring": "Args: reduction_data (obspy.core.stream.Stream or numpy.ndarray): Intensity measurement component. bandwidth (float): Bandwidth for the smoothing operation. Default is None. percentile (float): Percentile for rotation calculations. Default is None. period (float): Period for smoothing (Fourier a...
2
stack_v2_sparse_classes_30k_train_009895
Implement the Python class `Arias` described below. Class description: Class for calculation of arias intensity. Method signatures and docstrings: - def __init__(self, reduction_data, bandwidth=None, percentile=None, period=None, smoothing=None, interval=[5, 95]): Args: reduction_data (obspy.core.stream.Stream or num...
Implement the Python class `Arias` described below. Class description: Class for calculation of arias intensity. Method signatures and docstrings: - def __init__(self, reduction_data, bandwidth=None, percentile=None, period=None, smoothing=None, interval=[5, 95]): Args: reduction_data (obspy.core.stream.Stream or num...
5c0395f2ae3608861cfd47f1cc3fbe9b2ed82a93
<|skeleton|> class Arias: """Class for calculation of arias intensity.""" def __init__(self, reduction_data, bandwidth=None, percentile=None, period=None, smoothing=None, interval=[5, 95]): """Args: reduction_data (obspy.core.stream.Stream or numpy.ndarray): Intensity measurement component. bandwidth (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Arias: """Class for calculation of arias intensity.""" def __init__(self, reduction_data, bandwidth=None, percentile=None, period=None, smoothing=None, interval=[5, 95]): """Args: reduction_data (obspy.core.stream.Stream or numpy.ndarray): Intensity measurement component. bandwidth (float): Bandw...
the_stack_v2_python_sparse
gmprocess/metrics/reduction/arias.py
mhearne-usgs/groundmotion-processing
train
1
4294afbb8751d1097a3b24edace5d5ab0f5cde83
[ "cur = [root]\nhas_next = True\nans = []\nwhile cur and has_next:\n has_next = False\n next = []\n for node in cur:\n if node:\n ans.append(node.val)\n if node.left or node.right:\n has_next = True\n next.append(node.left)\n next.append(node...
<|body_start_0|> cur = [root] has_next = True ans = [] while cur and has_next: has_next = False next = [] for node in cur: if node: ans.append(node.val) if node.left or node.right: ...
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. 1,2,3 1,2,3 :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_029652
1,578
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. 1,2,3 1,2,3 :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "de...
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. 1,2,3 1,2,3 :type data:...
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. 1,2,3 1,2,3 :type data:...
9ab35dbffed7865e41b437b026f2268d133357be
<|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. 1,2,3 1,2,3 :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleto...
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""" cur = [root] has_next = True ans = [] while cur and has_next: has_next = False next = [] for node in cur: if n...
the_stack_v2_python_sparse
leetcode/297. 二叉树的序列化与反序列化.py
Cjz-Y/shuati
train
0
fd48449f57bf4f4884b2602a40510921a84a09fe
[ "if l1 is None:\n return l2\nelif l2 is None:\n return l1\nelif l1.val < l2.val:\n l1.next = self.mergeTwoLists(l1.next, l2)\n return l1\nelse:\n l2.next = self.mergeTwoLists(l1, l2.next)\n return l2", "prehead = ListNode(-1)\nprev = prehead\nwhile l1 and l2:\n if l1.val <= l2.val:\n p...
<|body_start_0|> if l1 is None: return l2 elif l2 is None: return l1 elif l1.val < l2.val: l1.next = self.mergeTwoLists(l1.next, l2) return l1 else: l2.next = self.mergeTwoLists(l1, l2.next) return l2 <|end_body_0|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': """Recursion""" <|body_0|> def mergeTwoLists2(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': """Iteration""" <|body_1|> <|end_skeleton|> <|body_start_0|> if l1 i...
stack_v2_sparse_classes_36k_train_029653
1,700
no_license
[ { "docstring": "Recursion", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode'" }, { "docstring": "Iteration", "name": "mergeTwoLists2", "signature": "def mergeTwoLists2(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode'" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': Recursion - def mergeTwoLists2(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': Iteration
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': Recursion - def mergeTwoLists2(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': Iteration <|skeleton|...
7694d0798fe55c69f350013b9329a5844c8c5e35
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': """Recursion""" <|body_0|> def mergeTwoLists2(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': """Iteration""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists1(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': """Recursion""" if l1 is None: return l2 elif l2 is None: return l1 elif l1.val < l2.val: l1.next = self.mergeTwoLists(l1.next, l2) return l1 ...
the_stack_v2_python_sparse
MergeSortedLinkedList (deleted e6c1755b7814d9883cf49e0d0465500a).py
annaymj/LeetCode
train
4
0375004ed30dd7c480fdfddc8e17abb67aeb5a5a
[ "super().__init__((func_name, args, align))\nself.func_name = func_name\nself.args = args\nself.align = align", "rop = ROP(state._elf)\nif self.align:\n arutil.align_call(rop, self.func_name, self.args)\nelse:\n rop.call(self.func_name, self.args)\nlog.info(rop.dump())\nstate.overwriter(state.target, rop.ch...
<|body_start_0|> super().__init__((func_name, args, align)) self.func_name = func_name self.args = args self.align = align <|end_body_0|> <|body_start_1|> rop = ROP(state._elf) if self.align: arutil.align_call(rop, self.func_name, self.args) else: ...
Custom
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Custom: def __init__(self, func_name: str, args: List[Any]=[], align: bool=False): """Call an arbitrary function using rop chain. Call an arbitrary function using rop chain. This is basically a thin wrapper around using ROP in pwntools. Arguments: func_name: Symbol in executable which we...
stack_v2_sparse_classes_36k_train_029654
1,520
permissive
[ { "docstring": "Call an arbitrary function using rop chain. Call an arbitrary function using rop chain. This is basically a thin wrapper around using ROP in pwntools. Arguments: func_name: Symbol in executable which we can return to. args: Optional list of arguments to pass to function. align: Whether the call ...
2
stack_v2_sparse_classes_30k_train_001383
Implement the Python class `Custom` described below. Class description: Implement the Custom class. Method signatures and docstrings: - def __init__(self, func_name: str, args: List[Any]=[], align: bool=False): Call an arbitrary function using rop chain. Call an arbitrary function using rop chain. This is basically a...
Implement the Python class `Custom` described below. Class description: Implement the Custom class. Method signatures and docstrings: - def __init__(self, func_name: str, args: List[Any]=[], align: bool=False): Call an arbitrary function using rop chain. Call an arbitrary function using rop chain. This is basically a...
5735073008f722fab00f3866ef4a05f04620593b
<|skeleton|> class Custom: def __init__(self, func_name: str, args: List[Any]=[], align: bool=False): """Call an arbitrary function using rop chain. Call an arbitrary function using rop chain. This is basically a thin wrapper around using ROP in pwntools. Arguments: func_name: Symbol in executable which we...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Custom: def __init__(self, func_name: str, args: List[Any]=[], align: bool=False): """Call an arbitrary function using rop chain. Call an arbitrary function using rop chain. This is basically a thin wrapper around using ROP in pwntools. Arguments: func_name: Symbol in executable which we can return to...
the_stack_v2_python_sparse
autorop/call/Custom.py
Licae/autorop
train
0
846f4d77c7d8eb9124beab8af2bd804504ef995b
[ "item = models.MonitorItem.objects.get(id=self.request.query_params['id']) if self.request.query_params.__contains__('id') else None\nserializer = ItemSerializer(instance=item, many=False)\nret = {'code': constant.BACKEND_CODE_OK, 'data': {'item': serializer.data}}\nreturn JsonResponse(ret, safe=False)", "ret = {...
<|body_start_0|> item = models.MonitorItem.objects.get(id=self.request.query_params['id']) if self.request.query_params.__contains__('id') else None serializer = ItemSerializer(instance=item, many=False) ret = {'code': constant.BACKEND_CODE_OK, 'data': {'item': serializer.data}} return J...
ItemInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemInfo: def get(self, request, pk=None, format=None): """获取指定监控项""" <|body_0|> def post(self, request, pk=None, format=None): """在指定模板下添加监控项""" <|body_1|> <|end_skeleton|> <|body_start_0|> item = models.MonitorItem.objects.get(id=self.request.quer...
stack_v2_sparse_classes_36k_train_029655
5,048
no_license
[ { "docstring": "获取指定监控项", "name": "get", "signature": "def get(self, request, pk=None, format=None)" }, { "docstring": "在指定模板下添加监控项", "name": "post", "signature": "def post(self, request, pk=None, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_016075
Implement the Python class `ItemInfo` described below. Class description: Implement the ItemInfo class. Method signatures and docstrings: - def get(self, request, pk=None, format=None): 获取指定监控项 - def post(self, request, pk=None, format=None): 在指定模板下添加监控项
Implement the Python class `ItemInfo` described below. Class description: Implement the ItemInfo class. Method signatures and docstrings: - def get(self, request, pk=None, format=None): 获取指定监控项 - def post(self, request, pk=None, format=None): 在指定模板下添加监控项 <|skeleton|> class ItemInfo: def get(self, request, pk=No...
b7018a9357a7d71acd1cd5eb0b8e0f6dc8016a88
<|skeleton|> class ItemInfo: def get(self, request, pk=None, format=None): """获取指定监控项""" <|body_0|> def post(self, request, pk=None, format=None): """在指定模板下添加监控项""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemInfo: def get(self, request, pk=None, format=None): """获取指定监控项""" item = models.MonitorItem.objects.get(id=self.request.query_params['id']) if self.request.query_params.__contains__('id') else None serializer = ItemSerializer(instance=item, many=False) ret = {'code': consta...
the_stack_v2_python_sparse
monitor_api2/monitor_web/views/item_view.py
evoup/monitor_pass
train
0
65d88785f79bd16f39bfc2dad2f2d76f92978334
[ "super(PointerNet, self).__init__()\nself.embedding_dim = embedding_dim\nself.bidir = bidir\nself.encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir)\nself.decoder = Decoder(embedding_dim, hidden_dim)\nself.decoder_input0 = Parameter(torch.FloatTensor(embedding_dim), requires_grad=True)\nnn.in...
<|body_start_0|> super(PointerNet, self).__init__() self.embedding_dim = embedding_dim self.bidir = bidir self.encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir) self.decoder = Decoder(embedding_dim, hidden_dim) self.decoder_input0 = Parameter(torch...
Pointer-Net
PointerNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointerNet: """Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LST...
stack_v2_sparse_classes_36k_train_029656
12,775
no_license
[ { "docstring": "Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LSTMs :param float dropout: Float between 0-1 :param bool bidir: Bidirectional", "name": "__init__", "signature": "def __i...
2
stack_v2_sparse_classes_30k_train_018149
Implement the Python class `PointerNet` described below. Class description: Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidd...
Implement the Python class `PointerNet` described below. Class description: Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidd...
86a480b9196053cee9a3287e023dd12a13bb5df8
<|skeleton|> class PointerNet: """Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LST...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointerNet: """Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LSTMs :param flo...
the_stack_v2_python_sparse
PointerNet.py
EleanorHYW/Rerank
train
0
19d91727a7fa137a7572af4119ff6063048a20d0
[ "self._nodes = list()\nfor node in nodes:\n if node.db.storage_type != 'T':\n log.warning(f'Ignoring non-transport node \"{node.name}\" in Transport Group \"{self.group.name}\"')\n else:\n self._nodes.append(node)\nif not len(self._nodes):\n raise ValueError(f'no usable nodes ({len(nodes)} un...
<|body_start_0|> self._nodes = list() for node in nodes: if node.db.storage_type != 'T': log.warning(f'Ignoring non-transport node "{node.name}" in Transport Group "{self.group.name}"') else: self._nodes.append(node) if not len(self._nodes)...
Transport Group I/O. This implements (the formerly special-cased) transport disk logic. A Transport StorageGroup is used to transfer data onto transiting storage. Features of a Transport StorageGroup: - it may have any number of nodes. All node must have node.db.storage_type == 'T', but no restrictions are put on the i...
TransportGroupIO
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransportGroupIO: """Transport Group I/O. This implements (the formerly special-cased) transport disk logic. A Transport StorageGroup is used to transfer data onto transiting storage. Features of a Transport StorageGroup: - it may have any number of nodes. All node must have node.db.storage_type ...
stack_v2_sparse_classes_36k_train_029657
5,479
permissive
[ { "docstring": "Check that nodes in group are transit nodes. Parameters ---------- nodes : list of UpdateableNodes local active nodes in this group Returns ------- nodes : list of UpdateableNodes subset of `nodes` which are Transport nodes. Raises ------ ValueError none of the supplied `nodes` were Transport no...
3
stack_v2_sparse_classes_30k_train_009485
Implement the Python class `TransportGroupIO` described below. Class description: Transport Group I/O. This implements (the formerly special-cased) transport disk logic. A Transport StorageGroup is used to transfer data onto transiting storage. Features of a Transport StorageGroup: - it may have any number of nodes. A...
Implement the Python class `TransportGroupIO` described below. Class description: Transport Group I/O. This implements (the formerly special-cased) transport disk logic. A Transport StorageGroup is used to transfer data onto transiting storage. Features of a Transport StorageGroup: - it may have any number of nodes. A...
7067844d144ab5e2bba6d63b5f627c25edf73618
<|skeleton|> class TransportGroupIO: """Transport Group I/O. This implements (the formerly special-cased) transport disk logic. A Transport StorageGroup is used to transfer data onto transiting storage. Features of a Transport StorageGroup: - it may have any number of nodes. All node must have node.db.storage_type ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransportGroupIO: """Transport Group I/O. This implements (the formerly special-cased) transport disk logic. A Transport StorageGroup is used to transfer data onto transiting storage. Features of a Transport StorageGroup: - it may have any number of nodes. All node must have node.db.storage_type == 'T', but n...
the_stack_v2_python_sparse
alpenhorn/io/transport.py
radiocosmology/alpenhorn
train
3
ffab28c7146255e16c435e134be71713068f8968
[ "user = User.query.get(g.user.id)\nif user:\n return jsonify(dict(twoFAKey=user.twoFAKey, twoFALoggedin=user.twoFALoggedin))", "args = twofaParser.parse_args()\nuser = User.query.get(g.user.id)\nif user.check_twoFAKey(args.get('otp')):\n return jsonify(dict(success=True))\nreturn abort(401, 'otp code is not...
<|body_start_0|> user = User.query.get(g.user.id) if user: return jsonify(dict(twoFAKey=user.twoFAKey, twoFALoggedin=user.twoFALoggedin)) <|end_body_0|> <|body_start_1|> args = twofaParser.parse_args() user = User.query.get(g.user.id) if user.check_twoFAKey(args.get(...
setup_twofa
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class setup_twofa: def get(self): """get otp twofa details""" <|body_0|> def put(self): """setup twofa""" <|body_1|> def delete(self): """disable twofa login""" <|body_2|> <|end_skeleton|> <|body_start_0|> user = User.query.get(g.user...
stack_v2_sparse_classes_36k_train_029658
9,160
no_license
[ { "docstring": "get otp twofa details", "name": "get", "signature": "def get(self)" }, { "docstring": "setup twofa", "name": "put", "signature": "def put(self)" }, { "docstring": "disable twofa login", "name": "delete", "signature": "def delete(self)" } ]
3
stack_v2_sparse_classes_30k_train_012509
Implement the Python class `setup_twofa` described below. Class description: Implement the setup_twofa class. Method signatures and docstrings: - def get(self): get otp twofa details - def put(self): setup twofa - def delete(self): disable twofa login
Implement the Python class `setup_twofa` described below. Class description: Implement the setup_twofa class. Method signatures and docstrings: - def get(self): get otp twofa details - def put(self): setup twofa - def delete(self): disable twofa login <|skeleton|> class setup_twofa: def get(self): """ge...
1c7d812e214590e0f4759e6c5be411bd64f8e3c4
<|skeleton|> class setup_twofa: def get(self): """get otp twofa details""" <|body_0|> def put(self): """setup twofa""" <|body_1|> def delete(self): """disable twofa login""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class setup_twofa: def get(self): """get otp twofa details""" user = User.query.get(g.user.id) if user: return jsonify(dict(twoFAKey=user.twoFAKey, twoFALoggedin=user.twoFALoggedin)) def put(self): """setup twofa""" args = twofaParser.parse_args() use...
the_stack_v2_python_sparse
apis/auth.py
ajutor-app/backend
train
0
8d25357f54f8e28f1829ed0cd2859141fc8075da
[ "if p and q:\n print(p.val, q.val)\n if p.val != q.val:\n return False\n left = self.isSameTree(p.left, q.left)\n right = self.isSameTree(p.right, q.right)\n print(left, right)\n return left and right\nelif p and (not q) or (not p and q):\n return False\nelse:\n return True", "if no...
<|body_start_0|> if p and q: print(p.val, q.val) if p.val != q.val: return False left = self.isSameTree(p.left, q.left) right = self.isSameTree(p.right, q.right) print(left, right) return left and right elif p and (n...
First try -- a bit messy, not super fast Runtime: 24 ms, faster than 26.25% of Python online submissions for Same Tree. Memory Usage: 12.8 MB, less than 40.93% of Python online submissions for Same Tree.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """First try -- a bit messy, not super fast Runtime: 24 ms, faster than 26.25% of Python online submissions for Same Tree. Memory Usage: 12.8 MB, less than 40.93% of Python online submissions for Same Tree.""" def isSameTree(self, p, q): """:type p: TreeNode :type q: TreeNo...
stack_v2_sparse_classes_36k_train_029659
4,095
no_license
[ { "docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool", "name": "isSameTree", "signature": "def isSameTree(self, p, q)" }, { "docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool", "name": "isSameTree", "signature": "def isSameTree(self, p, q)" }, { "docstring...
4
null
Implement the Python class `Solution` described below. Class description: First try -- a bit messy, not super fast Runtime: 24 ms, faster than 26.25% of Python online submissions for Same Tree. Memory Usage: 12.8 MB, less than 40.93% of Python online submissions for Same Tree. Method signatures and docstrings: - def ...
Implement the Python class `Solution` described below. Class description: First try -- a bit messy, not super fast Runtime: 24 ms, faster than 26.25% of Python online submissions for Same Tree. Memory Usage: 12.8 MB, less than 40.93% of Python online submissions for Same Tree. Method signatures and docstrings: - def ...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: """First try -- a bit messy, not super fast Runtime: 24 ms, faster than 26.25% of Python online submissions for Same Tree. Memory Usage: 12.8 MB, less than 40.93% of Python online submissions for Same Tree.""" def isSameTree(self, p, q): """:type p: TreeNode :type q: TreeNo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """First try -- a bit messy, not super fast Runtime: 24 ms, faster than 26.25% of Python online submissions for Same Tree. Memory Usage: 12.8 MB, less than 40.93% of Python online submissions for Same Tree.""" def isSameTree(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bo...
the_stack_v2_python_sparse
100-same_tree.py
stevestar888/leetcode-problems
train
2
0a0eade6fafb4cc8a63f31c2ee9a2ddf9e64020d
[ "s = set()\nfor num in nums:\n if num in s:\n return num\n else:\n s.add(num)\nreturn None", "lo = 1\nhi = len(nums)\nwhile lo < hi:\n mid = lo + (hi - lo) / 2\n cnt = 0\n for num in nums:\n if num <= mid:\n cnt += 1\n if cnt <= mid:\n lo = mid + 1\n els...
<|body_start_0|> s = set() for num in nums: if num in s: return num else: s.add(num) return None <|end_body_0|> <|body_start_1|> lo = 1 hi = len(nums) while lo < hi: mid = lo + (hi - lo) / 2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate(self, nums): """用集合记录出现过的数字,set 比 list 快 :type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate(self, nums): """基于值的二分法: 因为数都在 [1,n] 之间,二分搜索, 统计列表中和 mid 相比的数量。 :type nums: List[int] :rtype: int""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_029660
2,001
no_license
[ { "docstring": "用集合记录出现过的数字,set 比 list 快 :type nums: List[int] :rtype: int", "name": "findDuplicate", "signature": "def findDuplicate(self, nums)" }, { "docstring": "基于值的二分法: 因为数都在 [1,n] 之间,二分搜索, 统计列表中和 mid 相比的数量。 :type nums: List[int] :rtype: int", "name": "findDuplicate", "signature": ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): 用集合记录出现过的数字,set 比 list 快 :type nums: List[int] :rtype: int - def findDuplicate(self, nums): 基于值的二分法: 因为数都在 [1,n] 之间,二分搜索, 统计列表中和 mid 相比的数量。 :type n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): 用集合记录出现过的数字,set 比 list 快 :type nums: List[int] :rtype: int - def findDuplicate(self, nums): 基于值的二分法: 因为数都在 [1,n] 之间,二分搜索, 统计列表中和 mid 相比的数量。 :type n...
860590239da0618c52967a55eda8d6bbe00bfa96
<|skeleton|> class Solution: def findDuplicate(self, nums): """用集合记录出现过的数字,set 比 list 快 :type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate(self, nums): """基于值的二分法: 因为数都在 [1,n] 之间,二分搜索, 统计列表中和 mid 相比的数量。 :type nums: List[int] :rtype: int""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicate(self, nums): """用集合记录出现过的数字,set 比 list 快 :type nums: List[int] :rtype: int""" s = set() for num in nums: if num in s: return num else: s.add(num) return None def findDuplicate(self, nums): ...
the_stack_v2_python_sparse
LeetCode/p0287/I/find-the-duplicate-number.py
Ynjxsjmh/PracticeMakesPerfect
train
0
7b773a759e89b52db629079e4b69f284d783d8c9
[ "cur = node\nwhile cur.next != None:\n cur.val = cur.next.val\n if cur.next.next == None:\n tmp = cur.next\n cur.next = None\n del tmp\n break\n cur = cur.next", "node.val = node.next.val\ntmp = node.next\nnode.next = node.next.next\ndel tmp" ]
<|body_start_0|> cur = node while cur.next != None: cur.val = cur.next.val if cur.next.next == None: tmp = cur.next cur.next = None del tmp break cur = cur.next <|end_body_0|> <|body_start_1|> no...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteNode_myself(self, node): """:type node: ListNode :rtype: void Do not return anything, modify node in-place instead.""" <|body_0|> def deleteNode(self, node): """:type node: ListNode :rtype: void Do not return anything, modify node in-place instead...
stack_v2_sparse_classes_36k_train_029661
2,760
no_license
[ { "docstring": ":type node: ListNode :rtype: void Do not return anything, modify node in-place instead.", "name": "deleteNode_myself", "signature": "def deleteNode_myself(self, node)" }, { "docstring": ":type node: ListNode :rtype: void Do not return anything, modify node in-place instead.", ...
2
stack_v2_sparse_classes_30k_train_006529
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode_myself(self, node): :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. - def deleteNode(self, node): :type node: ListNode :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode_myself(self, node): :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. - def deleteNode(self, node): :type node: ListNode :rty...
93266095329e2e8e949a72371b88b07382a60e0d
<|skeleton|> class Solution: def deleteNode_myself(self, node): """:type node: ListNode :rtype: void Do not return anything, modify node in-place instead.""" <|body_0|> def deleteNode(self, node): """:type node: ListNode :rtype: void Do not return anything, modify node in-place instead...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteNode_myself(self, node): """:type node: ListNode :rtype: void Do not return anything, modify node in-place instead.""" cur = node while cur.next != None: cur.val = cur.next.val if cur.next.next == None: tmp = cur.next ...
the_stack_v2_python_sparse
deleteNode.py
shivangi-prog/leetcode
train
0
ca5c1fd0a53a01b92dd10826b1d38bc50fdfbd62
[ "from stock.models import StockItem\nlogger.info(f'SampleLocatePlugin attempting to locate item ID {item_pk}')\ntry:\n item = StockItem.objects.get(pk=item_pk)\n logger.info(f'StockItem {item_pk} located!')\n item.set_metadata('located', True)\nexcept (ValueError, StockItem.DoesNotExist):\n logger.error...
<|body_start_0|> from stock.models import StockItem logger.info(f'SampleLocatePlugin attempting to locate item ID {item_pk}') try: item = StockItem.objects.get(pk=item_pk) logger.info(f'StockItem {item_pk} located!') item.set_metadata('located', True) ...
A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.
SampleLocatePlugin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampleLocatePlugin: """A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.""" def locate_stock_item(self, item_pk): """Locate a StockItem. Args: item_pk: primary key for item""" <|body_0|> def locate_stock_loc...
stack_v2_sparse_classes_36k_train_029662
1,854
permissive
[ { "docstring": "Locate a StockItem. Args: item_pk: primary key for item", "name": "locate_stock_item", "signature": "def locate_stock_item(self, item_pk)" }, { "docstring": "Locate a StockLocation. Args: location_pk: primary key for location", "name": "locate_stock_location", "signature"...
2
stack_v2_sparse_classes_30k_train_004486
Implement the Python class `SampleLocatePlugin` described below. Class description: A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger. Method signatures and docstrings: - def locate_stock_item(self, item_pk): Locate a StockItem. Args: item_pk: primary key...
Implement the Python class `SampleLocatePlugin` described below. Class description: A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger. Method signatures and docstrings: - def locate_stock_item(self, item_pk): Locate a StockItem. Args: item_pk: primary key...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class SampleLocatePlugin: """A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.""" def locate_stock_item(self, item_pk): """Locate a StockItem. Args: item_pk: primary key for item""" <|body_0|> def locate_stock_loc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SampleLocatePlugin: """A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.""" def locate_stock_item(self, item_pk): """Locate a StockItem. Args: item_pk: primary key for item""" from stock.models import StockItem logger...
the_stack_v2_python_sparse
InvenTree/plugin/samples/locate/locate_sample.py
inventree/InvenTree
train
3,077
da81f23699e7bfd4afbbe30ed4471ed0658fc304
[ "self.__k = 300\nself.__dq = deque()\nself.__count = 0", "self.getHits(timestamp)\nif self.__dq and self.__dq[-1][0] == timestamp:\n self.__dq[-1][1] += 1\nelse:\n self.__dq.append([timestamp, 1])\nself.__count += 1", "while self.__dq and self.__dq[0][0] <= timestamp - self.__k:\n self.__count -= self....
<|body_start_0|> self.__k = 300 self.__dq = deque() self.__count = 0 <|end_body_0|> <|body_start_1|> self.getHits(timestamp) if self.__dq and self.__dq[-1][0] == timestamp: self.__dq[-1][1] += 1 else: self.__dq.append([timestamp, 1]) self....
HitCounter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp): """Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rtype: void""" <|body_1|> def getHit...
stack_v2_sparse_classes_36k_train_029663
5,759
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rtype: void", "name": "hit", "signature": "def hit(self, ...
3
null
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp): Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type ti...
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp): Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type ti...
0ba027d9b8bc7c80bc89ce2da3543ce7a49a403c
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp): """Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rtype: void""" <|body_1|> def getHit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HitCounter: def __init__(self): """Initialize your data structure here.""" self.__k = 300 self.__dq = deque() self.__count = 0 def hit(self, timestamp): """Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rtype:...
the_stack_v2_python_sparse
cs15211/DesignHitCounter.py
JulyKikuAkita/PythonPrac
train
1
b18c34502918b94175ea56a6a68f003f5132f416
[ "nic_attributes = {}\nnic_plugin_attributes_query = db().query(cls.model.id, models.Plugin.name, models.Plugin.title, cls.model.attributes).join(models.ClusterPlugin, models.Plugin).filter(cls.model.interface_id == interface.id).filter(models.ClusterPlugin.enabled.is_(True)).all()\nfor nic_plugin_id, name, title, a...
<|body_start_0|> nic_attributes = {} nic_plugin_attributes_query = db().query(cls.model.id, models.Plugin.name, models.Plugin.title, cls.model.attributes).join(models.ClusterPlugin, models.Plugin).filter(cls.model.interface_id == interface.id).filter(models.ClusterPlugin.enabled.is_(True)).all() ...
NodeNICInterfaceClusterPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeNICInterfaceClusterPlugin: def get_all_enabled_attributes_by_interface(cls, interface): """Returns plugin enabled attributes for specific NIC. :param interface: Interface instance :type interface: models.node.NodeNICInterface :returns: dict -- Dict object with plugin NIC attributes""...
stack_v2_sparse_classes_36k_train_029664
24,356
permissive
[ { "docstring": "Returns plugin enabled attributes for specific NIC. :param interface: Interface instance :type interface: models.node.NodeNICInterface :returns: dict -- Dict object with plugin NIC attributes", "name": "get_all_enabled_attributes_by_interface", "signature": "def get_all_enabled_attribute...
3
stack_v2_sparse_classes_30k_train_018609
Implement the Python class `NodeNICInterfaceClusterPlugin` described below. Class description: Implement the NodeNICInterfaceClusterPlugin class. Method signatures and docstrings: - def get_all_enabled_attributes_by_interface(cls, interface): Returns plugin enabled attributes for specific NIC. :param interface: Inter...
Implement the Python class `NodeNICInterfaceClusterPlugin` described below. Class description: Implement the NodeNICInterfaceClusterPlugin class. Method signatures and docstrings: - def get_all_enabled_attributes_by_interface(cls, interface): Returns plugin enabled attributes for specific NIC. :param interface: Inter...
768ac74a420f822261c4eb8da72f1d8af3c6bbff
<|skeleton|> class NodeNICInterfaceClusterPlugin: def get_all_enabled_attributes_by_interface(cls, interface): """Returns plugin enabled attributes for specific NIC. :param interface: Interface instance :type interface: models.node.NodeNICInterface :returns: dict -- Dict object with plugin NIC attributes""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeNICInterfaceClusterPlugin: def get_all_enabled_attributes_by_interface(cls, interface): """Returns plugin enabled attributes for specific NIC. :param interface: Interface instance :type interface: models.node.NodeNICInterface :returns: dict -- Dict object with plugin NIC attributes""" nic_...
the_stack_v2_python_sparse
nailgun/nailgun/objects/plugin.py
dis-xcom/fuel-web
train
0
8c4e1fa06aa6259080cc410a34aae4f94b860a32
[ "self.inputs: InputManager = inputs\nself.features_df: pd.DataFrame | None = None\nif feature_type not in ['all', 'training']:\n raise ValueError(f\"feature_type {feature_type} not allowable. Must be either 'all' or 'training'\")\nself.feature_type = feature_type\nself.input_dict = {'all': {'ferc1_df': self.inpu...
<|body_start_0|> self.inputs: InputManager = inputs self.features_df: pd.DataFrame | None = None if feature_type not in ['all', 'training']: raise ValueError(f"feature_type {feature_type} not allowable. Must be either 'all' or 'training'") self.feature_type = feature_type ...
Generate feature vectors for connecting FERC and EIA.
Features
[ "CC-BY-4.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Features: """Generate feature vectors for connecting FERC and EIA.""" def __init__(self, feature_type: Literal['training', 'all'], inputs: InputManager): """Initialize feature generator. Args: feature_type: Type of features to compile. Either 'training' or 'all'. inputs: Instance of ...
stack_v2_sparse_classes_36k_train_029665
42,623
permissive
[ { "docstring": "Initialize feature generator. Args: feature_type: Type of features to compile. Either 'training' or 'all'. inputs: Instance of :class:`InputManager`.", "name": "__init__", "signature": "def __init__(self, feature_type: Literal['training', 'all'], inputs: InputManager)" }, { "docs...
3
stack_v2_sparse_classes_30k_test_000379
Implement the Python class `Features` described below. Class description: Generate feature vectors for connecting FERC and EIA. Method signatures and docstrings: - def __init__(self, feature_type: Literal['training', 'all'], inputs: InputManager): Initialize feature generator. Args: feature_type: Type of features to ...
Implement the Python class `Features` described below. Class description: Generate feature vectors for connecting FERC and EIA. Method signatures and docstrings: - def __init__(self, feature_type: Literal['training', 'all'], inputs: InputManager): Initialize feature generator. Args: feature_type: Type of features to ...
6afae8aade053408f23ac4332d5cbb438ab72dc6
<|skeleton|> class Features: """Generate feature vectors for connecting FERC and EIA.""" def __init__(self, feature_type: Literal['training', 'all'], inputs: InputManager): """Initialize feature generator. Args: feature_type: Type of features to compile. Either 'training' or 'all'. inputs: Instance of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Features: """Generate feature vectors for connecting FERC and EIA.""" def __init__(self, feature_type: Literal['training', 'all'], inputs: InputManager): """Initialize feature generator. Args: feature_type: Type of features to compile. Either 'training' or 'all'. inputs: Instance of :class:`Input...
the_stack_v2_python_sparse
src/pudl/analysis/ferc1_eia.py
catalyst-cooperative/pudl
train
382
22bbc15752f24f0c8c8dac39f45e38f6ae69d657
[ "super(BatchMGCN, self).__init__()\nself.raw = ModuleList([FullyConnectNN(i, n_hids, h_size, act, layer_norm_on) for i in n_feats])\nself.msg = BatchMultiMessagePassing([h_size for _ in range(len(n_feats))], n_hids, h_size, n_steps, act, layer_norm_on)\nself.transform = FullyConnectNN(h_size, n_hids, n_output, act,...
<|body_start_0|> super(BatchMGCN, self).__init__() self.raw = ModuleList([FullyConnectNN(i, n_hids, h_size, act, layer_norm_on) for i in n_feats]) self.msg = BatchMultiMessagePassing([h_size for _ in range(len(n_feats))], n_hids, h_size, n_steps, act, layer_norm_on) self.transform = Full...
BatchMGCN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchMGCN: def __init__(self, n_feats, n_output, n_hids, h_size, n_steps, act=nn.LeakyReLU, layer_norm_on=False): """n_feats: number of node features (a list) n_output: output size of node n_hids: number of hidden neurons (a list) n_steps: number of message passing steps The list in the ...
stack_v2_sparse_classes_36k_train_029666
2,540
no_license
[ { "docstring": "n_feats: number of node features (a list) n_output: output size of node n_hids: number of hidden neurons (a list) n_steps: number of message passing steps The list in the input features correspond to different type of the intput. For each type, there are 3 processing units: 1. map all raw featur...
2
stack_v2_sparse_classes_30k_train_015142
Implement the Python class `BatchMGCN` described below. Class description: Implement the BatchMGCN class. Method signatures and docstrings: - def __init__(self, n_feats, n_output, n_hids, h_size, n_steps, act=nn.LeakyReLU, layer_norm_on=False): n_feats: number of node features (a list) n_output: output size of node n...
Implement the Python class `BatchMGCN` described below. Class description: Implement the BatchMGCN class. Method signatures and docstrings: - def __init__(self, n_feats, n_output, n_hids, h_size, n_steps, act=nn.LeakyReLU, layer_norm_on=False): n_feats: number of node features (a list) n_output: output size of node n...
4bda823ef99a34a9a3250192897d2a0faedca500
<|skeleton|> class BatchMGCN: def __init__(self, n_feats, n_output, n_hids, h_size, n_steps, act=nn.LeakyReLU, layer_norm_on=False): """n_feats: number of node features (a list) n_output: output size of node n_hids: number of hidden neurons (a list) n_steps: number of message passing steps The list in the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchMGCN: def __init__(self, n_feats, n_output, n_hids, h_size, n_steps, act=nn.LeakyReLU, layer_norm_on=False): """n_feats: number of node features (a list) n_output: output size of node n_hids: number of hidden neurons (a list) n_steps: number of message passing steps The list in the input features...
the_stack_v2_python_sparse
gcn/batch_mgcn.py
kshiteejm/net-update-code
train
0
00b0482e9a5e0c4f432ce3f4e8665411a39057cc
[ "app_id_list = self.request.query_params.get('selectedAppList')\nif not app_id_list:\n app_id_list = get_cc_app_id_by_user()\nelse:\n app_id_list = app_id_list.split(',')\nreturn EsCluster.objects.filter(app_id__in=app_id_list).order_by('-create_time')", "try:\n post_data = request.data\n bk_username ...
<|body_start_0|> app_id_list = self.request.query_params.get('selectedAppList') if not app_id_list: app_id_list = get_cc_app_id_by_user() else: app_id_list = app_id_list.split(',') return EsCluster.objects.filter(app_id__in=app_id_list).order_by('-create_time') <|...
es集群表视图
EsClusterViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EsClusterViewSet: """es集群表视图""" def get_queryset(self): """重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离""" <|body_0|> def create_cluster(self, request, *args, **kwargs): """POST /es/create_cluster es集群创建""" <|body_1|> def add_node(self, request): "...
stack_v2_sparse_classes_36k_train_029667
10,026
no_license
[ { "docstring": "重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "POST /es/create_cluster es集群创建", "name": "create_cluster", "signature": "def create_cluster(self, request, *args, **kwargs)" }, { "docstring":...
6
stack_v2_sparse_classes_30k_train_018212
Implement the Python class `EsClusterViewSet` described below. Class description: es集群表视图 Method signatures and docstrings: - def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离 - def create_cluster(self, request, *args, **kwargs): POST /es/create_cluster es集群创建 - def add_node(self, request): POST /api/es/...
Implement the Python class `EsClusterViewSet` described below. Class description: es集群表视图 Method signatures and docstrings: - def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离 - def create_cluster(self, request, *args, **kwargs): POST /es/create_cluster es集群创建 - def add_node(self, request): POST /api/es/...
97cfac2ba94d67980d837f0b541caae70b68a595
<|skeleton|> class EsClusterViewSet: """es集群表视图""" def get_queryset(self): """重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离""" <|body_0|> def create_cluster(self, request, *args, **kwargs): """POST /es/create_cluster es集群创建""" <|body_1|> def add_node(self, request): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EsClusterViewSet: """es集群表视图""" def get_queryset(self): """重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离""" app_id_list = self.request.query_params.get('selectedAppList') if not app_id_list: app_id_list = get_cc_app_id_by_user() else: app_id_list = app_id_...
the_stack_v2_python_sparse
apps/es/views.py
sdgdsffdsfff/bk-dop
train
0
88ce75a526556da2601f88d08cb3bdf460b9b951
[ "fields = []\ncondition = '1 = 1'\nvalues = []\nif not self.util.is_empty('shop_id', params):\n condition += ' and shop_id = %s'\n values.append(params['shop_id'])\nresult = await self.find(self.tbl_shop, {self.sql_constants.FIELDS: fields, self.sql_constants.CONDITION: condition}, tuple(values))\nreturn resu...
<|body_start_0|> fields = [] condition = '1 = 1' values = [] if not self.util.is_empty('shop_id', params): condition += ' and shop_id = %s' values.append(params['shop_id']) result = await self.find(self.tbl_shop, {self.sql_constants.FIELDS: fields, self.sq...
Model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: async def query_one(self, params): """查询店铺信息(单条) @param params: @return:""" <|body_0|> async def create(self, params): """创建店铺 同时会创建超管和管理员分组数据 @param params: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> fields = [] conditi...
stack_v2_sparse_classes_36k_train_029668
1,814
no_license
[ { "docstring": "查询店铺信息(单条) @param params: @return:", "name": "query_one", "signature": "async def query_one(self, params)" }, { "docstring": "创建店铺 同时会创建超管和管理员分组数据 @param params: @return:", "name": "create", "signature": "async def create(self, params)" } ]
2
stack_v2_sparse_classes_30k_train_005730
Implement the Python class `Model` described below. Class description: Implement the Model class. Method signatures and docstrings: - async def query_one(self, params): 查询店铺信息(单条) @param params: @return: - async def create(self, params): 创建店铺 同时会创建超管和管理员分组数据 @param params: @return:
Implement the Python class `Model` described below. Class description: Implement the Model class. Method signatures and docstrings: - async def query_one(self, params): 查询店铺信息(单条) @param params: @return: - async def create(self, params): 创建店铺 同时会创建超管和管理员分组数据 @param params: @return: <|skeleton|> class Model: asy...
9ab7dc87b678fc2a105cf883448cb7aada8494d2
<|skeleton|> class Model: async def query_one(self, params): """查询店铺信息(单条) @param params: @return:""" <|body_0|> async def create(self, params): """创建店铺 同时会创建超管和管理员分组数据 @param params: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: async def query_one(self, params): """查询店铺信息(单条) @param params: @return:""" fields = [] condition = '1 = 1' values = [] if not self.util.is_empty('shop_id', params): condition += ' and shop_id = %s' values.append(params['shop_id']) ...
the_stack_v2_python_sparse
src/module/v1/shop/model.py
yuiitsu/DSSP
train
0
69c61670c91bf5714be11c990282ae2e3581ac0c
[ "if not s:\n return ''\nres = s\ns = '#' + '#'.join(list(s)) + '#'\nlength = len(s)\nmid = length // 2\nfor i in range(mid, -1, -1):\n left = i - 1\n right = i + 1\n flag = True\n while left >= 0 and right < length and flag:\n if s[left] != s[right]:\n flag = False\n left -= ...
<|body_start_0|> if not s: return '' res = s s = '#' + '#'.join(list(s)) + '#' length = len(s) mid = length // 2 for i in range(mid, -1, -1): left = i - 1 right = i + 1 flag = True while left >= 0 and right < len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestPalindrome(self, s: str) -> str: """超时解法""" <|body_0|> def shortestPalindrom1e(self, s: str) -> str: """kmp 永远滴神""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s: return '' res = s s = '#' + ...
stack_v2_sparse_classes_36k_train_029669
1,709
no_license
[ { "docstring": "超时解法", "name": "shortestPalindrome", "signature": "def shortestPalindrome(self, s: str) -> str" }, { "docstring": "kmp 永远滴神", "name": "shortestPalindrom1e", "signature": "def shortestPalindrom1e(self, s: str) -> str" } ]
2
stack_v2_sparse_classes_30k_train_013582
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s: str) -> str: 超时解法 - def shortestPalindrom1e(self, s: str) -> str: kmp 永远滴神
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s: str) -> str: 超时解法 - def shortestPalindrom1e(self, s: str) -> str: kmp 永远滴神 <|skeleton|> class Solution: def shortestPalindrome(self, s: str)...
40726506802d2d60028fdce206696b1df2f63ece
<|skeleton|> class Solution: def shortestPalindrome(self, s: str) -> str: """超时解法""" <|body_0|> def shortestPalindrom1e(self, s: str) -> str: """kmp 永远滴神""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shortestPalindrome(self, s: str) -> str: """超时解法""" if not s: return '' res = s s = '#' + '#'.join(list(s)) + '#' length = len(s) mid = length // 2 for i in range(mid, -1, -1): left = i - 1 right = i + 1 ...
the_stack_v2_python_sparse
二刷+题解/每日一题/shortestPalindrome.py
1oser5/LeetCode
train
0
b7faad42a09a27894671d3c52e5cf74350bc9417
[ "expected_content = ['Elisa Miles,LR04,Leather Sofa,25\\n', 'Edward Data,KT78,Kitchen Table,10\\n', 'Alex Gonzales,BR02,Queen Mattress,17\\n']\nadd_furniture('rented_items.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25)\nadd_furniture('rented_items.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10)\nadd_furniture('...
<|body_start_0|> expected_content = ['Elisa Miles,LR04,Leather Sofa,25\n', 'Edward Data,KT78,Kitchen Table,10\n', 'Alex Gonzales,BR02,Queen Mattress,17\n'] add_furniture('rented_items.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25) add_furniture('rented_items.csv', 'Edward Data', 'KT78', 'Kitch...
Define a class for testing inventory functions
InventoryTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryTests: """Define a class for testing inventory functions""" def test_add_furniture(self): """Tests adding furniture to the CSV file""" <|body_0|> def test_single_customer(self): """Tests importing items from a CSV for a single user""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_029670
1,726
no_license
[ { "docstring": "Tests adding furniture to the CSV file", "name": "test_add_furniture", "signature": "def test_add_furniture(self)" }, { "docstring": "Tests importing items from a CSV for a single user", "name": "test_single_customer", "signature": "def test_single_customer(self)" } ]
2
stack_v2_sparse_classes_30k_train_008956
Implement the Python class `InventoryTests` described below. Class description: Define a class for testing inventory functions Method signatures and docstrings: - def test_add_furniture(self): Tests adding furniture to the CSV file - def test_single_customer(self): Tests importing items from a CSV for a single user
Implement the Python class `InventoryTests` described below. Class description: Define a class for testing inventory functions Method signatures and docstrings: - def test_add_furniture(self): Tests adding furniture to the CSV file - def test_single_customer(self): Tests importing items from a CSV for a single user ...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class InventoryTests: """Define a class for testing inventory functions""" def test_add_furniture(self): """Tests adding furniture to the CSV file""" <|body_0|> def test_single_customer(self): """Tests importing items from a CSV for a single user""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InventoryTests: """Define a class for testing inventory functions""" def test_add_furniture(self): """Tests adding furniture to the CSV file""" expected_content = ['Elisa Miles,LR04,Leather Sofa,25\n', 'Edward Data,KT78,Kitchen Table,10\n', 'Alex Gonzales,BR02,Queen Mattress,17\n'] ...
the_stack_v2_python_sparse
students/bcoates/lesson08/test_inventory.py
JavaRod/SP_Python220B_2019
train
1
e8c5ec6b6bb9472db9e0d2be57d6d16e0478ee20
[ "if not Cert(cert).exists():\n pub_ns.abort(400, \"can't publish non-existent certificate\")\nif Cert(cert).owner != get_jwt_identity() and get_jwt_claims()['roles'] != 'admin':\n pub_ns.abort(401, \"you don't own this certificate\")\nc = Cert(cert).publish()\nif c.is_publish():\n return (c.json(), 202)\ne...
<|body_start_0|> if not Cert(cert).exists(): pub_ns.abort(400, "can't publish non-existent certificate") if Cert(cert).owner != get_jwt_identity() and get_jwt_claims()['roles'] != 'admin': pub_ns.abort(401, "you don't own this certificate") c = Cert(cert).publish() ...
publish one certificate
PublishOneCert
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublishOneCert: """publish one certificate""" def put(self, cert): """Publish one owned cert""" <|body_0|> def delete(self, cert): """Unpublish one owned cert""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not Cert(cert).exists(): ...
stack_v2_sparse_classes_36k_train_029671
5,403
permissive
[ { "docstring": "Publish one owned cert", "name": "put", "signature": "def put(self, cert)" }, { "docstring": "Unpublish one owned cert", "name": "delete", "signature": "def delete(self, cert)" } ]
2
stack_v2_sparse_classes_30k_train_020932
Implement the Python class `PublishOneCert` described below. Class description: publish one certificate Method signatures and docstrings: - def put(self, cert): Publish one owned cert - def delete(self, cert): Unpublish one owned cert
Implement the Python class `PublishOneCert` described below. Class description: publish one certificate Method signatures and docstrings: - def put(self, cert): Publish one owned cert - def delete(self, cert): Unpublish one owned cert <|skeleton|> class PublishOneCert: """publish one certificate""" def put(...
6a9bf3a3d73fb3faa7cf1e5cfc757cc360fbafde
<|skeleton|> class PublishOneCert: """publish one certificate""" def put(self, cert): """Publish one owned cert""" <|body_0|> def delete(self, cert): """Unpublish one owned cert""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PublishOneCert: """publish one certificate""" def put(self, cert): """Publish one owned cert""" if not Cert(cert).exists(): pub_ns.abort(400, "can't publish non-existent certificate") if Cert(cert).owner != get_jwt_identity() and get_jwt_claims()['roles'] != 'admin': ...
the_stack_v2_python_sparse
haprestio/api_v1/pub.py
innofocus/haprestio
train
0
36bad1c0cc04e3146b0c850f3a80fd21b31bd3ae
[ "if len(ser_y.unique()) != 2:\n raise ValueError('Must have two classes.')\nself._df_X = df_X\nself._ser_y = ser_y\nself.all = self._order()\nself.chosens = []\nself.removes = []", "ser_fstat = util_classifier.makeFstatDF(self._df_X, self._ser_y, ser_weight=ser_weight)[1]\nser_fstat = ser_fstat.fillna(0)\nser_...
<|body_start_0|> if len(ser_y.unique()) != 2: raise ValueError('Must have two classes.') self._df_X = df_X self._ser_y = ser_y self.all = self._order() self.chosens = [] self.removes = [] <|end_body_0|> <|body_start_1|> ser_fstat = util_classifier.mak...
FeatureCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureCollection: def __init__(self, df_X, ser_y, **kwargs): """:param pd.DataFrame df_X: columns: features index: instances :param pd.Series ser_y: index: instances values: binary class values: 0, 1""" <|body_0|> def _order(self, ser_weight=None): """Constructs fea...
stack_v2_sparse_classes_36k_train_029672
6,221
permissive
[ { "docstring": ":param pd.DataFrame df_X: columns: features index: instances :param pd.Series ser_y: index: instances values: binary class values: 0, 1", "name": "__init__", "signature": "def __init__(self, df_X, ser_y, **kwargs)" }, { "docstring": "Constructs features ordered in descending prio...
6
stack_v2_sparse_classes_30k_train_013417
Implement the Python class `FeatureCollection` described below. Class description: Implement the FeatureCollection class. Method signatures and docstrings: - def __init__(self, df_X, ser_y, **kwargs): :param pd.DataFrame df_X: columns: features index: instances :param pd.Series ser_y: index: instances values: binary ...
Implement the Python class `FeatureCollection` described below. Class description: Implement the FeatureCollection class. Method signatures and docstrings: - def __init__(self, df_X, ser_y, **kwargs): :param pd.DataFrame df_X: columns: features index: instances :param pd.Series ser_y: index: instances values: binary ...
a57542245f117fe6c835cc9d7ad570b9853b7e6c
<|skeleton|> class FeatureCollection: def __init__(self, df_X, ser_y, **kwargs): """:param pd.DataFrame df_X: columns: features index: instances :param pd.Series ser_y: index: instances values: binary class values: 0, 1""" <|body_0|> def _order(self, ser_weight=None): """Constructs fea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureCollection: def __init__(self, df_X, ser_y, **kwargs): """:param pd.DataFrame df_X: columns: features index: instances :param pd.Series ser_y: index: instances values: binary class values: 0, 1""" if len(ser_y.unique()) != 2: raise ValueError('Must have two classes.') ...
the_stack_v2_python_sparse
common_python/classifier/save/feature_collection.py
ScienceStacks/common_python
train
1
8ab848d19dfc0072a1b664b4134e9ea43b47886b
[ "self.radius = radius\nself.x_center = x_center\nself.y_center = y_center", "degree = random.random() * 360\nr = math.sqrt(random.random()) * self.radius\nx = self.x_center + r * math.cos(degree)\ny = self.y_center + r * math.sin(degree)\nreturn [x, y]" ]
<|body_start_0|> self.radius = radius self.x_center = x_center self.y_center = y_center <|end_body_0|> <|body_start_1|> degree = random.random() * 360 r = math.sqrt(random.random()) * self.radius x = self.x_center + r * math.cos(degree) y = self.y_center + r * ma...
Solution_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_1: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float 228ms""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.radiu...
stack_v2_sparse_classes_36k_train_029673
2,530
no_license
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float 228ms", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
stack_v2_sparse_classes_30k_train_000216
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float 228ms - def randPoint(self): :rtype: List[float]
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float 228ms - def randPoint(self): :rtype: List[float] <|skeleton|>...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution_1: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float 228ms""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_1: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float 228ms""" self.radius = radius self.x_center = x_center self.y_center = y_center def randPoint(self): """:rtype: List[float]""" deg...
the_stack_v2_python_sparse
GenerateRandomPointInACircle_MID_883.py
953250587/leetcode-python
train
2
cda0058d12f7a6cf72ee9b6863770fa7f69294c2
[ "self.domain = kwargs.pop('instance', None)\nsuper(DomainLimitsForm, self).__init__(*args, **kwargs)\nfor name, tpl in utils.get_domain_limit_templates():\n self.fields['{}_limit'.format(name)] = forms.IntegerField(label=tpl['label'], help_text=tpl['help'])\nif not self.domain:\n return\nfor fieldname in list...
<|body_start_0|> self.domain = kwargs.pop('instance', None) super(DomainLimitsForm, self).__init__(*args, **kwargs) for name, tpl in utils.get_domain_limit_templates(): self.fields['{}_limit'.format(name)] = forms.IntegerField(label=tpl['label'], help_text=tpl['help']) if not...
Per-domain limits form.
DomainLimitsForm
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DomainLimitsForm: """Per-domain limits form.""" def __init__(self, *args, **kwargs): """Define limits as fields.""" <|body_0|> def clean(self): """Ensure limit values are correct.""" <|body_1|> def save(self, user, **kwargs): """Set limits.""...
stack_v2_sparse_classes_36k_train_029674
3,755
permissive
[ { "docstring": "Define limits as fields.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Ensure limit values are correct.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Set limits.", "name": "save", "signat...
3
null
Implement the Python class `DomainLimitsForm` described below. Class description: Per-domain limits form. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Define limits as fields. - def clean(self): Ensure limit values are correct. - def save(self, user, **kwargs): Set limits.
Implement the Python class `DomainLimitsForm` described below. Class description: Per-domain limits form. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Define limits as fields. - def clean(self): Ensure limit values are correct. - def save(self, user, **kwargs): Set limits. <|skeleton|> cl...
df699aab0799ec1725b6b89be38e56285821c889
<|skeleton|> class DomainLimitsForm: """Per-domain limits form.""" def __init__(self, *args, **kwargs): """Define limits as fields.""" <|body_0|> def clean(self): """Ensure limit values are correct.""" <|body_1|> def save(self, user, **kwargs): """Set limits.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DomainLimitsForm: """Per-domain limits form.""" def __init__(self, *args, **kwargs): """Define limits as fields.""" self.domain = kwargs.pop('instance', None) super(DomainLimitsForm, self).__init__(*args, **kwargs) for name, tpl in utils.get_domain_limit_templates(): ...
the_stack_v2_python_sparse
modoboa/limits/forms.py
modoboa/modoboa
train
2,201
1af32c233fa1289e2541dbf6607a6f358cef0859
[ "try:\n search = request.GET.get('search', '')\n if search:\n brands = self.get_filter_objects(BrandModel, brand=brand_id, model_name__icontains=search)\n else:\n brands = self.get_filter_objects(BrandModel, brand=brand_id)\n serializer = serializers.BrandModelSerializer(brands, many=True)...
<|body_start_0|> try: search = request.GET.get('search', '') if search: brands = self.get_filter_objects(BrandModel, brand=brand_id, model_name__icontains=search) else: brands = self.get_filter_objects(BrandModel, brand=brand_id) se...
Brand Model List and create Endpoint
BrandModelList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrandModelList: """Brand Model List and create Endpoint""" def get(self, request, brand_id): """Returnt the list of Models of particular brand :param request: :param brand_id: :return:""" <|body_0|> def post(self, request, brand_id): """Creates a new brand model ...
stack_v2_sparse_classes_36k_train_029675
23,745
permissive
[ { "docstring": "Returnt the list of Models of particular brand :param request: :param brand_id: :return:", "name": "get", "signature": "def get(self, request, brand_id)" }, { "docstring": "Creates a new brand model :param request: { \"model_name\" : \"Unicorn\" } :param brand_id: :return:", ...
2
stack_v2_sparse_classes_30k_train_012313
Implement the Python class `BrandModelList` described below. Class description: Brand Model List and create Endpoint Method signatures and docstrings: - def get(self, request, brand_id): Returnt the list of Models of particular brand :param request: :param brand_id: :return: - def post(self, request, brand_id): Creat...
Implement the Python class `BrandModelList` described below. Class description: Brand Model List and create Endpoint Method signatures and docstrings: - def get(self, request, brand_id): Returnt the list of Models of particular brand :param request: :param brand_id: :return: - def post(self, request, brand_id): Creat...
1e31affddf60d2de72445a85dd2055bdeba6f670
<|skeleton|> class BrandModelList: """Brand Model List and create Endpoint""" def get(self, request, brand_id): """Returnt the list of Models of particular brand :param request: :param brand_id: :return:""" <|body_0|> def post(self, request, brand_id): """Creates a new brand model ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrandModelList: """Brand Model List and create Endpoint""" def get(self, request, brand_id): """Returnt the list of Models of particular brand :param request: :param brand_id: :return:""" try: search = request.GET.get('search', '') if search: brands...
the_stack_v2_python_sparse
the_mechanic_backend/v0/stock/views.py
muthukumar4999/the-mechanic-backend
train
0
f5c839dcd24ec1129ac3e7aa01a13834a9f8ee86
[ "self.reponame = os.getenv('reponame')\nself.mode = os.getenv('mode')\nself.case_step = os.getenv('case_step')\nself.case_name = os.getenv('case_name')\nself.qa_yaml_name = os.getenv('qa_yaml_name')", "if 'dy2st' in self.case_name:\n os.environ['FLAGS_use_cinn'] = '0'\n logger.info('set org FLAGS_use_cinn a...
<|body_start_0|> self.reponame = os.getenv('reponame') self.mode = os.getenv('mode') self.case_step = os.getenv('case_step') self.case_name = os.getenv('case_name') self.qa_yaml_name = os.getenv('qa_yaml_name') <|end_body_0|> <|body_start_1|> if 'dy2st' in self.case_name...
自定义环境准备
PaddleScience_Case_Start
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaddleScience_Case_Start: """自定义环境准备""" def __init__(self): """初始化变量""" <|body_0|> def build_prepare(self): """执行准备过程""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.reponame = os.getenv('reponame') self.mode = os.getenv('mode') ...
stack_v2_sparse_classes_36k_train_029676
1,637
no_license
[ { "docstring": "初始化变量", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "执行准备过程", "name": "build_prepare", "signature": "def build_prepare(self)" } ]
2
null
Implement the Python class `PaddleScience_Case_Start` described below. Class description: 自定义环境准备 Method signatures and docstrings: - def __init__(self): 初始化变量 - def build_prepare(self): 执行准备过程
Implement the Python class `PaddleScience_Case_Start` described below. Class description: 自定义环境准备 Method signatures and docstrings: - def __init__(self): 初始化变量 - def build_prepare(self): 执行准备过程 <|skeleton|> class PaddleScience_Case_Start: """自定义环境准备""" def __init__(self): """初始化变量""" <|body_...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class PaddleScience_Case_Start: """自定义环境准备""" def __init__(self): """初始化变量""" <|body_0|> def build_prepare(self): """执行准备过程""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaddleScience_Case_Start: """自定义环境准备""" def __init__(self): """初始化变量""" self.reponame = os.getenv('reponame') self.mode = os.getenv('mode') self.case_step = os.getenv('case_step') self.case_name = os.getenv('case_name') self.qa_yaml_name = os.getenv('qa_yam...
the_stack_v2_python_sparse
models_restruct/deepxde/tools/case_start.py
PaddlePaddle/PaddleTest
train
42
c752df3113489b51ea724e5e192530f73b262ab1
[ "self.token_dict = {'l': -1, 'r': 1, 'f': 0}\nself.return_dict = {'l': -1, 'r': 1, 'f': 0, 's': [], 'w': 2}\nself.l_buf = np.zeros((num_step, num_step))\nself.r_buf = np.zeros((num_step, num_step))\nself.f_buf = np.zeros((num_step, num_step))\nself.s_buf = np.zeros((num_step, num_step))\nself.direc_buffers = {'l': ...
<|body_start_0|> self.token_dict = {'l': -1, 'r': 1, 'f': 0} self.return_dict = {'l': -1, 'r': 1, 'f': 0, 's': [], 'w': 2} self.l_buf = np.zeros((num_step, num_step)) self.r_buf = np.zeros((num_step, num_step)) self.f_buf = np.zeros((num_step, num_step)) self.s_buf = np.z...
InstructionFilter2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstructionFilter2D: def __init__(self, num_step, thresh=0.015): """This is a temporal filter for instruction selection translate a language of four words: {left(-1), forward(0), right(1), stop()} to a language of five words: {left(-1), forward(0), right(1), stop(), wait(2)} scheme: spli...
stack_v2_sparse_classes_36k_train_029677
3,652
no_license
[ { "docstring": "This is a temporal filter for instruction selection translate a language of four words: {left(-1), forward(0), right(1), stop()} to a language of five words: {left(-1), forward(0), right(1), stop(), wait(2)} scheme: split the incoming data into 4 channels perform low pass filtering on each chann...
2
stack_v2_sparse_classes_30k_train_019355
Implement the Python class `InstructionFilter2D` described below. Class description: Implement the InstructionFilter2D class. Method signatures and docstrings: - def __init__(self, num_step, thresh=0.015): This is a temporal filter for instruction selection translate a language of four words: {left(-1), forward(0), r...
Implement the Python class `InstructionFilter2D` described below. Class description: Implement the InstructionFilter2D class. Method signatures and docstrings: - def __init__(self, num_step, thresh=0.015): This is a temporal filter for instruction selection translate a language of four words: {left(-1), forward(0), r...
20f1f815fd03bfe95ab52acede3658be0394b3a8
<|skeleton|> class InstructionFilter2D: def __init__(self, num_step, thresh=0.015): """This is a temporal filter for instruction selection translate a language of four words: {left(-1), forward(0), right(1), stop()} to a language of five words: {left(-1), forward(0), right(1), stop(), wait(2)} scheme: spli...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstructionFilter2D: def __init__(self, num_step, thresh=0.015): """This is a temporal filter for instruction selection translate a language of four words: {left(-1), forward(0), right(1), stop()} to a language of five words: {left(-1), forward(0), right(1), stop(), wait(2)} scheme: split the incoming...
the_stack_v2_python_sparse
postprocess/inst_filter2d.py
emistern/EC601_Robotic_Guidedog
train
2
8cc52ef865c61466dc07b260ae6d756ed843f84b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TeamworkActivityTopic()", "from .teamwork_activity_topic_source import TeamworkActivityTopicSource\nfrom .teamwork_activity_topic_source import TeamworkActivityTopicSource\nfields: Dict[str, Callable[[Any], None]] = {'@odata.type': lam...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return TeamworkActivityTopic() <|end_body_0|> <|body_start_1|> from .teamwork_activity_topic_source import TeamworkActivityTopicSource from .teamwork_activity_topic_source import TeamworkActivi...
TeamworkActivityTopic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamworkActivityTopic: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamworkActivityTopic: """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 th...
stack_v2_sparse_classes_36k_train_029678
3,494
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: TeamworkActivityTopic", "name": "create_from_discriminator_value", "signature": "def create_from_discriminat...
3
stack_v2_sparse_classes_30k_train_002166
Implement the Python class `TeamworkActivityTopic` described below. Class description: Implement the TeamworkActivityTopic class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamworkActivityTopic: Creates a new instance of the appropriate class base...
Implement the Python class `TeamworkActivityTopic` described below. Class description: Implement the TeamworkActivityTopic class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamworkActivityTopic: Creates a new instance of the appropriate class base...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class TeamworkActivityTopic: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamworkActivityTopic: """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 th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeamworkActivityTopic: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamworkActivityTopic: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
the_stack_v2_python_sparse
msgraph/generated/models/teamwork_activity_topic.py
microsoftgraph/msgraph-sdk-python
train
135
3ba226bd8235087e580332fb2c887692ffb2d073
[ "self.dest_db_name = dest_db_name\nself.dest_edb_filepath = dest_edb_filepath\nself.dest_log_dirpath = dest_log_dirpath\nself.entity_id = entity_id\nself.mount_db = mount_db\nself.progress_monitor_path = progress_monitor_path\nself.restore_as_recovery_db = restore_as_recovery_db\nself.target_host_entity = target_ho...
<|body_start_0|> self.dest_db_name = dest_db_name self.dest_edb_filepath = dest_edb_filepath self.dest_log_dirpath = dest_log_dirpath self.entity_id = entity_id self.mount_db = mount_db self.progress_monitor_path = progress_monitor_path self.restore_as_recovery_db...
Implementation of the 'RestoreExchangeParams_DatabaseOptions' model. TODO: type description here. Attributes: dest_db_name (string): Destination Database Name dest_edb_filepath (string): Target EDB dir path. Example: e:\\myexchange\\hrdb\\hr_db.edb. dest_log_dirpath (string): Target LOG dir path. Example: e:\\myexchang...
RestoreExchangeParams_DatabaseOptions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreExchangeParams_DatabaseOptions: """Implementation of the 'RestoreExchangeParams_DatabaseOptions' model. TODO: type description here. Attributes: dest_db_name (string): Destination Database Name dest_edb_filepath (string): Target EDB dir path. Example: e:\\myexchange\\hrdb\\hr_db.edb. dest_...
stack_v2_sparse_classes_36k_train_029679
4,408
permissive
[ { "docstring": "Constructor for the RestoreExchangeParams_DatabaseOptions class", "name": "__init__", "signature": "def __init__(self, dest_db_name=None, dest_edb_filepath=None, dest_log_dirpath=None, entity_id=None, mount_db=None, progress_monitor_path=None, restore_as_recovery_db=None, target_host_ent...
2
stack_v2_sparse_classes_30k_train_010990
Implement the Python class `RestoreExchangeParams_DatabaseOptions` described below. Class description: Implementation of the 'RestoreExchangeParams_DatabaseOptions' model. TODO: type description here. Attributes: dest_db_name (string): Destination Database Name dest_edb_filepath (string): Target EDB dir path. Example:...
Implement the Python class `RestoreExchangeParams_DatabaseOptions` described below. Class description: Implementation of the 'RestoreExchangeParams_DatabaseOptions' model. TODO: type description here. Attributes: dest_db_name (string): Destination Database Name dest_edb_filepath (string): Target EDB dir path. Example:...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreExchangeParams_DatabaseOptions: """Implementation of the 'RestoreExchangeParams_DatabaseOptions' model. TODO: type description here. Attributes: dest_db_name (string): Destination Database Name dest_edb_filepath (string): Target EDB dir path. Example: e:\\myexchange\\hrdb\\hr_db.edb. dest_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreExchangeParams_DatabaseOptions: """Implementation of the 'RestoreExchangeParams_DatabaseOptions' model. TODO: type description here. Attributes: dest_db_name (string): Destination Database Name dest_edb_filepath (string): Target EDB dir path. Example: e:\\myexchange\\hrdb\\hr_db.edb. dest_log_dirpath (...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_exchange_params_database_options.py
cohesity/management-sdk-python
train
24
e81c250c6ea0a989d20010fbb48a4148de8f7cf2
[ "for index, item in enumerate(nums):\n if item >= target:\n return index\nreturn index + 1", "nums.append(target)\nnums.sort()\nreturn nums.index(target)", "if not nums or len(nums) == 0:\n return 0\n\ndef binarySearch(a, b, nums, target):\n if a >= b:\n return a\n mid = a + (b - a) //...
<|body_start_0|> for index, item in enumerate(nums): if item >= target: return index return index + 1 <|end_body_0|> <|body_start_1|> nums.append(target) nums.sort() return nums.index(target) <|end_body_1|> <|body_start_2|> if not nums or len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsertFastInPython(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsertNaive(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def searchIns...
stack_v2_sparse_classes_36k_train_029680
1,607
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsertFastInPython", "signature": "def searchInsertFastInPython(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsertNaive", "signature": "de...
4
stack_v2_sparse_classes_30k_train_017213
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsertFastInPython(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsertNaive(self, nums, target): :type nums: List[int] :type tar...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsertFastInPython(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsertNaive(self, nums, target): :type nums: List[int] :type tar...
9bf06e095b5eefe388d33afe0ac4bb702b6a96b4
<|skeleton|> class Solution: def searchInsertFastInPython(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsertNaive(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def searchIns...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsertFastInPython(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" for index, item in enumerate(nums): if item >= target: return index return index + 1 def searchInsertNaive(self, nums, target): ...
the_stack_v2_python_sparse
Easy/SearchInsertPosition.py
JayWelborn/LeetCode
train
0
880e51b5965f8ff091f449f2926c88927e1be818
[ "ObjectManager.__init__(self)\nself.setters.update({'organization': 'set_foreign_key', 'user': 'set_foreign_key', 'starting_value': 'set_general'})\nself.getters.update({'balance': 'get_balance_from_training_unit_account', 'organization': 'get_foreign_key', 'user': 'get_foreign_key', 'training_unit_transactions': '...
<|body_start_0|> ObjectManager.__init__(self) self.setters.update({'organization': 'set_foreign_key', 'user': 'set_foreign_key', 'starting_value': 'set_general'}) self.getters.update({'balance': 'get_balance_from_training_unit_account', 'organization': 'get_foreign_key', 'user': 'get_foreign_key...
Manage TrainingUnitAccounts in the Power Reg system
TrainingUnitAccountManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainingUnitAccountManager: """Manage TrainingUnitAccounts in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, user=None, organization=None): """Create a new TrainingUnitAccount @param user User associated with...
stack_v2_sparse_classes_36k_train_029681
2,052
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a new TrainingUnitAccount @param user User associated with this account. Mutually exclusive with company. @param organization organization associated with this account. Mutually exclusiv...
2
null
Implement the Python class `TrainingUnitAccountManager` described below. Class description: Manage TrainingUnitAccounts in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, user=None, organization=None): Create a new TrainingUnitAccount @param user...
Implement the Python class `TrainingUnitAccountManager` described below. Class description: Manage TrainingUnitAccounts in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, user=None, organization=None): Create a new TrainingUnitAccount @param user...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class TrainingUnitAccountManager: """Manage TrainingUnitAccounts in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, user=None, organization=None): """Create a new TrainingUnitAccount @param user User associated with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainingUnitAccountManager: """Manage TrainingUnitAccounts in the Power Reg system""" def __init__(self): """constructor""" ObjectManager.__init__(self) self.setters.update({'organization': 'set_foreign_key', 'user': 'set_foreign_key', 'starting_value': 'set_general'}) sel...
the_stack_v2_python_sparse
pr_services/product_system/training_unit_account_manager.py
ninemoreminutes/openassign-server
train
0
7be8667b460c88fb3cc502f3a9583e0b0f872255
[ "prefixs = collections.defaultdict(list)\nfor word in words:\n prefixs[word[0]].append(iter(word[1:]))\nfor c in S:\n for it in prefixs.pop(c, ()):\n prefixs[next(it, None)].append(it)\nreturn len(prefixs[None])", "def match(word):\n i, j = (len(S) - 1, len(word) - 1)\n while i >= 0 and j >= 0:...
<|body_start_0|> prefixs = collections.defaultdict(list) for word in words: prefixs[word[0]].append(iter(word[1:])) for c in S: for it in prefixs.pop(c, ()): prefixs[next(it, None)].append(it) return len(prefixs[None]) <|end_body_0|> <|body_start_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numMatchingSubseq(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_0|> def numMatchingSubseq_TLE(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_029682
2,891
no_license
[ { "docstring": ":type S: str :type words: List[str] :rtype: int", "name": "numMatchingSubseq", "signature": "def numMatchingSubseq(self, S, words)" }, { "docstring": ":type S: str :type words: List[str] :rtype: int", "name": "numMatchingSubseq_TLE", "signature": "def numMatchingSubseq_TL...
2
stack_v2_sparse_classes_30k_train_015552
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S, words): :type S: str :type words: List[str] :rtype: int - def numMatchingSubseq_TLE(self, S, words): :type S: str :type words: List[str] :rtype: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S, words): :type S: str :type words: List[str] :rtype: int - def numMatchingSubseq_TLE(self, S, words): :type S: str :type words: List[str] :rtype: in...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def numMatchingSubseq(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_0|> def numMatchingSubseq_TLE(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numMatchingSubseq(self, S, words): """:type S: str :type words: List[str] :rtype: int""" prefixs = collections.defaultdict(list) for word in words: prefixs[word[0]].append(iter(word[1:])) for c in S: for it in prefixs.pop(c, ()): ...
the_stack_v2_python_sparse
src/lt_792.py
oxhead/CodingYourWay
train
0
3648ac67028093bc9369b2598bb6e510ecd1bf76
[ "opt_warning = self.DEFAULT_WARNING\nopt_critical = self.DEFAULT_CRITICAL\nopt_logfile_name = self.DEFAULT_LOGFILE\nopt_reference = self.DEFAULT_REFERENCE\nopt_period = self.DEFAULT_PERIOD\nif 'warning' in opt:\n opt_warning = opt['warning']\nif 'critical' in opt:\n opt_critical = opt['critical']\nif 'logfile...
<|body_start_0|> opt_warning = self.DEFAULT_WARNING opt_critical = self.DEFAULT_CRITICAL opt_logfile_name = self.DEFAULT_LOGFILE opt_reference = self.DEFAULT_REFERENCE opt_period = self.DEFAULT_PERIOD if 'warning' in opt: opt_warning = opt['warning'] i...
Check the average execution time for each function in the DPNS logfile
check_lfc_perf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class check_lfc_perf: """Check the average execution time for each function in the DPNS logfile""" def __init__(self, opt={}, args=[]): """Constructor @param opt Contains a dictionary with the long option name as the key, and the argument as value @param args Contains the arguments not ass...
stack_v2_sparse_classes_36k_train_029683
4,915
no_license
[ { "docstring": "Constructor @param opt Contains a dictionary with the long option name as the key, and the argument as value @param args Contains the arguments not associated with any option", "name": "__init__", "signature": "def __init__(self, opt={}, args=[])" }, { "docstring": "Test code its...
2
stack_v2_sparse_classes_30k_train_009936
Implement the Python class `check_lfc_perf` described below. Class description: Check the average execution time for each function in the DPNS logfile Method signatures and docstrings: - def __init__(self, opt={}, args=[]): Constructor @param opt Contains a dictionary with the long option name as the key, and the arg...
Implement the Python class `check_lfc_perf` described below. Class description: Check the average execution time for each function in the DPNS logfile Method signatures and docstrings: - def __init__(self, opt={}, args=[]): Constructor @param opt Contains a dictionary with the long option name as the key, and the arg...
270b7d2fff4ae56735d53fa99bb1613c07f1f9a3
<|skeleton|> class check_lfc_perf: """Check the average execution time for each function in the DPNS logfile""" def __init__(self, opt={}, args=[]): """Constructor @param opt Contains a dictionary with the long option name as the key, and the argument as value @param args Contains the arguments not ass...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class check_lfc_perf: """Check the average execution time for each function in the DPNS logfile""" def __init__(self, opt={}, args=[]): """Constructor @param opt Contains a dictionary with the long option name as the key, and the argument as value @param args Contains the arguments not associated with ...
the_stack_v2_python_sparse
cambox-package/plugins/lcgdm/check_lfc_perf
usuporte/install.issabel
train
1
bd6afedc1074725d2f7ced87041e895aeb78ce30
[ "def helper_serialize(node, string):\n if node is None:\n string += 'None,'\n else:\n string += str(node.val) + ','\n string = helper_serialize(node.left, string)\n string = helper_serialize(node.right, string)\n return string\nreturn helper_serialize(root, '')", "def helper_d...
<|body_start_0|> def helper_serialize(node, string): if node is None: string += 'None,' else: string += str(node.val) + ',' string = helper_serialize(node.left, string) string = helper_serialize(node.right, string) ...
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_029684
3,469
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_006808
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:...
0a34a19bb0979d58b511822782098f62cd86b25e
<|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""" def helper_serialize(node, string): if node is None: string += 'None,' else: string += str(node.val) + ',' string ...
the_stack_v2_python_sparse
Tree/L297_Serialize_Deserialize_Binary_Tree_latest.py
SimonFans/LeetCode
train
1
00036ff9a57b5d138ddfc72cf02545214758506e
[ "r, nr = (0, 0)\nfor i in range(len(nums)):\n tmp = nr\n nr = max(r, nr)\n r = tmp + nums[i]\nreturn max(r, nr)", "def helper(start, stop):\n r, nr = (0, 0)\n for i in range(start, stop):\n tmp = nr\n nr = max(r, nr)\n r = tmp + nums[i]\n return max(r, nr)\nif len(nums) == 1...
<|body_start_0|> r, nr = (0, 0) for i in range(len(nums)): tmp = nr nr = max(r, nr) r = tmp + nums[i] return max(r, nr) <|end_body_0|> <|body_start_1|> def helper(start, stop): r, nr = (0, 0) for i in range(start, stop): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob1(self, nums): """line :param nums: :return:""" <|body_0|> def rob2(self, nums): """circle :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> r, nr = (0, 0) for i in range(len(nums)): ...
stack_v2_sparse_classes_36k_train_029685
790
no_license
[ { "docstring": "line :param nums: :return:", "name": "rob1", "signature": "def rob1(self, nums)" }, { "docstring": "circle :type nums: List[int] :rtype: int", "name": "rob2", "signature": "def rob2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_004706
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob1(self, nums): line :param nums: :return: - def rob2(self, nums): circle :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob1(self, nums): line :param nums: :return: - def rob2(self, nums): circle :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob1(self, nums): ...
e16702d2b3ec4e5054baad56f4320bc3b31676ad
<|skeleton|> class Solution: def rob1(self, nums): """line :param nums: :return:""" <|body_0|> def rob2(self, nums): """circle :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob1(self, nums): """line :param nums: :return:""" r, nr = (0, 0) for i in range(len(nums)): tmp = nr nr = max(r, nr) r = tmp + nums[i] return max(r, nr) def rob2(self, nums): """circle :type nums: List[int] :rtype:...
the_stack_v2_python_sparse
leetcode/medium/house_robber.py
SuperMartinYang/learning_algorithm
train
0
ccea63b99cd218dd271a94bb122938b67e6cdea1
[ "SEARCH_URL = 'https://www.googleapis.com/customsearch/v1'\nkwargs.update({'q': query, 'cx': settings.SEARCH_GOOGLE_CX, 'num': 10, 'key': settings.SEARCH_GOOGLE_KEY})\nresponse = requests.get(SEARCH_URL, params=kwargs)\nassert response.status_code == 200, 'Something went wrong: ' + response.text\nresults = response...
<|body_start_0|> SEARCH_URL = 'https://www.googleapis.com/customsearch/v1' kwargs.update({'q': query, 'cx': settings.SEARCH_GOOGLE_CX, 'num': 10, 'key': settings.SEARCH_GOOGLE_KEY}) response = requests.get(SEARCH_URL, params=kwargs) assert response.status_code == 200, 'Something went wro...
The query map caches search results from a search query to the set of Document results.
QueryMap
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryMap: """The query map caches search results from a search query to the set of Document results.""" def query_google(cls, query, **kwargs): """Query google for document.""" <|body_0|> def get(cls, query): """Get query or ask Google for elements.""" <|...
stack_v2_sparse_classes_36k_train_029686
2,712
permissive
[ { "docstring": "Query google for document.", "name": "query_google", "signature": "def query_google(cls, query, **kwargs)" }, { "docstring": "Get query or ask Google for elements.", "name": "get", "signature": "def get(cls, query)" } ]
2
stack_v2_sparse_classes_30k_train_002820
Implement the Python class `QueryMap` described below. Class description: The query map caches search results from a search query to the set of Document results. Method signatures and docstrings: - def query_google(cls, query, **kwargs): Query google for document. - def get(cls, query): Get query or ask Google for el...
Implement the Python class `QueryMap` described below. Class description: The query map caches search results from a search query to the set of Document results. Method signatures and docstrings: - def query_google(cls, query, **kwargs): Query google for document. - def get(cls, query): Get query or ask Google for el...
d3667ea666c02b7a71af1c26c4b22b9f4ab4c7c0
<|skeleton|> class QueryMap: """The query map caches search results from a search query to the set of Document results.""" def query_google(cls, query, **kwargs): """Query google for document.""" <|body_0|> def get(cls, query): """Get query or ask Google for elements.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryMap: """The query map caches search results from a search query to the set of Document results.""" def query_google(cls, query, **kwargs): """Query google for document.""" SEARCH_URL = 'https://www.googleapis.com/customsearch/v1' kwargs.update({'q': query, 'cx': settings.SEAR...
the_stack_v2_python_sparse
django/search/models.py
arunchaganty/hypatia
train
0
4bf718186e928def650b50fc3a6155b8f88d8b2a
[ "if maxValue <= minValue:\n raise ValueError('maxValue must be greater than minValue')\nif notificationStepValue <= 0:\n raise ValueError('notificationStepValue must be positive')\nself.minValue = minValue\nself.maxValue = maxValue\nself.notificationStepValue = notificationStepValue\nself.label = label\nself....
<|body_start_0|> if maxValue <= minValue: raise ValueError('maxValue must be greater than minValue') if notificationStepValue <= 0: raise ValueError('notificationStepValue must be positive') self.minValue = minValue self.maxValue = maxValue self.notificati...
Given a valid value range, track the state of the value, and send an warning alert when the value is out of range. Send another info alert when the value is back to the normal range.
RangeViolationAlert
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RangeViolationAlert: """Given a valid value range, track the state of the value, and send an warning alert when the value is out of range. Send another info alert when the value is back to the normal range.""" def __init__(self, minValue, maxValue, notificationStepValue=3, label='value', uni...
stack_v2_sparse_classes_36k_train_029687
3,957
no_license
[ { "docstring": "Ctor :param int minValue: the minimum good value :param int maxValue: the maximum good value :param int notificationStepValue: the value at which point a notification email will be sent. E.g. with the default maxValue of 50 and the step value of 3, the first notification is at 53, and the next o...
3
stack_v2_sparse_classes_30k_train_019593
Implement the Python class `RangeViolationAlert` described below. Class description: Given a valid value range, track the state of the value, and send an warning alert when the value is out of range. Send another info alert when the value is back to the normal range. Method signatures and docstrings: - def __init__(s...
Implement the Python class `RangeViolationAlert` described below. Class description: Given a valid value range, track the state of the value, and send an warning alert when the value is out of range. Send another info alert when the value is back to the normal range. Method signatures and docstrings: - def __init__(s...
c64c9e109173277b6b4b2473adaac9d2da623cdb
<|skeleton|> class RangeViolationAlert: """Given a valid value range, track the state of the value, and send an warning alert when the value is out of range. Send another info alert when the value is back to the normal range.""" def __init__(self, minValue, maxValue, notificationStepValue=3, label='value', uni...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RangeViolationAlert: """Given a valid value range, track the state of the value, and send an warning alert when the value is out of range. Send another info alert when the value is back to the normal range.""" def __init__(self, minValue, maxValue, notificationStepValue=3, label='value', unit='', module=...
the_stack_v2_python_sparse
legacy-jython-code/aaa_modules/layout_model/actions/range_violation_alert.py
yfaway/openhab-rules
train
10
6cb05fedc0d07d6e102e21b7cc68d67d3c663358
[ "if Capability.SHELL not in capability:\n return\nfacts = []\nfor fact in pwncat.victim.enumerate('screen-version'):\n progress.update(task, step=str(fact.data))\n if fact.data.vulnerable and fact.data.perms & 2048:\n facts.append(fact)\nfor fact in facts:\n progress.update(task, step=str(fact.da...
<|body_start_0|> if Capability.SHELL not in capability: return facts = [] for fact in pwncat.victim.enumerate('screen-version'): progress.update(task, step=str(fact.data)) if fact.data.vulnerable and fact.data.perms & 2048: facts.append(fact) ...
Method
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Method: def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: """Find all techniques known at this time""" <|body_0|> def execute(self, technique: Technique): """Run the specified technique""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_029688
5,063
no_license
[ { "docstring": "Find all techniques known at this time", "name": "enumerate", "signature": "def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]" }, { "docstring": "Run the specified technique", "name": "execute", "signature": "def execute(self, techniqu...
2
stack_v2_sparse_classes_30k_train_019240
Implement the Python class `Method` described below. Class description: Implement the Method class. Method signatures and docstrings: - def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: Find all techniques known at this time - def execute(self, technique: Technique): Run the spec...
Implement the Python class `Method` described below. Class description: Implement the Method class. Method signatures and docstrings: - def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: Find all techniques known at this time - def execute(self, technique: Technique): Run the spec...
30e084ab6e8c41fa2f0a43b557b308599eb0bdf3
<|skeleton|> class Method: def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: """Find all techniques known at this time""" <|body_0|> def execute(self, technique: Technique): """Run the specified technique""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Method: def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: """Find all techniques known at this time""" if Capability.SHELL not in capability: return facts = [] for fact in pwncat.victim.enumerate('screen-version'): p...
the_stack_v2_python_sparse
pwncat/privesc/screen.py
tilt41/pwncat
train
1
9f1d6e090f6cce87e8cd404da4bb1e755af33091
[ "import hashlib\nfrom concurrent.futures import ThreadPoolExecutor\npathstr = str(path)\npaths: list[str] = []\nif path.is_dir():\n for basename, _dirnames, filenames in os.walk(path):\n for filename in filenames:\n fullname = os.path.join(basename, filename)\n assert fullname.starts...
<|body_start_0|> import hashlib from concurrent.futures import ThreadPoolExecutor pathstr = str(path) paths: list[str] = [] if path.is_dir(): for basename, _dirnames, filenames in os.walk(path): for filename in filenames: fullname =...
Contains a summary of files in a directory.
DirectoryManifest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectoryManifest: """Contains a summary of files in a directory.""" def create_from_disk(cls, path: Path) -> DirectoryManifest: """Create a manifest from a directory on disk.""" <|body_0|> def validate(self) -> None: """Log any odd data in the manifest; for debu...
stack_v2_sparse_classes_36k_train_029689
3,457
permissive
[ { "docstring": "Create a manifest from a directory on disk.", "name": "create_from_disk", "signature": "def create_from_disk(cls, path: Path) -> DirectoryManifest" }, { "docstring": "Log any odd data in the manifest; for debugging.", "name": "validate", "signature": "def validate(self) -...
3
null
Implement the Python class `DirectoryManifest` described below. Class description: Contains a summary of files in a directory. Method signatures and docstrings: - def create_from_disk(cls, path: Path) -> DirectoryManifest: Create a manifest from a directory on disk. - def validate(self) -> None: Log any odd data in t...
Implement the Python class `DirectoryManifest` described below. Class description: Contains a summary of files in a directory. Method signatures and docstrings: - def create_from_disk(cls, path: Path) -> DirectoryManifest: Create a manifest from a directory on disk. - def validate(self) -> None: Log any odd data in t...
9aa73cd20941655e96b0e626017a7395ccb40062
<|skeleton|> class DirectoryManifest: """Contains a summary of files in a directory.""" def create_from_disk(cls, path: Path) -> DirectoryManifest: """Create a manifest from a directory on disk.""" <|body_0|> def validate(self) -> None: """Log any odd data in the manifest; for debu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DirectoryManifest: """Contains a summary of files in a directory.""" def create_from_disk(cls, path: Path) -> DirectoryManifest: """Create a manifest from a directory on disk.""" import hashlib from concurrent.futures import ThreadPoolExecutor pathstr = str(path) p...
the_stack_v2_python_sparse
tools/bacommon/transfer.py
sudo-logic/ballistica
train
0
0c84a257e1c71ce22355e208943679dfaed42aaf
[ "if body in SKIP_IN_PATH:\n raise ValueError(\"Empty value passed for a required argument 'body'.\")\nreturn self.transport.perform_request('POST', '/_sql/close', params=params, body=body)", "if body in SKIP_IN_PATH:\n raise ValueError(\"Empty value passed for a required argument 'body'.\")\nreturn self.tra...
<|body_start_0|> if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request('POST', '/_sql/close', params=params, body=body) <|end_body_0|> <|body_start_1|> if body in SKIP_IN_PATH: raise ValueErr...
SqlClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqlClient: def clear_cursor(self, body, params=None): """`<Clear SQL cursor>`_ :arg body: Specify the cursor value in the `cursor` element to clean the cursor.""" <|body_0|> def query(self, body, params=None): """`<Execute SQL>`_ :arg body: Use the `query` element to...
stack_v2_sparse_classes_36k_train_029690
1,532
permissive
[ { "docstring": "`<Clear SQL cursor>`_ :arg body: Specify the cursor value in the `cursor` element to clean the cursor.", "name": "clear_cursor", "signature": "def clear_cursor(self, body, params=None)" }, { "docstring": "`<Execute SQL>`_ :arg body: Use the `query` element to start a query. Use t...
3
stack_v2_sparse_classes_30k_train_004573
Implement the Python class `SqlClient` described below. Class description: Implement the SqlClient class. Method signatures and docstrings: - def clear_cursor(self, body, params=None): `<Clear SQL cursor>`_ :arg body: Specify the cursor value in the `cursor` element to clean the cursor. - def query(self, body, params...
Implement the Python class `SqlClient` described below. Class description: Implement the SqlClient class. Method signatures and docstrings: - def clear_cursor(self, body, params=None): `<Clear SQL cursor>`_ :arg body: Specify the cursor value in the `cursor` element to clean the cursor. - def query(self, body, params...
e68eeb1d2d949101205836b07e85dafa1d94cd1d
<|skeleton|> class SqlClient: def clear_cursor(self, body, params=None): """`<Clear SQL cursor>`_ :arg body: Specify the cursor value in the `cursor` element to clean the cursor.""" <|body_0|> def query(self, body, params=None): """`<Execute SQL>`_ :arg body: Use the `query` element to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SqlClient: def clear_cursor(self, body, params=None): """`<Clear SQL cursor>`_ :arg body: Specify the cursor value in the `cursor` element to clean the cursor.""" if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.tra...
the_stack_v2_python_sparse
elasticsearch/client/sql.py
lumigo-io/elasticsearch-py
train
3
d4ba1cd917884ee1503fe147fe6bb3ed9493e61f
[ "def serialize_core(root):\n str = ''\n if not root:\n str += '$'\n str += ' '\n return\n str += str(root.val)\n str += ' '\n return str + serialize_core(root.left) + serialize_core(root.right)\nif not root:\n return '$ '\nreturn serialize_core(root)", "if not data:\n ret...
<|body_start_0|> def serialize_core(root): str = '' if not root: str += '$' str += ' ' return str += str(root.val) str += ' ' return str + serialize_core(root.left) + serialize_core(root.right) if...
Codec2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec2: 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_029691
2,353
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_013572
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 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 :rtyp...
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 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 :rtyp...
ce29ea836bd20841d69972180273e4d4ec11514d
<|skeleton|> class Codec2: 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 Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def serialize_core(root): str = '' if not root: str += '$' str += ' ' return str += str(root.val) ...
the_stack_v2_python_sparse
37.py
NeilWangziyu/JZOffer
train
1
9f502c61502662aac3707af67bd11cec7c4b4805
[ "def gen_preorder(node):\n if not node:\n yield '#'\n else:\n yield str(node.val)\n yield from gen_preorder(node.left)\n yield from gen_preorder(node.right)\nreturn ','.join(gen_preorder(root))", "chunk_iter = iter(data.split(','))\n\ndef builder():\n val = next(chunk_iter)\n ...
<|body_start_0|> def gen_preorder(node): if not node: yield '#' else: yield str(node.val) yield from gen_preorder(node.left) yield from gen_preorder(node.right) return ','.join(gen_preorder(root)) <|end_body_0|> <|b...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> def gen_preorde...
stack_v2_sparse_classes_36k_train_029692
3,644
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserialize(self, data)" } ]
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. - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: TreeNode
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. - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: TreeNode <|skeleton|> class Cod...
44765a7d89423b7ec2c159f70b1a6f6e446523c2
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|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.""" def gen_preorder(node): if not node: yield '#' else: yield str(node.val) yield from gen_preorder(node.left) yield from gen_preorder...
the_stack_v2_python_sparse
python/_0001_0500/0449_serialize-and-deserialize-bst.py
Wang-Yann/LeetCodeMe
train
0
b07a0bf81931f815f463491ffff90fedaf381742
[ "ui = os.path.join(_config.get_data_path(), 'ui', 'SeleccionAlumnos.ui')\nif not os.path.exists(ui):\n ui = None\nif stand_alone:\n top_widget = 'seleccion_alumnos'\nelse:\n top_widget = 'sw_scroller'\nView.__init__(self, builder=ui, parent=parent, top=top_widget)\nreturn", "res = self['seleccion_alumnos...
<|body_start_0|> ui = os.path.join(_config.get_data_path(), 'ui', 'SeleccionAlumnos.ui') if not os.path.exists(ui): ui = None if stand_alone: top_widget = 'seleccion_alumnos' else: top_widget = 'sw_scroller' View.__init__(self, builder=ui, pare...
BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()
SeleccionAlumnosView
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeleccionAlumnosView: """BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()""" def __init__(self, parent=None, stand_alone=True): """Constructor for AlumnoView reads a graphical representation of ...
stack_v2_sparse_classes_36k_train_029693
1,559
permissive
[ { "docstring": "Constructor for AlumnoView reads a graphical representation of the view from a glade file. parent: The name of the window that spawned this one stand_alone: If true, this view is a window unto itself. If not, it is embedded in another window.", "name": "__init__", "signature": "def __ini...
2
null
Implement the Python class `SeleccionAlumnosView` described below. Class description: BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run() Method signatures and docstrings: - def __init__(self, parent=None, stand_alone=True): Constr...
Implement the Python class `SeleccionAlumnosView` described below. Class description: BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run() Method signatures and docstrings: - def __init__(self, parent=None, stand_alone=True): Constr...
1ec22552a3bd3e46dd3d647d007424f5a355f0ff
<|skeleton|> class SeleccionAlumnosView: """BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()""" def __init__(self, parent=None, stand_alone=True): """Constructor for AlumnoView reads a graphical representation of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeleccionAlumnosView: """BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()""" def __init__(self, parent=None, stand_alone=True): """Constructor for AlumnoView reads a graphical representation of the view from...
the_stack_v2_python_sparse
gestionacademia/views/seleccionalumnos_view.py
jonlatorre/gestionacademia
train
1
91442f6d224b496bd35061a83b4e0e9c7d1a677b
[ "self.nums = nums\nself.cacheId = None\nself.candidates = []", "if self.cacheId != target:\n self.cacheId = target\n self.candidates[:] = []\n for index, i in enumerate(self.nums):\n if i == target:\n self.candidates.append(index)\nreturn self.candidates[random.randint(0, len(self.candi...
<|body_start_0|> self.nums = nums self.cacheId = None self.candidates = [] <|end_body_0|> <|body_start_1|> if self.cacheId != target: self.cacheId = target self.candidates[:] = [] for index, i in enumerate(self.nums): if i == target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.nums = nums self.cacheId = None ...
stack_v2_sparse_classes_36k_train_029694
800
no_license
[ { "docstring": ":type nums: List[int] :type numsSize: int", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type target: int :rtype: int", "name": "pick", "signature": "def pick(self, target)" } ]
2
stack_v2_sparse_classes_30k_train_013888
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type numsSize: int - def pick(self, target): :type target: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type numsSize: int - def pick(self, target): :type target: int :rtype: int <|skeleton|> class Solution: def __init__(self, ...
01498cd07e552d8ddf7b7fb7f8b8c71f303a4a87
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" self.nums = nums self.cacheId = None self.candidates = [] def pick(self, target): """:type target: int :rtype: int""" if self.cacheId != target: self.cacheId = t...
the_stack_v2_python_sparse
leetcode/398. Random Pick Index/398._Random_Pick_Index_2.py
tyge318/tyge318.github.io
train
1
2874baaa24f1c2cdafe8577cd7b68d50be0329b1
[ "items = range(5)\ncombo = random_combination_with_replacement(items, len(items) * 2)\neq_(2 * len(items), len(combo))\nif len(set(combo)) == len(combo):\n raise AssertionError('Combination contained no duplicates')", "items = range(15)\nall_items = set()\nfor _ in xrange(50):\n combination = random_combina...
<|body_start_0|> items = range(5) combo = random_combination_with_replacement(items, len(items) * 2) eq_(2 * len(items), len(combo)) if len(set(combo)) == len(combo): raise AssertionError('Combination contained no duplicates') <|end_body_0|> <|body_start_1|> items = ...
Tests for ``random_combination_with_replacement()``
RandomCombinationWithReplacementTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomCombinationWithReplacementTests: """Tests for ``random_combination_with_replacement()``""" def test_replacement(self): """ensure that elements are sampled with replacement""" <|body_0|> def test_psuedorandomness(self): """ensure different subsets of the ite...
stack_v2_sparse_classes_36k_train_029695
47,145
no_license
[ { "docstring": "ensure that elements are sampled with replacement", "name": "test_replacement", "signature": "def test_replacement(self)" }, { "docstring": "ensure different subsets of the iterable get returned over many samplings of random combinations", "name": "test_psuedorandomness", ...
2
null
Implement the Python class `RandomCombinationWithReplacementTests` described below. Class description: Tests for ``random_combination_with_replacement()`` Method signatures and docstrings: - def test_replacement(self): ensure that elements are sampled with replacement - def test_psuedorandomness(self): ensure differe...
Implement the Python class `RandomCombinationWithReplacementTests` described below. Class description: Tests for ``random_combination_with_replacement()`` Method signatures and docstrings: - def test_replacement(self): ensure that elements are sampled with replacement - def test_psuedorandomness(self): ensure differe...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class RandomCombinationWithReplacementTests: """Tests for ``random_combination_with_replacement()``""" def test_replacement(self): """ensure that elements are sampled with replacement""" <|body_0|> def test_psuedorandomness(self): """ensure different subsets of the ite...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomCombinationWithReplacementTests: """Tests for ``random_combination_with_replacement()``""" def test_replacement(self): """ensure that elements are sampled with replacement""" items = range(5) combo = random_combination_with_replacement(items, len(items) * 2) eq_(2 * ...
the_stack_v2_python_sparse
repoData/erikrose-more-itertools/allPythonContent.py
aCoffeeYin/pyreco
train
0
bf066cbc17a32102c3bb2eea848caf82c68e5a8b
[ "ans = defaultdict(list)\nfor string in strs:\n count = [0] * 26\n for char in string:\n count[ord(char) - ord('a')] += 1\n ans[tuple(count)].append(string)\nreturn ans.values()", "ans = defaultdict(list)\nfor string in strs:\n ans[tuple(sorted(string))].append(string)\nreturn ans.values()" ]
<|body_start_0|> ans = defaultdict(list) for string in strs: count = [0] * 26 for char in string: count[ord(char) - ord('a')] += 1 ans[tuple(count)].append(string) return ans.values() <|end_body_0|> <|body_start_1|> ans = defaultdict(l...
Anagrams
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Anagrams: def group(self, strs: List[str]) -> List[str]: """Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:""" <|body_0|> def group_(self, strs: List[str]) -> List[str]: """Approach: Categorize by sorted string Time ...
stack_v2_sparse_classes_36k_train_029696
1,103
no_license
[ { "docstring": "Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:", "name": "group", "signature": "def group(self, strs: List[str]) -> List[str]" }, { "docstring": "Approach: Categorize by sorted string Time Complexity: O(N log K) Space Complexity...
2
stack_v2_sparse_classes_30k_test_000961
Implement the Python class `Anagrams` described below. Class description: Implement the Anagrams class. Method signatures and docstrings: - def group(self, strs: List[str]) -> List[str]: Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return: - def group_(self, strs: List[st...
Implement the Python class `Anagrams` described below. Class description: Implement the Anagrams class. Method signatures and docstrings: - def group(self, strs: List[str]) -> List[str]: Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return: - def group_(self, strs: List[st...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Anagrams: def group(self, strs: List[str]) -> List[str]: """Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:""" <|body_0|> def group_(self, strs: List[str]) -> List[str]: """Approach: Categorize by sorted string Time ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Anagrams: def group(self, strs: List[str]) -> List[str]: """Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:""" ans = defaultdict(list) for string in strs: count = [0] * 26 for char in string: cou...
the_stack_v2_python_sparse
revisited_2021/math_and_string/group_anagrams.py
Shiv2157k/leet_code
train
1
2ddecd9114f9d28791355050c36172b4f42fbdf5
[ "self.name = label.get('Name')\nself.confidence = label.get('Confidence')\nself.parent_name = label.get('ParentName')\nself.timestamp = timestamp", "rendering = {}\nif self.name is not None:\n rendering['name'] = self.name\nif self.parent_name is not None:\n rendering['parent_name'] = self.parent_name\nif s...
<|body_start_0|> self.name = label.get('Name') self.confidence = label.get('Confidence') self.parent_name = label.get('ParentName') self.timestamp = timestamp <|end_body_0|> <|body_start_1|> rendering = {} if self.name is not None: rendering['name'] = self.na...
Encapsulates an Amazon Rekognition moderation label.
RekognitionModerationLabel
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RekognitionModerationLabel: """Encapsulates an Amazon Rekognition moderation label.""" def __init__(self, label, timestamp=None): """Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time w...
stack_v2_sparse_classes_36k_train_029697
11,689
permissive
[ { "docstring": "Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the moderation label was detected, if the label was detected in a video.", "name": "__init__", "signature": "def __init__(self, label...
2
null
Implement the Python class `RekognitionModerationLabel` described below. Class description: Encapsulates an Amazon Rekognition moderation label. Method signatures and docstrings: - def __init__(self, label, timestamp=None): Initializes the moderation label object. :param label: Label data, in the format returned by A...
Implement the Python class `RekognitionModerationLabel` described below. Class description: Encapsulates an Amazon Rekognition moderation label. Method signatures and docstrings: - def __init__(self, label, timestamp=None): Initializes the moderation label object. :param label: Label data, in the format returned by A...
dec41fb589043ac9d8667aac36fb88a53c3abe50
<|skeleton|> class RekognitionModerationLabel: """Encapsulates an Amazon Rekognition moderation label.""" def __init__(self, label, timestamp=None): """Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RekognitionModerationLabel: """Encapsulates an Amazon Rekognition moderation label.""" def __init__(self, label, timestamp=None): """Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the moder...
the_stack_v2_python_sparse
python/example_code/rekognition/rekognition_objects.py
awsdocs/aws-doc-sdk-examples
train
8,240
7dae28a51ac9c9132fe1b2456da15f6722aa5d16
[ "zero_rows = [False] * len(matrix)\nzero_columns = [False] * len(matrix[0])\nfor i in range(0, len(matrix)):\n for j in range(0, len(matrix[i])):\n if matrix[i][j] == 0:\n zero_rows[i] = True\n zero_columns[j] = True\nfor i in range(0, len(matrix)):\n for j in range(0, len(matrix[...
<|body_start_0|> zero_rows = [False] * len(matrix) zero_columns = [False] * len(matrix[0]) for i in range(0, len(matrix)): for j in range(0, len(matrix[i])): if matrix[i][j] == 0: zero_rows[i] = True zero_columns[j] = True ...
MatrixZeros
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatrixZeros: def set_zeroes(matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def set_zeroes_efficient(matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify mat...
stack_v2_sparse_classes_36k_train_029698
1,689
permissive
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "set_zeroes", "signature": "def set_zeroes(matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",...
2
null
Implement the Python class `MatrixZeros` described below. Class description: Implement the MatrixZeros class. Method signatures and docstrings: - def set_zeroes(matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def set_zeroes_efficient(matrix): :type matrix:...
Implement the Python class `MatrixZeros` described below. Class description: Implement the MatrixZeros class. Method signatures and docstrings: - def set_zeroes(matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def set_zeroes_efficient(matrix): :type matrix:...
77838c37e3fdae0f2ec628aa7ddc59f4a5949bbe
<|skeleton|> class MatrixZeros: def set_zeroes(matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def set_zeroes_efficient(matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify mat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatrixZeros: def set_zeroes(matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" zero_rows = [False] * len(matrix) zero_columns = [False] * len(matrix[0]) for i in range(0, len(matrix)): for j in range(0, ...
the_stack_v2_python_sparse
Python/dev/arrays/matrix_zeroes.py
faisaldialpad/hellouniverse
train
0
a6dbc6762f06d3737c5208a951a025ebde172a3f
[ "super(ReducedConv, self).__init__()\nself.flat_conv1 = nn.Conv1d(1, 1, 31, stride=2, padding=15)\nself.linear = nn.Sequential(nn.Linear(embeddings_dim // 2, hidden_dim), nn.Dropout(dropout), nn.ReLU(), nn.BatchNorm1d(hidden_dim))\nself.output = nn.Linear(32, output_dim)", "o = x[:, None, :]\no = F.relu(self.flat...
<|body_start_0|> super(ReducedConv, self).__init__() self.flat_conv1 = nn.Conv1d(1, 1, 31, stride=2, padding=15) self.linear = nn.Sequential(nn.Linear(embeddings_dim // 2, hidden_dim), nn.Dropout(dropout), nn.ReLU(), nn.BatchNorm1d(hidden_dim)) self.output = nn.Linear(32, output_dim) <|e...
ReducedConv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReducedConv: def __init__(self, embeddings_dim: int=1024, hidden_dim: int=32, output_dim: int=12, dropout: float=0.25): """Simple Feed forward model with default parameters like the network tha is ued in the SeqVec paper. Args: embeddings_dim: dimension of the input hidden_dim: dimension...
stack_v2_sparse_classes_36k_train_029699
1,460
no_license
[ { "docstring": "Simple Feed forward model with default parameters like the network tha is ued in the SeqVec paper. Args: embeddings_dim: dimension of the input hidden_dim: dimension of the hidden layers output_dim: output dimension (number of classes that should be classified) number_hidden_layers: number of hi...
2
stack_v2_sparse_classes_30k_train_009457
Implement the Python class `ReducedConv` described below. Class description: Implement the ReducedConv class. Method signatures and docstrings: - def __init__(self, embeddings_dim: int=1024, hidden_dim: int=32, output_dim: int=12, dropout: float=0.25): Simple Feed forward model with default parameters like the networ...
Implement the Python class `ReducedConv` described below. Class description: Implement the ReducedConv class. Method signatures and docstrings: - def __init__(self, embeddings_dim: int=1024, hidden_dim: int=32, output_dim: int=12, dropout: float=0.25): Simple Feed forward model with default parameters like the networ...
cf294348cbb838cbbd33f27c3c58d29a88eb137e
<|skeleton|> class ReducedConv: def __init__(self, embeddings_dim: int=1024, hidden_dim: int=32, output_dim: int=12, dropout: float=0.25): """Simple Feed forward model with default parameters like the network tha is ued in the SeqVec paper. Args: embeddings_dim: dimension of the input hidden_dim: dimension...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReducedConv: def __init__(self, embeddings_dim: int=1024, hidden_dim: int=32, output_dim: int=12, dropout: float=0.25): """Simple Feed forward model with default parameters like the network tha is ued in the SeqVec paper. Args: embeddings_dim: dimension of the input hidden_dim: dimension of the hidden...
the_stack_v2_python_sparse
models/legacy/reduced_conv.py
bioinformatica/protein-localization
train
0