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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ece1afccee207fb5f4f0d0a618404ff8017cc978 | [
"n_m = self.params['n_m']\nKp = self.params['K'] * pressure\ntht = self.params['tht']\nlang_load = Kp / (1.0 + Kp)\nreturn n_m * (lang_load + tht * lang_load ** 2 * (lang_load - 1))",
"def fun(x):\n return self.loading(x) - loading\nopt_res = optimize.root(fun, numpy.zeros_like(loading), method='hybr')\nif not... | <|body_start_0|>
n_m = self.params['n_m']
Kp = self.params['K'] * pressure
tht = self.params['tht']
lang_load = Kp / (1.0 + Kp)
return n_m * (lang_load + tht * lang_load ** 2 * (lang_load - 1))
<|end_body_0|>
<|body_start_1|>
def fun(x):
return self.loading(x... | Asymptotic approximation to the Temkin isotherm. .. math:: n(p) = n_m \\frac{K p}{1 + K p} + n_m \\theta (\\frac{K p}{1 + K p})^2 (\\frac{K p}{1 + K p} -1) Notes ----- The Temkin adsorption isotherm [#]_, like the Langmuir model, considers a surface with n_m identical adsorption sites, but takes into account adsorbate-... | TemkinApprox | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TemkinApprox:
"""Asymptotic approximation to the Temkin isotherm. .. math:: n(p) = n_m \\frac{K p}{1 + K p} + n_m \\theta (\\frac{K p}{1 + K p})^2 (\\frac{K p}{1 + K p} -1) Notes ----- The Temkin adsorption isotherm [#]_, like the Langmuir model, considers a surface with n_m identical adsorption ... | stack_v2_sparse_classes_36k_train_005400 | 4,511 | permissive | [
{
"docstring": "Calculate loading at specified pressure. Parameters ---------- pressure : float The pressure at which to calculate the loading. Returns ------- float Loading at specified pressure.",
"name": "loading",
"signature": "def loading(self, pressure)"
},
{
"docstring": "Calculate pressu... | 4 | null | Implement the Python class `TemkinApprox` described below.
Class description:
Asymptotic approximation to the Temkin isotherm. .. math:: n(p) = n_m \\frac{K p}{1 + K p} + n_m \\theta (\\frac{K p}{1 + K p})^2 (\\frac{K p}{1 + K p} -1) Notes ----- The Temkin adsorption isotherm [#]_, like the Langmuir model, considers a... | Implement the Python class `TemkinApprox` described below.
Class description:
Asymptotic approximation to the Temkin isotherm. .. math:: n(p) = n_m \\frac{K p}{1 + K p} + n_m \\theta (\\frac{K p}{1 + K p})^2 (\\frac{K p}{1 + K p} -1) Notes ----- The Temkin adsorption isotherm [#]_, like the Langmuir model, considers a... | 53ee47313ed9fe26be419e4801c123d0a65b2efc | <|skeleton|>
class TemkinApprox:
"""Asymptotic approximation to the Temkin isotherm. .. math:: n(p) = n_m \\frac{K p}{1 + K p} + n_m \\theta (\\frac{K p}{1 + K p})^2 (\\frac{K p}{1 + K p} -1) Notes ----- The Temkin adsorption isotherm [#]_, like the Langmuir model, considers a surface with n_m identical adsorption ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TemkinApprox:
"""Asymptotic approximation to the Temkin isotherm. .. math:: n(p) = n_m \\frac{K p}{1 + K p} + n_m \\theta (\\frac{K p}{1 + K p})^2 (\\frac{K p}{1 + K p} -1) Notes ----- The Temkin adsorption isotherm [#]_, like the Langmuir model, considers a surface with n_m identical adsorption sites, but ta... | the_stack_v2_python_sparse | src/pygaps/modelling/temkinapprox.py | pauliacomi/pyGAPS | train | 49 |
7d0250ed75e38452d7cccec1aca74a5d51e91b9d | [
"self.frequency_value_dict = {}\nself.recently_value_dict = collections.defaultdict(collections.OrderedDict)\nself.capacity = capacity\nself.min_frequency = 1",
"temp_value = -1\nif key in self.frequency_value_dict:\n temp_value, frequency = self.frequency_value_dict[key]\n self.frequency_value_dict[key] = ... | <|body_start_0|>
self.frequency_value_dict = {}
self.recently_value_dict = collections.defaultdict(collections.OrderedDict)
self.capacity = capacity
self.min_frequency = 1
<|end_body_0|>
<|body_start_1|>
temp_value = -1
if key in self.frequency_value_dict:
te... | LFUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFUCache:
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: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_005401 | 1,892 | 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: None",
"name": "pu... | 3 | null | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache 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: None | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache 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: None
<|sk... | dc45210cb2cc50bfefd8c21c865e6ee2163a022a | <|skeleton|>
class LFUCache:
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: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.frequency_value_dict = {}
self.recently_value_dict = collections.defaultdict(collections.OrderedDict)
self.capacity = capacity
self.min_frequency = 1
def get(self, key):
""":type key: in... | the_stack_v2_python_sparse | practice/solution/0460_lfu_cache.py | kesarb/leetcode-summary-python | train | 0 | |
acb197df35875cc73efc720d7e9664fd000c32c9 | [
"res = super(PayslipOverTime, self).get_inputs(contracts, date_to, date_from)\novertime_type = self.env.ref('ohrms_overtime.hr_salary_rule_overtime')\ncontract = self.contract_id\novertime_id_sub = self.env['hr.overtime.line'].search([('employee_id', '=', self.employee_id.id), ('overtime_id.state', '=', 'approve'),... | <|body_start_0|>
res = super(PayslipOverTime, self).get_inputs(contracts, date_to, date_from)
overtime_type = self.env.ref('ohrms_overtime.hr_salary_rule_overtime')
contract = self.contract_id
overtime_id_sub = self.env['hr.overtime.line'].search([('employee_id', '=', self.employee_id.id... | PayslipOverTime | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PayslipOverTime:
def get_inputs(self, contracts, date_from, date_to):
"""function used for writing overtime record in payslip input tree."""
<|body_0|>
def action_payslip_done(self):
"""function used for marking paid overtime request."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_005402 | 1,571 | no_license | [
{
"docstring": "function used for writing overtime record in payslip input tree.",
"name": "get_inputs",
"signature": "def get_inputs(self, contracts, date_from, date_to)"
},
{
"docstring": "function used for marking paid overtime request.",
"name": "action_payslip_done",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_005431 | Implement the Python class `PayslipOverTime` described below.
Class description:
Implement the PayslipOverTime class.
Method signatures and docstrings:
- def get_inputs(self, contracts, date_from, date_to): function used for writing overtime record in payslip input tree.
- def action_payslip_done(self): function used... | Implement the Python class `PayslipOverTime` described below.
Class description:
Implement the PayslipOverTime class.
Method signatures and docstrings:
- def get_inputs(self, contracts, date_from, date_to): function used for writing overtime record in payslip input tree.
- def action_payslip_done(self): function used... | 4fe19ca76523cf274a3a85c8bcad653100ff556f | <|skeleton|>
class PayslipOverTime:
def get_inputs(self, contracts, date_from, date_to):
"""function used for writing overtime record in payslip input tree."""
<|body_0|>
def action_payslip_done(self):
"""function used for marking paid overtime request."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PayslipOverTime:
def get_inputs(self, contracts, date_from, date_to):
"""function used for writing overtime record in payslip input tree."""
res = super(PayslipOverTime, self).get_inputs(contracts, date_to, date_from)
overtime_type = self.env.ref('ohrms_overtime.hr_salary_rule_overtime... | the_stack_v2_python_sparse | sub/community/ohrms_overtime/models/hr_payslip.py | ahmed-amine-ellouze/personal | train | 0 | |
e45d7f48ecca3703ad10a6076b5e4ee8d7e481e9 | [
"if not shaper:\n shaper = Shaper(func='join_documents_and_scores', inputs={'documents': 'documents'}, outputs=['documents'])\nif not sampler and retriever.mode != 'snippets':\n sampler = TopPSampler(top_p=0.95)\nself.pipeline = Pipeline()\nself.pipeline.add_node(component=retriever, name='Retriever', inputs=... | <|body_start_0|>
if not shaper:
shaper = Shaper(func='join_documents_and_scores', inputs={'documents': 'documents'}, outputs=['documents'])
if not sampler and retriever.mode != 'snippets':
sampler = TopPSampler(top_p=0.95)
self.pipeline = Pipeline()
self.pipeline.... | Pipeline for Generative Question Answering performed based on Documents returned from a web search engine. | WebQAPipeline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WebQAPipeline:
"""Pipeline for Generative Question Answering performed based on Documents returned from a web search engine."""
def __init__(self, retriever: WebRetriever, prompt_node: PromptNode, sampler: Optional[TopPSampler]=None, shaper: Optional[Shaper]=None):
""":param retrieve... | stack_v2_sparse_classes_36k_train_005403 | 41,634 | permissive | [
{
"docstring": ":param retriever: The WebRetriever used for retrieving documents from a web search engine. :param prompt_node: The PromptNode used for generating the answer based on retrieved documents. :param shaper: The Shaper used for transforming the documents and scores into a format that can be used by th... | 2 | null | Implement the Python class `WebQAPipeline` described below.
Class description:
Pipeline for Generative Question Answering performed based on Documents returned from a web search engine.
Method signatures and docstrings:
- def __init__(self, retriever: WebRetriever, prompt_node: PromptNode, sampler: Optional[TopPSampl... | Implement the Python class `WebQAPipeline` described below.
Class description:
Pipeline for Generative Question Answering performed based on Documents returned from a web search engine.
Method signatures and docstrings:
- def __init__(self, retriever: WebRetriever, prompt_node: PromptNode, sampler: Optional[TopPSampl... | 5f1256ac7e5734c2ea481e72cb7e02c34baf8c43 | <|skeleton|>
class WebQAPipeline:
"""Pipeline for Generative Question Answering performed based on Documents returned from a web search engine."""
def __init__(self, retriever: WebRetriever, prompt_node: PromptNode, sampler: Optional[TopPSampler]=None, shaper: Optional[Shaper]=None):
""":param retrieve... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WebQAPipeline:
"""Pipeline for Generative Question Answering performed based on Documents returned from a web search engine."""
def __init__(self, retriever: WebRetriever, prompt_node: PromptNode, sampler: Optional[TopPSampler]=None, shaper: Optional[Shaper]=None):
""":param retriever: The WebRet... | the_stack_v2_python_sparse | haystack/pipelines/standard_pipelines.py | deepset-ai/haystack | train | 10,599 |
64719fc657c551ac1c7f7629f9246dd462d4f9c2 | [
"assertEqual = self.assertEqual\nvalues = ['A', 'B', 'B', 'C']\naggregate = S3GroupAggregate('count', 'Example', values)\nassertEqual(aggregate.result, 3)\nvalues = None\naggregate = S3GroupAggregate('count', 'Example', values)\nassertEqual(aggregate.result, None)\nvalues = 17\naggregate = S3GroupAggregate('count',... | <|body_start_0|>
assertEqual = self.assertEqual
values = ['A', 'B', 'B', 'C']
aggregate = S3GroupAggregate('count', 'Example', values)
assertEqual(aggregate.result, 3)
values = None
aggregate = S3GroupAggregate('count', 'Example', values)
assertEqual(aggregate.res... | Tests for grouped items value aggregation methods | GroupAggregateTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupAggregateTests:
"""Tests for grouped items value aggregation methods"""
def testCount(self):
"""Test aggregation method 'count'"""
<|body_0|>
def testSum(self):
"""Test aggregation method 'sum'"""
<|body_1|>
def testMin(self):
"""Test ag... | stack_v2_sparse_classes_36k_train_005404 | 15,171 | permissive | [
{
"docstring": "Test aggregation method 'count'",
"name": "testCount",
"signature": "def testCount(self)"
},
{
"docstring": "Test aggregation method 'sum'",
"name": "testSum",
"signature": "def testSum(self)"
},
{
"docstring": "Test aggregation method 'min'",
"name": "testMin... | 6 | stack_v2_sparse_classes_30k_train_007070 | Implement the Python class `GroupAggregateTests` described below.
Class description:
Tests for grouped items value aggregation methods
Method signatures and docstrings:
- def testCount(self): Test aggregation method 'count'
- def testSum(self): Test aggregation method 'sum'
- def testMin(self): Test aggregation metho... | Implement the Python class `GroupAggregateTests` described below.
Class description:
Tests for grouped items value aggregation methods
Method signatures and docstrings:
- def testCount(self): Test aggregation method 'count'
- def testSum(self): Test aggregation method 'sum'
- def testMin(self): Test aggregation metho... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class GroupAggregateTests:
"""Tests for grouped items value aggregation methods"""
def testCount(self):
"""Test aggregation method 'count'"""
<|body_0|>
def testSum(self):
"""Test aggregation method 'sum'"""
<|body_1|>
def testMin(self):
"""Test ag... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupAggregateTests:
"""Tests for grouped items value aggregation methods"""
def testCount(self):
"""Test aggregation method 'count'"""
assertEqual = self.assertEqual
values = ['A', 'B', 'B', 'C']
aggregate = S3GroupAggregate('count', 'Example', values)
assertEqual... | the_stack_v2_python_sparse | modules/unit_tests/core/methods/grouped.py | nursix/drkcm | train | 3 |
da2f89f2c3d6dcff588b6b25b7dde4721b9db986 | [
"V = np.ones((neu_dim, x_dim)) / 2\nW = np.ones((output_dim, neu_dim)) / 2\nY = np.zeros(output_dim)\nV = normalization_all(V)\nself.V = V\nself.W = W\nself.Y = Y\nself.lr = lr\nself.lr_out = lr_out",
"z_layer = np.dot(self.V, x.T)\nargmax = np.argmax(z_layer)\nreturn argmax",
"self.V[argmax] = self.V[argmax] +... | <|body_start_0|>
V = np.ones((neu_dim, x_dim)) / 2
W = np.ones((output_dim, neu_dim)) / 2
Y = np.zeros(output_dim)
V = normalization_all(V)
self.V = V
self.W = W
self.Y = Y
self.lr = lr
self.lr_out = lr_out
<|end_body_0|>
<|body_start_1|>
... | competitive_network | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class competitive_network:
def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out):
"""类参数初始化"""
<|body_0|>
def forward_propagation(self, x):
"""前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针"""
<|body_1|>
def back_propagation(self,... | stack_v2_sparse_classes_36k_train_005405 | 4,419 | no_license | [
{
"docstring": "类参数初始化",
"name": "__init__",
"signature": "def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out)"
},
{
"docstring": "前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针",
"name": "forward_propagation",
"signature": "def forward_propagation(self, x... | 6 | stack_v2_sparse_classes_30k_train_005436 | Implement the Python class `competitive_network` described below.
Class description:
Implement the competitive_network class.
Method signatures and docstrings:
- def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out): 类参数初始化
- def forward_propagation(self, x): 前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argm... | Implement the Python class `competitive_network` described below.
Class description:
Implement the competitive_network class.
Method signatures and docstrings:
- def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out): 类参数初始化
- def forward_propagation(self, x): 前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argm... | 97e69c71af972f22c38b714b659a374d04c08b84 | <|skeleton|>
class competitive_network:
def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out):
"""类参数初始化"""
<|body_0|>
def forward_propagation(self, x):
"""前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针"""
<|body_1|>
def back_propagation(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class competitive_network:
def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out):
"""类参数初始化"""
V = np.ones((neu_dim, x_dim)) / 2
W = np.ones((output_dim, neu_dim)) / 2
Y = np.zeros(output_dim)
V = normalization_all(V)
self.V = V
self.W = W
self.Y ... | the_stack_v2_python_sparse | HW2/Hermit_7.py | gavinatthu/ANN_course | train | 3 | |
3be0109a7c24d1b4061202ed43865f34d4fc3d90 | [
"if obj is None:\n return\nassert os.path.exists(obj), f'path {obj} does not exist.'\nreturn shutil.make_archive(obj, 'tar', obj)",
"unpacked_file = os.path.splitext(value)[0]\nshutil.unpack_archive(value, unpacked_file)\nreturn unpacked_file"
] | <|body_start_0|>
if obj is None:
return
assert os.path.exists(obj), f'path {obj} does not exist.'
return shutil.make_archive(obj, 'tar', obj)
<|end_body_0|>
<|body_start_1|>
unpacked_file = os.path.splitext(value)[0]
shutil.unpack_archive(value, unpacked_file)
... | TarFolder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TarFolder:
def put(self, obj):
"""perform checks before putting and archive folder"""
<|body_0|>
def get(self, value):
"""unpack zip file"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if obj is None:
return
assert os.path.exist... | stack_v2_sparse_classes_36k_train_005406 | 14,064 | permissive | [
{
"docstring": "perform checks before putting and archive folder",
"name": "put",
"signature": "def put(self, obj)"
},
{
"docstring": "unpack zip file",
"name": "get",
"signature": "def get(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009955 | Implement the Python class `TarFolder` described below.
Class description:
Implement the TarFolder class.
Method signatures and docstrings:
- def put(self, obj): perform checks before putting and archive folder
- def get(self, value): unpack zip file | Implement the Python class `TarFolder` described below.
Class description:
Implement the TarFolder class.
Method signatures and docstrings:
- def put(self, obj): perform checks before putting and archive folder
- def get(self, value): unpack zip file
<|skeleton|>
class TarFolder:
def put(self, obj):
"""... | d375a2677ec0d28b5cbe3c350ecee929f20c24f9 | <|skeleton|>
class TarFolder:
def put(self, obj):
"""perform checks before putting and archive folder"""
<|body_0|>
def get(self, value):
"""unpack zip file"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TarFolder:
def put(self, obj):
"""perform checks before putting and archive folder"""
if obj is None:
return
assert os.path.exists(obj), f'path {obj} does not exist.'
return shutil.make_archive(obj, 'tar', obj)
def get(self, value):
"""unpack zip file""... | the_stack_v2_python_sparse | loris/database/attributes.py | gucky92/loris | train | 1 | |
27b5e1bb865c16e4fd297a102855c9e5fda50491 | [
"self.event_message = event_message\nself.percent_finished = percent_finished\nself.remaining_work_count = remaining_work_count\nself.timestamp_seconds = timestamp_seconds",
"if dictionary is None:\n return None\nevent_message = dictionary.get('eventMessage')\npercent_finished = dictionary.get('percentFinished... | <|body_start_0|>
self.event_message = event_message
self.percent_finished = percent_finished
self.remaining_work_count = remaining_work_count
self.timestamp_seconds = timestamp_seconds
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
event_m... | Implementation of the 'TaskEvent' model. Specifies events that clients can attach to a task. Attributes: event_message (string): Specifies the message associated with an event. percent_finished (float): Specifies the completion percentage of the task attached to this event. remaining_work_count (long|int): Specifies th... | TaskEvent | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskEvent:
"""Implementation of the 'TaskEvent' model. Specifies events that clients can attach to a task. Attributes: event_message (string): Specifies the message associated with an event. percent_finished (float): Specifies the completion percentage of the task attached to this event. remainin... | stack_v2_sparse_classes_36k_train_005407 | 2,430 | permissive | [
{
"docstring": "Constructor for the TaskEvent class",
"name": "__init__",
"signature": "def __init__(self, event_message=None, percent_finished=None, remaining_work_count=None, timestamp_seconds=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dicti... | 2 | stack_v2_sparse_classes_30k_train_001889 | Implement the Python class `TaskEvent` described below.
Class description:
Implementation of the 'TaskEvent' model. Specifies events that clients can attach to a task. Attributes: event_message (string): Specifies the message associated with an event. percent_finished (float): Specifies the completion percentage of th... | Implement the Python class `TaskEvent` described below.
Class description:
Implementation of the 'TaskEvent' model. Specifies events that clients can attach to a task. Attributes: event_message (string): Specifies the message associated with an event. percent_finished (float): Specifies the completion percentage of th... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class TaskEvent:
"""Implementation of the 'TaskEvent' model. Specifies events that clients can attach to a task. Attributes: event_message (string): Specifies the message associated with an event. percent_finished (float): Specifies the completion percentage of the task attached to this event. remainin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskEvent:
"""Implementation of the 'TaskEvent' model. Specifies events that clients can attach to a task. Attributes: event_message (string): Specifies the message associated with an event. percent_finished (float): Specifies the completion percentage of the task attached to this event. remaining_work_count ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/task_event.py | cohesity/management-sdk-python | train | 24 |
9e3753f3b2900bbe125069f85622c9543584fcb4 | [
"with get_resource_as_file('robust_loss_jax/data/partition_spline.npz') as spline_file:\n with jnp.load(spline_file, allow_pickle=False) as f:\n self._spline_x_scale = f['x_scale']\n self._spline_values = f['values']\n self._spline_tangents = f['tangents']",
"alpha = jnp.maximum(0, alpha)\... | <|body_start_0|>
with get_resource_as_file('robust_loss_jax/data/partition_spline.npz') as spline_file:
with jnp.load(spline_file, allow_pickle=False) as f:
self._spline_x_scale = f['x_scale']
self._spline_values = f['values']
self._spline_tangents = f... | A wrapper class around the distribution. | Distribution | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Distribution:
"""A wrapper class around the distribution."""
def __init__(self):
"""Initialize the distribution. Load the values, tangents, and x-coordinate scaling of a spline that approximates the partition function. The spline was produced by running the script in fit_partition_sp... | stack_v2_sparse_classes_36k_train_005408 | 9,638 | permissive | [
{
"docstring": "Initialize the distribution. Load the values, tangents, and x-coordinate scaling of a spline that approximates the partition function. The spline was produced by running the script in fit_partition_spline.py.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring... | 4 | null | Implement the Python class `Distribution` described below.
Class description:
A wrapper class around the distribution.
Method signatures and docstrings:
- def __init__(self): Initialize the distribution. Load the values, tangents, and x-coordinate scaling of a spline that approximates the partition function. The spli... | Implement the Python class `Distribution` described below.
Class description:
A wrapper class around the distribution.
Method signatures and docstrings:
- def __init__(self): Initialize the distribution. Load the values, tangents, and x-coordinate scaling of a spline that approximates the partition function. The spli... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class Distribution:
"""A wrapper class around the distribution."""
def __init__(self):
"""Initialize the distribution. Load the values, tangents, and x-coordinate scaling of a spline that approximates the partition function. The spline was produced by running the script in fit_partition_sp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Distribution:
"""A wrapper class around the distribution."""
def __init__(self):
"""Initialize the distribution. Load the values, tangents, and x-coordinate scaling of a spline that approximates the partition function. The spline was produced by running the script in fit_partition_spline.py."""
... | the_stack_v2_python_sparse | robust_loss_jax/distribution.py | Jimmy-INL/google-research | train | 1 |
ae27651030ffafda2ce526a54c26b95238f148eb | [
"self.nshoppers = nshoppers\nself.item_freq = ci / ci.sum()\nself.item_values = pv\nself.fcount = 0\nself.shoppers = []\nfor i in range(nshoppers):\n shopper = Shopper(self.item_freq, pv)\n self.shoppers.append(shopper)",
"self.fcount += 1\norder = np.argsort(p)\nrevenue = 0.0\nfor i in range(self.nshoppers... | <|body_start_0|>
self.nshoppers = nshoppers
self.item_freq = ci / ci.sum()
self.item_values = pv
self.fcount = 0
self.shoppers = []
for i in range(nshoppers):
shopper = Shopper(self.item_freq, pv)
self.shoppers.append(shopper)
<|end_body_0|>
<|bod... | Simulate a day's worth of customers | Objective | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Objective:
"""Simulate a day's worth of customers"""
def __init__(self, nshoppers, ci, pv):
"""Constructor"""
<|body_0|>
def Evaluate(self, p):
"""Evaluate an arrangement of products"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.nshoppers... | stack_v2_sparse_classes_36k_train_005409 | 6,050 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, nshoppers, ci, pv)"
},
{
"docstring": "Evaluate an arrangement of products",
"name": "Evaluate",
"signature": "def Evaluate(self, p)"
}
] | 2 | null | Implement the Python class `Objective` described below.
Class description:
Simulate a day's worth of customers
Method signatures and docstrings:
- def __init__(self, nshoppers, ci, pv): Constructor
- def Evaluate(self, p): Evaluate an arrangement of products | Implement the Python class `Objective` described below.
Class description:
Simulate a day's worth of customers
Method signatures and docstrings:
- def __init__(self, nshoppers, ci, pv): Constructor
- def Evaluate(self, p): Evaluate an arrangement of products
<|skeleton|>
class Objective:
"""Simulate a day's wort... | 5445b6f90ab49339ca0fdb71e98d44e6827c95a8 | <|skeleton|>
class Objective:
"""Simulate a day's worth of customers"""
def __init__(self, nshoppers, ci, pv):
"""Constructor"""
<|body_0|>
def Evaluate(self, p):
"""Evaluate an arrangement of products"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Objective:
"""Simulate a day's worth of customers"""
def __init__(self, nshoppers, ci, pv):
"""Constructor"""
self.nshoppers = nshoppers
self.item_freq = ci / ci.sum()
self.item_values = pv
self.fcount = 0
self.shoppers = []
for i in range(nshoppers... | the_stack_v2_python_sparse | store/store.py | dayoladejo/SwarmOptimization | train | 0 |
94cc6d2adfd1186347360a5dfe4e44be6ea3b3df | [
"bl = 1125 * np.log(1 + fl * fs / 700)\nbh = 1125 * np.log(1 + fh * fs / 700)\nB = bh - bl\ny = np.linspace(0, B, p + 2)\nFb = 700 * (np.exp(y / 1125) - 1)\nW = int(n / 2 + 1)\ndf = fs / n\nbank = np.zeros((p, W))\nfor m in range(1, p + 1):\n f0, f1, f2 = (Fb[m], Fb[m - 1], Fb[m + 1])\n n0 = f0 / df\n n1 =... | <|body_start_0|>
bl = 1125 * np.log(1 + fl * fs / 700)
bh = 1125 * np.log(1 + fh * fs / 700)
B = bh - bl
y = np.linspace(0, B, p + 2)
Fb = 700 * (np.exp(y / 1125) - 1)
W = int(n / 2 + 1)
df = fs / n
bank = np.zeros((p, W))
for m in range(1, p + 1):... | MFCC | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MFCC:
def melbankm(self, p, n, fs, fl=0, fh=0.5, w='t'):
"""再Mel频率上设计平均分布的滤波器 :param p: fl和fh之间设计的Mel滤波器的个数 :param n: FFT长度 :param fs: 采样频率 :param fl: 设计滤波器的最低频率(用fs归一化,一般取0) :param fh: 设计滤波器的最高频率(用fs归一化,一般取0.5) :param w: 窗函数,'t'=triangle,'n'=hanning, 'm'=hanmming :return bank: 滤波器频率响应,s... | stack_v2_sparse_classes_36k_train_005410 | 3,700 | permissive | [
{
"docstring": "再Mel频率上设计平均分布的滤波器 :param p: fl和fh之间设计的Mel滤波器的个数 :param n: FFT长度 :param fs: 采样频率 :param fl: 设计滤波器的最低频率(用fs归一化,一般取0) :param fh: 设计滤波器的最高频率(用fs归一化,一般取0.5) :param w: 窗函数,'t'=triangle,'n'=hanning, 'm'=hanmming :return bank: 滤波器频率响应,size = p x (n/2 + 1), 只取正频率部分",
"name": "melbankm",
"signatur... | 2 | null | Implement the Python class `MFCC` described below.
Class description:
Implement the MFCC class.
Method signatures and docstrings:
- def melbankm(self, p, n, fs, fl=0, fh=0.5, w='t'): 再Mel频率上设计平均分布的滤波器 :param p: fl和fh之间设计的Mel滤波器的个数 :param n: FFT长度 :param fs: 采样频率 :param fl: 设计滤波器的最低频率(用fs归一化,一般取0) :param fh: 设计滤波器的最高频... | Implement the Python class `MFCC` described below.
Class description:
Implement the MFCC class.
Method signatures and docstrings:
- def melbankm(self, p, n, fs, fl=0, fh=0.5, w='t'): 再Mel频率上设计平均分布的滤波器 :param p: fl和fh之间设计的Mel滤波器的个数 :param n: FFT长度 :param fs: 采样频率 :param fl: 设计滤波器的最低频率(用fs归一化,一般取0) :param fh: 设计滤波器的最高频... | 0074ad1d519387a75d5eca42c77f4d6966eb0a0e | <|skeleton|>
class MFCC:
def melbankm(self, p, n, fs, fl=0, fh=0.5, w='t'):
"""再Mel频率上设计平均分布的滤波器 :param p: fl和fh之间设计的Mel滤波器的个数 :param n: FFT长度 :param fs: 采样频率 :param fl: 设计滤波器的最低频率(用fs归一化,一般取0) :param fh: 设计滤波器的最高频率(用fs归一化,一般取0.5) :param w: 窗函数,'t'=triangle,'n'=hanning, 'm'=hanmming :return bank: 滤波器频率响应,s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MFCC:
def melbankm(self, p, n, fs, fl=0, fh=0.5, w='t'):
"""再Mel频率上设计平均分布的滤波器 :param p: fl和fh之间设计的Mel滤波器的个数 :param n: FFT长度 :param fs: 采样频率 :param fl: 设计滤波器的最低频率(用fs归一化,一般取0) :param fh: 设计滤波器的最高频率(用fs归一化,一般取0.5) :param w: 窗函数,'t'=triangle,'n'=hanning, 'm'=hanmming :return bank: 滤波器频率响应,size = p x (n/2... | the_stack_v2_python_sparse | Chapter6_VoiceActivityDetection/MFCC.py | BarryZM/Python_Speech_SZY | train | 0 | |
47467394cb163151c88d99a35e3adae766ac4f9a | [
"my_byte_array = bytearray(obj.read())\ncompressed_bytes = gzip.compress(my_byte_array)\nfileobj = io.BytesIO(compressed_bytes)\nfileobj.seek(0, os.SEEK_SET)\nreturn fileobj",
"if fileobj is None:\n return None\nmy_byte_array = bytearray(fileobj.read())\ndecompressed_bytes = gzip.decompress(my_byte_array)\nnew... | <|body_start_0|>
my_byte_array = bytearray(obj.read())
compressed_bytes = gzip.compress(my_byte_array)
fileobj = io.BytesIO(compressed_bytes)
fileobj.seek(0, os.SEEK_SET)
return fileobj
<|end_body_0|>
<|body_start_1|>
if fileobj is None:
return None
m... | A slightly different SerializationFormat for Gzip where the serialization goes into a buffer. from_object() is compression. to_object() is decompression. | BufferedGzipSerializationFormat | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BufferedGzipSerializationFormat:
"""A slightly different SerializationFormat for Gzip where the serialization goes into a buffer. from_object() is compression. to_object() is decompression."""
def from_object(self, obj):
""":param obj: The object to serialize :return: an open file-li... | stack_v2_sparse_classes_36k_train_005411 | 1,691 | no_license | [
{
"docstring": ":param obj: The object to serialize :return: an open file-like object for streaming the serialized bytes. Any file cursors should be set to the beginning of the data (ala seek to the beginning).",
"name": "from_object",
"signature": "def from_object(self, obj)"
},
{
"docstring": ... | 2 | null | Implement the Python class `BufferedGzipSerializationFormat` described below.
Class description:
A slightly different SerializationFormat for Gzip where the serialization goes into a buffer. from_object() is compression. to_object() is decompression.
Method signatures and docstrings:
- def from_object(self, obj): :pa... | Implement the Python class `BufferedGzipSerializationFormat` described below.
Class description:
A slightly different SerializationFormat for Gzip where the serialization goes into a buffer. from_object() is compression. to_object() is decompression.
Method signatures and docstrings:
- def from_object(self, obj): :pa... | 99c2f401d6c4b203ee439ed607985a918d0c3c7e | <|skeleton|>
class BufferedGzipSerializationFormat:
"""A slightly different SerializationFormat for Gzip where the serialization goes into a buffer. from_object() is compression. to_object() is decompression."""
def from_object(self, obj):
""":param obj: The object to serialize :return: an open file-li... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BufferedGzipSerializationFormat:
"""A slightly different SerializationFormat for Gzip where the serialization goes into a buffer. from_object() is compression. to_object() is decompression."""
def from_object(self, obj):
""":param obj: The object to serialize :return: an open file-like object for... | the_stack_v2_python_sparse | servicecommon/serialization/format/buffered_gzip_serialization_format.py | Cognizant-CDB-AIA-BAI-AI-OI/LEAF-ENN-Training-V2 | train | 0 |
607e7f6af826bb5e869c207cdd888f72a8a1d34d | [
"id = request.GET.get('id', '')\nshare_page_desc = ''\ntry:\n scanlottery = app_models.Scanlottery.objects.get(id=id)\n share_page_desc = scanlottery.name\nexcept:\n pass\nmember = request.member\nis_pc = False if member else True\nthumbnails_url = '/static_v2/img/thumbnails_lottery.png'\nc = RequestContex... | <|body_start_0|>
id = request.GET.get('id', '')
share_page_desc = ''
try:
scanlottery = app_models.Scanlottery.objects.get(id=id)
share_page_desc = scanlottery.name
except:
pass
member = request.member
is_pc = False if member else True
... | Mexlottery | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mexlottery:
def get(request):
"""响应GET"""
<|body_0|>
def api_get(request):
"""响应GET"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
id = request.GET.get('id', '')
share_page_desc = ''
try:
scanlottery = app_models.Scanlot... | stack_v2_sparse_classes_36k_train_005412 | 4,367 | no_license | [
{
"docstring": "响应GET",
"name": "get",
"signature": "def get(request)"
},
{
"docstring": "响应GET",
"name": "api_get",
"signature": "def api_get(request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001033 | Implement the Python class `Mexlottery` described below.
Class description:
Implement the Mexlottery class.
Method signatures and docstrings:
- def get(request): 响应GET
- def api_get(request): 响应GET | Implement the Python class `Mexlottery` described below.
Class description:
Implement the Mexlottery class.
Method signatures and docstrings:
- def get(request): 响应GET
- def api_get(request): 响应GET
<|skeleton|>
class Mexlottery:
def get(request):
"""响应GET"""
<|body_0|>
def api_get(request):... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class Mexlottery:
def get(request):
"""响应GET"""
<|body_0|>
def api_get(request):
"""响应GET"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mexlottery:
def get(request):
"""响应GET"""
id = request.GET.get('id', '')
share_page_desc = ''
try:
scanlottery = app_models.Scanlottery.objects.get(id=id)
share_page_desc = scanlottery.name
except:
pass
member = request.member... | the_stack_v2_python_sparse | weapp/apps/customerized_apps/scanlottery/m_scanlottery_page.py | chengdg/weizoom | train | 1 | |
8f9cc4a549f5a659488e6f4098dcfd8f5093f74c | [
"if msg is None:\n msg = '\"%s\" not found in \"%s\"' % (a, b)\nself.assert_(a in b, msg)",
"if msg is None:\n msg = '\"%s\" unexpectedly found in \"%s\"' % (a, b)\nself.assert_(a not in b, msg)",
"if chart is None:\n chart = self.chart\nparams = chart.display._Params(chart)\nreturn params[param_name]"... | <|body_start_0|>
if msg is None:
msg = '"%s" not found in "%s"' % (a, b)
self.assert_(a in b, msg)
<|end_body_0|>
<|body_start_1|>
if msg is None:
msg = '"%s" unexpectedly found in "%s"' % (a, b)
self.assert_(a not in b, msg)
<|end_body_1|>
<|body_start_2|>
... | Base class for other Graphy tests. | GraphyTest | [
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphyTest:
"""Base class for other Graphy tests."""
def assertIn(self, a, b, msg=None):
"""Just like self.assert_(a in b), but with a nicer default message."""
<|body_0|>
def assertNotIn(self, a, b, msg=None):
"""Just like self.assert_(a not in b), but with a ni... | stack_v2_sparse_classes_36k_train_005413 | 1,509 | permissive | [
{
"docstring": "Just like self.assert_(a in b), but with a nicer default message.",
"name": "assertIn",
"signature": "def assertIn(self, a, b, msg=None)"
},
{
"docstring": "Just like self.assert_(a not in b), but with a nicer default message.",
"name": "assertNotIn",
"signature": "def as... | 3 | null | Implement the Python class `GraphyTest` described below.
Class description:
Base class for other Graphy tests.
Method signatures and docstrings:
- def assertIn(self, a, b, msg=None): Just like self.assert_(a in b), but with a nicer default message.
- def assertNotIn(self, a, b, msg=None): Just like self.assert_(a not... | Implement the Python class `GraphyTest` described below.
Class description:
Base class for other Graphy tests.
Method signatures and docstrings:
- def assertIn(self, a, b, msg=None): Just like self.assert_(a in b), but with a nicer default message.
- def assertNotIn(self, a, b, msg=None): Just like self.assert_(a not... | 53102de187a48ac2cfc241fef54dcbc29c453a8e | <|skeleton|>
class GraphyTest:
"""Base class for other Graphy tests."""
def assertIn(self, a, b, msg=None):
"""Just like self.assert_(a in b), but with a nicer default message."""
<|body_0|>
def assertNotIn(self, a, b, msg=None):
"""Just like self.assert_(a not in b), but with a ni... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphyTest:
"""Base class for other Graphy tests."""
def assertIn(self, a, b, msg=None):
"""Just like self.assert_(a in b), but with a nicer default message."""
if msg is None:
msg = '"%s" not found in "%s"' % (a, b)
self.assert_(a in b, msg)
def assertNotIn(self,... | the_stack_v2_python_sparse | third_party/graphy/graphy/graphy_test.py | catapult-project/catapult | train | 2,032 |
71ab720905f8924866122febd63bc1b2c24591e1 | [
"if not quota_max_calls:\n use_rate_limiter = False\nself._services = None\nsuper(ServiceManagementRepositoryClient, self).__init__(API_NAME, versions=['v1'], quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limiter=use_rate_limiter)",
"if not self._services:\n self._services = self._ini... | <|body_start_0|>
if not quota_max_calls:
use_rate_limiter = False
self._services = None
super(ServiceManagementRepositoryClient, self).__init__(API_NAME, versions=['v1'], quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limiter=use_rate_limiter)
<|end_body_0|>
<|... | Service Management API Respository. | ServiceManagementRepositoryClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceManagementRepositoryClient:
"""Service Management API Respository."""
def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True):
"""Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The ti... | stack_v2_sparse_classes_36k_train_005414 | 13,031 | permissive | [
{
"docstring": "Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests over. use_rate_limiter (bool): Set to false to disable the use of a rate limiter for this service.",
"name": "__init__",
"signature": "def __... | 2 | stack_v2_sparse_classes_30k_train_010561 | Implement the Python class `ServiceManagementRepositoryClient` described below.
Class description:
Service Management API Respository.
Method signatures and docstrings:
- def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per... | Implement the Python class `ServiceManagementRepositoryClient` described below.
Class description:
Service Management API Respository.
Method signatures and docstrings:
- def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per... | d4421afa50a17ed47cbebe942044ebab3720e0f5 | <|skeleton|>
class ServiceManagementRepositoryClient:
"""Service Management API Respository."""
def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True):
"""Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The ti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ServiceManagementRepositoryClient:
"""Service Management API Respository."""
def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True):
"""Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to ... | the_stack_v2_python_sparse | google/cloud/forseti/common/gcp_api/servicemanagement.py | kevensen/forseti-security | train | 1 |
50aa98647a053bd1ca9107cb807bd870a929bc12 | [
"path = os.path.join(os.path.join(dirPath, 'spider'), sourceName)\nallFiles = []\nfor dir in os.listdir(path):\n tarPath = os.path.join(path, dir)\n if os.path.isdir(tarPath):\n files = [file for file in os.listdir(tarPath) if os.path.isfile(os.path.join(tarPath, file)) and os.path.splitext(file)[1] ==... | <|body_start_0|>
path = os.path.join(os.path.join(dirPath, 'spider'), sourceName)
allFiles = []
for dir in os.listdir(path):
tarPath = os.path.join(path, dir)
if os.path.isdir(tarPath):
files = [file for file in os.listdir(tarPath) if os.path.isfile(os.pat... | 系统控制类 | NewsController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewsController:
"""系统控制类"""
def newsFiles(self, operator, sourceName):
""":func 获取spider/sourceName/目录下爬取的各个新闻excel表 :param operator: 根据get或rm进行获取文件以及删除文件操作 sourceName:新闻网站文件夹 :return:获取文件操作返回文件名列表,删除文件,删除成功返回allFiles=False,表示目录下没有文件"""
<|body_0|>
def rmRepeate(self, *di... | stack_v2_sparse_classes_36k_train_005415 | 2,449 | no_license | [
{
"docstring": ":func 获取spider/sourceName/目录下爬取的各个新闻excel表 :param operator: 根据get或rm进行获取文件以及删除文件操作 sourceName:新闻网站文件夹 :return:获取文件操作返回文件名列表,删除文件,删除成功返回allFiles=False,表示目录下没有文件",
"name": "newsFiles",
"signature": "def newsFiles(self, operator, sourceName)"
},
{
"docstring": "func: 删除已经去重的文件 :para... | 2 | null | Implement the Python class `NewsController` described below.
Class description:
系统控制类
Method signatures and docstrings:
- def newsFiles(self, operator, sourceName): :func 获取spider/sourceName/目录下爬取的各个新闻excel表 :param operator: 根据get或rm进行获取文件以及删除文件操作 sourceName:新闻网站文件夹 :return:获取文件操作返回文件名列表,删除文件,删除成功返回allFiles=False,表示目... | Implement the Python class `NewsController` described below.
Class description:
系统控制类
Method signatures and docstrings:
- def newsFiles(self, operator, sourceName): :func 获取spider/sourceName/目录下爬取的各个新闻excel表 :param operator: 根据get或rm进行获取文件以及删除文件操作 sourceName:新闻网站文件夹 :return:获取文件操作返回文件名列表,删除文件,删除成功返回allFiles=False,表示目... | ab5ad56c8520e60d5f568deed0081dfc127b7cd9 | <|skeleton|>
class NewsController:
"""系统控制类"""
def newsFiles(self, operator, sourceName):
""":func 获取spider/sourceName/目录下爬取的各个新闻excel表 :param operator: 根据get或rm进行获取文件以及删除文件操作 sourceName:新闻网站文件夹 :return:获取文件操作返回文件名列表,删除文件,删除成功返回allFiles=False,表示目录下没有文件"""
<|body_0|>
def rmRepeate(self, *di... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewsController:
"""系统控制类"""
def newsFiles(self, operator, sourceName):
""":func 获取spider/sourceName/目录下爬取的各个新闻excel表 :param operator: 根据get或rm进行获取文件以及删除文件操作 sourceName:新闻网站文件夹 :return:获取文件操作返回文件名列表,删除文件,删除成功返回allFiles=False,表示目录下没有文件"""
path = os.path.join(os.path.join(dirPath, 'spider'),... | the_stack_v2_python_sparse | controller/newsController.py | howie6879/getNews | train | 49 |
de1fcf567f9635ce4e4b99db3ec63f54fdf3b5ba | [
"super().__init__(response=http_resp)\nif http_resp:\n self.status = http_resp.status\n self.reason = http_resp.reason\n self.body = http_resp.data\n self.headers = http_resp.getheaders()\nelse:\n self.status = status\n self.reason = reason\n self.body = None\n self.headers = None",
"error... | <|body_start_0|>
super().__init__(response=http_resp)
if http_resp:
self.status = http_resp.status
self.reason = http_resp.reason
self.body = http_resp.data
self.headers = http_resp.getheaders()
else:
self.status = status
se... | NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. | ApiException | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiException:
"""NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually."""
def __init__(self, status=None, reason=None, http_resp=None):
"""Initialize with HTTP response."""
<|body_0|>
def __str__(self... | stack_v2_sparse_classes_36k_train_005416 | 2,814 | permissive | [
{
"docstring": "Initialize with HTTP response.",
"name": "__init__",
"signature": "def __init__(self, status=None, reason=None, http_resp=None)"
},
{
"docstring": "Get custom error messages for exception.",
"name": "__str__",
"signature": "def __str__(self)"
}
] | 2 | null | Implement the Python class `ApiException` described below.
Class description:
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
Method signatures and docstrings:
- def __init__(self, status=None, reason=None, http_resp=None): Initialize with H... | Implement the Python class `ApiException` described below.
Class description:
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
Method signatures and docstrings:
- def __init__(self, status=None, reason=None, http_resp=None): Initialize with H... | 1ec64b7e1039c891ac3a667ee6697731c61ddbaf | <|skeleton|>
class ApiException:
"""NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually."""
def __init__(self, status=None, reason=None, http_resp=None):
"""Initialize with HTTP response."""
<|body_0|>
def __str__(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiException:
"""NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually."""
def __init__(self, status=None, reason=None, http_resp=None):
"""Initialize with HTTP response."""
super().__init__(response=http_resp)
... | the_stack_v2_python_sparse | influxdb_client/rest.py | influxdata/influxdb-client-python | train | 623 |
009d209e9ef1159a669f578fd67b1c9bd039f9be | [
"def preorder(node):\n if not node:\n return\n self.preR.append(str(node.val))\n preorder(node.left)\n preorder(node.right)\n return\npreorder(root)\n\ndef midorder(node):\n if not node:\n return\n midorder(node.left)\n self.midR.append(str(node.val))\n midorder(node.right)\... | <|body_start_0|>
def preorder(node):
if not node:
return
self.preR.append(str(node.val))
preorder(node.left)
preorder(node.right)
return
preorder(root)
def midorder(node):
if not node:
return... | Codec | [
"MIT"
] | 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_005417 | 2,034 | permissive | [
{
"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:... | f91c2f5055c57f31de3a8724cc298a040b6dfd14 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def preorder(node):
if not node:
return
self.preR.append(str(node.val))
preorder(node.left)
preorder(node.right)
... | the_stack_v2_python_sparse | 449.py | kangli-bionic/leetcode-1 | train | 0 | |
bc61f12940a556119b5dd84dce0c3bf37be40b6a | [
"paddle.set_default_dtype(dtype)\nsuper(Conv2DNet, self).__init__()\nself._conv1 = paddle.nn.Conv2D(in_channels=in_channels, out_channels=out_channels, kernel_size=3, stride=1, padding=1, dilation=1, groups=1, padding_mode='zeros', weight_attr=paddle.nn.initializer.Constant(value=0.5), bias_attr=paddle.nn.initializ... | <|body_start_0|>
paddle.set_default_dtype(dtype)
super(Conv2DNet, self).__init__()
self._conv1 = paddle.nn.Conv2D(in_channels=in_channels, out_channels=out_channels, kernel_size=3, stride=1, padding=1, dilation=1, groups=1, padding_mode='zeros', weight_attr=paddle.nn.initializer.Constant(value=0... | model | Conv2DNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv2DNet:
"""model"""
def __init__(self, dtype=np.float64, in_channels=3, out_channels=10, data_format='NCHW'):
"""__init__"""
<|body_0|>
def forward(self, inputs):
"""forward"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
paddle.set_default_d... | stack_v2_sparse_classes_36k_train_005418 | 1,252 | no_license | [
{
"docstring": "__init__",
"name": "__init__",
"signature": "def __init__(self, dtype=np.float64, in_channels=3, out_channels=10, data_format='NCHW')"
},
{
"docstring": "forward",
"name": "forward",
"signature": "def forward(self, inputs)"
}
] | 2 | null | Implement the Python class `Conv2DNet` described below.
Class description:
model
Method signatures and docstrings:
- def __init__(self, dtype=np.float64, in_channels=3, out_channels=10, data_format='NCHW'): __init__
- def forward(self, inputs): forward | Implement the Python class `Conv2DNet` described below.
Class description:
model
Method signatures and docstrings:
- def __init__(self, dtype=np.float64, in_channels=3, out_channels=10, data_format='NCHW'): __init__
- def forward(self, inputs): forward
<|skeleton|>
class Conv2DNet:
"""model"""
def __init__(... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class Conv2DNet:
"""model"""
def __init__(self, dtype=np.float64, in_channels=3, out_channels=10, data_format='NCHW'):
"""__init__"""
<|body_0|>
def forward(self, inputs):
"""forward"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Conv2DNet:
"""model"""
def __init__(self, dtype=np.float64, in_channels=3, out_channels=10, data_format='NCHW'):
"""__init__"""
paddle.set_default_dtype(dtype)
super(Conv2DNet, self).__init__()
self._conv1 = paddle.nn.Conv2D(in_channels=in_channels, out_channels=out_channe... | the_stack_v2_python_sparse | framework/e2e/scene/models/conv2d_dygraph_model.py | PaddlePaddle/PaddleTest | train | 42 |
4a0521e733d7580ef3eba6519f3e26a369b68637 | [
"super().__init__()\nself.spherical_cheb_bn_pool = SphericalChebBNPool(in_channels, out_channels, lap, pooling, kernel_size)\nself.spherical_cheb_bn = SphericalChebBN(in_channels + out_channels, out_channels, lap, kernel_size)",
"x = self.spherical_cheb_bn_pool(x)\nx = torch.cat((x, concat_data), dim=2)\nx = self... | <|body_start_0|>
super().__init__()
self.spherical_cheb_bn_pool = SphericalChebBNPool(in_channels, out_channels, lap, pooling, kernel_size)
self.spherical_cheb_bn = SphericalChebBN(in_channels + out_channels, out_channels, lap, kernel_size)
<|end_body_0|>
<|body_start_1|>
x = self.spher... | Building Block calling a SphericalChebBNPool Block then concatenating the output with another tensor and calling a SphericalChebBN block. | SphericalChebBNPoolConcat | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SphericalChebBNPoolConcat:
"""Building Block calling a SphericalChebBNPool Block then concatenating the output with another tensor and calling a SphericalChebBN block."""
def __init__(self, in_channels, out_channels, lap, pooling, kernel_size):
"""Initialization. Args: in_channels (i... | stack_v2_sparse_classes_36k_train_005419 | 41,403 | no_license | [
{
"docstring": "Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number of channels. lap (:obj:`torch.sparse.FloatTensor`): laplacian. pooling (:obj:`torch.nn.Module`): pooling/unpooling module. kernel_size (int, optional): polynomial degree. Defaults to 3.",
"... | 2 | stack_v2_sparse_classes_30k_train_013978 | Implement the Python class `SphericalChebBNPoolConcat` described below.
Class description:
Building Block calling a SphericalChebBNPool Block then concatenating the output with another tensor and calling a SphericalChebBN block.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, lap, po... | Implement the Python class `SphericalChebBNPoolConcat` described below.
Class description:
Building Block calling a SphericalChebBNPool Block then concatenating the output with another tensor and calling a SphericalChebBN block.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, lap, po... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class SphericalChebBNPoolConcat:
"""Building Block calling a SphericalChebBNPool Block then concatenating the output with another tensor and calling a SphericalChebBN block."""
def __init__(self, in_channels, out_channels, lap, pooling, kernel_size):
"""Initialization. Args: in_channels (i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SphericalChebBNPoolConcat:
"""Building Block calling a SphericalChebBNPool Block then concatenating the output with another tensor and calling a SphericalChebBN block."""
def __init__(self, in_channels, out_channels, lap, pooling, kernel_size):
"""Initialization. Args: in_channels (int): initial ... | the_stack_v2_python_sparse | generated/test_deepsphere_deepsphere_pytorch.py | jansel/pytorch-jit-paritybench | train | 35 |
796c056f854fb5551e8706d4fc722aa7e0d2835b | [
"self.inactive = inactive\nself.magneto_entity_id = magneto_entity_id\nself.protection_jobs = protection_jobs",
"if dictionary is None:\n return None\ninactive = dictionary.get('inactive')\nmagneto_entity_id = dictionary.get('magnetoEntityId')\nprotection_jobs = None\nif dictionary.get('protectionJobs') != Non... | <|body_start_0|>
self.inactive = inactive
self.magneto_entity_id = magneto_entity_id
self.protection_jobs = protection_jobs
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
inactive = dictionary.get('inactive')
magneto_entity_id = dictionary... | Implementation of the 'ViewProtection' model. Specifies information about the Protection Jobs that are protecting the View. Attributes: inactive (bool): Specifies if this View is an inactive View that was created on this Remote Cluster to store the Snapshots created by replication. This inactive View cannot be NFS or S... | ViewProtection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewProtection:
"""Implementation of the 'ViewProtection' model. Specifies information about the Protection Jobs that are protecting the View. Attributes: inactive (bool): Specifies if this View is an inactive View that was created on this Remote Cluster to store the Snapshots created by replicat... | stack_v2_sparse_classes_36k_train_005420 | 2,558 | permissive | [
{
"docstring": "Constructor for the ViewProtection class",
"name": "__init__",
"signature": "def __init__(self, inactive=None, magneto_entity_id=None, protection_jobs=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe... | 2 | stack_v2_sparse_classes_30k_train_012743 | Implement the Python class `ViewProtection` described below.
Class description:
Implementation of the 'ViewProtection' model. Specifies information about the Protection Jobs that are protecting the View. Attributes: inactive (bool): Specifies if this View is an inactive View that was created on this Remote Cluster to ... | Implement the Python class `ViewProtection` described below.
Class description:
Implementation of the 'ViewProtection' model. Specifies information about the Protection Jobs that are protecting the View. Attributes: inactive (bool): Specifies if this View is an inactive View that was created on this Remote Cluster to ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ViewProtection:
"""Implementation of the 'ViewProtection' model. Specifies information about the Protection Jobs that are protecting the View. Attributes: inactive (bool): Specifies if this View is an inactive View that was created on this Remote Cluster to store the Snapshots created by replicat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ViewProtection:
"""Implementation of the 'ViewProtection' model. Specifies information about the Protection Jobs that are protecting the View. Attributes: inactive (bool): Specifies if this View is an inactive View that was created on this Remote Cluster to store the Snapshots created by replication. This ina... | the_stack_v2_python_sparse | cohesity_management_sdk/models/view_protection.py | cohesity/management-sdk-python | train | 24 |
457a7d82f0b57ddb3d2132ac0cb0979a32d3a6c8 | [
"trie = Trie(d)\nwords = sentence.split(' ')\nfor i in range(len(words)):\n root = trie.find(words[i])\n if len(root) > 0:\n words[i] = root\nreturn ' '.join(words)",
"def replace(word):\n best = word\n for r in cache[ord(word[0]) - 97]:\n if len(r) < len(best) and word.startswith(r):\n ... | <|body_start_0|>
trie = Trie(d)
words = sentence.split(' ')
for i in range(len(words)):
root = trie.find(words[i])
if len(root) > 0:
words[i] = root
return ' '.join(words)
<|end_body_0|>
<|body_start_1|>
def replace(word):
best... | Solution_1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_1:
def replaceWords(self, d, sentence):
""":type dict: List[str] :type sentence: str :rtype: str"""
<|body_0|>
def replaceWords_1(self, roots, sentence):
""":type dict: List[str] :type sentence: str :rtype: str 89ms"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_005421 | 4,252 | no_license | [
{
"docstring": ":type dict: List[str] :type sentence: str :rtype: str",
"name": "replaceWords",
"signature": "def replaceWords(self, d, sentence)"
},
{
"docstring": ":type dict: List[str] :type sentence: str :rtype: str 89ms",
"name": "replaceWords_1",
"signature": "def replaceWords_1(se... | 2 | stack_v2_sparse_classes_30k_train_011500 | Implement the Python class `Solution_1` described below.
Class description:
Implement the Solution_1 class.
Method signatures and docstrings:
- def replaceWords(self, d, sentence): :type dict: List[str] :type sentence: str :rtype: str
- def replaceWords_1(self, roots, sentence): :type dict: List[str] :type sentence: ... | Implement the Python class `Solution_1` described below.
Class description:
Implement the Solution_1 class.
Method signatures and docstrings:
- def replaceWords(self, d, sentence): :type dict: List[str] :type sentence: str :rtype: str
- def replaceWords_1(self, roots, sentence): :type dict: List[str] :type sentence: ... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution_1:
def replaceWords(self, d, sentence):
""":type dict: List[str] :type sentence: str :rtype: str"""
<|body_0|>
def replaceWords_1(self, roots, sentence):
""":type dict: List[str] :type sentence: str :rtype: str 89ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution_1:
def replaceWords(self, d, sentence):
""":type dict: List[str] :type sentence: str :rtype: str"""
trie = Trie(d)
words = sentence.split(' ')
for i in range(len(words)):
root = trie.find(words[i])
if len(root) > 0:
words[i] = ro... | the_stack_v2_python_sparse | ReplaceWords_MID_648.py | 953250587/leetcode-python | train | 2 | |
22778fa8e55ecad7856749b17b54bd7c3355dfe7 | [
"x = ax.get_xlim()\ny = ax.get_ylim()\nxy_pixels = ax.transData.transform(np.vstack([x, y]).T)\nxpix, ypix = xy_pixels.T\nreturn (xpix, ypix)",
"axes = figure.get_axes()\ntotalW = 0\nfor axis in axes:\n xpix, ypix = MplUtils.getAxisLimits(axis)\n dataW = xpix[1] - xpix[0]\n dataH = ypix[1] - ypix[0]\n ... | <|body_start_0|>
x = ax.get_xlim()
y = ax.get_ylim()
xy_pixels = ax.transData.transform(np.vstack([x, y]).T)
xpix, ypix = xy_pixels.T
return (xpix, ypix)
<|end_body_0|>
<|body_start_1|>
axes = figure.get_axes()
totalW = 0
for axis in axes:
xpi... | MplUtils | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MplUtils:
def getAxisLimits(cls, ax):
"""Warning not super accurate - use for data not frame size"""
<|body_0|>
def calcFigCanvasWidthHeight(cls, figure):
"""deprecated, not reliable for calculating accurate size calculates dimensions from axes. Caution, y not additi... | stack_v2_sparse_classes_36k_train_005422 | 1,570 | permissive | [
{
"docstring": "Warning not super accurate - use for data not frame size",
"name": "getAxisLimits",
"signature": "def getAxisLimits(cls, ax)"
},
{
"docstring": "deprecated, not reliable for calculating accurate size calculates dimensions from axes. Caution, y not additive alternative to figure.c... | 2 | stack_v2_sparse_classes_30k_train_007248 | Implement the Python class `MplUtils` described below.
Class description:
Implement the MplUtils class.
Method signatures and docstrings:
- def getAxisLimits(cls, ax): Warning not super accurate - use for data not frame size
- def calcFigCanvasWidthHeight(cls, figure): deprecated, not reliable for calculating accurat... | Implement the Python class `MplUtils` described below.
Class description:
Implement the MplUtils class.
Method signatures and docstrings:
- def getAxisLimits(cls, ax): Warning not super accurate - use for data not frame size
- def calcFigCanvasWidthHeight(cls, figure): deprecated, not reliable for calculating accurat... | 20fba1b1fd1a42add223d9e8af2d267665bec493 | <|skeleton|>
class MplUtils:
def getAxisLimits(cls, ax):
"""Warning not super accurate - use for data not frame size"""
<|body_0|>
def calcFigCanvasWidthHeight(cls, figure):
"""deprecated, not reliable for calculating accurate size calculates dimensions from axes. Caution, y not additi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MplUtils:
def getAxisLimits(cls, ax):
"""Warning not super accurate - use for data not frame size"""
x = ax.get_xlim()
y = ax.get_ylim()
xy_pixels = ax.transData.transform(np.vstack([x, y]).T)
xpix, ypix = xy_pixels.T
return (xpix, ypix)
def calcFigCanvasWi... | the_stack_v2_python_sparse | gui/wellplot/matplotlib/mplutils.py | ABV-Hub/qreservoir | train | 0 | |
ba379577b22edd9af0c0d1f9d85a667ded2ec6a0 | [
"matstamm_info = request.json\ninserted_matstaemme = []\nfor matstamm in matstamm_info:\n inserted_matstamm = Matstamm.create(matstamm_dict=matstamm)\n inserted_matstaemme.append(inserted_matstamm)\nreturn inserted_matstaemme",
"matstamm_info = request.json\nmatstamm_info['last_updated'] = datetime.utcnow()... | <|body_start_0|>
matstamm_info = request.json
inserted_matstaemme = []
for matstamm in matstamm_info:
inserted_matstamm = Matstamm.create(matstamm_dict=matstamm)
inserted_matstaemme.append(inserted_matstamm)
return inserted_matstaemme
<|end_body_0|>
<|body_start_... | Matstammn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Matstammn:
def post(self):
"""Matstammliste wird in die Datenbank hinzugefügt"""
<|body_0|>
def put(self):
"""Matstamm bearbeiten"""
<|body_1|>
def get(self):
"""Matstamm anzeigen"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_005423 | 4,078 | no_license | [
{
"docstring": "Matstammliste wird in die Datenbank hinzugefügt",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Matstamm bearbeiten",
"name": "put",
"signature": "def put(self)"
},
{
"docstring": "Matstamm anzeigen",
"name": "get",
"signature": "def get... | 3 | stack_v2_sparse_classes_30k_train_001972 | Implement the Python class `Matstammn` described below.
Class description:
Implement the Matstammn class.
Method signatures and docstrings:
- def post(self): Matstammliste wird in die Datenbank hinzugefügt
- def put(self): Matstamm bearbeiten
- def get(self): Matstamm anzeigen | Implement the Python class `Matstammn` described below.
Class description:
Implement the Matstammn class.
Method signatures and docstrings:
- def post(self): Matstammliste wird in die Datenbank hinzugefügt
- def put(self): Matstamm bearbeiten
- def get(self): Matstamm anzeigen
<|skeleton|>
class Matstammn:
def ... | 8f1f0f9bb2a060aa5c32be320a6d2c955f442053 | <|skeleton|>
class Matstammn:
def post(self):
"""Matstammliste wird in die Datenbank hinzugefügt"""
<|body_0|>
def put(self):
"""Matstamm bearbeiten"""
<|body_1|>
def get(self):
"""Matstamm anzeigen"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Matstammn:
def post(self):
"""Matstammliste wird in die Datenbank hinzugefügt"""
matstamm_info = request.json
inserted_matstaemme = []
for matstamm in matstamm_info:
inserted_matstamm = Matstamm.create(matstamm_dict=matstamm)
inserted_matstaemme.append(i... | the_stack_v2_python_sparse | app/api/matstaemme.py | hammadi3/freig | train | 0 | |
d2b35ae267d39657b9b6dafdba0efa7d5ce51072 | [
"self.sets = []\nmine = '-u' + unicode(os.getuid())\nfor line in self.lsof('-lnP', '-F0ncupf', '-M', '-S2', mine):\n first = line[0][0]\n whole = dict(line)\n if first == 'p':\n proc = whole\n self.sets.append(proc)\n elif first == 'f':\n proc.setdefault('f', []).append(whole)",
"... | <|body_start_0|>
self.sets = []
mine = '-u' + unicode(os.getuid())
for line in self.lsof('-lnP', '-F0ncupf', '-M', '-S2', mine):
first = line[0][0]
whole = dict(line)
if first == 'p':
proc = whole
self.sets.append(proc)
... | Interface to the Un*x 'lsof' command. Public attribute sets is a list of dictionaries with one-character keys and string values. Only if the key is 'f' the value will be a similar list of dict, but not nested further. Some interesting keys: c process command name n file name p pid s file size t file type u process user... | OpenFileListLinMac | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OpenFileListLinMac:
"""Interface to the Un*x 'lsof' command. Public attribute sets is a list of dictionaries with one-character keys and string values. Only if the key is 'f' the value will be a similar list of dict, but not nested further. Some interesting keys: c process command name n file nam... | stack_v2_sparse_classes_36k_train_005424 | 6,436 | no_license | [
{
"docstring": "Constructor. Currently fills sets using options optimized for speed.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Return file lists for specified processes. PARAMETERS ========== filters -- tuple of strings. Either command names (mplayer), binary pat... | 3 | stack_v2_sparse_classes_30k_train_002942 | Implement the Python class `OpenFileListLinMac` described below.
Class description:
Interface to the Un*x 'lsof' command. Public attribute sets is a list of dictionaries with one-character keys and string values. Only if the key is 'f' the value will be a similar list of dict, but not nested further. Some interesting ... | Implement the Python class `OpenFileListLinMac` described below.
Class description:
Interface to the Un*x 'lsof' command. Public attribute sets is a list of dictionaries with one-character keys and string values. Only if the key is 'f' the value will be a similar list of dict, but not nested further. Some interesting ... | 748bc19f8ddaf6427f25d2f4e3d2087c02c8fccc | <|skeleton|>
class OpenFileListLinMac:
"""Interface to the Un*x 'lsof' command. Public attribute sets is a list of dictionaries with one-character keys and string values. Only if the key is 'f' the value will be a similar list of dict, but not nested further. Some interesting keys: c process command name n file nam... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OpenFileListLinMac:
"""Interface to the Un*x 'lsof' command. Public attribute sets is a list of dictionaries with one-character keys and string values. Only if the key is 'f' the value will be a similar list of dict, but not nested further. Some interesting keys: c process command name n file name p pid s fil... | the_stack_v2_python_sparse | src/AniChou/tracker/players.py | bloodcurdle/anichou | train | 0 |
bd4e48a6645caebeb4d0090abb2ea414ad91babf | [
"if not self.stage_id or not self.stage_id.notify:\n return False\nif self.stage_id in self.notified_stage_ids:\n if not self.stage_id.notify_multiple:\n return False\nif not self.stage_id.notify_template_id:\n raise except_orm(_(u'Warning !'), _(u\"No email template selected in the '%s' stage of th... | <|body_start_0|>
if not self.stage_id or not self.stage_id.notify:
return False
if self.stage_id in self.notified_stage_ids:
if not self.stage_id.notify_multiple:
return False
if not self.stage_id.notify_template_id:
raise except_orm(_(u'Warnin... | Add notification feature | Ticket | [
"CC-BY-2.5"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ticket:
"""Add notification feature"""
def check_notify(self):
"""Return True only if we should notify"""
<|body_0|>
def create(self, values):
"""Notify on create"""
<|body_1|>
def write(self, values):
"""Notify on write"""
<|body_2|>... | stack_v2_sparse_classes_36k_train_005425 | 3,123 | permissive | [
{
"docstring": "Return True only if we should notify",
"name": "check_notify",
"signature": "def check_notify(self)"
},
{
"docstring": "Notify on create",
"name": "create",
"signature": "def create(self, values)"
},
{
"docstring": "Notify on write",
"name": "write",
"sign... | 3 | stack_v2_sparse_classes_30k_train_018660 | Implement the Python class `Ticket` described below.
Class description:
Add notification feature
Method signatures and docstrings:
- def check_notify(self): Return True only if we should notify
- def create(self, values): Notify on create
- def write(self, values): Notify on write | Implement the Python class `Ticket` described below.
Class description:
Add notification feature
Method signatures and docstrings:
- def check_notify(self): Return True only if we should notify
- def create(self, values): Notify on create
- def write(self, values): Notify on write
<|skeleton|>
class Ticket:
"""A... | 50c4c1aa6c04f89a2e11cf2bae13e97ae0877819 | <|skeleton|>
class Ticket:
"""Add notification feature"""
def check_notify(self):
"""Return True only if we should notify"""
<|body_0|>
def create(self, values):
"""Notify on create"""
<|body_1|>
def write(self, values):
"""Notify on write"""
<|body_2|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ticket:
"""Add notification feature"""
def check_notify(self):
"""Return True only if we should notify"""
if not self.stage_id or not self.stage_id.notify:
return False
if self.stage_id in self.notified_stage_ids:
if not self.stage_id.notify_multiple:
... | the_stack_v2_python_sparse | anytracker/notify/notify.py | anybox/anytracker | train | 1 |
8bde023e3b8bb84b45cb14da24585f8a5fe013b0 | [
"cls.flags = magic.MAGIC_NONE\nif mime:\n cls.flags |= magic.MAGIC_MIME\nif mime_encoding:\n cls.flags |= magic.MAGIC_MIME_ENCODING\nif keep_going:\n cls.flags |= magic.MAGIC_CONTINUE\ncls.old_api = True\ntry:\n cls.cookie = magic.open(cls.flags)\n if magic_file and os.path.exists(magic_file):\n ... | <|body_start_0|>
cls.flags = magic.MAGIC_NONE
if mime:
cls.flags |= magic.MAGIC_MIME
if mime_encoding:
cls.flags |= magic.MAGIC_MIME_ENCODING
if keep_going:
cls.flags |= magic.MAGIC_CONTINUE
cls.old_api = True
try:
cls.cooki... | Factory class for python-magic | Magic | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Magic:
"""Factory class for python-magic"""
def _initialize(cls, magic_file=None, mime=False, mime_encoding=False, keep_going=False):
"""Initialize python-magic"""
<|body_0|>
def from_buffer(cls, buf, **kwargs):
"""Compute mimetype from a buffer :param buf: buffe... | stack_v2_sparse_classes_36k_train_005426 | 3,113 | permissive | [
{
"docstring": "Initialize python-magic",
"name": "_initialize",
"signature": "def _initialize(cls, magic_file=None, mime=False, mime_encoding=False, keep_going=False)"
},
{
"docstring": "Compute mimetype from a buffer :param buf: buffer from where to get data",
"name": "from_buffer",
"s... | 3 | stack_v2_sparse_classes_30k_train_017099 | Implement the Python class `Magic` described below.
Class description:
Factory class for python-magic
Method signatures and docstrings:
- def _initialize(cls, magic_file=None, mime=False, mime_encoding=False, keep_going=False): Initialize python-magic
- def from_buffer(cls, buf, **kwargs): Compute mimetype from a buf... | Implement the Python class `Magic` described below.
Class description:
Factory class for python-magic
Method signatures and docstrings:
- def _initialize(cls, magic_file=None, mime=False, mime_encoding=False, keep_going=False): Initialize python-magic
- def from_buffer(cls, buf, **kwargs): Compute mimetype from a buf... | 4e3e2c0fa82e352a1a7a7fd02381a4d84bed9f09 | <|skeleton|>
class Magic:
"""Factory class for python-magic"""
def _initialize(cls, magic_file=None, mime=False, mime_encoding=False, keep_going=False):
"""Initialize python-magic"""
<|body_0|>
def from_buffer(cls, buf, **kwargs):
"""Compute mimetype from a buffer :param buf: buffe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Magic:
"""Factory class for python-magic"""
def _initialize(cls, magic_file=None, mime=False, mime_encoding=False, keep_going=False):
"""Initialize python-magic"""
cls.flags = magic.MAGIC_NONE
if mime:
cls.flags |= magic.MAGIC_MIME
if mime_encoding:
... | the_stack_v2_python_sparse | common/src/utils/mimetypes.py | quarkslab/irma | train | 267 |
db5392730296201fc393727bab4d48779fbfa707 | [
"super().__init__(name, card_no, expiry_date, address)\nself._csv = csv\nself._card_type = card_type",
"expiry = ''\nif self._expiry_date is not None:\n expiry = f\"Expires on {self._expiry_date.strftime('%Y-%m-%d')}\\n\"\nreturn f'\\n====== {self._card_type.upper()} CARD (ID {self.id})======\\n{self._name}\\n... | <|body_start_0|>
super().__init__(name, card_no, expiry_date, address)
self._csv = csv
self._card_type = card_type
<|end_body_0|>
<|body_start_1|>
expiry = ''
if self._expiry_date is not None:
expiry = f"Expires on {self._expiry_date.strftime('%Y-%m-%d')}\n"
... | Represent credit and debit cards. | MoneyCard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MoneyCard:
"""Represent credit and debit cards."""
def __init__(self, csv, card_type, name, card_no, expiry_date, address):
"""Initialises MoneyCard. :param csv: int :param card_type: String :param name: String :param card_no: String :param expiry_date: Datetime :param address: Addre... | stack_v2_sparse_classes_36k_train_005427 | 10,626 | no_license | [
{
"docstring": "Initialises MoneyCard. :param csv: int :param card_type: String :param name: String :param card_no: String :param expiry_date: Datetime :param address: Address",
"name": "__init__",
"signature": "def __init__(self, csv, card_type, name, card_no, expiry_date, address)"
},
{
"docst... | 2 | stack_v2_sparse_classes_30k_train_017864 | Implement the Python class `MoneyCard` described below.
Class description:
Represent credit and debit cards.
Method signatures and docstrings:
- def __init__(self, csv, card_type, name, card_no, expiry_date, address): Initialises MoneyCard. :param csv: int :param card_type: String :param name: String :param card_no: ... | Implement the Python class `MoneyCard` described below.
Class description:
Represent credit and debit cards.
Method signatures and docstrings:
- def __init__(self, csv, card_type, name, card_no, expiry_date, address): Initialises MoneyCard. :param csv: int :param card_type: String :param name: String :param card_no: ... | b7695cc7cf0860aa9c8bf492b1bd06bd88b9af41 | <|skeleton|>
class MoneyCard:
"""Represent credit and debit cards."""
def __init__(self, csv, card_type, name, card_no, expiry_date, address):
"""Initialises MoneyCard. :param csv: int :param card_type: String :param name: String :param card_no: String :param expiry_date: Datetime :param address: Addre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MoneyCard:
"""Represent credit and debit cards."""
def __init__(self, csv, card_type, name, card_no, expiry_date, address):
"""Initialises MoneyCard. :param csv: int :param card_type: String :param name: String :param card_no: String :param expiry_date: Datetime :param address: Address"""
... | the_stack_v2_python_sparse | Assignments/Assignment 2/card.py | sakshambhardwaj523/Python-OOP-Projects | train | 0 |
40be6e9cd7448589e7818440d43e24f9bbffba38 | [
"self.data = data\nself.x = x\nself.y = y\nself.X = data[x]\nself.Y = data[y]\nself.X2 = sm.add_constant(self.X)\nself.sm = sm.OLS(self.Y, self.X2).fit()",
"missing = [i for i in self.x if i not in inputs.keys()]\nif len(missing) > 0:\n raise ValueError(f\"Missing input(s) '{missing}'\")\ninputs = {k: np.array... | <|body_start_0|>
self.data = data
self.x = x
self.y = y
self.X = data[x]
self.Y = data[y]
self.X2 = sm.add_constant(self.X)
self.sm = sm.OLS(self.Y, self.X2).fit()
<|end_body_0|>
<|body_start_1|>
missing = [i for i in self.x if i not in inputs.keys()]
... | Simple linear regression model. | LinearModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearModel:
"""Simple linear regression model."""
def __init__(self, data, x, y):
"""Creates an instance of `LinearModel`. Parameters ---------- data : pd.DataFrame Input dataset. x : list List of regression variables. y : str Output variable."""
<|body_0|>
def predict(... | stack_v2_sparse_classes_36k_train_005428 | 8,559 | permissive | [
{
"docstring": "Creates an instance of `LinearModel`. Parameters ---------- data : pd.DataFrame Input dataset. x : list List of regression variables. y : str Output variable.",
"name": "__init__",
"signature": "def __init__(self, data, x, y)"
},
{
"docstring": "Predicts the output value of `inpu... | 5 | null | Implement the Python class `LinearModel` described below.
Class description:
Simple linear regression model.
Method signatures and docstrings:
- def __init__(self, data, x, y): Creates an instance of `LinearModel`. Parameters ---------- data : pd.DataFrame Input dataset. x : list List of regression variables. y : str... | Implement the Python class `LinearModel` described below.
Class description:
Simple linear regression model.
Method signatures and docstrings:
- def __init__(self, data, x, y): Creates an instance of `LinearModel`. Parameters ---------- data : pd.DataFrame Input dataset. x : list List of regression variables. y : str... | d7270ebe1c554293a9d36730d67ab555c071cb17 | <|skeleton|>
class LinearModel:
"""Simple linear regression model."""
def __init__(self, data, x, y):
"""Creates an instance of `LinearModel`. Parameters ---------- data : pd.DataFrame Input dataset. x : list List of regression variables. y : str Output variable."""
<|body_0|>
def predict(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinearModel:
"""Simple linear regression model."""
def __init__(self, data, x, y):
"""Creates an instance of `LinearModel`. Parameters ---------- data : pd.DataFrame Input dataset. x : list List of regression variables. y : str Output variable."""
self.data = data
self.x = x
... | the_stack_v2_python_sparse | wisdem/orbit/parametric.py | WISDEM/WISDEM | train | 120 |
cc9ac5a133d824b091308b6705ad20610df8273f | [
"if n < 10:\n return n\nnl = list(str(n))\nfor i in range(len(nl) - 1, 0, -1):\n if nl[i - 1] > nl[i]:\n nl[i - 1] = str(int(nl[i - 1]) - 1)\n nl[i:] = ['9'] * len(nl[i:])\nreturn int(''.join(nl))",
"if n < 10:\n return n\nnl = list(str(n))\nfor i in range(len(nl) - 1):\n if int(nl[i]) >... | <|body_start_0|>
if n < 10:
return n
nl = list(str(n))
for i in range(len(nl) - 1, 0, -1):
if nl[i - 1] > nl[i]:
nl[i - 1] = str(int(nl[i - 1]) - 1)
nl[i:] = ['9'] * len(nl[i:])
return int(''.join(nl))
<|end_body_0|>
<|body_start_1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def monotoneIncreasingDigits(self, n):
""":type n: int :rtype: int 从后往前遍历"""
<|body_0|>
def monotoneIncreasingDigits0(self, n):
""":type n: int :rtype: int 从前往后遍历"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n < 10:
retur... | stack_v2_sparse_classes_36k_train_005429 | 1,304 | no_license | [
{
"docstring": ":type n: int :rtype: int 从后往前遍历",
"name": "monotoneIncreasingDigits",
"signature": "def monotoneIncreasingDigits(self, n)"
},
{
"docstring": ":type n: int :rtype: int 从前往后遍历",
"name": "monotoneIncreasingDigits0",
"signature": "def monotoneIncreasingDigits0(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def monotoneIncreasingDigits(self, n): :type n: int :rtype: int 从后往前遍历
- def monotoneIncreasingDigits0(self, n): :type n: int :rtype: int 从前往后遍历 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def monotoneIncreasingDigits(self, n): :type n: int :rtype: int 从后往前遍历
- def monotoneIncreasingDigits0(self, n): :type n: int :rtype: int 从前往后遍历
<|skeleton|>
class Solution:
... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def monotoneIncreasingDigits(self, n):
""":type n: int :rtype: int 从后往前遍历"""
<|body_0|>
def monotoneIncreasingDigits0(self, n):
""":type n: int :rtype: int 从前往后遍历"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def monotoneIncreasingDigits(self, n):
""":type n: int :rtype: int 从后往前遍历"""
if n < 10:
return n
nl = list(str(n))
for i in range(len(nl) - 1, 0, -1):
if nl[i - 1] > nl[i]:
nl[i - 1] = str(int(nl[i - 1]) - 1)
nl[... | the_stack_v2_python_sparse | 738.单调递增的数字.py | yangyuxiang1996/leetcode | train | 0 | |
90bd4ac55df9cf4bc987abf706d68d2ce7c99b2e | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), name=name)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, password=password, name=name)\nuser.is_admin = True\nuser.is_staff = True... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email), name=name)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user = self.c... | UserProfileManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserProfileManager:
def create_user(self, email, name, password=None):
"""创建普通用户 Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, name, password):
"""创建超级用户 Creates and saves a superuser with t... | stack_v2_sparse_classes_36k_train_005430 | 5,621 | no_license | [
{
"docstring": "创建普通用户 Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, email, name, password=None)"
},
{
"docstring": "创建超级用户 Creates and saves a superuser with the given email, date of birth and password.",
... | 2 | stack_v2_sparse_classes_30k_val_000178 | Implement the Python class `UserProfileManager` described below.
Class description:
Implement the UserProfileManager class.
Method signatures and docstrings:
- def create_user(self, email, name, password=None): 创建普通用户 Creates and saves a User with the given email, date of birth and password.
- def create_superuser(se... | Implement the Python class `UserProfileManager` described below.
Class description:
Implement the UserProfileManager class.
Method signatures and docstrings:
- def create_user(self, email, name, password=None): 创建普通用户 Creates and saves a User with the given email, date of birth and password.
- def create_superuser(se... | cc475863b0f6f574de79fc8d1fa91b9d0d5449d8 | <|skeleton|>
class UserProfileManager:
def create_user(self, email, name, password=None):
"""创建普通用户 Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, name, password):
"""创建超级用户 Creates and saves a superuser with t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserProfileManager:
def create_user(self, email, name, password=None):
"""创建普通用户 Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(ema... | the_stack_v2_python_sparse | mgmt/models.py | starjoe/PWM | train | 0 | |
f80c3c7b809144e107623e4a8a0053cd37ce09bf | [
"domain_list = ['DEFAULT']\nmeta_list = capi.get_ds_metadata_domain_list(self._ptr)\nif meta_list:\n counter = 0\n domain = meta_list[counter]\n while domain:\n domain_list.append(domain.decode())\n counter += 1\n domain = meta_list[counter]\ncapi.free_dsl(meta_list)\nresult = {}\nfor ... | <|body_start_0|>
domain_list = ['DEFAULT']
meta_list = capi.get_ds_metadata_domain_list(self._ptr)
if meta_list:
counter = 0
domain = meta_list[counter]
while domain:
domain_list.append(domain.decode())
counter += 1
... | Attributes that exist on both GDALRaster and GDALBand. | GDALRasterBase | [
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"GPL-1.0-or-later",
"Python-2.0.1",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-other-permissive",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GDALRasterBase:
"""Attributes that exist on both GDALRaster and GDALBand."""
def metadata(self):
"""Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata domain and the second-level is the metadata item names a... | stack_v2_sparse_classes_36k_train_005431 | 2,882 | permissive | [
{
"docstring": "Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata domain and the second-level is the metadata item names and values for that domain.",
"name": "metadata",
"signature": "def metadata(self)"
},
{
"docstri... | 2 | null | Implement the Python class `GDALRasterBase` described below.
Class description:
Attributes that exist on both GDALRaster and GDALBand.
Method signatures and docstrings:
- def metadata(self): Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata... | Implement the Python class `GDALRasterBase` described below.
Class description:
Attributes that exist on both GDALRaster and GDALBand.
Method signatures and docstrings:
- def metadata(self): Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata... | c74a6fad5475495756a5bdb18b2cab2b68d429bc | <|skeleton|>
class GDALRasterBase:
"""Attributes that exist on both GDALRaster and GDALBand."""
def metadata(self):
"""Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata domain and the second-level is the metadata item names a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GDALRasterBase:
"""Attributes that exist on both GDALRaster and GDALBand."""
def metadata(self):
"""Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata domain and the second-level is the metadata item names and values for... | the_stack_v2_python_sparse | django/contrib/gis/gdal/raster/base.py | django/django | train | 73,530 |
f3482a5bb8b665e09c0ba7570a4504342c63af2a | [
"if not root:\n return []\nresult = {}\nmax_depth = 0\nstack = [(root, 0)]\nwhile stack:\n node, depth = stack.pop()\n max_depth = max(max_depth, depth)\n if depth not in result:\n result[depth] = node.val\n if node.left:\n stack.append((node.left, depth + 1))\n if node.right:\n ... | <|body_start_0|>
if not root:
return []
result = {}
max_depth = 0
stack = [(root, 0)]
while stack:
node, depth = stack.pop()
max_depth = max(max_depth, depth)
if depth not in result:
result[depth] = node.val
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rightSideView_dfs(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def rightSideView_level(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
... | stack_v2_sparse_classes_36k_train_005432 | 1,785 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "rightSideView_dfs",
"signature": "def rightSideView_dfs(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "rightSideView_level",
"signature": "def rightSideView_level(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010052 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rightSideView_dfs(self, root): :type root: TreeNode :rtype: List[int]
- def rightSideView_level(self, root): :type root: TreeNode :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rightSideView_dfs(self, root): :type root: TreeNode :rtype: List[int]
- def rightSideView_level(self, root): :type root: TreeNode :rtype: List[int]
<|skeleton|>
class Soluti... | 9ac54720f571a4bea09d0cceb0039381a78df9e8 | <|skeleton|>
class Solution:
def rightSideView_dfs(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def rightSideView_level(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def rightSideView_dfs(self, root):
""":type root: TreeNode :rtype: List[int]"""
if not root:
return []
result = {}
max_depth = 0
stack = [(root, 0)]
while stack:
node, depth = stack.pop()
max_depth = max(max_depth, d... | the_stack_v2_python_sparse | code/199_binary-tree-right-side-view.py | linhdvu14/leetcode-solutions | train | 2 | |
725f7a094142175602be5a6823557701de741c8e | [
"self.metric_name = metric['name'] or DATA_MODEL.metrics[metric['type']].name\nself.metric_unit = metric['unit'] or DATA_MODEL.metrics[metric['type']].unit.value\nself.subject_name = subject.get('name') or DATA_MODEL.subjects[subject['type']].name\nscale = metric['scale']\nself.new_metric_value = None\nself.old_met... | <|body_start_0|>
self.metric_name = metric['name'] or DATA_MODEL.metrics[metric['type']].name
self.metric_unit = metric['unit'] or DATA_MODEL.metrics[metric['type']].unit.value
self.subject_name = subject.get('name') or DATA_MODEL.subjects[subject['type']].name
scale = metric['scale']
... | Handle metric data needed for notifications. | MetricNotificationData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetricNotificationData:
"""Handle metric data needed for notifications."""
def __init__(self, metric: Metric, measurements: list[Measurement], subject: Subject) -> None:
"""Initialise the Notification with metric data."""
<|body_0|>
def __user_friendly_status(metric_stat... | stack_v2_sparse_classes_36k_train_005433 | 2,152 | permissive | [
{
"docstring": "Initialise the Notification with metric data.",
"name": "__init__",
"signature": "def __init__(self, metric: Metric, measurements: list[Measurement], subject: Subject) -> None"
},
{
"docstring": "Get the user friendly status name from the data model.",
"name": "__user_friendl... | 2 | stack_v2_sparse_classes_30k_train_001073 | Implement the Python class `MetricNotificationData` described below.
Class description:
Handle metric data needed for notifications.
Method signatures and docstrings:
- def __init__(self, metric: Metric, measurements: list[Measurement], subject: Subject) -> None: Initialise the Notification with metric data.
- def __... | Implement the Python class `MetricNotificationData` described below.
Class description:
Handle metric data needed for notifications.
Method signatures and docstrings:
- def __init__(self, metric: Metric, measurements: list[Measurement], subject: Subject) -> None: Initialise the Notification with metric data.
- def __... | 5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3 | <|skeleton|>
class MetricNotificationData:
"""Handle metric data needed for notifications."""
def __init__(self, metric: Metric, measurements: list[Measurement], subject: Subject) -> None:
"""Initialise the Notification with metric data."""
<|body_0|>
def __user_friendly_status(metric_stat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MetricNotificationData:
"""Handle metric data needed for notifications."""
def __init__(self, metric: Metric, measurements: list[Measurement], subject: Subject) -> None:
"""Initialise the Notification with metric data."""
self.metric_name = metric['name'] or DATA_MODEL.metrics[metric['typ... | the_stack_v2_python_sparse | components/notifier/src/models/metric_notification_data.py | ICTU/quality-time | train | 43 |
0cabedfadb79d035c5e8bbd8a8b5155911fe6fe4 | [
"super().__init__(img=fishing_net_img, x=x, y=y)\nself.set_sprite_center()\nself.size = 0\nself.visible = True",
"if self.scale <= 1:\n self.size += 300 * dt\n self.scale = self.size / 100\nelse:\n self.visible = False"
] | <|body_start_0|>
super().__init__(img=fishing_net_img, x=x, y=y)
self.set_sprite_center()
self.size = 0
self.visible = True
<|end_body_0|>
<|body_start_1|>
if self.scale <= 1:
self.size += 300 * dt
self.scale = self.size / 100
else:
se... | 渔网精灵 | NetSprite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetSprite:
"""渔网精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
<|body_0|>
def open(self, dt):
"""张开渔网"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init__(img=fishing_net_img, x=x, y=y)
self.set_sprite_center()
self.si... | stack_v2_sparse_classes_36k_train_005434 | 4,509 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self, x=0, y=0)"
},
{
"docstring": "张开渔网",
"name": "open",
"signature": "def open(self, dt)"
}
] | 2 | null | Implement the Python class `NetSprite` described below.
Class description:
渔网精灵
Method signatures and docstrings:
- def __init__(self, x=0, y=0): 初始化
- def open(self, dt): 张开渔网 | Implement the Python class `NetSprite` described below.
Class description:
渔网精灵
Method signatures and docstrings:
- def __init__(self, x=0, y=0): 初始化
- def open(self, dt): 张开渔网
<|skeleton|>
class NetSprite:
"""渔网精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
<|body_0|>
def open(self, dt)... | 941e29d5f39092b02f8486a435e61c7ec2bdcdb6 | <|skeleton|>
class NetSprite:
"""渔网精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
<|body_0|>
def open(self, dt):
"""张开渔网"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NetSprite:
"""渔网精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
super().__init__(img=fishing_net_img, x=x, y=y)
self.set_sprite_center()
self.size = 0
self.visible = True
def open(self, dt):
"""张开渔网"""
if self.scale <= 1:
self.size +=... | the_stack_v2_python_sparse | Python趣味编程:从入门到人工智能/第31课_捕鱼达人/示例程序/version3/game_sprites.py | zhy0313/children-python | train | 0 |
40aa15e865ce7a4e8693f5a4a15e58b0f2f37bfc | [
"self.msg = kargs.get('msg', '')\nself.value = kargs.get('value', 0)\nself.maxi = kargs.get('maxi', 100)\nif self.maxi == 0:\n self.maxi = 1\nself.form = kargs.get('format', '%3d%%')\nself.file = sys.stdout\nself.time = kargs.get('time', True)\nself._write(self.msg)\nself._write(self.form % 0, update=True)\nst =... | <|body_start_0|>
self.msg = kargs.get('msg', '')
self.value = kargs.get('value', 0)
self.maxi = kargs.get('maxi', 100)
if self.maxi == 0:
self.maxi = 1
self.form = kargs.get('format', '%3d%%')
self.file = sys.stdout
self.time = kargs.get('time', True)
... | This class allows to easily follow the progress of a task. | Progress | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Progress:
"""This class allows to easily follow the progress of a task."""
def __init__(self, **kargs):
"""Initialization"""
<|body_0|>
def _write(self, txt, update=False):
"""Print progress if in a terminal."""
<|body_1|>
def Update(self, value):
... | stack_v2_sparse_classes_36k_train_005435 | 3,392 | no_license | [
{
"docstring": "Initialization",
"name": "__init__",
"signature": "def __init__(self, **kargs)"
},
{
"docstring": "Print progress if in a terminal.",
"name": "_write",
"signature": "def _write(self, txt, update=False)"
},
{
"docstring": "Set the progress indicator to 'value' and ... | 4 | null | Implement the Python class `Progress` described below.
Class description:
This class allows to easily follow the progress of a task.
Method signatures and docstrings:
- def __init__(self, **kargs): Initialization
- def _write(self, txt, update=False): Print progress if in a terminal.
- def Update(self, value): Set th... | Implement the Python class `Progress` described below.
Class description:
This class allows to easily follow the progress of a task.
Method signatures and docstrings:
- def __init__(self, **kargs): Initialization
- def _write(self, txt, update=False): Print progress if in a terminal.
- def Update(self, value): Set th... | 62592c0f17be823caad8ea71cd52841acbab6185 | <|skeleton|>
class Progress:
"""This class allows to easily follow the progress of a task."""
def __init__(self, **kargs):
"""Initialization"""
<|body_0|>
def _write(self, txt, update=False):
"""Print progress if in a terminal."""
<|body_1|>
def Update(self, value):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Progress:
"""This class allows to easily follow the progress of a task."""
def __init__(self, **kargs):
"""Initialization"""
self.msg = kargs.get('msg', '')
self.value = kargs.get('value', 0)
self.maxi = kargs.get('maxi', 100)
if self.maxi == 0:
self.ma... | the_stack_v2_python_sparse | asrun/progress.py | zhanxiangqian/salome | train | 1 |
d7367642f37563412ff457f45f0547494861dfd6 | [
"left, right = (0, len(height) - 1)\nleft_max = right_max = water_area = 0\nwhile left < right:\n if height[left] < height[right]:\n if height[left] > left_max:\n left_max = height[left]\n water_area += left_max - height[left]\n left += 1\n else:\n if height[right] > rig... | <|body_start_0|>
left, right = (0, len(height) - 1)
left_max = right_max = water_area = 0
while left < right:
if height[left] < height[right]:
if height[left] > left_max:
left_max = height[left]
water_area += left_max - height[left]... | RainWater | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RainWater:
def get_area(self, height: List[int]) -> int:
"""Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:"""
<|body_0|>
def get_area_(self, height: List[int]) -> int:
"""Approach: Pointers Time Complexity: O(N) Space Comp... | stack_v2_sparse_classes_36k_train_005436 | 1,629 | no_license | [
{
"docstring": "Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:",
"name": "get_area",
"signature": "def get_area(self, height: List[int]) -> int"
},
{
"docstring": "Approach: Pointers Time Complexity: O(N) Space Complexity: O(N) :param height: :return:... | 2 | null | Implement the Python class `RainWater` described below.
Class description:
Implement the RainWater class.
Method signatures and docstrings:
- def get_area(self, height: List[int]) -> int: Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:
- def get_area_(self, height: List[int... | Implement the Python class `RainWater` described below.
Class description:
Implement the RainWater class.
Method signatures and docstrings:
- def get_area(self, height: List[int]) -> int: Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:
- def get_area_(self, height: List[int... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class RainWater:
def get_area(self, height: List[int]) -> int:
"""Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:"""
<|body_0|>
def get_area_(self, height: List[int]) -> int:
"""Approach: Pointers Time Complexity: O(N) Space Comp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RainWater:
def get_area(self, height: List[int]) -> int:
"""Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:"""
left, right = (0, len(height) - 1)
left_max = right_max = water_area = 0
while left < right:
if height[left] < ... | the_stack_v2_python_sparse | revisited_2021/arrays/two_pointers/trapping_rain_water.py | Shiv2157k/leet_code | train | 1 | |
b3638010a594275bf6f8ecf0f9183159d539d1f6 | [
"if not head or not head.next:\n return True\ncursor = head\ncnt = 0\nwhile cursor:\n cnt += 1\n cursor = cursor.next\nmid = cnt // 2\npre = None\ncur = head\nwhile mid > 0:\n nxt = cur.next\n cur.next = pre\n pre = cur\n cur = nxt\n mid -= 1\nnxt = cur if cnt % 2 == 0 else cur.next\nwhile p... | <|body_start_0|>
if not head or not head.next:
return True
cursor = head
cnt = 0
while cursor:
cnt += 1
cursor = cursor.next
mid = cnt // 2
pre = None
cur = head
while mid > 0:
nxt = cur.next
cur.... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def isPalindromeOther(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head or not head.next:
... | stack_v2_sparse_classes_36k_train_005437 | 1,826 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "isPalindromeOther",
"signature": "def isPalindromeOther(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002420 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head): :type head: ListNode :rtype: bool
- def isPalindromeOther(self, head): :type head: ListNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head): :type head: ListNode :rtype: bool
- def isPalindromeOther(self, head): :type head: ListNode :rtype: bool
<|skeleton|>
class Solution:
def isPa... | 387074588c50973b6fb8645f859ae9ca29b4df4c | <|skeleton|>
class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def isPalindromeOther(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
if not head or not head.next:
return True
cursor = head
cnt = 0
while cursor:
cnt += 1
cursor = cursor.next
mid = cnt // 2
pre = None
... | the_stack_v2_python_sparse | Coding/Algorithm/Code/LeetCodeCn/Primary/025.py | bovenson/notes | train | 8 | |
671b465df7a8d2c52079e979fe61c2685e3a402d | [
"try:\n return self.content_type.get_object_for_this_type(pk=self.object_id)\nexcept self.content_type.model_class().DoesNotExist:\n return None",
"obj = self.get_edited_object()\nif not obj or not self.partner:\n return None\nbase_urls = {'contact': reverse('edit_contact'), 'contact record': reverse('re... | <|body_start_0|>
try:
return self.content_type.get_object_for_this_type(pk=self.object_id)
except self.content_type.model_class().DoesNotExist:
return None
<|end_body_0|>
<|body_start_1|>
obj = self.get_edited_object()
if not obj or not self.partner:
... | ContactLogEntry | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContactLogEntry:
def get_edited_object(self):
"""Returns the edited object represented by this log entry"""
<|body_0|>
def get_object_url(self):
"""Creates the link that leads to the view/edit view for that object."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_005438 | 34,734 | no_license | [
{
"docstring": "Returns the edited object represented by this log entry",
"name": "get_edited_object",
"signature": "def get_edited_object(self)"
},
{
"docstring": "Creates the link that leads to the view/edit view for that object.",
"name": "get_object_url",
"signature": "def get_object... | 2 | stack_v2_sparse_classes_30k_train_009423 | Implement the Python class `ContactLogEntry` described below.
Class description:
Implement the ContactLogEntry class.
Method signatures and docstrings:
- def get_edited_object(self): Returns the edited object represented by this log entry
- def get_object_url(self): Creates the link that leads to the view/edit view f... | Implement the Python class `ContactLogEntry` described below.
Class description:
Implement the ContactLogEntry class.
Method signatures and docstrings:
- def get_edited_object(self): Returns the edited object represented by this log entry
- def get_object_url(self): Creates the link that leads to the view/edit view f... | 100f22e25eea97979ded571c3d41010ad46dcd4e | <|skeleton|>
class ContactLogEntry:
def get_edited_object(self):
"""Returns the edited object represented by this log entry"""
<|body_0|>
def get_object_url(self):
"""Creates the link that leads to the view/edit view for that object."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContactLogEntry:
def get_edited_object(self):
"""Returns the edited object represented by this log entry"""
try:
return self.content_type.get_object_for_this_type(pk=self.object_id)
except self.content_type.model_class().DoesNotExist:
return None
def get_ob... | the_stack_v2_python_sparse | mypartners/models.py | surendrakgp/questov1 | train | 0 | |
c2a5ee09b26d58459efb493ffa1ff35f41e77a37 | [
"if root == None:\n return None\nleft = self.invert_tree(root.left)\nright = self.invert_tree(root.right)\nroot.left = right\nroot.right = left\nreturn root",
"if root == None:\n return None\nnode_list = []\nnode_list.append(root)\nwhile len(node_list) > 0:\n cur = node_list.pop()\n if cur.left:\n ... | <|body_start_0|>
if root == None:
return None
left = self.invert_tree(root.left)
right = self.invert_tree(root.right)
root.left = right
root.right = left
return root
<|end_body_0|>
<|body_start_1|>
if root == None:
return None
node... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def invert_tree(self, root: TreeNode) -> TreeNode:
"""翻转二叉树 Args: root: 根节点 Returns: TreeNode"""
<|body_0|>
def invert_tree2(self, root: TreeNode) -> TreeNode:
"""翻转二叉树 Args: root: 根节点 Returns: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_005439 | 2,228 | permissive | [
{
"docstring": "翻转二叉树 Args: root: 根节点 Returns: TreeNode",
"name": "invert_tree",
"signature": "def invert_tree(self, root: TreeNode) -> TreeNode"
},
{
"docstring": "翻转二叉树 Args: root: 根节点 Returns: TreeNode",
"name": "invert_tree2",
"signature": "def invert_tree2(self, root: TreeNode) -> T... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invert_tree(self, root: TreeNode) -> TreeNode: 翻转二叉树 Args: root: 根节点 Returns: TreeNode
- def invert_tree2(self, root: TreeNode) -> TreeNode: 翻转二叉树 Args: root: 根节点 Returns: Tr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invert_tree(self, root: TreeNode) -> TreeNode: 翻转二叉树 Args: root: 根节点 Returns: TreeNode
- def invert_tree2(self, root: TreeNode) -> TreeNode: 翻转二叉树 Args: root: 根节点 Returns: Tr... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def invert_tree(self, root: TreeNode) -> TreeNode:
"""翻转二叉树 Args: root: 根节点 Returns: TreeNode"""
<|body_0|>
def invert_tree2(self, root: TreeNode) -> TreeNode:
"""翻转二叉树 Args: root: 根节点 Returns: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def invert_tree(self, root: TreeNode) -> TreeNode:
"""翻转二叉树 Args: root: 根节点 Returns: TreeNode"""
if root == None:
return None
left = self.invert_tree(root.left)
right = self.invert_tree(root.right)
root.left = right
root.right = left
... | the_stack_v2_python_sparse | src/leetcodepython/tree/invert_binary_tree_226.py | zhangyu345293721/leetcode | train | 101 | |
b46f3b2d2c50dc0c81120c6629f7394ada9bd497 | [
"self.minhasher = minhasher\nn = minhasher.n\nassert n % b == 0\nr = n // b\nself.r = r\nself.b = b\nself.dc = dc\nd = dc.cnt\nself.buckets = np.full(b, {})\nself.docth = np.zeros((d, b), dtype=int)\nfor i in range(b):\n for j in range(d):\n low = int(i * r)\n high = int((i + 1) * r)\n l = m... | <|body_start_0|>
self.minhasher = minhasher
n = minhasher.n
assert n % b == 0
r = n // b
self.r = r
self.b = b
self.dc = dc
d = dc.cnt
self.buckets = np.full(b, {})
self.docth = np.zeros((d, b), dtype=int)
for i in range(b):
... | LSH | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSH:
def __init__(self, b, minhasher, dc):
"""Performs the Locality Sensitive Hashing using the signature matrix which is the output of the MinHasher b: number of bands r: number of rows in each band condition br = n n: number of hash function (number of rows in the signature matrix)"""
... | stack_v2_sparse_classes_36k_train_005440 | 2,153 | no_license | [
{
"docstring": "Performs the Locality Sensitive Hashing using the signature matrix which is the output of the MinHasher b: number of bands r: number of rows in each band condition br = n n: number of hash function (number of rows in the signature matrix)",
"name": "__init__",
"signature": "def __init__(... | 2 | stack_v2_sparse_classes_30k_train_019260 | Implement the Python class `LSH` described below.
Class description:
Implement the LSH class.
Method signatures and docstrings:
- def __init__(self, b, minhasher, dc): Performs the Locality Sensitive Hashing using the signature matrix which is the output of the MinHasher b: number of bands r: number of rows in each b... | Implement the Python class `LSH` described below.
Class description:
Implement the LSH class.
Method signatures and docstrings:
- def __init__(self, b, minhasher, dc): Performs the Locality Sensitive Hashing using the signature matrix which is the output of the MinHasher b: number of bands r: number of rows in each b... | 8a1ae6c28993d0e040f377923d9a3a8c24adf8d9 | <|skeleton|>
class LSH:
def __init__(self, b, minhasher, dc):
"""Performs the Locality Sensitive Hashing using the signature matrix which is the output of the MinHasher b: number of bands r: number of rows in each band condition br = n n: number of hash function (number of rows in the signature matrix)"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LSH:
def __init__(self, b, minhasher, dc):
"""Performs the Locality Sensitive Hashing using the signature matrix which is the output of the MinHasher b: number of bands r: number of rows in each band condition br = n n: number of hash function (number of rows in the signature matrix)"""
self.m... | the_stack_v2_python_sparse | lsh.py | Raghu150999/locality-sensitive-hashing | train | 0 | |
1e17bba4d10b3e3bb60773cde4b0d46e80516e01 | [
"self._logspec = save_kwargs.pop('logspec', [])\nsuper(_FunctorSubtask, self).__init__(*save_args, **save_kwargs)\nself._func = _func\nif self._logspec:\n if len(self._logspec) < 2 or not callable(self._logspec[0]):\n raise ValueError('logspec must be a list comprising a callable followed by a format stri... | <|body_start_0|>
self._logspec = save_kwargs.pop('logspec', [])
super(_FunctorSubtask, self).__init__(*save_args, **save_kwargs)
self._func = _func
if self._logspec:
if len(self._logspec) < 2 or not callable(self._logspec[0]):
raise ValueError('logspec must be... | Shim to create a Subtask around an existing callable. | _FunctorSubtask | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _FunctorSubtask:
"""Shim to create a Subtask around an existing callable."""
def __init__(self, _func, *save_args, **save_kwargs):
"""Save the callable as well as the arguments. :param _func: Callable to be invoked under the WrapperTask. :param save_args: See Subtask.__init__(save_ar... | stack_v2_sparse_classes_36k_train_005441 | 36,787 | permissive | [
{
"docstring": "Save the callable as well as the arguments. :param _func: Callable to be invoked under the WrapperTask. :param save_args: See Subtask.__init__(save_args). :param save_kwargs: See Subtask.__init__(save_kwargs). May contain the following values, which are treated specially and NOT passed to the ca... | 2 | stack_v2_sparse_classes_30k_train_008148 | Implement the Python class `_FunctorSubtask` described below.
Class description:
Shim to create a Subtask around an existing callable.
Method signatures and docstrings:
- def __init__(self, _func, *save_args, **save_kwargs): Save the callable as well as the arguments. :param _func: Callable to be invoked under the Wr... | Implement the Python class `_FunctorSubtask` described below.
Class description:
Shim to create a Subtask around an existing callable.
Method signatures and docstrings:
- def __init__(self, _func, *save_args, **save_kwargs): Save the callable as well as the arguments. :param _func: Callable to be invoked under the Wr... | 68f2b586b4f17489f379534ab52fc56a524b6da5 | <|skeleton|>
class _FunctorSubtask:
"""Shim to create a Subtask around an existing callable."""
def __init__(self, _func, *save_args, **save_kwargs):
"""Save the callable as well as the arguments. :param _func: Callable to be invoked under the WrapperTask. :param save_args: See Subtask.__init__(save_ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _FunctorSubtask:
"""Shim to create a Subtask around an existing callable."""
def __init__(self, _func, *save_args, **save_kwargs):
"""Save the callable as well as the arguments. :param _func: Callable to be invoked under the WrapperTask. :param save_args: See Subtask.__init__(save_args). :param s... | the_stack_v2_python_sparse | pypowervm/utils/transaction.py | powervm/pypowervm | train | 25 |
b50bc4c089ecf59773f79a7df170a8b19574028e | [
"if canAppAccessDatabase():\n self.generate_part_thumbnails()\n self.update_trackable_status()",
"from .models import Part\nlogger.debug('InvenTree: Checking Part image thumbnails')\ntry:\n for part in Part.objects.exclude(image=None):\n if part.image:\n url = part.image.thumbnail.name\... | <|body_start_0|>
if canAppAccessDatabase():
self.generate_part_thumbnails()
self.update_trackable_status()
<|end_body_0|>
<|body_start_1|>
from .models import Part
logger.debug('InvenTree: Checking Part image thumbnails')
try:
for part in Part.objects... | PartConfig | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PartConfig:
def ready(self):
"""This function is called whenever the Part app is loaded."""
<|body_0|>
def generate_part_thumbnails(self):
"""Generate thumbnail images for any Part that does not have one. This function exists mainly for legacy support, as any *new* i... | stack_v2_sparse_classes_36k_train_005442 | 2,687 | permissive | [
{
"docstring": "This function is called whenever the Part app is loaded.",
"name": "ready",
"signature": "def ready(self)"
},
{
"docstring": "Generate thumbnail images for any Part that does not have one. This function exists mainly for legacy support, as any *new* image uploaded will have a thu... | 3 | null | Implement the Python class `PartConfig` described below.
Class description:
Implement the PartConfig class.
Method signatures and docstrings:
- def ready(self): This function is called whenever the Part app is loaded.
- def generate_part_thumbnails(self): Generate thumbnail images for any Part that does not have one.... | Implement the Python class `PartConfig` described below.
Class description:
Implement the PartConfig class.
Method signatures and docstrings:
- def ready(self): This function is called whenever the Part app is loaded.
- def generate_part_thumbnails(self): Generate thumbnail images for any Part that does not have one.... | 2a0ea66f6591756eeb62da28d24daec3ad4209e8 | <|skeleton|>
class PartConfig:
def ready(self):
"""This function is called whenever the Part app is loaded."""
<|body_0|>
def generate_part_thumbnails(self):
"""Generate thumbnail images for any Part that does not have one. This function exists mainly for legacy support, as any *new* i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PartConfig:
def ready(self):
"""This function is called whenever the Part app is loaded."""
if canAppAccessDatabase():
self.generate_part_thumbnails()
self.update_trackable_status()
def generate_part_thumbnails(self):
"""Generate thumbnail images for any Pa... | the_stack_v2_python_sparse | InvenTree/part/apps.py | MedShift/InvenTree | train | 0 | |
37872d5fb8f1f2bf9d849b84d23c695fd01abc0e | [
"query = Program.get_query(info)\nif author:\n user = UserModel.find_by_username(author)\n return query.order_by(ProgramModel.name.desc()).filter(ProgramModel.author == user.id).all()\nreturn query.all()",
"query = Program.get_query(info)\nif id:\n return query.filter(ProgramModel.id == id).first()\nif n... | <|body_start_0|>
query = Program.get_query(info)
if author:
user = UserModel.find_by_username(author)
return query.order_by(ProgramModel.name.desc()).filter(ProgramModel.author == user.id).all()
return query.all()
<|end_body_0|>
<|body_start_1|>
query = Program.g... | Query | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Query:
def resolve_programs(root, info, author=None):
"""Return a list of programs. Search by author: A user's username."""
<|body_0|>
def resolve_program(root, info, id: int=None, name: str=None):
"""Search for program in decreasing order of precedence: id, name."""... | stack_v2_sparse_classes_36k_train_005443 | 1,247 | no_license | [
{
"docstring": "Return a list of programs. Search by author: A user's username.",
"name": "resolve_programs",
"signature": "def resolve_programs(root, info, author=None)"
},
{
"docstring": "Search for program in decreasing order of precedence: id, name.",
"name": "resolve_program",
"sign... | 2 | stack_v2_sparse_classes_30k_train_017078 | Implement the Python class `Query` described below.
Class description:
Implement the Query class.
Method signatures and docstrings:
- def resolve_programs(root, info, author=None): Return a list of programs. Search by author: A user's username.
- def resolve_program(root, info, id: int=None, name: str=None): Search f... | Implement the Python class `Query` described below.
Class description:
Implement the Query class.
Method signatures and docstrings:
- def resolve_programs(root, info, author=None): Return a list of programs. Search by author: A user's username.
- def resolve_program(root, info, id: int=None, name: str=None): Search f... | f0056da32453fce0a9dece90508fcdcad8cc905b | <|skeleton|>
class Query:
def resolve_programs(root, info, author=None):
"""Return a list of programs. Search by author: A user's username."""
<|body_0|>
def resolve_program(root, info, id: int=None, name: str=None):
"""Search for program in decreasing order of precedence: id, name."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Query:
def resolve_programs(root, info, author=None):
"""Return a list of programs. Search by author: A user's username."""
query = Program.get_query(info)
if author:
user = UserModel.find_by_username(author)
return query.order_by(ProgramModel.name.desc()).filte... | the_stack_v2_python_sparse | stronk/schemas/program/query.py | not-monday/stronk-backend | train | 3 | |
4c0c3e8d0e90520c56a8ab879e9f81e0f45483a4 | [
"if not isinstance(env_vars, dict):\n raise TypeError('env variables not passed in as dictionary')\nif 'GMAPS_KEY' not in env_vars:\n raise KeyError('GMAPS_KEY not found in .env file')\nself.gmaps = googlemaps.Client(key=env_vars['GMAPS_KEY'])",
"assert isinstance(start, str) and isinstance(destination, str... | <|body_start_0|>
if not isinstance(env_vars, dict):
raise TypeError('env variables not passed in as dictionary')
if 'GMAPS_KEY' not in env_vars:
raise KeyError('GMAPS_KEY not found in .env file')
self.gmaps = googlemaps.Client(key=env_vars['GMAPS_KEY'])
<|end_body_0|>
<|... | This class is a decorator class to the Google Maps Directions API. | DirectionsClient | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DirectionsClient:
"""This class is a decorator class to the Google Maps Directions API."""
def __init__(self, env_vars):
"""Loads the token and initializes the googlemaps client API :param env_vars: the enviornment variables dict :raises TypeError: if the environment variables not pa... | stack_v2_sparse_classes_36k_train_005444 | 2,341 | no_license | [
{
"docstring": "Loads the token and initializes the googlemaps client API :param env_vars: the enviornment variables dict :raises TypeError: if the environment variables not passed in as dictionary :raises KeyError: when the GMAPS_KEY token is not set in the .env file",
"name": "__init__",
"signature": ... | 3 | stack_v2_sparse_classes_30k_train_006664 | Implement the Python class `DirectionsClient` described below.
Class description:
This class is a decorator class to the Google Maps Directions API.
Method signatures and docstrings:
- def __init__(self, env_vars): Loads the token and initializes the googlemaps client API :param env_vars: the enviornment variables di... | Implement the Python class `DirectionsClient` described below.
Class description:
This class is a decorator class to the Google Maps Directions API.
Method signatures and docstrings:
- def __init__(self, env_vars): Loads the token and initializes the googlemaps client API :param env_vars: the enviornment variables di... | 821c146de73b773ae63a6bccceecfa9fbecb7e92 | <|skeleton|>
class DirectionsClient:
"""This class is a decorator class to the Google Maps Directions API."""
def __init__(self, env_vars):
"""Loads the token and initializes the googlemaps client API :param env_vars: the enviornment variables dict :raises TypeError: if the environment variables not pa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DirectionsClient:
"""This class is a decorator class to the Google Maps Directions API."""
def __init__(self, env_vars):
"""Loads the token and initializes the googlemaps client API :param env_vars: the enviornment variables dict :raises TypeError: if the environment variables not passed in as di... | the_stack_v2_python_sparse | site/utils/directionsClient.py | aaronluo8/ECE_229_project | train | 0 |
76b7ecea7bfcd392342ffc9b6bdb3578616006ec | [
"x_ = x - ra_0\ny_ = y - dec_0\nf_ = 1 / 2.0 * (gamma1 * x_ * x_ + 2 * gamma2 * x_ * y_ - gamma1 * y_ * y_)\nreturn f_",
"x_ = x - ra_0\ny_ = y - dec_0\nf_x = gamma1 * x_ + gamma2 * y_\nf_y = +gamma2 * x_ - gamma1 * y_\nreturn (f_x, f_y)",
"gamma1 = gamma1\ngamma2 = gamma2\nkappa = 0\nf_xx = kappa + gamma1\nf_y... | <|body_start_0|>
x_ = x - ra_0
y_ = y - dec_0
f_ = 1 / 2.0 * (gamma1 * x_ * x_ + 2 * gamma2 * x_ * y_ - gamma1 * y_ * y_)
return f_
<|end_body_0|>
<|body_start_1|>
x_ = x - ra_0
y_ = y - dec_0
f_x = gamma1 * x_ + gamma2 * y_
f_y = +gamma2 * x_ - gamma1 * ... | class for external shear gamma1, gamma2 expression | Shear | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Shear:
"""class for external shear gamma1, gamma2 expression"""
def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0):
""":param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where ... | stack_v2_sparse_classes_36k_train_005445 | 7,557 | permissive | [
{
"docstring": ":param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where shear deflection is 0 :param dec_0: y/dec position where shear deflection is 0 :return: lensing potential",
"name": "function",
"s... | 3 | stack_v2_sparse_classes_30k_train_008377 | Implement the Python class `Shear` described below.
Class description:
class for external shear gamma1, gamma2 expression
Method signatures and docstrings:
- def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0): :param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param ... | Implement the Python class `Shear` described below.
Class description:
class for external shear gamma1, gamma2 expression
Method signatures and docstrings:
- def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0): :param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param ... | 73c9645f26f6983fe7961104075ebe8bf7a4b54c | <|skeleton|>
class Shear:
"""class for external shear gamma1, gamma2 expression"""
def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0):
""":param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Shear:
"""class for external shear gamma1, gamma2 expression"""
def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0):
""":param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where shear deflect... | the_stack_v2_python_sparse | lenstronomy/LensModel/Profiles/shear.py | lenstronomy/lenstronomy | train | 41 |
6c3b0896585a2b834791b7db54084116cb9587fc | [
"self.ide = identity_element\nself.lide = lazy_ide\nself.func = segfunc\nn = len(ls)\nself.num = 2 ** (n - 1).bit_length()\nself.tree = [self.ide] * (2 * self.num)\nself.lazy = [self.lide] * (2 * self.num)\nfor i, l in enumerate(ls):\n self.tree[i + self.num - 1] = l\nfor i in range(self.num - 2, -1, -1):\n s... | <|body_start_0|>
self.ide = identity_element
self.lide = lazy_ide
self.func = segfunc
n = len(ls)
self.num = 2 ** (n - 1).bit_length()
self.tree = [self.ide] * (2 * self.num)
self.lazy = [self.lide] * (2 * self.num)
for i, l in enumerate(ls):
s... | SegmentTreeForRMQandRAQ | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegmentTreeForRMQandRAQ:
def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=0):
"""セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83... | stack_v2_sparse_classes_36k_train_005446 | 23,273 | no_license | [
{
"docstring": "セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83)",
"name": "__init__",
"signature": "def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, laz... | 4 | null | Implement the Python class `SegmentTreeForRMQandRAQ` described below.
Class description:
Implement the SegmentTreeForRMQandRAQ class.
Method signatures and docstrings:
- def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=0): セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity... | Implement the Python class `SegmentTreeForRMQandRAQ` described below.
Class description:
Implement the SegmentTreeForRMQandRAQ class.
Method signatures and docstrings:
- def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=0): セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity... | 74915a40ac157f89fe400e3f98e9bf3c10012cd7 | <|skeleton|>
class SegmentTreeForRMQandRAQ:
def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=0):
"""セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SegmentTreeForRMQandRAQ:
def __init__(self, ls: list, segfunc=min, identity_element=2 ** 63, lazy_ide=0):
"""セグ木 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83)"""
s... | the_stack_v2_python_sparse | algorithm/SegmentTree.py | masakiaota/kyoupuro | train | 1 | |
0c9671f10f71bb0a12d37f3f714c9347c553721a | [
"self.documents = []\nif self.data.get('general_information', None):\n self.form = self._make_form(self.well, GeneralInformationForm, self.data['general_information'])\nif self.data.get('documents', None):\n for document in self.data['documents']:\n well_doc = WellDocument.objects.get(id=document['id_d... | <|body_start_0|>
self.documents = []
if self.data.get('general_information', None):
self.form = self._make_form(self.well, GeneralInformationForm, self.data['general_information'])
if self.data.get('documents', None):
for document in self.data['documents']:
... | Collection form for general information section | GeneralInformationCreateForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneralInformationCreateForm:
"""Collection form for general information section"""
def create(self):
"""create form from data"""
<|body_0|>
def save(self):
"""save all available data"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.document... | stack_v2_sparse_classes_36k_train_005447 | 1,717 | no_license | [
{
"docstring": "create form from data",
"name": "create",
"signature": "def create(self)"
},
{
"docstring": "save all available data",
"name": "save",
"signature": "def save(self)"
}
] | 2 | null | Implement the Python class `GeneralInformationCreateForm` described below.
Class description:
Collection form for general information section
Method signatures and docstrings:
- def create(self): create form from data
- def save(self): save all available data | Implement the Python class `GeneralInformationCreateForm` described below.
Class description:
Collection form for general information section
Method signatures and docstrings:
- def create(self): create form from data
- def save(self): save all available data
<|skeleton|>
class GeneralInformationCreateForm:
"""C... | fc036f9f8346dee2d40287d08375a6c2af0a1a12 | <|skeleton|>
class GeneralInformationCreateForm:
"""Collection form for general information section"""
def create(self):
"""create form from data"""
<|body_0|>
def save(self):
"""save all available data"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GeneralInformationCreateForm:
"""Collection form for general information section"""
def create(self):
"""create form from data"""
self.documents = []
if self.data.get('general_information', None):
self.form = self._make_form(self.well, GeneralInformationForm, self.data... | the_stack_v2_python_sparse | views/form_group/general_information.py | Alexia-Water/IGRAC-WellAndMonitoringDatabase | train | 0 |
6ebf63c9d54c90ed1ae7f66c9e5c20942d655750 | [
"self.archive_task_uid = archive_task_uid\nself.archive_version = archive_version\nself.expiry_time_usecs = expiry_time_usecs\nself.index_size_bytes = index_size_bytes\nself.job_run_id = job_run_id\nself.metadata_complete = metadata_complete\nself.run_type = run_type\nself.snapshot_time_usecs = snapshot_time_usecs"... | <|body_start_0|>
self.archive_task_uid = archive_task_uid
self.archive_version = archive_version
self.expiry_time_usecs = expiry_time_usecs
self.index_size_bytes = index_size_bytes
self.job_run_id = job_run_id
self.metadata_complete = metadata_complete
self.run_ty... | Implementation of the 'RemoteProtectionJobRunInstance' model. Specifies details about one Job Run (Snapshot) archived to a remote Vault that was captured by a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies the globally unique id of the archival task that archived the Snapshot to the Vault. archiv... | RemoteProtectionJobRunInstance | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteProtectionJobRunInstance:
"""Implementation of the 'RemoteProtectionJobRunInstance' model. Specifies details about one Job Run (Snapshot) archived to a remote Vault that was captured by a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies the globally unique id of the arc... | stack_v2_sparse_classes_36k_train_005448 | 4,762 | permissive | [
{
"docstring": "Constructor for the RemoteProtectionJobRunInstance class",
"name": "__init__",
"signature": "def __init__(self, archive_task_uid=None, archive_version=None, expiry_time_usecs=None, index_size_bytes=None, job_run_id=None, metadata_complete=None, run_type=None, snapshot_time_usecs=None)"
... | 2 | null | Implement the Python class `RemoteProtectionJobRunInstance` described below.
Class description:
Implementation of the 'RemoteProtectionJobRunInstance' model. Specifies details about one Job Run (Snapshot) archived to a remote Vault that was captured by a Protection Job. Attributes: archive_task_uid (UniversalId): Spec... | Implement the Python class `RemoteProtectionJobRunInstance` described below.
Class description:
Implementation of the 'RemoteProtectionJobRunInstance' model. Specifies details about one Job Run (Snapshot) archived to a remote Vault that was captured by a Protection Job. Attributes: archive_task_uid (UniversalId): Spec... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RemoteProtectionJobRunInstance:
"""Implementation of the 'RemoteProtectionJobRunInstance' model. Specifies details about one Job Run (Snapshot) archived to a remote Vault that was captured by a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies the globally unique id of the arc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RemoteProtectionJobRunInstance:
"""Implementation of the 'RemoteProtectionJobRunInstance' model. Specifies details about one Job Run (Snapshot) archived to a remote Vault that was captured by a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies the globally unique id of the archival task th... | the_stack_v2_python_sparse | cohesity_management_sdk/models/remote_protection_job_run_instance.py | cohesity/management-sdk-python | train | 24 |
1e3c0d58b901105f8a9febeb0cfa48272742e4ea | [
"context = req.environ['nova.context']\ncontext.can(sg_policies.POLICY_NAME % 'show', target={'project_id': context.project_id})\ntry:\n id = security_group_api.validate_id(id)\n security_group = security_group_api.get(context, id)\nexcept exception.SecurityGroupNotFound as exp:\n raise exc.HTTPNotFound(ex... | <|body_start_0|>
context = req.environ['nova.context']
context.can(sg_policies.POLICY_NAME % 'show', target={'project_id': context.project_id})
try:
id = security_group_api.validate_id(id)
security_group = security_group_api.get(context, id)
except exception.Secur... | The Security group API controller for the OpenStack API. | SecurityGroupController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecurityGroupController:
"""The Security group API controller for the OpenStack API."""
def show(self, req, id):
"""Return data about the given security group."""
<|body_0|>
def delete(self, req, id):
"""Delete a security group."""
<|body_1|>
def ind... | stack_v2_sparse_classes_36k_train_005449 | 20,601 | permissive | [
{
"docstring": "Return data about the given security group.",
"name": "show",
"signature": "def show(self, req, id)"
},
{
"docstring": "Delete a security group.",
"name": "delete",
"signature": "def delete(self, req, id)"
},
{
"docstring": "Returns a list of security groups.",
... | 5 | stack_v2_sparse_classes_30k_train_010010 | Implement the Python class `SecurityGroupController` described below.
Class description:
The Security group API controller for the OpenStack API.
Method signatures and docstrings:
- def show(self, req, id): Return data about the given security group.
- def delete(self, req, id): Delete a security group.
- def index(s... | Implement the Python class `SecurityGroupController` described below.
Class description:
The Security group API controller for the OpenStack API.
Method signatures and docstrings:
- def show(self, req, id): Return data about the given security group.
- def delete(self, req, id): Delete a security group.
- def index(s... | 065c5906d2da3e2bb6eeb3a7a15d4cd8d98b35e9 | <|skeleton|>
class SecurityGroupController:
"""The Security group API controller for the OpenStack API."""
def show(self, req, id):
"""Return data about the given security group."""
<|body_0|>
def delete(self, req, id):
"""Delete a security group."""
<|body_1|>
def ind... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SecurityGroupController:
"""The Security group API controller for the OpenStack API."""
def show(self, req, id):
"""Return data about the given security group."""
context = req.environ['nova.context']
context.can(sg_policies.POLICY_NAME % 'show', target={'project_id': context.proj... | the_stack_v2_python_sparse | nova/api/openstack/compute/security_groups.py | openstack/nova | train | 2,287 |
14c1512509693fb6d022249e3072269127349476 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Provide raw access to get and set parameters. | ParamServiceServicer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParamServiceServicer:
"""Provide raw access to get and set parameters."""
def GetParamInt(self, request, context):
"""Get an int parameter. If the type is wrong, the result will be `WRONG_TYPE`."""
<|body_0|>
def SetParamInt(self, request, context):
"""Set an int... | stack_v2_sparse_classes_36k_train_005450 | 4,941 | permissive | [
{
"docstring": "Get an int parameter. If the type is wrong, the result will be `WRONG_TYPE`.",
"name": "GetParamInt",
"signature": "def GetParamInt(self, request, context)"
},
{
"docstring": "Set an int parameter. If the type is wrong, the result will be `WRONG_TYPE`.",
"name": "SetParamInt"... | 5 | stack_v2_sparse_classes_30k_val_000128 | Implement the Python class `ParamServiceServicer` described below.
Class description:
Provide raw access to get and set parameters.
Method signatures and docstrings:
- def GetParamInt(self, request, context): Get an int parameter. If the type is wrong, the result will be `WRONG_TYPE`.
- def SetParamInt(self, request,... | Implement the Python class `ParamServiceServicer` described below.
Class description:
Provide raw access to get and set parameters.
Method signatures and docstrings:
- def GetParamInt(self, request, context): Get an int parameter. If the type is wrong, the result will be `WRONG_TYPE`.
- def SetParamInt(self, request,... | a328834518621842f530804572ecb3baeec31805 | <|skeleton|>
class ParamServiceServicer:
"""Provide raw access to get and set parameters."""
def GetParamInt(self, request, context):
"""Get an int parameter. If the type is wrong, the result will be `WRONG_TYPE`."""
<|body_0|>
def SetParamInt(self, request, context):
"""Set an int... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParamServiceServicer:
"""Provide raw access to get and set parameters."""
def GetParamInt(self, request, context):
"""Get an int parameter. If the type is wrong, the result will be `WRONG_TYPE`."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not imp... | the_stack_v2_python_sparse | mavsdk/param_pb2_grpc.py | PML-UCF/MAVSDK-Python | train | 0 |
2097bc5c81179f9667a9a53a3530837eca0cac9d | [
"if len(nums) < 3:\n return []\nif nums[0] * nums[-1] > 0:\n return []\nj, k = (1, len(nums) - 1)\nx = nums[0]\ntarget = x * -1\nresult = []\nalready_calculate = []\nwhile j < k:\n y = nums[j]\n z = nums[k]\n sum = y + z\n if sum > target:\n k -= 1\n elif sum < target:\n j += 1\n ... | <|body_start_0|>
if len(nums) < 3:
return []
if nums[0] * nums[-1] > 0:
return []
j, k = (1, len(nums) - 1)
x = nums[0]
target = x * -1
result = []
already_calculate = []
while j < k:
y = nums[j]
z = nums[k]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pairs(self, nums):
""":param nums: :return: >>> s = Solution() >>> s.pairs([-5, -4, -1, 0, 1, 3, 7]) [] >>> s.pairs([-4, -1, 0, 1, 3, 7]) [(-4, 1, 3)] >>> s.pairs([-1, 0, 1, 3, 7]) [(-1, 0, 1)] >>> s.pairs([0, 1, 3, 7]) []"""
<|body_0|>
def threeSum(self, nums)... | stack_v2_sparse_classes_36k_train_005451 | 2,009 | no_license | [
{
"docstring": ":param nums: :return: >>> s = Solution() >>> s.pairs([-5, -4, -1, 0, 1, 3, 7]) [] >>> s.pairs([-4, -1, 0, 1, 3, 7]) [(-4, 1, 3)] >>> s.pairs([-1, 0, 1, 3, 7]) [(-1, 0, 1)] >>> s.pairs([0, 1, 3, 7]) []",
"name": "pairs",
"signature": "def pairs(self, nums)"
},
{
"docstring": ":typ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pairs(self, nums): :param nums: :return: >>> s = Solution() >>> s.pairs([-5, -4, -1, 0, 1, 3, 7]) [] >>> s.pairs([-4, -1, 0, 1, 3, 7]) [(-4, 1, 3)] >>> s.pairs([-1, 0, 1, 3, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pairs(self, nums): :param nums: :return: >>> s = Solution() >>> s.pairs([-5, -4, -1, 0, 1, 3, 7]) [] >>> s.pairs([-4, -1, 0, 1, 3, 7]) [(-4, 1, 3)] >>> s.pairs([-1, 0, 1, 3, ... | 3b13a02f9c8273f9794a57b948d2655792707f37 | <|skeleton|>
class Solution:
def pairs(self, nums):
""":param nums: :return: >>> s = Solution() >>> s.pairs([-5, -4, -1, 0, 1, 3, 7]) [] >>> s.pairs([-4, -1, 0, 1, 3, 7]) [(-4, 1, 3)] >>> s.pairs([-1, 0, 1, 3, 7]) [(-1, 0, 1)] >>> s.pairs([0, 1, 3, 7]) []"""
<|body_0|>
def threeSum(self, nums)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def pairs(self, nums):
""":param nums: :return: >>> s = Solution() >>> s.pairs([-5, -4, -1, 0, 1, 3, 7]) [] >>> s.pairs([-4, -1, 0, 1, 3, 7]) [(-4, 1, 3)] >>> s.pairs([-1, 0, 1, 3, 7]) [(-1, 0, 1)] >>> s.pairs([0, 1, 3, 7]) []"""
if len(nums) < 3:
return []
if num... | the_stack_v2_python_sparse | 3sum.py | gsy/leetcode | train | 1 | |
9786d654210c0adc1b38dee72c277cef9406f71c | [
"super().__init__(input_tensor_spec, input_preprocessors, preprocessing_combiner=preprocessing_combiner, name=name)\nif kernel_initializer is None:\n kernel_initializer = functools.partial(variance_scaling_init, mode='fan_in', distribution='truncated_normal', nonlinearity=activation)\nembedding_layers = nn.Modul... | <|body_start_0|>
super().__init__(input_tensor_spec, input_preprocessors, preprocessing_combiner=preprocessing_combiner, name=name)
if kernel_initializer is None:
kernel_initializer = functools.partial(variance_scaling_init, mode='fan_in', distribution='truncated_normal', nonlinearity=activa... | Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250 | SocialAttentionNetwork | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SocialAttentionNetwork:
"""Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250"""
def __init__(self, input_tensor_spec, input... | stack_v2_sparse_classes_36k_train_005452 | 16,672 | permissive | [
{
"docstring": "Args: input_tensor_spec (nested TensorSpec): the (nested) tensor spec of the input. If nested, then ``preprocessing_combiner`` must not be None. input_preprocessors (nested InputPreprocessor): a nest of ``InputPreprocessor``, each of which will be applied to the corresponding input. If not None,... | 2 | null | Implement the Python class `SocialAttentionNetwork` described below.
Class description:
Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250
Method sign... | Implement the Python class `SocialAttentionNetwork` described below.
Class description:
Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250
Method sign... | b00ff2fa5e660de31020338ba340263183fbeaa4 | <|skeleton|>
class SocialAttentionNetwork:
"""Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250"""
def __init__(self, input_tensor_spec, input... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SocialAttentionNetwork:
"""Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250"""
def __init__(self, input_tensor_spec, input_preprocessor... | the_stack_v2_python_sparse | alf/networks/transformer_networks.py | HorizonRobotics/alf | train | 288 |
e313911d9d4030dcb4de24f2498f46cfab6e6190 | [
"permission_classes = [IsAuthenticated]\nif self.action in ('add_balance',):\n permission_classes += [IsAdminUser]\nelif self.action in ('update', 'partial_update'):\n permission_classes += [IsProfileOwnerOrStaff]\nreturn [permission() for permission in permission_classes]",
"if self.action == 'add_balance'... | <|body_start_0|>
permission_classes = [IsAuthenticated]
if self.action in ('add_balance',):
permission_classes += [IsAdminUser]
elif self.action in ('update', 'partial_update'):
permission_classes += [IsProfileOwnerOrStaff]
return [permission() for permission in p... | ProfileViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileViewSet:
def get_permissions(self) -> List[BasePermission]:
"""Allow `add_balance` only to staff, updating to staff and the current user"""
<|body_0|>
def get_serializer_class(self) -> Type[BaseSerializer]:
"""Change serializer class for custom actions"""
... | stack_v2_sparse_classes_36k_train_005453 | 5,976 | permissive | [
{
"docstring": "Allow `add_balance` only to staff, updating to staff and the current user",
"name": "get_permissions",
"signature": "def get_permissions(self) -> List[BasePermission]"
},
{
"docstring": "Change serializer class for custom actions",
"name": "get_serializer_class",
"signatu... | 4 | stack_v2_sparse_classes_30k_test_000340 | Implement the Python class `ProfileViewSet` described below.
Class description:
Implement the ProfileViewSet class.
Method signatures and docstrings:
- def get_permissions(self) -> List[BasePermission]: Allow `add_balance` only to staff, updating to staff and the current user
- def get_serializer_class(self) -> Type[... | Implement the Python class `ProfileViewSet` described below.
Class description:
Implement the ProfileViewSet class.
Method signatures and docstrings:
- def get_permissions(self) -> List[BasePermission]: Allow `add_balance` only to staff, updating to staff and the current user
- def get_serializer_class(self) -> Type[... | a898caa068cd82d223161fa62a0561f75333d50e | <|skeleton|>
class ProfileViewSet:
def get_permissions(self) -> List[BasePermission]:
"""Allow `add_balance` only to staff, updating to staff and the current user"""
<|body_0|>
def get_serializer_class(self) -> Type[BaseSerializer]:
"""Change serializer class for custom actions"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProfileViewSet:
def get_permissions(self) -> List[BasePermission]:
"""Allow `add_balance` only to staff, updating to staff and the current user"""
permission_classes = [IsAuthenticated]
if self.action in ('add_balance',):
permission_classes += [IsAdminUser]
elif sel... | the_stack_v2_python_sparse | users/views.py | coma64/kaffee-kasse-backend | train | 0 | |
63ea4dcd5c0304418a13cccf3b12cfa055cbe659 | [
"l = len(nums)\nif l < 3:\n return False\ns3 = -float('inf')\ni = l - 1\nwhile i >= 0:\n if i > 0 and nums[i - 1] > nums[i]:\n s3 = max([x for x in nums[i:] if x < nums[i - 1]])\n if i - 2 >= 0 and nums[i - 2] < s3:\n return True\n elif nums[i] < s3:\n return True\n i -= ... | <|body_start_0|>
l = len(nums)
if l < 3:
return False
s3 = -float('inf')
i = l - 1
while i >= 0:
if i > 0 and nums[i - 1] > nums[i]:
s3 = max([x for x in nums[i:] if x < nums[i - 1]])
if i - 2 >= 0 and nums[i - 2] < s3:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def find132pattern1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def find132pattern(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l = len(nums)
if l < 3:
... | stack_v2_sparse_classes_36k_train_005454 | 1,060 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "find132pattern1",
"signature": "def find132pattern1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "find132pattern",
"signature": "def find132pattern(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern1(self, nums): :type nums: List[int] :rtype: bool
- def find132pattern(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern1(self, nums): :type nums: List[int] :rtype: bool
- def find132pattern(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
def fi... | e5b018493bbd12edcdcd0434f35d9c358106d391 | <|skeleton|>
class Solution:
def find132pattern1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def find132pattern(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def find132pattern1(self, nums):
""":type nums: List[int] :rtype: bool"""
l = len(nums)
if l < 3:
return False
s3 = -float('inf')
i = l - 1
while i >= 0:
if i > 0 and nums[i - 1] > nums[i]:
s3 = max([x for x in n... | the_stack_v2_python_sparse | py/leetcode/456.py | wfeng1991/learnpy | train | 0 | |
820e2dff412b2620efbc7822dd2001f3da8b03a8 | [
"integ = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\nalphabet = [' ', '*', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']\nindex = dict(zip(integ, alphabet))\nif i < 0:\n return (i, A, B, C)\nelif A[i] == len(index[B[i]]):\n for j in range(i, len(A)):\n A[j] = 0\n i = i - 1\n A[i] = A[i] + 1\n ... | <|body_start_0|>
integ = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
alphabet = [' ', '*', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
index = dict(zip(integ, alphabet))
if i < 0:
return (i, A, B, C)
elif A[i] == len(index[B[i]]):
for j in range(i, len(A)... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reprint(self, i, A, B, C):
""":type i: num :type digit:str :rtype: List[str], num"""
<|body_0|>
def letterCombinations(self, digits):
""":type digits: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
integ = [0, 1,... | stack_v2_sparse_classes_36k_train_005455 | 1,400 | no_license | [
{
"docstring": ":type i: num :type digit:str :rtype: List[str], num",
"name": "reprint",
"signature": "def reprint(self, i, A, B, C)"
},
{
"docstring": ":type digits: str :rtype: List[str]",
"name": "letterCombinations",
"signature": "def letterCombinations(self, digits)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reprint(self, i, A, B, C): :type i: num :type digit:str :rtype: List[str], num
- def letterCombinations(self, digits): :type digits: str :rtype: List[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reprint(self, i, A, B, C): :type i: num :type digit:str :rtype: List[str], num
- def letterCombinations(self, digits): :type digits: str :rtype: List[str]
<|skeleton|>
class... | 9752533bc76ce5ecb881f61e33a3bc4b20dcf666 | <|skeleton|>
class Solution:
def reprint(self, i, A, B, C):
""":type i: num :type digit:str :rtype: List[str], num"""
<|body_0|>
def letterCombinations(self, digits):
""":type digits: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reprint(self, i, A, B, C):
""":type i: num :type digit:str :rtype: List[str], num"""
integ = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
alphabet = [' ', '*', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
index = dict(zip(integ, alphabet))
if i < 0:
... | the_stack_v2_python_sparse | 017. Letter Combinations of a Phone Number/17. Letter Combinations of a Phone Number.py | 603lzy/LeetCode | train | 3 | |
1c912191d2f29c56990d1b0b1194049e1c609429 | [
"if not root:\n return root\nstack = []\npre = None\ncur = root\nwhile cur or stack:\n while cur:\n stack.append(cur)\n cur = cur.right\n cur = stack.pop()\n if pre:\n cur.val += pre.val\n pre = cur\n cur = cur.left\nreturn root",
"if not root:\n return root\nself.pre = N... | <|body_start_0|>
if not root:
return root
stack = []
pre = None
cur = root
while cur or stack:
while cur:
stack.append(cur)
cur = cur.right
cur = stack.pop()
if pre:
cur.val += pre.val... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def convertBST(self, root):
""":type root: TreeNode :rtype: TreeNode :解法:迭代+中序遍历"""
<|body_0|>
def convertBST1(self, root):
""":type root: TreeNode :rtype: TreeNode :解法:递归+中序遍历"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
... | stack_v2_sparse_classes_36k_train_005456 | 1,455 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode :解法:迭代+中序遍历",
"name": "convertBST",
"signature": "def convertBST(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: TreeNode :解法:递归+中序遍历",
"name": "convertBST1",
"signature": "def convertBST1(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def convertBST(self, root): :type root: TreeNode :rtype: TreeNode :解法:迭代+中序遍历
- def convertBST1(self, root): :type root: TreeNode :rtype: TreeNode :解法:递归+中序遍历 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def convertBST(self, root): :type root: TreeNode :rtype: TreeNode :解法:迭代+中序遍历
- def convertBST1(self, root): :type root: TreeNode :rtype: TreeNode :解法:递归+中序遍历
<|skeleton|>
class... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def convertBST(self, root):
""":type root: TreeNode :rtype: TreeNode :解法:迭代+中序遍历"""
<|body_0|>
def convertBST1(self, root):
""":type root: TreeNode :rtype: TreeNode :解法:递归+中序遍历"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def convertBST(self, root):
""":type root: TreeNode :rtype: TreeNode :解法:迭代+中序遍历"""
if not root:
return root
stack = []
pre = None
cur = root
while cur or stack:
while cur:
stack.append(cur)
cur =... | the_stack_v2_python_sparse | out/production/leetcode/538.把二叉搜索树转换为累加树.py | yangyuxiang1996/leetcode | train | 0 | |
f82ae254c765166c3de130b28f3f1a59a127d1c0 | [
"deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc)\nfield_data.delta_P_dc -= deltap[0]\nfield_data.delta_P_omega -= deltap[1]",
"deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc)\nfield_data.delta_P_dc += deltap[0]\nfield_data.delta_P_omega += deltap[1]",
"delta... | <|body_start_0|>
deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc)
field_data.delta_P_dc -= deltap[0]
field_data.delta_P_omega -= deltap[1]
<|end_body_0|>
<|body_start_1|>
deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc)
field_d... | similarity_drift_maps | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class similarity_drift_maps:
def S_r(self, field_data, ptcl_data):
"""Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing"""
<|body_0|>
def S_r_inverse(self, field_data, ptcl_data):
"""Compute the ef... | stack_v2_sparse_classes_36k_train_005457 | 1,804 | permissive | [
{
"docstring": "Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing",
"name": "S_r",
"signature": "def S_r(self, field_data, ptcl_data)"
},
{
"docstring": "Compute the effects of the r-inverse similarity map on the fields ... | 4 | stack_v2_sparse_classes_30k_train_006912 | Implement the Python class `similarity_drift_maps` described below.
Class description:
Implement the similarity_drift_maps class.
Method signatures and docstrings:
- def S_r(self, field_data, ptcl_data): Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :retu... | Implement the Python class `similarity_drift_maps` described below.
Class description:
Implement the similarity_drift_maps class.
Method signatures and docstrings:
- def S_r(self, field_data, ptcl_data): Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :retu... | 14b119267686c64e2d0fcd3be19c365b8d486e22 | <|skeleton|>
class similarity_drift_maps:
def S_r(self, field_data, ptcl_data):
"""Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing"""
<|body_0|>
def S_r_inverse(self, field_data, ptcl_data):
"""Compute the ef... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class similarity_drift_maps:
def S_r(self, field_data, ptcl_data):
"""Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing"""
deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc)
field_data.delta_P... | the_stack_v2_python_sparse | rssympim/sympim_rz/maps/similarity_drift_maps.py | radiasoft/rssympim | train | 2 | |
26b1517a6e2c5437372bb81c8e3256d15dcb8c9e | [
"end = int(target / 2) + 1\nresult = []\nfor i in range(1, end):\n for j in range(i + 1, end + 1):\n total = (i + j) * (j - i + 1) / 2\n if total == target:\n result.append([x for x in range(i, j + 1)])\n break\nreturn result",
"result = []\nleft, right = (1, 2)\nwhile left ... | <|body_start_0|>
end = int(target / 2) + 1
result = []
for i in range(1, end):
for j in range(i + 1, end + 1):
total = (i + j) * (j - i + 1) / 2
if total == target:
result.append([x for x in range(i, j + 1)])
bre... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def find_continuous_sequence(self, target: int) -> List[List[int]]:
"""查找连续的序列 Args: target: 目标值 Returns: 目标数组"""
<|body_0|>
def find_continuous_sequence2(self, target: int) -> List[List[int]]:
"""查找连续的序列 Args: target: 目标值 Returns: 目标数组"""
<|body_1|... | stack_v2_sparse_classes_36k_train_005458 | 2,460 | permissive | [
{
"docstring": "查找连续的序列 Args: target: 目标值 Returns: 目标数组",
"name": "find_continuous_sequence",
"signature": "def find_continuous_sequence(self, target: int) -> List[List[int]]"
},
{
"docstring": "查找连续的序列 Args: target: 目标值 Returns: 目标数组",
"name": "find_continuous_sequence2",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_009848 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find_continuous_sequence(self, target: int) -> List[List[int]]: 查找连续的序列 Args: target: 目标值 Returns: 目标数组
- def find_continuous_sequence2(self, target: int) -> List[List[int]]:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find_continuous_sequence(self, target: int) -> List[List[int]]: 查找连续的序列 Args: target: 目标值 Returns: 目标数组
- def find_continuous_sequence2(self, target: int) -> List[List[int]]:... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def find_continuous_sequence(self, target: int) -> List[List[int]]:
"""查找连续的序列 Args: target: 目标值 Returns: 目标数组"""
<|body_0|>
def find_continuous_sequence2(self, target: int) -> List[List[int]]:
"""查找连续的序列 Args: target: 目标值 Returns: 目标数组"""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def find_continuous_sequence(self, target: int) -> List[List[int]]:
"""查找连续的序列 Args: target: 目标值 Returns: 目标数组"""
end = int(target / 2) + 1
result = []
for i in range(1, end):
for j in range(i + 1, end + 1):
total = (i + j) * (j - i + 1) / ... | the_stack_v2_python_sparse | src/leetcodepython/array/find_continuous_sequence_57.py | zhangyu345293721/leetcode | train | 101 | |
3b3cfc32aaddc1273f740d65b7261f4cfe82dbce | [
"if self.oriented_from == oriented_segment:\n return self.oriented_to\nelif self.oriented_to == oriented_segment:\n return self.oriented_from\nelif tolerant:\n return None\nelse:\n raise gfapy.NotFoundError(\"Oriented segment '{}' not found\\n\".format(repr(oriented_segment)) + 'Line: {}'.format(self))"... | <|body_start_0|>
if self.oriented_from == oriented_segment:
return self.oriented_to
elif self.oriented_to == oriented_segment:
return self.oriented_from
elif tolerant:
return None
else:
raise gfapy.NotFoundError("Oriented segment '{}' not f... | Other | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Other:
def other_oriented_segment(self, oriented_segment, tolerant=False):
"""Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segm... | stack_v2_sparse_classes_36k_train_005459 | 1,564 | permissive | [
{
"docstring": "Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segment_end is not a segment end of the line.",
"name": "other_oriented_segment",
... | 2 | stack_v2_sparse_classes_30k_train_020346 | Implement the Python class `Other` described below.
Class description:
Implement the Other class.
Method signatures and docstrings:
- def other_oriented_segment(self, oriented_segment, tolerant=False): Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns --... | Implement the Python class `Other` described below.
Class description:
Implement the Other class.
Method signatures and docstrings:
- def other_oriented_segment(self, oriented_segment, tolerant=False): Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns --... | 12b31daac26ab137b6ee4a29b4f14554ba962dcb | <|skeleton|>
class Other:
def other_oriented_segment(self, oriented_segment, tolerant=False):
"""Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segm... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Other:
def other_oriented_segment(self, oriented_segment, tolerant=False):
"""Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segment_end is not... | the_stack_v2_python_sparse | gfapy/line/edge/gfa1/other.py | ggonnella/gfapy | train | 63 | |
4a0521e733d7580ef3eba6519f3e26a369b68637 | [
"self.ratio = ratio\nself.kernel_size = 4\nsuper().__init__()",
"x, _ = equiangular_calculator(x, self.ratio)\nx = x.permute(0, 3, 1, 2)\nx = F.interpolate(x, scale_factor=(self.kernel_size, self.kernel_size), mode='nearest')\nx = reformat(x)\nreturn x"
] | <|body_start_0|>
self.ratio = ratio
self.kernel_size = 4
super().__init__()
<|end_body_0|>
<|body_start_1|>
x, _ = equiangular_calculator(x, self.ratio)
x = x.permute(0, 3, 1, 2)
x = F.interpolate(x, scale_factor=(self.kernel_size, self.kernel_size), mode='nearest')
... | EquiAngular Average Unpooling version 1 using the interpolate function when unpooling | EquiangularAvgUnpool | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EquiangularAvgUnpool:
"""EquiAngular Average Unpooling version 1 using the interpolate function when unpooling"""
def __init__(self, ratio):
"""Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data"""
<|body_0|>
def forward(self,... | stack_v2_sparse_classes_36k_train_005460 | 41,403 | no_license | [
{
"docstring": "Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data",
"name": "__init__",
"signature": "def __init__(self, ratio)"
},
{
"docstring": "calls pytorch's interpolate function to create the values while unpooling based on the nearby values A... | 2 | stack_v2_sparse_classes_30k_train_000676 | Implement the Python class `EquiangularAvgUnpool` described below.
Class description:
EquiAngular Average Unpooling version 1 using the interpolate function when unpooling
Method signatures and docstrings:
- def __init__(self, ratio): Initialization Args: ratio (float): ratio between latitude and longitude dimensions... | Implement the Python class `EquiangularAvgUnpool` described below.
Class description:
EquiAngular Average Unpooling version 1 using the interpolate function when unpooling
Method signatures and docstrings:
- def __init__(self, ratio): Initialization Args: ratio (float): ratio between latitude and longitude dimensions... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class EquiangularAvgUnpool:
"""EquiAngular Average Unpooling version 1 using the interpolate function when unpooling"""
def __init__(self, ratio):
"""Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data"""
<|body_0|>
def forward(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EquiangularAvgUnpool:
"""EquiAngular Average Unpooling version 1 using the interpolate function when unpooling"""
def __init__(self, ratio):
"""Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data"""
self.ratio = ratio
self.kernel_size = ... | the_stack_v2_python_sparse | generated/test_deepsphere_deepsphere_pytorch.py | jansel/pytorch-jit-paritybench | train | 35 |
81568dc2bb21ab0a42087a4a17a118f8f9673a7f | [
"if not root:\n return True\nnLeft = self.NodeDepth(root.left)\nnRight = self.NodeDepth(root.right)\nif nLeft - nRight > 1 or nRight - nLeft > 1:\n return False\nreturn self.isBalanced(root.left) and self.isBalanced(root.right)",
"if not node:\n return 0\nreturn max(self.NodeDepth(node.left), self.NodeDe... | <|body_start_0|>
if not root:
return True
nLeft = self.NodeDepth(root.left)
nRight = self.NodeDepth(root.right)
if nLeft - nRight > 1 or nRight - nLeft > 1:
return False
return self.isBalanced(root.left) and self.isBalanced(root.right)
<|end_body_0|>
<|bo... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def NodeDepth(self, node):
"""DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return ... | stack_v2_sparse_classes_36k_train_005461 | 1,232 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isBalanced",
"signature": "def isBalanced(self, root)"
},
{
"docstring": "DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int",
"name": "NodeDepth",
"signature": "def NodeDepth(self, node)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001820 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced(self, root): :type root: TreeNode :rtype: bool
- def NodeDepth(self, node): DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced(self, root): :type root: TreeNode :rtype: bool
- def NodeDepth(self, node): DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
de... | f012740215568768794a019153af0b6e4c77b91b | <|skeleton|>
class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def NodeDepth(self, node):
"""DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
if not root:
return True
nLeft = self.NodeDepth(root.left)
nRight = self.NodeDepth(root.right)
if nLeft - nRight > 1 or nRight - nLeft > 1:
return False
return ... | the_stack_v2_python_sparse | No.110_BalancedBinaryTree.py | wh279813/LeetCode | train | 0 | |
818ffbb736d1ea751d8d5d51ff19bfe26a0a1db5 | [
"cur_max_end = min((itv[E] for itvs in schedule for itv in itvs))\nq = []\nfor i, itvs in enumerate(schedule):\n j = 0\n itv = itvs[j]\n heapq.heappush(q, (itv[S], i, j))\nret = []\nwhile q:\n _, i, j = heapq.heappop(q)\n itv = schedule[i][j]\n if cur_max_end < itv[S]:\n ret.append([cur_max... | <|body_start_0|>
cur_max_end = min((itv[E] for itvs in schedule for itv in itvs))
q = []
for i, itvs in enumerate(schedule):
j = 0
itv = itvs[j]
heapq.heappush(q, (itv[S], i, j))
ret = []
while q:
_, i, j = heapq.heappop(q)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]:
"""Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and co... | stack_v2_sparse_classes_36k_train_005462 | 11,144 | no_license | [
{
"docstring": "Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and compare to the min start time Method 2 Better algorithm to find the open interval [s, e], we can think ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]: Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]: Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, ... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class Solution:
def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]:
"""Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and co... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]:
"""Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and compare to the m... | the_stack_v2_python_sparse | leetcode_python/Array/employee-free-time.py | yennanliu/CS_basics | train | 64 | |
5238cf3ae77f67b0923551e58234b23a5d31a53a | [
"super(EmBreakoutIFMerge, self).__init__()\nself.service = GlobalModule.SERVICE_BREAKOUT\nself._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service]\nself._scenario_name = 'BreakoutIFMerge'\nself.device_type = 'device'",
"device__json_message = {'device': {'name': None, 'breakout-interface_value': 0, 'brea... | <|body_start_0|>
super(EmBreakoutIFMerge, self).__init__()
self.service = GlobalModule.SERVICE_BREAKOUT
self._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service]
self._scenario_name = 'BreakoutIFMerge'
self.device_type = 'device'
<|end_body_0|>
<|body_start_1|>
d... | BreakoutIF creation class | EmBreakoutIFMerge | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmBreakoutIFMerge:
"""BreakoutIF creation class"""
def __init__(self):
"""Constructor"""
<|body_0|>
def _creating_json(self, device_message):
"""Convert EC message (XML) divided for each device into JSON. Explanation about parameter: device_message: Message for e... | stack_v2_sparse_classes_36k_train_005463 | 3,216 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Convert EC message (XML) divided for each device into JSON. Explanation about parameter: device_message: Message for each device Explanation about return value device_json_message: JSON message... | 3 | null | Implement the Python class `EmBreakoutIFMerge` described below.
Class description:
BreakoutIF creation class
Method signatures and docstrings:
- def __init__(self): Constructor
- def _creating_json(self, device_message): Convert EC message (XML) divided for each device into JSON. Explanation about parameter: device_m... | Implement the Python class `EmBreakoutIFMerge` described below.
Class description:
BreakoutIF creation class
Method signatures and docstrings:
- def __init__(self): Constructor
- def _creating_json(self, device_message): Convert EC message (XML) divided for each device into JSON. Explanation about parameter: device_m... | e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f | <|skeleton|>
class EmBreakoutIFMerge:
"""BreakoutIF creation class"""
def __init__(self):
"""Constructor"""
<|body_0|>
def _creating_json(self, device_message):
"""Convert EC message (XML) divided for each device into JSON. Explanation about parameter: device_message: Message for e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmBreakoutIFMerge:
"""BreakoutIF creation class"""
def __init__(self):
"""Constructor"""
super(EmBreakoutIFMerge, self).__init__()
self.service = GlobalModule.SERVICE_BREAKOUT
self._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service]
self._scenario_name = '... | the_stack_v2_python_sparse | lib/Scenario/EmBreakoutIFMerge.py | lixiaochun/element-manager | train | 0 |
264b500238e2e0aa50fbf23ec1a26dff5741e31c | [
"self.detener = False\nself.tira = tira\nself.jpg = jpg\nself.pasos = pasos\nself.nuevo_pct_fila = nuevo_pct_fila\nself.tiempo_s = tiempo_s",
"if self.detener:\n return\nwhile self.nuevo_pct_fila > 100.0:\n self.nuevo_pct_fila -= 100.0\nself.tira.poner_imagen(self.jpg, self.pasos, self.nuevo_pct_fila, self.... | <|body_start_0|>
self.detener = False
self.tira = tira
self.jpg = jpg
self.pasos = pasos
self.nuevo_pct_fila = nuevo_pct_fila
self.tiempo_s = tiempo_s
<|end_body_0|>
<|body_start_1|>
if self.detener:
return
while self.nuevo_pct_fila > 100.0:
... | Siguiente iteracion de la imagen. | Siguiente | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Siguiente:
"""Siguiente iteracion de la imagen."""
def __init__(self, tira, jpg, pasos, nuevo_pct_fila, tiempo_s):
"""Siguiente iteracion de la imagen. Guarda referencia a todos los valores."""
<|body_0|>
def f(self):
"""Poner la siguiente imagen."""
<|bo... | stack_v2_sparse_classes_36k_train_005464 | 12,576 | no_license | [
{
"docstring": "Siguiente iteracion de la imagen. Guarda referencia a todos los valores.",
"name": "__init__",
"signature": "def __init__(self, tira, jpg, pasos, nuevo_pct_fila, tiempo_s)"
},
{
"docstring": "Poner la siguiente imagen.",
"name": "f",
"signature": "def f(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002384 | Implement the Python class `Siguiente` described below.
Class description:
Siguiente iteracion de la imagen.
Method signatures and docstrings:
- def __init__(self, tira, jpg, pasos, nuevo_pct_fila, tiempo_s): Siguiente iteracion de la imagen. Guarda referencia a todos los valores.
- def f(self): Poner la siguiente im... | Implement the Python class `Siguiente` described below.
Class description:
Siguiente iteracion de la imagen.
Method signatures and docstrings:
- def __init__(self, tira, jpg, pasos, nuevo_pct_fila, tiempo_s): Siguiente iteracion de la imagen. Guarda referencia a todos los valores.
- def f(self): Poner la siguiente im... | 8c62f28b9b4af3f609ae88c7ffa22fef45b99c24 | <|skeleton|>
class Siguiente:
"""Siguiente iteracion de la imagen."""
def __init__(self, tira, jpg, pasos, nuevo_pct_fila, tiempo_s):
"""Siguiente iteracion de la imagen. Guarda referencia a todos los valores."""
<|body_0|>
def f(self):
"""Poner la siguiente imagen."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Siguiente:
"""Siguiente iteracion de la imagen."""
def __init__(self, tira, jpg, pasos, nuevo_pct_fila, tiempo_s):
"""Siguiente iteracion de la imagen. Guarda referencia a todos los valores."""
self.detener = False
self.tira = tira
self.jpg = jpg
self.pasos = pasos... | the_stack_v2_python_sparse | tira.py | antonio-fiol/tren | train | 0 |
c8009485b360571ec704e38e2dedea7ba1e74faf | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | ChatServiceServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChatServiceServicer:
"""Missing associated documentation comment in .proto file."""
def CreateRoomChat(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetListRoomChat(self, request, context):
"""Missing assoc... | stack_v2_sparse_classes_36k_train_005465 | 17,987 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "CreateRoomChat",
"signature": "def CreateRoomChat(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetListRoomChat",
"signature": "def GetLis... | 4 | null | Implement the Python class `ChatServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def CreateRoomChat(self, request, context): Missing associated documentation comment in .proto file.
- def GetListRoomChat(self, request, co... | Implement the Python class `ChatServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def CreateRoomChat(self, request, context): Missing associated documentation comment in .proto file.
- def GetListRoomChat(self, request, co... | 8111787d1d20eb87733ae360d8baa745a65e2743 | <|skeleton|>
class ChatServiceServicer:
"""Missing associated documentation comment in .proto file."""
def CreateRoomChat(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetListRoomChat(self, request, context):
"""Missing assoc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChatServiceServicer:
"""Missing associated documentation comment in .proto file."""
def CreateRoomChat(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemente... | the_stack_v2_python_sparse | CmsAdmin/codegen_protos/interactive_main_service_pb2_grpc.py | Final-Game/social_network_backend | train | 0 |
8733bd22a91588b5457593e36eb7b02221839a35 | [
"self.can_fit = False\nif not isinstance(classifiers, list):\n warnings.warn('If a single classifier is passed, it should not have been loaded from disk due to cloning errors with models loaded from disk. If you are using pre-trained model(s), create a list of Estimator objects th... | <|body_start_0|>
self.can_fit = False
if not isinstance(classifiers, list):
warnings.warn('If a single classifier is passed, it should not have been loaded from disk due to cloning errors with models loaded from disk. If you are using pre-trained model(s), cre... | Implementation of Deep Partition Aggregation Defense. Training data is partitioned into disjoint buckets based on a hash function and a classifier is trained on each bucket. | Paper link: https://arxiv.org/abs/2006.14768 | DeepPartitionEnsemble | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeepPartitionEnsemble:
"""Implementation of Deep Partition Aggregation Defense. Training data is partitioned into disjoint buckets based on a hash function and a classifier is trained on each bucket. | Paper link: https://arxiv.org/abs/2006.14768"""
def __init__(self, classifiers: Union['CLA... | stack_v2_sparse_classes_36k_train_005466 | 10,027 | permissive | [
{
"docstring": ":param classifiers: The base model definition to use for defining the ensemble. If a list, the list must be the same size as the ensemble size. :param hash_function: The function used to partition the training data. If empty, the hash function will use the sum of the input values modulo the ense... | 3 | null | Implement the Python class `DeepPartitionEnsemble` described below.
Class description:
Implementation of Deep Partition Aggregation Defense. Training data is partitioned into disjoint buckets based on a hash function and a classifier is trained on each bucket. | Paper link: https://arxiv.org/abs/2006.14768
Method sig... | Implement the Python class `DeepPartitionEnsemble` described below.
Class description:
Implementation of Deep Partition Aggregation Defense. Training data is partitioned into disjoint buckets based on a hash function and a classifier is trained on each bucket. | Paper link: https://arxiv.org/abs/2006.14768
Method sig... | e7c763b650fa016ff9915da750d90ba0e876b1ef | <|skeleton|>
class DeepPartitionEnsemble:
"""Implementation of Deep Partition Aggregation Defense. Training data is partitioned into disjoint buckets based on a hash function and a classifier is trained on each bucket. | Paper link: https://arxiv.org/abs/2006.14768"""
def __init__(self, classifiers: Union['CLA... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeepPartitionEnsemble:
"""Implementation of Deep Partition Aggregation Defense. Training data is partitioned into disjoint buckets based on a hash function and a classifier is trained on each bucket. | Paper link: https://arxiv.org/abs/2006.14768"""
def __init__(self, classifiers: Union['CLASSIFIER_NEURA... | the_stack_v2_python_sparse | art/estimators/classification/deep_partition_ensemble.py | davidslater/adversarial-robustness-toolbox | train | 1 |
884e8b46a578412b236916b1de8a115205cc4990 | [
"self.ostype = self.NOSUPPORT\nself.version = self.ERRORVERS\nself.dist = platform.dist()\nself.system = platform.system()\nself.platform = platform.platform()\nself.uname = platform.uname()\nself.cpu_supported = self.uname[-1] in WhatOS.SUPPORTED_CPU_TYPES\nself.os_class_map = {WhatOS.LINUX_CLASS: self.linux, What... | <|body_start_0|>
self.ostype = self.NOSUPPORT
self.version = self.ERRORVERS
self.dist = platform.dist()
self.system = platform.system()
self.platform = platform.platform()
self.uname = platform.uname()
self.cpu_supported = self.uname[-1] in WhatOS.SUPPORTED_CPU_TY... | Determine OS-type and version of the system we run on and whether we run on a system that is supported. Only x86 systems are supported. All methods will return False if we are on another platform. On supported CPU platforms, the following methods are available: linux: determine OS-type and version for (some) Linux dist... | WhatOS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WhatOS:
"""Determine OS-type and version of the system we run on and whether we run on a system that is supported. Only x86 systems are supported. All methods will return False if we are on another platform. On supported CPU platforms, the following methods are available: linux: determine OS-type... | stack_v2_sparse_classes_36k_train_005467 | 13,877 | no_license | [
{
"docstring": "AnyOS instance creation",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Find Linux OS-type and major OS version",
"name": "linux",
"signature": "def linux(self)"
},
{
"docstring": "Find Solaris OS-type and major OS version",
"name": ... | 5 | null | Implement the Python class `WhatOS` described below.
Class description:
Determine OS-type and version of the system we run on and whether we run on a system that is supported. Only x86 systems are supported. All methods will return False if we are on another platform. On supported CPU platforms, the following methods ... | Implement the Python class `WhatOS` described below.
Class description:
Determine OS-type and version of the system we run on and whether we run on a system that is supported. Only x86 systems are supported. All methods will return False if we are on another platform. On supported CPU platforms, the following methods ... | 5e4a177ffb42018cf0626381f26990f55caf9a34 | <|skeleton|>
class WhatOS:
"""Determine OS-type and version of the system we run on and whether we run on a system that is supported. Only x86 systems are supported. All methods will return False if we are on another platform. On supported CPU platforms, the following methods are available: linux: determine OS-type... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WhatOS:
"""Determine OS-type and version of the system we run on and whether we run on a system that is supported. Only x86 systems are supported. All methods will return False if we are on another platform. On supported CPU platforms, the following methods are available: linux: determine OS-type and version ... | the_stack_v2_python_sparse | urb-core/tools/whatos.py | UnivaCorporation/urb-k8s | train | 21 |
56fd5285ce32ea1f8def2286a3a80c88c2db203f | [
"path = os.path.join(self.base_path, 'numbers.txt')\np = rdf_paths.PathSpec(path=path, pathtype=rdf_paths.PathSpec.PathType.OS)\nresult = self.RunAction(file_fingerprint.FingerprintFile, rdf_client_action.FingerprintRequest(pathspec=p))\ntypes = result[0].matching_types\nfingers = {}\nfor f in result[0].results:\n ... | <|body_start_0|>
path = os.path.join(self.base_path, 'numbers.txt')
p = rdf_paths.PathSpec(path=path, pathtype=rdf_paths.PathSpec.PathType.OS)
result = self.RunAction(file_fingerprint.FingerprintFile, rdf_client_action.FingerprintRequest(pathspec=p))
types = result[0].matching_types
... | Test fingerprinting files. | FilehashTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FilehashTest:
"""Test fingerprinting files."""
def testHashFile(self):
"""Can we hash a file?"""
<|body_0|>
def testMissingFile(self):
"""Fail on missing file?"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
path = os.path.join(self.base_path, '... | stack_v2_sparse_classes_36k_train_005468 | 2,018 | permissive | [
{
"docstring": "Can we hash a file?",
"name": "testHashFile",
"signature": "def testHashFile(self)"
},
{
"docstring": "Fail on missing file?",
"name": "testMissingFile",
"signature": "def testMissingFile(self)"
}
] | 2 | null | Implement the Python class `FilehashTest` described below.
Class description:
Test fingerprinting files.
Method signatures and docstrings:
- def testHashFile(self): Can we hash a file?
- def testMissingFile(self): Fail on missing file? | Implement the Python class `FilehashTest` described below.
Class description:
Test fingerprinting files.
Method signatures and docstrings:
- def testHashFile(self): Can we hash a file?
- def testMissingFile(self): Fail on missing file?
<|skeleton|>
class FilehashTest:
"""Test fingerprinting files."""
def te... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class FilehashTest:
"""Test fingerprinting files."""
def testHashFile(self):
"""Can we hash a file?"""
<|body_0|>
def testMissingFile(self):
"""Fail on missing file?"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FilehashTest:
"""Test fingerprinting files."""
def testHashFile(self):
"""Can we hash a file?"""
path = os.path.join(self.base_path, 'numbers.txt')
p = rdf_paths.PathSpec(path=path, pathtype=rdf_paths.PathSpec.PathType.OS)
result = self.RunAction(file_fingerprint.Fingerpri... | the_stack_v2_python_sparse | grr/client/grr_response_client/client_actions/file_fingerprint_test.py | google/grr | train | 4,683 |
ef51a6df46d30dc5f94294f1abda8e2bf1d0ad3c | [
"flag_config = trigger_utils.AddTriggerArgs(parser)\ntrigger_utils.AddBuildConfigArgs(flag_config)\ntrigger_utils.AddGitRepoSource(flag_config)",
"client = cloudbuild_util.GetClientInstance()\nmessages = cloudbuild_util.GetMessagesModule()\ntrigger = messages.BuildTrigger()\nif args.trigger_config:\n trigger =... | <|body_start_0|>
flag_config = trigger_utils.AddTriggerArgs(parser)
trigger_utils.AddBuildConfigArgs(flag_config)
trigger_utils.AddGitRepoSource(flag_config)
<|end_body_0|>
<|body_start_1|>
client = cloudbuild_util.GetClientInstance()
messages = cloudbuild_util.GetMessagesModule... | Create a build trigger with a manual trigger event. | CreateManual | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateManual:
"""Create a build trigger with a manual trigger event."""
def Args(parser):
"""Register flags for this command. Args: parser: An argparse.ArgumentParser-like object."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs t... | stack_v2_sparse_classes_36k_train_005469 | 4,478 | permissive | [
{
"docstring": "Register flags for this command. Args: parser: An argparse.ArgumentParser-like object.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring": "This is what gets called when the user runs this command. Args: args: An argparse namespace. All the arguments that were pro... | 2 | null | Implement the Python class `CreateManual` described below.
Class description:
Create a build trigger with a manual trigger event.
Method signatures and docstrings:
- def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object.
- def Run(self, args): This is what gets called... | Implement the Python class `CreateManual` described below.
Class description:
Create a build trigger with a manual trigger event.
Method signatures and docstrings:
- def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object.
- def Run(self, args): This is what gets called... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class CreateManual:
"""Create a build trigger with a manual trigger event."""
def Args(parser):
"""Register flags for this command. Args: parser: An argparse.ArgumentParser-like object."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CreateManual:
"""Create a build trigger with a manual trigger event."""
def Args(parser):
"""Register flags for this command. Args: parser: An argparse.ArgumentParser-like object."""
flag_config = trigger_utils.AddTriggerArgs(parser)
trigger_utils.AddBuildConfigArgs(flag_config)
... | the_stack_v2_python_sparse | lib/surface/builds/triggers/create/manual.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
61c103c58d3c039e7fe0e84c2829b052ea80c438 | [
"super().__init__(**kwargs)\nself.factory = factory\nself.curriculum_guide = curriculum_guide",
"curriculum_guide_sections_structure = self.load_yaml_file(self.structure_file_path)\nsection_numbers = []\nfor section_slug, section_structure in curriculum_guide_sections_structure.items():\n if section_structure ... | <|body_start_0|>
super().__init__(**kwargs)
self.factory = factory
self.curriculum_guide = curriculum_guide
<|end_body_0|>
<|body_start_1|>
curriculum_guide_sections_structure = self.load_yaml_file(self.structure_file_path)
section_numbers = []
for section_slug, section_... | Custom loader for loading curriculum guide sections. | CurriculumGuideSectionsLoader | [
"CC-BY-NC-SA-4.0",
"BSD-3-Clause",
"CC0-1.0",
"ISC",
"Unlicense",
"LicenseRef-scancode-secret-labs-2011",
"WTFPL",
"Apache-2.0",
"LGPL-3.0-only",
"MIT",
"CC-BY-SA-4.0",
"LicenseRef-scancode-public-domain",
"CC-BY-NC-2.5",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CurriculumGuideSectionsLoader:
"""Custom loader for loading curriculum guide sections."""
def __init__(self, factory, curriculum_guide, **kwargs):
"""Create the loader for loading curriculum guide sections. Args: factory: LoaderFactory object for creating loaders (LoaderFactory). cur... | stack_v2_sparse_classes_36k_train_005470 | 4,393 | permissive | [
{
"docstring": "Create the loader for loading curriculum guide sections. Args: factory: LoaderFactory object for creating loaders (LoaderFactory). curriculum_guide: Object of related curriculum guide model (CurriculumGuide).",
"name": "__init__",
"signature": "def __init__(self, factory, curriculum_guid... | 2 | stack_v2_sparse_classes_30k_train_001815 | Implement the Python class `CurriculumGuideSectionsLoader` described below.
Class description:
Custom loader for loading curriculum guide sections.
Method signatures and docstrings:
- def __init__(self, factory, curriculum_guide, **kwargs): Create the loader for loading curriculum guide sections. Args: factory: Loade... | Implement the Python class `CurriculumGuideSectionsLoader` described below.
Class description:
Custom loader for loading curriculum guide sections.
Method signatures and docstrings:
- def __init__(self, factory, curriculum_guide, **kwargs): Create the loader for loading curriculum guide sections. Args: factory: Loade... | ea3281ec6f4d17538f6d3cf6f88d74fa54581b34 | <|skeleton|>
class CurriculumGuideSectionsLoader:
"""Custom loader for loading curriculum guide sections."""
def __init__(self, factory, curriculum_guide, **kwargs):
"""Create the loader for loading curriculum guide sections. Args: factory: LoaderFactory object for creating loaders (LoaderFactory). cur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CurriculumGuideSectionsLoader:
"""Custom loader for loading curriculum guide sections."""
def __init__(self, factory, curriculum_guide, **kwargs):
"""Create the loader for loading curriculum guide sections. Args: factory: LoaderFactory object for creating loaders (LoaderFactory). curriculum_guide... | the_stack_v2_python_sparse | csfieldguide/curriculum_guides/management/commands/_CurriculumGuideSectionsLoader.py | uccser/cs-field-guide | train | 364 |
df8801b358a40c0079308ce0a943089d2866a5c5 | [
"if self.ufp_event_obj is not None:\n return cast(Event, getattr(obj, self.ufp_event_obj, None))\nreturn None",
"if event is None:\n return False\nnow = dt_util.utcnow()\nvalue = now > event.start\nif value and event.end is not None and (now > event.end):\n value = False\nreturn value"
] | <|body_start_0|>
if self.ufp_event_obj is not None:
return cast(Event, getattr(obj, self.ufp_event_obj, None))
return None
<|end_body_0|>
<|body_start_1|>
if event is None:
return False
now = dt_util.utcnow()
value = now > event.start
if value and... | Mixin for events. | ProtectEventMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProtectEventMixin:
"""Mixin for events."""
def get_event_obj(self, obj: T) -> Event | None:
"""Return value from UniFi Protect device."""
<|body_0|>
def get_is_on(self, event: Event | None) -> bool:
"""Return value if event is active."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k_train_005471 | 5,372 | permissive | [
{
"docstring": "Return value from UniFi Protect device.",
"name": "get_event_obj",
"signature": "def get_event_obj(self, obj: T) -> Event | None"
},
{
"docstring": "Return value if event is active.",
"name": "get_is_on",
"signature": "def get_is_on(self, event: Event | None) -> bool"
}... | 2 | stack_v2_sparse_classes_30k_train_001744 | Implement the Python class `ProtectEventMixin` described below.
Class description:
Mixin for events.
Method signatures and docstrings:
- def get_event_obj(self, obj: T) -> Event | None: Return value from UniFi Protect device.
- def get_is_on(self, event: Event | None) -> bool: Return value if event is active. | Implement the Python class `ProtectEventMixin` described below.
Class description:
Mixin for events.
Method signatures and docstrings:
- def get_event_obj(self, obj: T) -> Event | None: Return value from UniFi Protect device.
- def get_is_on(self, event: Event | None) -> bool: Return value if event is active.
<|skel... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ProtectEventMixin:
"""Mixin for events."""
def get_event_obj(self, obj: T) -> Event | None:
"""Return value from UniFi Protect device."""
<|body_0|>
def get_is_on(self, event: Event | None) -> bool:
"""Return value if event is active."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProtectEventMixin:
"""Mixin for events."""
def get_event_obj(self, obj: T) -> Event | None:
"""Return value from UniFi Protect device."""
if self.ufp_event_obj is not None:
return cast(Event, getattr(obj, self.ufp_event_obj, None))
return None
def get_is_on(self, ... | the_stack_v2_python_sparse | homeassistant/components/unifiprotect/models.py | home-assistant/core | train | 35,501 |
aa066272064ae6d8963e1367bc71819e5fbdea45 | [
"super().__init__()\nself.in_features = in_features\nself.scan_weight = torch.nn.Parameter(torch.zeros(in_features, 1))\nself.apply(initialise_layer_weights)",
"item = input[0]\nB, C, Z, Y, X = item.shape\nf_avg_2d = torch.nn.functional.avg_pool3d(item, [1, Y, X])\nnormalized_weight = TF.softmax(self.scan_weight,... | <|body_start_0|>
super().__init__()
self.in_features = in_features
self.scan_weight = torch.nn.Parameter(torch.zeros(in_features, 1))
self.apply(initialise_layer_weights)
<|end_body_0|>
<|body_start_1|>
item = input[0]
B, C, Z, Y, X = item.shape
f_avg_2d = torch.... | Performs 3D average pooling with custom weighting along the Z dimension. In short: extract the 2d average for each B-scan. Learn a weighting for averaging these features over all B-Scans. | ZAdaptive3dAvgLayer | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZAdaptive3dAvgLayer:
"""Performs 3D average pooling with custom weighting along the Z dimension. In short: extract the 2d average for each B-scan. Learn a weighting for averaging these features over all B-Scans."""
def __init__(self, in_features: int) -> None:
""":param in_features: ... | stack_v2_sparse_classes_36k_train_005472 | 4,772 | permissive | [
{
"docstring": ":param in_features: number of B-scan",
"name": "__init__",
"signature": "def __init__(self, in_features: int) -> None"
},
{
"docstring": ":param input: batch of size [B, C, Z, X, Y]",
"name": "forward",
"signature": "def forward(self, *input: torch.Tensor, **kwargs: Any) ... | 2 | stack_v2_sparse_classes_30k_train_021369 | Implement the Python class `ZAdaptive3dAvgLayer` described below.
Class description:
Performs 3D average pooling with custom weighting along the Z dimension. In short: extract the 2d average for each B-scan. Learn a weighting for averaging these features over all B-Scans.
Method signatures and docstrings:
- def __ini... | Implement the Python class `ZAdaptive3dAvgLayer` described below.
Class description:
Performs 3D average pooling with custom weighting along the Z dimension. In short: extract the 2d average for each B-scan. Learn a weighting for averaging these features over all B-Scans.
Method signatures and docstrings:
- def __ini... | 2877002d50d3a34d80f647c18cb561025d9066cc | <|skeleton|>
class ZAdaptive3dAvgLayer:
"""Performs 3D average pooling with custom weighting along the Z dimension. In short: extract the 2d average for each B-scan. Learn a weighting for averaging these features over all B-Scans."""
def __init__(self, in_features: int) -> None:
""":param in_features: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZAdaptive3dAvgLayer:
"""Performs 3D average pooling with custom weighting along the Z dimension. In short: extract the 2d average for each B-scan. Learn a weighting for averaging these features over all B-Scans."""
def __init__(self, in_features: int) -> None:
""":param in_features: number of B-s... | the_stack_v2_python_sparse | InnerEye/ML/models/layers/pooling_layers.py | microsoft/InnerEye-DeepLearning | train | 511 |
269c9c5f8d21277d3660bbd9fd6d464a19b70b4c | [
"if self.request.method == 'GET':\n return [permissions.IsAuthenticated()]\nif self.request.method == 'POST':\n return (IsSurgeon(),)\nif self.request.method == 'PATCH':\n return (IsCaseSurgeonOrOncologistOrRadiotherapist(),)\nreturn (permissions.IsAuthenticated(), IsCaseSurgeon())",
"queryset = Case.obj... | <|body_start_0|>
if self.request.method == 'GET':
return [permissions.IsAuthenticated()]
if self.request.method == 'POST':
return (IsSurgeon(),)
if self.request.method == 'PATCH':
return (IsCaseSurgeonOrOncologistOrRadiotherapist(),)
return (permission... | Case CRUD | CaseViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaseViewSet:
"""Case CRUD"""
def get_permissions(self):
"""Patients can view their cases Doctors can view their cases Surgeons can create case Surgeons can update and delete their own cases"""
<|body_0|>
def get_queryset(self):
"""Should return a list of all the ... | stack_v2_sparse_classes_36k_train_005473 | 15,503 | no_license | [
{
"docstring": "Patients can view their cases Doctors can view their cases Surgeons can create case Surgeons can update and delete their own cases",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Should return a list of all the cases for the currently auth... | 3 | stack_v2_sparse_classes_30k_train_014881 | Implement the Python class `CaseViewSet` described below.
Class description:
Case CRUD
Method signatures and docstrings:
- def get_permissions(self): Patients can view their cases Doctors can view their cases Surgeons can create case Surgeons can update and delete their own cases
- def get_queryset(self): Should retu... | Implement the Python class `CaseViewSet` described below.
Class description:
Case CRUD
Method signatures and docstrings:
- def get_permissions(self): Patients can view their cases Doctors can view their cases Surgeons can create case Surgeons can update and delete their own cases
- def get_queryset(self): Should retu... | 413664d4e77020c8fcb6bf95e31e3ff9908e2b60 | <|skeleton|>
class CaseViewSet:
"""Case CRUD"""
def get_permissions(self):
"""Patients can view their cases Doctors can view their cases Surgeons can create case Surgeons can update and delete their own cases"""
<|body_0|>
def get_queryset(self):
"""Should return a list of all the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaseViewSet:
"""Case CRUD"""
def get_permissions(self):
"""Patients can view their cases Doctors can view their cases Surgeons can create case Surgeons can update and delete their own cases"""
if self.request.method == 'GET':
return [permissions.IsAuthenticated()]
if s... | the_stack_v2_python_sparse | noccapp/views/case.py | otto-torino/nocc-server | train | 0 |
f63e104f39f9063a19ea6d2c943dbf8829e337f1 | [
"self.__logger = State().getLogger('Preprocessing_Component_Logger')\nself.__logger.info('Starting __init__()', 'Preprocessing:__init__()')\nself.__config = config\nordererPreporcessingUnitList = []\nnoiseFilterConfig = self.__config['GaussianBlurNoiseFilterPreprocessor']\nself.__gaussianBlurNoiseFilterPreprocessor... | <|body_start_0|>
self.__logger = State().getLogger('Preprocessing_Component_Logger')
self.__logger.info('Starting __init__()', 'Preprocessing:__init__()')
self.__config = config
ordererPreporcessingUnitList = []
noiseFilterConfig = self.__config['GaussianBlurNoiseFilterPreprocess... | Preprocessing | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Preprocessing:
def __init__(self, config):
"""Constructor, initialisiert Membervariablen Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Preprocessing(config)"""
<|body_0|>
def execute(self, mat):
"""Führt Preprocessingschritte auf die Bi... | stack_v2_sparse_classes_36k_train_005474 | 8,159 | no_license | [
{
"docstring": "Constructor, initialisiert Membervariablen Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Preprocessing(config)",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Führt Preprocessingschritte auf die BildMatrix aus und ... | 2 | stack_v2_sparse_classes_30k_train_003704 | Implement the Python class `Preprocessing` described below.
Class description:
Implement the Preprocessing class.
Method signatures and docstrings:
- def __init__(self, config): Constructor, initialisiert Membervariablen Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Preprocessing(config... | Implement the Python class `Preprocessing` described below.
Class description:
Implement the Preprocessing class.
Method signatures and docstrings:
- def __init__(self, config): Constructor, initialisiert Membervariablen Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Preprocessing(config... | 3daaa72b193ebfb55894b47b6a752cdc2192bb6b | <|skeleton|>
class Preprocessing:
def __init__(self, config):
"""Constructor, initialisiert Membervariablen Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Preprocessing(config)"""
<|body_0|>
def execute(self, mat):
"""Führt Preprocessingschritte auf die Bi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Preprocessing:
def __init__(self, config):
"""Constructor, initialisiert Membervariablen Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Preprocessing(config)"""
self.__logger = State().getLogger('Preprocessing_Component_Logger')
self.__logger.info('Startin... | the_stack_v2_python_sparse | SheetMusicScanner/Preprocessing_Component/Preprocessing/Preprocessing.py | jadeskon/score-scan | train | 0 | |
4b6c3485ae50f1976ab172e4a81c1791528b70a3 | [
"self.size = size\nself.queue = deque([])\nself.cur_sum = 0",
"cur_sum = 0\nif len(self.queue) < self.size:\n self.cur_sum += val\nelse:\n last_num = self.queue.popleft()\n self.cur_sum = self.cur_sum - last_num + val\nself.queue.append(val)\nreturn self.cur_sum / float(len(self.queue))"
] | <|body_start_0|>
self.size = size
self.queue = deque([])
self.cur_sum = 0
<|end_body_0|>
<|body_start_1|>
cur_sum = 0
if len(self.queue) < self.size:
self.cur_sum += val
else:
last_num = self.queue.popleft()
self.cur_sum = self.cur_sum... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.size = size
self.queue =... | stack_v2_sparse_classes_36k_train_005475 | 674 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019324 | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | a1b14fc7ecab09a838d70e0130ece27fb0fef7fd | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
self.size = size
self.queue = deque([])
self.cur_sum = 0
def next(self, val):
""":type val: int :rtype: float"""
cur_sum = 0
if len(self.queue) < sel... | the_stack_v2_python_sparse | Moving_Average_from_Data_Stream.py | Superbeet/LeetCode | train | 4 | |
604302862d9d71679915f730cb6233360bbd34a0 | [
"super(conv_7x1_1x7, self).__init__()\nself.stride = desc.stride\nself.channel_out = desc.C\nself.affine = desc.affine\nself.channel_out = channel_out\nself.data_format = desc.data_format",
"x = tf.nn.relu(x)\nx = tf.layers.conv2d(x, self.channel_out, (1, 7), strides=(1, self.stride), padding='same', use_bias=Fal... | <|body_start_0|>
super(conv_7x1_1x7, self).__init__()
self.stride = desc.stride
self.channel_out = desc.C
self.affine = desc.affine
self.channel_out = channel_out
self.data_format = desc.data_format
<|end_body_0|>
<|body_start_1|>
x = tf.nn.relu(x)
x = tf... | Class of 7x1 and 1x7 convolution. :param desc: description of conv_7x1_1x7 :type desc: Config | conv_7x1_1x7 | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class conv_7x1_1x7:
"""Class of 7x1 and 1x7 convolution. :param desc: description of conv_7x1_1x7 :type desc: Config"""
def __init__(self, desc):
"""Init conv_7x1_1x7."""
<|body_0|>
def __call__(self, x, training):
"""Forward function of conv_7x1_1x7."""
<|body... | stack_v2_sparse_classes_36k_train_005476 | 9,137 | permissive | [
{
"docstring": "Init conv_7x1_1x7.",
"name": "__init__",
"signature": "def __init__(self, desc)"
},
{
"docstring": "Forward function of conv_7x1_1x7.",
"name": "__call__",
"signature": "def __call__(self, x, training)"
}
] | 2 | null | Implement the Python class `conv_7x1_1x7` described below.
Class description:
Class of 7x1 and 1x7 convolution. :param desc: description of conv_7x1_1x7 :type desc: Config
Method signatures and docstrings:
- def __init__(self, desc): Init conv_7x1_1x7.
- def __call__(self, x, training): Forward function of conv_7x1_1... | Implement the Python class `conv_7x1_1x7` described below.
Class description:
Class of 7x1 and 1x7 convolution. :param desc: description of conv_7x1_1x7 :type desc: Config
Method signatures and docstrings:
- def __init__(self, desc): Init conv_7x1_1x7.
- def __call__(self, x, training): Forward function of conv_7x1_1... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class conv_7x1_1x7:
"""Class of 7x1 and 1x7 convolution. :param desc: description of conv_7x1_1x7 :type desc: Config"""
def __init__(self, desc):
"""Init conv_7x1_1x7."""
<|body_0|>
def __call__(self, x, training):
"""Forward function of conv_7x1_1x7."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class conv_7x1_1x7:
"""Class of 7x1 and 1x7 convolution. :param desc: description of conv_7x1_1x7 :type desc: Config"""
def __init__(self, desc):
"""Init conv_7x1_1x7."""
super(conv_7x1_1x7, self).__init__()
self.stride = desc.stride
self.channel_out = desc.C
self.affine... | the_stack_v2_python_sparse | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/search_space/networks/tensorflow/blocks/darts_ops.py | Huawei-Ascend/modelzoo | train | 1 |
621c2b327c87807d0df0eac211f6f2abf2fa521c | [
"d2 = copy.deepcopy(d)\ntarget_installation_platforms = dict()\nfor key in d['targetInstallationPlatforms']:\n target_installation_platforms[key] = TargetInstallationPlatform.from_dict(d['targetInstallationPlatforms'][key])\nd2['targetInstallationPlatforms'] = target_installation_platforms\napplications = list()... | <|body_start_0|>
d2 = copy.deepcopy(d)
target_installation_platforms = dict()
for key in d['targetInstallationPlatforms']:
target_installation_platforms[key] = TargetInstallationPlatform.from_dict(d['targetInstallationPlatforms'][key])
d2['targetInstallationPlatforms'] = targ... | InstallationConfiguration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstallationConfiguration:
def from_dict(cls, d):
""":type d: dict[str] :rtype: InstallerConfiguration"""
<|body_0|>
def __init__(self, installationRoot, tempDirectory, targetInstallationPlatforms, applications):
""":type installationRoot: str :type tempDirectory: st... | stack_v2_sparse_classes_36k_train_005477 | 8,065 | no_license | [
{
"docstring": ":type d: dict[str] :rtype: InstallerConfiguration",
"name": "from_dict",
"signature": "def from_dict(cls, d)"
},
{
"docstring": ":type installationRoot: str :type tempDirectory: str :type targetInstallationPlatforms: dict[str, TargetInstallationPlatform] :type applications: list[... | 2 | null | Implement the Python class `InstallationConfiguration` described below.
Class description:
Implement the InstallationConfiguration class.
Method signatures and docstrings:
- def from_dict(cls, d): :type d: dict[str] :rtype: InstallerConfiguration
- def __init__(self, installationRoot, tempDirectory, targetInstallatio... | Implement the Python class `InstallationConfiguration` described below.
Class description:
Implement the InstallationConfiguration class.
Method signatures and docstrings:
- def from_dict(cls, d): :type d: dict[str] :rtype: InstallerConfiguration
- def __init__(self, installationRoot, tempDirectory, targetInstallatio... | e298540f7b5f201779213850291337a8bded66c7 | <|skeleton|>
class InstallationConfiguration:
def from_dict(cls, d):
""":type d: dict[str] :rtype: InstallerConfiguration"""
<|body_0|>
def __init__(self, installationRoot, tempDirectory, targetInstallationPlatforms, applications):
""":type installationRoot: str :type tempDirectory: st... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InstallationConfiguration:
def from_dict(cls, d):
""":type d: dict[str] :rtype: InstallerConfiguration"""
d2 = copy.deepcopy(d)
target_installation_platforms = dict()
for key in d['targetInstallationPlatforms']:
target_installation_platforms[key] = TargetInstallatio... | the_stack_v2_python_sparse | phase02/immortals_repo/harness/installer/datatypes.py | TF-185/bbn-immortals | train | 0 | |
16477679afcc0ba738c30538c6a0b7c9eb6dd499 | [
"sql_str = '\\n SELECT id, email\\n FROM auth_user\\n '\nquery = ResetPassword._make_select(sql_str)\nuser_emails = []\nfor element in query:\n if 'email' in element:\n user_emails.append(element['email'])\nreturn user_emails",
"sql_str = '\\n ... | <|body_start_0|>
sql_str = '\n SELECT id, email\n FROM auth_user\n '
query = ResetPassword._make_select(sql_str)
user_emails = []
for element in query:
if 'email' in element:
user_emails.append(element['email'... | Class for reseting password. | ResetPassword | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResetPassword:
"""Class for reseting password."""
def get_list_of_user_emails():
"""Find user in database by his email. :return: List with all user emails."""
<|body_0|>
def update_password(user_email):
"""Method to find user in database by his email. :param user... | stack_v2_sparse_classes_36k_train_005478 | 1,405 | no_license | [
{
"docstring": "Find user in database by his email. :return: List with all user emails.",
"name": "get_list_of_user_emails",
"signature": "def get_list_of_user_emails()"
},
{
"docstring": "Method to find user in database by his email. :param user_email: Email from user.",
"name": "update_pas... | 2 | stack_v2_sparse_classes_30k_train_018056 | Implement the Python class `ResetPassword` described below.
Class description:
Class for reseting password.
Method signatures and docstrings:
- def get_list_of_user_emails(): Find user in database by his email. :return: List with all user emails.
- def update_password(user_email): Method to find user in database by h... | Implement the Python class `ResetPassword` described below.
Class description:
Class for reseting password.
Method signatures and docstrings:
- def get_list_of_user_emails(): Find user in database by his email. :return: List with all user emails.
- def update_password(user_email): Method to find user in database by h... | 7d8f85323cd553e1b7788b407f84f14d2563bd2b | <|skeleton|>
class ResetPassword:
"""Class for reseting password."""
def get_list_of_user_emails():
"""Find user in database by his email. :return: List with all user emails."""
<|body_0|>
def update_password(user_email):
"""Method to find user in database by his email. :param user... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResetPassword:
"""Class for reseting password."""
def get_list_of_user_emails():
"""Find user in database by his email. :return: List with all user emails."""
sql_str = '\n SELECT id, email\n FROM auth_user\n '
query = ResetPasswo... | the_stack_v2_python_sparse | moneta/src/python/db/reset_password.py | lv-386-python/moneta | train | 7 |
949ff2e5f05636420f35c8a6af33a435937b1420 | [
"data = queries.get_all_model_train_data(reverse=True)\npaginator = Paginator(data, 10)\npage_number = request.GET.get('page')\npage_obj = paginator.get_page(page_number)\nreturn render(request, 'data_manager_app/modelTrainData.html', {'form': self.form_class, 'datas': page_obj, 'search_form': self.search_form})",
... | <|body_start_0|>
data = queries.get_all_model_train_data(reverse=True)
paginator = Paginator(data, 10)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
return render(request, 'data_manager_app/modelTrainData.html', {'form': self.form_class, 'datas'... | ModelTrainData | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelTrainData:
def get(self, request):
"""Return all data from ModelTrainData :param request: :return:"""
<|body_0|>
def post(self, request):
"""Create record in model_train_data :param request: :return: Record if created, otherwise error"""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k_train_005479 | 9,663 | no_license | [
{
"docstring": "Return all data from ModelTrainData :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Create record in model_train_data :param request: :return: Record if created, otherwise error",
"name": "post",
"signature": "def post(se... | 2 | stack_v2_sparse_classes_30k_train_000122 | Implement the Python class `ModelTrainData` described below.
Class description:
Implement the ModelTrainData class.
Method signatures and docstrings:
- def get(self, request): Return all data from ModelTrainData :param request: :return:
- def post(self, request): Create record in model_train_data :param request: :ret... | Implement the Python class `ModelTrainData` described below.
Class description:
Implement the ModelTrainData class.
Method signatures and docstrings:
- def get(self, request): Return all data from ModelTrainData :param request: :return:
- def post(self, request): Create record in model_train_data :param request: :ret... | 2dedee10bded628a0eaecacc4554b421cc6f0ddd | <|skeleton|>
class ModelTrainData:
def get(self, request):
"""Return all data from ModelTrainData :param request: :return:"""
<|body_0|>
def post(self, request):
"""Create record in model_train_data :param request: :return: Record if created, otherwise error"""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelTrainData:
def get(self, request):
"""Return all data from ModelTrainData :param request: :return:"""
data = queries.get_all_model_train_data(reverse=True)
paginator = Paginator(data, 10)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_numb... | the_stack_v2_python_sparse | data_model_manager_app/views/model_train_data_manager_view.py | SonThanhNguyen13/django_data_manager | train | 0 | |
963347e62527801fc81b171503a3463a225d8569 | [
"result = {'result': 'NG', 'content': []}\nif doc_id:\n tags = CtrlDSScene().get_tags_by_doc_id(doc_id)\n if tags:\n result['result'] = 'OK'\n result['content'] = tags\n micro_ver = CtrlDsDoc().get_doc_ver(doc_id)\n result['micro_ver'] = micro_ver\nreturn result",
"result = {'result': 'N... | <|body_start_0|>
result = {'result': 'NG', 'content': []}
if doc_id:
tags = CtrlDSScene().get_tags_by_doc_id(doc_id)
if tags:
result['result'] = 'OK'
result['content'] = tags
micro_ver = CtrlDsDoc().get_doc_ver(doc_id)
resul... | ApiDSTag | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用)"""
<|body_0|>
def post(self):
"""保存場景的模快下的考慮點 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'result': 'NG', 'content': []}
if doc_id:
tags = CtrlDSS... | stack_v2_sparse_classes_36k_train_005480 | 2,608 | no_license | [
{
"docstring": "获取设计文档关系的场景(场景的考虑点使用)",
"name": "get",
"signature": "def get(self, doc_id=0)"
},
{
"docstring": "保存場景的模快下的考慮點 :return:",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018784 | Implement the Python class `ApiDSTag` described below.
Class description:
Implement the ApiDSTag class.
Method signatures and docstrings:
- def get(self, doc_id=0): 获取设计文档关系的场景(场景的考虑点使用)
- def post(self): 保存場景的模快下的考慮點 :return: | Implement the Python class `ApiDSTag` described below.
Class description:
Implement the ApiDSTag class.
Method signatures and docstrings:
- def get(self, doc_id=0): 获取设计文档关系的场景(场景的考虑点使用)
- def post(self): 保存場景的模快下的考慮點 :return:
<|skeleton|>
class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用)"""
<|body_0|>
def post(self):
"""保存場景的模快下的考慮點 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用)"""
result = {'result': 'NG', 'content': []}
if doc_id:
tags = CtrlDSScene().get_tags_by_doc_id(doc_id)
if tags:
result['result'] = 'OK'
result['content'] = tags
... | the_stack_v2_python_sparse | Source/collaboration_2/app/api_1_0/api_ds_scene.py | lsn1183/web_project | train | 0 | |
90a1f96b7268c4cff4c4973a7742f97929a265fb | [
"self.sample_size = coord_bounds\nself.coords_lo_lim = lower_lim_region_size\nself.coords_hi_lim = upper_lim_region_size\nself.dim = len(self.sample_size)",
"size = [np.random.randint(low=self.coords_lo_lim[i], high=self.coords_hi_lim[i]) for i in range(self.dim)]\ncoords_lo = [np.random.randint(low=0, high=self.... | <|body_start_0|>
self.sample_size = coord_bounds
self.coords_lo_lim = lower_lim_region_size
self.coords_hi_lim = upper_lim_region_size
self.dim = len(self.sample_size)
<|end_body_0|>
<|body_start_1|>
size = [np.random.randint(low=self.coords_lo_lim[i], high=self.coords_hi_lim[i]... | A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample. | RegionGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegionGenerator:
"""A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample."""
def __init__(self, coord_bounds: list, lower_lim_region_size: list, upper_lim_reg... | stack_v2_sparse_classes_36k_train_005481 | 2,604 | permissive | [
{
"docstring": "Parameters ---------- coord_bounds - coordinate bounds of a sample with the format: [depth, width, height] lower_lim_region_size - region minimal size along each axis with the format: [min_depth, min_width, min_height] upper_lim_region_size - region maximal size along each axis with the format: ... | 2 | stack_v2_sparse_classes_30k_train_008393 | Implement the Python class `RegionGenerator` described below.
Class description:
A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample.
Method signatures and docstrings:
- def __init__(... | Implement the Python class `RegionGenerator` described below.
Class description:
A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample.
Method signatures and docstrings:
- def __init__(... | a8b8fa0b68735a106cc4d947bdb0d6647e991fb3 | <|skeleton|>
class RegionGenerator:
"""A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample."""
def __init__(self, coord_bounds: list, lower_lim_region_size: list, upper_lim_reg... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegionGenerator:
"""A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample."""
def __init__(self, coord_bounds: list, lower_lim_region_size: list, upper_lim_region_size: lis... | the_stack_v2_python_sparse | elektronn3/data/transforms/region_generator.py | ELEKTRONN/elektronn3 | train | 167 |
63612cefdbb78f08858930f684eb329eb5815d6c | [
"self.start = int(start, 16)\nself.end = int(end, 16)\nself.permissions = permissions\nself.offset = int(offset, 16)\nself.pathname = pathname.strip()\nself.fields = collections.OrderedDict()",
"assert ':' in line\nsplit_index = line.index(':')\nk, v = (line[:split_index].strip(), line[split_index + 1:].strip())\... | <|body_start_0|>
self.start = int(start, 16)
self.end = int(end, 16)
self.permissions = permissions
self.offset = int(offset, 16)
self.pathname = pathname.strip()
self.fields = collections.OrderedDict()
<|end_body_0|>
<|body_start_1|>
assert ':' in line
s... | A single entry (mapping) in /proc/[pid]/smaps. | Mapping | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mapping:
"""A single entry (mapping) in /proc/[pid]/smaps."""
def __init__(self, start, end, permissions, offset, pathname):
"""Initializes an instance. Args: start: (str) Start address of the mapping. end: (str) End address of the mapping. permissions: (str) Permission string, e.g. ... | stack_v2_sparse_classes_36k_train_005482 | 10,063 | permissive | [
{
"docstring": "Initializes an instance. Args: start: (str) Start address of the mapping. end: (str) End address of the mapping. permissions: (str) Permission string, e.g. r-wp. offset: (str) Offset into the file or 0 if this is not a file mapping. pathname: (str) Path name, or pseudo-path, e.g. [stack]",
"... | 3 | null | Implement the Python class `Mapping` described below.
Class description:
A single entry (mapping) in /proc/[pid]/smaps.
Method signatures and docstrings:
- def __init__(self, start, end, permissions, offset, pathname): Initializes an instance. Args: start: (str) Start address of the mapping. end: (str) End address of... | Implement the Python class `Mapping` described below.
Class description:
A single entry (mapping) in /proc/[pid]/smaps.
Method signatures and docstrings:
- def __init__(self, start, end, permissions, offset, pathname): Initializes an instance. Args: start: (str) Start address of the mapping. end: (str) End address of... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class Mapping:
"""A single entry (mapping) in /proc/[pid]/smaps."""
def __init__(self, start, end, permissions, offset, pathname):
"""Initializes an instance. Args: start: (str) Start address of the mapping. end: (str) End address of the mapping. permissions: (str) Permission string, e.g. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mapping:
"""A single entry (mapping) in /proc/[pid]/smaps."""
def __init__(self, start, end, permissions, offset, pathname):
"""Initializes an instance. Args: start: (str) Start address of the mapping. end: (str) End address of the mapping. permissions: (str) Permission string, e.g. r-wp. offset:... | the_stack_v2_python_sparse | tools/android/native_lib_memory/parse_smaps.py | chromium/chromium | train | 17,408 |
eeb645ab00f85e64892190fc40e1e5d260caf40a | [
"self.indices = indices\nself.values = values\nself.axis = axis\nself.reduce = reduce\nself.types = types\nif paddle.device.is_compiled_with_cuda() is True:\n self.places = ['cpu', 'gpu:0']\nelse:\n self.places = ['cpu']",
"paddle.set_device(device)\npaddle.disable_static()\narr = paddle.to_tensor(self.arr,... | <|body_start_0|>
self.indices = indices
self.values = values
self.axis = axis
self.reduce = reduce
self.types = types
if paddle.device.is_compiled_with_cuda() is True:
self.places = ['cpu', 'gpu:0']
else:
self.places = ['cpu']
<|end_body_0|... | calculate put_along_axis api | PutAlongAxis | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PutAlongAxis:
"""calculate put_along_axis api"""
def __init__(self, indices, values, axis, types, reduce='assign'):
"""init"""
<|body_0|>
def cal_dynamic(self, device, dtype):
"""dynamic calculate"""
<|body_1|>
def cal_static(self, device):
"... | stack_v2_sparse_classes_36k_train_005483 | 6,483 | no_license | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self, indices, values, axis, types, reduce='assign')"
},
{
"docstring": "dynamic calculate",
"name": "cal_dynamic",
"signature": "def cal_dynamic(self, device, dtype)"
},
{
"docstring": "static_calculate",
... | 4 | stack_v2_sparse_classes_30k_train_012205 | Implement the Python class `PutAlongAxis` described below.
Class description:
calculate put_along_axis api
Method signatures and docstrings:
- def __init__(self, indices, values, axis, types, reduce='assign'): init
- def cal_dynamic(self, device, dtype): dynamic calculate
- def cal_static(self, device): static_calcul... | Implement the Python class `PutAlongAxis` described below.
Class description:
calculate put_along_axis api
Method signatures and docstrings:
- def __init__(self, indices, values, axis, types, reduce='assign'): init
- def cal_dynamic(self, device, dtype): dynamic calculate
- def cal_static(self, device): static_calcul... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class PutAlongAxis:
"""calculate put_along_axis api"""
def __init__(self, indices, values, axis, types, reduce='assign'):
"""init"""
<|body_0|>
def cal_dynamic(self, device, dtype):
"""dynamic calculate"""
<|body_1|>
def cal_static(self, device):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PutAlongAxis:
"""calculate put_along_axis api"""
def __init__(self, indices, values, axis, types, reduce='assign'):
"""init"""
self.indices = indices
self.values = values
self.axis = axis
self.reduce = reduce
self.types = types
if paddle.device.is_c... | the_stack_v2_python_sparse | framework/api/paddlebase/test_put_along_axis_.py | PaddlePaddle/PaddleTest | train | 42 |
26d8c448fe3cbc1c128ed01329d8589a85e33c17 | [
"if n == 1:\n return x % m\nreturn x % m * (self.power(x, n - 1) % m) % m",
"result = 1\nwhile n > 0:\n result = result * (x % m) % m\n n -= 1\nreturn result",
"result = 1\nwhile n > 0:\n if n % 2 != 0:\n result = result * x % m\n x = x % m * (x % m) % m\n n //= 2\nreturn result"
] | <|body_start_0|>
if n == 1:
return x % m
return x % m * (self.power(x, n - 1) % m) % m
<|end_body_0|>
<|body_start_1|>
result = 1
while n > 0:
result = result * (x % m) % m
n -= 1
return result
<|end_body_1|>
<|body_start_2|>
result =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def power_brute_recur(self, x, n, m=1000000007):
"""Returns x ^ n % m. Simple recursive algorithm. Time complexity: O(n). Space complexity: O(n)."""
<|body_0|>
def power_brute_iter(self, x, n, m=1000000007):
"""Returns x ^ n % m. Simple iterative algorithm.... | stack_v2_sparse_classes_36k_train_005484 | 1,350 | no_license | [
{
"docstring": "Returns x ^ n % m. Simple recursive algorithm. Time complexity: O(n). Space complexity: O(n).",
"name": "power_brute_recur",
"signature": "def power_brute_recur(self, x, n, m=1000000007)"
},
{
"docstring": "Returns x ^ n % m. Simple iterative algorithm. Time complexity: O(n). Spa... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def power_brute_recur(self, x, n, m=1000000007): Returns x ^ n % m. Simple recursive algorithm. Time complexity: O(n). Space complexity: O(n).
- def power_brute_iter(self, x, n, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def power_brute_recur(self, x, n, m=1000000007): Returns x ^ n % m. Simple recursive algorithm. Time complexity: O(n). Space complexity: O(n).
- def power_brute_iter(self, x, n, ... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def power_brute_recur(self, x, n, m=1000000007):
"""Returns x ^ n % m. Simple recursive algorithm. Time complexity: O(n). Space complexity: O(n)."""
<|body_0|>
def power_brute_iter(self, x, n, m=1000000007):
"""Returns x ^ n % m. Simple iterative algorithm.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def power_brute_recur(self, x, n, m=1000000007):
"""Returns x ^ n % m. Simple recursive algorithm. Time complexity: O(n). Space complexity: O(n)."""
if n == 1:
return x % m
return x % m * (self.power(x, n - 1) % m) % m
def power_brute_iter(self, x, n, m=10000... | the_stack_v2_python_sparse | Numbers/fast_power.py | vladn90/Algorithms | train | 0 | |
51b516c072296bd62fc4418c87a44a5100d73f09 | [
"defaults = {'vcmax': 60.0, 'kc': 650.0, 'ko': 450000.0, 'gamma': 0.5 / 2590.0, 'vpmax': 120.0, 'vpr': 80.0, 'kp': 80.0, 'gs': 0.003, 'alpha': 0.0, 'x': 0.4, 'jmax': 400.0, 'theta': 0.7, 'f': 0.15, 'absorptance': 0.85, 'om': 200000.0, 'i': 10000.0}\ndefaults.update(parameters)\ndefaults.setdefault('rd', 0.01 * defa... | <|body_start_0|>
defaults = {'vcmax': 60.0, 'kc': 650.0, 'ko': 450000.0, 'gamma': 0.5 / 2590.0, 'vpmax': 120.0, 'vpr': 80.0, 'kp': 80.0, 'gs': 0.003, 'alpha': 0.0, 'x': 0.4, 'jmax': 400.0, 'theta': 0.7, 'f': 0.15, 'absorptance': 0.85, 'om': 200000.0, 'i': 10000.0}
defaults.update(parameters)
def... | C4Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class C4Model:
def __init__(self, **parameters):
"""Create a model, overriding default parameters or adding new ones. Setting parameters through keyword arguments sets this instance's default parameters (which may then be overridden when calling C4Model.A() to calculate an assimilation rate.) ... | stack_v2_sparse_classes_36k_train_005485 | 10,237 | no_license | [
{
"docstring": "Create a model, overriding default parameters or adding new ones. Setting parameters through keyword arguments sets this instance's default parameters (which may then be overridden when calling C4Model.A() to calculate an assimilation rate.) See the code for a list of parameters which may be set... | 2 | stack_v2_sparse_classes_30k_train_020222 | Implement the Python class `C4Model` described below.
Class description:
Implement the C4Model class.
Method signatures and docstrings:
- def __init__(self, **parameters): Create a model, overriding default parameters or adding new ones. Setting parameters through keyword arguments sets this instance's default parame... | Implement the Python class `C4Model` described below.
Class description:
Implement the C4Model class.
Method signatures and docstrings:
- def __init__(self, **parameters): Create a model, overriding default parameters or adding new ones. Setting parameters through keyword arguments sets this instance's default parame... | f140b85b4b9e73a6158abdbac6c93442ea4208c1 | <|skeleton|>
class C4Model:
def __init__(self, **parameters):
"""Create a model, overriding default parameters or adding new ones. Setting parameters through keyword arguments sets this instance's default parameters (which may then be overridden when calling C4Model.A() to calculate an assimilation rate.) ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class C4Model:
def __init__(self, **parameters):
"""Create a model, overriding default parameters or adding new ones. Setting parameters through keyword arguments sets this instance's default parameters (which may then be overridden when calling C4Model.A() to calculate an assimilation rate.) See the code f... | the_stack_v2_python_sparse | fitting/classical_c4_model.py | ebogart/multiscale_c4_source | train | 1 | |
f628ad9e1f15a8022aebd47d1f8c1245f86896f6 | [
"if len(collection) < 1:\n return collection\nif isinstance(collection, dict):\n return sorted(collection.items(), key=lambda x: x[0])\nif isinstance(list(collection)[0], Operation):\n key = lambda x: x.operation_id\nelif isinstance(list(collection)[0], str):\n key = lambda x: SchemaObjects.get(x).name\... | <|body_start_0|>
if len(collection) < 1:
return collection
if isinstance(collection, dict):
return sorted(collection.items(), key=lambda x: x[0])
if isinstance(list(collection)[0], Operation):
key = lambda x: x.operation_id
elif isinstance(list(collect... | SwaggerObject | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwaggerObject:
def sorted(collection):
"""sorting dict by key, schema-collection by schema-name operations by id"""
<|body_0|>
def get_regular_properties(self, _type, *args, **kwargs):
"""Make table with properties by schema_id :param str _type: :rtype: str"""
... | stack_v2_sparse_classes_36k_train_005486 | 4,908 | permissive | [
{
"docstring": "sorting dict by key, schema-collection by schema-name operations by id",
"name": "sorted",
"signature": "def sorted(collection)"
},
{
"docstring": "Make table with properties by schema_id :param str _type: :rtype: str",
"name": "get_regular_properties",
"signature": "def ... | 4 | stack_v2_sparse_classes_30k_train_004791 | Implement the Python class `SwaggerObject` described below.
Class description:
Implement the SwaggerObject class.
Method signatures and docstrings:
- def sorted(collection): sorting dict by key, schema-collection by schema-name operations by id
- def get_regular_properties(self, _type, *args, **kwargs): Make table wi... | Implement the Python class `SwaggerObject` described below.
Class description:
Implement the SwaggerObject class.
Method signatures and docstrings:
- def sorted(collection): sorting dict by key, schema-collection by schema-name operations by id
- def get_regular_properties(self, _type, *args, **kwargs): Make table wi... | 43c22b5d2dc00565b939cc32782cc753d02a8434 | <|skeleton|>
class SwaggerObject:
def sorted(collection):
"""sorting dict by key, schema-collection by schema-name operations by id"""
<|body_0|>
def get_regular_properties(self, _type, *args, **kwargs):
"""Make table with properties by schema_id :param str _type: :rtype: str"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SwaggerObject:
def sorted(collection):
"""sorting dict by key, schema-collection by schema-name operations by id"""
if len(collection) < 1:
return collection
if isinstance(collection, dict):
return sorted(collection.items(), key=lambda x: x[0])
if isinst... | the_stack_v2_python_sparse | swg2rst/utils/rst.py | dborodin836/swagger2rst | train | 0 | |
fb5d8f27cd7ebe851f0c81ee8e1e3a920d8e0eaf | [
"super(ConvLayer, self).__init__()\nself.atom_fea_len = atom_fea_len\nself.nbr_fea_len = nbr_fea_len\nself.fc_full = nn.Linear(2 * self.atom_fea_len + self.nbr_fea_len, 2 * self.atom_fea_len)\nself.sigmoid = nn.Sigmoid()\nself.softplus1 = nn.Softplus()\nself.bn1 = nn.BatchNorm1d(2 * self.atom_fea_len)\nself.bn2 = n... | <|body_start_0|>
super(ConvLayer, self).__init__()
self.atom_fea_len = atom_fea_len
self.nbr_fea_len = nbr_fea_len
self.fc_full = nn.Linear(2 * self.atom_fea_len + self.nbr_fea_len, 2 * self.atom_fea_len)
self.sigmoid = nn.Sigmoid()
self.softplus1 = nn.Softplus()
... | Convolutional operation on graphs. | ConvLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvLayer:
"""Convolutional operation on graphs."""
def __init__(self, atom_fea_len: int, nbr_fea_len: int):
"""Initialize ConvLayer. Args: atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features."""
<|body_0|>
def forward(self, atom_in... | stack_v2_sparse_classes_36k_train_005487 | 9,607 | permissive | [
{
"docstring": "Initialize ConvLayer. Args: atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features.",
"name": "__init__",
"signature": "def __init__(self, atom_fea_len: int, nbr_fea_len: int)"
},
{
"docstring": "Forward pass. N: Total number of atoms in the ba... | 2 | null | Implement the Python class `ConvLayer` described below.
Class description:
Convolutional operation on graphs.
Method signatures and docstrings:
- def __init__(self, atom_fea_len: int, nbr_fea_len: int): Initialize ConvLayer. Args: atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond featu... | Implement the Python class `ConvLayer` described below.
Class description:
Convolutional operation on graphs.
Method signatures and docstrings:
- def __init__(self, atom_fea_len: int, nbr_fea_len: int): Initialize ConvLayer. Args: atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond featu... | 0b69b7d5b261f2f9af3984793c1295b9b80cd01a | <|skeleton|>
class ConvLayer:
"""Convolutional operation on graphs."""
def __init__(self, atom_fea_len: int, nbr_fea_len: int):
"""Initialize ConvLayer. Args: atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features."""
<|body_0|>
def forward(self, atom_in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvLayer:
"""Convolutional operation on graphs."""
def __init__(self, atom_fea_len: int, nbr_fea_len: int):
"""Initialize ConvLayer. Args: atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features."""
super(ConvLayer, self).__init__()
self.atom_fe... | the_stack_v2_python_sparse | src/gt4sd/frameworks/cgcnn/model.py | GT4SD/gt4sd-core | train | 239 |
eb767c0c3070853da34a3068ba2d6c216799f2b2 | [
"self.key = key\nself.actions_allowed = actions_allowed\nself.how_often = how_often\n'\\n Dictionary of {domain: datetime}\\n When a domain exceeds its allowed actions, an entry is put here to\\n note the timestamp when the domain should be allowed to perform\\n actions again. This is me... | <|body_start_0|>
self.key = key
self.actions_allowed = actions_allowed
self.how_often = how_often
'\n Dictionary of {domain: datetime}\n When a domain exceeds its allowed actions, an entry is put here to\n note the timestamp when the domain should be allowed to perfo... | A util for rate limiting by domain. For example, to allow a domain to only send 100 SMS every 60 seconds: limiter = DomainRateLimiter('send-sms-for-', 100, 60) ... if limiter.can_perform_action('my-domain'): <perform action> else: <delay action> | DomainRateLimiter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DomainRateLimiter:
"""A util for rate limiting by domain. For example, to allow a domain to only send 100 SMS every 60 seconds: limiter = DomainRateLimiter('send-sms-for-', 100, 60) ... if limiter.can_perform_action('my-domain'): <perform action> else: <delay action>"""
def __init__(self, ke... | stack_v2_sparse_classes_36k_train_005488 | 4,174 | permissive | [
{
"docstring": "key - the beginning of the redis key that will be used to rate limit on; the actual key that is used will be key + domain actions_allowed - see rate_limit() how_often - see rate_limit()",
"name": "__init__",
"signature": "def __init__(self, key, actions_allowed, how_often)"
},
{
... | 2 | stack_v2_sparse_classes_30k_test_001135 | Implement the Python class `DomainRateLimiter` described below.
Class description:
A util for rate limiting by domain. For example, to allow a domain to only send 100 SMS every 60 seconds: limiter = DomainRateLimiter('send-sms-for-', 100, 60) ... if limiter.can_perform_action('my-domain'): <perform action> else: <dela... | Implement the Python class `DomainRateLimiter` described below.
Class description:
A util for rate limiting by domain. For example, to allow a domain to only send 100 SMS every 60 seconds: limiter = DomainRateLimiter('send-sms-for-', 100, 60) ... if limiter.can_perform_action('my-domain'): <perform action> else: <dela... | 1c70ce416564efa496fb4ef6e9130c188aea0f40 | <|skeleton|>
class DomainRateLimiter:
"""A util for rate limiting by domain. For example, to allow a domain to only send 100 SMS every 60 seconds: limiter = DomainRateLimiter('send-sms-for-', 100, 60) ... if limiter.can_perform_action('my-domain'): <perform action> else: <delay action>"""
def __init__(self, ke... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DomainRateLimiter:
"""A util for rate limiting by domain. For example, to allow a domain to only send 100 SMS every 60 seconds: limiter = DomainRateLimiter('send-sms-for-', 100, 60) ... if limiter.can_perform_action('my-domain'): <perform action> else: <delay action>"""
def __init__(self, key, actions_al... | the_stack_v2_python_sparse | corehq/ex-submodules/dimagi/utils/rate_limit.py | dungeonmaster51/commcare-hq | train | 1 |
9d6d95f62b7b9f14d0b42b2f7b90d8d9224c1446 | [
"self._config = config\nself._optimizer_config = config.optimizer.get()\nself._optimizer_type = config.optimizer.type\nif self._optimizer_config is None:\n raise ValueError('Optimizer type must be specified')\nself._lr_config = config.learning_rate.get()\nself._lr_type = config.learning_rate.type\nself._warmup_c... | <|body_start_0|>
self._config = config
self._optimizer_config = config.optimizer.get()
self._optimizer_type = config.optimizer.type
if self._optimizer_config is None:
raise ValueError('Optimizer type must be specified')
self._lr_config = config.learning_rate.get()
... | Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the optimization config. (3) Build learning rate. (... | OptimizerFactory | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptimizerFactory:
"""Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the opt... | stack_v2_sparse_classes_36k_train_005489 | 4,835 | permissive | [
{
"docstring": "Initializing OptimizerFactory. Args: config: OptimizationConfig instance contain optimization config.",
"name": "__init__",
"signature": "def __init__(self, config: opt_cfg.OptimizationConfig)"
},
{
"docstring": "Build learning rate. Builds learning rate from config. Learning rat... | 3 | stack_v2_sparse_classes_30k_train_018445 | Implement the Python class `OptimizerFactory` described below.
Class description:
Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule.... | Implement the Python class `OptimizerFactory` described below.
Class description:
Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule.... | ad48842549b61e171254cf4a895239022ef509d4 | <|skeleton|>
class OptimizerFactory:
"""Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the opt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OptimizerFactory:
"""Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the optimization con... | the_stack_v2_python_sparse | ImageClassification-Resnet_50/TensorFlow2/source/resnet/include/modeling/optimization/optimizer_factory.py | tbd-ai/tbd-suite | train | 51 |
fa4b0dc0802cce68b81b737e26b65ecc125a0712 | [
"self.map = collections.defaultdict(int)\nself.interval = {}\nself.intervalList = []",
"if self.map[val]:\n return\nelse:\n self.map[val] = 1\n left = self.map[val - 1]\n right = self.map[val + 1]\n self.map[val - left] = left + right + 1\n self.map[val + right] = left + right + 1\n if right:... | <|body_start_0|>
self.map = collections.defaultdict(int)
self.interval = {}
self.intervalList = []
<|end_body_0|>
<|body_start_1|>
if self.map[val]:
return
else:
self.map[val] = 1
left = self.map[val - 1]
right = self.map[val + 1]
... | SummaryRanges | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SummaryRanges:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addNum(self, val):
""":type val: int :rtype: void"""
<|body_1|>
def getIntervals(self):
""":rtype: List[Interval]"""
<|body_2|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_005490 | 2,090 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type val: int :rtype: void",
"name": "addNum",
"signature": "def addNum(self, val)"
},
{
"docstring": ":rtype: List[Interval]",
"name": "getInterva... | 3 | stack_v2_sparse_classes_30k_train_006242 | Implement the Python class `SummaryRanges` described below.
Class description:
Implement the SummaryRanges class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addNum(self, val): :type val: int :rtype: void
- def getIntervals(self): :rtype: List[Interval] | Implement the Python class `SummaryRanges` described below.
Class description:
Implement the SummaryRanges class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addNum(self, val): :type val: int :rtype: void
- def getIntervals(self): :rtype: List[Interval]
<|skelet... | c964131a870d0af74c9fd7a8fdb311dc4b863dbd | <|skeleton|>
class SummaryRanges:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addNum(self, val):
""":type val: int :rtype: void"""
<|body_1|>
def getIntervals(self):
""":rtype: List[Interval]"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SummaryRanges:
def __init__(self):
"""Initialize your data structure here."""
self.map = collections.defaultdict(int)
self.interval = {}
self.intervalList = []
def addNum(self, val):
""":type val: int :rtype: void"""
if self.map[val]:
return
... | the_stack_v2_python_sparse | 352_data_stream_as_disjoint_interval.py | xiangcao/PythonLeetcode | train | 0 | |
169b0169a52f5aefb7943cd67306b0b8c9a1d050 | [
"trees = {}\nwithout_bind = {}\ntables_info = RedisSourceService.info_for_tree_building((), tables, source)\nfor t_name in tables:\n tree = TablesTree(t_name)\n without_bind[t_name] = TablesTree.build_tree([tree.root], tables, tables_info)\n trees[t_name] = tree\nreturn (trees, without_bind)",
"def inner... | <|body_start_0|>
trees = {}
without_bind = {}
tables_info = RedisSourceService.info_for_tree_building((), tables, source)
for t_name in tables:
tree = TablesTree(t_name)
without_bind[t_name] = TablesTree.build_tree([tree.root], tables, tables_info)
tre... | Обработчик деревьев TablesTree | TableTreeRepository | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableTreeRepository:
"""Обработчик деревьев TablesTree"""
def build_trees(cls, tables, source):
"""строит всевозможные деревья :param tables: list :param source: Datasource :return:"""
<|body_0|>
def delete_nodes_from_tree(cls, tree, source, tables):
"""удаляет у... | stack_v2_sparse_classes_36k_train_005491 | 11,150 | no_license | [
{
"docstring": "строит всевозможные деревья :param tables: list :param source: Datasource :return:",
"name": "build_trees",
"signature": "def build_trees(cls, tables, source)"
},
{
"docstring": "удаляет узлы дерева :param tree: TablesTree :param source: Datasource :param tables: list",
"name... | 2 | stack_v2_sparse_classes_30k_train_014208 | Implement the Python class `TableTreeRepository` described below.
Class description:
Обработчик деревьев TablesTree
Method signatures and docstrings:
- def build_trees(cls, tables, source): строит всевозможные деревья :param tables: list :param source: Datasource :return:
- def delete_nodes_from_tree(cls, tree, sourc... | Implement the Python class `TableTreeRepository` described below.
Class description:
Обработчик деревьев TablesTree
Method signatures and docstrings:
- def build_trees(cls, tables, source): строит всевозможные деревья :param tables: list :param source: Datasource :return:
- def delete_nodes_from_tree(cls, tree, sourc... | aec9c9719c91cc15cfbb73bb3d544d9aa8da5572 | <|skeleton|>
class TableTreeRepository:
"""Обработчик деревьев TablesTree"""
def build_trees(cls, tables, source):
"""строит всевозможные деревья :param tables: list :param source: Datasource :return:"""
<|body_0|>
def delete_nodes_from_tree(cls, tree, source, tables):
"""удаляет у... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TableTreeRepository:
"""Обработчик деревьев TablesTree"""
def build_trees(cls, tables, source):
"""строит всевозможные деревья :param tables: list :param source: Datasource :return:"""
trees = {}
without_bind = {}
tables_info = RedisSourceService.info_for_tree_building((),... | the_stack_v2_python_sparse | etl/models.py | BionNetwork/platform | train | 0 |
5c8a3842f80279a0f15ea37094bbabc6e5942845 | [
"Bill.__init__(self, user)\nself.amounts['submit_sm'] = 0.0\nself.amounts['submit_sm_resp'] = 0.0\nself.actions['decrement_submit_sm_count'] = 0",
"bill = SubmitSmRespBill(self.user)\nbill.setAmount('submit_sm_resp', self.getAmount('submit_sm_resp'))\nreturn bill"
] | <|body_start_0|>
Bill.__init__(self, user)
self.amounts['submit_sm'] = 0.0
self.amounts['submit_sm_resp'] = 0.0
self.actions['decrement_submit_sm_count'] = 0
<|end_body_0|>
<|body_start_1|>
bill = SubmitSmRespBill(self.user)
bill.setAmount('submit_sm_resp', self.getAmoun... | This is the bill for user to pay when sending a MT SMS | SubmitSmBill | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubmitSmBill:
"""This is the bill for user to pay when sending a MT SMS"""
def __init__(self, user):
"""Defining billables"""
<|body_0|>
def getSubmitSmRespBill(self):
"""Will return a separate Bill for submit_sm_resp"""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_36k_train_005492 | 3,091 | permissive | [
{
"docstring": "Defining billables",
"name": "__init__",
"signature": "def __init__(self, user)"
},
{
"docstring": "Will return a separate Bill for submit_sm_resp",
"name": "getSubmitSmRespBill",
"signature": "def getSubmitSmRespBill(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002683 | Implement the Python class `SubmitSmBill` described below.
Class description:
This is the bill for user to pay when sending a MT SMS
Method signatures and docstrings:
- def __init__(self, user): Defining billables
- def getSubmitSmRespBill(self): Will return a separate Bill for submit_sm_resp | Implement the Python class `SubmitSmBill` described below.
Class description:
This is the bill for user to pay when sending a MT SMS
Method signatures and docstrings:
- def __init__(self, user): Defining billables
- def getSubmitSmRespBill(self): Will return a separate Bill for submit_sm_resp
<|skeleton|>
class Subm... | e352208f22677b0a0769d1246892cff9558503cf | <|skeleton|>
class SubmitSmBill:
"""This is the bill for user to pay when sending a MT SMS"""
def __init__(self, user):
"""Defining billables"""
<|body_0|>
def getSubmitSmRespBill(self):
"""Will return a separate Bill for submit_sm_resp"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubmitSmBill:
"""This is the bill for user to pay when sending a MT SMS"""
def __init__(self, user):
"""Defining billables"""
Bill.__init__(self, user)
self.amounts['submit_sm'] = 0.0
self.amounts['submit_sm_resp'] = 0.0
self.actions['decrement_submit_sm_count'] = ... | the_stack_v2_python_sparse | jasmin/routing/Bills.py | jookies/jasmin | train | 943 |
f3d83911dc6f77e54213e8fd70ca3547496bc867 | [
"perms = [[]]\nfor n in nums:\n new_perm = []\n for perm in perms:\n for i in range(len(perm) + 1):\n new_perm.append(perm[:i] + [n] + perm[i:])\n if i < len(perm) and n == perm[i]:\n break\n perms = new_perm\nreturn perms",
"res = []\nif len(nums) == 0:\n r... | <|body_start_0|>
perms = [[]]
for n in nums:
new_perm = []
for perm in perms:
for i in range(len(perm) + 1):
new_perm.append(perm[:i] + [n] + perm[i:])
if i < len(perm) and n == perm[i]:
break
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique1(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
perms = [[]]
... | stack_v2_sparse_classes_36k_train_005493 | 1,035 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique",
"signature": "def permuteUnique(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique1",
"signature": "def permuteUnique1(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique1(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique1(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class S... | 863b89be674a82eef60c0f33d726ac08d43f2e01 | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique1(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
perms = [[]]
for n in nums:
new_perm = []
for perm in perms:
for i in range(len(perm) + 1):
new_perm.append(perm[:i] + [n] + perm[i:]... | the_stack_v2_python_sparse | q47_Permutaions_II.py | Ryuya1995/leetcode | train | 0 | |
73aebd39d363c78fa2ff411c2519c212f69ccc22 | [
"maps = PersonalAppealDao.PersonalAppealDao.get_dist_cert_field(field_name)\nrespond = JsonResponse(maps)\nrespond['Access-Control-Allow-Origin'] = '*'\nreturn respond",
"if request.method == 'POST':\n appeallor = request.POST.get('appeallor')\n field_name = request.POST.get('field')\nelse:\n appeallor =... | <|body_start_0|>
maps = PersonalAppealDao.PersonalAppealDao.get_dist_cert_field(field_name)
respond = JsonResponse(maps)
respond['Access-Control-Allow-Origin'] = '*'
return respond
<|end_body_0|>
<|body_start_1|>
if request.method == 'POST':
appeallor = request.POST.... | 用于写测试方法 | TestPersonalAppealDao | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPersonalAppealDao:
"""用于写测试方法"""
def test_gdocf(request, field_name):
"""测试URL模式是否生效 :param request: :param field_name: :return:"""
<|body_0|>
def test_gdocf2(request):
"""测试是否成功从request中取得参数 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_005494 | 1,217 | no_license | [
{
"docstring": "测试URL模式是否生效 :param request: :param field_name: :return:",
"name": "test_gdocf",
"signature": "def test_gdocf(request, field_name)"
},
{
"docstring": "测试是否成功从request中取得参数 :param request: :return:",
"name": "test_gdocf2",
"signature": "def test_gdocf2(request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010416 | Implement the Python class `TestPersonalAppealDao` described below.
Class description:
用于写测试方法
Method signatures and docstrings:
- def test_gdocf(request, field_name): 测试URL模式是否生效 :param request: :param field_name: :return:
- def test_gdocf2(request): 测试是否成功从request中取得参数 :param request: :return: | Implement the Python class `TestPersonalAppealDao` described below.
Class description:
用于写测试方法
Method signatures and docstrings:
- def test_gdocf(request, field_name): 测试URL模式是否生效 :param request: :param field_name: :return:
- def test_gdocf2(request): 测试是否成功从request中取得参数 :param request: :return:
<|skeleton|>
class T... | b907bb29b52047b21b79e95178b78ca033eee04f | <|skeleton|>
class TestPersonalAppealDao:
"""用于写测试方法"""
def test_gdocf(request, field_name):
"""测试URL模式是否生效 :param request: :param field_name: :return:"""
<|body_0|>
def test_gdocf2(request):
"""测试是否成功从request中取得参数 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestPersonalAppealDao:
"""用于写测试方法"""
def test_gdocf(request, field_name):
"""测试URL模式是否生效 :param request: :param field_name: :return:"""
maps = PersonalAppealDao.PersonalAppealDao.get_dist_cert_field(field_name)
respond = JsonResponse(maps)
respond['Access-Control-Allow-Ori... | the_stack_v2_python_sparse | code/user_profiles/service/TestService.py | gitxiangxiang/UserPortraitAnalysis | train | 1 |
70edcb73239287b25b55f3bf69d90b40addb98ae | [
"self.doi_prefix = prefix\nif self.doi_prefix[-1] == '/':\n self.doi_prefix = self.doi_prefix[:-1]\nif not message:\n self.message = 'You cannot change an already registered DOI.'\nctx = dict(prefix=prefix, CFG_SITE_NAME=current_app.config['CFG_SITE_NAME'])\nself.message = self.message % ctx",
"if field.obj... | <|body_start_0|>
self.doi_prefix = prefix
if self.doi_prefix[-1] == '/':
self.doi_prefix = self.doi_prefix[:-1]
if not message:
self.message = 'You cannot change an already registered DOI.'
ctx = dict(prefix=prefix, CFG_SITE_NAME=current_app.config['CFG_SITE_NAME'... | Validate if DOI. | MintedDOIValidator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MintedDOIValidator:
"""Validate if DOI."""
def __init__(self, prefix='10.5072', message=None):
"""Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072"""
<|body_0|>
def __call__(self, form, field):
"""Validate."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_005495 | 11,750 | no_license | [
{
"docstring": "Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072",
"name": "__init__",
"signature": "def __init__(self, prefix='10.5072', message=None)"
},
{
"docstring": "Validate.",
"name": "__call__",
"signature": "def __call__(self, form, field)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007885 | Implement the Python class `MintedDOIValidator` described below.
Class description:
Validate if DOI.
Method signatures and docstrings:
- def __init__(self, prefix='10.5072', message=None): Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072
- def __call__(self, form, field): Validate. | Implement the Python class `MintedDOIValidator` described below.
Class description:
Validate if DOI.
Method signatures and docstrings:
- def __init__(self, prefix='10.5072', message=None): Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072
- def __call__(self, form, field): Validate.
<|skeleton|>
clas... | 4de8910fff569fc9028300c70b63200da521ddb9 | <|skeleton|>
class MintedDOIValidator:
"""Validate if DOI."""
def __init__(self, prefix='10.5072', message=None):
"""Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072"""
<|body_0|>
def __call__(self, form, field):
"""Validate."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MintedDOIValidator:
"""Validate if DOI."""
def __init__(self, prefix='10.5072', message=None):
"""Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072"""
self.doi_prefix = prefix
if self.doi_prefix[-1] == '/':
self.doi_prefix = self.doi_prefix[:-1]
... | the_stack_v2_python_sparse | inspirehep/modules/forms/validation_utils.py | nikpap/inspire-next | train | 1 |
9633eb7c70ede62f9903c11d2d3130e88cf6325b | [
"completed = []\nfor step, label in mkt.APP_STEPS:\n if getattr(self, step, False):\n completed.append(step)\nreturn completed",
"for step, label in mkt.APP_STEPS[:-1]:\n if not getattr(self, step, False):\n return step"
] | <|body_start_0|>
completed = []
for step, label in mkt.APP_STEPS:
if getattr(self, step, False):
completed.append(step)
return completed
<|end_body_0|>
<|body_start_1|>
for step, label in mkt.APP_STEPS[:-1]:
if not getattr(self, step, False):
... | AppSubmissionChecklist | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppSubmissionChecklist:
def get_completed(self):
"""Return a list of completed submission steps."""
<|body_0|>
def get_next(self):
"""Return the next step."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
completed = []
for step, label in mkt... | stack_v2_sparse_classes_36k_train_005496 | 1,031 | permissive | [
{
"docstring": "Return a list of completed submission steps.",
"name": "get_completed",
"signature": "def get_completed(self)"
},
{
"docstring": "Return the next step.",
"name": "get_next",
"signature": "def get_next(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015771 | Implement the Python class `AppSubmissionChecklist` described below.
Class description:
Implement the AppSubmissionChecklist class.
Method signatures and docstrings:
- def get_completed(self): Return a list of completed submission steps.
- def get_next(self): Return the next step. | Implement the Python class `AppSubmissionChecklist` described below.
Class description:
Implement the AppSubmissionChecklist class.
Method signatures and docstrings:
- def get_completed(self): Return a list of completed submission steps.
- def get_next(self): Return the next step.
<|skeleton|>
class AppSubmissionChe... | 5fa5400a447f2e905372d4c8eba6d959d22d4f3e | <|skeleton|>
class AppSubmissionChecklist:
def get_completed(self):
"""Return a list of completed submission steps."""
<|body_0|>
def get_next(self):
"""Return the next step."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AppSubmissionChecklist:
def get_completed(self):
"""Return a list of completed submission steps."""
completed = []
for step, label in mkt.APP_STEPS:
if getattr(self, step, False):
completed.append(step)
return completed
def get_next(self):
... | the_stack_v2_python_sparse | mkt/submit/models.py | sarvex/zamboni | train | 0 | |
6387e46ef6c393a7ed2a6c5f2cddf7a8efa98793 | [
"self.count = count\nself.minimum = minimum\nself.maximum = maximum\nself.character = character",
"exploded = [c for c in str]\nfor count in range(self.count):\n size = random.randint(self.minimum, self.maximum)\n position = random.randint(0, len(str) - size)\n for iIter in range(size):\n exploded... | <|body_start_0|>
self.count = count
self.minimum = minimum
self.maximum = maximum
self.character = character
<|end_body_0|>
<|body_start_1|>
exploded = [c for c in str]
for count in range(self.count):
size = random.randint(self.minimum, self.maximum)
... | Class to implement a simple fuzzer | cFuzzer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class cFuzzer:
"""Class to implement a simple fuzzer"""
def __init__(self, count=10, minimum=1, maximum=10, character='A'):
"""class instantiation arguments: count is the number of fuzzed sequences (i.e. overwritten bytes) produced by the fuzzer; default 10 minimum is the minimum length of... | stack_v2_sparse_classes_36k_train_005497 | 25,658 | no_license | [
{
"docstring": "class instantiation arguments: count is the number of fuzzed sequences (i.e. overwritten bytes) produced by the fuzzer; default 10 minimum is the minimum length of a fuzzed sequence; default 1 maximum is the maximum length of a fuzzed sequence; default 10 character is the character used to gener... | 2 | stack_v2_sparse_classes_30k_val_000229 | Implement the Python class `cFuzzer` described below.
Class description:
Class to implement a simple fuzzer
Method signatures and docstrings:
- def __init__(self, count=10, minimum=1, maximum=10, character='A'): class instantiation arguments: count is the number of fuzzed sequences (i.e. overwritten bytes) produced b... | Implement the Python class `cFuzzer` described below.
Class description:
Class to implement a simple fuzzer
Method signatures and docstrings:
- def __init__(self, count=10, minimum=1, maximum=10, character='A'): class instantiation arguments: count is the number of fuzzed sequences (i.e. overwritten bytes) produced b... | 8190354314d6f42c9ddc477a795029dc446176c5 | <|skeleton|>
class cFuzzer:
"""Class to implement a simple fuzzer"""
def __init__(self, count=10, minimum=1, maximum=10, character='A'):
"""class instantiation arguments: count is the number of fuzzed sequences (i.e. overwritten bytes) produced by the fuzzer; default 10 minimum is the minimum length of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class cFuzzer:
"""Class to implement a simple fuzzer"""
def __init__(self, count=10, minimum=1, maximum=10, character='A'):
"""class instantiation arguments: count is the number of fuzzed sequences (i.e. overwritten bytes) produced by the fuzzer; default 10 minimum is the minimum length of a fuzzed seq... | the_stack_v2_python_sparse | mPDF.py | DidierStevens/DidierStevensSuite | train | 1,670 |
09db15a77b28997d10bf63c667e2a9cc463fa7e4 | [
"InputValidation.validate_string(config_file, 'The configuration file name must be a string')\nconfig_file = BASE_DIR + config_file\nInputValidation.validate_file_exist(config_file, 'The provided configuration file does not exist')\nself.config = ConfigParser.ConfigParser()\nself.config.read(config_file)\nfor secti... | <|body_start_0|>
InputValidation.validate_string(config_file, 'The configuration file name must be a string')
config_file = BASE_DIR + config_file
InputValidation.validate_file_exist(config_file, 'The provided configuration file does not exist')
self.config = ConfigParser.ConfigParser()
... | Used to extract data from the configuration file | ConfigurationFile | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigurationFile:
"""Used to extract data from the configuration file"""
def __init__(self, sections, config_file='conf.cfg'):
"""Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration f... | stack_v2_sparse_classes_36k_train_005498 | 22,587 | permissive | [
{
"docstring": "Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration file (string) :return: None",
"name": "__init__",
"signature": "def __init__(self, sections, config_file='conf.cfg')"
},
{
"docs... | 4 | stack_v2_sparse_classes_30k_val_000227 | Implement the Python class `ConfigurationFile` described below.
Class description:
Used to extract data from the configuration file
Method signatures and docstrings:
- def __init__(self, sections, config_file='conf.cfg'): Reads configuration file sections :param sections: list of strings representing the sections to ... | Implement the Python class `ConfigurationFile` described below.
Class description:
Used to extract data from the configuration file
Method signatures and docstrings:
- def __init__(self, sections, config_file='conf.cfg'): Reads configuration file sections :param sections: list of strings representing the sections to ... | 9b3cc8d114d96c7353942323f0783c7138ac56b7 | <|skeleton|>
class ConfigurationFile:
"""Used to extract data from the configuration file"""
def __init__(self, sections, config_file='conf.cfg'):
"""Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConfigurationFile:
"""Used to extract data from the configuration file"""
def __init__(self, sections, config_file='conf.cfg'):
"""Reads configuration file sections :param sections: list of strings representing the sections to be loaded :param config_file: name of the configuration file (string) ... | the_stack_v2_python_sparse | experimental_framework/common.py | IntelLabsEurope/benchmarking-framework | train | 2 |
3357aaf4673d2162fc841f860f02ededc0fbdadc | [
"self.period = period\nif offsets:\n self.offsets_s = [60 * offset + jitter for offset in offsets]\nelse:\n self.offsets_s = [jitter]",
"starts = [snapped_datetime(utc_dt, self.period, offset) for offset in self.offsets_s]\ninstants = [start + datetime.timedelta(minutes=n * self.period) for n, start in iter... | <|body_start_0|>
self.period = period
if offsets:
self.offsets_s = [60 * offset + jitter for offset in offsets]
else:
self.offsets_s = [jitter]
<|end_body_0|>
<|body_start_1|>
starts = [snapped_datetime(utc_dt, self.period, offset) for offset in self.offsets_s]
... | JobTimes | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobTimes:
def __init__(self, period, offsets, jitter):
"""This object computes a sequence of timestamps. Ex: period = 5, offsets = [0] would compute a series of datetime.datetime objects spaced by 5 minutes, aligned with the hour (e.g. 08:00, 08:05, 08:10 would be part of the sequence). ... | stack_v2_sparse_classes_36k_train_005499 | 8,797 | permissive | [
{
"docstring": "This object computes a sequence of timestamps. Ex: period = 5, offsets = [0] would compute a series of datetime.datetime objects spaced by 5 minutes, aligned with the hour (e.g. 08:00, 08:05, 08:10 would be part of the sequence). The alignment can be controlled with the \"offsets\" argument: per... | 2 | null | Implement the Python class `JobTimes` described below.
Class description:
Implement the JobTimes class.
Method signatures and docstrings:
- def __init__(self, period, offsets, jitter): This object computes a sequence of timestamps. Ex: period = 5, offsets = [0] would compute a series of datetime.datetime objects spac... | Implement the Python class `JobTimes` described below.
Class description:
Implement the JobTimes class.
Method signatures and docstrings:
- def __init__(self, period, offsets, jitter): This object computes a sequence of timestamps. Ex: period = 5, offsets = [0] would compute a series of datetime.datetime objects spac... | 09064105713603f7bf75c772e8354800a1bfa256 | <|skeleton|>
class JobTimes:
def __init__(self, period, offsets, jitter):
"""This object computes a sequence of timestamps. Ex: period = 5, offsets = [0] would compute a series of datetime.datetime objects spaced by 5 minutes, aligned with the hour (e.g. 08:00, 08:05, 08:10 would be part of the sequence). ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobTimes:
def __init__(self, period, offsets, jitter):
"""This object computes a sequence of timestamps. Ex: period = 5, offsets = [0] would compute a series of datetime.datetime objects spaced by 5 minutes, aligned with the hour (e.g. 08:00, 08:05, 08:10 would be part of the sequence). The alignment ... | the_stack_v2_python_sparse | infra/services/service_manager/scheduling_parser.py | mcgreevy/chromium-infra | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.