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
95c565c23cab7bcf5bda89ff2fb81b0448f06c6e
[ "args = self.parse(args)\nset_seed(args.seed)\nconfig, tokenizer, maxlength = self.load(base, maxlength)\nlabels = None\nif task == 'question-answering':\n process = Questions(tokenizer, columns, maxlength, stride)\nelse:\n process = Labels(tokenizer, columns, maxlength)\n labels = process.labels(train)\nt...
<|body_start_0|> args = self.parse(args) set_seed(args.seed) config, tokenizer, maxlength = self.load(base, maxlength) labels = None if task == 'question-answering': process = Questions(tokenizer, columns, maxlength, stride) else: process = Labels(...
Trains a new Hugging Face Transformer model using the Trainer framework.
HFTrainer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HFTrainer: """Trains a new Hugging Face Transformer model using the Trainer framework.""" def __call__(self, base, train, validation=None, columns=None, maxlength=None, stride=128, task='text-classification', **args): """Builds a new model using arguments. Args: base: path to base mo...
stack_v2_sparse_classes_36k_train_029100
5,472
permissive
[ { "docstring": "Builds a new model using arguments. Args: base: path to base model, accepts Hugging Face model hub id, local path or (model, tokenizer) tuple train: training data validation: validation data columns: tuple of columns to use for text/label, defaults to (text, None, label) maxlength: maximum seque...
4
stack_v2_sparse_classes_30k_train_016002
Implement the Python class `HFTrainer` described below. Class description: Trains a new Hugging Face Transformer model using the Trainer framework. Method signatures and docstrings: - def __call__(self, base, train, validation=None, columns=None, maxlength=None, stride=128, task='text-classification', **args): Builds...
Implement the Python class `HFTrainer` described below. Class description: Trains a new Hugging Face Transformer model using the Trainer framework. Method signatures and docstrings: - def __call__(self, base, train, validation=None, columns=None, maxlength=None, stride=128, task='text-classification', **args): Builds...
1fb384912795dc9592a9df494ed2337e16fe4bd4
<|skeleton|> class HFTrainer: """Trains a new Hugging Face Transformer model using the Trainer framework.""" def __call__(self, base, train, validation=None, columns=None, maxlength=None, stride=128, task='text-classification', **args): """Builds a new model using arguments. Args: base: path to base mo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HFTrainer: """Trains a new Hugging Face Transformer model using the Trainer framework.""" def __call__(self, base, train, validation=None, columns=None, maxlength=None, stride=128, task='text-classification', **args): """Builds a new model using arguments. Args: base: path to base model, accepts ...
the_stack_v2_python_sparse
src/python/txtai/pipeline/hftrainer.py
hi019/txtai
train
1
caff89b3f93b828492a757b749bb3d3878f668d2
[ "headers = {'Content-Type': 'application/json;charset=UTF-8'}\nresponse = requests.post(url=url, headers=headers, data=json.dumps(data))\nif response.status_code != 200:\n raise RequestException(str(response.json()))\nif response.json().get('code') != 100:\n raise MyException('目标服务错误:' + response.json().get('...
<|body_start_0|> headers = {'Content-Type': 'application/json;charset=UTF-8'} response = requests.post(url=url, headers=headers, data=json.dumps(data)) if response.status_code != 200: raise RequestException(str(response.json())) if response.json().get('code') != 100: ...
RestTemplate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestTemplate: def do_post(url, data): """发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:""" <|body_0|> def do_post_for_jcos(url, data): """发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> he...
stack_v2_sparse_classes_36k_train_029101
1,618
no_license
[ { "docstring": "发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:", "name": "do_post", "signature": "def do_post(url, data)" }, { "docstring": "发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:", "name": "do_post_for_jcos", "signature": "def do_post_for_jcos(url, data)" } ]
2
null
Implement the Python class `RestTemplate` described below. Class description: Implement the RestTemplate class. Method signatures and docstrings: - def do_post(url, data): 发送post请求 :param url:请求地址 :param data:字典或字典列表 :return: - def do_post_for_jcos(url, data): 发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:
Implement the Python class `RestTemplate` described below. Class description: Implement the RestTemplate class. Method signatures and docstrings: - def do_post(url, data): 发送post请求 :param url:请求地址 :param data:字典或字典列表 :return: - def do_post_for_jcos(url, data): 发送post请求 :param url:请求地址 :param data:字典或字典列表 :return: <|...
5fb62820fa697ffc45931c4c19a9b0775feb1fc5
<|skeleton|> class RestTemplate: def do_post(url, data): """发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:""" <|body_0|> def do_post_for_jcos(url, data): """发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestTemplate: def do_post(url, data): """发送post请求 :param url:请求地址 :param data:字典或字典列表 :return:""" headers = {'Content-Type': 'application/json;charset=UTF-8'} response = requests.post(url=url, headers=headers, data=json.dumps(data)) if response.status_code != 200: r...
the_stack_v2_python_sparse
app/util/rest_template.py
9Echo/gc-goods-allocation
train
0
404a72285610e0bc52b6301e6dc3a3078b1d6fbf
[ "post_ = Post.objects.get(slug=slug, is_deleted=False)\ninfographic_post = post_.infographic\nis_user_article = False\nif request.user.is_authenticated():\n user_prof = UserProfile.objects.get(user=request.user)\n contributor = user_can_contribute(request.user)\n if user_prof:\n if user_prof.is_cont...
<|body_start_0|> post_ = Post.objects.get(slug=slug, is_deleted=False) infographic_post = post_.infographic is_user_article = False if request.user.is_authenticated(): user_prof = UserProfile.objects.get(user=request.user) contributor = user_can_contribute(request...
InfographicView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfographicView: def get(self, request, slug): """Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic""" <|body_0|> def post(self, request, slug): """For when the ...
stack_v2_sparse_classes_36k_train_029102
10,751
no_license
[ { "docstring": "Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic", "name": "get", "signature": "def get(self, request, slug)" }, { "docstring": "For when the unpublish button is pressed, in...
2
stack_v2_sparse_classes_30k_train_003202
Implement the Python class `InfographicView` described below. Class description: Implement the InfographicView class. Method signatures and docstrings: - def get(self, request, slug): Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slu...
Implement the Python class `InfographicView` described below. Class description: Implement the InfographicView class. Method signatures and docstrings: - def get(self, request, slug): Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slu...
8296c49dfa8771b47965c24b6b49a2b6e8ace6cf
<|skeleton|> class InfographicView: def get(self, request, slug): """Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic""" <|body_0|> def post(self, request, slug): """For when the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InfographicView: def get(self, request, slug): """Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic""" post_ = Post.objects.get(slug=slug, is_deleted=False) infographic_post = post...
the_stack_v2_python_sparse
relevate_web_app/apps/contribution/views/infographics_view.py
jhock/Relevate
train
1
45f5ef3cc47674d3c2b7e9a7d6bc6d700dc24d0d
[ "fleet_veh = self.pool.get('fleet.vehicle')\nrangs = fleet_veh._selection_year(self, cr, uid)\nlist_year = []\nfor years in rangs[1:len(rangs)]:\n list_year.append(years)\nreturn list_year", "data = self.read(cr, uid, ids, [], context=context)[0]\ndatas = {'ids': [], 'model': 'fleet.vehicle.log.contract', 'for...
<|body_start_0|> fleet_veh = self.pool.get('fleet.vehicle') rangs = fleet_veh._selection_year(self, cr, uid) list_year = [] for years in rangs[1:len(rangs)]: list_year.append(years) return list_year <|end_body_0|> <|body_start_1|> data = self.read(cr, uid, id...
To manage rented cars reports
rented_cars_wiz
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class rented_cars_wiz: """To manage rented cars reports""" def _year(self, cr, uid, context=None): """Select cars manufacturing years between 1970 and Current year. @return: list of years""" <|body_0|> def print_report(self, cr, uid, ids, context=None): """Print report...
stack_v2_sparse_classes_36k_train_029103
2,273
no_license
[ { "docstring": "Select cars manufacturing years between 1970 and Current year. @return: list of years", "name": "_year", "signature": "def _year(self, cr, uid, context=None)" }, { "docstring": "Print report. @return: Dictionary of print attributes", "name": "print_report", "signature": "...
2
stack_v2_sparse_classes_30k_train_018760
Implement the Python class `rented_cars_wiz` described below. Class description: To manage rented cars reports Method signatures and docstrings: - def _year(self, cr, uid, context=None): Select cars manufacturing years between 1970 and Current year. @return: list of years - def print_report(self, cr, uid, ids, contex...
Implement the Python class `rented_cars_wiz` described below. Class description: To manage rented cars reports Method signatures and docstrings: - def _year(self, cr, uid, context=None): Select cars manufacturing years between 1970 and Current year. @return: list of years - def print_report(self, cr, uid, ids, contex...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class rented_cars_wiz: """To manage rented cars reports""" def _year(self, cr, uid, context=None): """Select cars manufacturing years between 1970 and Current year. @return: list of years""" <|body_0|> def print_report(self, cr, uid, ids, context=None): """Print report...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class rented_cars_wiz: """To manage rented cars reports""" def _year(self, cr, uid, context=None): """Select cars manufacturing years between 1970 and Current year. @return: list of years""" fleet_veh = self.pool.get('fleet.vehicle') rangs = fleet_veh._selection_year(self, cr, uid) ...
the_stack_v2_python_sparse
v_7/Dongola/admin_affairs/service/wizard/rented_cars.py
musabahmed/baba
train
0
f45439be1eb9a030ef6790a49840485b15078c72
[ "with open(filename, 'r') as file:\n num_nodes = None\n graph = {}\n for line in file:\n if num_nodes is None:\n num_nodes = int(line)\n graph = {id_: node_cls(id_) for id_ in range(1, num_nodes + 1)}\n else:\n m, n, dist = line.split(' ')\n m = int...
<|body_start_0|> with open(filename, 'r') as file: num_nodes = None graph = {} for line in file: if num_nodes is None: num_nodes = int(line) graph = {id_: node_cls(id_) for id_ in range(1, num_nodes + 1)} ...
IOManager handles converting between dictionaries of GraphNode objects and .ecegraph files.
IOManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IOManager: """IOManager handles converting between dictionaries of GraphNode objects and .ecegraph files.""" def import_graph(cls, filename, node_cls=GraphNode): """Returns a dictionary of GraphNode objects. Parameters: filename: Name of .ecegraph file to import (ie. map.ecegraph) Re...
stack_v2_sparse_classes_36k_train_029104
2,331
no_license
[ { "docstring": "Returns a dictionary of GraphNode objects. Parameters: filename: Name of .ecegraph file to import (ie. map.ecegraph) Returns: Dictionary where keys are ids and values are GraphNode objects. Example: graph = IOManager.import_graph('g.ecegraph')", "name": "import_graph", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_010565
Implement the Python class `IOManager` described below. Class description: IOManager handles converting between dictionaries of GraphNode objects and .ecegraph files. Method signatures and docstrings: - def import_graph(cls, filename, node_cls=GraphNode): Returns a dictionary of GraphNode objects. Parameters: filenam...
Implement the Python class `IOManager` described below. Class description: IOManager handles converting between dictionaries of GraphNode objects and .ecegraph files. Method signatures and docstrings: - def import_graph(cls, filename, node_cls=GraphNode): Returns a dictionary of GraphNode objects. Parameters: filenam...
faf065e0aae8e242d05f6940ba98be102f6ff6e5
<|skeleton|> class IOManager: """IOManager handles converting between dictionaries of GraphNode objects and .ecegraph files.""" def import_graph(cls, filename, node_cls=GraphNode): """Returns a dictionary of GraphNode objects. Parameters: filename: Name of .ecegraph file to import (ie. map.ecegraph) Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IOManager: """IOManager handles converting between dictionaries of GraphNode objects and .ecegraph files.""" def import_graph(cls, filename, node_cls=GraphNode): """Returns a dictionary of GraphNode objects. Parameters: filename: Name of .ecegraph file to import (ie. map.ecegraph) Returns: Dictio...
the_stack_v2_python_sparse
graph/iomanager.py
andrew-zhou/ece457a
train
0
c70a5faadd2aef0fe5978fc378df727cdfe07e1d
[ "if root is None:\n return []\nsum_root = self.SumofLevel(root)\nreturn [i[0] / i[1] for i in sum_root]", "if root is None:\n return []\nsum_l = self.SumofLevel(root.left)\nsum_r = self.SumofLevel(root.right)\nsum_root = [(root.val, 1)]\nfor i in range(max(len(sum_l), len(sum_r))):\n if i >= len(sum_l):\...
<|body_start_0|> if root is None: return [] sum_root = self.SumofLevel(root) return [i[0] / i[1] for i in sum_root] <|end_body_0|> <|body_start_1|> if root is None: return [] sum_l = self.SumofLevel(root.left) sum_r = self.SumofLevel(root.right) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def averageOfLevels(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_0|> def SumofLevel(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: ...
stack_v2_sparse_classes_36k_train_029105
1,801
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[float]", "name": "averageOfLevels", "signature": "def averageOfLevels(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[float]", "name": "SumofLevel", "signature": "def SumofLevel(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_012789
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def averageOfLevels(self, root): :type root: TreeNode :rtype: List[float] - def SumofLevel(self, root): :type root: TreeNode :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def averageOfLevels(self, root): :type root: TreeNode :rtype: List[float] - def SumofLevel(self, root): :type root: TreeNode :rtype: List[float] <|skeleton|> class Solution: ...
4e137a6a860fc5ce1d32befd0886a22fd67d2293
<|skeleton|> class Solution: def averageOfLevels(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_0|> def SumofLevel(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def averageOfLevels(self, root): """:type root: TreeNode :rtype: List[float]""" if root is None: return [] sum_root = self.SumofLevel(root) return [i[0] / i[1] for i in sum_root] def SumofLevel(self, root): """:type root: TreeNode :rtype: List...
the_stack_v2_python_sparse
src/637_Average_of_Levels_in_Binary_Tree.py
HuJiawei1990/LeetCode
train
0
f1f1617b69267399b90f989cb1ffaf1e7f911d32
[ "BaseMailingProcess.__init__(self)\nself.preview_problem = None\nself.mail_preview = None", "self.unit_problem = problem\nself.mail_preview = mail_preview\nbackslash_string = \"Ce problème est inspiré d'une interview donnée par\"\ncustom_company_message = f\"{('Cette interview est une création originale' if self....
<|body_start_0|> BaseMailingProcess.__init__(self) self.preview_problem = None self.mail_preview = None <|end_body_0|> <|body_start_1|> self.unit_problem = problem self.mail_preview = mail_preview backslash_string = "Ce problème est inspiré d'une interview donnée par" ...
PreviewMailingProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreviewMailingProcess: def __init__(self): """The PreviewMailingProcess handle the core logic for sending one mail for a preview given a problem. It's used when doing email previews when adding/updating a Problem model in the admin page.""" <|body_0|> def run(self, problem, ...
stack_v2_sparse_classes_36k_train_029106
24,237
no_license
[ { "docstring": "The PreviewMailingProcess handle the core logic for sending one mail for a preview given a problem. It's used when doing email previews when adding/updating a Problem model in the admin page.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Run the unit ...
2
stack_v2_sparse_classes_30k_train_018689
Implement the Python class `PreviewMailingProcess` described below. Class description: Implement the PreviewMailingProcess class. Method signatures and docstrings: - def __init__(self): The PreviewMailingProcess handle the core logic for sending one mail for a preview given a problem. It's used when doing email previ...
Implement the Python class `PreviewMailingProcess` described below. Class description: Implement the PreviewMailingProcess class. Method signatures and docstrings: - def __init__(self): The PreviewMailingProcess handle the core logic for sending one mail for a preview given a problem. It's used when doing email previ...
048e349a413b075da9cc0e0b497c40ab6620e245
<|skeleton|> class PreviewMailingProcess: def __init__(self): """The PreviewMailingProcess handle the core logic for sending one mail for a preview given a problem. It's used when doing email previews when adding/updating a Problem model in the admin page.""" <|body_0|> def run(self, problem, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreviewMailingProcess: def __init__(self): """The PreviewMailingProcess handle the core logic for sending one mail for a preview given a problem. It's used when doing email previews when adding/updating a Problem model in the admin page.""" BaseMailingProcess.__init__(self) self.previe...
the_stack_v2_python_sparse
1interviewparjour/oneinterviewparjour/mail_scheduler/engine.py
gabrielmougard/1interviewparjour
train
1
10ec79b81992964c09d8dd1830229b7b322274fc
[ "super().__init__()\nself.lstm_cell = tf.keras.layers.LSTMCell(lstm_units, dropout=0.3, kernel_regularizer=tf.keras.regularizers.l2(l=0.02), recurrent_regularizer=tf.keras.regularizers.l2(l=0.02))\nself.dense1 = tf.keras.layers.Dense(1)\nself.dense2 = tf.keras.layers.Dense(10, activation='relu', kernel_regularizer=...
<|body_start_0|> super().__init__() self.lstm_cell = tf.keras.layers.LSTMCell(lstm_units, dropout=0.3, kernel_regularizer=tf.keras.regularizers.l2(l=0.02), recurrent_regularizer=tf.keras.regularizers.l2(l=0.02)) self.dense1 = tf.keras.layers.Dense(1) self.dense2 = tf.keras.layers.Dense(1...
Simple RNN based CF model.
RNNCFModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNCFModel: """Simple RNN based CF model.""" def __init__(self, maxhd, maxv, mina, maxa, lstm_units=20, dt=0.1): """Inits RNN based CF model. Args: maxhd: max headway (for nomalization of inputs) maxv: max velocity (for nomalization of inputs) mina: minimum acceleration (for nomaliza...
stack_v2_sparse_classes_36k_train_029107
20,223
permissive
[ { "docstring": "Inits RNN based CF model. Args: maxhd: max headway (for nomalization of inputs) maxv: max velocity (for nomalization of inputs) mina: minimum acceleration (for nomalization of outputs) maxa: maximum acceleration (for nomalization of outputs) dt: timestep", "name": "__init__", "signature"...
2
stack_v2_sparse_classes_30k_train_012377
Implement the Python class `RNNCFModel` described below. Class description: Simple RNN based CF model. Method signatures and docstrings: - def __init__(self, maxhd, maxv, mina, maxa, lstm_units=20, dt=0.1): Inits RNN based CF model. Args: maxhd: max headway (for nomalization of inputs) maxv: max velocity (for nomaliz...
Implement the Python class `RNNCFModel` described below. Class description: Simple RNN based CF model. Method signatures and docstrings: - def __init__(self, maxhd, maxv, mina, maxa, lstm_units=20, dt=0.1): Inits RNN based CF model. Args: maxhd: max headway (for nomalization of inputs) maxv: max velocity (for nomaliz...
0aaf9674e987822ff2dc90c74613d5e68e8ef0ce
<|skeleton|> class RNNCFModel: """Simple RNN based CF model.""" def __init__(self, maxhd, maxv, mina, maxa, lstm_units=20, dt=0.1): """Inits RNN based CF model. Args: maxhd: max headway (for nomalization of inputs) maxv: max velocity (for nomalization of inputs) mina: minimum acceleration (for nomaliza...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNCFModel: """Simple RNN based CF model.""" def __init__(self, maxhd, maxv, mina, maxa, lstm_units=20, dt=0.1): """Inits RNN based CF model. Args: maxhd: max headway (for nomalization of inputs) maxv: max velocity (for nomalization of inputs) mina: minimum acceleration (for nomalization of outpu...
the_stack_v2_python_sparse
scripts/meng/deep learning/DL2_relax.py
seccode/havsim
train
0
884ba1b274da0f5736845de349da2a4c344ef87c
[ "super(SGDBenchmark, self).__init__(config_path, config)\nif not self.config:\n self.config = objdict(SGD_DEFAULTS.copy())\nfor key in SGD_DEFAULTS:\n if key not in self.config:\n self.config[key] = SGD_DEFAULTS[key]", "if 'instance_set' not in self.config.keys():\n self.read_instance_set()\nif 't...
<|body_start_0|> super(SGDBenchmark, self).__init__(config_path, config) if not self.config: self.config = objdict(SGD_DEFAULTS.copy()) for key in SGD_DEFAULTS: if key not in self.config: self.config[key] = SGD_DEFAULTS[key] <|end_body_0|> <|body_start_1|...
Benchmark with default configuration & relevant functions for SGD
SGDBenchmark
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SGDBenchmark: """Benchmark with default configuration & relevant functions for SGD""" def __init__(self, config_path=None, config=None): """Initialize SGD Benchmark Parameters ------- config_path : str Path to config file (optional)""" <|body_0|> def get_environment(self...
stack_v2_sparse_classes_36k_train_029108
6,789
permissive
[ { "docstring": "Initialize SGD Benchmark Parameters ------- config_path : str Path to config file (optional)", "name": "__init__", "signature": "def __init__(self, config_path=None, config=None)" }, { "docstring": "Return SGDEnv env with current configuration Returns ------- SGDEnv SGD environme...
4
stack_v2_sparse_classes_30k_train_010371
Implement the Python class `SGDBenchmark` described below. Class description: Benchmark with default configuration & relevant functions for SGD Method signatures and docstrings: - def __init__(self, config_path=None, config=None): Initialize SGD Benchmark Parameters ------- config_path : str Path to config file (opti...
Implement the Python class `SGDBenchmark` described below. Class description: Benchmark with default configuration & relevant functions for SGD Method signatures and docstrings: - def __init__(self, config_path=None, config=None): Initialize SGD Benchmark Parameters ------- config_path : str Path to config file (opti...
d99b21ec844a46d6e18e729ab299f8e9051a68e8
<|skeleton|> class SGDBenchmark: """Benchmark with default configuration & relevant functions for SGD""" def __init__(self, config_path=None, config=None): """Initialize SGD Benchmark Parameters ------- config_path : str Path to config file (optional)""" <|body_0|> def get_environment(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SGDBenchmark: """Benchmark with default configuration & relevant functions for SGD""" def __init__(self, config_path=None, config=None): """Initialize SGD Benchmark Parameters ------- config_path : str Path to config file (optional)""" super(SGDBenchmark, self).__init__(config_path, confi...
the_stack_v2_python_sparse
dacbench/benchmarks/sgd_benchmark.py
automl/DACBench
train
19
aaf832c4c2152b897ec65c25877615a4098a1680
[ "try:\n self.store_records(table=Platform, data=data)\n if autosave:\n self.commit_session()\nexcept:\n self.rollback_session()\n raise", "try:\n column = [column for column in Platform.__table__.columns if column.key == target_column_name][0]\n platform = self.fetch_records_by_column(tab...
<|body_start_0|> try: self.store_records(table=Platform, data=data) if autosave: self.commit_session() except: self.rollback_session() raise <|end_body_0|> <|body_start_1|> try: column = [column for column in Platform._...
An adaptor class for Platform tables
PlatformAdaptor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlatformAdaptor: """An adaptor class for Platform tables""" def store_platform_data(self, data, autosave=True): """Load data to Platform table""" <|body_0|> def fetch_platform_records_igf_id(self, platform_igf_id, target_column_name='platform_igf_id', output_mode='one'):...
stack_v2_sparse_classes_36k_train_029109
2,442
permissive
[ { "docstring": "Load data to Platform table", "name": "store_platform_data", "signature": "def store_platform_data(self, data, autosave=True)" }, { "docstring": "A method for fetching data for Platform table :param platform_igf_id: an igf id :param target_column_name: column name in the Platform...
3
stack_v2_sparse_classes_30k_train_000728
Implement the Python class `PlatformAdaptor` described below. Class description: An adaptor class for Platform tables Method signatures and docstrings: - def store_platform_data(self, data, autosave=True): Load data to Platform table - def fetch_platform_records_igf_id(self, platform_igf_id, target_column_name='platf...
Implement the Python class `PlatformAdaptor` described below. Class description: An adaptor class for Platform tables Method signatures and docstrings: - def store_platform_data(self, data, autosave=True): Load data to Platform table - def fetch_platform_records_igf_id(self, platform_igf_id, target_column_name='platf...
01063828f2983e790aafde592d1a2a3af088a6a9
<|skeleton|> class PlatformAdaptor: """An adaptor class for Platform tables""" def store_platform_data(self, data, autosave=True): """Load data to Platform table""" <|body_0|> def fetch_platform_records_igf_id(self, platform_igf_id, target_column_name='platform_igf_id', output_mode='one'):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlatformAdaptor: """An adaptor class for Platform tables""" def store_platform_data(self, data, autosave=True): """Load data to Platform table""" try: self.store_records(table=Platform, data=data) if autosave: self.commit_session() except: ...
the_stack_v2_python_sparse
igf_data/igfdb/platformadaptor.py
bballamudi/data-management-python
train
0
734dfb90aa36e313b993b584aa43139193fc8621
[ "customer_data = self.parse_request()\ncustomer = Customer.objects.create(**customer_data)\nsession.auth.set_data(self.request, customer)\nreturn http.HttpResponse()", "customer = session.auth.get_data(self.request)\nif customer is None:\n return http.HttpResponseForbidden()\npassword_old = kwargs.pop('passwor...
<|body_start_0|> customer_data = self.parse_request() customer = Customer.objects.create(**customer_data) session.auth.set_data(self.request, customer) return http.HttpResponse() <|end_body_0|> <|body_start_1|> customer = session.auth.get_data(self.request) if customer i...
CustomerView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerView: def post(self, request, *args, **kwargs): """Create customer. Automatically logins.""" <|body_0|> def put(self, request, *args, **kwargs): """Update customer fields. 404 if not logged in. If want to set password, old password has to be provided in 'pass...
stack_v2_sparse_classes_36k_train_029110
5,815
no_license
[ { "docstring": "Create customer. Automatically logins.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Update customer fields. 404 if not logged in. If want to set password, old password has to be provided in 'password_old' parameter.", "name": "p...
2
stack_v2_sparse_classes_30k_train_019267
Implement the Python class `CustomerView` described below. Class description: Implement the CustomerView class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Create customer. Automatically logins. - def put(self, request, *args, **kwargs): Update customer fields. 404 if not logged in. ...
Implement the Python class `CustomerView` described below. Class description: Implement the CustomerView class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Create customer. Automatically logins. - def put(self, request, *args, **kwargs): Update customer fields. 404 if not logged in. ...
038834c0f544d6997613d61d593a7d5abf673c70
<|skeleton|> class CustomerView: def post(self, request, *args, **kwargs): """Create customer. Automatically logins.""" <|body_0|> def put(self, request, *args, **kwargs): """Update customer fields. 404 if not logged in. If want to set password, old password has to be provided in 'pass...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomerView: def post(self, request, *args, **kwargs): """Create customer. Automatically logins.""" customer_data = self.parse_request() customer = Customer.objects.create(**customer_data) session.auth.set_data(self.request, customer) return http.HttpResponse() de...
the_stack_v2_python_sparse
sites/hermanmiller/shop/views.py
alexgula/django_sites
train
0
bf6acef6187502b2b91651b537b15cbcfaf5c6cf
[ "tokens = []\nself.space, tokens = (len(tokens), tokens + [' '])\ntokens.extend(chars)\nif apostrophe:\n tokens.append(\"'\")\nif punct:\n if non_default_punct_list is not None:\n self.PUNCT_LIST = non_default_punct_list\n tokens.extend(self.PUNCT_LIST)\nsuper().__init__(tokens, add_blank_at=add_bla...
<|body_start_0|> tokens = [] self.space, tokens = (len(tokens), tokens + [' ']) tokens.extend(chars) if apostrophe: tokens.append("'") if punct: if non_default_punct_list is not None: self.PUNCT_LIST = non_default_punct_list tok...
BaseCharsTokenizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseCharsTokenizer: def __init__(self, chars, punct=True, apostrophe=True, add_blank_at=None, pad_with_space=False, non_default_punct_list=None, text_preprocessing_func=lambda x: x): """Base class for char-based tokenizer. Args: chars: string that represents all possible characters. punc...
stack_v2_sparse_classes_36k_train_029111
13,991
permissive
[ { "docstring": "Base class for char-based tokenizer. Args: chars: string that represents all possible characters. punct: Whether to reserve grapheme for basic punctuation or not. apostrophe: Whether to use apostrophe or not. add_blank_at: Add blank to labels in the specified order (\"last\") or after tokens (an...
2
null
Implement the Python class `BaseCharsTokenizer` described below. Class description: Implement the BaseCharsTokenizer class. Method signatures and docstrings: - def __init__(self, chars, punct=True, apostrophe=True, add_blank_at=None, pad_with_space=False, non_default_punct_list=None, text_preprocessing_func=lambda x:...
Implement the Python class `BaseCharsTokenizer` described below. Class description: Implement the BaseCharsTokenizer class. Method signatures and docstrings: - def __init__(self, chars, punct=True, apostrophe=True, add_blank_at=None, pad_with_space=False, non_default_punct_list=None, text_preprocessing_func=lambda x:...
866cc3f66fab3a796a6b74ef7a9e362c2282a976
<|skeleton|> class BaseCharsTokenizer: def __init__(self, chars, punct=True, apostrophe=True, add_blank_at=None, pad_with_space=False, non_default_punct_list=None, text_preprocessing_func=lambda x: x): """Base class for char-based tokenizer. Args: chars: string that represents all possible characters. punc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseCharsTokenizer: def __init__(self, chars, punct=True, apostrophe=True, add_blank_at=None, pad_with_space=False, non_default_punct_list=None, text_preprocessing_func=lambda x: x): """Base class for char-based tokenizer. Args: chars: string that represents all possible characters. punct: Whether to ...
the_stack_v2_python_sparse
nemo/collections/tts/torch/tts_tokenizers.py
VahidooX/NeMo
train
1
5cd1afffcc6c59497a995a07aa6bc7b297311a8f
[ "super().define(spec)\nspec.input('num_val', valid_type=orm.Int, required=True, serializer=orm.to_aiida_type, help='Number of valence WFs.')\nspec.input('rotate_unk', valid_type=orm.Bool, default=lambda: orm.Bool(False), serializer=orm.to_aiida_type, help='Number of valence WFs.')\nspec.inputs['metadata']['options'...
<|body_start_0|> super().define(spec) spec.input('num_val', valid_type=orm.Int, required=True, serializer=orm.to_aiida_type, help='Number of valence WFs.') spec.input('rotate_unk', valid_type=orm.Bool, default=lambda: orm.Bool(False), serializer=orm.to_aiida_type, help='Number of valence WFs.') ...
AiiDA calculation plugin wrapping the split AMN/MMN/EIG script.
Wannier90SplitCalculation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wannier90SplitCalculation: """AiiDA calculation plugin wrapping the split AMN/MMN/EIG script.""" def define(cls, spec): """Define inputs and outputs of the calculation.""" <|body_0|> def prepare_for_submission(self, folder): """Create input files. :param folder: ...
stack_v2_sparse_classes_36k_train_029112
5,395
permissive
[ { "docstring": "Define inputs and outputs of the calculation.", "name": "define", "signature": "def define(cls, spec)" }, { "docstring": "Create input files. :param folder: an `aiida.common.folders.Folder` where the plugin should temporarily place all files needed by the calculation. :return: `a...
2
stack_v2_sparse_classes_30k_val_001116
Implement the Python class `Wannier90SplitCalculation` described below. Class description: AiiDA calculation plugin wrapping the split AMN/MMN/EIG script. Method signatures and docstrings: - def define(cls, spec): Define inputs and outputs of the calculation. - def prepare_for_submission(self, folder): Create input f...
Implement the Python class `Wannier90SplitCalculation` described below. Class description: AiiDA calculation plugin wrapping the split AMN/MMN/EIG script. Method signatures and docstrings: - def define(cls, spec): Define inputs and outputs of the calculation. - def prepare_for_submission(self, folder): Create input f...
aeceb3519ffd1cd071d5b98f81888052fff58163
<|skeleton|> class Wannier90SplitCalculation: """AiiDA calculation plugin wrapping the split AMN/MMN/EIG script.""" def define(cls, spec): """Define inputs and outputs of the calculation.""" <|body_0|> def prepare_for_submission(self, folder): """Create input files. :param folder: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Wannier90SplitCalculation: """AiiDA calculation plugin wrapping the split AMN/MMN/EIG script.""" def define(cls, spec): """Define inputs and outputs of the calculation.""" super().define(spec) spec.input('num_val', valid_type=orm.Int, required=True, serializer=orm.to_aiida_type, h...
the_stack_v2_python_sparse
src/aiida_wannier90_workflows/calculations/split.py
aiidateam/aiida-wannier90-workflows
train
5
ffc27843d222e28dec61943da71cf3dd35b75133
[ "install_cache_path = os.path.join(sublime.cache_path(), 'Rainmeter', 'install', 'last_entered_folder.cache')\nif os.path.exists(install_cache_path) and os.path.isfile(install_cache_path):\n with open(install_cache_path, 'r') as cache_handler:\n cache_content = cache_handler.read()\n default_path =...
<|body_start_0|> install_cache_path = os.path.join(sublime.cache_path(), 'Rainmeter', 'install', 'last_entered_folder.cache') if os.path.exists(install_cache_path) and os.path.isfile(install_cache_path): with open(install_cache_path, 'r') as cache_handler: cache_content = cac...
Command to install skin from a folder. Command String is rainmeter_install_skin_from_folder_command.
RainmeterInstallSkinFromFolderCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RainmeterInstallSkinFromFolderCommand: """Command to install skin from a folder. Command String is rainmeter_install_skin_from_folder_command.""" def run(self): """Automatically executed upon calling this command.""" <|body_0|> def __on_folder_path_entered(cls, path): ...
stack_v2_sparse_classes_36k_train_029113
11,700
permissive
[ { "docstring": "Automatically executed upon calling this command.", "name": "run", "signature": "def run(self)" }, { "docstring": "Executed after a path is entered. Checks the given user input to verify some basic requirements like that it is a directory.", "name": "__on_folder_path_entered"...
2
stack_v2_sparse_classes_30k_train_000668
Implement the Python class `RainmeterInstallSkinFromFolderCommand` described below. Class description: Command to install skin from a folder. Command String is rainmeter_install_skin_from_folder_command. Method signatures and docstrings: - def run(self): Automatically executed upon calling this command. - def __on_fo...
Implement the Python class `RainmeterInstallSkinFromFolderCommand` described below. Class description: Command to install skin from a folder. Command String is rainmeter_install_skin_from_folder_command. Method signatures and docstrings: - def run(self): Automatically executed upon calling this command. - def __on_fo...
89d67adfd0ef196360785aa2aedecb693f71e965
<|skeleton|> class RainmeterInstallSkinFromFolderCommand: """Command to install skin from a folder. Command String is rainmeter_install_skin_from_folder_command.""" def run(self): """Automatically executed upon calling this command.""" <|body_0|> def __on_folder_path_entered(cls, path): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RainmeterInstallSkinFromFolderCommand: """Command to install skin from a folder. Command String is rainmeter_install_skin_from_folder_command.""" def run(self): """Automatically executed upon calling this command.""" install_cache_path = os.path.join(sublime.cache_path(), 'Rainmeter', 'in...
the_stack_v2_python_sparse
install_skin.py
thatsIch/sublime-rainmeter
train
62
c7f289f030458cc4a3f694f93b361fc691f606ff
[ "tofAxis = timeHistogram.axisFromName('tof')\ntofVector = tofAxis.storage()\nenergyAxis = energyHistogram.axisFromName('energy')\nenergyVector = energyAxis.storage()\nself._calcor(pixelDist, tofVector, energyVector)\nreturn", "from reduction.vectorCompat.EBinCalcor import EBinCalcor\nself._calcor = EBinCalcor(dat...
<|body_start_0|> tofAxis = timeHistogram.axisFromName('tof') tofVector = tofAxis.storage() energyAxis = energyHistogram.axisFromName('energy') energyVector = energyAxis.storage() self._calcor(pixelDist, tofVector, energyVector) return <|end_body_0|> <|body_start_1|> ...
energy bin calculator calculate energy bins out of tof bins
EBinCalcor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EBinCalcor: """energy bin calculator calculate energy bins out of tof bins""" def __call__(self, pixelDist, timeHistogram, energyHistogram): """ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel dist...
stack_v2_sparse_classes_36k_train_029114
2,138
no_license
[ { "docstring": "ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel distance and histogram with tof axis. inputs: pixelDist: distance from sample to pixel (float) timeHistogram (instance of Histogram with axis \"tof\") energyHis...
2
stack_v2_sparse_classes_30k_train_008736
Implement the Python class `EBinCalcor` described below. Class description: energy bin calculator calculate energy bins out of tof bins Method signatures and docstrings: - def __call__(self, pixelDist, timeHistogram, energyHistogram): ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin b...
Implement the Python class `EBinCalcor` described below. Class description: energy bin calculator calculate energy bins out of tof bins Method signatures and docstrings: - def __call__(self, pixelDist, timeHistogram, energyHistogram): ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin b...
7ba4ce07a5a4645942192b4b81f7afcae505db90
<|skeleton|> class EBinCalcor: """energy bin calculator calculate energy bins out of tof bins""" def __call__(self, pixelDist, timeHistogram, energyHistogram): """ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel dist...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EBinCalcor: """energy bin calculator calculate energy bins out of tof bins""" def __call__(self, pixelDist, timeHistogram, energyHistogram): """ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel distance and hist...
the_stack_v2_python_sparse
histogrammode/reduction/histCompat/EBinCalcor.py
danse-inelastic/DrChops
train
0
5ebaf98990f1723ed520236535b543888dfc7e95
[ "if type(data) != np.ndarray or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nd, n = (data.shape[0], data.shape[1])\nif n < 2:\n raise ValueError('data must contain multiple data points')\nself.mean = np.mean(data, axis=1, keepdims=True)\nself.cov = np.matmul(data - self.mean, da...
<|body_start_0|> if type(data) != np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') d, n = (data.shape[0], data.shape[1]) if n < 2: raise ValueError('data must contain multiple data points') self.mean = np.mean(data, axis=1, ke...
represents multinormal random variable
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """represents multinormal random variable""" def __init__(self, data): """creates multinormal instance""" <|body_0|> def pdf(self, x): """calculates the pdf at a data point x: np.ndarray (d, 1) containing a data point d: number of dimensions""" ...
stack_v2_sparse_classes_36k_train_029115
1,446
no_license
[ { "docstring": "creates multinormal instance", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "calculates the pdf at a data point x: np.ndarray (d, 1) containing a data point d: number of dimensions", "name": "pdf", "signature": "def pdf(self, x)" } ]
2
null
Implement the Python class `MultiNormal` described below. Class description: represents multinormal random variable Method signatures and docstrings: - def __init__(self, data): creates multinormal instance - def pdf(self, x): calculates the pdf at a data point x: np.ndarray (d, 1) containing a data point d: number o...
Implement the Python class `MultiNormal` described below. Class description: represents multinormal random variable Method signatures and docstrings: - def __init__(self, data): creates multinormal instance - def pdf(self, x): calculates the pdf at a data point x: np.ndarray (d, 1) containing a data point d: number o...
d86b0e0cae2dd07c761f84a493abc895007873ee
<|skeleton|> class MultiNormal: """represents multinormal random variable""" def __init__(self, data): """creates multinormal instance""" <|body_0|> def pdf(self, x): """calculates the pdf at a data point x: np.ndarray (d, 1) containing a data point d: number of dimensions""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """represents multinormal random variable""" def __init__(self, data): """creates multinormal instance""" if type(data) != np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') d, n = (data.shape[0], data.shape[1]) ...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
mag389/holbertonschool-machine_learning
train
2
410804580eedfb7a0f337e7c4304c6047c1b85c2
[ "components = []\n\ndef dfs(node):\n if node is None:\n components.append('')\n else:\n components.append(str(node.val))\n dfs(node.left)\n dfs(node.right)\ndfs(root)\nreturn ','.join(components) + ','", "if data == ',':\n return None\nself.index = 0\n\ndef dfs():\n if data...
<|body_start_0|> components = [] def dfs(node): if node is None: components.append('') else: components.append(str(node.val)) dfs(node.left) dfs(node.right) dfs(root) return ','.join(components) + ',...
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_029116
1,917
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_016867
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:...
488d93280d45ea686d30b0928e96aa5ed5498e6b
<|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""" components = [] def dfs(node): if node is None: components.append('') else: components.append(str(node.val)) ...
the_stack_v2_python_sparse
leetcode/lc297.py
JasonXJ/algorithms
train
1
0c1b699d18933ca76dcc0358803abd2a50a8c082
[ "mix = mix.to(self.device)\nmix_w = self.modules.encoder(mix)\nest_mask = self.modules.masknet(mix_w)\nmix_w = torch.stack([mix_w] * self.hparams.num_spks)\nsep_h = mix_w * est_mask\nest_source = torch.cat([self.modules.decoder(sep_h[i]).unsqueeze(-1) for i in range(self.hparams.num_spks)], dim=-1)\nT_origin = mix....
<|body_start_0|> mix = mix.to(self.device) mix_w = self.modules.encoder(mix) est_mask = self.modules.masknet(mix_w) mix_w = torch.stack([mix_w] * self.hparams.num_spks) sep_h = mix_w * est_mask est_source = torch.cat([self.modules.decoder(sep_h[i]).unsqueeze(-1) for i in ...
A "ready-to-use" speech separation model. Uses Sepformer architecture. Example ------- >>> tmpdir = getfixture("tmpdir") >>> model = SepformerSeparation.from_hparams( ... source="speechbrain/sepformer-wsj02mix", ... savedir=tmpdir) >>> mix = torch.randn(1, 400) >>> est_sources = model.separate_batch(mix) >>> print(est_...
SepformerSeparation
[ "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SepformerSeparation: """A "ready-to-use" speech separation model. Uses Sepformer architecture. Example ------- >>> tmpdir = getfixture("tmpdir") >>> model = SepformerSeparation.from_hparams( ... source="speechbrain/sepformer-wsj02mix", ... savedir=tmpdir) >>> mix = torch.randn(1, 400) >>> est_sou...
stack_v2_sparse_classes_36k_train_029117
35,100
permissive
[ { "docstring": "Run source separation on batch of audio. Arguments --------- mix : torch.tensor The mixture of sources. Returns ------- tensor Separated sources", "name": "separate_batch", "signature": "def separate_batch(self, mix)" }, { "docstring": "Separate sources from file. Arguments -----...
2
stack_v2_sparse_classes_30k_train_018613
Implement the Python class `SepformerSeparation` described below. Class description: A "ready-to-use" speech separation model. Uses Sepformer architecture. Example ------- >>> tmpdir = getfixture("tmpdir") >>> model = SepformerSeparation.from_hparams( ... source="speechbrain/sepformer-wsj02mix", ... savedir=tmpdir) >>...
Implement the Python class `SepformerSeparation` described below. Class description: A "ready-to-use" speech separation model. Uses Sepformer architecture. Example ------- >>> tmpdir = getfixture("tmpdir") >>> model = SepformerSeparation.from_hparams( ... source="speechbrain/sepformer-wsj02mix", ... savedir=tmpdir) >>...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class SepformerSeparation: """A "ready-to-use" speech separation model. Uses Sepformer architecture. Example ------- >>> tmpdir = getfixture("tmpdir") >>> model = SepformerSeparation.from_hparams( ... source="speechbrain/sepformer-wsj02mix", ... savedir=tmpdir) >>> mix = torch.randn(1, 400) >>> est_sou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SepformerSeparation: """A "ready-to-use" speech separation model. Uses Sepformer architecture. Example ------- >>> tmpdir = getfixture("tmpdir") >>> model = SepformerSeparation.from_hparams( ... source="speechbrain/sepformer-wsj02mix", ... savedir=tmpdir) >>> mix = torch.randn(1, 400) >>> est_sources = model....
the_stack_v2_python_sparse
ACL_PyTorch/contrib/audio/tdnn/interfaces.py
Ascend/ModelZoo-PyTorch
train
23
77c744cfa3caf1023aeb65602c56b7492b12bf52
[ "super(MultiHeadAttention, self).__init__()\nself.h = h\nself.dm = dm\nself.depth = int(dm / h)\nself.Wq = tf.keras.layers.Dense(units=dm)\nself.Wk = tf.keras.layers.Dense(units=dm)\nself.Wv = tf.keras.layers.Dense(units=dm)\nself.linear = tf.keras.layers.Dense(units=dm)", "batch, seq_len_q, dk = Q.shape\n_, seq_...
<|body_start_0|> super(MultiHeadAttention, self).__init__() self.h = h self.dm = dm self.depth = int(dm / h) self.Wq = tf.keras.layers.Dense(units=dm) self.Wk = tf.keras.layers.Dense(units=dm) self.Wv = tf.keras.layers.Dense(units=dm) self.linear = tf.kera...
Class MultiHeadAttention
MultiHeadAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttention: """Class MultiHeadAttention""" def __init__(self, dm, h): """Constructor dm is an integer representing the dimensionality of the model h is an integer representing the number of heads dm is divisible by h Sets the following public instance attributes: h - the numb...
stack_v2_sparse_classes_36k_train_029118
4,328
permissive
[ { "docstring": "Constructor dm is an integer representing the dimensionality of the model h is an integer representing the number of heads dm is divisible by h Sets the following public instance attributes: h - the number of heads dm - the dimensionality of the model depth - the depth of each attention head Wq ...
2
null
Implement the Python class `MultiHeadAttention` described below. Class description: Class MultiHeadAttention Method signatures and docstrings: - def __init__(self, dm, h): Constructor dm is an integer representing the dimensionality of the model h is an integer representing the number of heads dm is divisible by h Se...
Implement the Python class `MultiHeadAttention` described below. Class description: Class MultiHeadAttention Method signatures and docstrings: - def __init__(self, dm, h): Constructor dm is an integer representing the dimensionality of the model h is an integer representing the number of heads dm is divisible by h Se...
eaf23423ec0f412f103f5931d6610fdd67bcc5be
<|skeleton|> class MultiHeadAttention: """Class MultiHeadAttention""" def __init__(self, dm, h): """Constructor dm is an integer representing the dimensionality of the model h is an integer representing the number of heads dm is divisible by h Sets the following public instance attributes: h - the numb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadAttention: """Class MultiHeadAttention""" def __init__(self, dm, h): """Constructor dm is an integer representing the dimensionality of the model h is an integer representing the number of heads dm is divisible by h Sets the following public instance attributes: h - the number of heads d...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/6-multihead_attention.py
ledbagholberton/holbertonschool-machine_learning
train
1
13b59db3f2968efaadf006a57e566787a23a11d2
[ "title = getattr(self, 'page_title', None)\nlanguages = getattr(self, 'page_languages', None)\nif not title:\n languages = languages or [settings.LANGUAGE_CODE]\n title = {language: factory.Faker('catch_phrase').evaluate(None, None, {'locale': language}) for language in languages}\nreturn create_i18n_page(tit...
<|body_start_0|> title = getattr(self, 'page_title', None) languages = getattr(self, 'page_languages', None) if not title: languages = languages or [settings.LANGUAGE_CODE] title = {language: factory.Faker('catch_phrase').evaluate(None, None, {'locale': language}) for lan...
Factories for page extensions have in common that: - they must create a related page with a title, - the related page may have to be placed below a "parent" page, - we may want to test the related page in several languages. All this is mutualized by inheriting from the present class.
PageExtensionDjangoModelFactory
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageExtensionDjangoModelFactory: """Factories for page extensions have in common that: - they must create a related page with a title, - the related page may have to be placed below a "parent" page, - we may want to test the related page in several languages. All this is mutualized by inheriting ...
stack_v2_sparse_classes_36k_train_029119
11,346
permissive
[ { "docstring": "Automatically create a related page with the title (or random title if None) in all the requested languages", "name": "extended_object", "signature": "def extended_object(self)" }, { "docstring": "This hook method is called last when generating an instance from a factory. The sup...
3
null
Implement the Python class `PageExtensionDjangoModelFactory` described below. Class description: Factories for page extensions have in common that: - they must create a related page with a title, - the related page may have to be placed below a "parent" page, - we may want to test the related page in several languages...
Implement the Python class `PageExtensionDjangoModelFactory` described below. Class description: Factories for page extensions have in common that: - they must create a related page with a title, - the related page may have to be placed below a "parent" page, - we may want to test the related page in several languages...
f2d46fc46b271eb3b4d565039a29c15ba15f027c
<|skeleton|> class PageExtensionDjangoModelFactory: """Factories for page extensions have in common that: - they must create a related page with a title, - the related page may have to be placed below a "parent" page, - we may want to test the related page in several languages. All this is mutualized by inheriting ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PageExtensionDjangoModelFactory: """Factories for page extensions have in common that: - they must create a related page with a title, - the related page may have to be placed below a "parent" page, - we may want to test the related page in several languages. All this is mutualized by inheriting from the pres...
the_stack_v2_python_sparse
src/richie/apps/core/factories.py
openfun/richie
train
238
409ebe1d510a2644b274fbf98e60ac84f1bf76eb
[ "wx.Frame.__init__(self, None, title='Crosshair', style=wx.NO_BORDER)\nself.height_half = crosshair_height // 2\nself.width_half = crosshair_width // 2\nself.screenheight_half = screen_height // 2\nself.screenwidth_half = screen_width // 2\nself.thickness = thickness\nself.SetBackgroundColour(background_color)\nsel...
<|body_start_0|> wx.Frame.__init__(self, None, title='Crosshair', style=wx.NO_BORDER) self.height_half = crosshair_height // 2 self.width_half = crosshair_width // 2 self.screenheight_half = screen_height // 2 self.screenwidth_half = screen_width // 2 self.thickness = thi...
Crosshair
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crosshair: def __init__(self, x_pos=-1920, y_pos=0, screen_width=1920, screen_height=1080, title='Crosshair', background_color='#686868', crosshair_height=60, crosshair_width=60, thickness=7, hide_cursor=True): """A wxpython Crosshair that can flash red. :param x_pos: x position (default...
stack_v2_sparse_classes_36k_train_029120
2,843
no_license
[ { "docstring": "A wxpython Crosshair that can flash red. :param x_pos: x position (defaults to 1920 pixels left of main screen) :param y_pos: y position (defaults to 0) :param screen_width: size of screen in pixels :param screen_height: height of screen in pixels :param title: Not displayed externally. Defaults...
3
stack_v2_sparse_classes_30k_train_021553
Implement the Python class `Crosshair` described below. Class description: Implement the Crosshair class. Method signatures and docstrings: - def __init__(self, x_pos=-1920, y_pos=0, screen_width=1920, screen_height=1080, title='Crosshair', background_color='#686868', crosshair_height=60, crosshair_width=60, thicknes...
Implement the Python class `Crosshair` described below. Class description: Implement the Crosshair class. Method signatures and docstrings: - def __init__(self, x_pos=-1920, y_pos=0, screen_width=1920, screen_height=1080, title='Crosshair', background_color='#686868', crosshair_height=60, crosshair_width=60, thicknes...
4eec0ea2eb3dc287d475f9ab4e0b75259c51b309
<|skeleton|> class Crosshair: def __init__(self, x_pos=-1920, y_pos=0, screen_width=1920, screen_height=1080, title='Crosshair', background_color='#686868', crosshair_height=60, crosshair_width=60, thickness=7, hide_cursor=True): """A wxpython Crosshair that can flash red. :param x_pos: x position (default...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Crosshair: def __init__(self, x_pos=-1920, y_pos=0, screen_width=1920, screen_height=1080, title='Crosshair', background_color='#686868', crosshair_height=60, crosshair_width=60, thickness=7, hide_cursor=True): """A wxpython Crosshair that can flash red. :param x_pos: x position (defaults to 1920 pixe...
the_stack_v2_python_sparse
Graphics/CursorTask/WxCrosshair.py
heathzhang35/CCDLUtil
train
0
7c57ae52609c14193963537895761dfe748b258b
[ "if numRows == 0:\n return []\nres = [[1]]\nfor r in range(1, numRows):\n pre_list = res[-1]\n cur_list = [1] * (len(pre_list) + 1)\n for i in range(len(pre_list) - 1):\n cur_list[i + 1] = pre_list[i] + pre_list[i + 1]\n res.append(cur_list)\nreturn res", "if rowIndex == 0:\n return [1]\n...
<|body_start_0|> if numRows == 0: return [] res = [[1]] for r in range(1, numRows): pre_list = res[-1] cur_list = [1] * (len(pre_list) + 1) for i in range(len(pre_list) - 1): cur_list[i + 1] = pre_list[i] + pre_list[i + 1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate(self, numRows: int) -> List[List[int]]: """118""" <|body_0|> def getRow(self, rowIndex: int) -> List[int]: """119""" <|body_1|> <|end_skeleton|> <|body_start_0|> if numRows == 0: return [] res = [[1]] ...
stack_v2_sparse_classes_36k_train_029121
949
no_license
[ { "docstring": "118", "name": "generate", "signature": "def generate(self, numRows: int) -> List[List[int]]" }, { "docstring": "119", "name": "getRow", "signature": "def getRow(self, rowIndex: int) -> List[int]" } ]
2
stack_v2_sparse_classes_30k_train_015103
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows: int) -> List[List[int]]: 118 - def getRow(self, rowIndex: int) -> List[int]: 119
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows: int) -> List[List[int]]: 118 - def getRow(self, rowIndex: int) -> List[int]: 119 <|skeleton|> class Solution: def generate(self, numRows: int) -...
8290ad1c763d9f7c7f7bed63426b4769b34fd2fc
<|skeleton|> class Solution: def generate(self, numRows: int) -> List[List[int]]: """118""" <|body_0|> def getRow(self, rowIndex: int) -> List[int]: """119""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generate(self, numRows: int) -> List[List[int]]: """118""" if numRows == 0: return [] res = [[1]] for r in range(1, numRows): pre_list = res[-1] cur_list = [1] * (len(pre_list) + 1) for i in range(len(pre_list) - 1):...
the_stack_v2_python_sparse
array_118_yanghuiTriangle.py
screnary/Algorithm_python
train
0
c84e92eb8e63816fa5058775f1be4baa582c6dce
[ "for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if target == nums[i] + nums[j] and i != j:\n print(i, j)\n return (i, j)", "sumdict = {}\nfor i, num in enumerate(nums):\n complement = target - num\n print(sumdict)\n print(complement, sumdict.keys())\n ...
<|body_start_0|> for i in range(len(nums)): for j in range(i + 1, len(nums)): if target == nums[i] + nums[j] and i != j: print(i, j) return (i, j) <|end_body_0|> <|body_start_1|> sumdict = {} for i, num in enumerate(nums): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSumHash(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_029122
1,465
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSumHash", "signature": "def twoSumHash(self, nums, target...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSumHash(self, nums, target): :type nums: List[int] :type target: int :rtype: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSumHash(self, nums, target): :type nums: List[int] :type target: int :rtype: Li...
786075e0f9f61cf062703bc0b41cc3191d77f033
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSumHash(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" for i in range(len(nums)): for j in range(i + 1, len(nums)): if target == nums[i] + nums[j] and i != j: print(i, j) retu...
the_stack_v2_python_sparse
1_TwoSum.py
Anirban2404/LeetCodePractice
train
1
f760ba04c172b5543705846b0de53713ebbab6bd
[ "self.dll = DLL()\nself.mapper = {}\nself.capacity = capacity\nself.count = 0", "if key in self.mapper:\n node = self.mapper[key]\n self.dll.deleteNode(node)\n self.dll.addNode(node)\n return self.mapper[key].val[1]\nreturn -1", "if key in self.mapper:\n node = self.mapper[key]\n self.dll.dele...
<|body_start_0|> self.dll = DLL() self.mapper = {} self.capacity = capacity self.count = 0 <|end_body_0|> <|body_start_1|> if key in self.mapper: node = self.mapper[key] self.dll.deleteNode(node) self.dll.addNode(node) return self....
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_029123
2,310
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
3bfee704adb1d94efc8e531b732cf06c4f8aef0f
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.dll = DLL() self.mapper = {} self.capacity = capacity self.count = 0 def get(self, key): """:type key: int :rtype: int""" if key in self.mapper: node = self.mapper[ke...
the_stack_v2_python_sparse
lru.py
zopepy/leetcode
train
0
38ee80688ed3024f5c27cfa9d508b466a2220937
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IosCompliancePolicy()", "from .device_compliance_policy import DeviceCompliancePolicy\nfrom .device_threat_protection_level import DeviceThreatProtectionLevel\nfrom .required_password_type import RequiredPasswordType\nfrom .device_comp...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IosCompliancePolicy() <|end_body_0|> <|body_start_1|> from .device_compliance_policy import DeviceCompliancePolicy from .device_threat_protection_level import DeviceThreatProtectionLevel...
This class contains compliance settings for IOS.
IosCompliancePolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IosCompliancePolicy: """This class contains compliance settings for IOS.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosCompliancePolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse no...
stack_v2_sparse_classes_36k_train_029124
7,140
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: IosCompliancePolicy", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
null
Implement the Python class `IosCompliancePolicy` described below. Class description: This class contains compliance settings for IOS. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosCompliancePolicy: Creates a new instance of the appropriate class ba...
Implement the Python class `IosCompliancePolicy` described below. Class description: This class contains compliance settings for IOS. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosCompliancePolicy: Creates a new instance of the appropriate class ba...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IosCompliancePolicy: """This class contains compliance settings for IOS.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosCompliancePolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse no...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IosCompliancePolicy: """This class contains compliance settings for IOS.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosCompliancePolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to ...
the_stack_v2_python_sparse
msgraph/generated/models/ios_compliance_policy.py
microsoftgraph/msgraph-sdk-python
train
135
18b112c31fd0e296ea4d961051746ba8d8a7e86f
[ "headers = []\nfor field in self.get_export_fields():\n field_model = AidProject._meta.get_field(field.column_name)\n headers.append(field_model.verbose_name)\nreturn headers", "field_name = self.get_field_name(field)\nmethod = getattr(self, 'dehydrate_%s' % field_name, None)\nif method is not None:\n re...
<|body_start_0|> headers = [] for field in self.get_export_fields(): field_model = AidProject._meta.get_field(field.column_name) headers.append(field_model.verbose_name) return headers <|end_body_0|> <|body_start_1|> field_name = self.get_field_name(field) ...
Resource for Export AidProject.
AidProjectResource
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AidProjectResource: """Resource for Export AidProject.""" def get_export_headers(self): """override get_export_headers() to translate field names.""" <|body_0|> def export_field(self, field, obj): """override export_field() to translate field values.""" <...
stack_v2_sparse_classes_36k_train_029125
13,586
permissive
[ { "docstring": "override get_export_headers() to translate field names.", "name": "get_export_headers", "signature": "def get_export_headers(self)" }, { "docstring": "override export_field() to translate field values.", "name": "export_field", "signature": "def export_field(self, field, ...
2
stack_v2_sparse_classes_30k_train_000645
Implement the Python class `AidProjectResource` described below. Class description: Resource for Export AidProject. Method signatures and docstrings: - def get_export_headers(self): override get_export_headers() to translate field names. - def export_field(self, field, obj): override export_field() to translate field...
Implement the Python class `AidProjectResource` described below. Class description: Resource for Export AidProject. Method signatures and docstrings: - def get_export_headers(self): override get_export_headers() to translate field names. - def export_field(self, field, obj): override export_field() to translate field...
af9f6e6e8b1918363793fbf291f3518ef1454169
<|skeleton|> class AidProjectResource: """Resource for Export AidProject.""" def get_export_headers(self): """override get_export_headers() to translate field names.""" <|body_0|> def export_field(self, field, obj): """override export_field() to translate field values.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AidProjectResource: """Resource for Export AidProject.""" def get_export_headers(self): """override get_export_headers() to translate field names.""" headers = [] for field in self.get_export_fields(): field_model = AidProject._meta.get_field(field.column_name) ...
the_stack_v2_python_sparse
src/aids/resources.py
MTES-MCT/aides-territoires
train
21
9b6aa1307c3a22123aa6636db3c8baa06c2773ca
[ "self.value = value\nself.description = description\nself.default = default", "v = '\"%s\"' % self.value if type(self.value) is str else str(self.value)\nd = {'value': v}\nd['default'] = ' (Default)' if self.default else ''\nd['description'] = ' %s' % self.description if self.description != None else ''\nd['link'...
<|body_start_0|> self.value = value self.description = description self.default = default <|end_body_0|> <|body_start_1|> v = '"%s"' % self.value if type(self.value) is str else str(self.value) d = {'value': v} d['default'] = ' (Default)' if self.default else '' ...
Class representing a value for an Option.
OptionValue
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionValue: """Class representing a value for an Option.""" def __init__(self, value, description=None, default=False): """Initialisation. @param value The value. @param description (str) A description for this value. @param default (bool) If this value is the default value.""" ...
stack_v2_sparse_classes_36k_train_029126
11,864
permissive
[ { "docstring": "Initialisation. @param value The value. @param description (str) A description for this value. @param default (bool) If this value is the default value.", "name": "__init__", "signature": "def __init__(self, value, description=None, default=False)" }, { "docstring": "Render this ...
2
stack_v2_sparse_classes_30k_train_005563
Implement the Python class `OptionValue` described below. Class description: Class representing a value for an Option. Method signatures and docstrings: - def __init__(self, value, description=None, default=False): Initialisation. @param value The value. @param description (str) A description for this value. @param d...
Implement the Python class `OptionValue` described below. Class description: Class representing a value for an Option. Method signatures and docstrings: - def __init__(self, value, description=None, default=False): Initialisation. @param value The value. @param description (str) A description for this value. @param d...
c20c06b85bc04902134ab37442763ef6660a35f5
<|skeleton|> class OptionValue: """Class representing a value for an Option.""" def __init__(self, value, description=None, default=False): """Initialisation. @param value The value. @param description (str) A description for this value. @param default (bool) If this value is the default value.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptionValue: """Class representing a value for an Option.""" def __init__(self, value, description=None, default=False): """Initialisation. @param value The value. @param description (str) A description for this value. @param default (bool) If this value is the default value.""" self.valu...
the_stack_v2_python_sparse
olof/configuration.py
Roel/Gyrid-server
train
0
e1652dc5737322ed873006c08e6653036affc57f
[ "if username is None and password is None:\n username = account.username\n password = decrypt_password(account.data['gerrit_http_password'])\nreturn super(GerritClient, self).get_http_credentials(account=account, username=username, password=password)", "super(GerritClient, self).process_http_error(request, ...
<|body_start_0|> if username is None and password is None: username = account.username password = decrypt_password(account.data['gerrit_http_password']) return super(GerritClient, self).get_http_credentials(account=account, username=username, password=password) <|end_body_0|> <|...
The Gerrit hosting service API client.
GerritClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GerritClient: """The Gerrit hosting service API client.""" def get_http_credentials(self, account, username=None, password=None, **kwargs): """Return credentials used to authenticate with the service. Unless an explicit username and password is provided, this will use the ones stored...
stack_v2_sparse_classes_36k_train_029127
26,166
permissive
[ { "docstring": "Return credentials used to authenticate with the service. Unless an explicit username and password is provided, this will use the ones stored for the account. Args: account (reviewboard.hostingsvcs.models.HostingServiceAccount): The stored authentication data for the service. username (unicode, ...
2
stack_v2_sparse_classes_30k_train_011062
Implement the Python class `GerritClient` described below. Class description: The Gerrit hosting service API client. Method signatures and docstrings: - def get_http_credentials(self, account, username=None, password=None, **kwargs): Return credentials used to authenticate with the service. Unless an explicit usernam...
Implement the Python class `GerritClient` described below. Class description: The Gerrit hosting service API client. Method signatures and docstrings: - def get_http_credentials(self, account, username=None, password=None, **kwargs): Return credentials used to authenticate with the service. Unless an explicit usernam...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class GerritClient: """The Gerrit hosting service API client.""" def get_http_credentials(self, account, username=None, password=None, **kwargs): """Return credentials used to authenticate with the service. Unless an explicit username and password is provided, this will use the ones stored...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GerritClient: """The Gerrit hosting service API client.""" def get_http_credentials(self, account, username=None, password=None, **kwargs): """Return credentials used to authenticate with the service. Unless an explicit username and password is provided, this will use the ones stored for the acco...
the_stack_v2_python_sparse
reviewboard/hostingsvcs/gerrit.py
reviewboard/reviewboard
train
1,141
35b3e6750d559d2d5bf0f9e7e5c1abda5eb1a349
[ "if root == None:\n return root\nout = self.dfs(root)\nprev = root\nif len(out) <= 1:\n return root\nelse:\n for e in out[1:]:\n prev.left = None\n prev.right = TreeNode(e)\n prev = prev.right", "out_lst = [node.val]\nif node.left:\n out_lst += self.dfs(node.left)\nif node.right:\...
<|body_start_0|> if root == None: return root out = self.dfs(root) prev = root if len(out) <= 1: return root else: for e in out[1:]: prev.left = None prev.right = TreeNode(e) prev = prev.right <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" <|body_0|> def dfs(self, node): """得到这个node下所有节点""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root == None: ...
stack_v2_sparse_classes_36k_train_029128
1,076
no_license
[ { "docstring": ":type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": "得到这个node下所有节点", "name": "dfs", "signature": "def dfs(self, node)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: None Do not return anything, modify root in-place instead. - def dfs(self, node): 得到这个node下所有节点
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: None Do not return anything, modify root in-place instead. - def dfs(self, node): 得到这个node下所有节点 <|skeleton|> class Solution...
f1a3930c571a6d062208ee1c1aadfe93a5684c40
<|skeleton|> class Solution: def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" <|body_0|> def dfs(self, node): """得到这个node下所有节点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" if root == None: return root out = self.dfs(root) prev = root if len(out) <= 1: return root else: ...
the_stack_v2_python_sparse
solution/problem 82.py
Fay321/leetcode-exercise
train
0
1baadf850299d55bf32988b389f9a27bb5b1e3b4
[ "borders = np.arange(10)\n'when'\ntuples = get_buckets(borders)\n'then'\nself.assertEqual(str(tuples), str([(np.nan, 0.0), (0.0, 1.0), (1.0, 2.0), (2.0, 3.0), (3.0, 4.0), (4.0, 5.0), (5.0, 6.0), (6.0, 7.0), (7.0, 8.0), (8.0, 9.0), (9.0, np.nan)]))", "b = CircularBuffer(10)\nb2 = CircularBuffer(10)\n'when'\nfor i ...
<|body_start_0|> borders = np.arange(10) 'when' tuples = get_buckets(borders) 'then' self.assertEqual(str(tuples), str([(np.nan, 0.0), (0.0, 1.0), (1.0, 2.0), (2.0, 3.0), (3.0, 4.0), (4.0, 5.0), (5.0, 6.0), (6.0, 7.0), (7.0, 8.0), (8.0, 9.0), (9.0, np.nan)])) <|end_body_0|> <|bo...
TestNumpyUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNumpyUtils: def test_bucketing(self): """given""" <|body_0|> def test_circular_buffer(self): """given""" <|body_1|> def test_one_hot(self): """given integer numbers""" <|body_2|> <|end_skeleton|> <|body_start_0|> borders = n...
stack_v2_sparse_classes_36k_train_029129
1,313
permissive
[ { "docstring": "given", "name": "test_bucketing", "signature": "def test_bucketing(self)" }, { "docstring": "given", "name": "test_circular_buffer", "signature": "def test_circular_buffer(self)" }, { "docstring": "given integer numbers", "name": "test_one_hot", "signature...
3
null
Implement the Python class `TestNumpyUtils` described below. Class description: Implement the TestNumpyUtils class. Method signatures and docstrings: - def test_bucketing(self): given - def test_circular_buffer(self): given - def test_one_hot(self): given integer numbers
Implement the Python class `TestNumpyUtils` described below. Class description: Implement the TestNumpyUtils class. Method signatures and docstrings: - def test_bucketing(self): given - def test_circular_buffer(self): given - def test_one_hot(self): given integer numbers <|skeleton|> class TestNumpyUtils: def t...
650a8e8f77bc4d71136518d1c7ee65c194a99cf0
<|skeleton|> class TestNumpyUtils: def test_bucketing(self): """given""" <|body_0|> def test_circular_buffer(self): """given""" <|body_1|> def test_one_hot(self): """given integer numbers""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNumpyUtils: def test_bucketing(self): """given""" borders = np.arange(10) 'when' tuples = get_buckets(borders) 'then' self.assertEqual(str(tuples), str([(np.nan, 0.0), (0.0, 1.0), (1.0, 2.0), (2.0, 3.0), (3.0, 4.0), (4.0, 5.0), (5.0, 6.0), (6.0, 7.0), (7.0, ...
the_stack_v2_python_sparse
pandas-ml-common/pandas_ml_common_test/unit/utils/test_numpy.py
jcoffi/pandas-ml-quant
train
0
dade4a359d421bd76494d53e10649ef2d7a32b09
[ "super(QFlowWidgetItem, self).__init__(widget)\nself.data = data\nself._cached_hint = QSize()\nself._cached_max = QSize()\nself._cached_min = QSize()", "if not self._cached_max.isValid():\n self._cached_max = super(QFlowWidgetItem, self).maximumSize()\nreturn self._cached_max", "if not self._cached_min.isVal...
<|body_start_0|> super(QFlowWidgetItem, self).__init__(widget) self.data = data self._cached_hint = QSize() self._cached_max = QSize() self._cached_min = QSize() <|end_body_0|> <|body_start_1|> if not self._cached_max.isValid(): self._cached_max = super(QFlow...
A custom QWidgetItem for use with the QFlowLayout.
QFlowWidgetItem
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QFlowWidgetItem: """A custom QWidgetItem for use with the QFlowLayout.""" def __init__(self, widget, data): """Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this i...
stack_v2_sparse_classes_36k_train_029130
39,042
permissive
[ { "docstring": "Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this item.", "name": "__init__", "signature": "def __init__(self, widget, data)" }, { "docstring": "Reimplemented...
6
null
Implement the Python class `QFlowWidgetItem` described below. Class description: A custom QWidgetItem for use with the QFlowLayout. Method signatures and docstrings: - def __init__(self, widget, data): Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : Flo...
Implement the Python class `QFlowWidgetItem` described below. Class description: A custom QWidgetItem for use with the QFlowLayout. Method signatures and docstrings: - def __init__(self, widget, data): Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : Flo...
1544e7fb371b8f941cfa2fde682795e479380284
<|skeleton|> class QFlowWidgetItem: """A custom QWidgetItem for use with the QFlowLayout.""" def __init__(self, widget, data): """Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QFlowWidgetItem: """A custom QWidgetItem for use with the QFlowLayout.""" def __init__(self, widget, data): """Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this item.""" ...
the_stack_v2_python_sparse
enaml/qt/q_flow_layout.py
MatthieuDartiailh/enaml
train
26
9f61664d8d4b343d7e687880daf78b9d2bf28696
[ "self.config_entry = entry\nself.client = Elgato(entry.data[CONF_HOST], port=entry.data[CONF_PORT], session=async_get_clientsession(hass))\nsuper().__init__(hass, LOGGER, name=f'{DOMAIN}_{entry.data[CONF_HOST]}', update_interval=SCAN_INTERVAL)", "try:\n if self.has_battery is None:\n self.has_battery = ...
<|body_start_0|> self.config_entry = entry self.client = Elgato(entry.data[CONF_HOST], port=entry.data[CONF_PORT], session=async_get_clientsession(hass)) super().__init__(hass, LOGGER, name=f'{DOMAIN}_{entry.data[CONF_HOST]}', update_interval=SCAN_INTERVAL) <|end_body_0|> <|body_start_1|> ...
Class to manage fetching Elgato data.
ElgatoDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElgatoDataUpdateCoordinator: """Class to manage fetching Elgato data.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize the coordinator.""" <|body_0|> async def _async_update_data(self) -> ElgatoData: """Fetch data from the Elg...
stack_v2_sparse_classes_36k_train_029131
1,971
permissive
[ { "docstring": "Initialize the coordinator.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None" }, { "docstring": "Fetch data from the Elgato device.", "name": "_async_update_data", "signature": "async def _async_update_data(self) -> E...
2
stack_v2_sparse_classes_30k_train_002146
Implement the Python class `ElgatoDataUpdateCoordinator` described below. Class description: Class to manage fetching Elgato data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the coordinator. - async def _async_update_data(self) -> ElgatoData: Fe...
Implement the Python class `ElgatoDataUpdateCoordinator` described below. Class description: Class to manage fetching Elgato data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the coordinator. - async def _async_update_data(self) -> ElgatoData: Fe...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ElgatoDataUpdateCoordinator: """Class to manage fetching Elgato data.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize the coordinator.""" <|body_0|> async def _async_update_data(self) -> ElgatoData: """Fetch data from the Elg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElgatoDataUpdateCoordinator: """Class to manage fetching Elgato data.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize the coordinator.""" self.config_entry = entry self.client = Elgato(entry.data[CONF_HOST], port=entry.data[CONF_PORT], session...
the_stack_v2_python_sparse
homeassistant/components/elgato/coordinator.py
home-assistant/core
train
35,501
e98c17b010c1258e3c9b144718ae074979299732
[ "self.needed_locks = {}\nif self.op.duration <= 0:\n raise errors.OpPrereqError('Duration must be greater than zero')\nif not self.op.no_locks and (self.op.on_nodes or self.op.on_master):\n self.needed_locks[locking.LEVEL_NODE] = []\nself.op.on_node_uuids = []\nif self.op.on_nodes:\n self.op.on_node_uuids,...
<|body_start_0|> self.needed_locks = {} if self.op.duration <= 0: raise errors.OpPrereqError('Duration must be greater than zero') if not self.op.no_locks and (self.op.on_nodes or self.op.on_master): self.needed_locks[locking.LEVEL_NODE] = [] self.op.on_node_uuids...
Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.
LUTestDelay
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LUTestDelay: """Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.""" def ExpandNames(self): """Expand names and set required locks. This expands the node list, if any.""" <|body_0|> def _InterruptibleDelay(sel...
stack_v2_sparse_classes_36k_train_029132
16,228
permissive
[ { "docstring": "Expand names and set required locks. This expands the node list, if any.", "name": "ExpandNames", "signature": "def ExpandNames(self)" }, { "docstring": "Delays but provides the mechanisms necessary to interrupt the delay as needed.", "name": "_InterruptibleDelay", "signa...
5
stack_v2_sparse_classes_30k_val_000855
Implement the Python class `LUTestDelay` described below. Class description: Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time. Method signatures and docstrings: - def ExpandNames(self): Expand names and set required locks. This expands the node list, if an...
Implement the Python class `LUTestDelay` described below. Class description: Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time. Method signatures and docstrings: - def ExpandNames(self): Expand names and set required locks. This expands the node list, if an...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class LUTestDelay: """Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.""" def ExpandNames(self): """Expand names and set required locks. This expands the node list, if any.""" <|body_0|> def _InterruptibleDelay(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LUTestDelay: """Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.""" def ExpandNames(self): """Expand names and set required locks. This expands the node list, if any.""" self.needed_locks = {} if self.op.duration <= 0:...
the_stack_v2_python_sparse
lib/cmdlib/test.py
ganeti/ganeti
train
465
c512c29e936921f2ad8fd937d3100dea310ce9eb
[ "response = await self.client(Operation(operation_type='RUNNER_READ', kwargs={'runner_id': runner_id}))\nself.set_header('Content-Type', 'application/json; charset=UTF-8')\nself.write(response)", "response = await self.client(Operation(operation_type='RUNNER_DELETE', kwargs={'runner_id': runner_id, 'remove': True...
<|body_start_0|> response = await self.client(Operation(operation_type='RUNNER_READ', kwargs={'runner_id': runner_id})) self.set_header('Content-Type', 'application/json; charset=UTF-8') self.write(response) <|end_body_0|> <|body_start_1|> response = await self.client(Operation(operatio...
RunnerAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunnerAPI: async def get(self, runner_id): """--- summary: Get a runner parameters: - name: runner_id in: path required: true description: The ID of the Runner type: string responses: 200: description: List of runner states schema: $ref: '#/definitions/Runner' 404: $ref: '#/definitions/4...
stack_v2_sparse_classes_36k_train_029133
6,146
permissive
[ { "docstring": "--- summary: Get a runner parameters: - name: runner_id in: path required: true description: The ID of the Runner type: string responses: 200: description: List of runner states schema: $ref: '#/definitions/Runner' 404: $ref: '#/definitions/404Error' 50x: $ref: '#/definitions/50xError' tags: - R...
3
stack_v2_sparse_classes_30k_train_002783
Implement the Python class `RunnerAPI` described below. Class description: Implement the RunnerAPI class. Method signatures and docstrings: - async def get(self, runner_id): --- summary: Get a runner parameters: - name: runner_id in: path required: true description: The ID of the Runner type: string responses: 200: d...
Implement the Python class `RunnerAPI` described below. Class description: Implement the RunnerAPI class. Method signatures and docstrings: - async def get(self, runner_id): --- summary: Get a runner parameters: - name: runner_id in: path required: true description: The ID of the Runner type: string responses: 200: d...
a5fd2dcc2444409e243d3fdaa43d86695e5cb142
<|skeleton|> class RunnerAPI: async def get(self, runner_id): """--- summary: Get a runner parameters: - name: runner_id in: path required: true description: The ID of the Runner type: string responses: 200: description: List of runner states schema: $ref: '#/definitions/Runner' 404: $ref: '#/definitions/4...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunnerAPI: async def get(self, runner_id): """--- summary: Get a runner parameters: - name: runner_id in: path required: true description: The ID of the Runner type: string responses: 200: description: List of runner states schema: $ref: '#/definitions/Runner' 404: $ref: '#/definitions/404Error' 50x: ...
the_stack_v2_python_sparse
src/app/beer_garden/api/http/handlers/vbeta/runner.py
beer-garden/beer-garden
train
254
9f3c1acc7c1a14ab6efc85ddf6f00b4d87e0e44e
[ "if strs == []:\n return ''\ndict = {}\ncommon = len(strs[0])\nfor i, s in enumerate(strs):\n count = 0\n for j, c in enumerate(s):\n if count >= common:\n break\n if dict.get(j) == None:\n if i == 0:\n dict[j] = c\n count += 1\n ...
<|body_start_0|> if strs == []: return '' dict = {} common = len(strs[0]) for i, s in enumerate(strs): count = 0 for j, c in enumerate(s): if count >= common: break if dict.get(j) == None: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix_myself(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> def longestCommonPrefix_heng(self, s1): """:type strs...
stack_v2_sparse_classes_36k_train_029134
3,533
no_license
[ { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix_myself", "signature": "def longestCommonPrefix_myself(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix", "signature": "def longestCommonPrefix(self, strs)" }...
3
stack_v2_sparse_classes_30k_train_019416
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix_myself(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix_h...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix_myself(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix_h...
93266095329e2e8e949a72371b88b07382a60e0d
<|skeleton|> class Solution: def longestCommonPrefix_myself(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> def longestCommonPrefix_heng(self, s1): """:type strs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonPrefix_myself(self, strs): """:type strs: List[str] :rtype: str""" if strs == []: return '' dict = {} common = len(strs[0]) for i, s in enumerate(strs): count = 0 for j, c in enumerate(s): if...
the_stack_v2_python_sparse
longestCommonPrefix.py
shivangi-prog/leetcode
train
0
47736eafa758724b7c78c98cb372047dad6c43f8
[ "num_idx_map = {}\nfor idx, num in enumerate(nums):\n diff = target - num\n if diff in num_idx_map:\n return [num_idx_map[diff], idx]\n else:\n num_idx_map[num] = idx", "pairs = [(num, i) for i, num in enumerate(nums)]\nnums = sorted(pairs)\nprint(nums)\nbeg, end = (0, len(nums) - 1)\nwhile...
<|body_start_0|> num_idx_map = {} for idx, num in enumerate(nums): diff = target - num if diff in num_idx_map: return [num_idx_map[diff], idx] else: num_idx_map[num] = idx <|end_body_0|> <|body_start_1|> pairs = [(num, i) for i...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """注意这题目 letcode 不是有序的,剑指offer 上的是有序的。一种方式是用 hash 来做 :type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum1(self, nums, target): """注意这题目 letcode 不是有序的,剑指offer 上的是有序的。可以先排序来做。之后首位指针向中间归并 :type num...
stack_v2_sparse_classes_36k_train_029135
1,695
permissive
[ { "docstring": "注意这题目 letcode 不是有序的,剑指offer 上的是有序的。一种方式是用 hash 来做 :type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": "注意这题目 letcode 不是有序的,剑指offer 上的是有序的。可以先排序来做。之后首位指针向中间归并 :type nums: List[int] :type targ...
2
stack_v2_sparse_classes_30k_train_010226
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): 注意这题目 letcode 不是有序的,剑指offer 上的是有序的。一种方式是用 hash 来做 :type nums: List[int] :type target: int :rtype: List[int] - def twoSum1(self, nums, target): 注意这...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): 注意这题目 letcode 不是有序的,剑指offer 上的是有序的。一种方式是用 hash 来做 :type nums: List[int] :type target: int :rtype: List[int] - def twoSum1(self, nums, target): 注意这...
3469a79c34b6c08ae52797c3974b49fbfa8cca51
<|skeleton|> class Solution: def twoSum(self, nums, target): """注意这题目 letcode 不是有序的,剑指offer 上的是有序的。一种方式是用 hash 来做 :type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum1(self, nums, target): """注意这题目 letcode 不是有序的,剑指offer 上的是有序的。可以先排序来做。之后首位指针向中间归并 :type num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """注意这题目 letcode 不是有序的,剑指offer 上的是有序的。一种方式是用 hash 来做 :type nums: List[int] :type target: int :rtype: List[int]""" num_idx_map = {} for idx, num in enumerate(nums): diff = target - num if diff in num_idx_map: ...
the_stack_v2_python_sparse
剑指offer/41_1_TwoNumbersWithSum(和为s的两个数字VS和为s的连续正数序列).py
Mark24Code/python_data_structures_and_algorithms
train
1
a577d974c9da21494dcab37849ef72837c034fa8
[ "db_start = time()\nprint('database start time is {}'.format(db_start))\ntry:\n user_profile = UserProfile.objects.get(pk=pk)\nexcept UserProfile.DoesNotExist:\n return Response({'message': 'The User Profile does not exist'}, status=status.HTTP_404_NOT_FOUND)\ndb_time = time() - db_start\nprint('database acce...
<|body_start_0|> db_start = time() print('database start time is {}'.format(db_start)) try: user_profile = UserProfile.objects.get(pk=pk) except UserProfile.DoesNotExist: return Response({'message': 'The User Profile does not exist'}, status=status.HTTP_404_NOT_FO...
UserProfileView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileView: def get(self, request, pk, *args, **kwargs): """:param request: :param pk: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """:param request: :param pk: :param args: :param kwargs: :return:""" <|bo...
stack_v2_sparse_classes_36k_train_029136
2,896
no_license
[ { "docstring": ":param request: :param pk: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, pk, *args, **kwargs)" }, { "docstring": ":param request: :param pk: :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, re...
4
stack_v2_sparse_classes_30k_train_021236
Implement the Python class `UserProfileView` described below. Class description: Implement the UserProfileView class. Method signatures and docstrings: - def get(self, request, pk, *args, **kwargs): :param request: :param pk: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): :param requ...
Implement the Python class `UserProfileView` described below. Class description: Implement the UserProfileView class. Method signatures and docstrings: - def get(self, request, pk, *args, **kwargs): :param request: :param pk: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): :param requ...
1808c866a28ae1d9424d6d929890688b95cb7605
<|skeleton|> class UserProfileView: def get(self, request, pk, *args, **kwargs): """:param request: :param pk: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """:param request: :param pk: :param args: :param kwargs: :return:""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserProfileView: def get(self, request, pk, *args, **kwargs): """:param request: :param pk: :param args: :param kwargs: :return:""" db_start = time() print('database start time is {}'.format(db_start)) try: user_profile = UserProfile.objects.get(pk=pk) excep...
the_stack_v2_python_sparse
assignment/promantus/views.py
kshitijParashar/PromantusApp
train
0
7f43f15cf9e55c8a9c3151392086d821effb23ff
[ "self.task.set_status(hd_fields.TaskStatus.Running)\nself.task.save()\ndriver = self._get_driver('node')\nif driver is None:\n self.task.set_status(hd_fields.TaskStatus.Complete)\n self.task.add_status_msg(msg='No node driver enabled, ending task.', error=True, ctx=str(self.task.get_id()), ctx_type='task')\n ...
<|body_start_0|> self.task.set_status(hd_fields.TaskStatus.Running) self.task.save() driver = self._get_driver('node') if driver is None: self.task.set_status(hd_fields.TaskStatus.Complete) self.task.add_status_msg(msg='No node driver enabled, ending task.', error...
Action to configure site wide/inter-node settings.
PrepareSite
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrepareSite: """Action to configure site wide/inter-node settings.""" def start(self): """Start executing this action in the context of the local task.""" <|body_0|> def step_configureprovisioner(self, driver): """Run the ConfigureNodeProvisioner step of this act...
stack_v2_sparse_classes_36k_train_029137
47,038
permissive
[ { "docstring": "Start executing this action in the context of the local task.", "name": "start", "signature": "def start(self)" }, { "docstring": "Run the ConfigureNodeProvisioner step of this action. :param driver: The driver instance to use for execution.", "name": "step_configureprovision...
4
null
Implement the Python class `PrepareSite` described below. Class description: Action to configure site wide/inter-node settings. Method signatures and docstrings: - def start(self): Start executing this action in the context of the local task. - def step_configureprovisioner(self, driver): Run the ConfigureNodeProvisi...
Implement the Python class `PrepareSite` described below. Class description: Action to configure site wide/inter-node settings. Method signatures and docstrings: - def start(self): Start executing this action in the context of the local task. - def step_configureprovisioner(self, driver): Run the ConfigureNodeProvisi...
f99abfa4337f8cbb591513aac404b11208d4187c
<|skeleton|> class PrepareSite: """Action to configure site wide/inter-node settings.""" def start(self): """Start executing this action in the context of the local task.""" <|body_0|> def step_configureprovisioner(self, driver): """Run the ConfigureNodeProvisioner step of this act...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrepareSite: """Action to configure site wide/inter-node settings.""" def start(self): """Start executing this action in the context of the local task.""" self.task.set_status(hd_fields.TaskStatus.Running) self.task.save() driver = self._get_driver('node') if drive...
the_stack_v2_python_sparse
python/drydock_provisioner/orchestrator/actions/orchestrator.py
airshipit/drydock
train
13
b62173335183be65b5f41cc1779a5b84b3e2cbfb
[ "super(RainbowDQN, self).__init__()\nobs_shape, action_shape = (squeeze(obs_shape), squeeze(action_shape))\nif head_hidden_size is None:\n head_hidden_size = encoder_hidden_size_list[-1]\nif isinstance(obs_shape, int) or len(obs_shape) == 1:\n self.encoder = FCEncoder(obs_shape, encoder_hidden_size_list, acti...
<|body_start_0|> super(RainbowDQN, self).__init__() obs_shape, action_shape = (squeeze(obs_shape), squeeze(action_shape)) if head_hidden_size is None: head_hidden_size = encoder_hidden_size_list[-1] if isinstance(obs_shape, int) or len(obs_shape) == 1: self.encode...
Overview: RainbowDQN network (C51 + Dueling + Noisy Block) .. note:: RainbowDQN contains dueling architecture by default
RainbowDQN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RainbowDQN: """Overview: RainbowDQN network (C51 + Dueling + Noisy Block) .. note:: RainbowDQN contains dueling architecture by default""" def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], he...
stack_v2_sparse_classes_36k_train_029138
30,380
permissive
[ { "docstring": "Overview: Init the Rainbow Model according to arguments. Arguments: - obs_shape (:obj:`Union[int, SequenceType]`): Observation space shape. - action_shape (:obj:`Union[int, SequenceType]`): Action space shape. - encoder_hidden_size_list (:obj:`SequenceType`): Collection of ``hidden_size`` to pas...
2
stack_v2_sparse_classes_30k_train_008113
Implement the Python class `RainbowDQN` described below. Class description: Overview: RainbowDQN network (C51 + Dueling + Noisy Block) .. note:: RainbowDQN contains dueling architecture by default Method signatures and docstrings: - def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, Sequ...
Implement the Python class `RainbowDQN` described below. Class description: Overview: RainbowDQN network (C51 + Dueling + Noisy Block) .. note:: RainbowDQN contains dueling architecture by default Method signatures and docstrings: - def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, Sequ...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class RainbowDQN: """Overview: RainbowDQN network (C51 + Dueling + Noisy Block) .. note:: RainbowDQN contains dueling architecture by default""" def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], he...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RainbowDQN: """Overview: RainbowDQN network (C51 + Dueling + Noisy Block) .. note:: RainbowDQN contains dueling architecture by default""" def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], head_hidden_siz...
the_stack_v2_python_sparse
ding/model/template/q_learning.py
shengxuesun/DI-engine
train
1
f1d83757e80d1b5229afb869b35ddbd8d9df6dad
[ "player_id = current_user.get('player_id')\nif player_id:\n ticket = flexmatch.get_player_ticket(player_id)\n if ticket and ticket['TicketId'] == ticket_id:\n ret = dict(ticket_id=ticket['TicketId'], ticket_status=ticket['Status'], configuration_name=ticket['ConfigurationName'], players=ticket['Players...
<|body_start_0|> player_id = current_user.get('player_id') if player_id: ticket = flexmatch.get_player_ticket(player_id) if ticket and ticket['TicketId'] == ticket_id: ret = dict(ticket_id=ticket['TicketId'], ticket_status=ticket['Status'], configuration_name=tick...
RUD API for flexmatch tickets.
FlexMatchTicketAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlexMatchTicketAPI: """RUD API for flexmatch tickets.""" def get(ticket_id): """Return the stored ticket if the calling player is a member of the ticket, either solo or via party""" <|body_0|> def delete(ticket_id): """Delete and cancel 'ticket_id' if caller is a...
stack_v2_sparse_classes_36k_train_029139
11,779
permissive
[ { "docstring": "Return the stored ticket if the calling player is a member of the ticket, either solo or via party", "name": "get", "signature": "def get(ticket_id)" }, { "docstring": "Delete and cancel 'ticket_id' if caller is allowed to do so.", "name": "delete", "signature": "def dele...
3
stack_v2_sparse_classes_30k_train_008002
Implement the Python class `FlexMatchTicketAPI` described below. Class description: RUD API for flexmatch tickets. Method signatures and docstrings: - def get(ticket_id): Return the stored ticket if the calling player is a member of the ticket, either solo or via party - def delete(ticket_id): Delete and cancel 'tick...
Implement the Python class `FlexMatchTicketAPI` described below. Class description: RUD API for flexmatch tickets. Method signatures and docstrings: - def get(ticket_id): Return the stored ticket if the calling player is a member of the ticket, either solo or via party - def delete(ticket_id): Delete and cancel 'tick...
2771bb46db7fd331448f9db3cfb257fab7f89bcc
<|skeleton|> class FlexMatchTicketAPI: """RUD API for flexmatch tickets.""" def get(ticket_id): """Return the stored ticket if the calling player is a member of the ticket, either solo or via party""" <|body_0|> def delete(ticket_id): """Delete and cancel 'ticket_id' if caller is a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlexMatchTicketAPI: """RUD API for flexmatch tickets.""" def get(ticket_id): """Return the stored ticket if the calling player is a member of the ticket, either solo or via party""" player_id = current_user.get('player_id') if player_id: ticket = flexmatch.get_player_t...
the_stack_v2_python_sparse
driftbase/api/matchmakers/flexmatch.py
directivegames/drift-base
train
1
0d321699c64a7e3af7180aacae9be4171af93cd7
[ "X = _is_dataframe(X)\nself.variables = _find_numerical_variables(X, self.variables)\n_check_contains_na(X, self.variables)\nreturn X", "check_is_fitted(self)\nX = _is_dataframe(X)\n_check_contains_na(X, self.variables)\n_check_input_matches_training_df(X, self.input_shape_[1])\nreturn X" ]
<|body_start_0|> X = _is_dataframe(X) self.variables = _find_numerical_variables(X, self.variables) _check_contains_na(X, self.variables) return X <|end_body_0|> <|body_start_1|> check_is_fitted(self) X = _is_dataframe(X) _check_contains_na(X, self.variables) ...
BaseNumericalTransformer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseNumericalTransformer: def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: """Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults...
stack_v2_sparse_classes_36k_train_029140
2,119
permissive
[ { "docstring": "Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults to None. Alternatively takes Pandas Series. Returns: DataFrame with fitted transformation", "name": "fit", ...
2
stack_v2_sparse_classes_30k_train_021667
Implement the Python class `BaseNumericalTransformer` described below. Class description: Implement the BaseNumericalTransformer class. Method signatures and docstrings: - def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: Fits the transformation to the DataFrame. Args: X: Pandas DataFrame t...
Implement the Python class `BaseNumericalTransformer` described below. Class description: Implement the BaseNumericalTransformer class. Method signatures and docstrings: - def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: Fits the transformation to the DataFrame. Args: X: Pandas DataFrame t...
74a2902c129452c96cc434df70127b7fa61b7f8a
<|skeleton|> class BaseNumericalTransformer: def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: """Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseNumericalTransformer: def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: """Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults to None. Alte...
the_stack_v2_python_sparse
feature_engine/base_transformers.py
mlaricobar/feature_engine
train
0
f6ae82440e44f59504edf5f3797ea1269b00cd32
[ "super().__init__(ui_obj=ui_obj, vertex=vertex, scale_factor=scale_factor, movable=movable, selectable=selectable, r=r)\nself.pen = pen\nself.brush = brush\nself.selected_pen = QtGui.QPen(QtCore.Qt.darkCyan)\nself.selected_pen.setWidth(6)\nself.selected_brush = QtGui.QBrush(QtCore.Qt.darkCyan)\nself.set_style()", ...
<|body_start_0|> super().__init__(ui_obj=ui_obj, vertex=vertex, scale_factor=scale_factor, movable=movable, selectable=selectable, r=r) self.pen = pen self.brush = brush self.selected_pen = QtGui.QPen(QtCore.Qt.darkCyan) self.selected_pen.setWidth(6) self.selected_brush =...
InteractiveOverlayColumn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractiveOverlayColumn: def __init__(self, ui_obj=None, vertex=None, scale_factor=1, movable=True, selectable=True, r=16, pen=QtGui.QPen(QtCore.Qt.red), brush=QtGui.QBrush(QtCore.Qt.red)): """Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. ...
stack_v2_sparse_classes_36k_train_029141
26,668
no_license
[ { "docstring": "Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. Is used to highlight atomic positions.", "name": "__init__", "signature": "def __init__(self, ui_obj=None, vertex=None, scale_factor=1, movable=True, selectable=True, r=16, pen=QtGui.QPen(QtCore...
2
stack_v2_sparse_classes_30k_train_001849
Implement the Python class `InteractiveOverlayColumn` described below. Class description: Implement the InteractiveOverlayColumn class. Method signatures and docstrings: - def __init__(self, ui_obj=None, vertex=None, scale_factor=1, movable=True, selectable=True, r=16, pen=QtGui.QPen(QtCore.Qt.red), brush=QtGui.QBrus...
Implement the Python class `InteractiveOverlayColumn` described below. Class description: Implement the InteractiveOverlayColumn class. Method signatures and docstrings: - def __init__(self, ui_obj=None, vertex=None, scale_factor=1, movable=True, selectable=True, r=16, pen=QtGui.QPen(QtCore.Qt.red), brush=QtGui.QBrus...
7fed6e5121180981ce67b1397ddd5ef54246e5eb
<|skeleton|> class InteractiveOverlayColumn: def __init__(self, ui_obj=None, vertex=None, scale_factor=1, movable=True, selectable=True, r=16, pen=QtGui.QPen(QtCore.Qt.red), brush=QtGui.QBrush(QtCore.Qt.red)): """Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InteractiveOverlayColumn: def __init__(self, ui_obj=None, vertex=None, scale_factor=1, movable=True, selectable=True, r=16, pen=QtGui.QPen(QtCore.Qt.red), brush=QtGui.QBrush(QtCore.Qt.red)): """Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. Is used to hig...
the_stack_v2_python_sparse
GUI_custom_components.py
Haawk666/AutomAl_6000_thesis_version
train
0
4109b0a3748f7d5d98c91fd5f9cadfed173c5270
[ "self.batteries = {}\nfor section in cfg.sections():\n parts = section.split('.')\n if parts[0] == 'battery':\n name = parts[1]\n empty = cfg.getint(section, 'empty')\n full = cfg.getint(section, 'full')\n self.batteries[name] = Battery(empty, full)\nself.BATT_LOW = 30\nself.screen...
<|body_start_0|> self.batteries = {} for section in cfg.sections(): parts = section.split('.') if parts[0] == 'battery': name = parts[1] empty = cfg.getint(section, 'empty') full = cfg.getint(section, 'full') self.ba...
Contains the important state and functions for this script.
BatteryMonitor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatteryMonitor: """Contains the important state and functions for this script.""" def __init__(self, screen, cfg): """Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configura...
stack_v2_sparse_classes_36k_train_029142
5,209
no_license
[ { "docstring": "Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configuration information.", "name": "__init__", "signature": "def __init__(self, screen, cfg)" }, { "docstring": "A callba...
4
null
Implement the Python class `BatteryMonitor` described below. Class description: Contains the important state and functions for this script. Method signatures and docstrings: - def __init__(self, screen, cfg): Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a R...
Implement the Python class `BatteryMonitor` described below. Class description: Contains the important state and functions for this script. Method signatures and docstrings: - def __init__(self, screen, cfg): Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a R...
52bacd9f58524090e0ab421a47714629249ca273
<|skeleton|> class BatteryMonitor: """Contains the important state and functions for this script.""" def __init__(self, screen, cfg): """Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configura...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatteryMonitor: """Contains the important state and functions for this script.""" def __init__(self, screen, cfg): """Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configuration informat...
the_stack_v2_python_sparse
src/09-10/ubc-tbird-ros-pkg/sb_util/scripts/battery_monitor.py
jpearkes/snowbots
train
0
e998b49a3db66c22905d0c817517699f4fdd9e84
[ "self.anneal = cfg.MODEL.LOSSES.SA.ANNEAL\nself.metric = cfg.MODEL.LOSSES.SA.METRIC\nself.num_id = cfg.SOLVER.IMS_PER_BATCH // cfg.DATALOADER.NUM_INSTANCE", "embedding = F.normalize(embedding, dim=1)\nfeat_dim = embedding.size(1)\nif comm.get_world_size() > 1:\n all_embedding = concat_all_gather(embedding)\n ...
<|body_start_0|> self.anneal = cfg.MODEL.LOSSES.SA.ANNEAL self.metric = cfg.MODEL.LOSSES.SA.METRIC self.num_id = cfg.SOLVER.IMS_PER_BATCH // cfg.DATALOADER.NUM_INSTANCE <|end_body_0|> <|body_start_1|> embedding = F.normalize(embedding, dim=1) feat_dim = embedding.size(1) ...
PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the same number of instances represented in...
SmoothAP
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmoothAP: """PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the sam...
stack_v2_sparse_classes_36k_train_029143
10,777
permissive
[ { "docstring": "Parameters ---------- cfg: (cfgNode) anneal : float the temperature of the sigmoid that is used to smooth the ranking function batch_size : int the batch size being used num_id : int the number of different classes that are represented in the batch feat_dims : int the dimension of the input feat...
2
stack_v2_sparse_classes_30k_train_013498
Implement the Python class `SmoothAP` described below. Class description: PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number o...
Implement the Python class `SmoothAP` described below. Class description: PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number o...
d0eaee768e0be606417a27ce5ea2b3071b5a9bc2
<|skeleton|> class SmoothAP: """PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the sam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmoothAP: """PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the same number of i...
the_stack_v2_python_sparse
fastreid/modeling/losses/smooth_ap.py
SZLSP/reid2020NAIC
train
2
6d3cfb37fc16d04de4b9d20cfe7d7cfc5535aece
[ "clear_test_collections()\nwith patch('database.__set_collection_names', return_value=TEST_DB_NAMES):\n incorrect_names = database.import_data('', 'Products .csv', 'Customers .csv', 'Rentals .csv')\nself.assertEqual([(0, 0, 0), (1, 1, 1)], incorrect_names)\nwith patch('database.__set_collection_names', return_va...
<|body_start_0|> clear_test_collections() with patch('database.__set_collection_names', return_value=TEST_DB_NAMES): incorrect_names = database.import_data('', 'Products .csv', 'Customers .csv', 'Rentals .csv') self.assertEqual([(0, 0, 0), (1, 1, 1)], incorrect_names) with pa...
Class for unit tests for database.py
DatabaseUnitTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseUnitTest: """Class for unit tests for database.py""" def test_import_data(self): """Test that import_data imports csv into database""" <|body_0|> def test_show_available_products(self): """Tests show_available_products""" <|body_1|> def test_...
stack_v2_sparse_classes_36k_train_029144
7,040
no_license
[ { "docstring": "Test that import_data imports csv into database", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Tests show_available_products", "name": "test_show_available_products", "signature": "def test_show_available_products(self)" }, ...
3
null
Implement the Python class `DatabaseUnitTest` described below. Class description: Class for unit tests for database.py Method signatures and docstrings: - def test_import_data(self): Test that import_data imports csv into database - def test_show_available_products(self): Tests show_available_products - def test_show...
Implement the Python class `DatabaseUnitTest` described below. Class description: Class for unit tests for database.py Method signatures and docstrings: - def test_import_data(self): Test that import_data imports csv into database - def test_show_available_products(self): Tests show_available_products - def test_show...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class DatabaseUnitTest: """Class for unit tests for database.py""" def test_import_data(self): """Test that import_data imports csv into database""" <|body_0|> def test_show_available_products(self): """Tests show_available_products""" <|body_1|> def test_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseUnitTest: """Class for unit tests for database.py""" def test_import_data(self): """Test that import_data imports csv into database""" clear_test_collections() with patch('database.__set_collection_names', return_value=TEST_DB_NAMES): incorrect_names = database...
the_stack_v2_python_sparse
students/kyle_lehning/Lesson05/assignment/test_database.py
JavaRod/SP_Python220B_2019
train
1
83f7383fd83041bf61bd3e0006237db867408471
[ "super(TDNN, self).__init__()\nself.context_size = context_size\nself.stride = stride\nself.input_dim = input_dim\nself.output_dim = output_dim\nself.dilation = dilation\nself.dropout_p = dropout_p\nself.batch_norm = batch_norm\nself.kernel = nn.Linear(input_dim * context_size, output_dim)\nself.nonlinearity = nn.R...
<|body_start_0|> super(TDNN, self).__init__() self.context_size = context_size self.stride = stride self.input_dim = input_dim self.output_dim = output_dim self.dilation = dilation self.dropout_p = dropout_p self.batch_norm = batch_norm self.kernel...
TDNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TDNN: def __init__(self, input_dim=3, output_dim=3, context_size=3, dilation=1, stride=1, batch_norm=True, dropout_p=0.0): """TDNN as defined by https://www.danielpovey.com/files/2015_interspeech_multisplice.pdf Affine transformation not applied globally to all frames but smaller windows...
stack_v2_sparse_classes_36k_train_029145
4,369
no_license
[ { "docstring": "TDNN as defined by https://www.danielpovey.com/files/2015_interspeech_multisplice.pdf Affine transformation not applied globally to all frames but smaller windows with local context batch_norm: True to include batch normalisation after the non linearity Context size and dilation determine the fr...
2
stack_v2_sparse_classes_30k_train_011309
Implement the Python class `TDNN` described below. Class description: Implement the TDNN class. Method signatures and docstrings: - def __init__(self, input_dim=3, output_dim=3, context_size=3, dilation=1, stride=1, batch_norm=True, dropout_p=0.0): TDNN as defined by https://www.danielpovey.com/files/2015_interspeech...
Implement the Python class `TDNN` described below. Class description: Implement the TDNN class. Method signatures and docstrings: - def __init__(self, input_dim=3, output_dim=3, context_size=3, dilation=1, stride=1, batch_norm=True, dropout_p=0.0): TDNN as defined by https://www.danielpovey.com/files/2015_interspeech...
d04244ed07401567c493171d3e4b7b37d107a68d
<|skeleton|> class TDNN: def __init__(self, input_dim=3, output_dim=3, context_size=3, dilation=1, stride=1, batch_norm=True, dropout_p=0.0): """TDNN as defined by https://www.danielpovey.com/files/2015_interspeech_multisplice.pdf Affine transformation not applied globally to all frames but smaller windows...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TDNN: def __init__(self, input_dim=3, output_dim=3, context_size=3, dilation=1, stride=1, batch_norm=True, dropout_p=0.0): """TDNN as defined by https://www.danielpovey.com/files/2015_interspeech_multisplice.pdf Affine transformation not applied globally to all frames but smaller windows with local co...
the_stack_v2_python_sparse
2-x-vector/tdnn.py
zcx-1997/My_speaker_recognition
train
1
0a34b4e70ba768e49d9059f8ff38047e599a854f
[ "super().__init__(**kwargs)\nself.min_prefix_len = min_prefix_len\nself.max_prefix_len = max_prefix_len", "value = super()._validate(cfg, value)\ntry:\n net = IPv4Network(value)\nexcept ValueError as err:\n raise ValueError('value is not a valid IPv4 Network (CIDR)') from err\nif self.min_prefix_len and net...
<|body_start_0|> super().__init__(**kwargs) self.min_prefix_len = min_prefix_len self.max_prefix_len = max_prefix_len <|end_body_0|> <|body_start_1|> value = super()._validate(cfg, value) try: net = IPv4Network(value) except ValueError as err: rai...
IPv4 network field. This field accepts CIDR notation networks in the form of ``A.B.C.D/Z``.
IPv4NetworkField
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPv4NetworkField: """IPv4 network field. This field accepts CIDR notation networks in the form of ``A.B.C.D/Z``.""" def __init__(self, min_prefix_len: Optional[int]=None, max_prefix_len: Optional[int]=None, **kwargs): """:param min_prefix_len: minimum subnet prefix length (/X), in bi...
stack_v2_sparse_classes_36k_train_029146
4,387
permissive
[ { "docstring": ":param min_prefix_len: minimum subnet prefix length (/X), in bits :param max_prefix_len: maximum subnet prefix length (/X), in bits", "name": "__init__", "signature": "def __init__(self, min_prefix_len: Optional[int]=None, max_prefix_len: Optional[int]=None, **kwargs)" }, { "docs...
2
stack_v2_sparse_classes_30k_train_014029
Implement the Python class `IPv4NetworkField` described below. Class description: IPv4 network field. This field accepts CIDR notation networks in the form of ``A.B.C.D/Z``. Method signatures and docstrings: - def __init__(self, min_prefix_len: Optional[int]=None, max_prefix_len: Optional[int]=None, **kwargs): :param...
Implement the Python class `IPv4NetworkField` described below. Class description: IPv4 network field. This field accepts CIDR notation networks in the form of ``A.B.C.D/Z``. Method signatures and docstrings: - def __init__(self, min_prefix_len: Optional[int]=None, max_prefix_len: Optional[int]=None, **kwargs): :param...
1499ff8f00a43a592571a10666823e125d5fbc49
<|skeleton|> class IPv4NetworkField: """IPv4 network field. This field accepts CIDR notation networks in the form of ``A.B.C.D/Z``.""" def __init__(self, min_prefix_len: Optional[int]=None, max_prefix_len: Optional[int]=None, **kwargs): """:param min_prefix_len: minimum subnet prefix length (/X), in bi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPv4NetworkField: """IPv4 network field. This field accepts CIDR notation networks in the form of ``A.B.C.D/Z``.""" def __init__(self, min_prefix_len: Optional[int]=None, max_prefix_len: Optional[int]=None, **kwargs): """:param min_prefix_len: minimum subnet prefix length (/X), in bits :param max...
the_stack_v2_python_sparse
cincoconfig/fields/net_field.py
ameily/cincoconfig
train
6
0fdd2d2adc2923914bb1558939979dd0dfab7837
[ "def batch_shaped(t):\n return graph_typecheck.assert_shape(t, [batch_size])\n\ndef batch_win_shaped(t):\n return graph_typecheck.assert_shape(t, [batch_size, window_size])\n\ndef batch_2win_shaped(t):\n return graph_typecheck.assert_shape(t, [batch_size, 2 * window_size])\n\ndef tile_to_2win(t):\n retu...
<|body_start_0|> def batch_shaped(t): return graph_typecheck.assert_shape(t, [batch_size]) def batch_win_shaped(t): return graph_typecheck.assert_shape(t, [batch_size, window_size]) def batch_2win_shaped(t): return graph_typecheck.assert_shape(t, [batch_size...
Helper for dealing with window-like raw features. In particular, this class generates concatenated "dflux_dt" values, and has a masking helper, which will probably be applied after doing some non-linear transformations to dflux_dt (or possibly raw self.dtime, self.dflux) values.
WindowFeatures
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowFeatures: """Helper for dealing with window-like raw features. In particular, this class generates concatenated "dflux_dt" values, and has a masking helper, which will probably be applied after doing some non-linear transformations to dflux_dt (or possibly raw self.dtime, self.dflux) values...
stack_v2_sparse_classes_36k_train_029147
11,936
permissive
[ { "docstring": "Initializes a windowed feature extractor. :param band_features: Band features, generated by raw_value_features. :param batch_size: Outer batch size. :param window_size: Number of points in 'before' and 'after' windows. :param band_time_diff: Maximum difference between requested time and actual t...
3
stack_v2_sparse_classes_30k_train_003189
Implement the Python class `WindowFeatures` described below. Class description: Helper for dealing with window-like raw features. In particular, this class generates concatenated "dflux_dt" values, and has a masking helper, which will probably be applied after doing some non-linear transformations to dflux_dt (or poss...
Implement the Python class `WindowFeatures` described below. Class description: Helper for dealing with window-like raw features. In particular, this class generates concatenated "dflux_dt" values, and has a masking helper, which will probably be applied after doing some non-linear transformations to dflux_dt (or poss...
2edcb471cd01d6659a498bcd0209cb5dae83375a
<|skeleton|> class WindowFeatures: """Helper for dealing with window-like raw features. In particular, this class generates concatenated "dflux_dt" values, and has a masking helper, which will probably be applied after doing some non-linear transformations to dflux_dt (or possibly raw self.dtime, self.dflux) values...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowFeatures: """Helper for dealing with window-like raw features. In particular, this class generates concatenated "dflux_dt" values, and has a masking helper, which will probably be applied after doing some non-linear transformations to dflux_dt (or possibly raw self.dtime, self.dflux) values.""" def...
the_stack_v2_python_sparse
justice/features/dense_extracted_features.py
aimalz/justice
train
1
631a1a02fbacdba3a7b45af19d3ce49c86d035b6
[ "if not head or not head.next:\n return head\ndummy = ListNode(None)\nd = dummy\nh = head\nd.next = head\nwhile h and h.next:\n n1 = h.next\n n2 = h.next.next\n d.next = n1\n n1.next = h\n h.next = n2\n d = h\n h = n2\nreturn dummy.next", "if not head or not head.next:\n return head\nne...
<|body_start_0|> if not head or not head.next: return head dummy = ListNode(None) d = dummy h = head d.next = head while h and h.next: n1 = h.next n2 = h.next.next d.next = n1 n1.next = h h.next = n2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseInPairs1(self, head): """input: ListNode head return: ListNode""" <|body_0|> def reverseInPairs2(self, head): """input: ListNode head return: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head or not head.next:...
stack_v2_sparse_classes_36k_train_029148
1,535
no_license
[ { "docstring": "input: ListNode head return: ListNode", "name": "reverseInPairs1", "signature": "def reverseInPairs1(self, head)" }, { "docstring": "input: ListNode head return: ListNode", "name": "reverseInPairs2", "signature": "def reverseInPairs2(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_012470
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseInPairs1(self, head): input: ListNode head return: ListNode - def reverseInPairs2(self, head): input: ListNode head return: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseInPairs1(self, head): input: ListNode head return: ListNode - def reverseInPairs2(self, head): input: ListNode head return: ListNode <|skeleton|> class Solution: ...
c34b55bb42dc44a9026a902f6afcc018b4154662
<|skeleton|> class Solution: def reverseInPairs1(self, head): """input: ListNode head return: ListNode""" <|body_0|> def reverseInPairs2(self, head): """input: ListNode head return: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseInPairs1(self, head): """input: ListNode head return: ListNode""" if not head or not head.next: return head dummy = ListNode(None) d = dummy h = head d.next = head while h and h.next: n1 = h.next n...
the_stack_v2_python_sparse
Algorithm/Reverse Linked List In Pairs - Lai.py
superpigBB/Happy-Coding
train
0
5cf53a8bdb3640698c1f305be5e6512b420fe8dd
[ "wx.Panel.__init__(self, parent, *args, **kwargs)\nself.layouts = {}\nself.bind_objects = {}\nself.setting = setting\nself.SetSizerAndFit(self.do_layout())", "vsizer = wx.BoxSizer(wx.VERTICAL)\nlayout = LayoutDimensions(top=2, bottom=2, left=4, right=4, interior=2, widths=(100, 200), stretch_factor=(0, 1), height...
<|body_start_0|> wx.Panel.__init__(self, parent, *args, **kwargs) self.layouts = {} self.bind_objects = {} self.setting = setting self.SetSizerAndFit(self.do_layout()) <|end_body_0|> <|body_start_1|> vsizer = wx.BoxSizer(wx.VERTICAL) layout = LayoutDimensions(top...
Particular Figure Setting
FigureSettingPanel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FigureSettingPanel: """Particular Figure Setting""" def __init__(self, parent, setting, *args, **kwargs): """:param setting: :param args: :param kwargs: :return:""" <|body_0|> def do_layout(self): """Layout form :return:""" <|body_1|> def sync_data(s...
stack_v2_sparse_classes_36k_train_029149
8,601
no_license
[ { "docstring": ":param setting: :param args: :param kwargs: :return:", "name": "__init__", "signature": "def __init__(self, parent, setting, *args, **kwargs)" }, { "docstring": "Layout form :return:", "name": "do_layout", "signature": "def do_layout(self)" }, { "docstring": "Sync...
3
stack_v2_sparse_classes_30k_train_011182
Implement the Python class `FigureSettingPanel` described below. Class description: Particular Figure Setting Method signatures and docstrings: - def __init__(self, parent, setting, *args, **kwargs): :param setting: :param args: :param kwargs: :return: - def do_layout(self): Layout form :return: - def sync_data(self)...
Implement the Python class `FigureSettingPanel` described below. Class description: Particular Figure Setting Method signatures and docstrings: - def __init__(self, parent, setting, *args, **kwargs): :param setting: :param args: :param kwargs: :return: - def do_layout(self): Layout form :return: - def sync_data(self)...
e78511f30935b006385b571472487bb081aa36d8
<|skeleton|> class FigureSettingPanel: """Particular Figure Setting""" def __init__(self, parent, setting, *args, **kwargs): """:param setting: :param args: :param kwargs: :return:""" <|body_0|> def do_layout(self): """Layout form :return:""" <|body_1|> def sync_data(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FigureSettingPanel: """Particular Figure Setting""" def __init__(self, parent, setting, *args, **kwargs): """:param setting: :param args: :param kwargs: :return:""" wx.Panel.__init__(self, parent, *args, **kwargs) self.layouts = {} self.bind_objects = {} self.setti...
the_stack_v2_python_sparse
boaui/chart/dlg.py
JoenyBui/boa-gui
train
0
d3f0a3110e1363fcfe79a8d0d1312d4914e55cff
[ "if not name:\n name = model_load_name\nsuper().__init__(name=name, type='keras')\nself.model_load_name = model_load_name\nself.pop_last = pop_last", "model = saveload.load_tf_model(self.model_load_name)\nif self.pop_last:\n model.pop()\nreturn model", "try:\n model = self.get_model()\n y = model.pr...
<|body_start_0|> if not name: name = model_load_name super().__init__(name=name, type='keras') self.model_load_name = model_load_name self.pop_last = pop_last <|end_body_0|> <|body_start_1|> model = saveload.load_tf_model(self.model_load_name) if self.pop_las...
KerasLoadsWhole
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KerasLoadsWhole: def __init__(self, model_load_name, name=None, pop_last=False): """Wrap a saved Keras model. This subclass of ModelWrapper should be used with Keras models that have been saved using utils.saveload.save_tf_model. If only weights have been saved, KerasLoadsWeights (not im...
stack_v2_sparse_classes_36k_train_029150
5,167
no_license
[ { "docstring": "Wrap a saved Keras model. This subclass of ModelWrapper should be used with Keras models that have been saved using utils.saveload.save_tf_model. If only weights have been saved, KerasLoadsWeights (not implemented) should be used instead. Args: model_load_name (str): The name used when saving th...
3
null
Implement the Python class `KerasLoadsWhole` described below. Class description: Implement the KerasLoadsWhole class. Method signatures and docstrings: - def __init__(self, model_load_name, name=None, pop_last=False): Wrap a saved Keras model. This subclass of ModelWrapper should be used with Keras models that have b...
Implement the Python class `KerasLoadsWhole` described below. Class description: Implement the KerasLoadsWhole class. Method signatures and docstrings: - def __init__(self, model_load_name, name=None, pop_last=False): Wrap a saved Keras model. This subclass of ModelWrapper should be used with Keras models that have b...
d61d298b52c4338e07d7cd4a3fdc65f1de1bcbf1
<|skeleton|> class KerasLoadsWhole: def __init__(self, model_load_name, name=None, pop_last=False): """Wrap a saved Keras model. This subclass of ModelWrapper should be used with Keras models that have been saved using utils.saveload.save_tf_model. If only weights have been saved, KerasLoadsWeights (not im...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KerasLoadsWhole: def __init__(self, model_load_name, name=None, pop_last=False): """Wrap a saved Keras model. This subclass of ModelWrapper should be used with Keras models that have been saved using utils.saveload.save_tf_model. If only weights have been saved, KerasLoadsWeights (not implemented) sho...
the_stack_v2_python_sparse
code/models/ensemble.py
lennelov/endd-reproduce
train
3
9d1f5c96335c114405f718f133b7bb1bce7198d5
[ "def bisearch(s, e):\n while s <= e:\n m = s + (e - s) // 2\n if nums[m] < target:\n s = m + 1\n elif nums[m] > target:\n e = m - 1\n else:\n return m\n return s\nreturn bisearch(0, len(nums) - 1)", "l, r = (0, len(nums) - 1)\nwhile l <= r:\n m...
<|body_start_0|> def bisearch(s, e): while s <= e: m = s + (e - s) // 2 if nums[m] < target: s = m + 1 elif nums[m] > target: e = m - 1 else: return m return s ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert(self, nums: List[int], target: int) -> int: """Dec 03, 2021 13:53""" <|body_0|> def searchInsert(self, nums: List[int], target: int) -> int: """Mar 22, 2023 00:17""" <|body_1|> <|end_skeleton|> <|body_start_0|> def bisearc...
stack_v2_sparse_classes_36k_train_029151
1,819
no_license
[ { "docstring": "Dec 03, 2021 13:53", "name": "searchInsert", "signature": "def searchInsert(self, nums: List[int], target: int) -> int" }, { "docstring": "Mar 22, 2023 00:17", "name": "searchInsert", "signature": "def searchInsert(self, nums: List[int], target: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums: List[int], target: int) -> int: Dec 03, 2021 13:53 - def searchInsert(self, nums: List[int], target: int) -> int: Mar 22, 2023 00:17
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums: List[int], target: int) -> int: Dec 03, 2021 13:53 - def searchInsert(self, nums: List[int], target: int) -> int: Mar 22, 2023 00:17 <|skeleton|> cl...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def searchInsert(self, nums: List[int], target: int) -> int: """Dec 03, 2021 13:53""" <|body_0|> def searchInsert(self, nums: List[int], target: int) -> int: """Mar 22, 2023 00:17""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsert(self, nums: List[int], target: int) -> int: """Dec 03, 2021 13:53""" def bisearch(s, e): while s <= e: m = s + (e - s) // 2 if nums[m] < target: s = m + 1 elif nums[m] > target: ...
the_stack_v2_python_sparse
leetcode/solved/35_Search_Insert_Position/solution.py
sungminoh/algorithms
train
0
2e115ed0c4c9b5e70866402d3dc3fb0e54610ea6
[ "DirectFrame.__init__(self, parent=parent, pos=pos)\nself.createGuiObjects()\nself.hourCallback = hourCallback\nself.lastHour = -1\nself.lastMinute = -1", "textScale = 0.075\ntimeFont = ToontownGlobals.getMinnieFont()\nself.hourLabel = DirectLabel(parent=self, pos=(-0.015, 0, 0), relief=None, text='', text_scale=...
<|body_start_0|> DirectFrame.__init__(self, parent=parent, pos=pos) self.createGuiObjects() self.hourCallback = hourCallback self.lastHour = -1 self.lastMinute = -1 <|end_body_0|> <|body_start_1|> textScale = 0.075 timeFont = ToontownGlobals.getMinnieFont() ...
A class to dislay the server time nicely. Do not put references to the shtiker page or book, so this class can be placed anywhere.
ServerTimeGui
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerTimeGui: """A class to dislay the server time nicely. Do not put references to the shtiker page or book, so this class can be placed anywhere.""" def __init__(self, parent, pos=(0, 0, 0), hourCallback=None): """Construct ourself.""" <|body_0|> def createGuiObjects(...
stack_v2_sparse_classes_36k_train_029152
3,512
no_license
[ { "docstring": "Construct ourself.", "name": "__init__", "signature": "def __init__(self, parent, pos=(0, 0, 0), hourCallback=None)" }, { "docstring": "Create all gui elements and tasks.", "name": "createGuiObjects", "signature": "def createGuiObjects(self)" }, { "docstring": "Do...
4
stack_v2_sparse_classes_30k_train_000881
Implement the Python class `ServerTimeGui` described below. Class description: A class to dislay the server time nicely. Do not put references to the shtiker page or book, so this class can be placed anywhere. Method signatures and docstrings: - def __init__(self, parent, pos=(0, 0, 0), hourCallback=None): Construct ...
Implement the Python class `ServerTimeGui` described below. Class description: A class to dislay the server time nicely. Do not put references to the shtiker page or book, so this class can be placed anywhere. Method signatures and docstrings: - def __init__(self, parent, pos=(0, 0, 0), hourCallback=None): Construct ...
0e7bfc1fe29fd595df0b982e40f94c30befb1ec7
<|skeleton|> class ServerTimeGui: """A class to dislay the server time nicely. Do not put references to the shtiker page or book, so this class can be placed anywhere.""" def __init__(self, parent, pos=(0, 0, 0), hourCallback=None): """Construct ourself.""" <|body_0|> def createGuiObjects(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerTimeGui: """A class to dislay the server time nicely. Do not put references to the shtiker page or book, so this class can be placed anywhere.""" def __init__(self, parent, pos=(0, 0, 0), hourCallback=None): """Construct ourself.""" DirectFrame.__init__(self, parent=parent, pos=pos)...
the_stack_v2_python_sparse
toontown/src/parties/ServerTimeGui.py
satire6/Anesidora
train
89
893994880d83d79a34b358adfd017158a8e32282
[ "self.id = id\nself.name = name\nself.number = number\nself.mtype = mtype\nself.aggregation_status_code = aggregation_status_code\nself.balance = balance\nself.balance_date = balance_date\nself.transactions = transactions\nself.additional_properties = additional_properties", "if dictionary is None:\n return No...
<|body_start_0|> self.id = id self.name = name self.number = number self.mtype = mtype self.aggregation_status_code = aggregation_status_code self.balance = balance self.balance_date = balance_date self.transactions = transactions self.additional_p...
Implementation of the 'Transactions Report Account' model. The fields used for the Transaction History Report (CRA products). Attributes: id (long|int): The Finicity account ID. name (string): The account name from the financial institution. number (string): The account number from the financial institution (obfuscated...
TransactionsReportAccount
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransactionsReportAccount: """Implementation of the 'Transactions Report Account' model. The fields used for the Transaction History Report (CRA products). Attributes: id (long|int): The Finicity account ID. name (string): The account name from the financial institution. number (string): The acco...
stack_v2_sparse_classes_36k_train_029153
4,249
permissive
[ { "docstring": "Constructor for the TransactionsReportAccount class", "name": "__init__", "signature": "def __init__(self, id=None, name=None, number=None, mtype=None, aggregation_status_code=None, balance=None, balance_date=None, transactions=None, additional_properties={})" }, { "docstring": "...
2
null
Implement the Python class `TransactionsReportAccount` described below. Class description: Implementation of the 'Transactions Report Account' model. The fields used for the Transaction History Report (CRA products). Attributes: id (long|int): The Finicity account ID. name (string): The account name from the financial...
Implement the Python class `TransactionsReportAccount` described below. Class description: Implementation of the 'Transactions Report Account' model. The fields used for the Transaction History Report (CRA products). Attributes: id (long|int): The Finicity account ID. name (string): The account name from the financial...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class TransactionsReportAccount: """Implementation of the 'Transactions Report Account' model. The fields used for the Transaction History Report (CRA products). Attributes: id (long|int): The Finicity account ID. name (string): The account name from the financial institution. number (string): The acco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransactionsReportAccount: """Implementation of the 'Transactions Report Account' model. The fields used for the Transaction History Report (CRA products). Attributes: id (long|int): The Finicity account ID. name (string): The account name from the financial institution. number (string): The account number fr...
the_stack_v2_python_sparse
finicityapi/models/transactions_report_account.py
monarchmoney/finicity-python
train
0
51423a8e76303794466b956e97c993d0f9003d90
[ "batch_brw = self.env['batch'].browse(vals['batch_id'])\nbatch_start_date = batch_brw.start_date\nbatch_stop_date = batch_brw.end_date\nstart_date = vals['start_date']\nstop_date = vals['end_date']\nif start_date >= batch_start_date and start_date <= batch_stop_date and (stop_date >= batch_start_date) and (stop_dat...
<|body_start_0|> batch_brw = self.env['batch'].browse(vals['batch_id']) batch_start_date = batch_brw.start_date batch_stop_date = batch_brw.end_date start_date = vals['start_date'] stop_date = vals['end_date'] if start_date >= batch_start_date and start_date <= batch_stop...
acd_term
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class acd_term: def create(self, vals): """------------------ :param vals: :return:""" <|body_0|> def write(self, vals): """----------------- :param vals: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> batch_brw = self.env['batch'].browse(vals['...
stack_v2_sparse_classes_36k_train_029154
3,521
no_license
[ { "docstring": "------------------ :param vals: :return:", "name": "create", "signature": "def create(self, vals)" }, { "docstring": "----------------- :param vals: :return:", "name": "write", "signature": "def write(self, vals)" } ]
2
null
Implement the Python class `acd_term` described below. Class description: Implement the acd_term class. Method signatures and docstrings: - def create(self, vals): ------------------ :param vals: :return: - def write(self, vals): ----------------- :param vals: :return:
Implement the Python class `acd_term` described below. Class description: Implement the acd_term class. Method signatures and docstrings: - def create(self, vals): ------------------ :param vals: :return: - def write(self, vals): ----------------- :param vals: :return: <|skeleton|> class acd_term: def create(se...
0e65e5d937b029beb69563772197b9b050748407
<|skeleton|> class acd_term: def create(self, vals): """------------------ :param vals: :return:""" <|body_0|> def write(self, vals): """----------------- :param vals: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class acd_term: def create(self, vals): """------------------ :param vals: :return:""" batch_brw = self.env['batch'].browse(vals['batch_id']) batch_start_date = batch_brw.start_date batch_stop_date = batch_brw.end_date start_date = vals['start_date'] stop_date = vals[...
the_stack_v2_python_sparse
edsys_edu_masters/models/acd_term.py
probytesodoo/edsys_school_erp
train
1
7aeb04ca35c8e1b5c183596eca353461970a2dc0
[ "queue = deque([root])\ns = ''\nwhile queue:\n node = queue.popleft()\n if node:\n s += str(node.val) + ','\n queue.append(node.left)\n queue.append(node.right)\n else:\n s += 'None' + ','\nreturn '[' + s[:-1] + ']'", "data_split = data[1:-1].split(',')\nr = data_split[0]\nif ...
<|body_start_0|> queue = deque([root]) s = '' while queue: node = queue.popleft() if node: s += str(node.val) + ',' queue.append(node.left) queue.append(node.right) else: s += 'None' + ',' ...
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_029155
1,696
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
9aed6e84fbe48090382744dd103843fec43ccce9
<|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""" queue = deque([root]) s = '' while queue: node = queue.popleft() if node: s += str(node.val) + ',' queue.append(no...
the_stack_v2_python_sparse
python/297_codeC.py
LeonhardtWang/leetcode-train
train
1
df1d3f4f4ff2800213a045e5c8f45224dfbb726f
[ "key = cls.des_key\nlength = len(reqdata)\nif length < cls.block_size:\n add = cls.block_size - length\nelif length > cls.block_size:\n add = cls.block_size - length % cls.block_size\nelse:\n add = 8\nreqdata = reqdata + cls.pad_str[add - 1] * add\ndes = DES.new(key, DES.MODE_ECB)\nencrypt_data = des.encry...
<|body_start_0|> key = cls.des_key length = len(reqdata) if length < cls.block_size: add = cls.block_size - length elif length > cls.block_size: add = cls.block_size - length % cls.block_size else: add = 8 reqdata = reqdata + cls.pad_st...
加密和解密工具类
Crypt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crypt: """加密和解密工具类""" def des_base64_encrypt(cls, reqdata): """基于DES和base64的加密算法 @:param reqdata 需要加密的请求数据""" <|body_0|> def des_base64_decrypt(cls, retdata): """DES解密 @:param retdata: lakala reponse retData""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_029156
1,265
no_license
[ { "docstring": "基于DES和base64的加密算法 @:param reqdata 需要加密的请求数据", "name": "des_base64_encrypt", "signature": "def des_base64_encrypt(cls, reqdata)" }, { "docstring": "DES解密 @:param retdata: lakala reponse retData", "name": "des_base64_decrypt", "signature": "def des_base64_decrypt(cls, retda...
2
stack_v2_sparse_classes_30k_train_011431
Implement the Python class `Crypt` described below. Class description: 加密和解密工具类 Method signatures and docstrings: - def des_base64_encrypt(cls, reqdata): 基于DES和base64的加密算法 @:param reqdata 需要加密的请求数据 - def des_base64_decrypt(cls, retdata): DES解密 @:param retdata: lakala reponse retData
Implement the Python class `Crypt` described below. Class description: 加密和解密工具类 Method signatures and docstrings: - def des_base64_encrypt(cls, reqdata): 基于DES和base64的加密算法 @:param reqdata 需要加密的请求数据 - def des_base64_decrypt(cls, retdata): DES解密 @:param retdata: lakala reponse retData <|skeleton|> class Crypt: """...
92358511e1de06d8bf93888128576c32f226a26b
<|skeleton|> class Crypt: """加密和解密工具类""" def des_base64_encrypt(cls, reqdata): """基于DES和base64的加密算法 @:param reqdata 需要加密的请求数据""" <|body_0|> def des_base64_decrypt(cls, retdata): """DES解密 @:param retdata: lakala reponse retData""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Crypt: """加密和解密工具类""" def des_base64_encrypt(cls, reqdata): """基于DES和base64的加密算法 @:param reqdata 需要加密的请求数据""" key = cls.des_key length = len(reqdata) if length < cls.block_size: add = cls.block_size - length elif length > cls.block_size: add...
the_stack_v2_python_sparse
加密隐藏/DES/des_ecb.py
KnowNo/CTF-LEARN
train
0
934cc4adf4784cdbedeaa5bc022b4ec99423d927
[ "if project == 'CMIP6':\n required = [{'short_name': 'o3'}, {'short_name': 'ps'}]\nelse:\n required = [{'short_name': 'tro3'}, {'short_name': 'ps'}]\nreturn required", "tro3_cube = cubes.extract_cube(iris.Constraint(name='mole_fraction_of_ozone_in_air'))\nps_cube = cubes.extract_cube(iris.Constraint(name='s...
<|body_start_0|> if project == 'CMIP6': required = [{'short_name': 'o3'}, {'short_name': 'ps'}] else: required = [{'short_name': 'tro3'}, {'short_name': 'ps'}] return required <|end_body_0|> <|body_start_1|> tro3_cube = cubes.extract_cube(iris.Constraint(name='mo...
Derivation of variable `toz`.
DerivedVariable
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DerivedVariable: """Derivation of variable `toz`.""" def required(project): """Declare the variables needed for derivation.""" <|body_0|> def calculate(cubes): """Compute total column ozone. Note ---- The surface pressure is used as a lower integration bound. A f...
stack_v2_sparse_classes_36k_train_029157
2,234
permissive
[ { "docstring": "Declare the variables needed for derivation.", "name": "required", "signature": "def required(project)" }, { "docstring": "Compute total column ozone. Note ---- The surface pressure is used as a lower integration bound. A fixed upper integration bound of 0 Pa is used.", "name...
2
stack_v2_sparse_classes_30k_train_012006
Implement the Python class `DerivedVariable` described below. Class description: Derivation of variable `toz`. Method signatures and docstrings: - def required(project): Declare the variables needed for derivation. - def calculate(cubes): Compute total column ozone. Note ---- The surface pressure is used as a lower i...
Implement the Python class `DerivedVariable` described below. Class description: Derivation of variable `toz`. Method signatures and docstrings: - def required(project): Declare the variables needed for derivation. - def calculate(cubes): Compute total column ozone. Note ---- The surface pressure is used as a lower i...
d5187438fea2928644cb53ecb26c6adb1e4cc947
<|skeleton|> class DerivedVariable: """Derivation of variable `toz`.""" def required(project): """Declare the variables needed for derivation.""" <|body_0|> def calculate(cubes): """Compute total column ozone. Note ---- The surface pressure is used as a lower integration bound. A f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DerivedVariable: """Derivation of variable `toz`.""" def required(project): """Declare the variables needed for derivation.""" if project == 'CMIP6': required = [{'short_name': 'o3'}, {'short_name': 'ps'}] else: required = [{'short_name': 'tro3'}, {'short_n...
the_stack_v2_python_sparse
esmvalcore/preprocessor/_derive/toz.py
ESMValGroup/ESMValCore
train
41
379422795761c17158b780897250910eeb06333e
[ "self.pop_server = pop_server\nself.user = user\nself.password = passwd", "try:\n self.reademail = poplib.POP3_SSL(self.pop_server)\n self.reademail.user(self.user)\n self.reademail.pass_(self.password)\n self.allemail = self.reademail.stat()\nexcept Exception as e:\n exit('读取邮件登录失败::%s' % str(e))"...
<|body_start_0|> self.pop_server = pop_server self.user = user self.password = passwd <|end_body_0|> <|body_start_1|> try: self.reademail = poplib.POP3_SSL(self.pop_server) self.reademail.user(self.user) self.reademail.pass_(self.password) ...
My_Email_Rec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class My_Email_Rec: def __init__(self, pop_server='pop.qq.com', user='964725349@qq.com', passwd='kxsxacdjdelsbejc', *args, **kwargs): """初始化接收邮件,获取第一封邮件标题字符的对象""" <|body_0|> def pop_connect(self): """连接pop服务器,收取邮件 :param self: :return:""" <|body_1|> def receiv...
stack_v2_sparse_classes_36k_train_029158
8,396
no_license
[ { "docstring": "初始化接收邮件,获取第一封邮件标题字符的对象", "name": "__init__", "signature": "def __init__(self, pop_server='pop.qq.com', user='964725349@qq.com', passwd='kxsxacdjdelsbejc', *args, **kwargs)" }, { "docstring": "连接pop服务器,收取邮件 :param self: :return:", "name": "pop_connect", "signature": "def p...
3
null
Implement the Python class `My_Email_Rec` described below. Class description: Implement the My_Email_Rec class. Method signatures and docstrings: - def __init__(self, pop_server='pop.qq.com', user='964725349@qq.com', passwd='kxsxacdjdelsbejc', *args, **kwargs): 初始化接收邮件,获取第一封邮件标题字符的对象 - def pop_connect(self): 连接pop服务器...
Implement the Python class `My_Email_Rec` described below. Class description: Implement the My_Email_Rec class. Method signatures and docstrings: - def __init__(self, pop_server='pop.qq.com', user='964725349@qq.com', passwd='kxsxacdjdelsbejc', *args, **kwargs): 初始化接收邮件,获取第一封邮件标题字符的对象 - def pop_connect(self): 连接pop服务器...
8e4dfaaeae782a37f6baca4c024b1c2a1dc83cba
<|skeleton|> class My_Email_Rec: def __init__(self, pop_server='pop.qq.com', user='964725349@qq.com', passwd='kxsxacdjdelsbejc', *args, **kwargs): """初始化接收邮件,获取第一封邮件标题字符的对象""" <|body_0|> def pop_connect(self): """连接pop服务器,收取邮件 :param self: :return:""" <|body_1|> def receiv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class My_Email_Rec: def __init__(self, pop_server='pop.qq.com', user='964725349@qq.com', passwd='kxsxacdjdelsbejc', *args, **kwargs): """初始化接收邮件,获取第一封邮件标题字符的对象""" self.pop_server = pop_server self.user = user self.password = passwd def pop_connect(self): """连接pop服务器,收取邮件...
the_stack_v2_python_sparse
poweroff_by_email.py
PeterZhangxing/codewars
train
0
6cc07005984263fa6614700037e32de71fe39bb5
[ "wait_for_nodes_1 = WaitForNodes(node_list, timeout=10.0)\nassert wait_for_nodes_1.wait()\nassert wait_for_nodes_1.get_nodes_not_found() == set()\nwait_for_nodes_1.shutdown()\nwith WaitForNodes(node_list, timeout=10.0) as wait_for_nodes_2:\n print('All nodes were found !')\n assert wait_for_nodes_2.get_nodes_...
<|body_start_0|> wait_for_nodes_1 = WaitForNodes(node_list, timeout=10.0) assert wait_for_nodes_1.wait() assert wait_for_nodes_1.get_nodes_not_found() == set() wait_for_nodes_1.shutdown() with WaitForNodes(node_list, timeout=10.0) as wait_for_nodes_2: print('All nodes...
CheckMultipleNodesLaunched
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckMultipleNodesLaunched: def test_nodes_successful(self, node_list): """Check if all the nodes were launched correctly.""" <|body_0|> def test_node_does_not_exist(self, node_list): """Insert a invalid node name that should not exist.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_029159
4,984
permissive
[ { "docstring": "Check if all the nodes were launched correctly.", "name": "test_nodes_successful", "signature": "def test_nodes_successful(self, node_list)" }, { "docstring": "Insert a invalid node name that should not exist.", "name": "test_node_does_not_exist", "signature": "def test_n...
2
stack_v2_sparse_classes_30k_train_004200
Implement the Python class `CheckMultipleNodesLaunched` described below. Class description: Implement the CheckMultipleNodesLaunched class. Method signatures and docstrings: - def test_nodes_successful(self, node_list): Check if all the nodes were launched correctly. - def test_node_does_not_exist(self, node_list): I...
Implement the Python class `CheckMultipleNodesLaunched` described below. Class description: Implement the CheckMultipleNodesLaunched class. Method signatures and docstrings: - def test_nodes_successful(self, node_list): Check if all the nodes were launched correctly. - def test_node_does_not_exist(self, node_list): I...
1d97c4fc7445554f6f85f63305d424fc017212a0
<|skeleton|> class CheckMultipleNodesLaunched: def test_nodes_successful(self, node_list): """Check if all the nodes were launched correctly.""" <|body_0|> def test_node_does_not_exist(self, node_list): """Insert a invalid node name that should not exist.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckMultipleNodesLaunched: def test_nodes_successful(self, node_list): """Check if all the nodes were launched correctly.""" wait_for_nodes_1 = WaitForNodes(node_list, timeout=10.0) assert wait_for_nodes_1.wait() assert wait_for_nodes_1.get_nodes_not_found() == set() w...
the_stack_v2_python_sparse
launch_testing/launch_testing_examples/launch_testing_examples/check_multiple_nodes_launch_test.py
ros2/examples
train
560
d01e533c15be3ffa5d7717e6909ec649a258309c
[ "self.__ops = ops\nself.__nops = len(ops)\nfor iop in range(self.__nops):\n if not isinstance(self.__ops[iop], operator):\n raise Exception('Elements of ops list must be of type operator')\nif self.__nops != len(dims):\n raise Exception('Number of dimensions (%d) must equal number of operators (%d)' % ...
<|body_start_0|> self.__ops = ops self.__nops = len(ops) for iop in range(self.__nops): if not isinstance(self.__ops[iop], operator): raise Exception('Elements of ops list must be of type operator') if self.__nops != len(dims): raise Exception('Num...
Row operator
rowop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class rowop: """Row operator""" def __init__(self, ops, dims): """rowop constructor Parameters: ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, 'ncols...
stack_v2_sparse_classes_36k_train_029160
13,837
no_license
[ { "docstring": "rowop constructor Parameters: ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, 'ncols': 10},...] Note that the row operator will be formed in the order in wh...
4
stack_v2_sparse_classes_30k_train_001478
Implement the Python class `rowop` described below. Class description: Row operator Method signatures and docstrings: - def __init__(self, ops, dims): rowop constructor Parameters: ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outpu...
Implement the Python class `rowop` described below. Class description: Row operator Method signatures and docstrings: - def __init__(self, ops, dims): rowop constructor Parameters: ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outpu...
32a303eddd13385d8778b8bb3b4fbbfbe78bea51
<|skeleton|> class rowop: """Row operator""" def __init__(self, ops, dims): """rowop constructor Parameters: ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, 'ncols...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class rowop: """Row operator""" def __init__(self, ops, dims): """rowop constructor Parameters: ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, 'ncols': 10},...] N...
the_stack_v2_python_sparse
opt/linopt/combops.py
ke0m/scaas
train
2
26f2162ea2709a5275a8780d7415161efc420589
[ "super(GRRHuntFileCollector, self).__init__(state, name=name, critical=critical)\nself.file_path_list = []\nself.max_file_size = 5 * 1024 * 1024 * 1024", "self.GrrSetUp(reason, grr_server_url, grr_username, grr_password, approvers=approvers, verify=verify, message_callback=self.PublishMessage)\nself.file_path_lis...
<|body_start_0|> super(GRRHuntFileCollector, self).__init__(state, name=name, critical=critical) self.file_path_list = [] self.max_file_size = 5 * 1024 * 1024 * 1024 <|end_body_0|> <|body_start_1|> self.GrrSetUp(reason, grr_server_url, grr_username, grr_password, approvers=approvers, ve...
File collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. file_path_list: comma-separated list of file paths.
GRRHuntFileCollector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRRHuntFileCollector: """File collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. file_path_list: comma-separated list of file paths.""" def __init__(self, state: DFTimewolfState, name: Optional[str]=None,...
stack_v2_sparse_classes_36k_train_029161
27,645
permissive
[ { "docstring": "Initializes a GRR file collector hunt. Args: state (DFTimewolfState): recipe state. name (Optional[str]): The module's runtime name. critical (bool): True if the module is critical, which causes the entire recipe to fail if the module encounters an error.", "name": "__init__", "signature...
4
null
Implement the Python class `GRRHuntFileCollector` described below. Class description: File collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. file_path_list: comma-separated list of file paths. Method signatures and docstrings: - ...
Implement the Python class `GRRHuntFileCollector` described below. Class description: File collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. file_path_list: comma-separated list of file paths. Method signatures and docstrings: - ...
bcea85b1ce7a0feb2aa28b5be4fc6ae124e8ca3c
<|skeleton|> class GRRHuntFileCollector: """File collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. file_path_list: comma-separated list of file paths.""" def __init__(self, state: DFTimewolfState, name: Optional[str]=None,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GRRHuntFileCollector: """File collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. file_path_list: comma-separated list of file paths.""" def __init__(self, state: DFTimewolfState, name: Optional[str]=None, critical: bo...
the_stack_v2_python_sparse
dftimewolf/lib/collectors/grr_hunt.py
log2timeline/dftimewolf
train
248
11261b3cb6bbd2d41a11cdc6010d8c29c9d5e562
[ "self._parent = parent\nself.scale = 0.01\nself.origin = self.scale * np.array([0, 0, 0])\nself.x_axis = self.scale * np.array([1, 0, 0])\nself.y_axis = self.scale * np.array([0, 1, 0])\nself.z_axis = self.scale * np.array([0, 0, 1])\nself.x_color = np.array([[1, 0, 0]])\nself.y_color = np.array([[0, 1, 0]])\nself....
<|body_start_0|> self._parent = parent self.scale = 0.01 self.origin = self.scale * np.array([0, 0, 0]) self.x_axis = self.scale * np.array([1, 0, 0]) self.y_axis = self.scale * np.array([0, 1, 0]) self.z_axis = self.scale * np.array([0, 0, 1]) self.x_color = np.a...
classdocs
CoordinateSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoordinateSystem: """classdocs""" def __init__(self, parent=None): """Class constructor of VBO""" <|body_0|> def _create_VBO(self): """Function creates VBO of coordinate system""" <|body_1|> def _paintGL_VBO_CS(self): """Paint local coordinat...
stack_v2_sparse_classes_36k_train_029162
3,309
no_license
[ { "docstring": "Class constructor of VBO", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Function creates VBO of coordinate system", "name": "_create_VBO", "signature": "def _create_VBO(self)" }, { "docstring": "Paint local coordinate syste...
3
null
Implement the Python class `CoordinateSystem` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, parent=None): Class constructor of VBO - def _create_VBO(self): Function creates VBO of coordinate system - def _paintGL_VBO_CS(self): Paint local coordinate system VBO
Implement the Python class `CoordinateSystem` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, parent=None): Class constructor of VBO - def _create_VBO(self): Function creates VBO of coordinate system - def _paintGL_VBO_CS(self): Paint local coordinate system VBO <...
5e6a54dee662206664dde022ccca372f966b1789
<|skeleton|> class CoordinateSystem: """classdocs""" def __init__(self, parent=None): """Class constructor of VBO""" <|body_0|> def _create_VBO(self): """Function creates VBO of coordinate system""" <|body_1|> def _paintGL_VBO_CS(self): """Paint local coordinat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoordinateSystem: """classdocs""" def __init__(self, parent=None): """Class constructor of VBO""" self._parent = parent self.scale = 0.01 self.origin = self.scale * np.array([0, 0, 0]) self.x_axis = self.scale * np.array([1, 0, 0]) self.y_axis = self.scale ...
the_stack_v2_python_sparse
MBD_system/body/coordinate_system/coordinate_system.py
xupeiwust/DyS
train
0
30e3ca8b72cc31243d061348299db2db33ef26de
[ "self._baseline_action_fn = baseline_action_fn\nself._comparator_fn = comparator_fn\nself._error_loss_fn = error_loss_fn\nself._margin = margin\nsuper(RelativeConstraint, self).__init__(time_step_spec, action_spec, constraint_network, error_loss_fn=self._error_loss_fn, name=name)", "predicted_values, _ = self._co...
<|body_start_0|> self._baseline_action_fn = baseline_action_fn self._comparator_fn = comparator_fn self._error_loss_fn = error_loss_fn self._margin = margin super(RelativeConstraint, self).__init__(time_step_spec, action_spec, constraint_network, error_loss_fn=self._error_loss_fn...
Class for representing a trainable relative constraint. This constraint class implements a relative constraint such as ``` expected_value(action) >= (1 - margin) * expected_value(baseline_action) ``` or ``` expected_value(action) <= (1 - margin) * expected_value(baseline_action) ```
RelativeConstraint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativeConstraint: """Class for representing a trainable relative constraint. This constraint class implements a relative constraint such as ``` expected_value(action) >= (1 - margin) * expected_value(baseline_action) ``` or ``` expected_value(action) <= (1 - margin) * expected_value(baseline_ac...
stack_v2_sparse_classes_36k_train_029163
22,532
permissive
[ { "docstring": "Creates a trainable relative constraint using a neural network. Args: time_step_spec: A `TimeStep` spec of the expected time_steps. action_spec: A nest of `BoundedTensorSpec` representing the actions. constraint_network: An instance of `tf_agents.network.Network` used to provide estimates of act...
2
null
Implement the Python class `RelativeConstraint` described below. Class description: Class for representing a trainable relative constraint. This constraint class implements a relative constraint such as ``` expected_value(action) >= (1 - margin) * expected_value(baseline_action) ``` or ``` expected_value(action) <= (1...
Implement the Python class `RelativeConstraint` described below. Class description: Class for representing a trainable relative constraint. This constraint class implements a relative constraint such as ``` expected_value(action) >= (1 - margin) * expected_value(baseline_action) ``` or ``` expected_value(action) <= (1...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class RelativeConstraint: """Class for representing a trainable relative constraint. This constraint class implements a relative constraint such as ``` expected_value(action) >= (1 - margin) * expected_value(baseline_action) ``` or ``` expected_value(action) <= (1 - margin) * expected_value(baseline_ac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelativeConstraint: """Class for representing a trainable relative constraint. This constraint class implements a relative constraint such as ``` expected_value(action) >= (1 - margin) * expected_value(baseline_action) ``` or ``` expected_value(action) <= (1 - margin) * expected_value(baseline_action) ```""" ...
the_stack_v2_python_sparse
tf_agents/bandits/policies/constraints.py
tensorflow/agents
train
2,755
971bd0c1781199c4c3585355cfefe61a4bc02c9a
[ "try:\n group = await get_data_from_req(self.request).groups.get(group_id)\nexcept ResourceNotFoundError:\n raise NotFound()\nreturn json_response(GroupResponse.parse_obj(group))", "try:\n group = await get_data_from_req(self.request).groups.update(group_id, data)\nexcept ResourceNotFoundError:\n rais...
<|body_start_0|> try: group = await get_data_from_req(self.request).groups.get(group_id) except ResourceNotFoundError: raise NotFound() return json_response(GroupResponse.parse_obj(group)) <|end_body_0|> <|body_start_1|> try: group = await get_data_fr...
GroupView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupView: async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: """Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found""" <|body_0|> async def pa...
stack_v2_sparse_classes_36k_train_029164
3,996
permissive
[ { "docstring": "Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found", "name": "get", "signature": "async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_010501
Implement the Python class `GroupView` described below. Class description: Implement the GroupView class. Method signatures and docstrings: - async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: Get a group. Fetches the complete representation of a single user group including its permissions. St...
Implement the Python class `GroupView` described below. Class description: Implement the GroupView class. Method signatures and docstrings: - async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: Get a group. Fetches the complete representation of a single user group including its permissions. St...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class GroupView: async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: """Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found""" <|body_0|> async def pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupView: async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: """Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found""" try: group = await get_data_fr...
the_stack_v2_python_sparse
virtool/groups/api.py
virtool/virtool
train
45
fd870f007d03036bafb3d1d54f73e97f37d00fa2
[ "fields = super(IssueReportAdmin, self).get_fields(request, obj)\nif obj and obj.type != 'duplicate' and ('usecase_duplicate' in fields):\n fields.remove('usecase_duplicate')\nreturn fields", "opts = self.model._meta\npk_value = obj._get_pk_val()\npreserved_filters = self.get_preserved_filters(request)\nredire...
<|body_start_0|> fields = super(IssueReportAdmin, self).get_fields(request, obj) if obj and obj.type != 'duplicate' and ('usecase_duplicate' in fields): fields.remove('usecase_duplicate') return fields <|end_body_0|> <|body_start_1|> opts = self.model._meta pk_value ...
IssueReportAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IssueReportAdmin: def get_fields(self, request, obj=None): """Override to hide the 'usecase_duplicate' if type is not 'duplicate'""" <|body_0|> def response_change(self, request, obj, *args, **kwargs): """Override response_change method of admin/options.py to handle ...
stack_v2_sparse_classes_36k_train_029165
18,243
no_license
[ { "docstring": "Override to hide the 'usecase_duplicate' if type is not 'duplicate'", "name": "get_fields", "signature": "def get_fields(self, request, obj=None)" }, { "docstring": "Override response_change method of admin/options.py to handle the click of newly added buttons", "name": "resp...
2
stack_v2_sparse_classes_30k_train_009320
Implement the Python class `IssueReportAdmin` described below. Class description: Implement the IssueReportAdmin class. Method signatures and docstrings: - def get_fields(self, request, obj=None): Override to hide the 'usecase_duplicate' if type is not 'duplicate' - def response_change(self, request, obj, *args, **kw...
Implement the Python class `IssueReportAdmin` described below. Class description: Implement the IssueReportAdmin class. Method signatures and docstrings: - def get_fields(self, request, obj=None): Override to hide the 'usecase_duplicate' if type is not 'duplicate' - def response_change(self, request, obj, *args, **kw...
d9b330ef70b0d0985bfc8248612ba57ee46ff0f4
<|skeleton|> class IssueReportAdmin: def get_fields(self, request, obj=None): """Override to hide the 'usecase_duplicate' if type is not 'duplicate'""" <|body_0|> def response_change(self, request, obj, *args, **kwargs): """Override response_change method of admin/options.py to handle ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IssueReportAdmin: def get_fields(self, request, obj=None): """Override to hide the 'usecase_duplicate' if type is not 'duplicate'""" fields = super(IssueReportAdmin, self).get_fields(request, obj) if obj and obj.type != 'duplicate' and ('usecase_duplicate' in fields): field...
the_stack_v2_python_sparse
Code/EnhanceCWE-master/muo/admin.py
happinesstaker/more-website
train
0
72fa32d825169a7a0c6418cfdb0c43c1b288462e
[ "if not last:\n t_cur = tuple(cur)\n if t_cur not in self.s:\n self.ret.append(cur)\n self.s.add(t_cur)\n return\nfor index, num in enumerate(last):\n self.buffer(cur + [num], last[:index] + last[index + 1:])", "if not last:\n self.ret.append(cur)\n return\ns = set()\nfor index, nu...
<|body_start_0|> if not last: t_cur = tuple(cur) if t_cur not in self.s: self.ret.append(cur) self.s.add(t_cur) return for index, num in enumerate(last): self.buffer(cur + [num], last[:index] + last[index + 1:]) <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buffer1(self, cur, last): """:type cur: list[int] :type last: list[int] :rtype :list[int]""" <|body_0|> def buffer(self, cur, last): """:type cur: list[int] :type last: list[int] :rtype :list[int]""" <|body_1|> def permuteUnique(self, nums)...
stack_v2_sparse_classes_36k_train_029166
1,264
no_license
[ { "docstring": ":type cur: list[int] :type last: list[int] :rtype :list[int]", "name": "buffer1", "signature": "def buffer1(self, cur, last)" }, { "docstring": ":type cur: list[int] :type last: list[int] :rtype :list[int]", "name": "buffer", "signature": "def buffer(self, cur, last)" }...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buffer1(self, cur, last): :type cur: list[int] :type last: list[int] :rtype :list[int] - def buffer(self, cur, last): :type cur: list[int] :type last: list[int] :rtype :list[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buffer1(self, cur, last): :type cur: list[int] :type last: list[int] :rtype :list[int] - def buffer(self, cur, last): :type cur: list[int] :type last: list[int] :rtype :list[...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def buffer1(self, cur, last): """:type cur: list[int] :type last: list[int] :rtype :list[int]""" <|body_0|> def buffer(self, cur, last): """:type cur: list[int] :type last: list[int] :rtype :list[int]""" <|body_1|> def permuteUnique(self, nums)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def buffer1(self, cur, last): """:type cur: list[int] :type last: list[int] :rtype :list[int]""" if not last: t_cur = tuple(cur) if t_cur not in self.s: self.ret.append(cur) self.s.add(t_cur) return for index...
the_stack_v2_python_sparse
python/leetcode/47_Permutations_II.py
bobcaoge/my-code
train
0
1104711a6ca608c8abb473799a3b9b50f368ba11
[ "self.data = dict()\nself.total = 0\nself.rand = random.Random()", "if val in self.data:\n return False\nself.data[val] = None\nself.total += 1\nreturn True", "if val in self.data:\n self.data.pop(val)\n self.total -= 1\n return True\nreturn False", "datas = list(self.data.keys())\npos = self.rand...
<|body_start_0|> self.data = dict() self.total = 0 self.rand = random.Random() <|end_body_0|> <|body_start_1|> if val in self.data: return False self.data[val] = None self.total += 1 return True <|end_body_1|> <|body_start_2|> if val in self....
RandomizedSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_36k_train_029167
1,584
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element.", "name": "insert", "signature": "def insert(self, val: int) ...
4
stack_v2_sparse_classes_30k_train_011559
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
976090d52c77fc95ed7eb2eae3c60abc2a7f7106
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" self.data = dict() self.total = 0 self.rand = random.Random() def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specif...
the_stack_v2_python_sparse
src/desgin/RandomizedSet.py
fanwucoder/leecode
train
0
ad1c389082b8c46fcc421eb4da67ec4cf18b358f
[ "tk.Toplevel.__init__(self)\nself.tid = scrolledtext.ScrolledText(self)\nself.tid.pack(fill=tk.BOTH, expand=1)\nself.Styles()\nself.Show()", "for c in ['red', 'blue', 'magenta', 'yellow', 'green', 'red4', 'green4', 'blue4']:\n self.tid.tag_configure(c, foreground=c)\nself.tid.tag_config('underline', underline=...
<|body_start_0|> tk.Toplevel.__init__(self) self.tid = scrolledtext.ScrolledText(self) self.tid.pack(fill=tk.BOTH, expand=1) self.Styles() self.Show() <|end_body_0|> <|body_start_1|> for c in ['red', 'blue', 'magenta', 'yellow', 'green', 'red4', 'green4', 'blue4']: ...
Help window.
xbbtools_help
[ "BSD-3-Clause", "LicenseRef-scancode-biopython" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class xbbtools_help: """Help window.""" def __init__(self, *args): """Make toplevel help window.""" <|body_0|> def Styles(self): """Define text styles.""" <|body_1|> def Show(self): """Display help text.""" <|body_2|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_029168
3,209
permissive
[ { "docstring": "Make toplevel help window.", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Define text styles.", "name": "Styles", "signature": "def Styles(self)" }, { "docstring": "Display help text.", "name": "Show", "signature": "def S...
3
stack_v2_sparse_classes_30k_val_000478
Implement the Python class `xbbtools_help` described below. Class description: Help window. Method signatures and docstrings: - def __init__(self, *args): Make toplevel help window. - def Styles(self): Define text styles. - def Show(self): Display help text.
Implement the Python class `xbbtools_help` described below. Class description: Help window. Method signatures and docstrings: - def __init__(self, *args): Make toplevel help window. - def Styles(self): Define text styles. - def Show(self): Display help text. <|skeleton|> class xbbtools_help: """Help window.""" ...
d416809344f1e345fbabbdaca4dd6dcf441e53bd
<|skeleton|> class xbbtools_help: """Help window.""" def __init__(self, *args): """Make toplevel help window.""" <|body_0|> def Styles(self): """Define text styles.""" <|body_1|> def Show(self): """Display help text.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class xbbtools_help: """Help window.""" def __init__(self, *args): """Make toplevel help window.""" tk.Toplevel.__init__(self) self.tid = scrolledtext.ScrolledText(self) self.tid.pack(fill=tk.BOTH, expand=1) self.Styles() self.Show() def Styles(self): ...
the_stack_v2_python_sparse
Scripts/xbbtools/xbb_help.py
biopython/biopython
train
3,669
b4910d9ce74079192a5ef828cdeafb5f4319323a
[ "res = super(ResConfigSettings, self).get_values()\nres['batch_num'] = int(self.env['ir.config_parameter'].sudo().get_param('funenc_wechat.batch_num', default=0))\nres['syn_thread_num'] = int(self.env['ir.config_parameter'].sudo().get_param('funenc_wechat.syn_thread_num', default=5))\nreturn res", "self.env['ir.c...
<|body_start_0|> res = super(ResConfigSettings, self).get_values() res['batch_num'] = int(self.env['ir.config_parameter'].sudo().get_param('funenc_wechat.batch_num', default=0)) res['syn_thread_num'] = int(self.env['ir.config_parameter'].sudo().get_param('funenc_wechat.syn_thread_num', default=5...
企业微信配置,批量处理
ResConfigSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResConfigSettings: """企业微信配置,批量处理""" def get_values(self): """取得配置 :return:""" <|body_0|> def set_values(self): """设置配置值 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = super(ResConfigSettings, self).get_values() res['batc...
stack_v2_sparse_classes_36k_train_029169
1,184
no_license
[ { "docstring": "取得配置 :return:", "name": "get_values", "signature": "def get_values(self)" }, { "docstring": "设置配置值 :return:", "name": "set_values", "signature": "def set_values(self)" } ]
2
null
Implement the Python class `ResConfigSettings` described below. Class description: 企业微信配置,批量处理 Method signatures and docstrings: - def get_values(self): 取得配置 :return: - def set_values(self): 设置配置值 :return:
Implement the Python class `ResConfigSettings` described below. Class description: 企业微信配置,批量处理 Method signatures and docstrings: - def get_values(self): 取得配置 :return: - def set_values(self): 设置配置值 :return: <|skeleton|> class ResConfigSettings: """企业微信配置,批量处理""" def get_values(self): """取得配置 :return:...
13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9
<|skeleton|> class ResConfigSettings: """企业微信配置,批量处理""" def get_values(self): """取得配置 :return:""" <|body_0|> def set_values(self): """设置配置值 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResConfigSettings: """企业微信配置,批量处理""" def get_values(self): """取得配置 :return:""" res = super(ResConfigSettings, self).get_values() res['batch_num'] = int(self.env['ir.config_parameter'].sudo().get_param('funenc_wechat.batch_num', default=0)) res['syn_thread_num'] = int(self....
the_stack_v2_python_sparse
mdias_addons/funenc_wechat/models/res_config_settings.py
rezaghanimi/main_mdias
train
0
ca3e6c50ee6c12dfed3588318923f3633bf9dc9a
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\noffset = request.args.get('offset', '0')\nlimit = request.args.get('limit', '10')\norder_by = request.args.get('order_by', 'id')\norder = request.args.get('order', 'ASC')\nper_page = request.args.get('per_page', '10'...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) offset = request.args.get('offset', '0') limit = request.args.get('limit', '10') order_by = request.args.get('order_by', 'id') order = request.a...
ObservacionCyTGList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservacionCyTGList: def get(self): """To fetch several observations (CyTG (resultados)). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an observation (CyTG (resultados)).""" <|body_1...
stack_v2_sparse_classes_36k_train_029170
18,120
no_license
[ { "docstring": "To fetch several observations (CyTG (resultados)). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages", "name": "get", "signature": "def get(self)" }, { "docstring": "To create an observation (CyTG (resultados)).", "name": "post", "signature": ...
2
stack_v2_sparse_classes_30k_train_012379
Implement the Python class `ObservacionCyTGList` described below. Class description: Implement the ObservacionCyTGList class. Method signatures and docstrings: - def get(self): To fetch several observations (CyTG (resultados)). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - def post(...
Implement the Python class `ObservacionCyTGList` described below. Class description: Implement the ObservacionCyTGList class. Method signatures and docstrings: - def get(self): To fetch several observations (CyTG (resultados)). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - def post(...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ObservacionCyTGList: def get(self): """To fetch several observations (CyTG (resultados)). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an observation (CyTG (resultados)).""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservacionCyTGList: def get(self): """To fetch several observations (CyTG (resultados)). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) ...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/observaciones_ires_cytg.py
Telematica/knight-rider
train
1
5d7f0d2b03d41c50ff6d837fc9d357219712a50e
[ "self.publisher = rospy.Publisher(output_heart_anomaly_topic, Classification2D, queue_size=10)\nrospy.Subscriber(input_ecg_topic, Float32MultiArray, self.callback)\nself.bridge = ROSBridge()\nself.channels = 1\nself.series_length = 9000\nif model == 'gru':\n self.learner = GatedRecurrentUnitLearner(in_channels=s...
<|body_start_0|> self.publisher = rospy.Publisher(output_heart_anomaly_topic, Classification2D, queue_size=10) rospy.Subscriber(input_ecg_topic, Float32MultiArray, self.callback) self.bridge = ROSBridge() self.channels = 1 self.series_length = 9000 if model == 'gru': ...
HeartAnomalyNode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeartAnomalyNode: def __init__(self, input_ecg_topic='/ecg/ecg', output_heart_anomaly_topic='/opendr/heart_anomaly', device='cuda', model='anbof'): """Creates a ROS Node for heart anomaly (atrial fibrillation) detection from ecg data :param input_ecg_topic: Topic from which we are readin...
stack_v2_sparse_classes_36k_train_029171
4,848
permissive
[ { "docstring": "Creates a ROS Node for heart anomaly (atrial fibrillation) detection from ecg data :param input_ecg_topic: Topic from which we are reading the input array data :type input_ecg_topic: str :param output_heart_anomaly_topic: Topic to which we are publishing the predicted class :type output_heart_an...
3
null
Implement the Python class `HeartAnomalyNode` described below. Class description: Implement the HeartAnomalyNode class. Method signatures and docstrings: - def __init__(self, input_ecg_topic='/ecg/ecg', output_heart_anomaly_topic='/opendr/heart_anomaly', device='cuda', model='anbof'): Creates a ROS Node for heart ano...
Implement the Python class `HeartAnomalyNode` described below. Class description: Implement the HeartAnomalyNode class. Method signatures and docstrings: - def __init__(self, input_ecg_topic='/ecg/ecg', output_heart_anomaly_topic='/opendr/heart_anomaly', device='cuda', model='anbof'): Creates a ROS Node for heart ano...
b3d6ce670cdf63469fc5766630eb295d67b3d788
<|skeleton|> class HeartAnomalyNode: def __init__(self, input_ecg_topic='/ecg/ecg', output_heart_anomaly_topic='/opendr/heart_anomaly', device='cuda', model='anbof'): """Creates a ROS Node for heart anomaly (atrial fibrillation) detection from ecg data :param input_ecg_topic: Topic from which we are readin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HeartAnomalyNode: def __init__(self, input_ecg_topic='/ecg/ecg', output_heart_anomaly_topic='/opendr/heart_anomaly', device='cuda', model='anbof'): """Creates a ROS Node for heart anomaly (atrial fibrillation) detection from ecg data :param input_ecg_topic: Topic from which we are reading the input ar...
the_stack_v2_python_sparse
projects/opendr_ws/src/opendr_perception/scripts/heart_anomaly_detection_node.py
opendr-eu/opendr
train
535
2e7c3f9d920ad966b36810c939d667d1486a951b
[ "for page in range(1, self.settings.get('MAX_PAGE') + 1):\n url = self.base_url + str(page)\n yield Request(url=url, callback=self.parse, meta={'page': page}, dont_filter=True)", "products = response.xpath(\"//*[@id='plist']/ul/li\")\nfor product in products:\n item = JdItem()\n item['title'] = produc...
<|body_start_0|> for page in range(1, self.settings.get('MAX_PAGE') + 1): url = self.base_url + str(page) yield Request(url=url, callback=self.parse, meta={'page': page}, dont_filter=True) <|end_body_0|> <|body_start_1|> products = response.xpath("//*[@id='plist']/ul/li") ...
LaptopSpider
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaptopSpider: def start_requests(self): """爬虫开始的地方,需要对页数进行处理""" <|body_0|> def parse(self, response): """对Selenium返回的页面进行解析""" <|body_1|> <|end_skeleton|> <|body_start_0|> for page in range(1, self.settings.get('MAX_PAGE') + 1): url = se...
stack_v2_sparse_classes_36k_train_029172
1,308
permissive
[ { "docstring": "爬虫开始的地方,需要对页数进行处理", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "对Selenium返回的页面进行解析", "name": "parse", "signature": "def parse(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_016210
Implement the Python class `LaptopSpider` described below. Class description: Implement the LaptopSpider class. Method signatures and docstrings: - def start_requests(self): 爬虫开始的地方,需要对页数进行处理 - def parse(self, response): 对Selenium返回的页面进行解析
Implement the Python class `LaptopSpider` described below. Class description: Implement the LaptopSpider class. Method signatures and docstrings: - def start_requests(self): 爬虫开始的地方,需要对页数进行处理 - def parse(self, response): 对Selenium返回的页面进行解析 <|skeleton|> class LaptopSpider: def start_requests(self): """爬虫...
e851524917b60e7308172bc235597b7c578882cc
<|skeleton|> class LaptopSpider: def start_requests(self): """爬虫开始的地方,需要对页数进行处理""" <|body_0|> def parse(self, response): """对Selenium返回的页面进行解析""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LaptopSpider: def start_requests(self): """爬虫开始的地方,需要对页数进行处理""" for page in range(1, self.settings.get('MAX_PAGE') + 1): url = self.base_url + str(page) yield Request(url=url, callback=self.parse, meta={'page': page}, dont_filter=True) def parse(self, response): ...
the_stack_v2_python_sparse
10th_week/homework/作业1/JD/JD/spiders/laptop.py
luhuadong/Python_Learning
train
1
82bb39dbb7391161dd61f37312a2e56b4923b0f9
[ "perms = self.helper.get_all_permission_items()\nreq_keys = self.request.POST.keys()\nresponse = ''\nfor fieldname, email in self.request.POST.iteritems():\n if re.match(self.USER_PERMISSION_REGEX, fieldname):\n for perm in perms:\n key = '{0}-{1}'.format(email, perm)\n if key in req...
<|body_start_0|> perms = self.helper.get_all_permission_items() req_keys = self.request.POST.keys() response = '' for fieldname, email in self.request.POST.iteritems(): if re.match(self.USER_PERMISSION_REGEX, fieldname): for perm in perms: ...
Class to handle requests to the /authorize page.
AuthorizePage
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthorizePage: """Class to handle requests to the /authorize page.""" def parse_update_user_permissions(self): """Update authorization matrix from form submission. Returns: A str with message to be displayed to the user.""" <|body_0|> def post(self): """Handler f...
stack_v2_sparse_classes_36k_train_029173
37,207
permissive
[ { "docstring": "Update authorization matrix from form submission. Returns: A str with message to be displayed to the user.", "name": "parse_update_user_permissions", "signature": "def parse_update_user_permissions(self)" }, { "docstring": "Handler for POST requests.", "name": "post", "si...
3
stack_v2_sparse_classes_30k_train_008630
Implement the Python class `AuthorizePage` described below. Class description: Class to handle requests to the /authorize page. Method signatures and docstrings: - def parse_update_user_permissions(self): Update authorization matrix from form submission. Returns: A str with message to be displayed to the user. - def ...
Implement the Python class `AuthorizePage` described below. Class description: Class to handle requests to the /authorize page. Method signatures and docstrings: - def parse_update_user_permissions(self): Update authorization matrix from form submission. Returns: A str with message to be displayed to the user. - def ...
aa36e8dfaa295d53bec616ed07f91ec8c02fa4e1
<|skeleton|> class AuthorizePage: """Class to handle requests to the /authorize page.""" def parse_update_user_permissions(self): """Update authorization matrix from form submission. Returns: A str with message to be displayed to the user.""" <|body_0|> def post(self): """Handler f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthorizePage: """Class to handle requests to the /authorize page.""" def parse_update_user_permissions(self): """Update authorization matrix from form submission. Returns: A str with message to be displayed to the user.""" perms = self.helper.get_all_permission_items() req_keys =...
the_stack_v2_python_sparse
AppDashboard/dashboard.py
shatterednirvana/appscale
train
6
bb5ba0c6e69879dfc1292f329f4d60c4775aa4d5
[ "self.data = data\nself.instruments = configuration.instruments\nself.exchanges = configuration.exchange_names\nself.exchange = self.exchanges[0]\nself.events = events\nself.short_window = short_window\nself.long_window = long_window\nself.trigger_window = trigger_window\nself.strategy_name = 'macd_crossover'\nself...
<|body_start_0|> self.data = data self.instruments = configuration.instruments self.exchanges = configuration.exchange_names self.exchange = self.exchanges[0] self.events = events self.short_window = short_window self.long_window = long_window self.trigger...
Carries out a basic MACD Strategy
MACDCrossover
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MACDCrossover: """Carries out a basic MACD Strategy""" def __init__(self, data, events, configuration, long_window=52, short_window=24, trigger_window=18): """Initialises the Moving Average Cross Strategy. :param data: The DataHandler object that provides bar information. :param even...
stack_v2_sparse_classes_36k_train_029174
3,787
no_license
[ { "docstring": "Initialises the Moving Average Cross Strategy. :param data: The DataHandler object that provides bar information. :param events: The Event Queue object. :param short_window: The short moving average lookback. :param long_window: The long moving average lookback.", "name": "__init__", "si...
3
stack_v2_sparse_classes_30k_train_012824
Implement the Python class `MACDCrossover` described below. Class description: Carries out a basic MACD Strategy Method signatures and docstrings: - def __init__(self, data, events, configuration, long_window=52, short_window=24, trigger_window=18): Initialises the Moving Average Cross Strategy. :param data: The Data...
Implement the Python class `MACDCrossover` described below. Class description: Carries out a basic MACD Strategy Method signatures and docstrings: - def __init__(self, data, events, configuration, long_window=52, short_window=24, trigger_window=18): Initialises the Moving Average Cross Strategy. :param data: The Data...
39ad067fa9ea27002d06c98a9d06725ad886917b
<|skeleton|> class MACDCrossover: """Carries out a basic MACD Strategy""" def __init__(self, data, events, configuration, long_window=52, short_window=24, trigger_window=18): """Initialises the Moving Average Cross Strategy. :param data: The DataHandler object that provides bar information. :param even...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MACDCrossover: """Carries out a basic MACD Strategy""" def __init__(self, data, events, configuration, long_window=52, short_window=24, trigger_window=18): """Initialises the Moving Average Cross Strategy. :param data: The DataHandler object that provides bar information. :param events: The Event...
the_stack_v2_python_sparse
strategies/crypto/macd_crossover.py
Dvisacker/backtrader
train
2
a41d07f606937855b97dd9a7a565512634603b94
[ "if n > 2:\n ans = self.climbStairs_rec(n - 1) + self.climbStairs_rec(n - 2)\nelse:\n ans = n\nreturn ans", "if n > 2:\n ans = self.climbStairs_cacherec(n - 1) + self.climbStairs_cacherec(n - 2)\nelse:\n ans = n\nreturn ans", "if n == 1:\n return 1\nif n == 2:\n return 2\ndp = [0] * n\ndp[0] =...
<|body_start_0|> if n > 2: ans = self.climbStairs_rec(n - 1) + self.climbStairs_rec(n - 2) else: ans = n return ans <|end_body_0|> <|body_start_1|> if n > 2: ans = self.climbStairs_cacherec(n - 1) + self.climbStairs_cacherec(n - 2) else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs_rec(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs_cacherec(self, n): """:type n: int :rtype: int""" <|body_1|> def climbStairs_dp(self, n): """:type n: int :rtype: int""" <|body_2|> def...
stack_v2_sparse_classes_36k_train_029175
2,932
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs_rec", "signature": "def climbStairs_rec(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "climbStairs_cacherec", "signature": "def climbStairs_cacherec(self, n)" }, { "docstring": ":type n: int :rtype:...
5
stack_v2_sparse_classes_30k_train_001826
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs_rec(self, n): :type n: int :rtype: int - def climbStairs_cacherec(self, n): :type n: int :rtype: int - def climbStairs_dp(self, n): :type n: int :rtype: int - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs_rec(self, n): :type n: int :rtype: int - def climbStairs_cacherec(self, n): :type n: int :rtype: int - def climbStairs_dp(self, n): :type n: int :rtype: int - def...
3f7b2ea959308eb80f4c65be35aaeed666570f80
<|skeleton|> class Solution: def climbStairs_rec(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs_cacherec(self, n): """:type n: int :rtype: int""" <|body_1|> def climbStairs_dp(self, n): """:type n: int :rtype: int""" <|body_2|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs_rec(self, n): """:type n: int :rtype: int""" if n > 2: ans = self.climbStairs_rec(n - 1) + self.climbStairs_rec(n - 2) else: ans = n return ans def climbStairs_cacherec(self, n): """:type n: int :rtype: int""" ...
the_stack_v2_python_sparse
70.爬楼梯.py
dxc19951001/Everyday_LeetCode
train
1
3a8b2f25b2ede5a50ac79f6478866acedd225294
[ "self.model_statistics = model_statistics\nself.model_constraints = model_constraints\nself.model_data_statistics = model_data_statistics\nself.model_data_constraints = model_data_constraints\nself.bias = bias\nself.bias_pre_training = bias_pre_training\nself.bias_post_training = bias_post_training\nself.explainabi...
<|body_start_0|> self.model_statistics = model_statistics self.model_constraints = model_constraints self.model_data_statistics = model_data_statistics self.model_data_constraints = model_data_constraints self.bias = bias self.bias_pre_training = bias_pre_training ...
Accepts model metrics parameters for conversion to request dict.
ModelMetrics
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelMetrics: """Accepts model metrics parameters for conversion to request dict.""" def __init__(self, model_statistics: Optional['MetricsSource']=None, model_constraints: Optional['MetricsSource']=None, model_data_statistics: Optional['MetricsSource']=None, model_data_constraints: Optional...
stack_v2_sparse_classes_36k_train_029176
7,143
permissive
[ { "docstring": "Initialize a ``ModelMetrics`` instance and turn parameters into dict. Args: model_statistics (MetricsSource): A metric source object that represents model statistics (default: None). model_constraints (MetricsSource): A metric source object that represents model constraints (default: None). mode...
2
null
Implement the Python class `ModelMetrics` described below. Class description: Accepts model metrics parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, model_statistics: Optional['MetricsSource']=None, model_constraints: Optional['MetricsSource']=None, model_data_statisti...
Implement the Python class `ModelMetrics` described below. Class description: Accepts model metrics parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, model_statistics: Optional['MetricsSource']=None, model_constraints: Optional['MetricsSource']=None, model_data_statisti...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class ModelMetrics: """Accepts model metrics parameters for conversion to request dict.""" def __init__(self, model_statistics: Optional['MetricsSource']=None, model_constraints: Optional['MetricsSource']=None, model_data_statistics: Optional['MetricsSource']=None, model_data_constraints: Optional...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelMetrics: """Accepts model metrics parameters for conversion to request dict.""" def __init__(self, model_statistics: Optional['MetricsSource']=None, model_constraints: Optional['MetricsSource']=None, model_data_statistics: Optional['MetricsSource']=None, model_data_constraints: Optional['MetricsSour...
the_stack_v2_python_sparse
src/sagemaker/model_metrics.py
aws/sagemaker-python-sdk
train
2,050
ed41bfc5515008d62eee2b4e11ec55f39c8710c4
[ "query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nform = PlatformForm()\nlist_platform = None\nif query:\n list_platform = Platform.objects.filter(Q(name_platform__icontains=query))\nelse:\n list_platform = Platform.objects.all()\noutput = {'form': form, 'list_platform': list_platform}\nr...
<|body_start_0|> query = request.GET.get('q') sort = request.GET.get('sort', 'name') form = PlatformForm() list_platform = None if query: list_platform = Platform.objects.filter(Q(name_platform__icontains=query)) else: list_platform = Platform.obje...
Clase para agregar una plataforma
NewPlatformView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewPlatformView: """Clase para agregar una plataforma""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|> <|body_start_0|> query = reques...
stack_v2_sparse_classes_36k_train_029177
22,221
no_license
[ { "docstring": "Método get", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Método post", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_005121
Implement the Python class `NewPlatformView` described below. Class description: Clase para agregar una plataforma Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post
Implement the Python class `NewPlatformView` described below. Class description: Clase para agregar una plataforma Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post <|skeleton|> class NewPlatformView: """Clase para agre...
e28e2d968372609ad396c42fb572a00c2410a117
<|skeleton|> class NewPlatformView: """Clase para agregar una plataforma""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewPlatformView: """Clase para agregar una plataforma""" def get(self, request, *args, **kwargs): """Método get""" query = request.GET.get('q') sort = request.GET.get('sort', 'name') form = PlatformForm() list_platform = None if query: list_plat...
the_stack_v2_python_sparse
list/views.py
damaos/server_list2
train
0
caeab58fb0a79f61ec2fb79eade172ced2411470
[ "self.prodLocation = prodLocation\nself.bingoAssetsFolder = AssetsFolder\nself.roomNumber = roomNumber\nself.gameName = os.path.split(self.prodLocation)[-1]\nself.runit = GeneralConversionCalls.intermediateFunctions(self.prodLocation, self.bingoAssetsFolder, self.roomNumber, False)\nself.GameFileNameSWF = self.game...
<|body_start_0|> self.prodLocation = prodLocation self.bingoAssetsFolder = AssetsFolder self.roomNumber = roomNumber self.gameName = os.path.split(self.prodLocation)[-1] self.runit = GeneralConversionCalls.intermediateFunctions(self.prodLocation, self.bingoAssetsFolder, self.room...
Moves all the bingo art from one location to the correct final location with the correct naming convetnion
MoveBingo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoveBingo: """Moves all the bingo art from one location to the correct final location with the correct naming convetnion""" def __init__(self, prodLocation, AssetsFolder, roomNumber): """Set up the location of the origonal art. The final art location and naming of assets""" <...
stack_v2_sparse_classes_36k_train_029178
2,578
no_license
[ { "docstring": "Set up the location of the origonal art. The final art location and naming of assets", "name": "__init__", "signature": "def __init__(self, prodLocation, AssetsFolder, roomNumber)" }, { "docstring": "Worker function call this if you want to move the art from one point to another"...
2
null
Implement the Python class `MoveBingo` described below. Class description: Moves all the bingo art from one location to the correct final location with the correct naming convetnion Method signatures and docstrings: - def __init__(self, prodLocation, AssetsFolder, roomNumber): Set up the location of the origonal art....
Implement the Python class `MoveBingo` described below. Class description: Moves all the bingo art from one location to the correct final location with the correct naming convetnion Method signatures and docstrings: - def __init__(self, prodLocation, AssetsFolder, roomNumber): Set up the location of the origonal art....
06d179d6ddfebba8fa42c220ce017a52c6bd3377
<|skeleton|> class MoveBingo: """Moves all the bingo art from one location to the correct final location with the correct naming convetnion""" def __init__(self, prodLocation, AssetsFolder, roomNumber): """Set up the location of the origonal art. The final art location and naming of assets""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoveBingo: """Moves all the bingo art from one location to the correct final location with the correct naming convetnion""" def __init__(self, prodLocation, AssetsFolder, roomNumber): """Set up the location of the origonal art. The final art location and naming of assets""" self.prodLocat...
the_stack_v2_python_sparse
FlashArtPipeline/art_pipeline/ExternalCalls/BingoConversion.py
underminerstudios/ScriptBackup
train
2
d33f5928e4414fbed5d4a09ae32baa2c6f413c19
[ "super(Variational, self).__init__()\nself.hidden_size = hidden_size\nself.latent_size = latent_size\nself.use_identity = use_identity\nif self.use_identity:\n self.hidden_to_mu = nn.Identity()\n self.hidden_to_tanh = nn.Linear(self.hidden_size, self.latent_size)\n self.act_tanh = nn.Tanh()\n self.than_...
<|body_start_0|> super(Variational, self).__init__() self.hidden_size = hidden_size self.latent_size = latent_size self.use_identity = use_identity if self.use_identity: self.hidden_to_mu = nn.Identity() self.hidden_to_tanh = nn.Linear(self.hidden_size, se...
Variation Layer of Variational AutoEncoder
Variational
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variational: """Variation Layer of Variational AutoEncoder""" def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): """Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vecto...
stack_v2_sparse_classes_36k_train_029179
14,969
permissive
[ { "docstring": "Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vector should be use_identity (bool, optional): if identity should be used. Defaults to False.", "name": "__init__", "signature": "def __init__(self, hidden...
2
stack_v2_sparse_classes_30k_train_018423
Implement the Python class `Variational` described below. Class description: Variation Layer of Variational AutoEncoder Method signatures and docstrings: - def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): Variational Args: hidden_size (int): number of features per time step (output fr...
Implement the Python class `Variational` described below. Class description: Variation Layer of Variational AutoEncoder Method signatures and docstrings: - def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): Variational Args: hidden_size (int): number of features per time step (output fr...
5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3
<|skeleton|> class Variational: """Variation Layer of Variational AutoEncoder""" def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): """Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vecto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Variational: """Variation Layer of Variational AutoEncoder""" def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): """Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vector should be u...
the_stack_v2_python_sparse
src/models/anomalia/layers.py
maurony/ts-vrae
train
1
6d7bd2ce2c1bbf766288a37830aa2857d5a1698b
[ "if balance < Decimal('0.00'):\n raise ValueError('Initial balance must be >= 0.00')\nself.name = name\nself.balance = balance", "if amount < Decimal('0.00'):\n raise ValueError('Amount must be positive')\nself.balance += amount" ]
<|body_start_0|> if balance < Decimal('0.00'): raise ValueError('Initial balance must be >= 0.00') self.name = name self.balance = balance <|end_body_0|> <|body_start_1|> if amount < Decimal('0.00'): raise ValueError('Amount must be positive') self.balanc...
Account class for maintaining a bank account balance
Account
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Account: """Account class for maintaining a bank account balance""" def __init__(self, name, balance): """Initialize an Account Object""" <|body_0|> def deposit(self, amount): """Deposit money to the account""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_029180
622
no_license
[ { "docstring": "Initialize an Account Object", "name": "__init__", "signature": "def __init__(self, name, balance)" }, { "docstring": "Deposit money to the account", "name": "deposit", "signature": "def deposit(self, amount)" } ]
2
stack_v2_sparse_classes_30k_train_015594
Implement the Python class `Account` described below. Class description: Account class for maintaining a bank account balance Method signatures and docstrings: - def __init__(self, name, balance): Initialize an Account Object - def deposit(self, amount): Deposit money to the account
Implement the Python class `Account` described below. Class description: Account class for maintaining a bank account balance Method signatures and docstrings: - def __init__(self, name, balance): Initialize an Account Object - def deposit(self, amount): Deposit money to the account <|skeleton|> class Account: "...
a235a2635316248c8066fdb27074e92635603ee3
<|skeleton|> class Account: """Account class for maintaining a bank account balance""" def __init__(self, name, balance): """Initialize an Account Object""" <|body_0|> def deposit(self, amount): """Deposit money to the account""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Account: """Account class for maintaining a bank account balance""" def __init__(self, name, balance): """Initialize an Account Object""" if balance < Decimal('0.00'): raise ValueError('Initial balance must be >= 0.00') self.name = name self.balance = balance ...
the_stack_v2_python_sparse
Chap10_OOP/account.py
kevin-d-mcewan/ClassExamples
train
0
da9bb410435d894fa4d5dfe710a387976b1c1818
[ "self.preferences = preferences\nsuper(NewsLetterForm, self).__init__(*args, **kwargs)\nself.fields['newsletter_frequency'].initial = preferences.newsletter_frequency\nif preferences.paused_until and preferences.paused_until > now().date():\n self.fields['paused_until'].initial = preferences.paused_until", "pr...
<|body_start_0|> self.preferences = preferences super(NewsLetterForm, self).__init__(*args, **kwargs) self.fields['newsletter_frequency'].initial = preferences.newsletter_frequency if preferences.paused_until and preferences.paused_until > now().date(): self.fields['paused_un...
The NewsLetterForm provides a form used to update the user's newsletter preferences
NewsLetterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewsLetterForm: """The NewsLetterForm provides a form used to update the user's newsletter preferences""" def __init__(self, preferences, *args, **kwargs): """Initializes a new instance of the ChangePasswordForm class.""" <|body_0|> def save(self): """Applies the...
stack_v2_sparse_classes_36k_train_029181
5,957
no_license
[ { "docstring": "Initializes a new instance of the ChangePasswordForm class.", "name": "__init__", "signature": "def __init__(self, preferences, *args, **kwargs)" }, { "docstring": "Applies the new password to the user and saves it.", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_015395
Implement the Python class `NewsLetterForm` described below. Class description: The NewsLetterForm provides a form used to update the user's newsletter preferences Method signatures and docstrings: - def __init__(self, preferences, *args, **kwargs): Initializes a new instance of the ChangePasswordForm class. - def sa...
Implement the Python class `NewsLetterForm` described below. Class description: The NewsLetterForm provides a form used to update the user's newsletter preferences Method signatures and docstrings: - def __init__(self, preferences, *args, **kwargs): Initializes a new instance of the ChangePasswordForm class. - def sa...
b0702a8f7f60de6db9de7f712108e68d66f07f61
<|skeleton|> class NewsLetterForm: """The NewsLetterForm provides a form used to update the user's newsletter preferences""" def __init__(self, preferences, *args, **kwargs): """Initializes a new instance of the ChangePasswordForm class.""" <|body_0|> def save(self): """Applies the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewsLetterForm: """The NewsLetterForm provides a form used to update the user's newsletter preferences""" def __init__(self, preferences, *args, **kwargs): """Initializes a new instance of the ChangePasswordForm class.""" self.preferences = preferences super(NewsLetterForm, self)....
the_stack_v2_python_sparse
getdeal/apps/profiles/forms.py
PankeshGupta/getdeal
train
0
f2ef04603e0428e0e6daad5c0f93f1c4748f75ac
[ "res = {'version': __version__}\nres.update(v)\nreturn res", "use_real_mongo = values.pop('use_real_mongo', None)\nif use_real_mongo is not None:\n warnings.warn(\"'use_real_mongo' is deprecated, please set the appropriate 'database_backend' instead.\", DeprecationWarning)\n if use_real_mongo:\n valu...
<|body_start_0|> res = {'version': __version__} res.update(v) return res <|end_body_0|> <|body_start_1|> use_real_mongo = values.pop('use_real_mongo', None) if use_real_mongo is not None: warnings.warn("'use_real_mongo' is deprecated, please set the appropriate 'data...
This class stores server config parameters in a way that can be easily extended for new config file types.
ServerConfig
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerConfig: """This class stores server config parameters in a way that can be easily extended for new config file types.""" def set_implementation_version(cls, v): """Set defaults and modify bypassed value(s)""" <|body_0|> def use_real_mongo_override(cls, values): ...
stack_v2_sparse_classes_36k_train_029182
13,459
permissive
[ { "docstring": "Set defaults and modify bypassed value(s)", "name": "set_implementation_version", "signature": "def set_implementation_version(cls, v)" }, { "docstring": "Overrides the `database_backend` setting with MongoDB and raises a deprecation warning.", "name": "use_real_mongo_overrid...
2
null
Implement the Python class `ServerConfig` described below. Class description: This class stores server config parameters in a way that can be easily extended for new config file types. Method signatures and docstrings: - def set_implementation_version(cls, v): Set defaults and modify bypassed value(s) - def use_real_...
Implement the Python class `ServerConfig` described below. Class description: This class stores server config parameters in a way that can be easily extended for new config file types. Method signatures and docstrings: - def set_implementation_version(cls, v): Set defaults and modify bypassed value(s) - def use_real_...
a9840269d11ca3f32e5b7d1547e5a49647656264
<|skeleton|> class ServerConfig: """This class stores server config parameters in a way that can be easily extended for new config file types.""" def set_implementation_version(cls, v): """Set defaults and modify bypassed value(s)""" <|body_0|> def use_real_mongo_override(cls, values): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerConfig: """This class stores server config parameters in a way that can be easily extended for new config file types.""" def set_implementation_version(cls, v): """Set defaults and modify bypassed value(s)""" res = {'version': __version__} res.update(v) return res ...
the_stack_v2_python_sparse
optimade/server/config.py
Materials-Consortia/optimade-python-tools
train
54
1cd13fd81d7ee1ac2eafc5ab84bf218b3d90870c
[ "QtGui.QDialog.__init__(self, parent)\nself.data = data_for_plotting\nself.graph_name = bar_chart_name\nself.ordinate_name = ordinate_name\nself.figure = plt.figure()\nself.canvas = FigureCanvas(self.figure)\nself.toolbar = NavigationToolbar(self.canvas, self)\nlayout = QtGui.QVBoxLayout()\nlayout.addWidget(self.to...
<|body_start_0|> QtGui.QDialog.__init__(self, parent) self.data = data_for_plotting self.graph_name = bar_chart_name self.ordinate_name = ordinate_name self.figure = plt.figure() self.canvas = FigureCanvas(self.figure) self.toolbar = NavigationToolbar(self.canvas,...
Implements mechanism for plotting of a bar chart for given data.
BarChart
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarChart: """Implements mechanism for plotting of a bar chart for given data.""" def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None): """Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It i...
stack_v2_sparse_classes_36k_train_029183
2,458
no_license
[ { "docstring": "Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It is a ordinate name of a bar chart. data_for_plotting (list): It is a data for plotting of a bar chart.", "name": "__init__", "signature": "def __init__(self, bar_chart_name...
2
stack_v2_sparse_classes_30k_train_017674
Implement the Python class `BarChart` described below. Class description: Implements mechanism for plotting of a bar chart for given data. Method signatures and docstrings: - def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None): Make a instance of BarChart class. Args: bar_chart_name (str...
Implement the Python class `BarChart` described below. Class description: Implements mechanism for plotting of a bar chart for given data. Method signatures and docstrings: - def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None): Make a instance of BarChart class. Args: bar_chart_name (str...
44d4b2977ee40564629e379f954dd54c68fa2c1a
<|skeleton|> class BarChart: """Implements mechanism for plotting of a bar chart for given data.""" def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None): """Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BarChart: """Implements mechanism for plotting of a bar chart for given data.""" def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None): """Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It is a ordinate ...
the_stack_v2_python_sparse
gui/BarChart.py
andrei-volkau/ground_station
train
2
a97e4bcaa8292daec01217899686888da783db12
[ "params = kwarg['params']\ncmd = 'df '\nreturn cmd", "disk = []\nrecords = output.split('\\n')[1:]\nfor r in records:\n r = r.strip()\n if not r:\n continue\n tokens = r.split()\n filesystem = tokens.pop(0)\n size = int(tokens.pop(0))\n used = int(tokens.pop(0))\n available = int(token...
<|body_start_0|> params = kwarg['params'] cmd = 'df ' return cmd <|end_body_0|> <|body_start_1|> disk = [] records = output.split('\n')[1:] for r in records: r = r.strip() if not r: continue tokens = r.split() ...
Disk free inforamtion
LinuxDiskFreeImpl
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinuxDiskFreeImpl: """Disk free inforamtion""" def format_show(self, command, *argv, **kwarg): """> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/o...
stack_v2_sparse_classes_36k_train_029184
2,420
permissive
[ { "docstring": "> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/onl/boot /dev/sda2 120M 1.6M 110M 2% /mnt/onl/config tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.9M 3.9G 1% /run...
2
stack_v2_sparse_classes_30k_val_000769
Implement the Python class `LinuxDiskFreeImpl` described below. Class description: Disk free inforamtion Method signatures and docstrings: - def format_show(self, command, *argv, **kwarg): > df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 6...
Implement the Python class `LinuxDiskFreeImpl` described below. Class description: Disk free inforamtion Method signatures and docstrings: - def format_show(self, command, *argv, **kwarg): > df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 6...
e4c8221e18cd94e7424c30e12eb0fb82f7767267
<|skeleton|> class LinuxDiskFreeImpl: """Disk free inforamtion""" def format_show(self, command, *argv, **kwarg): """> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinuxDiskFreeImpl: """Disk free inforamtion""" def format_show(self, command, *argv, **kwarg): """> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/onl/boot /dev/...
the_stack_v2_python_sparse
Amazon_Framework/DentOsTestbedLib/src/dent_os_testbed/lib/os/linux/linux_disk_free_impl.py
tld3daniel/testing
train
0
651f5aa5df5a0983bd999071d16c2b936ad25145
[ "if not root:\n return '[]'\nqueue = 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) + ']'", "if...
<|body_start_0|> if not root: return '[]' queue = deque() queue.append(root) res = [] while queue: node = queue.popleft() if node: res.append(str(node.val)) queue.append(node.left) queue.append(no...
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_029185
1,786
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_018146
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:...
5cd8a6c99c463ce01f512379bcb265b7f0b99885
<|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 = deque() queue.append(root) res = [] while queue: node = queue.popleft() if node: ...
the_stack_v2_python_sparse
jianzhi_offer/37.py
jingxiufenghua/algorithm_homework
train
0
5b5765a992c3941137c3b548ffe027dc0a1c19db
[ "super(SoftDotAttention, self).__init__()\ndim2 = dim2 if dim2 is not None else dim\nself.linear_in = nn.Linear(dim, dim2)\nself.sm = nn.Softmax(dim=1)\nself.linear_out = nn.Linear(dim + dim2, dim)\nself.mask = None", "target = self.linear_in(input).unsqueeze(2)\nkey = context if key is None else key\nattn = torc...
<|body_start_0|> super(SoftDotAttention, self).__init__() dim2 = dim2 if dim2 is not None else dim self.linear_in = nn.Linear(dim, dim2) self.sm = nn.Softmax(dim=1) self.linear_out = nn.Linear(dim + dim2, dim) self.mask = None <|end_body_0|> <|body_start_1|> targ...
Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.
SoftDotAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftDotAttention: """Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, dim, dim2=None, heads=1): """Initialize layer.""" <|body_0|> def forward(self, input, context, mask=None, attn_only=False, tok_leve...
stack_v2_sparse_classes_36k_train_029186
4,783
no_license
[ { "docstring": "Initialize layer.", "name": "__init__", "signature": "def __init__(self, dim, dim2=None, heads=1)" }, { "docstring": "Propogate input through the network. input: batch x dim context: batch x sourceL x dim", "name": "forward", "signature": "def forward(self, input, context...
2
stack_v2_sparse_classes_30k_train_021629
Implement the Python class `SoftDotAttention` described below. Class description: Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. Method signatures and docstrings: - def __init__(self, dim, dim2=None, heads=1): Initialize layer. - def forward(self, input, context, mask...
Implement the Python class `SoftDotAttention` described below. Class description: Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. Method signatures and docstrings: - def __init__(self, dim, dim2=None, heads=1): Initialize layer. - def forward(self, input, context, mask...
12c90a5cb3462afe47424c8608a7595c4db28e58
<|skeleton|> class SoftDotAttention: """Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, dim, dim2=None, heads=1): """Initialize layer.""" <|body_0|> def forward(self, input, context, mask=None, attn_only=False, tok_leve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftDotAttention: """Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, dim, dim2=None, heads=1): """Initialize layer.""" super(SoftDotAttention, self).__init__() dim2 = dim2 if dim2 is not None else dim s...
the_stack_v2_python_sparse
utilities/flow_lstm_util/models/lstm_attention.py
mrknight21/open_domain_interviewing_agent
train
2
fe73898049aeb6bce9342b9ae04cba78be372394
[ "self.gettext_domain = 'screen-resolution-extra'\ngettext.textdomain(self.gettext_domain)\nself.init_strings()", "result = unicode(gettext.gettext(str), 'UTF-8')\nif convert_keybindings:\n result = self.convert_keybindings(result)\nreturn result", "self.string_permission_text = self._('Monitor Resolution Set...
<|body_start_0|> self.gettext_domain = 'screen-resolution-extra' gettext.textdomain(self.gettext_domain) self.init_strings() <|end_body_0|> <|body_start_1|> result = unicode(gettext.gettext(str), 'UTF-8') if convert_keybindings: result = self.convert_keybindings(resu...
Abstract user interface. This encapsulates the entire program logic and all strings, but does not implement any concrete user interface.
AbstractUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractUI: """Abstract user interface. This encapsulates the entire program logic and all strings, but does not implement any concrete user interface.""" def __init__(self): """Initialize system.""" <|body_0|> def _(self, str, convert_keybindings=False): """Keyb...
stack_v2_sparse_classes_36k_train_029187
2,804
no_license
[ { "docstring": "Initialize system.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Keyboard accelerator aware gettext() wrapper. This optionally converts keyboard accelerators to the appropriate format for the frontend. All strings in the source code should use the '_'...
3
stack_v2_sparse_classes_30k_train_016074
Implement the Python class `AbstractUI` described below. Class description: Abstract user interface. This encapsulates the entire program logic and all strings, but does not implement any concrete user interface. Method signatures and docstrings: - def __init__(self): Initialize system. - def _(self, str, convert_key...
Implement the Python class `AbstractUI` described below. Class description: Abstract user interface. This encapsulates the entire program logic and all strings, but does not implement any concrete user interface. Method signatures and docstrings: - def __init__(self): Initialize system. - def _(self, str, convert_key...
d08f7bf370a82b6970387bb9f165d374a9d9092b
<|skeleton|> class AbstractUI: """Abstract user interface. This encapsulates the entire program logic and all strings, but does not implement any concrete user interface.""" def __init__(self): """Initialize system.""" <|body_0|> def _(self, str, convert_keybindings=False): """Keyb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractUI: """Abstract user interface. This encapsulates the entire program logic and all strings, but does not implement any concrete user interface.""" def __init__(self): """Initialize system.""" self.gettext_domain = 'screen-resolution-extra' gettext.textdomain(self.gettext_d...
the_stack_v2_python_sparse
usr/share/pyshared/ScreenResolution/ui.py
haniokasai/netwalker-rootfs
train
2
b01b756a452aeb8a72bf22532397daf9d4c3037c
[ "count = 0\nfor i in range(len(dominoes) - 1):\n for j in range(i + 1, len(dominoes)):\n if dominoes[i][0] == dominoes[j][0] and dominoes[i][1] == dominoes[j][1] or (dominoes[i][1] == dominoes[j][0] and dominoes[i][0] == dominoes[j][1]):\n count += 1\nreturn count", "data = {}\nfor domino in ...
<|body_start_0|> count = 0 for i in range(len(dominoes) - 1): for j in range(i + 1, len(dominoes)): if dominoes[i][0] == dominoes[j][0] and dominoes[i][1] == dominoes[j][1] or (dominoes[i][1] == dominoes[j][0] and dominoes[i][0] == dominoes[j][1]): count +...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _numEquivDominoPairs(self, dominoes): """:type dominoes: List[List[int]] :rtype: int""" <|body_0|> def numEquivDominoPairs(self, dominoes): """:type dominoes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_029188
1,904
permissive
[ { "docstring": ":type dominoes: List[List[int]] :rtype: int", "name": "_numEquivDominoPairs", "signature": "def _numEquivDominoPairs(self, dominoes)" }, { "docstring": ":type dominoes: List[List[int]] :rtype: int", "name": "numEquivDominoPairs", "signature": "def numEquivDominoPairs(self...
2
stack_v2_sparse_classes_30k_val_000430
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _numEquivDominoPairs(self, dominoes): :type dominoes: List[List[int]] :rtype: int - def numEquivDominoPairs(self, dominoes): :type dominoes: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _numEquivDominoPairs(self, dominoes): :type dominoes: List[List[int]] :rtype: int - def numEquivDominoPairs(self, dominoes): :type dominoes: List[List[int]] :rtype: int <|sk...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _numEquivDominoPairs(self, dominoes): """:type dominoes: List[List[int]] :rtype: int""" <|body_0|> def numEquivDominoPairs(self, dominoes): """:type dominoes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _numEquivDominoPairs(self, dominoes): """:type dominoes: List[List[int]] :rtype: int""" count = 0 for i in range(len(dominoes) - 1): for j in range(i + 1, len(dominoes)): if dominoes[i][0] == dominoes[j][0] and dominoes[i][1] == dominoes[j][1] ...
the_stack_v2_python_sparse
1128.number-of-equivalent-domino-pairs.py
windard/leeeeee
train
0
5b632ecf324ee12503ad2107bdcf75f72041b9a0
[ "proof = 0\nwhile self.valid_proof(last_proof, proof) is False:\n proof += 1\nreturn proof", "guess = f'{last_proof}{proof}'.encode()\nguess_hash = hashlib.sha256(guess).hexdigest()\nreturn guess_hash[:4] == '0000'" ]
<|body_start_0|> proof = 0 while self.valid_proof(last_proof, proof) is False: proof += 1 return proof <|end_body_0|> <|body_start_1|> guess = f'{last_proof}{proof}'.encode() guess_hash = hashlib.sha256(guess).hexdigest() return guess_hash[:4] == '0000' <|end...
Blockchain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blockchain: def proof_of_work(self, last_proof): """Algoritmo Simple de Prueba de Trabajo: Buscar un número p' tal que hash(pp') contenga 4 ceros a la izquierda, donde p es la anterior p''. p es la prueba anterior, y p' es la nueva prueba :param last_proof: <int> :return: <int>""" ...
stack_v2_sparse_classes_36k_train_029189
11,891
no_license
[ { "docstring": "Algoritmo Simple de Prueba de Trabajo: Buscar un número p' tal que hash(pp') contenga 4 ceros a la izquierda, donde p es la anterior p''. p es la prueba anterior, y p' es la nueva prueba :param last_proof: <int> :return: <int>", "name": "proof_of_work", "signature": "def proof_of_work(se...
2
stack_v2_sparse_classes_30k_train_018640
Implement the Python class `Blockchain` described below. Class description: Implement the Blockchain class. Method signatures and docstrings: - def proof_of_work(self, last_proof): Algoritmo Simple de Prueba de Trabajo: Buscar un número p' tal que hash(pp') contenga 4 ceros a la izquierda, donde p es la anterior p''....
Implement the Python class `Blockchain` described below. Class description: Implement the Blockchain class. Method signatures and docstrings: - def proof_of_work(self, last_proof): Algoritmo Simple de Prueba de Trabajo: Buscar un número p' tal que hash(pp') contenga 4 ceros a la izquierda, donde p es la anterior p''....
daba4247cca90c43a979e3e3f292cd7b8951b3d0
<|skeleton|> class Blockchain: def proof_of_work(self, last_proof): """Algoritmo Simple de Prueba de Trabajo: Buscar un número p' tal que hash(pp') contenga 4 ceros a la izquierda, donde p es la anterior p''. p es la prueba anterior, y p' es la nueva prueba :param last_proof: <int> :return: <int>""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Blockchain: def proof_of_work(self, last_proof): """Algoritmo Simple de Prueba de Trabajo: Buscar un número p' tal que hash(pp') contenga 4 ceros a la izquierda, donde p es la anterior p''. p es la prueba anterior, y p' es la nueva prueba :param last_proof: <int> :return: <int>""" proof = 0 ...
the_stack_v2_python_sparse
Blockchain/Blockchain1.py
mecomontes/Python
train
1
ad39751cc6ac7cc54e2738609dcdf25f520f1150
[ "self.module = module\nself.model_parallel_group = model_parallel_group\nself.model_parallel_world_size = 1 if self.model_parallel_group is None else dist.get_world_size(self.model_parallel_group)\nself.parallelism = parallelism", "dim1_size = self.module.weight.size(1)\nif self.parallelism == 'input':\n x = d...
<|body_start_0|> self.module = module self.model_parallel_group = model_parallel_group self.model_parallel_world_size = 1 if self.model_parallel_group is None else dist.get_world_size(self.model_parallel_group) self.parallelism = parallelism <|end_body_0|> <|body_start_1|> dim1_...
ModuleHelper for GPTNeoX layers.
GPTNeoXLinearModuleHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GPTNeoXLinearModuleHelper: """ModuleHelper for GPTNeoX layers.""" def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']): """Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model...
stack_v2_sparse_classes_36k_train_029190
2,162
permissive
[ { "docstring": "Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model_parallel_group (ProcessGroup): model parallel distributed process group this rank belongs to. If None, it is assumed model parallelism size is 1 (i.e., there is no model parallelism). parallelism (str): \"input\" i...
3
stack_v2_sparse_classes_30k_train_003584
Implement the Python class `GPTNeoXLinearModuleHelper` described below. Class description: ModuleHelper for GPTNeoX layers. Method signatures and docstrings: - def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']): Init ModuleHelper. Args:...
Implement the Python class `GPTNeoXLinearModuleHelper` described below. Class description: ModuleHelper for GPTNeoX layers. Method signatures and docstrings: - def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']): Init ModuleHelper. Args:...
e2b0c7dd1b1534e53389e7af9c070164b50b5968
<|skeleton|> class GPTNeoXLinearModuleHelper: """ModuleHelper for GPTNeoX layers.""" def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']): """Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GPTNeoXLinearModuleHelper: """ModuleHelper for GPTNeoX layers.""" def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']): """Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model_parallel_gro...
the_stack_v2_python_sparse
kfac/gpt_neox/modules.py
gpauloski/kfac-pytorch
train
29
cd2f4524b8b0f1bf5869c7228957671d012236c2
[ "super().__init__()\nassert (kernel_size - 1) % 2 == 0\nself.kernel_size = kernel_size\nself.pointwise_conv1 = torch.nn.Conv1d(channels, 2 * channels, kernel_size=1, stride=1, padding=0)\nif causal:\n self.lorder = kernel_size - 1\n padding = 0\nelse:\n self.lorder = 0\n padding = (kernel_size - 1) // 2...
<|body_start_0|> super().__init__() assert (kernel_size - 1) % 2 == 0 self.kernel_size = kernel_size self.pointwise_conv1 = torch.nn.Conv1d(channels, 2 * channels, kernel_size=1, stride=1, padding=0) if causal: self.lorder = kernel_size - 1 padding = 0 ...
ConformerConvolution module definition. Args: channels: The number of channels. kernel_size: Size of the convolving kernel. activation: Activation function. norm_args: Normalization module arguments. causal: Whether to use causal convolution (set to True if streaming).
ConformerConvolution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConformerConvolution: """ConformerConvolution module definition. Args: channels: The number of channels. kernel_size: Size of the convolving kernel. activation: Activation function. norm_args: Normalization module arguments. causal: Whether to use causal convolution (set to True if streaming)."""...
stack_v2_sparse_classes_36k_train_029191
7,416
permissive
[ { "docstring": "Construct an ConformerConvolution object.", "name": "__init__", "signature": "def __init__(self, channels: int, kernel_size: int, activation: torch.nn.Module=torch.nn.ReLU(), norm_args: Dict={}, causal: bool=False) -> None" }, { "docstring": "Compute convolution module. Args: x: ...
2
null
Implement the Python class `ConformerConvolution` described below. Class description: ConformerConvolution module definition. Args: channels: The number of channels. kernel_size: Size of the convolving kernel. activation: Activation function. norm_args: Normalization module arguments. causal: Whether to use causal con...
Implement the Python class `ConformerConvolution` described below. Class description: ConformerConvolution module definition. Args: channels: The number of channels. kernel_size: Size of the convolving kernel. activation: Activation function. norm_args: Normalization module arguments. causal: Whether to use causal con...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class ConformerConvolution: """ConformerConvolution module definition. Args: channels: The number of channels. kernel_size: Size of the convolving kernel. activation: Activation function. norm_args: Normalization module arguments. causal: Whether to use causal convolution (set to True if streaming)."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConformerConvolution: """ConformerConvolution module definition. Args: channels: The number of channels. kernel_size: Size of the convolving kernel. activation: Activation function. norm_args: Normalization module arguments. causal: Whether to use causal convolution (set to True if streaming).""" def __i...
the_stack_v2_python_sparse
espnet2/asr_transducer/encoder/modules/convolution.py
espnet/espnet
train
7,242
f54aeed44b551aa2eb2a75dd4d85bccd44a97262
[ "result = '{key:s}{type:s}'.format(key=self.oauth_consumer_key, type=' [cs]' if self.consumer_site_id else ' [pl]' if self.playlist_id else '')\nif self.deleted:\n result = _('{:s}[deleted]').format(result)\nreturn result", "if self.consumer_site and self.playlist:\n message = _('You should set either a Con...
<|body_start_0|> result = '{key:s}{type:s}'.format(key=self.oauth_consumer_key, type=' [cs]' if self.consumer_site_id else ' [pl]' if self.playlist_id else '') if self.deleted: result = _('{:s}[deleted]').format(result) return result <|end_body_0|> <|body_start_1|> if self.c...
Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instructor. A playlist pre-exists in Marsha. Th...
LTIPassport
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LTIPassport: """Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instruct...
stack_v2_sparse_classes_36k_train_029192
20,635
permissive
[ { "docstring": "Get the string representation of an instance.", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Clean instance fields before saving.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Generate the oauth consumer key and sha...
3
stack_v2_sparse_classes_30k_train_015972
Implement the Python class `LTIPassport` described below. Class description: Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlis...
Implement the Python class `LTIPassport` described below. Class description: Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlis...
f767f1bdc12c9712f26ea17cb8b19f536389f0ed
<|skeleton|> class LTIPassport: """Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instruct...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LTIPassport: """Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instructor. A playlis...
the_stack_v2_python_sparse
src/backend/marsha/core/models/account.py
openfun/marsha
train
92
13c028befe5a2a313429babf1c5f74bd7ca142b7
[ "if self.storage_manager.state == 1:\n repseq_map_gen = self.find_rid_by_tid(ids, subs=subs, iterator=True)\n\n def acc_generator():\n \"\"\"\"\"\"\n for taxon_id, repseq_ids in repseq_map_gen:\n yield (taxon_id, self._retrieve_accs_by_id(repseq_ids))\n acc_gen = acc_generator()\n ...
<|body_start_0|> if self.storage_manager.state == 1: repseq_map_gen = self.find_rid_by_tid(ids, subs=subs, iterator=True) def acc_generator(): """""" for taxon_id, repseq_ids in repseq_map_gen: yield (taxon_id, self._retrieve_accs_by_i...
Mixin class for handling accession numbers data.
DatabaseAccessionMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseAccessionMixin: """Mixin class for handling accession numbers data.""" def get_accession_by_tid(self, ids: Optional[AnyGenericIdentifier]=None, subs: bool=False, iterator: bool=True) -> Union[Dict[GenericIdentifier, Dict[str, str]], Generator[Tuple[GenericIdentifier, Dict[str, str]],...
stack_v2_sparse_classes_36k_train_029193
3,852
permissive
[ { "docstring": "Get accession numbers from the database. Parameters ---------- ids Target :term:`tids`. Use None for all :term:`tids` subs If True :term:`subs` will be included. Default is False. iterator If True return a generator object. Default is True. Returns ------- If `iterator` is True Returns a :class:...
3
null
Implement the Python class `DatabaseAccessionMixin` described below. Class description: Mixin class for handling accession numbers data. Method signatures and docstrings: - def get_accession_by_tid(self, ids: Optional[AnyGenericIdentifier]=None, subs: bool=False, iterator: bool=True) -> Union[Dict[GenericIdentifier, ...
Implement the Python class `DatabaseAccessionMixin` described below. Class description: Mixin class for handling accession numbers data. Method signatures and docstrings: - def get_accession_by_tid(self, ids: Optional[AnyGenericIdentifier]=None, subs: bool=False, iterator: bool=True) -> Union[Dict[GenericIdentifier, ...
028364e018f5f22a89aef9d4a86df9ba706747b5
<|skeleton|> class DatabaseAccessionMixin: """Mixin class for handling accession numbers data.""" def get_accession_by_tid(self, ids: Optional[AnyGenericIdentifier]=None, subs: bool=False, iterator: bool=True) -> Union[Dict[GenericIdentifier, Dict[str, str]], Generator[Tuple[GenericIdentifier, Dict[str, str]],...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseAccessionMixin: """Mixin class for handling accession numbers data.""" def get_accession_by_tid(self, ids: Optional[AnyGenericIdentifier]=None, subs: bool=False, iterator: bool=True) -> Union[Dict[GenericIdentifier, Dict[str, str]], Generator[Tuple[GenericIdentifier, Dict[str, str]], None, None]]...
the_stack_v2_python_sparse
pmaf/database/_core/_acs_base.py
mmtechslv/PhyloMAF
train
1
5b1951ca4052c764fabe5b2de4fc4aef32f6bd68
[ "if n == 1:\n return '1'\nif n == 2:\n return '11'\nresult = '11'\nflag = 2\nwhile flag < n:\n result = self.count(result)\n flag += 1\nreturn result", "index = []\ncount = []\nindex.append(input[0])\ncount.append(1)\nfor i in range(1, len(input)):\n if input[i] == input[i - 1]:\n count[-1] ...
<|body_start_0|> if n == 1: return '1' if n == 2: return '11' result = '11' flag = 2 while flag < n: result = self.count(result) flag += 1 return result <|end_body_0|> <|body_start_1|> index = [] count = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countAndSay(self, n: int) -> str: """主函数,控制遍历描述函数的次数 :param n: :return:""" <|body_0|> def count(self, input): """对上一次结果描述的函数 :param input: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 1: return '1' ...
stack_v2_sparse_classes_36k_train_029194
2,116
no_license
[ { "docstring": "主函数,控制遍历描述函数的次数 :param n: :return:", "name": "countAndSay", "signature": "def countAndSay(self, n: int) -> str" }, { "docstring": "对上一次结果描述的函数 :param input: :return:", "name": "count", "signature": "def count(self, input)" } ]
2
stack_v2_sparse_classes_30k_test_000558
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay(self, n: int) -> str: 主函数,控制遍历描述函数的次数 :param n: :return: - def count(self, input): 对上一次结果描述的函数 :param input: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay(self, n: int) -> str: 主函数,控制遍历描述函数的次数 :param n: :return: - def count(self, input): 对上一次结果描述的函数 :param input: :return: <|skeleton|> class Solution: def count...
fa45cd44c3d4e7b0205833efcdc708d1638cbbe4
<|skeleton|> class Solution: def countAndSay(self, n: int) -> str: """主函数,控制遍历描述函数的次数 :param n: :return:""" <|body_0|> def count(self, input): """对上一次结果描述的函数 :param input: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countAndSay(self, n: int) -> str: """主函数,控制遍历描述函数的次数 :param n: :return:""" if n == 1: return '1' if n == 2: return '11' result = '11' flag = 2 while flag < n: result = self.count(result) flag += 1 ...
the_stack_v2_python_sparse
Python/t38.py
g-lyc/LeetCode
train
15
4530e501baae4bb0e5befc7809451034758d92c6
[ "if loot_actions is None:\n return False\nloot_actions.apply_to_resolver(resolver)\nreturn True", "loot_actions = CommonLootActionUtils.load_loot_actions_by_id(loot_actions_id)\nif loot_actions is None:\n return False\nloot_actions.apply_to_resolver(resolver)\nreturn True", "has_applied_at_least_one = Fal...
<|body_start_0|> if loot_actions is None: return False loot_actions.apply_to_resolver(resolver) return True <|end_body_0|> <|body_start_1|> loot_actions = CommonLootActionUtils.load_loot_actions_by_id(loot_actions_id) if loot_actions is None: return False...
Utilities for manipulating Loot Actions.
CommonLootActionUtils
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonLootActionUtils: """Utilities for manipulating Loot Actions.""" def apply_loot_actions_using_resolver(loot_actions: LootActions, resolver: Resolver) -> bool: """apply_loot_actions_using_resolver(loot_actions, resolver) Apply loot actions using a resolver. :param loot_actions: T...
stack_v2_sparse_classes_36k_train_029195
4,906
permissive
[ { "docstring": "apply_loot_actions_using_resolver(loot_actions, resolver) Apply loot actions using a resolver. :param loot_actions: The loot actions to apply. :type loot_actions: LootActions :param resolver: A resolver used in various ways by loot actions. The resolver could be a SingleSimResolver, which will a...
4
null
Implement the Python class `CommonLootActionUtils` described below. Class description: Utilities for manipulating Loot Actions. Method signatures and docstrings: - def apply_loot_actions_using_resolver(loot_actions: LootActions, resolver: Resolver) -> bool: apply_loot_actions_using_resolver(loot_actions, resolver) Ap...
Implement the Python class `CommonLootActionUtils` described below. Class description: Utilities for manipulating Loot Actions. Method signatures and docstrings: - def apply_loot_actions_using_resolver(loot_actions: LootActions, resolver: Resolver) -> bool: apply_loot_actions_using_resolver(loot_actions, resolver) Ap...
58e7beb30b9c818b294d35abd2436a0192cd3e82
<|skeleton|> class CommonLootActionUtils: """Utilities for manipulating Loot Actions.""" def apply_loot_actions_using_resolver(loot_actions: LootActions, resolver: Resolver) -> bool: """apply_loot_actions_using_resolver(loot_actions, resolver) Apply loot actions using a resolver. :param loot_actions: T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonLootActionUtils: """Utilities for manipulating Loot Actions.""" def apply_loot_actions_using_resolver(loot_actions: LootActions, resolver: Resolver) -> bool: """apply_loot_actions_using_resolver(loot_actions, resolver) Apply loot actions using a resolver. :param loot_actions: The loot actio...
the_stack_v2_python_sparse
Scripts/sims4communitylib/utils/resources/common_loot_action_utils.py
ColonolNutty/Sims4CommunityLibrary
train
183
14ae5040f647c5c2727a54de11be143983505526
[ "if self.type_transformation is not None:\n self.type_transformation = self.type_transformation.upper()\n if self.type_transformation not in ['AA', 'AD', 'DA', 'DD']:\n raise ValueError(f\"Invalid type transformation: {self.type_transformation}\\nValid values are 'AA', 'AD', 'DA' and 'DD'.\")\nif self....
<|body_start_0|> if self.type_transformation is not None: self.type_transformation = self.type_transformation.upper() if self.type_transformation not in ['AA', 'AD', 'DA', 'DD']: raise ValueError(f"Invalid type transformation: {self.type_transformation}\nValid values are ...
Describes the transformation of a signal.
SignalTransformation
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalTransformation: """Describes the transformation of a signal.""" def __post_init__(self): """Perform some tests after construction.""" <|body_0|> def _evaluate_function(self): """Evaluate the internal function.""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_029196
37,433
permissive
[ { "docstring": "Perform some tests after construction.", "name": "__post_init__", "signature": "def __post_init__(self)" }, { "docstring": "Evaluate the internal function.", "name": "_evaluate_function", "signature": "def _evaluate_function(self)" } ]
2
null
Implement the Python class `SignalTransformation` described below. Class description: Describes the transformation of a signal. Method signatures and docstrings: - def __post_init__(self): Perform some tests after construction. - def _evaluate_function(self): Evaluate the internal function.
Implement the Python class `SignalTransformation` described below. Class description: Describes the transformation of a signal. Method signatures and docstrings: - def __post_init__(self): Perform some tests after construction. - def _evaluate_function(self): Evaluate the internal function. <|skeleton|> class Signal...
7bc16a196ee669822f3663f3c7a08f6bbd0c76d5
<|skeleton|> class SignalTransformation: """Describes the transformation of a signal.""" def __post_init__(self): """Perform some tests after construction.""" <|body_0|> def _evaluate_function(self): """Evaluate the internal function.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignalTransformation: """Describes the transformation of a signal.""" def __post_init__(self): """Perform some tests after construction.""" if self.type_transformation is not None: self.type_transformation = self.type_transformation.upper() if self.type_transformat...
the_stack_v2_python_sparse
weldx/measurement.py
BAMWelDX/weldx
train
20
473f84025c780a0448ab090db9cf15a8a5a84ed1
[ "self.user_01 = get_user_model().objects.create_user(username='user_01', password='12345678')\nself.user_02 = get_user_model().objects.create_user(username='user_02', password='12345678')\nself.email_pref_01 = EmailPreference.objects.create(user_id=self.user_01.id)\nself.email_pref_02 = EmailPreference.objects.crea...
<|body_start_0|> self.user_01 = get_user_model().objects.create_user(username='user_01', password='12345678') self.user_02 = get_user_model().objects.create_user(username='user_02', password='12345678') self.email_pref_01 = EmailPreference.objects.create(user_id=self.user_01.id) self.ema...
Unsubscribe API test
UnsubscribeAPITest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnsubscribeAPITest: """Unsubscribe API test""" def setUp(self): """Set up""" <|body_0|> def test_unsubscribe(self): """Test unsubscribe""" <|body_1|> def test_unsubscribe_invalid_username(self): """Test unsubscribe with invalid username""" ...
stack_v2_sparse_classes_36k_train_029197
17,449
permissive
[ { "docstring": "Set up", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test unsubscribe", "name": "test_unsubscribe", "signature": "def test_unsubscribe(self)" }, { "docstring": "Test unsubscribe with invalid username", "name": "test_unsubscribe_invalid_u...
6
stack_v2_sparse_classes_30k_train_014112
Implement the Python class `UnsubscribeAPITest` described below. Class description: Unsubscribe API test Method signatures and docstrings: - def setUp(self): Set up - def test_unsubscribe(self): Test unsubscribe - def test_unsubscribe_invalid_username(self): Test unsubscribe with invalid username - def test_unsubscri...
Implement the Python class `UnsubscribeAPITest` described below. Class description: Unsubscribe API test Method signatures and docstrings: - def setUp(self): Set up - def test_unsubscribe(self): Test unsubscribe - def test_unsubscribe_invalid_username(self): Test unsubscribe with invalid username - def test_unsubscri...
cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8
<|skeleton|> class UnsubscribeAPITest: """Unsubscribe API test""" def setUp(self): """Set up""" <|body_0|> def test_unsubscribe(self): """Test unsubscribe""" <|body_1|> def test_unsubscribe_invalid_username(self): """Test unsubscribe with invalid username""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnsubscribeAPITest: """Unsubscribe API test""" def setUp(self): """Set up""" self.user_01 = get_user_model().objects.create_user(username='user_01', password='12345678') self.user_02 = get_user_model().objects.create_user(username='user_02', password='12345678') self.email...
the_stack_v2_python_sparse
user/tests.py
810Teams/clubs-and-events-backend
train
3
62cadba52319831c7d29cf0e345dad1244cba96d
[ "client = get_client_by_request(request)\ninfo = client.cmsi.get_msg_type()\nalls = info['data']\nfor app in alls:\n print(app['is_active'])\n print(app['label'])\n print(app['type'])\n print('*' * 30)\nreturn JsonResponse(info)", "receiver = request.GET.get('receiver')\ntitle = request.GET.get('title...
<|body_start_0|> client = get_client_by_request(request) info = client.cmsi.get_msg_type() alls = info['data'] for app in alls: print(app['is_active']) print(app['label']) print(app['type']) print('*' * 30) return JsonResponse(info)...
PaasCmsi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaasCmsi: def get_msg_type(cls, request): """查询消息发送类型""" <|body_0|> def send_mail(cls, request): """发送邮件""" <|body_1|> def send_sms(cls, request): """发送短信""" <|body_2|> def send_weixin(cls, request): """发送微信""" <|body...
stack_v2_sparse_classes_36k_train_029198
5,818
no_license
[ { "docstring": "查询消息发送类型", "name": "get_msg_type", "signature": "def get_msg_type(cls, request)" }, { "docstring": "发送邮件", "name": "send_mail", "signature": "def send_mail(cls, request)" }, { "docstring": "发送短信", "name": "send_sms", "signature": "def send_sms(cls, request...
4
null
Implement the Python class `PaasCmsi` described below. Class description: Implement the PaasCmsi class. Method signatures and docstrings: - def get_msg_type(cls, request): 查询消息发送类型 - def send_mail(cls, request): 发送邮件 - def send_sms(cls, request): 发送短信 - def send_weixin(cls, request): 发送微信
Implement the Python class `PaasCmsi` described below. Class description: Implement the PaasCmsi class. Method signatures and docstrings: - def get_msg_type(cls, request): 查询消息发送类型 - def send_mail(cls, request): 发送邮件 - def send_sms(cls, request): 发送短信 - def send_weixin(cls, request): 发送微信 <|skeleton|> class PaasCmsi...
1911aadda75fc25c78f6fb37852111deb50052c0
<|skeleton|> class PaasCmsi: def get_msg_type(cls, request): """查询消息发送类型""" <|body_0|> def send_mail(cls, request): """发送邮件""" <|body_1|> def send_sms(cls, request): """发送短信""" <|body_2|> def send_weixin(cls, request): """发送微信""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaasCmsi: def get_msg_type(cls, request): """查询消息发送类型""" client = get_client_by_request(request) info = client.cmsi.get_msg_type() alls = info['data'] for app in alls: print(app['is_active']) print(app['label']) print(app['type']) ...
the_stack_v2_python_sparse
BK/exam_api_test/home_application/api_views.py
Louis-King123/projects
train
0
59b06542a499b4a746f18f68ab1bb2b3ba8165d2
[ "if model._meta.app_label in LABELS:\n return model._meta.app_label\nreturn None", "if model._meta.app_label in LABELS:\n return model._meta.app_label\nreturn None", "db_label1 = obj1._meta.app_label\ndb_label2 = obj2._meta.app_label\nif db_label1 and db_label2:\n if db_label1 == db_label2:\n re...
<|body_start_0|> if model._meta.app_label in LABELS: return model._meta.app_label return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in LABELS: return model._meta.app_label return None <|end_body_1|> <|body_start_2|> db_label1 = obj1._m...
A router to control all database operations on models for different databases.
DatabaseAppsRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseAppsRouter: """A router to control all database operations on models for different databases.""" def db_for_read(self, model, **hints): """"Point all read operations to the specific database.""" <|body_0|> def db_for_write(self, model, **hints): """Point ...
stack_v2_sparse_classes_36k_train_029199
1,746
no_license
[ { "docstring": "\"Point all read operations to the specific database.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Point all write operations to the specific database.", "name": "db_for_write", "signature": "def db_for_write(self, model...
5
stack_v2_sparse_classes_30k_train_005378
Implement the Python class `DatabaseAppsRouter` described below. Class description: A router to control all database operations on models for different databases. Method signatures and docstrings: - def db_for_read(self, model, **hints): "Point all read operations to the specific database. - def db_for_write(self, mo...
Implement the Python class `DatabaseAppsRouter` described below. Class description: A router to control all database operations on models for different databases. Method signatures and docstrings: - def db_for_read(self, model, **hints): "Point all read operations to the specific database. - def db_for_write(self, mo...
1b0e863ff3977471f5a94ef7d990796a9e9669c4
<|skeleton|> class DatabaseAppsRouter: """A router to control all database operations on models for different databases.""" def db_for_read(self, model, **hints): """"Point all read operations to the specific database.""" <|body_0|> def db_for_write(self, model, **hints): """Point ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseAppsRouter: """A router to control all database operations on models for different databases.""" def db_for_read(self, model, **hints): """"Point all read operations to the specific database.""" if model._meta.app_label in LABELS: return model._meta.app_label r...
the_stack_v2_python_sparse
project/logchart/logchart/databaseRouter.py
P79N6A/project_code
train
0