blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
330fc34c8959c24418587a35f9aa937640d777bf | [
"if head_1 is None or head_2 is None:\n return None\nloop_1 = FindFirstIntersectNode.get_loop_node(head_1)\nloop_2 = FindFirstIntersectNode.get_loop_node(head_2)\nif loop_1 is None and loop_2 is None:\n return FindFirstIntersectNode.no_loop(head_1, head_2)\nelif loop_1 is not None and loop_2 is not None:\n ... | <|body_start_0|>
if head_1 is None or head_2 is None:
return None
loop_1 = FindFirstIntersectNode.get_loop_node(head_1)
loop_2 = FindFirstIntersectNode.get_loop_node(head_2)
if loop_1 is None and loop_2 is None:
return FindFirstIntersectNode.no_loop(head_1, head_2... | FindFirstIntersectNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FindFirstIntersectNode:
def get_intersect_node(head_1, head_2):
""":param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点"""
<|body_0|>
def get_loop_node(head):
"""get loop node of linked list :param head: :return: 1、创建一个慢指针,一个快指针, 慢指针一次走一步, 快指针一次走两步 2、快、慢... | stack_v2_sparse_classes_10k_train_000100 | 8,372 | no_license | [
{
"docstring": ":param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点",
"name": "get_intersect_node",
"signature": "def get_intersect_node(head_1, head_2)"
},
{
"docstring": "get loop node of linked list :param head: :return: 1、创建一个慢指针,一个快指针, 慢指针一次走一步, 快指针一次走两步 2、快、慢指针同时走,第一次相遇后, 快指针... | 4 | stack_v2_sparse_classes_30k_train_000538 | Implement the Python class `FindFirstIntersectNode` described below.
Class description:
Implement the FindFirstIntersectNode class.
Method signatures and docstrings:
- def get_intersect_node(head_1, head_2): :param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点
- def get_loop_node(head): get loop node of ... | Implement the Python class `FindFirstIntersectNode` described below.
Class description:
Implement the FindFirstIntersectNode class.
Method signatures and docstrings:
- def get_intersect_node(head_1, head_2): :param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点
- def get_loop_node(head): get loop node of ... | 9767977c8c79a3b294003bdb3d9ef578a38508b6 | <|skeleton|>
class FindFirstIntersectNode:
def get_intersect_node(head_1, head_2):
""":param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点"""
<|body_0|>
def get_loop_node(head):
"""get loop node of linked list :param head: :return: 1、创建一个慢指针,一个快指针, 慢指针一次走一步, 快指针一次走两步 2、快、慢... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FindFirstIntersectNode:
def get_intersect_node(head_1, head_2):
""":param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点"""
if head_1 is None or head_2 is None:
return None
loop_1 = FindFirstIntersectNode.get_loop_node(head_1)
loop_2 = FindFirstIntersect... | the_stack_v2_python_sparse | link/find_first_intersect_node.py | TaylorWizard/python-learning | train | 0 | |
2b5ff03bc155daaece7585ef8a03299574061b3a | [
"self.kw = kwargs\nStep.__init__(self, routine=routine, **kwargs)\nself.spec_powers = {}\nself.freq_ranges = {}\nself.freq_centers = {}\nself.pts = {}\nself.experiment_settings = self.parse_settings(self.get_requested_settings())\nspec.QubitSpectroscopy1D.__init__(self, dev=self.dev, **self.experiment_settings)",
... | <|body_start_0|>
self.kw = kwargs
Step.__init__(self, routine=routine, **kwargs)
self.spec_powers = {}
self.freq_ranges = {}
self.freq_centers = {}
self.pts = {}
self.experiment_settings = self.parse_settings(self.get_requested_settings())
spec.QubitSpectr... | Wrapper for QubitSpectroscopy1D experiment. | QubitSpectroscopy1DStep | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QubitSpectroscopy1DStep:
"""Wrapper for QubitSpectroscopy1D experiment."""
def __init__(self, routine: AutomaticCalibrationRoutine, **kwargs):
"""Initializes the QubitSpectroscopy1DStep class, which also includes initialization of the QubitSpectroscopy1D experiment. Args: routine (St... | stack_v2_sparse_classes_10k_train_000101 | 24,662 | permissive | [
{
"docstring": "Initializes the QubitSpectroscopy1DStep class, which also includes initialization of the QubitSpectroscopy1D experiment. Args: routine (Step): The parent routine Keyword Arguments (for the Step constructor): step_label (str): A unique label for this step to be used in the configuration parameter... | 3 | stack_v2_sparse_classes_30k_train_003528 | Implement the Python class `QubitSpectroscopy1DStep` described below.
Class description:
Wrapper for QubitSpectroscopy1D experiment.
Method signatures and docstrings:
- def __init__(self, routine: AutomaticCalibrationRoutine, **kwargs): Initializes the QubitSpectroscopy1DStep class, which also includes initialization... | Implement the Python class `QubitSpectroscopy1DStep` described below.
Class description:
Wrapper for QubitSpectroscopy1D experiment.
Method signatures and docstrings:
- def __init__(self, routine: AutomaticCalibrationRoutine, **kwargs): Initializes the QubitSpectroscopy1DStep class, which also includes initialization... | bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d | <|skeleton|>
class QubitSpectroscopy1DStep:
"""Wrapper for QubitSpectroscopy1D experiment."""
def __init__(self, routine: AutomaticCalibrationRoutine, **kwargs):
"""Initializes the QubitSpectroscopy1DStep class, which also includes initialization of the QubitSpectroscopy1D experiment. Args: routine (St... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QubitSpectroscopy1DStep:
"""Wrapper for QubitSpectroscopy1D experiment."""
def __init__(self, routine: AutomaticCalibrationRoutine, **kwargs):
"""Initializes the QubitSpectroscopy1DStep class, which also includes initialization of the QubitSpectroscopy1D experiment. Args: routine (Step): The pare... | the_stack_v2_python_sparse | pycqed/measurement/calibration/automatic_calibration_routines/adaptive_qubit_spectroscopy.py | QudevETH/PycQED_py3 | train | 8 |
13bf17edb20b60bef2ca1380fc1df989cf64456c | [
"self.url = url\nself.auth_token = auth_token\nself.xapi_version = xapi_version",
"headers = {'Authorization': self.auth_token, 'Content-Type': 'application/json', 'X-Experience-API-Version': self.xapi_version}\nresponse = requests.post(self.url, json=xapi_statement.get_statement(), headers=headers, timeout=setti... | <|body_start_0|>
self.url = url
self.auth_token = auth_token
self.xapi_version = xapi_version
<|end_body_0|>
<|body_start_1|>
headers = {'Authorization': self.auth_token, 'Content-Type': 'application/json', 'X-Experience-API-Version': self.xapi_version}
response = requests.post(... | The XAPI object compute statements and send them to a LRS. | XAPI | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XAPI:
"""The XAPI object compute statements and send them to a LRS."""
def __init__(self, url, auth_token, xapi_version='1.0.3'):
"""Initialize the XAPI module. Parameters ---------- url: string The LRS endpoint to fetch auth_token: string The basic_auth token used to authenticate on... | stack_v2_sparse_classes_10k_train_000102 | 11,009 | permissive | [
{
"docstring": "Initialize the XAPI module. Parameters ---------- url: string The LRS endpoint to fetch auth_token: string The basic_auth token used to authenticate on the LRS xapi_version: string The xAPI version used.",
"name": "__init__",
"signature": "def __init__(self, url, auth_token, xapi_version... | 2 | stack_v2_sparse_classes_30k_train_001364 | Implement the Python class `XAPI` described below.
Class description:
The XAPI object compute statements and send them to a LRS.
Method signatures and docstrings:
- def __init__(self, url, auth_token, xapi_version='1.0.3'): Initialize the XAPI module. Parameters ---------- url: string The LRS endpoint to fetch auth_t... | Implement the Python class `XAPI` described below.
Class description:
The XAPI object compute statements and send them to a LRS.
Method signatures and docstrings:
- def __init__(self, url, auth_token, xapi_version='1.0.3'): Initialize the XAPI module. Parameters ---------- url: string The LRS endpoint to fetch auth_t... | f767f1bdc12c9712f26ea17cb8b19f536389f0ed | <|skeleton|>
class XAPI:
"""The XAPI object compute statements and send them to a LRS."""
def __init__(self, url, auth_token, xapi_version='1.0.3'):
"""Initialize the XAPI module. Parameters ---------- url: string The LRS endpoint to fetch auth_token: string The basic_auth token used to authenticate on... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XAPI:
"""The XAPI object compute statements and send them to a LRS."""
def __init__(self, url, auth_token, xapi_version='1.0.3'):
"""Initialize the XAPI module. Parameters ---------- url: string The LRS endpoint to fetch auth_token: string The basic_auth token used to authenticate on the LRS xapi... | the_stack_v2_python_sparse | src/backend/marsha/core/xapi.py | openfun/marsha | train | 92 |
b8ae939fca594afb1d38637766f2c78bc9e1b08b | [
"super(MLFBlockProcessor, self).__init__(sendee, sending=sending)\nself.set_sendee(sendee)\nself._current = None\nself._label_event_handler = label_event_handler",
"if isinstance(event, MLFRecordStartEvent):\n assert hasattr(event, 'record_filename')\n self._current = []\nelif isinstance(event, MLFLabelEven... | <|body_start_0|>
super(MLFBlockProcessor, self).__init__(sendee, sending=sending)
self.set_sendee(sendee)
self._current = None
self._label_event_handler = label_event_handler
<|end_body_0|>
<|body_start_1|>
if isinstance(event, MLFRecordStartEvent):
assert hasattr(ev... | Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [] >>> def handler0(label_evt): return label_e... | MLFBlockProcessor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MLFBlockProcessor:
"""Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [... | stack_v2_sparse_classes_10k_train_000103 | 13,578 | permissive | [
{
"docstring": "label_event_handler is a callable which takes MLFLabelEvents; the values returned will be appended to the list for each record. If None, the label events themselves will be appended. sendee is a function to call with our output events.",
"name": "__init__",
"signature": "def __init__(sel... | 2 | stack_v2_sparse_classes_30k_test_000348 | Implement the Python class `MLFBlockProcessor` described below.
Class description:
Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf'... | Implement the Python class `MLFBlockProcessor` described below.
Class description:
Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf'... | f270a1be86372b7044615e4fd82032029e123bc1 | <|skeleton|>
class MLFBlockProcessor:
"""Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MLFBlockProcessor:
"""Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [] >>> def han... | the_stack_v2_python_sparse | resources/Onyx-1.0.511/py/onyx/htkfiles/mlfprocess.py | eternity668/speechAD | train | 0 |
4b612ccddcca123d374e51540159ac2215f18f3c | [
"groups = Group.query.all()\ngroups_list = []\nfor group in groups:\n groups_list.append(group.__jsonapi__())\nreturn {'data': groups_list}",
"data = request.get_json()['data']\ngroup = Group(name=data['attributes']['name'])\ntry:\n group.abilities = list((id['id'] for id in data['relationships']['abilities... | <|body_start_0|>
groups = Group.query.all()
groups_list = []
for group in groups:
groups_list.append(group.__jsonapi__())
return {'data': groups_list}
<|end_body_0|>
<|body_start_1|>
data = request.get_json()['data']
group = Group(name=data['attributes']['nam... | GroupsList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupsList:
def get(self):
"""Get groups list"""
<|body_0|>
def post(self):
"""Create group"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
groups = Group.query.all()
groups_list = []
for group in groups:
groups_list.appe... | stack_v2_sparse_classes_10k_train_000104 | 46,738 | permissive | [
{
"docstring": "Get groups list",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create group",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004120 | Implement the Python class `GroupsList` described below.
Class description:
Implement the GroupsList class.
Method signatures and docstrings:
- def get(self): Get groups list
- def post(self): Create group | Implement the Python class `GroupsList` described below.
Class description:
Implement the GroupsList class.
Method signatures and docstrings:
- def get(self): Get groups list
- def post(self): Create group
<|skeleton|>
class GroupsList:
def get(self):
"""Get groups list"""
<|body_0|>
def po... | 3439a2dd0bd527c5d604801fec3a5aac904a72e2 | <|skeleton|>
class GroupsList:
def get(self):
"""Get groups list"""
<|body_0|>
def post(self):
"""Create group"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GroupsList:
def get(self):
"""Get groups list"""
groups = Group.query.all()
groups_list = []
for group in groups:
groups_list.append(group.__jsonapi__())
return {'data': groups_list}
def post(self):
"""Create group"""
data = request.get_... | the_stack_v2_python_sparse | app/views.py | taidos/lxc-rest | train | 0 | |
9dd91f29b7ba52fd1bfd24c1d4b5b34cd28d60c7 | [
"compiler = cls(filename)\ncompiler.visit(node)\nreturn compiler.stack.pop()",
"self.filename = filename\nself.block = '<undefined>'\nself.stack = []",
"self.block = node.name\nobj = {'enamldef': True, 'type': node.name, 'base': node.base, 'doc': node.doc, 'lineno': node.lineno, 'identifier': node.identifier, '... | <|body_start_0|>
compiler = cls(filename)
compiler.visit(node)
return compiler.stack.pop()
<|end_body_0|>
<|body_start_1|>
self.filename = filename
self.block = '<undefined>'
self.stack = []
<|end_body_1|>
<|body_start_2|>
self.block = node.name
obj = {'... | A visitor which compiles a Declaration node into a code object. | DeclarationCompiler | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeclarationCompiler:
"""A visitor which compiles a Declaration node into a code object."""
def compile(cls, node, filename):
"""The main entry point of the DeclarationCompiler. This compiler compiles the given Declaration node into a description dictionary which can be used to build ... | stack_v2_sparse_classes_10k_train_000105 | 24,020 | permissive | [
{
"docstring": "The main entry point of the DeclarationCompiler. This compiler compiles the given Declaration node into a description dictionary which can be used to build out the component tree at run time. Top assist with debugging, every production generated by the compiler has the filename, lineno, and bloc... | 6 | stack_v2_sparse_classes_30k_train_005902 | Implement the Python class `DeclarationCompiler` described below.
Class description:
A visitor which compiles a Declaration node into a code object.
Method signatures and docstrings:
- def compile(cls, node, filename): The main entry point of the DeclarationCompiler. This compiler compiles the given Declaration node ... | Implement the Python class `DeclarationCompiler` described below.
Class description:
A visitor which compiles a Declaration node into a code object.
Method signatures and docstrings:
- def compile(cls, node, filename): The main entry point of the DeclarationCompiler. This compiler compiles the given Declaration node ... | 424bba29219de58fe9e47196de6763de8b2009f2 | <|skeleton|>
class DeclarationCompiler:
"""A visitor which compiles a Declaration node into a code object."""
def compile(cls, node, filename):
"""The main entry point of the DeclarationCompiler. This compiler compiles the given Declaration node into a description dictionary which can be used to build ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeclarationCompiler:
"""A visitor which compiles a Declaration node into a code object."""
def compile(cls, node, filename):
"""The main entry point of the DeclarationCompiler. This compiler compiles the given Declaration node into a description dictionary which can be used to build out the compo... | the_stack_v2_python_sparse | enaml/core/enaml_compiler.py | enthought/enaml | train | 17 |
3c55a0f73a5023cf7cbd2e3af41f1532948a4068 | [
"if not root:\n return []\nres = [root.val]\nlevel = [root]\nwhile level:\n tem = []\n for l in level:\n if l:\n for child in [l.left, l.right]:\n tem.append(child)\n res.extend((i.val if i else None for i in tem))\n level = tem\nreturn res",
"if not data:\n retu... | <|body_start_0|>
if not root:
return []
res = [root.val]
level = [root]
while level:
tem = []
for l in level:
if l:
for child in [l.left, l.right]:
tem.append(child)
res.extend((i.... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_000106 | 1,788 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_006285 | 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:... | 409d7db811d41dbcc7ce8cda82b77eff35585657 | <|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_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return []
res = [root.val]
level = [root]
while level:
tem = []
for l in level:
if l:
... | the_stack_v2_python_sparse | Serialize and Deserialize Binary Tree.py | Windsooon/LeetCode | train | 1 | |
a34d1ca3a8b4ec696bdadbb45bc93c83c2bd6a7d | [
"self.loc = loc\nself.scale = scale\nself.NG = NormalDist()\nsuper().__init__(ContinuousSpace(-np.inf, np.inf))",
"y1 = self.NG.sample(num_samples)\ny2 = self.NG.sample(num_samples)\nreturn self.scale * (y1 / y2) + self.loc",
"loc = self.loc\nscale = self.scale\nv = m.pi * self.scale * (1 + np.square((x - loc) ... | <|body_start_0|>
self.loc = loc
self.scale = scale
self.NG = NormalDist()
super().__init__(ContinuousSpace(-np.inf, np.inf))
<|end_body_0|>
<|body_start_1|>
y1 = self.NG.sample(num_samples)
y2 = self.NG.sample(num_samples)
return self.scale * (y1 / y2) + self.loc... | Simple cauchy distribution. | CauchyDist | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CauchyDist:
"""Simple cauchy distribution."""
def __init__(self, loc=1, scale=1):
"""Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution"""
<|body_0|>
def sample(self, num_samples=1):
"""Generat... | stack_v2_sparse_classes_10k_train_000107 | 1,451 | permissive | [
{
"docstring": "Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution",
"name": "__init__",
"signature": "def __init__(self, loc=1, scale=1)"
},
{
"docstring": "Generate random numbers from Cauchy(mean,scale) by using ratio of no... | 3 | stack_v2_sparse_classes_30k_train_000148 | Implement the Python class `CauchyDist` described below.
Class description:
Simple cauchy distribution.
Method signatures and docstrings:
- def __init__(self, loc=1, scale=1): Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution
- def sample(self, nu... | Implement the Python class `CauchyDist` described below.
Class description:
Simple cauchy distribution.
Method signatures and docstrings:
- def __init__(self, loc=1, scale=1): Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution
- def sample(self, nu... | 4c854e90bfd4acaa511c1786c96f0610d7aea037 | <|skeleton|>
class CauchyDist:
"""Simple cauchy distribution."""
def __init__(self, loc=1, scale=1):
"""Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution"""
<|body_0|>
def sample(self, num_samples=1):
"""Generat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CauchyDist:
"""Simple cauchy distribution."""
def __init__(self, loc=1, scale=1):
"""Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution"""
self.loc = loc
self.scale = scale
self.NG = NormalDist()
... | the_stack_v2_python_sparse | src/continuous/cauchy.py | kosmitive/univariate-distributions | train | 0 |
c718b5f585e94d8e6e63d563a4d32982ca5746a0 | [
"dp = [[0] * (len(t) + 1) for _ in range(0, len(s) + 1)]\nfor i in range(0, len(s) + 1):\n dp[i][0] = 1\nfor i in range(1, len(s) + 1):\n for j in range(1, len(t) + 1):\n dp[i][j] += dp[i - 1][j]\n if t[j - 1] == s[i - 1]:\n dp[i][j] += dp[i - 1][j - 1]\nreturn dp[-1][-1]",
"dp = [0... | <|body_start_0|>
dp = [[0] * (len(t) + 1) for _ in range(0, len(s) + 1)]
for i in range(0, len(s) + 1):
dp[i][0] = 1
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
dp[i][j] += dp[i - 1][j]
if t[j - 1] == s[i - 1]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _numDistinct(self, s, t):
""":type s: str :type t: str :rtype: int"""
<|body_0|>
def numDistinct(self, s, t):
""":type s: str :type t: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [[0] * (len(t) + 1) for _ in ra... | stack_v2_sparse_classes_10k_train_000108 | 779 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: int",
"name": "_numDistinct",
"signature": "def _numDistinct(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: int",
"name": "numDistinct",
"signature": "def numDistinct(self, s, t)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _numDistinct(self, s, t): :type s: str :type t: str :rtype: int
- def numDistinct(self, s, t): :type s: str :type t: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _numDistinct(self, s, t): :type s: str :type t: str :rtype: int
- def numDistinct(self, s, t): :type s: str :type t: str :rtype: int
<|skeleton|>
class Solution:
def _n... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution:
def _numDistinct(self, s, t):
""":type s: str :type t: str :rtype: int"""
<|body_0|>
def numDistinct(self, s, t):
""":type s: str :type t: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _numDistinct(self, s, t):
""":type s: str :type t: str :rtype: int"""
dp = [[0] * (len(t) + 1) for _ in range(0, len(s) + 1)]
for i in range(0, len(s) + 1):
dp[i][0] = 1
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/lc-all-solutions/115.distinct-subsequences/distinct-subsequences.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
c090d4629aa082c25e3ef7af3d6b20f82e4bf8a4 | [
"tip_label1 = widgets.Label(u'最优参数grid search暂不支持实时网络数据模式', layout=widgets.Layout(width='300px'))\ntip_label2 = widgets.Label(u\"非沙盒模式需先用'数据下载界面操作'进行下载\", layout=widgets.Layout(width='300px'))\n'沙盒数据与开放数据模式切换'\nself.date_mode = widgets.RadioButtons(options=[u'沙盒数据模式', u'开放数据模式'], value=u'沙盒数据模式' if ABuEnv._g_enable... | <|body_start_0|>
tip_label1 = widgets.Label(u'最优参数grid search暂不支持实时网络数据模式', layout=widgets.Layout(width='300px'))
tip_label2 = widgets.Label(u"非沙盒模式需先用'数据下载界面操作'进行下载", layout=widgets.Layout(width='300px'))
'沙盒数据与开放数据模式切换'
self.date_mode = widgets.RadioButtons(options=[u'沙盒数据模式', u'开放数据模式... | 策略最优参数grid search | WidgetGridSearch | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WidgetGridSearch:
"""策略最优参数grid search"""
def __init__(self):
"""构建回测需要的各个组件形成tab"""
<|body_0|>
def on_data_mode_change(self, change):
"""沙盒与非沙盒数据界面操作转换"""
<|body_1|>
def run_grid_search(self, bt):
"""运行回测所对应的button按钮"""
<|body_2|>
<... | stack_v2_sparse_classes_10k_train_000109 | 4,321 | permissive | [
{
"docstring": "构建回测需要的各个组件形成tab",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "沙盒与非沙盒数据界面操作转换",
"name": "on_data_mode_change",
"signature": "def on_data_mode_change(self, change)"
},
{
"docstring": "运行回测所对应的button按钮",
"name": "run_grid_search",
... | 3 | stack_v2_sparse_classes_30k_train_006628 | Implement the Python class `WidgetGridSearch` described below.
Class description:
策略最优参数grid search
Method signatures and docstrings:
- def __init__(self): 构建回测需要的各个组件形成tab
- def on_data_mode_change(self, change): 沙盒与非沙盒数据界面操作转换
- def run_grid_search(self, bt): 运行回测所对应的button按钮 | Implement the Python class `WidgetGridSearch` described below.
Class description:
策略最优参数grid search
Method signatures and docstrings:
- def __init__(self): 构建回测需要的各个组件形成tab
- def on_data_mode_change(self, change): 沙盒与非沙盒数据界面操作转换
- def run_grid_search(self, bt): 运行回测所对应的button按钮
<|skeleton|>
class WidgetGridSearch:
... | 2e5ab17f2d20deb3c68c927f6208ea89db7c639d | <|skeleton|>
class WidgetGridSearch:
"""策略最优参数grid search"""
def __init__(self):
"""构建回测需要的各个组件形成tab"""
<|body_0|>
def on_data_mode_change(self, change):
"""沙盒与非沙盒数据界面操作转换"""
<|body_1|>
def run_grid_search(self, bt):
"""运行回测所对应的button按钮"""
<|body_2|>
<... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WidgetGridSearch:
"""策略最优参数grid search"""
def __init__(self):
"""构建回测需要的各个组件形成tab"""
tip_label1 = widgets.Label(u'最优参数grid search暂不支持实时网络数据模式', layout=widgets.Layout(width='300px'))
tip_label2 = widgets.Label(u"非沙盒模式需先用'数据下载界面操作'进行下载", layout=widgets.Layout(width='300px'))
... | the_stack_v2_python_sparse | abupy/WidgetBu/ABuWGGridSearch.py | luqin/firefly | train | 1 |
ea9286e90618c585ee1c81c06b28ccfa8b84b3fd | [
"if isinstance(start, int) and isinstance(end, int):\n pass\nelse:\n print('numbers should be int!')\nself.start = start\nself.end = end",
"@wraps(func)\ndef wrapper(*args, **kwargs):\n gener = self.__iter__()\n return func(gener, *args, **kwargs)\nreturn wrapper",
"try:\n for k in range(self.sta... | <|body_start_0|>
if isinstance(start, int) and isinstance(end, int):
pass
else:
print('numbers should be int!')
self.start = start
self.end = end
<|end_body_0|>
<|body_start_1|>
@wraps(func)
def wrapper(*args, **kwargs):
gener = self._... | Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using | Prime_Filtration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Prime_Filtration:
"""Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using"""
def __init__(self, start, end):
""... | stack_v2_sparse_classes_10k_train_000110 | 3,273 | no_license | [
{
"docstring": "Introduction ------------ constructor Parameters ---------- start: the start number of the range end : the end number of the range ----------",
"name": "__init__",
"signature": "def __init__(self, start, end)"
},
{
"docstring": "Introduction ------------ Rewrite __call__ function... | 4 | stack_v2_sparse_classes_30k_train_001947 | Implement the Python class `Prime_Filtration` described below.
Class description:
Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using
Method sig... | Implement the Python class `Prime_Filtration` described below.
Class description:
Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using
Method sig... | 661dba7ea846859056fd6ee7a310d352ca178e98 | <|skeleton|>
class Prime_Filtration:
"""Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using"""
def __init__(self, start, end):
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Prime_Filtration:
"""Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using"""
def __init__(self, start, end):
"""Introduction... | the_stack_v2_python_sparse | 包亦航2018011890/Regular_homework/Prime_Filtration(second_homework)/Prime_Filtration.py | wanghan79/2020_Python | train | 4 |
74e1a8d745d8263614e8b7e080fedc65d9709b81 | [
"self.years = [year for year in range(year_i, year_f + 1)]\nself.type_AOD = type_AOD\nself.year_i = year_i\nself.year_f = year_f\nself.file = file",
"self.data = pd.read_csv(path + self.file + '.csv')\nself.clean_data()\nself.data = self.data.fillna(-1)\nself.len_data = len(self.data[self.type_AOD])",
"for key ... | <|body_start_0|>
self.years = [year for year in range(year_i, year_f + 1)]
self.type_AOD = type_AOD
self.year_i = year_i
self.year_f = year_f
self.file = file
<|end_body_0|>
<|body_start_1|>
self.data = pd.read_csv(path + self.file + '.csv')
self.clean_data()
... | Clase que contiene los metodos y lectura que se le aplicaran a los datos de MODIS | MODIS_data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MODIS_data:
"""Clase que contiene los metodos y lectura que se le aplicaran a los datos de MODIS"""
def __init__(self, file, year_i, year_f, type_AOD):
"""Describcion de variables: type_AOD---> columna de AOD que leer file ---> archivo que contiene la informacion del AOD year_i ---> ... | stack_v2_sparse_classes_10k_train_000111 | 2,794 | no_license | [
{
"docstring": "Describcion de variables: type_AOD---> columna de AOD que leer file ---> archivo que contiene la informacion del AOD year_i ---> año en el que inicia el analisis year_f ---> año en el que finaliza el analisis",
"name": "__init__",
"signature": "def __init__(self, file, year_i, year_f, ty... | 5 | stack_v2_sparse_classes_30k_train_006183 | Implement the Python class `MODIS_data` described below.
Class description:
Clase que contiene los metodos y lectura que se le aplicaran a los datos de MODIS
Method signatures and docstrings:
- def __init__(self, file, year_i, year_f, type_AOD): Describcion de variables: type_AOD---> columna de AOD que leer file --->... | Implement the Python class `MODIS_data` described below.
Class description:
Clase que contiene los metodos y lectura que se le aplicaran a los datos de MODIS
Method signatures and docstrings:
- def __init__(self, file, year_i, year_f, type_AOD): Describcion de variables: type_AOD---> columna de AOD que leer file --->... | 43c7c6e6c57e76a0f80a3052a9060161d9b9dd41 | <|skeleton|>
class MODIS_data:
"""Clase que contiene los metodos y lectura que se le aplicaran a los datos de MODIS"""
def __init__(self, file, year_i, year_f, type_AOD):
"""Describcion de variables: type_AOD---> columna de AOD que leer file ---> archivo que contiene la informacion del AOD year_i ---> ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MODIS_data:
"""Clase que contiene los metodos y lectura que se le aplicaran a los datos de MODIS"""
def __init__(self, file, year_i, year_f, type_AOD):
"""Describcion de variables: type_AOD---> columna de AOD que leer file ---> archivo que contiene la informacion del AOD year_i ---> año en el que... | the_stack_v2_python_sparse | Scripts/functions_MODIS.py | iphadra/SIMA | train | 0 |
14f73d388dce505acb8f30bb623fd6d540791ffe | [
"print('Testing that spatial_correlation returns a float')\nsc_result = spatial_correlation(5, 5, 5, 5, 5, 5, 5, 5, 5, 5)\nself.assertTrue(isinstance(sc_result, float), 'spatial correlation is not a float')",
"print('Testing that spatial_correlation returns an array')\nhist_long = [53.195, 51.954, 53.107]\nfloat_... | <|body_start_0|>
print('Testing that spatial_correlation returns a float')
sc_result = spatial_correlation(5, 5, 5, 5, 5, 5, 5, 5, 5, 5)
self.assertTrue(isinstance(sc_result, float), 'spatial correlation is not a float')
<|end_body_0|>
<|body_start_1|>
print('Testing that spatial_correl... | Test cases for "spatial_correlation" function | MyTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyTestCase:
"""Test cases for "spatial_correlation" function"""
def test_spatial_correlation_returns_float(self):
"""Check that spatial_correlation returns a float if given a float :return: Nothing"""
<|body_0|>
def test_spatial_correlation_returns_array(self):
"... | stack_v2_sparse_classes_10k_train_000112 | 5,068 | no_license | [
{
"docstring": "Check that spatial_correlation returns a float if given a float :return: Nothing",
"name": "test_spatial_correlation_returns_float",
"signature": "def test_spatial_correlation_returns_float(self)"
},
{
"docstring": "Check that spatial_correlation returns an array if given an arra... | 4 | stack_v2_sparse_classes_30k_train_002988 | Implement the Python class `MyTestCase` described below.
Class description:
Test cases for "spatial_correlation" function
Method signatures and docstrings:
- def test_spatial_correlation_returns_float(self): Check that spatial_correlation returns a float if given a float :return: Nothing
- def test_spatial_correlatio... | Implement the Python class `MyTestCase` described below.
Class description:
Test cases for "spatial_correlation" function
Method signatures and docstrings:
- def test_spatial_correlation_returns_float(self): Check that spatial_correlation returns a float if given a float :return: Nothing
- def test_spatial_correlatio... | 3944e9783d58422d2d10bbc95f9706e168550034 | <|skeleton|>
class MyTestCase:
"""Test cases for "spatial_correlation" function"""
def test_spatial_correlation_returns_float(self):
"""Check that spatial_correlation returns a float if given a float :return: Nothing"""
<|body_0|>
def test_spatial_correlation_returns_array(self):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MyTestCase:
"""Test cases for "spatial_correlation" function"""
def test_spatial_correlation_returns_float(self):
"""Check that spatial_correlation returns a float if given a float :return: Nothing"""
print('Testing that spatial_correlation returns a float')
sc_result = spatial_co... | the_stack_v2_python_sparse | ow_calibration/find_besthist/spatial_correlation/spatial_correlation_test.py | gmaze/argodmqc_owc | train | 0 |
138eb3ab5e261f8bc5ec13406a1c5a1a472aa0a6 | [
"self.application_id_local = kwargs.pop('id')\nself.adult = kwargs.pop('adult')\nself.name = kwargs.pop('name')\nsuper(OtherPeopleAdultDBSForm, self).__init__(*args, **kwargs)\nfull_stop_stripper(self)\nif AdultInHome.objects.filter(application_id=self.application_id_local, adult=self.adult).count() > 0:\n adult... | <|body_start_0|>
self.application_id_local = kwargs.pop('id')
self.adult = kwargs.pop('adult')
self.name = kwargs.pop('name')
super(OtherPeopleAdultDBSForm, self).__init__(*args, **kwargs)
full_stop_stripper(self)
if AdultInHome.objects.filter(application_id=self.applicat... | GOV.UK form for the People in your home: adult DBS page | OtherPeopleAdultDBSForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OtherPeopleAdultDBSForm:
"""GOV.UK form for the People in your home: adult DBS page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult DBS form :param args: arguments passed to the form :param kwargs: keyword arguments ... | stack_v2_sparse_classes_10k_train_000113 | 20,631 | no_license | [
{
"docstring": "Method to configure the initialisation of the People in your home: adult DBS form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docs... | 2 | stack_v2_sparse_classes_30k_train_001088 | Implement the Python class `OtherPeopleAdultDBSForm` described below.
Class description:
GOV.UK form for the People in your home: adult DBS page
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Method to configure the initialisation of the People in your home: adult DBS form :param args: argum... | Implement the Python class `OtherPeopleAdultDBSForm` described below.
Class description:
GOV.UK form for the People in your home: adult DBS page
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Method to configure the initialisation of the People in your home: adult DBS form :param args: argum... | fa6ca6a8164763e1dfe1581702ca5d36e44859de | <|skeleton|>
class OtherPeopleAdultDBSForm:
"""GOV.UK form for the People in your home: adult DBS page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult DBS form :param args: arguments passed to the form :param kwargs: keyword arguments ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OtherPeopleAdultDBSForm:
"""GOV.UK form for the People in your home: adult DBS page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult DBS form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the... | the_stack_v2_python_sparse | application/forms/other_people.py | IS-JAQU-CAZ/OFS-MORE-Childminder-Website | train | 0 |
6b723ca5b76215f0ff4561982dea69962aef9f0a | [
"if not string:\n return Strings.EMPTY\nif not isinstance(string, str):\n string = str(string)\nstring = string.strip().lower()\nif string.startswith(('a ', 'an ')):\n return Strings.EMPTY\nif Strings.is_vowel(string[0]):\n return 'an'\nreturn 'a'",
"intensifiers = ['', 'rather', 'slightly', 'very', '... | <|body_start_0|>
if not string:
return Strings.EMPTY
if not isinstance(string, str):
string = str(string)
string = string.strip().lower()
if string.startswith(('a ', 'an ')):
return Strings.EMPTY
if Strings.is_vowel(string[0]):
retu... | Class docstring. | Utils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Utils:
"""Class docstring."""
def article_for(cls, string):
"""Method docstring."""
<|body_0|>
def random_intensifier(cls, uniform=False):
"""Method docstring."""
<|body_1|>
def scan_for_values_with_key(cls, obj, key):
"""Method docstring."""... | stack_v2_sparse_classes_10k_train_000114 | 1,557 | no_license | [
{
"docstring": "Method docstring.",
"name": "article_for",
"signature": "def article_for(cls, string)"
},
{
"docstring": "Method docstring.",
"name": "random_intensifier",
"signature": "def random_intensifier(cls, uniform=False)"
},
{
"docstring": "Method docstring.",
"name":... | 3 | stack_v2_sparse_classes_30k_train_005595 | Implement the Python class `Utils` described below.
Class description:
Class docstring.
Method signatures and docstrings:
- def article_for(cls, string): Method docstring.
- def random_intensifier(cls, uniform=False): Method docstring.
- def scan_for_values_with_key(cls, obj, key): Method docstring. | Implement the Python class `Utils` described below.
Class description:
Class docstring.
Method signatures and docstrings:
- def article_for(cls, string): Method docstring.
- def random_intensifier(cls, uniform=False): Method docstring.
- def scan_for_values_with_key(cls, obj, key): Method docstring.
<|skeleton|>
cla... | f4c2533cd4543717b57743b8dabd783fa7cfcd60 | <|skeleton|>
class Utils:
"""Class docstring."""
def article_for(cls, string):
"""Method docstring."""
<|body_0|>
def random_intensifier(cls, uniform=False):
"""Method docstring."""
<|body_1|>
def scan_for_values_with_key(cls, obj, key):
"""Method docstring."""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Utils:
"""Class docstring."""
def article_for(cls, string):
"""Method docstring."""
if not string:
return Strings.EMPTY
if not isinstance(string, str):
string = str(string)
string = string.strip().lower()
if string.startswith(('a ', 'an ')):... | the_stack_v2_python_sparse | rng/helpers/utils.py | janvanoverwalle/random-npc-generator | train | 0 |
76f32816b81a2645b48c5f143d13198f86ec11e7 | [
"try:\n return int(value)\nexcept ValueError:\n raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value)))",
"if isinstance(value, int):\n return 1\nreturn 0",
"try:\n return str(int(value))\nexcept OverflowError:\n base = str(value)\n ... | <|body_start_0|>
try:
return int(value)
except ValueError:
raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value)))
<|end_body_0|>
<|body_start_1|>
if isinstance(value, int):
return 1
retu... | SFInt32 field/event type base-class | _SFInt32 | [
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _SFInt32:
"""SFInt32 field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type... | stack_v2_sparse_classes_10k_train_000115 | 34,853 | permissive | [
{
"docstring": "Coerce the given value to our type Allowable types: any object with true/false protocol",
"name": "coerce",
"signature": "def coerce(self, value)"
},
{
"docstring": "Check that the given value is of exactly expected type",
"name": "check",
"signature": "def check(self, va... | 3 | null | Implement the Python class `_SFInt32` described below.
Class description:
SFInt32 field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of ... | Implement the Python class `_SFInt32` described below.
Class description:
SFInt32 field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of ... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class _SFInt32:
"""SFInt32 field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _SFInt32:
"""SFInt32 field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
try:
return int(value)
except ValueError:
raise ValueError('Attempted to set value for... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py | alexus37/AugmentedRealityChess | train | 1 |
3b6dd19f6d0ad43bf8fe62e84f348525992328b5 | [
"sum = 0\nres = []\nfor i in nums:\n if i == 1:\n sum += 1\n else:\n res.append(sum)\n sum = 0\n res.append(sum)\nreturn max(res)",
"sum = 0\nres = 0\nfor i in nums:\n if i == 1:\n sum += 1\n else:\n res = max(res, sum)\n sum = 0\n res = max(res, sum)\nr... | <|body_start_0|>
sum = 0
res = []
for i in nums:
if i == 1:
sum += 1
else:
res.append(sum)
sum = 0
res.append(sum)
return max(res)
<|end_body_0|>
<|body_start_1|>
sum = 0
res = 0
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sum = 0
res = []
for i... | stack_v2_sparse_classes_10k_train_000116 | 1,088 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMaxConsecutiveOnes",
"signature": "def findMaxConsecutiveOnes(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMax",
"signature": "def findMax(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000385 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int
- def findMax(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int
- def findMax(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def find... | 1040b5dbbe509abe42df848bc34dd1626d7a05fb | <|skeleton|>
class Solution:
def findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
sum = 0
res = []
for i in nums:
if i == 1:
sum += 1
else:
res.append(sum)
sum = 0
res.append(sum)
... | the_stack_v2_python_sparse | list/findMaxConsecutiveOnes.py | NJ-zero/LeetCode_Answer | train | 1 | |
7568adfd3092d11983bb1a07fc46df6a80aaed44 | [
"theKeys = HashSet()\nfor game in File('games/test').listFiles():\n if not game.__name__.endsWith('.kif'):\n continue\n theKeys.add(game.__name__.replace('.kif', ''))\nreturn theKeys",
"try:\n return Game.createEphemeralGame(Game.preprocessRulesheet(FileUtils.readFileAsString(File('games/test/' + ... | <|body_start_0|>
theKeys = HashSet()
for game in File('games/test').listFiles():
if not game.__name__.endsWith('.kif'):
continue
theKeys.add(game.__name__.replace('.kif', ''))
return theKeys
<|end_body_0|>
<|body_start_1|>
try:
return ... | generated source for class TestGameRepository | TestGameRepository | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGameRepository:
"""generated source for class TestGameRepository"""
def getUncachedGameKeys(self):
"""generated source for method getUncachedGameKeys"""
<|body_0|>
def getUncachedGame(self, theKey):
"""generated source for method getUncachedGame"""
<|... | stack_v2_sparse_classes_10k_train_000117 | 1,170 | permissive | [
{
"docstring": "generated source for method getUncachedGameKeys",
"name": "getUncachedGameKeys",
"signature": "def getUncachedGameKeys(self)"
},
{
"docstring": "generated source for method getUncachedGame",
"name": "getUncachedGame",
"signature": "def getUncachedGame(self, theKey)"
}
] | 2 | null | Implement the Python class `TestGameRepository` described below.
Class description:
generated source for class TestGameRepository
Method signatures and docstrings:
- def getUncachedGameKeys(self): generated source for method getUncachedGameKeys
- def getUncachedGame(self, theKey): generated source for method getUncac... | Implement the Python class `TestGameRepository` described below.
Class description:
generated source for class TestGameRepository
Method signatures and docstrings:
- def getUncachedGameKeys(self): generated source for method getUncachedGameKeys
- def getUncachedGame(self, theKey): generated source for method getUncac... | 4e6e6e876c3a4294cd711647051da2d9c1836b60 | <|skeleton|>
class TestGameRepository:
"""generated source for class TestGameRepository"""
def getUncachedGameKeys(self):
"""generated source for method getUncachedGameKeys"""
<|body_0|>
def getUncachedGame(self, theKey):
"""generated source for method getUncachedGame"""
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestGameRepository:
"""generated source for class TestGameRepository"""
def getUncachedGameKeys(self):
"""generated source for method getUncachedGameKeys"""
theKeys = HashSet()
for game in File('games/test').listFiles():
if not game.__name__.endsWith('.kif'):
... | the_stack_v2_python_sparse | ggpy/cruft/autocode/TestGameRepository.py | hobson/ggpy | train | 1 |
eca9b34b267e00712d798e7bdd47afb5cfbd5cdd | [
"super(PIDTimedLoop, self).__init__(period, num_period)\nself._pid = pid\nself._is_active = pid.poll() is None",
"if not self._is_active:\n raise StopIteration\ntry:\n self._pid.wait(timeout=timeout)\n self._is_active = False\nexcept subprocess.TimeoutExpired:\n pass"
] | <|body_start_0|>
super(PIDTimedLoop, self).__init__(period, num_period)
self._pid = pid
self._is_active = pid.poll() is None
<|end_body_0|>
<|body_start_1|>
if not self._is_active:
raise StopIteration
try:
self._pid.wait(timeout=timeout)
self.... | PIDTimedLoop | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PIDTimedLoop:
def __init__(self, pid, period, num_period=None):
"""Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned... | stack_v2_sparse_classes_10k_train_000118 | 13,068 | permissive | [
{
"docstring": "Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned by the loop is the product of the two input parameters. To create an infin... | 2 | stack_v2_sparse_classes_30k_train_003516 | Implement the Python class `PIDTimedLoop` described below.
Class description:
Implement the PIDTimedLoop class.
Method signatures and docstrings:
- def __init__(self, pid, period, num_period=None): Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of ti... | Implement the Python class `PIDTimedLoop` described below.
Class description:
Implement the PIDTimedLoop class.
Method signatures and docstrings:
- def __init__(self, pid, period, num_period=None): Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of ti... | 8acb57ab057104612e24d436a92c3fc1a1aa37c0 | <|skeleton|>
class PIDTimedLoop:
def __init__(self, pid, period, num_period=None):
"""Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PIDTimedLoop:
def __init__(self, pid, period, num_period=None):
"""Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned by the loop i... | the_stack_v2_python_sparse | service/geopmdpy/runtime.py | dannosliwcd/geopm | train | 0 | |
0fec9cb4b8d86dfaea25aec8c1361f09dd7e1b5d | [
"super(NeRF, self).__init__()\nself.D = D\nself.W = W\nself.in_channels_xyz = in_channels_xyz\nself.skips = skips\nself.sh = torch.nn.Parameter(torch.rand(9), requires_grad=True)\nfor i in range(D):\n if i == 0:\n layer = nn.Linear(in_channels_xyz, W)\n elif i in skips:\n layer = nn.Linear(W + i... | <|body_start_0|>
super(NeRF, self).__init__()
self.D = D
self.W = W
self.in_channels_xyz = in_channels_xyz
self.skips = skips
self.sh = torch.nn.Parameter(torch.rand(9), requires_grad=True)
for i in range(D):
if i == 0:
layer = nn.Linea... | NeRF | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeRF:
def __init__(self, D=8, W=256, in_channels_xyz=63, skips=[4]):
"""This network has NO direction input, only input xyz, output albedo and sigma D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (... | stack_v2_sparse_classes_10k_train_000119 | 18,983 | no_license | [
{
"docstring": "This network has NO direction input, only input xyz, output albedo and sigma D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (3+3*10*2=63 by default) skips: add skip connection in the Dth layer",
"name"... | 2 | stack_v2_sparse_classes_30k_train_007295 | Implement the Python class `NeRF` described below.
Class description:
Implement the NeRF class.
Method signatures and docstrings:
- def __init__(self, D=8, W=256, in_channels_xyz=63, skips=[4]): This network has NO direction input, only input xyz, output albedo and sigma D: number of layers for density (sigma) encode... | Implement the Python class `NeRF` described below.
Class description:
Implement the NeRF class.
Method signatures and docstrings:
- def __init__(self, D=8, W=256, in_channels_xyz=63, skips=[4]): This network has NO direction input, only input xyz, output albedo and sigma D: number of layers for density (sigma) encode... | 3b6e9d85e77077d1ad3b669fe88799d6a19e6d99 | <|skeleton|>
class NeRF:
def __init__(self, D=8, W=256, in_channels_xyz=63, skips=[4]):
"""This network has NO direction input, only input xyz, output albedo and sigma D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NeRF:
def __init__(self, D=8, W=256, in_channels_xyz=63, skips=[4]):
"""This network has NO direction input, only input xyz, output albedo and sigma D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (3+3*10*2=63 by... | the_stack_v2_python_sparse | models/nert.py | jcn16/nert | train | 0 | |
892cbc07a1524f47caaf9eddeb1e1485bb79c915 | [
"data = form.cleaned_data\nself.success_url = reverse('semester_result', kwargs={'level': int(data['level']), 'semester': int(data['semester'])})\nreturn super().form_valid(form)",
"context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Semester Result To Display'\ncontext['detail_text'] = ... | <|body_start_0|>
data = form.cleaned_data
self.success_url = reverse('semester_result', kwargs={'level': int(data['level']), 'semester': int(data['semester'])})
return super().form_valid(form)
<|end_body_0|>
<|body_start_1|>
context = super().get_context_data(**kwargs)
context['... | View for choosing which semester result to display. Check that the user's account is still active. Redirects to semester_result view on form valid. | ShowSemesterResultView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShowSemesterResultView:
"""View for choosing which semester result to display. Check that the user's account is still active. Redirects to semester_result view on form valid."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_000120 | 29,759 | no_license | [
{
"docstring": "Compute the success URL and call super.form_valid()",
"name": "form_valid",
"signature": "def form_valid(self, form)"
},
{
"docstring": "Return the data used in the templates rendering.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
}
... | 2 | stack_v2_sparse_classes_30k_train_003477 | Implement the Python class `ShowSemesterResultView` described below.
Class description:
View for choosing which semester result to display. Check that the user's account is still active. Redirects to semester_result view on form valid.
Method signatures and docstrings:
- def form_valid(self, form): Compute the succes... | Implement the Python class `ShowSemesterResultView` described below.
Class description:
View for choosing which semester result to display. Check that the user's account is still active. Redirects to semester_result view on form valid.
Method signatures and docstrings:
- def form_valid(self, form): Compute the succes... | 06bc577d01d3dbf6c425e03dcb903977a38e377c | <|skeleton|>
class ShowSemesterResultView:
"""View for choosing which semester result to display. Check that the user's account is still active. Redirects to semester_result view on form valid."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ShowSemesterResultView:
"""View for choosing which semester result to display. Check that the user's account is still active. Redirects to semester_result view on form valid."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
data = form.cleaned_data
... | the_stack_v2_python_sparse | cbt/views.py | Festusali/CBTest | train | 6 |
51e04a8fd9351ad145a79700d106335968a7ede3 | [
"self.num = number_of_iterations\nself.ang = angle\nself.sta = starting_angle\nself.size = size\nself.seq = ''\ncount = 0\nwhile count < self.num:\n self.seq += '0'\n self.seq += self.invert_sequence(self.seq[0:-1])\n count += 1\nself.draw = self.draw_curve()",
"inverted_sequence = ''\nfor n in sequence[... | <|body_start_0|>
self.num = number_of_iterations
self.ang = angle
self.sta = starting_angle
self.size = size
self.seq = ''
count = 0
while count < self.num:
self.seq += '0'
self.seq += self.invert_sequence(self.seq[0:-1])
count ... | Dragoncurve | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dragoncurve:
def __init__(self, number_of_iterations, angle=90, starting_angle=0, size=4):
"""generates sequence which will be used to draw curve"""
<|body_0|>
def invert_sequence(self, sequence):
"""flips retrograde then inverts digits"""
<|body_1|>
def... | stack_v2_sparse_classes_10k_train_000121 | 1,610 | no_license | [
{
"docstring": "generates sequence which will be used to draw curve",
"name": "__init__",
"signature": "def __init__(self, number_of_iterations, angle=90, starting_angle=0, size=4)"
},
{
"docstring": "flips retrograde then inverts digits",
"name": "invert_sequence",
"signature": "def inv... | 3 | stack_v2_sparse_classes_30k_train_007340 | Implement the Python class `Dragoncurve` described below.
Class description:
Implement the Dragoncurve class.
Method signatures and docstrings:
- def __init__(self, number_of_iterations, angle=90, starting_angle=0, size=4): generates sequence which will be used to draw curve
- def invert_sequence(self, sequence): fli... | Implement the Python class `Dragoncurve` described below.
Class description:
Implement the Dragoncurve class.
Method signatures and docstrings:
- def __init__(self, number_of_iterations, angle=90, starting_angle=0, size=4): generates sequence which will be used to draw curve
- def invert_sequence(self, sequence): fli... | 886699031cd708f96427dffdb70d6adc5949b647 | <|skeleton|>
class Dragoncurve:
def __init__(self, number_of_iterations, angle=90, starting_angle=0, size=4):
"""generates sequence which will be used to draw curve"""
<|body_0|>
def invert_sequence(self, sequence):
"""flips retrograde then inverts digits"""
<|body_1|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Dragoncurve:
def __init__(self, number_of_iterations, angle=90, starting_angle=0, size=4):
"""generates sequence which will be used to draw curve"""
self.num = number_of_iterations
self.ang = angle
self.sta = starting_angle
self.size = size
self.seq = ''
... | the_stack_v2_python_sparse | turtle_dragon_curve.py | MaxRandle/Python-projects | train | 0 | |
b0b855afb7ccd41f4eb013dae28fabd70bc7d699 | [
"carry = 1\nfor index in xrange(len(digits) - 1, -1, -1):\n sum = digits[index] + carry\n carry = sum / 10\n digits[index] = sum % 10\nif carry == 1:\n digits = [1] + digits\nreturn digits",
"for i in xrange(len(digits) - 1, -1, -1):\n if digits[i] < 9:\n digits[i] = digits[i] + 1\n r... | <|body_start_0|>
carry = 1
for index in xrange(len(digits) - 1, -1, -1):
sum = digits[index] + carry
carry = sum / 10
digits[index] = sum % 10
if carry == 1:
digits = [1] + digits
return digits
<|end_body_0|>
<|body_start_1|>
for i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def plusOne(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_0|>
def plusOne_better(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
carry = 1
for inde... | stack_v2_sparse_classes_10k_train_000122 | 988 | no_license | [
{
"docstring": ":type digits: List[int] :rtype: List[int]",
"name": "plusOne",
"signature": "def plusOne(self, digits)"
},
{
"docstring": ":type digits: List[int] :rtype: List[int]",
"name": "plusOne_better",
"signature": "def plusOne_better(self, digits)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def plusOne(self, digits): :type digits: List[int] :rtype: List[int]
- def plusOne_better(self, digits): :type digits: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def plusOne(self, digits): :type digits: List[int] :rtype: List[int]
- def plusOne_better(self, digits): :type digits: List[int] :rtype: List[int]
<|skeleton|>
class Solution:
... | a2cd0dc5e098080df87c4fb57d16877d21ca47a3 | <|skeleton|>
class Solution:
def plusOne(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_0|>
def plusOne_better(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def plusOne(self, digits):
""":type digits: List[int] :rtype: List[int]"""
carry = 1
for index in xrange(len(digits) - 1, -1, -1):
sum = digits[index] + carry
carry = sum / 10
digits[index] = sum % 10
if carry == 1:
digi... | the_stack_v2_python_sparse | 0066_Plus_One/solution.py | benjaminhuanghuang/ben-leetcode | train | 1 | |
688b3f42d97abd4aa6bce3ae787562f5ba51589a | [
"self._feature_store_id = feature_store_id\nself._feature_group_id = feature_group_id\nself._variable_api = VariableApi()",
"_client = client.get_instance()\npath_params = ['project', _client._project_id, 'featurestores', self._feature_store_id, 'featuregroups', self._feature_group_id, 'expectationsuite']\nmajor,... | <|body_start_0|>
self._feature_store_id = feature_store_id
self._feature_group_id = feature_group_id
self._variable_api = VariableApi()
<|end_body_0|>
<|body_start_1|>
_client = client.get_instance()
path_params = ['project', _client._project_id, 'featurestores', self._feature_s... | ExpectationSuiteApi | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExpectationSuiteApi:
def __init__(self, feature_store_id: int, feature_group_id: int):
"""Expectation Suite endpoints for the Feature Group resource. :param feature_store_id: id of the respective Feature Store :type feature_store_id: int :param feature_group_id: id of the respective Feat... | stack_v2_sparse_classes_10k_train_000123 | 6,356 | permissive | [
{
"docstring": "Expectation Suite endpoints for the Feature Group resource. :param feature_store_id: id of the respective Feature Store :type feature_store_id: int :param feature_group_id: id of the respective Feature Group :type feature_group_id: int",
"name": "__init__",
"signature": "def __init__(sel... | 6 | stack_v2_sparse_classes_30k_train_000098 | Implement the Python class `ExpectationSuiteApi` described below.
Class description:
Implement the ExpectationSuiteApi class.
Method signatures and docstrings:
- def __init__(self, feature_store_id: int, feature_group_id: int): Expectation Suite endpoints for the Feature Group resource. :param feature_store_id: id of... | Implement the Python class `ExpectationSuiteApi` described below.
Class description:
Implement the ExpectationSuiteApi class.
Method signatures and docstrings:
- def __init__(self, feature_store_id: int, feature_group_id: int): Expectation Suite endpoints for the Feature Group resource. :param feature_store_id: id of... | 3e67b26271e43b1ce38bd1e872bfb4c9212bb372 | <|skeleton|>
class ExpectationSuiteApi:
def __init__(self, feature_store_id: int, feature_group_id: int):
"""Expectation Suite endpoints for the Feature Group resource. :param feature_store_id: id of the respective Feature Store :type feature_store_id: int :param feature_group_id: id of the respective Feat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExpectationSuiteApi:
def __init__(self, feature_store_id: int, feature_group_id: int):
"""Expectation Suite endpoints for the Feature Group resource. :param feature_store_id: id of the respective Feature Store :type feature_store_id: int :param feature_group_id: id of the respective Feature Group :typ... | the_stack_v2_python_sparse | python/hsfs/core/expectation_suite_api.py | logicalclocks/feature-store-api | train | 59 | |
a7bd2a80bcf6a27c11ef916604536f12ff6d21f2 | [
"content = parent._content\nif content is not None:\n content = build_graves_on_subsection(content, path)\n if content is None:\n DocWarning(path, 'Listing element with empty content.')\nhead = parent._head\nif head is None:\n DocWarning(path, 'Listing element without empty head.')\nelse:\n head,... | <|body_start_0|>
content = parent._content
if content is not None:
content = build_graves_on_subsection(content, path)
if content is None:
DocWarning(path, 'Listing element with empty content.')
head = parent._head
if head is None:
DocW... | Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element. | GravedListingElement | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GravedListingElement:
"""Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element."""
def __new__(cls, parent, path):
... | stack_v2_sparse_classes_10k_train_000124 | 25,556 | permissive | [
{
"docstring": "Creates a new graved listing element. Parameters ---------- parent : ``TextListingElement`` The source listing element. path : ``QualPath`` The path of the respective docstring. Returns ------- self : `None`, ``GravedListingElement`` Returns `None`, if would have been creating an empty listing e... | 2 | null | Implement the Python class `GravedListingElement` described below.
Class description:
Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element.
Method ... | Implement the Python class `GravedListingElement` described below.
Class description:
Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element.
Method ... | 53f24fdb38459dc5a4fd04f11bdbfee8295b76a4 | <|skeleton|>
class GravedListingElement:
"""Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element."""
def __new__(cls, parent, path):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GravedListingElement:
"""Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element."""
def __new__(cls, parent, path):
"""Creates a... | the_stack_v2_python_sparse | hata/ext/patchouli/graver.py | HuyaneMatsu/hata | train | 3 |
4ec3bdefca9fade32c04f03f46bf6f440889b099 | [
"posthog.api_key = 'phc_C44vUK9R1J6HYVdfJarTEPqVAoRPJzMXzFcj8PIrJgP'\nposthog.host = 'https://eu.posthog.com'\nfor module_name in ['posthog', 'backoff']:\n logging.getLogger(module_name).setLevel(logging.CRITICAL)\n logging.getLogger(module_name).addHandler(logging.NullHandler())\n logging.getLogger(module... | <|body_start_0|>
posthog.api_key = 'phc_C44vUK9R1J6HYVdfJarTEPqVAoRPJzMXzFcj8PIrJgP'
posthog.host = 'https://eu.posthog.com'
for module_name in ['posthog', 'backoff']:
logging.getLogger(module_name).setLevel(logging.CRITICAL)
logging.getLogger(module_name).addHandler(logg... | Haystack reports anonymous usage statistics to support continuous software improvements for all its users. You can opt-out of sharing usage statistics by manually setting the environment variable `HAYSTACK_TELEMETRY_ENABLED` as described for different operating systems on the [documentation page](https://docs.haystack.... | Telemetry | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Telemetry:
"""Haystack reports anonymous usage statistics to support continuous software improvements for all its users. You can opt-out of sharing usage statistics by manually setting the environment variable `HAYSTACK_TELEMETRY_ENABLED` as described for different operating systems on the [docum... | stack_v2_sparse_classes_10k_train_000125 | 10,370 | permissive | [
{
"docstring": "Initializes the telemetry. Loads the user_id from the config file, or creates a new id and saves it if the file is not found. It also collects system information which cannot change across the lifecycle of the process (for example `is_containerized()`).",
"name": "__init__",
"signature":... | 2 | null | Implement the Python class `Telemetry` described below.
Class description:
Haystack reports anonymous usage statistics to support continuous software improvements for all its users. You can opt-out of sharing usage statistics by manually setting the environment variable `HAYSTACK_TELEMETRY_ENABLED` as described for di... | Implement the Python class `Telemetry` described below.
Class description:
Haystack reports anonymous usage statistics to support continuous software improvements for all its users. You can opt-out of sharing usage statistics by manually setting the environment variable `HAYSTACK_TELEMETRY_ENABLED` as described for di... | 5f1256ac7e5734c2ea481e72cb7e02c34baf8c43 | <|skeleton|>
class Telemetry:
"""Haystack reports anonymous usage statistics to support continuous software improvements for all its users. You can opt-out of sharing usage statistics by manually setting the environment variable `HAYSTACK_TELEMETRY_ENABLED` as described for different operating systems on the [docum... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Telemetry:
"""Haystack reports anonymous usage statistics to support continuous software improvements for all its users. You can opt-out of sharing usage statistics by manually setting the environment variable `HAYSTACK_TELEMETRY_ENABLED` as described for different operating systems on the [documentation page... | the_stack_v2_python_sparse | haystack/telemetry.py | deepset-ai/haystack | train | 10,599 |
afa48f657301cd38645afd5117b97144c08b0e04 | [
"if issubclass(struct_class, Message):\n message_class = struct_class\n struct_class = struct_class.get_struct_class()\nelse:\n message_class = None\nself._buf = BufferReader(buf)\nvtype, tag = self._buf.read_head()\nassert tag == 0\nif not self._buf.is_eof():\n remain = self._buf.get_buffer(begin=self.... | <|body_start_0|>
if issubclass(struct_class, Message):
message_class = struct_class
struct_class = struct_class.get_struct_class()
else:
message_class = None
self._buf = BufferReader(buf)
vtype, tag = self._buf.read_head()
assert tag == 0
... | WNS序列化器 | WNSSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WNSSerializer:
"""WNS序列化器"""
def wns_loads(self, struct_class, buf):
"""反序列化"""
<|body_0|>
def wns_dumps(self, struct_class, obj):
"""序列化"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if issubclass(struct_class, Message):
message_c... | stack_v2_sparse_classes_10k_train_000126 | 32,277 | no_license | [
{
"docstring": "反序列化",
"name": "wns_loads",
"signature": "def wns_loads(self, struct_class, buf)"
},
{
"docstring": "序列化",
"name": "wns_dumps",
"signature": "def wns_dumps(self, struct_class, obj)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005760 | Implement the Python class `WNSSerializer` described below.
Class description:
WNS序列化器
Method signatures and docstrings:
- def wns_loads(self, struct_class, buf): 反序列化
- def wns_dumps(self, struct_class, obj): 序列化 | Implement the Python class `WNSSerializer` described below.
Class description:
WNS序列化器
Method signatures and docstrings:
- def wns_loads(self, struct_class, buf): 反序列化
- def wns_dumps(self, struct_class, obj): 序列化
<|skeleton|>
class WNSSerializer:
"""WNS序列化器"""
def wns_loads(self, struct_class, buf):
... | b6aec96f9f9e6e0975d4254776d0b39849112c64 | <|skeleton|>
class WNSSerializer:
"""WNS序列化器"""
def wns_loads(self, struct_class, buf):
"""反序列化"""
<|body_0|>
def wns_dumps(self, struct_class, obj):
"""序列化"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WNSSerializer:
"""WNS序列化器"""
def wns_loads(self, struct_class, buf):
"""反序列化"""
if issubclass(struct_class, Message):
message_class = struct_class
struct_class = struct_class.get_struct_class()
else:
message_class = None
self._buf = Buff... | the_stack_v2_python_sparse | qt4s/message/serializers/jce.py | PurpleMStone/QT4S | train | 0 |
2b022e9fa78a09ed512d34e2c746da312f8ada57 | [
"args = self._build_potential_args({'room_id': room_id, 'topic': topic, 'format': 'json'})\nurl = self._generate_escaped_url(API_TOPIC_PATH, args)\nres = (yield self._fetch_wrapper(url, post=''))\nraise gen.Return(res)",
"self.log.info('Setting room \"%s\" topic to: %s' % (self.option('room'), self.option('topic'... | <|body_start_0|>
args = self._build_potential_args({'room_id': room_id, 'topic': topic, 'format': 'json'})
url = self._generate_escaped_url(API_TOPIC_PATH, args)
res = (yield self._fetch_wrapper(url, post=''))
raise gen.Return(res)
<|end_body_0|>
<|body_start_1|>
self.log.info('... | Sets a HipChat room topic. **Options** - ``room`` - The string-name (or ID) of the room to set the topic of - ``topic`` - String of the topic to send **Examples** .. code-block:: json { "actor": "hipchat.Topic", "desc": "set the room topic", "options": { "room": "Operations", "topic": "Latest Deployment: v1.2" } } **Dr... | Topic | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Topic:
"""Sets a HipChat room topic. **Options** - ``room`` - The string-name (or ID) of the room to set the topic of - ``topic`` - String of the topic to send **Examples** .. code-block:: json { "actor": "hipchat.Topic", "desc": "set the room topic", "options": { "room": "Operations", "topic": "... | stack_v2_sparse_classes_10k_train_000127 | 10,230 | permissive | [
{
"docstring": "Posts a message to Hipchat. https://www.hipchat.com/docs/api/method/rooms/topic Args: room_id: (Str/Int) Name or ID of the room to post to. topic: (Str) Required. The topic string, 250 char max Raises: gen.Return(<Dictionary of the response from Hipchat>)",
"name": "_set_topic",
"signatu... | 2 | stack_v2_sparse_classes_30k_test_000047 | Implement the Python class `Topic` described below.
Class description:
Sets a HipChat room topic. **Options** - ``room`` - The string-name (or ID) of the room to set the topic of - ``topic`` - String of the topic to send **Examples** .. code-block:: json { "actor": "hipchat.Topic", "desc": "set the room topic", "optio... | Implement the Python class `Topic` described below.
Class description:
Sets a HipChat room topic. **Options** - ``room`` - The string-name (or ID) of the room to set the topic of - ``topic`` - String of the topic to send **Examples** .. code-block:: json { "actor": "hipchat.Topic", "desc": "set the room topic", "optio... | d0abaf93ff321f12c0504c99eacb89f9288e892b | <|skeleton|>
class Topic:
"""Sets a HipChat room topic. **Options** - ``room`` - The string-name (or ID) of the room to set the topic of - ``topic`` - String of the topic to send **Examples** .. code-block:: json { "actor": "hipchat.Topic", "desc": "set the room topic", "options": { "room": "Operations", "topic": "... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Topic:
"""Sets a HipChat room topic. **Options** - ``room`` - The string-name (or ID) of the room to set the topic of - ``topic`` - String of the topic to send **Examples** .. code-block:: json { "actor": "hipchat.Topic", "desc": "set the room topic", "options": { "room": "Operations", "topic": "Latest Deploy... | the_stack_v2_python_sparse | kingpin/actors/hipchat.py | Nextdoor/kingpin | train | 29 |
ca0ac5df2395bd27181475bf718f2ab609a0e096 | [
"super().__init__('human_model_generation_client')\nself.bridge_cv = CvBridge()\nself.bridge_ros = ROS2Bridge()\nself.cli = self.create_client(ImgToMesh, service_name)\nwhile not self.cli.wait_for_service(timeout_sec=1.0):\n self.get_logger().info('service not available, waiting again...')\nself.req = ImgToMesh.... | <|body_start_0|>
super().__init__('human_model_generation_client')
self.bridge_cv = CvBridge()
self.bridge_ros = ROS2Bridge()
self.cli = self.create_client(ImgToMesh, service_name)
while not self.cli.wait_for_service(timeout_sec=1.0):
self.get_logger().info('service n... | HumanModelGenerationClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HumanModelGenerationClient:
def __init__(self, service_name='human_model_generation'):
"""Creates a ROS Client for human model generation :param service_name: The name of the service :type service_name: str"""
<|body_0|>
def send_request(self, img_rgb, img_msk, extract_pose)... | stack_v2_sparse_classes_10k_train_000128 | 5,361 | permissive | [
{
"docstring": "Creates a ROS Client for human model generation :param service_name: The name of the service :type service_name: str",
"name": "__init__",
"signature": "def __init__(self, service_name='human_model_generation')"
},
{
"docstring": "Send request to service assigned with the task to... | 2 | stack_v2_sparse_classes_30k_train_000880 | Implement the Python class `HumanModelGenerationClient` described below.
Class description:
Implement the HumanModelGenerationClient class.
Method signatures and docstrings:
- def __init__(self, service_name='human_model_generation'): Creates a ROS Client for human model generation :param service_name: The name of th... | Implement the Python class `HumanModelGenerationClient` described below.
Class description:
Implement the HumanModelGenerationClient class.
Method signatures and docstrings:
- def __init__(self, service_name='human_model_generation'): Creates a ROS Client for human model generation :param service_name: The name of th... | b3d6ce670cdf63469fc5766630eb295d67b3d788 | <|skeleton|>
class HumanModelGenerationClient:
def __init__(self, service_name='human_model_generation'):
"""Creates a ROS Client for human model generation :param service_name: The name of the service :type service_name: str"""
<|body_0|>
def send_request(self, img_rgb, img_msk, extract_pose)... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HumanModelGenerationClient:
def __init__(self, service_name='human_model_generation'):
"""Creates a ROS Client for human model generation :param service_name: The name of the service :type service_name: str"""
super().__init__('human_model_generation_client')
self.bridge_cv = CvBridge(... | the_stack_v2_python_sparse | projects/opendr_ws_2/src/opendr_simulation/opendr_simulation/human_model_generation_client.py | opendr-eu/opendr | train | 535 | |
97121c708408294e0bb9804efec9e695d6907591 | [
"location = self._parse_location(response)\nmeeting_map = {}\nfor item in response.css('.layoutArea li'):\n start = self._parse_start(item)\n if not start:\n continue\n meeting = Meeting(title='State Street Commission', description='', classification=COMMISSION, start=start, end=None, time_notes='',... | <|body_start_0|>
location = self._parse_location(response)
meeting_map = {}
for item in response.css('.layoutArea li'):
start = self._parse_start(item)
if not start:
continue
meeting = Meeting(title='State Street Commission', description='', cl... | ChiSsa1Spider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChiSsa1Spider:
def parse(self, response):
"""`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
<|body_0|>
def _parse_start(self, item):
"""Parse start date and time."""
<|body_1|... | stack_v2_sparse_classes_10k_train_000129 | 2,987 | permissive | [
{
"docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "Parse start date and time.",
"name": "_parse_start",
"signature":... | 4 | stack_v2_sparse_classes_30k_train_003411 | Implement the Python class `ChiSsa1Spider` described below.
Class description:
Implement the ChiSsa1Spider class.
Method signatures and docstrings:
- def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.
- def _parse_... | Implement the Python class `ChiSsa1Spider` described below.
Class description:
Implement the ChiSsa1Spider class.
Method signatures and docstrings:
- def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.
- def _parse_... | 611fce6a2705446e25a2fc33e32090a571eb35d1 | <|skeleton|>
class ChiSsa1Spider:
def parse(self, response):
"""`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
<|body_0|>
def _parse_start(self, item):
"""Parse start date and time."""
<|body_1|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChiSsa1Spider:
def parse(self, response):
"""`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
location = self._parse_location(response)
meeting_map = {}
for item in response.css('.layoutArea li'):... | the_stack_v2_python_sparse | city_scrapers/spiders/chi_ssa_1.py | City-Bureau/city-scrapers | train | 308 | |
40756d7cee79e84ad3a929ec359951f2543e759e | [
"result = self.init_parameter()\nquestion_id = self.get_argument('question_id')\nres = self.question_model.get(question_id).get('_source')\nresult['data'] = res\nreturn result",
"question = self.get_argument('question')\nsimilar_question = self.get_argument('similar_question', '')\nanswer_id = self.get_argument('... | <|body_start_0|>
result = self.init_parameter()
question_id = self.get_argument('question_id')
res = self.question_model.get(question_id).get('_source')
result['data'] = res
return result
<|end_body_0|>
<|body_start_1|>
question = self.get_argument('question')
si... | QuestionInfoDetailHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionInfoDetailHandler:
def get(self, *args, **kwargs):
"""获取问题详细信息 :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, *args, **kwargs):
"""新建问题信息 :param args: :param kwargs: :return:"""
<|body_1|>
def put(self, *args, **kwargs):
... | stack_v2_sparse_classes_10k_train_000130 | 2,671 | no_license | [
{
"docstring": "获取问题详细信息 :param args: :param kwargs: :return:",
"name": "get",
"signature": "def get(self, *args, **kwargs)"
},
{
"docstring": "新建问题信息 :param args: :param kwargs: :return:",
"name": "post",
"signature": "def post(self, *args, **kwargs)"
},
{
"docstring": "修改问题信息 :... | 3 | stack_v2_sparse_classes_30k_train_001587 | Implement the Python class `QuestionInfoDetailHandler` described below.
Class description:
Implement the QuestionInfoDetailHandler class.
Method signatures and docstrings:
- def get(self, *args, **kwargs): 获取问题详细信息 :param args: :param kwargs: :return:
- def post(self, *args, **kwargs): 新建问题信息 :param args: :param kwar... | Implement the Python class `QuestionInfoDetailHandler` described below.
Class description:
Implement the QuestionInfoDetailHandler class.
Method signatures and docstrings:
- def get(self, *args, **kwargs): 获取问题详细信息 :param args: :param kwargs: :return:
- def post(self, *args, **kwargs): 新建问题信息 :param args: :param kwar... | 9781b183cf168832b3c962d420e7f0a63287c4db | <|skeleton|>
class QuestionInfoDetailHandler:
def get(self, *args, **kwargs):
"""获取问题详细信息 :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, *args, **kwargs):
"""新建问题信息 :param args: :param kwargs: :return:"""
<|body_1|>
def put(self, *args, **kwargs):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QuestionInfoDetailHandler:
def get(self, *args, **kwargs):
"""获取问题详细信息 :param args: :param kwargs: :return:"""
result = self.init_parameter()
question_id = self.get_argument('question_id')
res = self.question_model.get(question_id).get('_source')
result['data'] = res
... | the_stack_v2_python_sparse | chat_bot/handlers/bot_manage/question_info.py | jiaojianglong/MyBot | train | 0 | |
cb923c7e56935ff9210d5a1a82cb5141cc5e1e26 | [
"super(focal_loss, self).__init__()\nself.size_average = size_average\nif isinstance(alpha, list):\n assert len(alpha) == num_classes\n self.alpha = torch.Tensor(alpha)\nelse:\n assert alpha < 1\n self.alpha = torch.zeros(num_classes)\n self.alpha[0] += alpha\n self.alpha[1:] += 1 - alpha\nself.ga... | <|body_start_0|>
super(focal_loss, self).__init__()
self.size_average = size_average
if isinstance(alpha, list):
assert len(alpha) == num_classes
self.alpha = torch.Tensor(alpha)
else:
assert alpha < 1
self.alpha = torch.zeros(num_classes)
... | focal_loss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class focal_loss:
def __init__(self, alpha=0.25, gamma=2, num_classes=2, size_average=False):
"""focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易... | stack_v2_sparse_classes_10k_train_000131 | 5,854 | no_license | [
{
"docstring": "focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本调节参数. retainnet中设置为2 :param num_classes: 类别数量 :param size_average: 损失计算方式,默认取均值",
"name": "__... | 2 | null | Implement the Python class `focal_loss` described below.
Class description:
Implement the focal_loss class.
Method signatures and docstrings:
- def __init__(self, alpha=0.25, gamma=2, num_classes=2, size_average=False): focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列... | Implement the Python class `focal_loss` described below.
Class description:
Implement the focal_loss class.
Method signatures and docstrings:
- def __init__(self, alpha=0.25, gamma=2, num_classes=2, size_average=False): focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列... | 1272fed2dc8fef78a9ded0f1ae1644d613a3b57b | <|skeleton|>
class focal_loss:
def __init__(self, alpha=0.25, gamma=2, num_classes=2, size_average=False):
"""focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class focal_loss:
def __init__(self, alpha=0.25, gamma=2, num_classes=2, size_average=False):
"""focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本调节参数. retain... | the_stack_v2_python_sparse | Text_Similarity/ERNIE_Coattention/utils.py | shawroad/NLP_pytorch_project | train | 530 | |
42ba469dc749b3fe8d7e0418e34e0f4cb1b38fe9 | [
"self.name = name\nself.unit_set = unit_set\nself.unit_name = units_of_quantities[self.name]\nunit_expr = sm.sympify(self.unit_name)\nunit_expr = unit_expr.subs(derived_units)\nself.symbolic_value = sm.sympify(str(unit_expr))\natoms = self.symbolic_value.atoms(sm.Symbol)\nself.def_units = [Unit(atom.name) for atom ... | <|body_start_0|>
self.name = name
self.unit_set = unit_set
self.unit_name = units_of_quantities[self.name]
unit_expr = sm.sympify(self.unit_name)
unit_expr = unit_expr.subs(derived_units)
self.symbolic_value = sm.sympify(str(unit_expr))
atoms = self.symbolic_value... | A physical quantity in a given set of basic units. Examples -------- Construct the stress quantity: >>> from sfepy.mechanics.units import Unit, Quantity >>> units = ['m', 's', 'kg', 'C'] >>> unit_set = [Unit(key) for key in units] >>> q1 = Quantity('stress', unit_set) >>> q1() '1.0 Pa' Show its unit using various prefi... | Quantity | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Quantity:
"""A physical quantity in a given set of basic units. Examples -------- Construct the stress quantity: >>> from sfepy.mechanics.units import Unit, Quantity >>> units = ['m', 's', 'kg', 'C'] >>> unit_set = [Unit(key) for key in units] >>> q1 = Quantity('stress', unit_set) >>> q1() '1.0 P... | stack_v2_sparse_classes_10k_train_000132 | 8,377 | permissive | [
{
"docstring": "Create a quantity in the given unit set. The name must be listed in the units_of_quantities dictionary.",
"name": "__init__",
"signature": "def __init__(self, name, unit_set)"
},
{
"docstring": "Get auxiliary dictionaries for a unit set.",
"name": "_get_dicts",
"signature... | 3 | stack_v2_sparse_classes_30k_train_003410 | Implement the Python class `Quantity` described below.
Class description:
A physical quantity in a given set of basic units. Examples -------- Construct the stress quantity: >>> from sfepy.mechanics.units import Unit, Quantity >>> units = ['m', 's', 'kg', 'C'] >>> unit_set = [Unit(key) for key in units] >>> q1 = Quant... | Implement the Python class `Quantity` described below.
Class description:
A physical quantity in a given set of basic units. Examples -------- Construct the stress quantity: >>> from sfepy.mechanics.units import Unit, Quantity >>> units = ['m', 's', 'kg', 'C'] >>> unit_set = [Unit(key) for key in units] >>> q1 = Quant... | 0c2d1690e764b601b2687be1e4261b82207ca366 | <|skeleton|>
class Quantity:
"""A physical quantity in a given set of basic units. Examples -------- Construct the stress quantity: >>> from sfepy.mechanics.units import Unit, Quantity >>> units = ['m', 's', 'kg', 'C'] >>> unit_set = [Unit(key) for key in units] >>> q1 = Quantity('stress', unit_set) >>> q1() '1.0 P... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Quantity:
"""A physical quantity in a given set of basic units. Examples -------- Construct the stress quantity: >>> from sfepy.mechanics.units import Unit, Quantity >>> units = ['m', 's', 'kg', 'C'] >>> unit_set = [Unit(key) for key in units] >>> q1 = Quantity('stress', unit_set) >>> q1() '1.0 Pa' Show its u... | the_stack_v2_python_sparse | sfepy/mechanics/units.py | sfepy/sfepy | train | 651 |
bebd68cb51dcce31b359ff68edacb5bedfd905b0 | [
"text = 'Alignment tensors.\\n\\n'\ntext = text + '%-8s%-20s\\n' % ('Index', 'Name')\nfor i in range(len(self)):\n text = text + '%-8i%-20s\\n' % (i, self[i].name)\ntext = text + \"\\nThese can be accessed by typing 'pipe.align_tensor[index]'.\\n\"\nreturn text",
"obj = AlignTensorData(name)\nself.append(obj)\... | <|body_start_0|>
text = 'Alignment tensors.\n\n'
text = text + '%-8s%-20s\n' % ('Index', 'Name')
for i in range(len(self)):
text = text + '%-8i%-20s\n' % (i, self[i].name)
text = text + "\nThese can be accessed by typing 'pipe.align_tensor[index]'.\n"
return text
<|en... | List type data container for holding all the alignment tensors. The elements of the list should be AlignTensorData instances. | AlignTensorList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlignTensorList:
"""List type data container for holding all the alignment tensors. The elements of the list should be AlignTensorData instances."""
def __repr__(self):
"""Replacement function for displaying an instance of this class."""
<|body_0|>
def add_item(self, nam... | stack_v2_sparse_classes_10k_train_000133 | 47,193 | no_license | [
{
"docstring": "Replacement function for displaying an instance of this class.",
"name": "__repr__",
"signature": "def __repr__(self)"
},
{
"docstring": "Append a new AlignTensorData instance to the list. @param name: The tensor ID string. @type name: str @return: The tensor object. @rtype: Alig... | 5 | null | Implement the Python class `AlignTensorList` described below.
Class description:
List type data container for holding all the alignment tensors. The elements of the list should be AlignTensorData instances.
Method signatures and docstrings:
- def __repr__(self): Replacement function for displaying an instance of this... | Implement the Python class `AlignTensorList` described below.
Class description:
List type data container for holding all the alignment tensors. The elements of the list should be AlignTensorData instances.
Method signatures and docstrings:
- def __repr__(self): Replacement function for displaying an instance of this... | c317326ddeacd1a1c608128769676899daeae531 | <|skeleton|>
class AlignTensorList:
"""List type data container for holding all the alignment tensors. The elements of the list should be AlignTensorData instances."""
def __repr__(self):
"""Replacement function for displaying an instance of this class."""
<|body_0|>
def add_item(self, nam... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AlignTensorList:
"""List type data container for holding all the alignment tensors. The elements of the list should be AlignTensorData instances."""
def __repr__(self):
"""Replacement function for displaying an instance of this class."""
text = 'Alignment tensors.\n\n'
text = text... | the_stack_v2_python_sparse | data_store/align_tensor.py | jlec/relax | train | 4 |
e2fd2c3475a04b9b74c8cdedccbade8187518e58 | [
"headers = {'Authorization': 'Bearer %s' % access_token}\ntry:\n resp = requests.get(ASANA_USER_DETAILS_URL, headers=headers)\n resp.raise_for_status()\n return resp.json()['data']\nexcept ValueError:\n return None",
"self.process_error(self.data)\nparams = self.auth_complete_params(self.validate_stat... | <|body_start_0|>
headers = {'Authorization': 'Bearer %s' % access_token}
try:
resp = requests.get(ASANA_USER_DETAILS_URL, headers=headers)
resp.raise_for_status()
return resp.json()['data']
except ValueError:
return None
<|end_body_0|>
<|body_star... | Asana OAuth authentication mechanism | AsanaAuth | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsanaAuth:
"""Asana OAuth authentication mechanism"""
def user_data(self, access_token, *args, **kwargs):
"""Loads user data from service"""
<|body_0|>
def auth_complete(self, *args, **kwargs):
"""Completes loging process, must return user instance"""
<|b... | stack_v2_sparse_classes_10k_train_000134 | 2,537 | permissive | [
{
"docstring": "Loads user data from service",
"name": "user_data",
"signature": "def user_data(self, access_token, *args, **kwargs)"
},
{
"docstring": "Completes loging process, must return user instance",
"name": "auth_complete",
"signature": "def auth_complete(self, *args, **kwargs)"
... | 2 | stack_v2_sparse_classes_30k_train_001205 | Implement the Python class `AsanaAuth` described below.
Class description:
Asana OAuth authentication mechanism
Method signatures and docstrings:
- def user_data(self, access_token, *args, **kwargs): Loads user data from service
- def auth_complete(self, *args, **kwargs): Completes loging process, must return user in... | Implement the Python class `AsanaAuth` described below.
Class description:
Asana OAuth authentication mechanism
Method signatures and docstrings:
- def user_data(self, access_token, *args, **kwargs): Loads user data from service
- def auth_complete(self, *args, **kwargs): Completes loging process, must return user in... | 36a02ed244c7b59ee1f2523e64e4749e404ab0f7 | <|skeleton|>
class AsanaAuth:
"""Asana OAuth authentication mechanism"""
def user_data(self, access_token, *args, **kwargs):
"""Loads user data from service"""
<|body_0|>
def auth_complete(self, *args, **kwargs):
"""Completes loging process, must return user instance"""
<|b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AsanaAuth:
"""Asana OAuth authentication mechanism"""
def user_data(self, access_token, *args, **kwargs):
"""Loads user data from service"""
headers = {'Authorization': 'Bearer %s' % access_token}
try:
resp = requests.get(ASANA_USER_DETAILS_URL, headers=headers)
... | the_stack_v2_python_sparse | src/social_auth/backends/asana.py | commonlims/commonlims | train | 4 |
c0d7c21eb777410d5e637c5dcd92fbadaa639f05 | [
"self.nthreads = 1\nself.serial = False\nself.timeout = -1\nself.all = False\nself.logfile = None\nself.sagenb = False\nself.long = False\nself.warn_long = None\nself.optional = set(['sage'])\nself.randorder = None\nself.global_iterations = 1\nself.file_iterations = 1\nself.initial = False\nself.force_lib = False\n... | <|body_start_0|>
self.nthreads = 1
self.serial = False
self.timeout = -1
self.all = False
self.logfile = None
self.sagenb = False
self.long = False
self.warn_long = None
self.optional = set(['sage'])
self.randorder = None
self.globa... | This class is used for doctesting the Sage doctest module. It fills in attributes to be the same as the defaults defined in ``SAGE_LOCAL/bin/sage-runtests``, expect for a few places, which is mostly to make doctesting more predictable. EXAMPLES:: sage: from sage.doctest.control import DocTestDefaults sage: D = DocTestD... | DocTestDefaults | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DocTestDefaults:
"""This class is used for doctesting the Sage doctest module. It fills in attributes to be the same as the defaults defined in ``SAGE_LOCAL/bin/sage-runtests``, expect for a few places, which is mostly to make doctesting more predictable. EXAMPLES:: sage: from sage.doctest.contro... | stack_v2_sparse_classes_10k_train_000135 | 46,253 | no_license | [
{
"docstring": "Edit these parameters after creating an instance. EXAMPLES:: sage: from sage.doctest.control import DocTestDefaults sage: D = DocTestDefaults(); D.optional {'sage'}",
"name": "__init__",
"signature": "def __init__(self, **kwds)"
},
{
"docstring": "Return the print representation.... | 3 | null | Implement the Python class `DocTestDefaults` described below.
Class description:
This class is used for doctesting the Sage doctest module. It fills in attributes to be the same as the defaults defined in ``SAGE_LOCAL/bin/sage-runtests``, expect for a few places, which is mostly to make doctesting more predictable. EX... | Implement the Python class `DocTestDefaults` described below.
Class description:
This class is used for doctesting the Sage doctest module. It fills in attributes to be the same as the defaults defined in ``SAGE_LOCAL/bin/sage-runtests``, expect for a few places, which is mostly to make doctesting more predictable. EX... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class DocTestDefaults:
"""This class is used for doctesting the Sage doctest module. It fills in attributes to be the same as the defaults defined in ``SAGE_LOCAL/bin/sage-runtests``, expect for a few places, which is mostly to make doctesting more predictable. EXAMPLES:: sage: from sage.doctest.contro... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DocTestDefaults:
"""This class is used for doctesting the Sage doctest module. It fills in attributes to be the same as the defaults defined in ``SAGE_LOCAL/bin/sage-runtests``, expect for a few places, which is mostly to make doctesting more predictable. EXAMPLES:: sage: from sage.doctest.control import DocT... | the_stack_v2_python_sparse | sage/src/sage/doctest/control.py | bopopescu/geosci | train | 0 |
8bf71c8b933406fbd71b0667c2a22f60091e7b49 | [
"if self.action in ['create']:\n permission_classes = [PortToPlaylistExists]\nelif self.action in ['destroy']:\n permission_classes = [UserIsAuthenticated & IsPortabilityRequestOwner]\nelif self.action in ['retrieve']:\n permission_classes = [UserIsAuthenticated & (IsPortabilityRequestOwner | IsPlaylistOwn... | <|body_start_0|>
if self.action in ['create']:
permission_classes = [PortToPlaylistExists]
elif self.action in ['destroy']:
permission_classes = [UserIsAuthenticated & IsPortabilityRequestOwner]
elif self.action in ['retrieve']:
permission_classes = [UserIsAut... | Viewset for the API of the portability request object. | PortabilityResourceViewSet | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PortabilityResourceViewSet:
"""Viewset for the API of the portability request object."""
def get_permissions(self):
"""Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI."""
<|body_0|>
d... | stack_v2_sparse_classes_10k_train_000136 | 6,199 | permissive | [
{
"docstring": "Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI.",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Return the queryset according to the action.",
"na... | 5 | null | Implement the Python class `PortabilityResourceViewSet` described below.
Class description:
Viewset for the API of the portability request object.
Method signatures and docstrings:
- def get_permissions(self): Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create`... | Implement the Python class `PortabilityResourceViewSet` described below.
Class description:
Viewset for the API of the portability request object.
Method signatures and docstrings:
- def get_permissions(self): Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create`... | f767f1bdc12c9712f26ea17cb8b19f536389f0ed | <|skeleton|>
class PortabilityResourceViewSet:
"""Viewset for the API of the portability request object."""
def get_permissions(self):
"""Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI."""
<|body_0|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PortabilityResourceViewSet:
"""Viewset for the API of the portability request object."""
def get_permissions(self):
"""Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI."""
if self.action in ['create']:
... | the_stack_v2_python_sparse | src/backend/marsha/core/api/portability_request.py | openfun/marsha | train | 92 |
6f137be05acf7b2d58e24805acf1ad00abfe6b62 | [
"super().__init__(entry, controller, poolObject, **kwargs)\nself._bodies = set(poolObject[BODY_ATTR].split(' '))\nself._attr_icon = 'mdi:fire-circle'",
"for bodyObjnam in self._bodies:\n body = self._controller.model[bodyObjnam]\n if body[STATUS_ATTR] == 'ON' and body[HEATER_ATTR] == self._poolObject.objnam... | <|body_start_0|>
super().__init__(entry, controller, poolObject, **kwargs)
self._bodies = set(poolObject[BODY_ATTR].split(' '))
self._attr_icon = 'mdi:fire-circle'
<|end_body_0|>
<|body_start_1|>
for bodyObjnam in self._bodies:
body = self._controller.model[bodyObjnam]
... | Representation of a Heater binary sensor. | HeaterBinarySensor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HeaterBinarySensor:
"""Representation of a Heater binary sensor."""
def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs):
"""Initialize."""
<|body_0|>
def is_on(self) -> bool:
"""Return true if sensor is on."""
... | stack_v2_sparse_classes_10k_train_000137 | 4,015 | no_license | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs)"
},
{
"docstring": "Return true if sensor is on.",
"name": "is_on",
"signature": "def is_on(self) -> bool"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_000450 | Implement the Python class `HeaterBinarySensor` described below.
Class description:
Representation of a Heater binary sensor.
Method signatures and docstrings:
- def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs): Initialize.
- def is_on(self) -> bool: Return true if... | Implement the Python class `HeaterBinarySensor` described below.
Class description:
Representation of a Heater binary sensor.
Method signatures and docstrings:
- def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs): Initialize.
- def is_on(self) -> bool: Return true if... | 625290c164c60611f501ee773583c06a85281300 | <|skeleton|>
class HeaterBinarySensor:
"""Representation of a Heater binary sensor."""
def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs):
"""Initialize."""
<|body_0|>
def is_on(self) -> bool:
"""Return true if sensor is on."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HeaterBinarySensor:
"""Representation of a Heater binary sensor."""
def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs):
"""Initialize."""
super().__init__(entry, controller, poolObject, **kwargs)
self._bodies = set(poolObject[BODY... | the_stack_v2_python_sparse | custom_components/intellicenter/binary_sensor.py | ntalekt/homeassistant | train | 213 |
deb00aa717b4af6b81377ac107324c7aa37e06aa | [
"super().setUp()\ncurrent_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS'] = ['foobar.com']\ncurrent_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS_THRESHOLD'] = 10\ncurrent_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS_SCORE_THRESHOLD'] = 0.75\ncurrent_app.config['DOMAIN_ANALYZER_WHITELISTED_DOMAINS'] = ['ytimg.com', 'gst... | <|body_start_0|>
super().setUp()
current_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS'] = ['foobar.com']
current_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS_THRESHOLD'] = 10
current_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS_SCORE_THRESHOLD'] = 0.75
current_app.config['DOMAIN_ANA... | Tests the functionality of the analyzer. | TestDomainsPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDomainsPlugin:
"""Tests the functionality of the analyzer."""
def setUp(self):
"""Set up the tests."""
<|body_0|>
def test_minhash(self):
"""Test minhash function."""
<|body_1|>
def test_get_similar_domains(self):
"""Test get_similar_doma... | stack_v2_sparse_classes_10k_train_000138 | 2,440 | permissive | [
{
"docstring": "Set up the tests.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test minhash function.",
"name": "test_minhash",
"signature": "def test_minhash(self)"
},
{
"docstring": "Test get_similar_domains function.",
"name": "test_get_similar_doma... | 3 | stack_v2_sparse_classes_30k_val_000344 | Implement the Python class `TestDomainsPlugin` described below.
Class description:
Tests the functionality of the analyzer.
Method signatures and docstrings:
- def setUp(self): Set up the tests.
- def test_minhash(self): Test minhash function.
- def test_get_similar_domains(self): Test get_similar_domains function. | Implement the Python class `TestDomainsPlugin` described below.
Class description:
Tests the functionality of the analyzer.
Method signatures and docstrings:
- def setUp(self): Set up the tests.
- def test_minhash(self): Test minhash function.
- def test_get_similar_domains(self): Test get_similar_domains function.
... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class TestDomainsPlugin:
"""Tests the functionality of the analyzer."""
def setUp(self):
"""Set up the tests."""
<|body_0|>
def test_minhash(self):
"""Test minhash function."""
<|body_1|>
def test_get_similar_domains(self):
"""Test get_similar_doma... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestDomainsPlugin:
"""Tests the functionality of the analyzer."""
def setUp(self):
"""Set up the tests."""
super().setUp()
current_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS'] = ['foobar.com']
current_app.config['DOMAIN_ANALYZER_WATCHED_DOMAINS_THRESHOLD'] = 10
cu... | the_stack_v2_python_sparse | timesketch/lib/analyzers/phishy_domains_test.py | google/timesketch | train | 2,263 |
dab49c5e1960e654f96f0f0c98076b1480cba305 | [
"if not s:\n return 0\nm = 1\nls = len(s)\nfor i in range(ls):\n j = i\n d = []\n while j < ls:\n if s[j] in d:\n break\n else:\n d.append(s[j])\n j += 1\n temp = j - i\n if temp > m:\n m = temp\nreturn m",
"l = 0\nstart = 0\nlength = len(s)\... | <|body_start_0|>
if not s:
return 0
m = 1
ls = len(s)
for i in range(ls):
j = i
d = []
while j < ls:
if s[j] in d:
break
else:
d.append(s[j])
j += 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not s:
return 0
m =... | stack_v2_sparse_classes_10k_train_000139 | 1,652 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring2",
"signature": "def lengthOfLongestSubstring2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000212 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | 2866df7587ee867a958a2b4fc02345bc3ef56999 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
if not s:
return 0
m = 1
ls = len(s)
for i in range(ls):
j = i
d = []
while j < ls:
if s[j] in d:
break
... | the_stack_v2_python_sparse | 中级算法/lengthOfLongestSubstring.py | OrangeJessie/Fighting_Leetcode | train | 1 | |
75f986562bc7adb0043500c82eb52498ed6c439a | [
"self.msg_id = error_info['msg_id']\nself.level = error_info['loglevel']\nself.msg = error_info['msg']\nself.suffix = error_info['suffix']",
"msg = self.msg % kwargs\nif storage_id:\n LOG.log(self.level, '%(storage_id)s MSGID%(msg_id)04d-%(msg_suffix)s: %(msg)s', {'storage_id': storage_id[-6:], 'msg_id': self.... | <|body_start_0|>
self.msg_id = error_info['msg_id']
self.level = error_info['loglevel']
self.msg = error_info['msg']
self.suffix = error_info['suffix']
<|end_body_0|>
<|body_start_1|>
msg = self.msg % kwargs
if storage_id:
LOG.log(self.level, '%(storage_id)s ... | messages for Hitachi HBSD Driver. | HBSDMsg | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HBSDMsg:
"""messages for Hitachi HBSD Driver."""
def __init__(self, error_info):
"""Initialize Enum attributes."""
<|body_0|>
def output_log(self, storage_id, **kwargs):
"""Output the message to the log file and return the message."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k_train_000140 | 29,040 | permissive | [
{
"docstring": "Initialize Enum attributes.",
"name": "__init__",
"signature": "def __init__(self, error_info)"
},
{
"docstring": "Output the message to the log file and return the message.",
"name": "output_log",
"signature": "def output_log(self, storage_id, **kwargs)"
}
] | 2 | null | Implement the Python class `HBSDMsg` described below.
Class description:
messages for Hitachi HBSD Driver.
Method signatures and docstrings:
- def __init__(self, error_info): Initialize Enum attributes.
- def output_log(self, storage_id, **kwargs): Output the message to the log file and return the message. | Implement the Python class `HBSDMsg` described below.
Class description:
messages for Hitachi HBSD Driver.
Method signatures and docstrings:
- def __init__(self, error_info): Initialize Enum attributes.
- def output_log(self, storage_id, **kwargs): Output the message to the log file and return the message.
<|skeleto... | 04a5d6b8c28271f6aefe2bbae6a1e16c1c235835 | <|skeleton|>
class HBSDMsg:
"""messages for Hitachi HBSD Driver."""
def __init__(self, error_info):
"""Initialize Enum attributes."""
<|body_0|>
def output_log(self, storage_id, **kwargs):
"""Output the message to the log file and return the message."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HBSDMsg:
"""messages for Hitachi HBSD Driver."""
def __init__(self, error_info):
"""Initialize Enum attributes."""
self.msg_id = error_info['msg_id']
self.level = error_info['loglevel']
self.msg = error_info['msg']
self.suffix = error_info['suffix']
def output... | the_stack_v2_python_sparse | cinder/volume/drivers/hitachi/hbsd_utils.py | LINBIT/openstack-cinder | train | 9 |
098e9c483b1d043e0920697eab1885c3b8f972eb | [
"self.logger = logging.getLogger(__name__)\nself.Name = name\nself.Drawing_type = drawing_type\nself.Text_presentation = {}\nself.Underlays = set()\nself.Shape_presentation = {}\nself.Closed_shape_fill = {}\nself.Corner_spec = {}\nself.logger.info(f'Loading assets for Presentation [{self.Name}]')\nself.load_text_pr... | <|body_start_0|>
self.logger = logging.getLogger(__name__)
self.Name = name
self.Drawing_type = drawing_type
self.Text_presentation = {}
self.Underlays = set()
self.Shape_presentation = {}
self.Closed_shape_fill = {}
self.Corner_spec = {}
self.logg... | A set of compatible visual styles including fonts, colors, border widths and so forth as appropriate to a given Drawing Type form a selectable Presentation. For example, an `Executable UML State Machine Diagram` might be drawn using certain fonts for state names and possibly different colors for transient and non-trans... | Presentation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Presentation:
"""A set of compatible visual styles including fonts, colors, border widths and so forth as appropriate to a given Drawing Type form a selectable Presentation. For example, an `Executable UML State Machine Diagram` might be drawn using certain fonts for state names and possibly diff... | stack_v2_sparse_classes_10k_train_000141 | 3,484 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, name: str, drawing_type: str)"
},
{
"docstring": "For each text Asset in this Presentation, load its Text Presentation",
"name": "load_text_presentations",
"signature": "def load_text_presentations(self)"
... | 3 | stack_v2_sparse_classes_30k_train_004811 | Implement the Python class `Presentation` described below.
Class description:
A set of compatible visual styles including fonts, colors, border widths and so forth as appropriate to a given Drawing Type form a selectable Presentation. For example, an `Executable UML State Machine Diagram` might be drawn using certain ... | Implement the Python class `Presentation` described below.
Class description:
A set of compatible visual styles including fonts, colors, border widths and so forth as appropriate to a given Drawing Type form a selectable Presentation. For example, an `Executable UML State Machine Diagram` might be drawn using certain ... | 088e27cded9eca2cacba2c6168c03caf4b43ef72 | <|skeleton|>
class Presentation:
"""A set of compatible visual styles including fonts, colors, border widths and so forth as appropriate to a given Drawing Type form a selectable Presentation. For example, an `Executable UML State Machine Diagram` might be drawn using certain fonts for state names and possibly diff... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Presentation:
"""A set of compatible visual styles including fonts, colors, border widths and so forth as appropriate to a given Drawing Type form a selectable Presentation. For example, an `Executable UML State Machine Diagram` might be drawn using certain fonts for state names and possibly different colors ... | the_stack_v2_python_sparse | flatland/drawing_domain/presentation.py | Laurelinex/flatland-model-diagram-editor | train | 0 |
1732d5b7c63ff0329a0cc5299b4f3ce9cbe490c3 | [
"def serialize(root):\n if not root:\n return\n nodes.append(root.val)\n serialize(root.left)\n serialize(root.right)\nnodes = []\nserialize(root)\nreturn ' '.join(map(str, nodes))",
"def deseralize(q, minVal, maxVal):\n if not q:\n return None\n if q[0] > maxVal or q[0] < minVal:\... | <|body_start_0|>
def serialize(root):
if not root:
return
nodes.append(root.val)
serialize(root.left)
serialize(root.right)
nodes = []
serialize(root)
return ' '.join(map(str, nodes))
<|end_body_0|>
<|body_start_1|>
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_000142 | 1,425 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | fa02b469344cf7c82510249fba9aa59ae0cb4cc0 | <|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_10k | 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 serialize(root):
if not root:
return
nodes.append(root.val)
serialize(root.left)
serialize(root.right)
nodes =... | the_stack_v2_python_sparse | SerializeandDeserializeBST.py | jiangshen95/UbuntuLeetCode | train | 0 | |
6f9cfaca5979ec78138348407f71106617c4e796 | [
"form = super().get_form(*args, **kwargs)\nform.fields['when'].widget.widgets[0].attrs = {'placeholder': f'Start Date and Time (YYYY-MM-DD HH:MM). Time zone is {settings.TIME_ZONE}.'}\nform.fields['when'].widget.widgets[1].attrs = {'placeholder': f'End Date and Time (YYYY-MM-DD HH:MM). Time zone is {settings.TIME_Z... | <|body_start_0|>
form = super().get_form(*args, **kwargs)
form.fields['when'].widget.widgets[0].attrs = {'placeholder': f'Start Date and Time (YYYY-MM-DD HH:MM). Time zone is {settings.TIME_ZONE}.'}
form.fields['when'].widget.widgets[1].attrs = {'placeholder': f'End Date and Time (YYYY-MM-DD HH:... | A mixin with the stuff shared between EventSession{Create|Update}View | EventSessionFormViewMixin | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventSessionFormViewMixin:
"""A mixin with the stuff shared between EventSession{Create|Update}View"""
def get_form(self, *args, **kwargs):
"""The default range widgets are a bit shit because they eat the help_text and have no indication of which field is for what. So we add a nice p... | stack_v2_sparse_classes_10k_train_000143 | 33,145 | permissive | [
{
"docstring": "The default range widgets are a bit shit because they eat the help_text and have no indication of which field is for what. So we add a nice placeholder. We also limit the event_location dropdown to only the current camps locations.",
"name": "get_form",
"signature": "def get_form(self, *... | 2 | null | Implement the Python class `EventSessionFormViewMixin` described below.
Class description:
A mixin with the stuff shared between EventSession{Create|Update}View
Method signatures and docstrings:
- def get_form(self, *args, **kwargs): The default range widgets are a bit shit because they eat the help_text and have no ... | Implement the Python class `EventSessionFormViewMixin` described below.
Class description:
A mixin with the stuff shared between EventSession{Create|Update}View
Method signatures and docstrings:
- def get_form(self, *args, **kwargs): The default range widgets are a bit shit because they eat the help_text and have no ... | 767deb7f58429e9162e0c2ef79be9f0f38f37ce1 | <|skeleton|>
class EventSessionFormViewMixin:
"""A mixin with the stuff shared between EventSession{Create|Update}View"""
def get_form(self, *args, **kwargs):
"""The default range widgets are a bit shit because they eat the help_text and have no indication of which field is for what. So we add a nice p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EventSessionFormViewMixin:
"""A mixin with the stuff shared between EventSession{Create|Update}View"""
def get_form(self, *args, **kwargs):
"""The default range widgets are a bit shit because they eat the help_text and have no indication of which field is for what. So we add a nice placeholder. W... | the_stack_v2_python_sparse | src/backoffice/views/program.py | bornhack/bornhack-website | train | 9 |
5c1d653df2380e03c42735136d5d98ac4410a5c3 | [
"if operation == 'update' and self.request.authenticated_role != self.context.author:\n self.request.errors.add('url', 'role', 'Can update document only author')\n self.request.errors.status = 403\n raise error_handler(self.request)\nif self.request.validated['tender_status'] not in ['active.qualification'... | <|body_start_0|>
if operation == 'update' and self.request.authenticated_role != self.context.author:
self.request.errors.add('url', 'role', 'Can update document only author')
self.request.errors.status = 403
raise error_handler(self.request)
if self.request.validated... | TenderUaAwardComplaintDocumentResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TenderUaAwardComplaintDocumentResource:
def validate_complaint_document(self, operation):
"""TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to... | stack_v2_sparse_classes_10k_train_000144 | 3,624 | permissive | [
{
"docstring": "TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to use different validators on methods according to procedure type.",
"name": "validate_complaint_d... | 4 | null | Implement the Python class `TenderUaAwardComplaintDocumentResource` described below.
Class description:
Implement the TenderUaAwardComplaintDocumentResource class.
Method signatures and docstrings:
- def validate_complaint_document(self, operation): TODO move validators This class is inherited in limited and openeu (... | Implement the Python class `TenderUaAwardComplaintDocumentResource` described below.
Class description:
Implement the TenderUaAwardComplaintDocumentResource class.
Method signatures and docstrings:
- def validate_complaint_document(self, operation): TODO move validators This class is inherited in limited and openeu (... | f901e1d8913cb10fee044dc267ef7c0f42c6a947 | <|skeleton|>
class TenderUaAwardComplaintDocumentResource:
def validate_complaint_document(self, operation):
"""TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TenderUaAwardComplaintDocumentResource:
def validate_complaint_document(self, operation):
"""TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to use different... | the_stack_v2_python_sparse | src/openprocurement/tender/openua/views/award_complaint_document.py | ProzorroUKR/openprocurement.api | train | 14 | |
72de027ad380186edcd59b98e76f4f1eb3effbe9 | [
"self.layers = layers\nself.features = features\nself.codebook = {}",
"if codeword in self.codebook:\n return self.codebook[codeword]\ncount = len(self.codebook)\nif count >= self.features:\n return hash(codeword) % self.features\nelse:\n self.codebook[codeword] = count\n return count",
"scaled_floa... | <|body_start_0|>
self.layers = layers
self.features = features
self.codebook = {}
<|end_body_0|>
<|body_start_1|>
if codeword in self.codebook:
return self.codebook[codeword]
count = len(self.codebook)
if count >= self.features:
return hash(codewo... | 砖瓦编码 | TileCoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TileCoder:
"""砖瓦编码"""
def __init__(self, layers, features):
"""layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征"""
<|body_0|>
def get_feature(self, codeword):
"""codeword 数据坐标(层数 坐标 坐标 动作)"""
<|body_1|>
def __call__(self, floats=(), ints=()):
"""将观测值向量... | stack_v2_sparse_classes_10k_train_000145 | 22,277 | no_license | [
{
"docstring": "layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征",
"name": "__init__",
"signature": "def __init__(self, layers, features)"
},
{
"docstring": "codeword 数据坐标(层数 坐标 坐标 动作)",
"name": "get_feature",
"signature": "def get_feature(self, codeword)"
},
{
"docstring": "将观测值向量转化为 坐标 f... | 3 | stack_v2_sparse_classes_30k_train_000232 | Implement the Python class `TileCoder` described below.
Class description:
砖瓦编码
Method signatures and docstrings:
- def __init__(self, layers, features): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征
- def get_feature(self, codeword): codeword 数据坐标(层数 坐标 坐标 动作)
- def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特... | Implement the Python class `TileCoder` described below.
Class description:
砖瓦编码
Method signatures and docstrings:
- def __init__(self, layers, features): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征
- def get_feature(self, codeword): codeword 数据坐标(层数 坐标 坐标 动作)
- def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特... | e6526e9e38fcb5be91b46cb40715c15242198a0b | <|skeleton|>
class TileCoder:
"""砖瓦编码"""
def __init__(self, layers, features):
"""layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征"""
<|body_0|>
def get_feature(self, codeword):
"""codeword 数据坐标(层数 坐标 坐标 动作)"""
<|body_1|>
def __call__(self, floats=(), ints=()):
"""将观测值向量... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TileCoder:
"""砖瓦编码"""
def __init__(self, layers, features):
"""layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征"""
self.layers = layers
self.features = features
self.codebook = {}
def get_feature(self, codeword):
"""codeword 数据坐标(层数 坐标 坐标 动作)"""
if codeword in s... | the_stack_v2_python_sparse | mountain_car/function_approx.py | lwzswufe/gym_learning | train | 0 |
8e44b4f33e8737c96f56d1b20c70c8ba3488d83f | [
"y_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07)\nsample_losses = -(y_true * np.log(y_pred_clipped) + (1 - y_true) * np.log(1 - y_pred_clipped))\nsample_losses = np.mean(sample_losses, axis=-1)\nreturn sample_losses",
"samples = len(derivated_values)\noutputs = len(derivated_values[0])\nclipped_derivated_value... | <|body_start_0|>
y_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07)
sample_losses = -(y_true * np.log(y_pred_clipped) + (1 - y_true) * np.log(1 - y_pred_clipped))
sample_losses = np.mean(sample_losses, axis=-1)
return sample_losses
<|end_body_0|>
<|body_start_1|>
samples = len(d... | The class computes the binary crossentropy by applying the formula. Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.407-412] | BinaryCrossentropy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryCrossentropy:
"""The class computes the binary crossentropy by applying the formula. Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.407-412]"""
def forward(self, y_pred, y_true):
"""Performs the forward pass. Args : y_pred(np.array): Model predi... | stack_v2_sparse_classes_10k_train_000146 | 1,927 | no_license | [
{
"docstring": "Performs the forward pass. Args : y_pred(np.array): Model predictions y_true(np.array): Actual values Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]",
"name": "forward",
"signature": "def forward(self, y_pred, y_true)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_001566 | Implement the Python class `BinaryCrossentropy` described below.
Class description:
The class computes the binary crossentropy by applying the formula. Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.407-412]
Method signatures and docstrings:
- def forward(self, y_pred, y_true): Perfor... | Implement the Python class `BinaryCrossentropy` described below.
Class description:
The class computes the binary crossentropy by applying the formula. Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.407-412]
Method signatures and docstrings:
- def forward(self, y_pred, y_true): Perfor... | 8ffd24971d8808e7c9caa722a7ff4df306b75b90 | <|skeleton|>
class BinaryCrossentropy:
"""The class computes the binary crossentropy by applying the formula. Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.407-412]"""
def forward(self, y_pred, y_true):
"""Performs the forward pass. Args : y_pred(np.array): Model predi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BinaryCrossentropy:
"""The class computes the binary crossentropy by applying the formula. Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.407-412]"""
def forward(self, y_pred, y_true):
"""Performs the forward pass. Args : y_pred(np.array): Model predictions y_true... | the_stack_v2_python_sparse | Music Recognizer/Metrics/BinaryCrossentropy.py | andutzu7/Lucrare-Licenta-MusicRecognizer | train | 0 |
e1e2074cd9c8f90baffffb2d96d4f32b5f4b0646 | [
"test_response = self.client.get('/people/')\nself.assertEqual(test_response.status_code, 200)\nself.assertTrue('personnel' in test_response.context)\nself.assertTemplateUsed(test_response, 'personnel_list.html')\nself.assertEqual(test_response.context['personnel_type'], 'current')\nself.assertEqual(test_response.c... | <|body_start_0|>
test_response = self.client.get('/people/')
self.assertEqual(test_response.status_code, 200)
self.assertTrue('personnel' in test_response.context)
self.assertTemplateUsed(test_response, 'personnel_list.html')
self.assertEqual(test_response.context['personnel_type... | Tests the views of ::class:`Personnel` objects contained in the ::mod:`personnel` app. | PersonnelViewTests | [
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersonnelViewTests:
"""Tests the views of ::class:`Personnel` objects contained in the ::mod:`personnel` app."""
def test_laboratory_personnel(self):
"""This function tests the laboratory-personnel view."""
<|body_0|>
def test_personnel_detail(self):
"""This func... | stack_v2_sparse_classes_10k_train_000147 | 5,452 | permissive | [
{
"docstring": "This function tests the laboratory-personnel view.",
"name": "test_laboratory_personnel",
"signature": "def test_laboratory_personnel(self)"
},
{
"docstring": "This function tests the personnel-details view.",
"name": "test_personnel_detail",
"signature": "def test_person... | 2 | stack_v2_sparse_classes_30k_train_007324 | Implement the Python class `PersonnelViewTests` described below.
Class description:
Tests the views of ::class:`Personnel` objects contained in the ::mod:`personnel` app.
Method signatures and docstrings:
- def test_laboratory_personnel(self): This function tests the laboratory-personnel view.
- def test_personnel_de... | Implement the Python class `PersonnelViewTests` described below.
Class description:
Tests the views of ::class:`Personnel` objects contained in the ::mod:`personnel` app.
Method signatures and docstrings:
- def test_laboratory_personnel(self): This function tests the laboratory-personnel view.
- def test_personnel_de... | d6f6c9c068bbf668c253e5943d9514947023e66d | <|skeleton|>
class PersonnelViewTests:
"""Tests the views of ::class:`Personnel` objects contained in the ::mod:`personnel` app."""
def test_laboratory_personnel(self):
"""This function tests the laboratory-personnel view."""
<|body_0|>
def test_personnel_detail(self):
"""This func... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PersonnelViewTests:
"""Tests the views of ::class:`Personnel` objects contained in the ::mod:`personnel` app."""
def test_laboratory_personnel(self):
"""This function tests the laboratory-personnel view."""
test_response = self.client.get('/people/')
self.assertEqual(test_response... | the_stack_v2_python_sparse | personnel/tests.py | BridgesLab/Lab-Website | train | 0 |
0d8d92882f5ae73c5e0331d4909fc18495c4e7eb | [
"res = []\ncur = []\nnum_of_letters = 0\nfor w in words:\n if num_of_letters + len(w) + len(cur) > maxWidth:\n for i in range(maxWidth - num_of_letters):\n cur[i % (len(cur) - 1 or 1)] += ' '\n res.append(''.join(cur))\n cur = []\n num_of_letters = 0\n cur += [w]\n nu... | <|body_start_0|>
res = []
cur = []
num_of_letters = 0
for w in words:
if num_of_letters + len(w) + len(cur) > maxWidth:
for i in range(maxWidth - num_of_letters):
cur[i % (len(cur) - 1 or 1)] += ' '
res.append(''.join(cur))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def fullJustify(self, words, maxWidth):
""":type words: List[str] :type maxWidth: int :rtype: List[str]"""
<|body_0|>
def rewrite(self, words, maxWidth):
""":type words: List[str] :type maxWidth: int :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_10k_train_000148 | 3,757 | no_license | [
{
"docstring": ":type words: List[str] :type maxWidth: int :rtype: List[str]",
"name": "fullJustify",
"signature": "def fullJustify(self, words, maxWidth)"
},
{
"docstring": ":type words: List[str] :type maxWidth: int :rtype: List[str]",
"name": "rewrite",
"signature": "def rewrite(self,... | 2 | stack_v2_sparse_classes_30k_train_000288 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fullJustify(self, words, maxWidth): :type words: List[str] :type maxWidth: int :rtype: List[str]
- def rewrite(self, words, maxWidth): :type words: List[str] :type maxWidth: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fullJustify(self, words, maxWidth): :type words: List[str] :type maxWidth: int :rtype: List[str]
- def rewrite(self, words, maxWidth): :type words: List[str] :type maxWidth: ... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def fullJustify(self, words, maxWidth):
""":type words: List[str] :type maxWidth: int :rtype: List[str]"""
<|body_0|>
def rewrite(self, words, maxWidth):
""":type words: List[str] :type maxWidth: int :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def fullJustify(self, words, maxWidth):
""":type words: List[str] :type maxWidth: int :rtype: List[str]"""
res = []
cur = []
num_of_letters = 0
for w in words:
if num_of_letters + len(w) + len(cur) > maxWidth:
for i in range(maxWidt... | the_stack_v2_python_sparse | co_linkedin/68_Text_Justification.py | vsdrun/lc_public | train | 6 | |
02d5c01c8b703afcc000002edd93305a52e1a84a | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ThreatIntelligence()",
"from ..entity import Entity\nfrom .article import Article\nfrom .article_indicator import ArticleIndicator\nfrom .host import Host\nfrom .host_component import HostComponent\nfrom .host_cookie import HostCookie\... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ThreatIntelligence()
<|end_body_0|>
<|body_start_1|>
from ..entity import Entity
from .article import Article
from .article_indicator import ArticleIndicator
from .host i... | ThreatIntelligence | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreatIntelligence:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje... | stack_v2_sparse_classes_10k_train_000149 | 7,000 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ThreatIntelligence",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | null | Implement the Python class `ThreatIntelligence` described below.
Class description:
Implement the ThreatIntelligence class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence: Creates a new instance of the appropriate class based on disc... | Implement the Python class `ThreatIntelligence` described below.
Class description:
Implement the ThreatIntelligence class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence: Creates a new instance of the appropriate class based on disc... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ThreatIntelligence:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ThreatIntelligence:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Th... | the_stack_v2_python_sparse | msgraph/generated/models/security/threat_intelligence.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
3bce24aa669609dbf40955b70ee6340e20bdf00a | [
"version_url = self._get_base_version_url()\nresp, body = self.raw_request(version_url, 'GET')\nself._error_checker(resp, body)\nbody = json.loads(body)\nself.validate_response(schema.list_versions, resp, body)\nreturn rest_client.ResponseBody(resp, body)",
"version_url = urljoin(self._get_base_version_url(), ver... | <|body_start_0|>
version_url = self._get_base_version_url()
resp, body = self.raw_request(version_url, 'GET')
self._error_checker(resp, body)
body = json.loads(body)
self.validate_response(schema.list_versions, resp, body)
return rest_client.ResponseBody(resp, body)
<|end... | VersionsClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VersionsClient:
def list_versions(self):
"""List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions"""
<|body_0|>
def show_version(self, version):
... | stack_v2_sparse_classes_10k_train_000150 | 2,524 | permissive | [
{
"docstring": "List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions",
"name": "list_versions",
"signature": "def list_versions(self)"
},
{
"docstring": "Show API version ... | 2 | stack_v2_sparse_classes_30k_val_000289 | Implement the Python class `VersionsClient` described below.
Class description:
Implement the VersionsClient class.
Method signatures and docstrings:
- def list_versions(self): List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/blo... | Implement the Python class `VersionsClient` described below.
Class description:
Implement the VersionsClient class.
Method signatures and docstrings:
- def list_versions(self): List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/blo... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class VersionsClient:
def list_versions(self):
"""List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions"""
<|body_0|>
def show_version(self, version):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VersionsClient:
def list_versions(self):
"""List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions"""
version_url = self._get_base_version_url()
resp, body = self.... | the_stack_v2_python_sparse | tempest/lib/services/volume/v3/versions_client.py | openstack/tempest | train | 270 | |
68f19fa1f9c4c766b1970591d4bc16b9c6068a60 | [
"if context is None:\n context = {}\nres = {}\nresult = []\ndepartment_obj = self.pool.get('hr.department')\ndepartment_condition = ''\ndepartment_ids = department_obj.search(cr, uid, [('id', 'child_of', department_id)])\nif len(department_ids) == 1:\n department_condition = ' and cust.department_id in (%s)' ... | <|body_start_0|>
if context is None:
context = {}
res = {}
result = []
department_obj = self.pool.get('hr.department')
department_condition = ''
department_ids = department_obj.search(cr, uid, [('id', 'child_of', department_id)])
if len(department_ids)... | Class to Create Custody Release Request From wizard | create_custody_release_request | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class create_custody_release_request:
"""Class to Create Custody Release Request From wizard"""
def change_department(self, cr, uid, ids, department_id, context=None):
"""To get default values for the object. @return: A dictionary which of fields with values."""
<|body_0|>
def... | stack_v2_sparse_classes_10k_train_000151 | 5,827 | no_license | [
{
"docstring": "To get default values for the object. @return: A dictionary which of fields with values.",
"name": "change_department",
"signature": "def change_department(self, cr, uid, ids, department_id, context=None)"
},
{
"docstring": "Button function to create release order for custody @re... | 2 | null | Implement the Python class `create_custody_release_request` described below.
Class description:
Class to Create Custody Release Request From wizard
Method signatures and docstrings:
- def change_department(self, cr, uid, ids, department_id, context=None): To get default values for the object. @return: A dictionary wh... | Implement the Python class `create_custody_release_request` described below.
Class description:
Class to Create Custody Release Request From wizard
Method signatures and docstrings:
- def change_department(self, cr, uid, ids, department_id, context=None): To get default values for the object. @return: A dictionary wh... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class create_custody_release_request:
"""Class to Create Custody Release Request From wizard"""
def change_department(self, cr, uid, ids, department_id, context=None):
"""To get default values for the object. @return: A dictionary which of fields with values."""
<|body_0|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class create_custody_release_request:
"""Class to Create Custody Release Request From wizard"""
def change_department(self, cr, uid, ids, department_id, context=None):
"""To get default values for the object. @return: A dictionary which of fields with values."""
if context is None:
... | the_stack_v2_python_sparse | v_7/NISS/shamil_v3/custody_management/wizard/partial_release_wizrd.py | musabahmed/baba | train | 0 |
bbe3e6162ed90a73dd0d2c6247a8cd7463dd88c2 | [
"if region in ['default', 'us-west-1']:\n return '%s://%sapi.us-west-1.altus.cloudera.com:%d' % (scheme, service_name, port)\nelif region == 'usg-1':\n return '%s://api.%s.cdp.clouderagovt.com:%d' % (scheme, region, port)\nelse:\n return '%s://api.%s.cdp.cloudera.com:%d' % (scheme, region, port)",
"if re... | <|body_start_0|>
if region in ['default', 'us-west-1']:
return '%s://%sapi.us-west-1.altus.cloudera.com:%d' % (scheme, service_name, port)
elif region == 'usg-1':
return '%s://api.%s.cdp.clouderagovt.com:%d' % (scheme, region, port)
else:
return '%s://api.%s.c... | A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator. | EndpointResolver | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EndpointResolver:
"""A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator."""
def _construct_altus_endpoint(self, service_name, scheme, region, port):
"""Construct a default base URL to an Altus service. :param service_name: service name, as referenced in it... | stack_v2_sparse_classes_10k_train_000152 | 17,043 | permissive | [
{
"docstring": "Construct a default base URL to an Altus service. :param service_name: service name, as referenced in its URLs :param scheme: URL scheme, e.g., 'https' :param port: service port :param region: service region :returns: Altus service base URL",
"name": "_construct_altus_endpoint",
"signatu... | 6 | stack_v2_sparse_classes_30k_train_006376 | Implement the Python class `EndpointResolver` described below.
Class description:
A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator.
Method signatures and docstrings:
- def _construct_altus_endpoint(self, service_name, scheme, region, port): Construct a default base URL to an Altus servic... | Implement the Python class `EndpointResolver` described below.
Class description:
A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator.
Method signatures and docstrings:
- def _construct_altus_endpoint(self, service_name, scheme, region, port): Construct a default base URL to an Altus servic... | c3de560c93914d400be86c4039b9f60c2c6d87c4 | <|skeleton|>
class EndpointResolver:
"""A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator."""
def _construct_altus_endpoint(self, service_name, scheme, region, port):
"""Construct a default base URL to an Altus service. :param service_name: service name, as referenced in it... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EndpointResolver:
"""A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator."""
def _construct_altus_endpoint(self, service_name, scheme, region, port):
"""Construct a default base URL to an Altus service. :param service_name: service name, as referenced in its URLs :param... | the_stack_v2_python_sparse | cdpcli/endpoint.py | cloudera/cdpcli | train | 9 |
0dad0d06e44faa9c3f3f97a73c541c7669eee9f1 | [
"merchObj = Merchant.objects.get(merchant=request.user.id)\nsubObj = SubAdmin.objects.filter(merchant=merchObj.merchantId)\nprint(subObj)\nserializer = SubAdminSerializer(subObj, many=True)\nprint(serializer.data)\nreturn Response(serializer.data)",
"obj2 = Merchant.objects.get(merchant=request.user.id)\nrequest.... | <|body_start_0|>
merchObj = Merchant.objects.get(merchant=request.user.id)
subObj = SubAdmin.objects.filter(merchant=merchObj.merchantId)
print(subObj)
serializer = SubAdminSerializer(subObj, many=True)
print(serializer.data)
return Response(serializer.data)
<|end_body_0|... | A class based view for creating and fetching student records | SubAdminRecordView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubAdminRecordView:
"""A class based view for creating and fetching student records"""
def get(self, request, format=None):
"""Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records"""
<|body_0|>
d... | stack_v2_sparse_classes_10k_train_000153 | 2,583 | no_license | [
{
"docstring": "Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records",
"name": "get",
"signature": "def get(self, request, format=None)"
},
{
"docstring": "Create a student record :param format: Format of the student rec... | 2 | stack_v2_sparse_classes_30k_val_000250 | Implement the Python class `SubAdminRecordView` described below.
Class description:
A class based view for creating and fetching student records
Method signatures and docstrings:
- def get(self, request, format=None): Get all the student records :param format: Format of the student records to return to :return: Retur... | Implement the Python class `SubAdminRecordView` described below.
Class description:
A class based view for creating and fetching student records
Method signatures and docstrings:
- def get(self, request, format=None): Get all the student records :param format: Format of the student records to return to :return: Retur... | 88e4e994a029527d9e6b9431155a81cd5774b63c | <|skeleton|>
class SubAdminRecordView:
"""A class based view for creating and fetching student records"""
def get(self, request, format=None):
"""Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records"""
<|body_0|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubAdminRecordView:
"""A class based view for creating and fetching student records"""
def get(self, request, format=None):
"""Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records"""
merchObj = Merchant.objects.ge... | the_stack_v2_python_sparse | myuser/views/subadminView.py | anku580/Upfront---Backend | train | 0 |
5884c9d06bb9947a11e2247472b18c5c2f5c5815 | [
"global op\nop = 0\nnext = pcs.Field('next_header', 8)\nlen = pcs.Field('length', 8)\ntype = pcs.Field('type', 8)\npcs.Packet.__init__(self, [next, len, type], bytes)",
"global op\nop += 1\notype = pcs.Field('otype' + str(op), 8)\nolen = pcs.Field('olength' + str(op), 8, default=len / 8)\nif len != 0:\n odata ... | <|body_start_0|>
global op
op = 0
next = pcs.Field('next_header', 8)
len = pcs.Field('length', 8)
type = pcs.Field('type', 8)
pcs.Packet.__init__(self, [next, len, type], bytes)
<|end_body_0|>
<|body_start_1|>
global op
op += 1
otype = pcs.Field('... | A class that contains the IPv6 destination options extension-headers. | dstopts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class dstopts:
"""A class that contains the IPv6 destination options extension-headers."""
def __init__(self, bytes=None):
"""IPv6 destination options extension header from RFC 2460"""
<|body_0|>
def option(self, len=0):
"""add option header to the destination extensio... | stack_v2_sparse_classes_10k_train_000154 | 7,919 | no_license | [
{
"docstring": "IPv6 destination options extension header from RFC 2460",
"name": "__init__",
"signature": "def __init__(self, bytes=None)"
},
{
"docstring": "add option header to the destination extension header",
"name": "option",
"signature": "def option(self, len=0)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006952 | Implement the Python class `dstopts` described below.
Class description:
A class that contains the IPv6 destination options extension-headers.
Method signatures and docstrings:
- def __init__(self, bytes=None): IPv6 destination options extension header from RFC 2460
- def option(self, len=0): add option header to the... | Implement the Python class `dstopts` described below.
Class description:
A class that contains the IPv6 destination options extension-headers.
Method signatures and docstrings:
- def __init__(self, bytes=None): IPv6 destination options extension header from RFC 2460
- def option(self, len=0): add option header to the... | a070a39586b582fbeea72abf12bbfd812955ad81 | <|skeleton|>
class dstopts:
"""A class that contains the IPv6 destination options extension-headers."""
def __init__(self, bytes=None):
"""IPv6 destination options extension header from RFC 2460"""
<|body_0|>
def option(self, len=0):
"""add option header to the destination extensio... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class dstopts:
"""A class that contains the IPv6 destination options extension-headers."""
def __init__(self, bytes=None):
"""IPv6 destination options extension header from RFC 2460"""
global op
op = 0
next = pcs.Field('next_header', 8)
len = pcs.Field('length', 8)
... | the_stack_v2_python_sparse | src/pcs/packets/ipv6.py | bilouro/tcptest | train | 0 |
3d354a435b6c318cfdcc7ee2be0ccc91f1e7aba6 | [
"self.user = kwargs.pop('user', None)\nself.question = kwargs.pop('question', None)\nsuper(KitsuneBaseForumForm, self).__init__(*args, **kwargs)",
"cdata = self.cleaned_data.get('content')\nif not cdata:\n return super(KitsuneBaseForumForm, self).clean(*args, **kwargs)\nif not self.user:\n raise forms.Valid... | <|body_start_0|>
self.user = kwargs.pop('user', None)
self.question = kwargs.pop('question', None)
super(KitsuneBaseForumForm, self).__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
cdata = self.cleaned_data.get('content')
if not cdata:
return super(KitsuneB... | Base form suitable for all the project. Mainly adds a common clean method to deal with spam. | KitsuneBaseForumForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KitsuneBaseForumForm:
"""Base form suitable for all the project. Mainly adds a common clean method to deal with spam."""
def __init__(self, *args, **kwargs):
"""Override init method to get the user if possible."""
<|body_0|>
def clean(self, *args, **kwargs):
"""G... | stack_v2_sparse_classes_10k_train_000155 | 1,419 | permissive | [
{
"docstring": "Override init method to get the user if possible.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Generic clean method used by all forms in the question app. Parse content for suspicious content. - Toll free numbers - NANP numbers - Lin... | 2 | null | Implement the Python class `KitsuneBaseForumForm` described below.
Class description:
Base form suitable for all the project. Mainly adds a common clean method to deal with spam.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Override init method to get the user if possible.
- def clean(self... | Implement the Python class `KitsuneBaseForumForm` described below.
Class description:
Base form suitable for all the project. Mainly adds a common clean method to deal with spam.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Override init method to get the user if possible.
- def clean(self... | 67ec527bfc32c715bf9f29d5e01362c4903aebd2 | <|skeleton|>
class KitsuneBaseForumForm:
"""Base form suitable for all the project. Mainly adds a common clean method to deal with spam."""
def __init__(self, *args, **kwargs):
"""Override init method to get the user if possible."""
<|body_0|>
def clean(self, *args, **kwargs):
"""G... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KitsuneBaseForumForm:
"""Base form suitable for all the project. Mainly adds a common clean method to deal with spam."""
def __init__(self, *args, **kwargs):
"""Override init method to get the user if possible."""
self.user = kwargs.pop('user', None)
self.question = kwargs.pop('qu... | the_stack_v2_python_sparse | kitsune/sumo/forms.py | mozilla/kitsune | train | 1,218 |
8313e79ff3c157db64aafa45a01063d465e5344e | [
"self.name = name\nself.customer = customer\nself.pickup = pickup\nself.dropoff = dropoff\nself.pickuptime = pickuptime\nself.dropofftime = dropofftime\nself.rating = rating\nself.notes = notes\nself.date_created = datetime.datetime.now()",
"dict = {}\ndict['id'] = self.id\ndict['name'] = self.name\ndict['custome... | <|body_start_0|>
self.name = name
self.customer = customer
self.pickup = pickup
self.dropoff = dropoff
self.pickuptime = pickuptime
self.dropofftime = dropofftime
self.rating = rating
self.notes = notes
self.date_created = datetime.datetime.now()
<... | Request info | Report | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Report:
"""Request info"""
def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes):
"""Initialize a report"""
<|body_0|>
def to_dict(self):
"""Dictionary representation of a report"""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_10k_train_000156 | 1,565 | no_license | [
{
"docstring": "Initialize a report",
"name": "__init__",
"signature": "def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes)"
},
{
"docstring": "Dictionary representation of a report",
"name": "to_dict",
"signature": "def to_dict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004882 | Implement the Python class `Report` described below.
Class description:
Request info
Method signatures and docstrings:
- def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes): Initialize a report
- def to_dict(self): Dictionary representation of a report | Implement the Python class `Report` described below.
Class description:
Request info
Method signatures and docstrings:
- def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes): Initialize a report
- def to_dict(self): Dictionary representation of a report
<|skeleton|>
class Repor... | 86c6dc617fef1f2bcbb939e23c665ce34ddc3e65 | <|skeleton|>
class Report:
"""Request info"""
def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes):
"""Initialize a report"""
<|body_0|>
def to_dict(self):
"""Dictionary representation of a report"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Report:
"""Request info"""
def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes):
"""Initialize a report"""
self.name = name
self.customer = customer
self.pickup = pickup
self.dropoff = dropoff
self.pickuptime = pickupt... | the_stack_v2_python_sparse | report.py | zachdg/SBAdatastore | train | 0 |
8ce47345a5b3e9be28aff1618a2ef79edd482e34 | [
"self.config_entry = entry\nself.lametric = LaMetricDevice(host=entry.data[CONF_HOST], api_key=entry.data[CONF_API_KEY], session=async_get_clientsession(hass))\nsuper().__init__(hass, LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL)",
"try:\n return await self.lametric.device()\nexcept LaMetricAuthenticatio... | <|body_start_0|>
self.config_entry = entry
self.lametric = LaMetricDevice(host=entry.data[CONF_HOST], api_key=entry.data[CONF_API_KEY], session=async_get_clientsession(hass))
super().__init__(hass, LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL)
<|end_body_0|>
<|body_start_1|>
try:
... | The LaMetric Data Update Coordinator. | LaMetricDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LaMetricDataUpdateCoordinator:
"""The LaMetric Data Update Coordinator."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the LaMatric coordinator."""
<|body_0|>
async def _async_update_data(self) -> Device:
"""Fetch device inf... | stack_v2_sparse_classes_10k_train_000157 | 1,627 | permissive | [
{
"docstring": "Initialize the LaMatric coordinator.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None"
},
{
"docstring": "Fetch device information of the LaMetric device.",
"name": "_async_update_data",
"signature": "async def _async... | 2 | stack_v2_sparse_classes_30k_test_000373 | Implement the Python class `LaMetricDataUpdateCoordinator` described below.
Class description:
The LaMetric Data Update Coordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the LaMatric coordinator.
- async def _async_update_data(self) -> Dev... | Implement the Python class `LaMetricDataUpdateCoordinator` described below.
Class description:
The LaMetric Data Update Coordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the LaMatric coordinator.
- async def _async_update_data(self) -> Dev... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class LaMetricDataUpdateCoordinator:
"""The LaMetric Data Update Coordinator."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the LaMatric coordinator."""
<|body_0|>
async def _async_update_data(self) -> Device:
"""Fetch device inf... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LaMetricDataUpdateCoordinator:
"""The LaMetric Data Update Coordinator."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the LaMatric coordinator."""
self.config_entry = entry
self.lametric = LaMetricDevice(host=entry.data[CONF_HOST], api_key=e... | the_stack_v2_python_sparse | homeassistant/components/lametric/coordinator.py | home-assistant/core | train | 35,501 |
282d3c3437b5daec2537fc9abdff3643fbebbf7f | [
"request_command = self.parser_invoker.get_maintenance_date_time_command_bytes(self.sequence_id, self.product_id)\nresponse_command_content = self.connectObj.send_receive_command(request_command)\nreturn response_command_content",
"request_command = self.parser_invoker.get_maintenance_period_command_bytes(self.se... | <|body_start_0|>
request_command = self.parser_invoker.get_maintenance_date_time_command_bytes(self.sequence_id, self.product_id)
response_command_content = self.connectObj.send_receive_command(request_command)
return response_command_content
<|end_body_0|>
<|body_start_1|>
request_comm... | This class is used to define all related methods with device report. | DeviceReport | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeviceReport:
"""This class is used to define all related methods with device report."""
def get_maintenance_date_time(self):
"""This method is used to get maintenance date time. :return: date time"""
<|body_0|>
def get_maintenance_period(self):
"""This method is... | stack_v2_sparse_classes_10k_train_000158 | 2,642 | permissive | [
{
"docstring": "This method is used to get maintenance date time. :return: date time",
"name": "get_maintenance_date_time",
"signature": "def get_maintenance_date_time(self)"
},
{
"docstring": "This method is used to get maintenance period. :return: maintenance period(unit:month)",
"name": "... | 5 | stack_v2_sparse_classes_30k_test_000399 | Implement the Python class `DeviceReport` described below.
Class description:
This class is used to define all related methods with device report.
Method signatures and docstrings:
- def get_maintenance_date_time(self): This method is used to get maintenance date time. :return: date time
- def get_maintenance_period(... | Implement the Python class `DeviceReport` described below.
Class description:
This class is used to define all related methods with device report.
Method signatures and docstrings:
- def get_maintenance_date_time(self): This method is used to get maintenance date time. :return: date time
- def get_maintenance_period(... | c2a4884a36f4c6c6552fa942143ae5d21c120b41 | <|skeleton|>
class DeviceReport:
"""This class is used to define all related methods with device report."""
def get_maintenance_date_time(self):
"""This method is used to get maintenance date time. :return: date time"""
<|body_0|>
def get_maintenance_period(self):
"""This method is... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeviceReport:
"""This class is used to define all related methods with device report."""
def get_maintenance_date_time(self):
"""This method is used to get maintenance date time. :return: date time"""
request_command = self.parser_invoker.get_maintenance_date_time_command_bytes(self.seque... | the_stack_v2_python_sparse | Keywords/MenuSettings/device_report.py | cassie01/PumpLibrary | train | 0 |
0ff048b088303cb2296a9a454cba73c33fa65373 | [
"if isinstance(key, int):\n return Option(key)\nif key not in Option._member_map_:\n extend_enum(Option, key, default)\nreturn Option[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 35 <= value <= 68:\n extend_enum(c... | <|body_start_0|>
if isinstance(key, int):
return Option(key)
if key not in Option._member_map_:
extend_enum(Option, key, default)
return Option[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 255):
raise ValueErro... | [Option] TCP Option Kind Numbers | Option | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_000159 | 3,365 | permissive | [
{
"docstring": "Backport support for original codes.",
"name": "get",
"signature": "def get(key, default=-1)"
},
{
"docstring": "Lookup function used when value is not found.",
"name": "_missing_",
"signature": "def _missing_(cls, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005981 | Implement the Python class `Option` described below.
Class description:
[Option] TCP Option Kind Numbers
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found. | Implement the Python class `Option` described below.
Class description:
[Option] TCP Option Kind Numbers
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found.
<|skeleton|>
class Option:
"""[Opt... | 71363d7948003fec88cedcf5bc80b6befa2ba244 | <|skeleton|>
class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return Option(key)
if key not in Option._member_map_:
extend_enum(Option, key, default)
return Option[key]
... | the_stack_v2_python_sparse | pcapkit/const/tcp/option.py | hiok2000/PyPCAPKit | train | 0 |
7f5fe0bae7e7993b2f15d7ffa59395353187b70a | [
"self.Wz = np.random.randn(i + h, h)\nself.bz = np.zeros((1, h))\nself.Wr = np.random.randn(i + h, h)\nself.br = np.zeros((1, h))\nself.Wh = np.random.randn(i + h, h)\nself.bh = np.zeros((1, h))\nself.Wy = np.random.randn(h, o)\nself.by = np.zeros((1, o))",
"concat = np.concatenate([h_prev, x_t], axis=1)\nr = sig... | <|body_start_0|>
self.Wz = np.random.randn(i + h, h)
self.bz = np.zeros((1, h))
self.Wr = np.random.randn(i + h, h)
self.br = np.zeros((1, h))
self.Wh = np.random.randn(i + h, h)
self.bh = np.zeros((1, h))
self.Wy = np.random.randn(h, o)
self.by = np.zeros... | This class represents a GRUCell | GRUCell | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GRUCell:
"""This class represents a GRUCell"""
def __init__(self, i, h, o):
"""All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
<|body_0|>
def forward(self, h_prev, x_t):
"""... | stack_v2_sparse_classes_10k_train_000160 | 1,796 | permissive | [
{
"docstring": "All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs",
"name": "__init__",
"signature": "def __init__(self, i, h, o)"
},
{
"docstring": "This method calculates de forward prop for one time-step x_t ... | 2 | stack_v2_sparse_classes_30k_train_004122 | Implement the Python class `GRUCell` described below.
Class description:
This class represents a GRUCell
Method signatures and docstrings:
- def __init__(self, i, h, o): All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs
- def forward... | Implement the Python class `GRUCell` described below.
Class description:
This class represents a GRUCell
Method signatures and docstrings:
- def __init__(self, i, h, o): All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs
- def forward... | 58c367f3014919f95157426121093b9fe14d4035 | <|skeleton|>
class GRUCell:
"""This class represents a GRUCell"""
def __init__(self, i, h, o):
"""All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
<|body_0|>
def forward(self, h_prev, x_t):
"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GRUCell:
"""This class represents a GRUCell"""
def __init__(self, i, h, o):
"""All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
self.Wz = np.random.randn(i + h, h)
self.bz = np.zeros((1, h))
... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/2-gru_cell.py | linkem97/holbertonschool-machine_learning | train | 0 |
5385b8ba54e3cf316ebd899565314ab28d0efb27 | [
"print('\\nLoading Keras model...')\nself.model = load_model('./net_4conv_patience5.h5')\nprint('loaded\\n')\nstatus = 0\nic = None\nic = EasyIce.initialize(sys.argv)\nproperties = ic.getProperties()\nself.lock = threading.Lock()\ntry:\n obj = ic.propertyToProxy('Digitclassifier.Camera.Proxy')\n self.cam = Ca... | <|body_start_0|>
print('\nLoading Keras model...')
self.model = load_model('./net_4conv_patience5.h5')
print('loaded\n')
status = 0
ic = None
ic = EasyIce.initialize(sys.argv)
properties = ic.getProperties()
self.lock = threading.Lock()
try:
... | Camera | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Camera:
def __init__(self):
"""Camera class gets images from live video and transform them in order to predict the digit in the image."""
<|body_0|>
def getImage(self):
"""Gets the image from the webcam and returns the original image with a ROI draw over it and the t... | stack_v2_sparse_classes_10k_train_000161 | 4,345 | no_license | [
{
"docstring": "Camera class gets images from live video and transform them in order to predict the digit in the image.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Gets the image from the webcam and returns the original image with a ROI draw over it and the transfo... | 5 | stack_v2_sparse_classes_30k_train_003243 | Implement the Python class `Camera` described below.
Class description:
Implement the Camera class.
Method signatures and docstrings:
- def __init__(self): Camera class gets images from live video and transform them in order to predict the digit in the image.
- def getImage(self): Gets the image from the webcam and r... | Implement the Python class `Camera` described below.
Class description:
Implement the Camera class.
Method signatures and docstrings:
- def __init__(self): Camera class gets images from live video and transform them in order to predict the digit in the image.
- def getImage(self): Gets the image from the webcam and r... | 4512c094bedd05646eb8cd2d9d5aba474ccbcb3d | <|skeleton|>
class Camera:
def __init__(self):
"""Camera class gets images from live video and transform them in order to predict the digit in the image."""
<|body_0|>
def getImage(self):
"""Gets the image from the webcam and returns the original image with a ROI draw over it and the t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Camera:
def __init__(self):
"""Camera class gets images from live video and transform them in order to predict the digit in the image."""
print('\nLoading Keras model...')
self.model = load_model('./net_4conv_patience5.h5')
print('loaded\n')
status = 0
ic = None... | the_stack_v2_python_sparse | 2016-tfg-david-pascual-replicado/Camera/camera.py | RoboticsLabURJC/2017-tfm-alexandre-rodriguez | train | 2 | |
b9bbee9ca458b3f4c3b13eb532817ee302b8bda5 | [
"if root is None:\n return '[]'\nfrom collections import deque\nqueue = deque([root])\nresult = [root.val]\nwhile queue:\n node = queue.popleft()\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\n result.append(node.left.val if node.left else 'null')... | <|body_start_0|>
if root is None:
return '[]'
from collections import deque
queue = deque([root])
result = [root.val]
while queue:
node = queue.popleft()
if node.left:
queue.append(node.left)
if node.right:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_000162 | 3,660 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_val_000280 | 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:... | c34b55bb42dc44a9026a902f6afcc018b4154662 | <|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_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if root is None:
return '[]'
from collections import deque
queue = deque([root])
result = [root.val]
while queue:
node = queue.pop... | the_stack_v2_python_sparse | Algorithm/Serialize and Deserialize Binary Tree.py | superpigBB/Happy-Coding | train | 0 | |
d7ad585d4bbb4111391ef8202181282d0c9d19eb | [
"super(BundleAction, self)._fixup()\nself.type = 'coord-action'\nself.name = self.coordJobName\nif self.conf:\n conf_data = i18n.smart_str(self.conf)\n if not isinstance(conf_data, bytes):\n conf_data = conf_data.encode('utf-8')\n xml = string_io(conf_data)\n self.conf_dict = hadoop.confparse.Con... | <|body_start_0|>
super(BundleAction, self)._fixup()
self.type = 'coord-action'
self.name = self.coordJobName
if self.conf:
conf_data = i18n.smart_str(self.conf)
if not isinstance(conf_data, bytes):
conf_data = conf_data.encode('utf-8')
... | BundleAction | [
"CC-BY-3.0",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"ZPL-2.0",
"Unlicense",
"LGPL-3.0-only",
"CC0-1.0",
"LicenseRef-scancode-other-permissive",
"CNRI-Python",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-2.0-or-later",
"Python-2.0",
"GPL-3.0... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BundleAction:
def _fixup(self):
"""Fixup: - time fields as struct_time - config dict"""
<|body_0|>
def get_progress(self):
"""How much more time before the next action."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(BundleAction, self)._fixup... | stack_v2_sparse_classes_10k_train_000163 | 19,361 | permissive | [
{
"docstring": "Fixup: - time fields as struct_time - config dict",
"name": "_fixup",
"signature": "def _fixup(self)"
},
{
"docstring": "How much more time before the next action.",
"name": "get_progress",
"signature": "def get_progress(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006891 | Implement the Python class `BundleAction` described below.
Class description:
Implement the BundleAction class.
Method signatures and docstrings:
- def _fixup(self): Fixup: - time fields as struct_time - config dict
- def get_progress(self): How much more time before the next action. | Implement the Python class `BundleAction` described below.
Class description:
Implement the BundleAction class.
Method signatures and docstrings:
- def _fixup(self): Fixup: - time fields as struct_time - config dict
- def get_progress(self): How much more time before the next action.
<|skeleton|>
class BundleAction:... | dccb9467675c67b9c3399fc76c5de6d31bfb8255 | <|skeleton|>
class BundleAction:
def _fixup(self):
"""Fixup: - time fields as struct_time - config dict"""
<|body_0|>
def get_progress(self):
"""How much more time before the next action."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BundleAction:
def _fixup(self):
"""Fixup: - time fields as struct_time - config dict"""
super(BundleAction, self)._fixup()
self.type = 'coord-action'
self.name = self.coordJobName
if self.conf:
conf_data = i18n.smart_str(self.conf)
if not isinsta... | the_stack_v2_python_sparse | desktop/libs/liboozie/src/liboozie/types.py | cloudera/hue | train | 5,655 | |
792e8eea26ff93e4711bb625b67cdda56a813db6 | [
"super(AlbertConfig, self).__init__(**kwargs)\nif inner_group_num != 1 or num_hidden_groups != 1:\n raise ValueError(\"We only support 'inner_group_num' and 'num_hidden_groups' as 1.\")",
"config = AlbertConfig(vocab_size=None)\nfor key, value in six.iteritems(json_object):\n config.__dict__[key] = value\nr... | <|body_start_0|>
super(AlbertConfig, self).__init__(**kwargs)
if inner_group_num != 1 or num_hidden_groups != 1:
raise ValueError("We only support 'inner_group_num' and 'num_hidden_groups' as 1.")
<|end_body_0|>
<|body_start_1|>
config = AlbertConfig(vocab_size=None)
for key... | Configuration for `ALBERT`. | AlbertConfig | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlbertConfig:
"""Configuration for `ALBERT`."""
def __init__(self, num_hidden_groups=1, inner_group_num=1, **kwargs):
"""Constructs AlbertConfig. Args: num_hidden_groups: Number of group for the hidden layers, parameters in the same group are shared. Note that this value and also the... | stack_v2_sparse_classes_10k_train_000164 | 2,261 | permissive | [
{
"docstring": "Constructs AlbertConfig. Args: num_hidden_groups: Number of group for the hidden layers, parameters in the same group are shared. Note that this value and also the following 'inner_group_num' has to be 1 for now, because all released ALBERT models set them to 1. We may support arbitary valid val... | 2 | null | Implement the Python class `AlbertConfig` described below.
Class description:
Configuration for `ALBERT`.
Method signatures and docstrings:
- def __init__(self, num_hidden_groups=1, inner_group_num=1, **kwargs): Constructs AlbertConfig. Args: num_hidden_groups: Number of group for the hidden layers, parameters in the... | Implement the Python class `AlbertConfig` described below.
Class description:
Configuration for `ALBERT`.
Method signatures and docstrings:
- def __init__(self, num_hidden_groups=1, inner_group_num=1, **kwargs): Constructs AlbertConfig. Args: num_hidden_groups: Number of group for the hidden layers, parameters in the... | a115d918f6894a69586174653172be0b5d1de952 | <|skeleton|>
class AlbertConfig:
"""Configuration for `ALBERT`."""
def __init__(self, num_hidden_groups=1, inner_group_num=1, **kwargs):
"""Constructs AlbertConfig. Args: num_hidden_groups: Number of group for the hidden layers, parameters in the same group are shared. Note that this value and also the... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AlbertConfig:
"""Configuration for `ALBERT`."""
def __init__(self, num_hidden_groups=1, inner_group_num=1, **kwargs):
"""Constructs AlbertConfig. Args: num_hidden_groups: Number of group for the hidden layers, parameters in the same group are shared. Note that this value and also the following 'i... | the_stack_v2_python_sparse | models/official/nlp/albert/configs.py | finnickniu/tensorflow_object_detection_tflite | train | 60 |
585ed3b8f6d17f9d343e3867fd20f52228ec1f66 | [
"cmd = self._get_cmd()\ncontent = ''\nif cmd:\n optlist = self.settings.get('ASCIIDOC_OPTIONS', []) + self.default_options\n options = ' '.join(optlist)\n content = call('%s %s -o - %s' % (cmd, options, source_path))\nmetadata = self._read_metadata(source_path)\nreturn (content, metadata)",
"if self.sett... | <|body_start_0|>
cmd = self._get_cmd()
content = ''
if cmd:
optlist = self.settings.get('ASCIIDOC_OPTIONS', []) + self.default_options
options = ' '.join(optlist)
content = call('%s %s -o - %s' % (cmd, options, source_path))
metadata = self._read_metad... | Reader for AsciiDoc files. | AsciiDocReader | [
"AGPL-3.0-only",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsciiDocReader:
"""Reader for AsciiDoc files."""
def read(self, source_path):
"""Parse content and metadata of AsciiDoc files."""
<|body_0|>
def _get_cmd(self):
"""Returns the AsciiDoc utility command to use for rendering or None if one cannot be found."""
... | stack_v2_sparse_classes_10k_train_000165 | 3,245 | permissive | [
{
"docstring": "Parse content and metadata of AsciiDoc files.",
"name": "read",
"signature": "def read(self, source_path)"
},
{
"docstring": "Returns the AsciiDoc utility command to use for rendering or None if one cannot be found.",
"name": "_get_cmd",
"signature": "def _get_cmd(self)"
... | 3 | null | Implement the Python class `AsciiDocReader` described below.
Class description:
Reader for AsciiDoc files.
Method signatures and docstrings:
- def read(self, source_path): Parse content and metadata of AsciiDoc files.
- def _get_cmd(self): Returns the AsciiDoc utility command to use for rendering or None if one canno... | Implement the Python class `AsciiDocReader` described below.
Class description:
Reader for AsciiDoc files.
Method signatures and docstrings:
- def read(self, source_path): Parse content and metadata of AsciiDoc files.
- def _get_cmd(self): Returns the AsciiDoc utility command to use for rendering or None if one canno... | b5d68070b6f15677a183424c84e30440e128e1ea | <|skeleton|>
class AsciiDocReader:
"""Reader for AsciiDoc files."""
def read(self, source_path):
"""Parse content and metadata of AsciiDoc files."""
<|body_0|>
def _get_cmd(self):
"""Returns the AsciiDoc utility command to use for rendering or None if one cannot be found."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AsciiDocReader:
"""Reader for AsciiDoc files."""
def read(self, source_path):
"""Parse content and metadata of AsciiDoc files."""
cmd = self._get_cmd()
content = ''
if cmd:
optlist = self.settings.get('ASCIIDOC_OPTIONS', []) + self.default_options
o... | the_stack_v2_python_sparse | plugins/asciidoc_reader/asciidoc_reader.py | JackMcKew/jackmckew.dev | train | 15 |
e944924f06776adce205340fdb95884385004029 | [
"t1 = PartParameterTemplate.objects.get(pk=1)\nself.assertEqual(str(t1), 'Length (mm)')\np1 = PartParameter.objects.get(pk=1)\nself.assertEqual(str(p1), 'M2x4 LPHS : Length = 4 (mm)')\nc1 = PartCategoryParameterTemplate.objects.get(pk=1)\nself.assertEqual(str(c1), 'Mechanical | Length | 2.8')",
"n = PartParameter... | <|body_start_0|>
t1 = PartParameterTemplate.objects.get(pk=1)
self.assertEqual(str(t1), 'Length (mm)')
p1 = PartParameter.objects.get(pk=1)
self.assertEqual(str(p1), 'M2x4 LPHS : Length = 4 (mm)')
c1 = PartCategoryParameterTemplate.objects.get(pk=1)
self.assertEqual(str(c... | Unit test class for testing the PartParameter model | TestParams | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestParams:
"""Unit test class for testing the PartParameter model"""
def test_str(self):
"""Test the str representation of the PartParameterTemplate model"""
<|body_0|>
def test_validate(self):
"""Test validation for part templates"""
<|body_1|>
def... | stack_v2_sparse_classes_10k_train_000166 | 12,864 | permissive | [
{
"docstring": "Test the str representation of the PartParameterTemplate model",
"name": "test_str",
"signature": "def test_str(self)"
},
{
"docstring": "Test validation for part templates",
"name": "test_validate",
"signature": "def test_validate(self)"
},
{
"docstring": "Unit t... | 4 | stack_v2_sparse_classes_30k_train_001967 | Implement the Python class `TestParams` described below.
Class description:
Unit test class for testing the PartParameter model
Method signatures and docstrings:
- def test_str(self): Test the str representation of the PartParameterTemplate model
- def test_validate(self): Test validation for part templates
- def tes... | Implement the Python class `TestParams` described below.
Class description:
Unit test class for testing the PartParameter model
Method signatures and docstrings:
- def test_str(self): Test the str representation of the PartParameterTemplate model
- def test_validate(self): Test validation for part templates
- def tes... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class TestParams:
"""Unit test class for testing the PartParameter model"""
def test_str(self):
"""Test the str representation of the PartParameterTemplate model"""
<|body_0|>
def test_validate(self):
"""Test validation for part templates"""
<|body_1|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestParams:
"""Unit test class for testing the PartParameter model"""
def test_str(self):
"""Test the str representation of the PartParameterTemplate model"""
t1 = PartParameterTemplate.objects.get(pk=1)
self.assertEqual(str(t1), 'Length (mm)')
p1 = PartParameter.objects.g... | the_stack_v2_python_sparse | InvenTree/part/test_param.py | inventree/InvenTree | train | 3,077 |
01c02917335c9cfed3c9583083b605dd412389bb | [
"super(SelfAttention, self).__init__()\nself.in_channel = in_channel\nif out_channel is not None:\n self.out_channel = out_channel\nelse:\n self.out_channel = in_channel\nself.temperature = self.out_channel ** 0.5\nself.q_map = nn.Conv1d(in_channel, self.out_channel, 1, bias=False)\nself.k_map = nn.Conv1d(in_... | <|body_start_0|>
super(SelfAttention, self).__init__()
self.in_channel = in_channel
if out_channel is not None:
self.out_channel = out_channel
else:
self.out_channel = in_channel
self.temperature = self.out_channel ** 0.5
self.q_map = nn.Conv1d(in_... | SelfAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttention:
def __init__(self, in_channel, out_channel=None, attn_dropout=0.1):
""":param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel"""
<|body_0|>
def forward(self, x):
""":param x: the f... | stack_v2_sparse_classes_10k_train_000167 | 25,448 | no_license | [
{
"docstring": ":param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel",
"name": "__init__",
"signature": "def __init__(self, in_channel, out_channel=None, attn_dropout=0.1)"
},
{
"docstring": ":param x: the feature maps fro... | 2 | stack_v2_sparse_classes_30k_train_000141 | Implement the Python class `SelfAttention` described below.
Class description:
Implement the SelfAttention class.
Method signatures and docstrings:
- def __init__(self, in_channel, out_channel=None, attn_dropout=0.1): :param in_channel: previous layer's output feature dimension :param out_channel: size of output vect... | Implement the Python class `SelfAttention` described below.
Class description:
Implement the SelfAttention class.
Method signatures and docstrings:
- def __init__(self, in_channel, out_channel=None, attn_dropout=0.1): :param in_channel: previous layer's output feature dimension :param out_channel: size of output vect... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class SelfAttention:
def __init__(self, in_channel, out_channel=None, attn_dropout=0.1):
""":param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel"""
<|body_0|>
def forward(self, x):
""":param x: the f... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SelfAttention:
def __init__(self, in_channel, out_channel=None, attn_dropout=0.1):
""":param in_channel: previous layer's output feature dimension :param out_channel: size of output vector, defaults to in_channel"""
super(SelfAttention, self).__init__()
self.in_channel = in_channel
... | the_stack_v2_python_sparse | generated/test_Na_Z_attMPTI.py | jansel/pytorch-jit-paritybench | train | 35 | |
441a13a3359174644eab0deca73e2743880ee24e | [
"self._caffe = kwargs.pop('caffe')\nself._creator = kwargs.pop('creator')\nkwargs.setdefault('label_suffix', '')\nsuper(CashReportForm, self).__init__(*args, **kwargs)\nself.fields['cash_before_shift'].label = 'Pieniądze na początku zmiany'\nself.fields['cash_after_shift'].label = 'Pieniądze na końcu zmiany'\nself.... | <|body_start_0|>
self._caffe = kwargs.pop('caffe')
self._creator = kwargs.pop('creator')
kwargs.setdefault('label_suffix', '')
super(CashReportForm, self).__init__(*args, **kwargs)
self.fields['cash_before_shift'].label = 'Pieniądze na początku zmiany'
self.fields['cash_a... | Responsible for creating a cash report. | CashReportForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CashReportForm:
"""Responsible for creating a cash report."""
def __init__(self, *args, **kwargs):
"""Initialize all CashReport's fields."""
<|body_0|>
def save(self, commit=True):
"""Override of save method, to add Caffe relation."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k_train_000168 | 4,623 | permissive | [
{
"docstring": "Initialize all CashReport's fields.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Override of save method, to add Caffe relation.",
"name": "save",
"signature": "def save(self, commit=True)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004041 | Implement the Python class `CashReportForm` described below.
Class description:
Responsible for creating a cash report.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize all CashReport's fields.
- def save(self, commit=True): Override of save method, to add Caffe relation. | Implement the Python class `CashReportForm` described below.
Class description:
Responsible for creating a cash report.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize all CashReport's fields.
- def save(self, commit=True): Override of save method, to add Caffe relation.
<|skeleto... | cdb7f5edb29255c7e874eaa6231621063210a8b0 | <|skeleton|>
class CashReportForm:
"""Responsible for creating a cash report."""
def __init__(self, *args, **kwargs):
"""Initialize all CashReport's fields."""
<|body_0|>
def save(self, commit=True):
"""Override of save method, to add Caffe relation."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CashReportForm:
"""Responsible for creating a cash report."""
def __init__(self, *args, **kwargs):
"""Initialize all CashReport's fields."""
self._caffe = kwargs.pop('caffe')
self._creator = kwargs.pop('creator')
kwargs.setdefault('label_suffix', '')
super(CashRepo... | the_stack_v2_python_sparse | caffe/cash/forms.py | VirrageS/io-kawiarnie | train | 3 |
8a9de19a2119078c81cba6df4f4827a60f1dbd3e | [
"if category.prevent_custom_triggers_default:\n kwargs['initial'] = {'prevent_custom_triggers': True}\nsuper().__init__(*args, **kwargs)\nqs = Goal.objects.packages(categories=category)\nself.fields['packaged_goals'].queryset = qs\nif not category.display_prevent_custom_triggers_option:\n self.fields['prevent... | <|body_start_0|>
if category.prevent_custom_triggers_default:
kwargs['initial'] = {'prevent_custom_triggers': True}
super().__init__(*args, **kwargs)
qs = Goal.objects.packages(categories=category)
self.fields['packaged_goals'].queryset = qs
if not category.display_pr... | Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected. | PackageEnrollmentForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PackageEnrollmentForm:
"""Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected."""
def __init_... | stack_v2_sparse_classes_10k_train_000169 | 33,751 | permissive | [
{
"docstring": "Provide a specific category for this for in order to enroll users in it's set of Goals.",
"name": "__init__",
"signature": "def __init__(self, category, *args, **kwargs)"
},
{
"docstring": "Returns a list of email addresses.",
"name": "clean_email_addresses",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_001016 | Implement the Python class `PackageEnrollmentForm` described below.
Class description:
Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the go... | Implement the Python class `PackageEnrollmentForm` described below.
Class description:
Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the go... | 3d22179c581ab3da18900483930d5ecc0a5fca73 | <|skeleton|>
class PackageEnrollmentForm:
"""Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected."""
def __init_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PackageEnrollmentForm:
"""Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected."""
def __init__(self, categ... | the_stack_v2_python_sparse | tndata_backend/goals/forms.py | tndatacommons/tndata_backend | train | 1 |
56778de5b881080768a7b5fa6948ae8502eaa780 | [
"super().__init__(description.key, api, coordinator)\nself.field = description.field\nself.entity_description = description",
"all_data = self.coordinator.data\nvalue = self.api.get_field_value(all_data, self.field.name)\nself._attr_is_on = self.api.parse_value(value, DataType.BOOLEAN)\nsuper()._handle_coordinato... | <|body_start_0|>
super().__init__(description.key, api, coordinator)
self.field = description.field
self.entity_description = description
<|end_body_0|>
<|body_start_1|>
all_data = self.coordinator.data
value = self.api.get_field_value(all_data, self.field.name)
self._at... | Get sensor data from the Renson API and store it in the state of the class. | RensonBinarySensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RensonBinarySensor:
"""Get sensor data from the Renson API and store it in the state of the class."""
def __init__(self, description: RensonBinarySensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None:
"""Initialize class."""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_000170 | 4,041 | permissive | [
{
"docstring": "Initialize class.",
"name": "__init__",
"signature": "def __init__(self, description: RensonBinarySensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None"
},
{
"docstring": "Handle updated data from the coordinator.",
"name": "_handle_coordina... | 2 | null | Implement the Python class `RensonBinarySensor` described below.
Class description:
Get sensor data from the Renson API and store it in the state of the class.
Method signatures and docstrings:
- def __init__(self, description: RensonBinarySensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinato... | Implement the Python class `RensonBinarySensor` described below.
Class description:
Get sensor data from the Renson API and store it in the state of the class.
Method signatures and docstrings:
- def __init__(self, description: RensonBinarySensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinato... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class RensonBinarySensor:
"""Get sensor data from the Renson API and store it in the state of the class."""
def __init__(self, description: RensonBinarySensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None:
"""Initialize class."""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RensonBinarySensor:
"""Get sensor data from the Renson API and store it in the state of the class."""
def __init__(self, description: RensonBinarySensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None:
"""Initialize class."""
super().__init__(description.... | the_stack_v2_python_sparse | homeassistant/components/renson/binary_sensor.py | home-assistant/core | train | 35,501 |
7a4fd2dad2aee7ee19844d35f283550ac2d5326a | [
"if N == 1:\n s = '0'\nelse:\n s = '01'\n for i in range(N - 2):\n l = len(s) // 2\n half_1 = s[0:l]\n half_2 = s[l:]\n a = half_2 + half_1\n s += a\nreturn int(s[K - 1])",
"if N == 1:\n return 0\nwhere = [K]\nwhile K != 1:\n next_k = (where[-1] + 1) // 2\n whe... | <|body_start_0|>
if N == 1:
s = '0'
else:
s = '01'
for i in range(N - 2):
l = len(s) // 2
half_1 = s[0:l]
half_2 = s[l:]
a = half_2 + half_1
s += a
return int(s[K - 1])
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kthGrammar(self, N, K):
""":type N: int :type K: int :rtype: int"""
<|body_0|>
def kthGrammar_1(self, N, K):
""":type N: int :type K: int :rtype: int 31ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if N == 1:
s = '0'
... | stack_v2_sparse_classes_10k_train_000171 | 1,984 | no_license | [
{
"docstring": ":type N: int :type K: int :rtype: int",
"name": "kthGrammar",
"signature": "def kthGrammar(self, N, K)"
},
{
"docstring": ":type N: int :type K: int :rtype: int 31ms",
"name": "kthGrammar_1",
"signature": "def kthGrammar_1(self, N, K)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthGrammar(self, N, K): :type N: int :type K: int :rtype: int
- def kthGrammar_1(self, N, K): :type N: int :type K: int :rtype: int 31ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthGrammar(self, N, K): :type N: int :type K: int :rtype: int
- def kthGrammar_1(self, N, K): :type N: int :type K: int :rtype: int 31ms
<|skeleton|>
class Solution:
de... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def kthGrammar(self, N, K):
""":type N: int :type K: int :rtype: int"""
<|body_0|>
def kthGrammar_1(self, N, K):
""":type N: int :type K: int :rtype: int 31ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def kthGrammar(self, N, K):
""":type N: int :type K: int :rtype: int"""
if N == 1:
s = '0'
else:
s = '01'
for i in range(N - 2):
l = len(s) // 2
half_1 = s[0:l]
half_2 = s[l:]
... | the_stack_v2_python_sparse | KthSymbolInGrammar_MID_779.py | 953250587/leetcode-python | train | 2 | |
722d3ede88ebaaf5454afa6e5735667e641c8034 | [
"self.sum_ = []\ntemp = 0\nfor i in nums:\n temp += i\n self.sum_.append(temp)",
"if i == 0:\n return self.sum_[j]\nreturn self.sum_[j] - self.sum_[i - 1]"
] | <|body_start_0|>
self.sum_ = []
temp = 0
for i in nums:
temp += i
self.sum_.append(temp)
<|end_body_0|>
<|body_start_1|>
if i == 0:
return self.sum_[j]
return self.sum_[j] - self.sum_[i - 1]
<|end_body_1|>
| NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.sum_ = []
temp = 0
for i in nums:
... | stack_v2_sparse_classes_10k_train_000172 | 548 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, i, j)"
}
] | 2 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int
<|skeleton|>
class NumArray:
def __init__(self, nums):
... | 9aed6e84fbe48090382744dd103843fec43ccce9 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
self.sum_ = []
temp = 0
for i in nums:
temp += i
self.sum_.append(temp)
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
if i == 0:
retu... | the_stack_v2_python_sparse | python/303_NumArray.py | LeonhardtWang/leetcode-train | train | 1 | |
1f9475dbb9aaeb60cb36be07860e5ed441e79773 | [
"self.trie = Trie()\nfor w, f in zip(sentences, times):\n self.trie.insert(w, f)\nself.prefix = ''",
"if c == '#':\n self.trie.insert(self.prefix, 1)\n self.prefix = ''\n return []\nelse:\n start_pointer = self.trie.search(self.prefix)\n if not start_pointer:\n return []\n freq_words =... | <|body_start_0|>
self.trie = Trie()
for w, f in zip(sentences, times):
self.trie.insert(w, f)
self.prefix = ''
<|end_body_0|>
<|body_start_1|>
if c == '#':
self.trie.insert(self.prefix, 1)
self.prefix = ''
return []
else:
... | AutocompleteSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.trie = Trie()
... | stack_v2_sparse_classes_10k_train_000173 | 5,655 | no_license | [
{
"docstring": ":type sentences: List[str] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, sentences, times)"
},
{
"docstring": ":type c: str :rtype: List[str]",
"name": "input",
"signature": "def input(self, c)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006780 | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str] | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str]
<|skeleton|>
cla... | 04716049fab1e8e35157c4baa2d496826d3e0884 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
self.trie = Trie()
for w, f in zip(sentences, times):
self.trie.insert(w, f)
self.prefix = ''
def input(self, c):
""":type c: str :rtype: L... | the_stack_v2_python_sparse | amazon/design_search_autocomplete.py | cyberbono3/leetcode | train | 0 | |
d10a819c69ab93c29fefaaf9c9639187fc87daf7 | [
"if _debug:\n ConfigArgumentParser._debug('__init__')\nArgumentParser.__init__(self, **kwargs)\nself.add_argument('--ini', help='device object configuration file', default=BACPYPES_INI)",
"if _debug:\n ConfigArgumentParser._debug('parse_args')\nresult_args = ArgumentParser.parse_args(self, *args, **kwargs)\... | <|body_start_0|>
if _debug:
ConfigArgumentParser._debug('__init__')
ArgumentParser.__init__(self, **kwargs)
self.add_argument('--ini', help='device object configuration file', default=BACPYPES_INI)
<|end_body_0|>
<|body_start_1|>
if _debug:
ConfigArgumentParser._... | ConfigArgumentParser extends the ArgumentParser with the functionality to read in a configuration file. --ini INI provide a separate INI file | ConfigArgumentParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigArgumentParser:
"""ConfigArgumentParser extends the ArgumentParser with the functionality to read in a configuration file. --ini INI provide a separate INI file"""
def __init__(self, **kwargs):
"""Follow normal initialization and add BACpypes arguments."""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_000174 | 7,777 | permissive | [
{
"docstring": "Follow normal initialization and add BACpypes arguments.",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Parse the arguments as usual, then add default processing.",
"name": "parse_args",
"signature": "def parse_args(self, *args, **kwa... | 2 | stack_v2_sparse_classes_30k_val_000120 | Implement the Python class `ConfigArgumentParser` described below.
Class description:
ConfigArgumentParser extends the ArgumentParser with the functionality to read in a configuration file. --ini INI provide a separate INI file
Method signatures and docstrings:
- def __init__(self, **kwargs): Follow normal initializa... | Implement the Python class `ConfigArgumentParser` described below.
Class description:
ConfigArgumentParser extends the ArgumentParser with the functionality to read in a configuration file. --ini INI provide a separate INI file
Method signatures and docstrings:
- def __init__(self, **kwargs): Follow normal initializa... | a5be2ad5ac69821c12299716b167dd52041b5342 | <|skeleton|>
class ConfigArgumentParser:
"""ConfigArgumentParser extends the ArgumentParser with the functionality to read in a configuration file. --ini INI provide a separate INI file"""
def __init__(self, **kwargs):
"""Follow normal initialization and add BACpypes arguments."""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConfigArgumentParser:
"""ConfigArgumentParser extends the ArgumentParser with the functionality to read in a configuration file. --ini INI provide a separate INI file"""
def __init__(self, **kwargs):
"""Follow normal initialization and add BACpypes arguments."""
if _debug:
Con... | the_stack_v2_python_sparse | py25/bacpypes/consolelogging.py | JoelBender/bacpypes | train | 284 |
93e5989775c1779db6095dc63156b6743d503b4e | [
"author = g.user\ntags = TagModel.query.filter_by(author_id=author.id).all()\nif not tags:\n abort(404, error=f'No tags yet')\nreturn (tags, 200)",
"author = g.user\ntag = TagModel(author_id=author.id, **kwargs)\ntry:\n tag.save()\n return (tag, 201)\nexcept:\n abort(404, error=f'An error occurred whi... | <|body_start_0|>
author = g.user
tags = TagModel.query.filter_by(author_id=author.id).all()
if not tags:
abort(404, error=f'No tags yet')
return (tags, 200)
<|end_body_0|>
<|body_start_1|>
author = g.user
tag = TagModel(author_id=author.id, **kwargs)
... | TagListResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TagListResource:
def get(self):
"""Возвращает все теги пользователя Требуется аутентификация. :return: теги"""
<|body_0|>
def post(self, **kwargs):
"""Создает тег пользователя. Требуется аутентификация. :param kwargs: параметры для создания тега :return: тег"""
... | stack_v2_sparse_classes_10k_train_000175 | 3,928 | no_license | [
{
"docstring": "Возвращает все теги пользователя Требуется аутентификация. :return: теги",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Создает тег пользователя. Требуется аутентификация. :param kwargs: параметры для создания тега :return: тег",
"name": "post",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_005887 | Implement the Python class `TagListResource` described below.
Class description:
Implement the TagListResource class.
Method signatures and docstrings:
- def get(self): Возвращает все теги пользователя Требуется аутентификация. :return: теги
- def post(self, **kwargs): Создает тег пользователя. Требуется аутентификац... | Implement the Python class `TagListResource` described below.
Class description:
Implement the TagListResource class.
Method signatures and docstrings:
- def get(self): Возвращает все теги пользователя Требуется аутентификация. :return: теги
- def post(self, **kwargs): Создает тег пользователя. Требуется аутентификац... | adb9a3f4524ab76e8ba656344e2ed452e87b577c | <|skeleton|>
class TagListResource:
def get(self):
"""Возвращает все теги пользователя Требуется аутентификация. :return: теги"""
<|body_0|>
def post(self, **kwargs):
"""Создает тег пользователя. Требуется аутентификация. :param kwargs: параметры для создания тега :return: тег"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TagListResource:
def get(self):
"""Возвращает все теги пользователя Требуется аутентификация. :return: теги"""
author = g.user
tags = TagModel.query.filter_by(author_id=author.id).all()
if not tags:
abort(404, error=f'No tags yet')
return (tags, 200)
de... | the_stack_v2_python_sparse | api/resources/tag.py | UshakovAleksandr/Blog | train | 1 | |
3016ba5a42230ec9b57ddb900b25fec87ec6d4b4 | [
"self.k = k\nself.queue = []\nheapq.heapify(self.queue)\nfor i, n in enumerate(nums):\n if i < k:\n heapq.heappush(self.queue, n)\n elif n > self.queue[0]:\n heapq.heappop(self.queue)\n heapq.heappush(self.queue, n)",
"if not self.queue or len(self.queue) < self.k:\n heapq.heappush(s... | <|body_start_0|>
self.k = k
self.queue = []
heapq.heapify(self.queue)
for i, n in enumerate(nums):
if i < k:
heapq.heappush(self.queue, n)
elif n > self.queue[0]:
heapq.heappop(self.queue)
heapq.heappush(self.queue, ... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.queue = []
heapq.heapify(s... | stack_v2_sparse_classes_10k_train_000176 | 783 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006722 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | b4fc2ba621f3484973c0520b02c60e5ed1930722 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.queue = []
heapq.heapify(self.queue)
for i, n in enumerate(nums):
if i < k:
heapq.heappush(self.queue, n)
elif n > self.queue[0]:
... | the_stack_v2_python_sparse | 703_KthLargest_heap.py | Black-Mamba24/leetcode-python | train | 0 | |
7d91990aab45f03088e6b2efbc2c240adaf2710c | [
"self.logger = ServerLogger(__name__, debug=debug)\nif test:\n self._PAYLOAD_FILE = 'securetea/lib/log_monitor/server_log/rules/payloads/bad_ua.txt'\nelse:\n self._PAYLOAD_FILE = '/etc/securetea/log_monitor/server_log/payloads/bad_ua.txt'\nself.payloads = utils.open_file(self._PAYLOAD_FILE)\nself._THRESHOLD =... | <|body_start_0|>
self.logger = ServerLogger(__name__, debug=debug)
if test:
self._PAYLOAD_FILE = 'securetea/lib/log_monitor/server_log/rules/payloads/bad_ua.txt'
else:
self._PAYLOAD_FILE = '/etc/securetea/log_monitor/server_log/payloads/bad_ua.txt'
self.payloads =... | SpiderDetect Class. | SpiderDetect | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpiderDetect:
"""SpiderDetect Class."""
def __init__(self, debug=False, test=False):
"""Initialize SpiderDetect. Args: debug (bool): Log on terminal or not Raises: None Returns: None"""
<|body_0|>
def detect_spider(self, data):
"""Detect possible Web Crawler / Sp... | stack_v2_sparse_classes_10k_train_000177 | 4,102 | permissive | [
{
"docstring": "Initialize SpiderDetect. Args: debug (bool): Log on terminal or not Raises: None Returns: None",
"name": "__init__",
"signature": "def __init__(self, debug=False, test=False)"
},
{
"docstring": "Detect possible Web Crawler / Spider / Bad user agents. High amount of unique GET req... | 3 | stack_v2_sparse_classes_30k_train_001034 | Implement the Python class `SpiderDetect` described below.
Class description:
SpiderDetect Class.
Method signatures and docstrings:
- def __init__(self, debug=False, test=False): Initialize SpiderDetect. Args: debug (bool): Log on terminal or not Raises: None Returns: None
- def detect_spider(self, data): Detect poss... | Implement the Python class `SpiderDetect` described below.
Class description:
SpiderDetect Class.
Method signatures and docstrings:
- def __init__(self, debug=False, test=False): Initialize SpiderDetect. Args: debug (bool): Log on terminal or not Raises: None Returns: None
- def detect_spider(self, data): Detect poss... | 43dec187e5848b9ced8a6b4957b6e9028d4d43cd | <|skeleton|>
class SpiderDetect:
"""SpiderDetect Class."""
def __init__(self, debug=False, test=False):
"""Initialize SpiderDetect. Args: debug (bool): Log on terminal or not Raises: None Returns: None"""
<|body_0|>
def detect_spider(self, data):
"""Detect possible Web Crawler / Sp... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SpiderDetect:
"""SpiderDetect Class."""
def __init__(self, debug=False, test=False):
"""Initialize SpiderDetect. Args: debug (bool): Log on terminal or not Raises: None Returns: None"""
self.logger = ServerLogger(__name__, debug=debug)
if test:
self._PAYLOAD_FILE = 'se... | the_stack_v2_python_sparse | securetea/lib/log_monitor/server_log/detect/recon/spider.py | rejahrehim/SecureTea-Project | train | 1 |
a4d9f9fc3acf8095df6ead79c1c8113adc09d09b | [
"line = 'hello world, this is some téśt data!'\nmember = chrome_app.apis.api_member_used(line)\nself.assertIsNone(member)\nline = 'hello world, this is some téśt data!'\nmember = chrome_app.apis.api_member_used(line)\nself.assertIsNone(member)",
"line = 'hello world, this test data uses chrome.tts.speak, test tes... | <|body_start_0|>
line = 'hello world, this is some téśt data!'
member = chrome_app.apis.api_member_used(line)
self.assertIsNone(member)
line = 'hello world, this is some téśt data!'
member = chrome_app.apis.api_member_used(line)
self.assertIsNone(member)
<|end_body_0|>
<... | Tests api_member_used. | TestApiMemberUsed | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestApiMemberUsed:
"""Tests api_member_used."""
def test_no_member(self):
"""Tests that if there is no member, None is returned."""
<|body_0|>
def test_api_member(self):
"""Tests that a member is picked up in the input string."""
<|body_1|>
def test_... | stack_v2_sparse_classes_10k_train_000178 | 3,679 | permissive | [
{
"docstring": "Tests that if there is no member, None is returned.",
"name": "test_no_member",
"signature": "def test_no_member(self)"
},
{
"docstring": "Tests that a member is picked up in the input string.",
"name": "test_api_member",
"signature": "def test_api_member(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_006909 | Implement the Python class `TestApiMemberUsed` described below.
Class description:
Tests api_member_used.
Method signatures and docstrings:
- def test_no_member(self): Tests that if there is no member, None is returned.
- def test_api_member(self): Tests that a member is picked up in the input string.
- def test_chro... | Implement the Python class `TestApiMemberUsed` described below.
Class description:
Tests api_member_used.
Method signatures and docstrings:
- def test_no_member(self): Tests that if there is no member, None is returned.
- def test_api_member(self): Tests that a member is picked up in the input string.
- def test_chro... | 985419af32f9bbd3abc934db3edc09523477118a | <|skeleton|>
class TestApiMemberUsed:
"""Tests api_member_used."""
def test_no_member(self):
"""Tests that if there is no member, None is returned."""
<|body_0|>
def test_api_member(self):
"""Tests that a member is picked up in the input string."""
<|body_1|>
def test_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestApiMemberUsed:
"""Tests api_member_used."""
def test_no_member(self):
"""Tests that if there is no member, None is returned."""
line = 'hello world, this is some téśt data!'
member = chrome_app.apis.api_member_used(line)
self.assertIsNone(member)
line = 'hello ... | the_stack_v2_python_sparse | src/chrome_app/apis_test.py | HoeDetector/caterpillar | train | 0 |
91c97ce7766e396254f0aa336e7154f161a748dc | [
"headers = {}\nif create_update_metadata:\n for key in create_update_metadata:\n metadata_header_name = create_update_metadata_prefix + key\n headers[metadata_header_name] = create_update_metadata[key]\nif delete_metadata:\n for key in delete_metadata:\n headers[delete_metadata_prefix + k... | <|body_start_0|>
headers = {}
if create_update_metadata:
for key in create_update_metadata:
metadata_header_name = create_update_metadata_prefix + key
headers[metadata_header_name] = create_update_metadata[key]
if delete_metadata:
for key i... | AccountClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountClient:
def create_update_or_delete_account_metadata(self, create_update_metadata=None, delete_metadata=None, create_update_metadata_prefix='X-Account-Meta-', delete_metadata_prefix='X-Remove-Account-Meta-'):
"""Creates, Updates or deletes an account metadata entry. Account Metada... | stack_v2_sparse_classes_10k_train_000179 | 3,052 | permissive | [
{
"docstring": "Creates, Updates or deletes an account metadata entry. Account Metadata can be created, updated or deleted based on metadata header or value. For detailed info, please refer to the official API reference: https://docs.openstack.org/api-ref/object-store/#create-update-or-delete-account-metadata",... | 3 | stack_v2_sparse_classes_30k_train_001482 | Implement the Python class `AccountClient` described below.
Class description:
Implement the AccountClient class.
Method signatures and docstrings:
- def create_update_or_delete_account_metadata(self, create_update_metadata=None, delete_metadata=None, create_update_metadata_prefix='X-Account-Meta-', delete_metadata_p... | Implement the Python class `AccountClient` described below.
Class description:
Implement the AccountClient class.
Method signatures and docstrings:
- def create_update_or_delete_account_metadata(self, create_update_metadata=None, delete_metadata=None, create_update_metadata_prefix='X-Account-Meta-', delete_metadata_p... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class AccountClient:
def create_update_or_delete_account_metadata(self, create_update_metadata=None, delete_metadata=None, create_update_metadata_prefix='X-Account-Meta-', delete_metadata_prefix='X-Remove-Account-Meta-'):
"""Creates, Updates or deletes an account metadata entry. Account Metada... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AccountClient:
def create_update_or_delete_account_metadata(self, create_update_metadata=None, delete_metadata=None, create_update_metadata_prefix='X-Account-Meta-', delete_metadata_prefix='X-Remove-Account-Meta-'):
"""Creates, Updates or deletes an account metadata entry. Account Metadata can be crea... | the_stack_v2_python_sparse | tempest/lib/services/object_storage/account_client.py | openstack/tempest | train | 270 | |
965f1d6339bb5141077ffce23364bb82ab3b5900 | [
"self.has_value = False\nself.value = None\nself.event = threading.Event()\nself.exception = None\npromise_callback = PromiseCallback(self, callback, *args, **kwargs)\npromise_thread = threading.Thread(target=promise_callback)\npromise_thread.start()",
"try:\n self.value = callback(*args, **kwargs)\nexcept Exc... | <|body_start_0|>
self.has_value = False
self.value = None
self.event = threading.Event()
self.exception = None
promise_callback = PromiseCallback(self, callback, *args, **kwargs)
promise_thread = threading.Thread(target=promise_callback)
promise_thread.start()
<|e... | Class for promises to deliver a value in the future. A thread is started to run callback(args), that thread should return the value that it generates, or raise an expception. p.WaitAndGetValue() will block until a value is available. If an exception was raised, p.WaitAndGetValue() will re-raise the same exception. | Promise | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Promise:
"""Class for promises to deliver a value in the future. A thread is started to run callback(args), that thread should return the value that it generates, or raise an expception. p.WaitAndGetValue() will block until a value is available. If an exception was raised, p.WaitAndGetValue() wil... | stack_v2_sparse_classes_10k_train_000180 | 21,209 | permissive | [
{
"docstring": "Initialize the promise and immediately call the supplied function. Args: callback: Function that takes the args and returns the promise value. *args: Any arguments to the target function. **kwargs: Any keyword args for the target function.",
"name": "__init__",
"signature": "def __init__... | 3 | null | Implement the Python class `Promise` described below.
Class description:
Class for promises to deliver a value in the future. A thread is started to run callback(args), that thread should return the value that it generates, or raise an expception. p.WaitAndGetValue() will block until a value is available. If an except... | Implement the Python class `Promise` described below.
Class description:
Class for promises to deliver a value in the future. A thread is started to run callback(args), that thread should return the value that it generates, or raise an expception. p.WaitAndGetValue() will block until a value is available. If an except... | b5d4783f99461438ca9e6a477535617fadab6ba3 | <|skeleton|>
class Promise:
"""Class for promises to deliver a value in the future. A thread is started to run callback(args), that thread should return the value that it generates, or raise an expception. p.WaitAndGetValue() will block until a value is available. If an exception was raised, p.WaitAndGetValue() wil... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Promise:
"""Class for promises to deliver a value in the future. A thread is started to run callback(args), that thread should return the value that it generates, or raise an expception. p.WaitAndGetValue() will block until a value is available. If an exception was raised, p.WaitAndGetValue() will re-raise th... | the_stack_v2_python_sparse | appengine/monorail/framework/framework_helpers.py | xinghun61/infra | train | 2 |
c7c9a249d55290e3c80faac5db659750fd379b50 | [
"self.aux_weight = aux_weight\nloss_base_cp = loss_base.copy()\nloss_base_name = loss_base_cp.pop('type')\nif ClassFactory.is_exists('trainer.loss', loss_base_name):\n loss_class = ClassFactory.get_cls('trainer.loss', loss_base_name)\nelse:\n loss_class = getattr(importlib.import_module('tensorflow.losses'), ... | <|body_start_0|>
self.aux_weight = aux_weight
loss_base_cp = loss_base.copy()
loss_base_name = loss_base_cp.pop('type')
if ClassFactory.is_exists('trainer.loss', loss_base_name):
loss_class = ClassFactory.get_cls('trainer.loss', loss_base_name)
else:
loss_... | Class of Mix Auxiliary Loss. :param aux_weight: auxiliary loss weight :type aux_weight: float :loss_base: base loss function :loss_base: str | MixAuxiliaryLoss | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MixAuxiliaryLoss:
"""Class of Mix Auxiliary Loss. :param aux_weight: auxiliary loss weight :type aux_weight: float :loss_base: base loss function :loss_base: str"""
def __init__(self, aux_weight, loss_base):
"""Init MixAuxiliaryLoss."""
<|body_0|>
def __call__(self, logi... | stack_v2_sparse_classes_10k_train_000181 | 1,827 | permissive | [
{
"docstring": "Init MixAuxiliaryLoss.",
"name": "__init__",
"signature": "def __init__(self, aux_weight, loss_base)"
},
{
"docstring": "Loss forward function.",
"name": "__call__",
"signature": "def __call__(self, logits, labels)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002401 | Implement the Python class `MixAuxiliaryLoss` described below.
Class description:
Class of Mix Auxiliary Loss. :param aux_weight: auxiliary loss weight :type aux_weight: float :loss_base: base loss function :loss_base: str
Method signatures and docstrings:
- def __init__(self, aux_weight, loss_base): Init MixAuxiliar... | Implement the Python class `MixAuxiliaryLoss` described below.
Class description:
Class of Mix Auxiliary Loss. :param aux_weight: auxiliary loss weight :type aux_weight: float :loss_base: base loss function :loss_base: str
Method signatures and docstrings:
- def __init__(self, aux_weight, loss_base): Init MixAuxiliar... | 12e37a1991eb6771a2999fe0a46ddda920c47948 | <|skeleton|>
class MixAuxiliaryLoss:
"""Class of Mix Auxiliary Loss. :param aux_weight: auxiliary loss weight :type aux_weight: float :loss_base: base loss function :loss_base: str"""
def __init__(self, aux_weight, loss_base):
"""Init MixAuxiliaryLoss."""
<|body_0|>
def __call__(self, logi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MixAuxiliaryLoss:
"""Class of Mix Auxiliary Loss. :param aux_weight: auxiliary loss weight :type aux_weight: float :loss_base: base loss function :loss_base: str"""
def __init__(self, aux_weight, loss_base):
"""Init MixAuxiliaryLoss."""
self.aux_weight = aux_weight
loss_base_cp = ... | the_stack_v2_python_sparse | vega/networks/tensorflow/losses/mix_auxiliary_loss.py | huawei-noah/vega | train | 850 |
42a999234b876fab73f16660a6c6d8a2d6aa2612 | [
"self.ListOfUrl = ListOfUrl\nself.url = None\nself.usr_agent = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}\nself.directory = os.getcwd()\nself.alt_dict = {}\nself.title_dict = {}\nself.h2_dict = {}\nself.h3_dict = {}",
"i = ... | <|body_start_0|>
self.ListOfUrl = ListOfUrl
self.url = None
self.usr_agent = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
self.directory = os.getcwd()
self.alt_dict = {}
self.title_di... | FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency. | FetchTags | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FetchTags:
"""FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency."""
def __init__(self, ListOfUrl):
"""__init__ method takes L... | stack_v2_sparse_classes_10k_train_000182 | 5,116 | permissive | [
{
"docstring": "__init__ method takes ListOfUrl generated by SearchResuts module",
"name": "__init__",
"signature": "def __init__(self, ListOfUrl)"
},
{
"docstring": "get_results method returns 4 dictionaries with keywords as keys and their frecuency as value",
"name": "get_results",
"si... | 6 | null | Implement the Python class `FetchTags` described below.
Class description:
FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency.
Method signatures and docstrings:... | Implement the Python class `FetchTags` described below.
Class description:
FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency.
Method signatures and docstrings:... | 31fd3fb1233f39ea2252a7a44160ff8a2140f7bd | <|skeleton|>
class FetchTags:
"""FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency."""
def __init__(self, ListOfUrl):
"""__init__ method takes L... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FetchTags:
"""FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency."""
def __init__(self, ListOfUrl):
"""__init__ method takes ListOfUrl gene... | the_stack_v2_python_sparse | Python/Tags_Scraper/Fetch_Tags.py | HarshCasper/Rotten-Scripts | train | 1,474 |
41fa99d6de5ae139cacd40bb2788d0d5a93a4391 | [
"if not root:\n return True\nreturn self.is_symmetric_recursive(root)",
"def recursion(node1, node2):\n if not node1 and (not node2):\n return True\n return bool(node1) and bool(node2) and (node1.val == node2.val) and recursion(node1.left, node2.right) and recursion(node1.right, node2.left)\nretur... | <|body_start_0|>
if not root:
return True
return self.is_symmetric_recursive(root)
<|end_body_0|>
<|body_start_1|>
def recursion(node1, node2):
if not node1 and (not node2):
return True
return bool(node1) and bool(node2) and (node1.val == node... | Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None"""
def is_symmetric(self, root):
"""Determine whether a given binary tree is left-right sym... | stack_v2_sparse_classes_10k_train_000183 | 3,129 | no_license | [
{
"docstring": "Determine whether a given binary tree is left-right symmetric. :type root: TreeNode :rtype: bool",
"name": "is_symmetric",
"signature": "def is_symmetric(self, root)"
},
{
"docstring": "Symmetric tree: recursive solution.",
"name": "is_symmetric_recursive",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_001799 | Implement the Python class `Solution` described below.
Class description:
Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None
Method signatures and docstrings:
- def is_symmetric(self, root)... | Implement the Python class `Solution` described below.
Class description:
Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None
Method signatures and docstrings:
- def is_symmetric(self, root)... | e11bfc454789e716055b80873af0817ec8588aea | <|skeleton|>
class Solution:
"""Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None"""
def is_symmetric(self, root):
"""Determine whether a given binary tree is left-right sym... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
"""Solution to Leetcode problem 101: Symmetric Tree. Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None"""
def is_symmetric(self, root):
"""Determine whether a given binary tree is left-right symmetric. :type... | the_stack_v2_python_sparse | p101/problem101.py | stanl3y/leetcode | train | 0 |
7cfef27a5e2f6b24db56e3e8b53e9c800420064d | [
"self.instresult = instresult\nself.number = number\nself.measures = {}",
"if measures == '':\n for name in sorted(self.measures.keys()):\n yield (name, self.measures[name][0], self.measures[name][1])\nelse:\n for name, _ in measures:\n if name in self.measures:\n yield (name, self.... | <|body_start_0|>
self.instresult = instresult
self.number = number
self.measures = {}
<|end_body_0|>
<|body_start_1|>
if measures == '':
for name in sorted(self.measures.keys()):
yield (name, self.measures[name][0], self.measures[name][1])
else:
... | Represents the result of an individual run of a benchmark instance. | Run | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Run:
"""Represents the result of an individual run of a benchmark instance."""
def __init__(self, instresult, number):
"""Initializes a benchmark result. Keyword arguments: instresult - The associated instance result number - The number of the run"""
<|body_0|>
def iter(... | stack_v2_sparse_classes_10k_train_000184 | 13,530 | no_license | [
{
"docstring": "Initializes a benchmark result. Keyword arguments: instresult - The associated instance result number - The number of the run",
"name": "__init__",
"signature": "def __init__(self, instresult, number)"
},
{
"docstring": "Creates an iterator over all measures captured during the r... | 2 | stack_v2_sparse_classes_30k_train_004749 | Implement the Python class `Run` described below.
Class description:
Represents the result of an individual run of a benchmark instance.
Method signatures and docstrings:
- def __init__(self, instresult, number): Initializes a benchmark result. Keyword arguments: instresult - The associated instance result number - T... | Implement the Python class `Run` described below.
Class description:
Represents the result of an individual run of a benchmark instance.
Method signatures and docstrings:
- def __init__(self, instresult, number): Initializes a benchmark result. Keyword arguments: instresult - The associated instance result number - T... | b8e36b457e5a2d3257ddbb308dd7d621f6cd4d86 | <|skeleton|>
class Run:
"""Represents the result of an individual run of a benchmark instance."""
def __init__(self, instresult, number):
"""Initializes a benchmark result. Keyword arguments: instresult - The associated instance result number - The number of the run"""
<|body_0|>
def iter(... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Run:
"""Represents the result of an individual run of a benchmark instance."""
def __init__(self, instresult, number):
"""Initializes a benchmark result. Keyword arguments: instresult - The associated instance result number - The number of the run"""
self.instresult = instresult
s... | the_stack_v2_python_sparse | src/benchmarktool/result/result.py | daajoe/benchmark-tool | train | 3 |
55e10c0109b6299d648126ae16c8f30485d7968b | [
"self.nsamp = nsamp\nself.mingap = mingap\nif lookback_samples == None:\n lookback_samples = nsamp * 4\nself.lookback_samples = lookback_samples\nself.reset(nseen=nseen, **kwargs)",
"self.nseen = nseen\nself.active = []\nself.lookback = None\nself.onreset(**kwargs)",
"full = []\nif self.lookback == None:\n ... | <|body_start_0|>
self.nsamp = nsamp
self.mingap = mingap
if lookback_samples == None:
lookback_samples = nsamp * 4
self.lookback_samples = lookback_samples
self.reset(nseen=nseen, **kwargs)
<|end_body_0|>
<|body_start_1|>
self.nseen = nseen
self.activ... | TriggerlessTrapSequence | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerlessTrapSequence:
def __init__(self, nsamp, mingap=0, nseen=0, lookback_samples=None, **kwargs):
"""Like a TrapSequence, but for use in situations where there is no trigger channel. Instead, each epoch is triggered when a particular "event offset" is supplied while processing a si... | stack_v2_sparse_classes_10k_train_000185 | 19,507 | no_license | [
{
"docstring": "Like a TrapSequence, but for use in situations where there is no trigger channel. Instead, each epoch is triggered when a particular \"event offset\" is supplied while processing a signal packet. The event offset dictates when, in samples relative to the start of the packet being processed, a ne... | 3 | stack_v2_sparse_classes_30k_train_004907 | Implement the Python class `TriggerlessTrapSequence` described below.
Class description:
Implement the TriggerlessTrapSequence class.
Method signatures and docstrings:
- def __init__(self, nsamp, mingap=0, nseen=0, lookback_samples=None, **kwargs): Like a TrapSequence, but for use in situations where there is no trig... | Implement the Python class `TriggerlessTrapSequence` described below.
Class description:
Implement the TriggerlessTrapSequence class.
Method signatures and docstrings:
- def __init__(self, nsamp, mingap=0, nseen=0, lookback_samples=None, **kwargs): Like a TrapSequence, but for use in situations where there is no trig... | 9db5556f204516467515defd6a6b93991df4ffe7 | <|skeleton|>
class TriggerlessTrapSequence:
def __init__(self, nsamp, mingap=0, nseen=0, lookback_samples=None, **kwargs):
"""Like a TrapSequence, but for use in situations where there is no trigger channel. Instead, each epoch is triggered when a particular "event offset" is supplied while processing a si... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TriggerlessTrapSequence:
def __init__(self, nsamp, mingap=0, nseen=0, lookback_samples=None, **kwargs):
"""Like a TrapSequence, but for use in situations where there is no trigger channel. Instead, each epoch is triggered when a particular "event offset" is supplied while processing a signal packet. T... | the_stack_v2_python_sparse | SigTools/Buffering4417.py | neurotechcenter/BCpy2000 | train | 9 | |
69c61670c91bf5714be11c990282ae2e3581ac0c | [
"if not s:\n return ''\nres = s\ns = '#' + '#'.join(list(s)) + '#'\nlength = len(s)\nmid = length // 2\nfor i in range(mid, -1, -1):\n left = i - 1\n right = i + 1\n flag = True\n while left >= 0 and right < length and flag:\n if s[left] != s[right]:\n flag = False\n left -= ... | <|body_start_0|>
if not s:
return ''
res = s
s = '#' + '#'.join(list(s)) + '#'
length = len(s)
mid = length // 2
for i in range(mid, -1, -1):
left = i - 1
right = i + 1
flag = True
while left >= 0 and right < len... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def shortestPalindrome(self, s: str) -> str:
"""超时解法"""
<|body_0|>
def shortestPalindrom1e(self, s: str) -> str:
"""kmp 永远滴神"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not s:
return ''
res = s
s = '#' + ... | stack_v2_sparse_classes_10k_train_000186 | 1,709 | no_license | [
{
"docstring": "超时解法",
"name": "shortestPalindrome",
"signature": "def shortestPalindrome(self, s: str) -> str"
},
{
"docstring": "kmp 永远滴神",
"name": "shortestPalindrom1e",
"signature": "def shortestPalindrom1e(self, s: str) -> str"
}
] | 2 | stack_v2_sparse_classes_30k_train_004726 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestPalindrome(self, s: str) -> str: 超时解法
- def shortestPalindrom1e(self, s: str) -> str: kmp 永远滴神 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestPalindrome(self, s: str) -> str: 超时解法
- def shortestPalindrom1e(self, s: str) -> str: kmp 永远滴神
<|skeleton|>
class Solution:
def shortestPalindrome(self, s: str)... | 40726506802d2d60028fdce206696b1df2f63ece | <|skeleton|>
class Solution:
def shortestPalindrome(self, s: str) -> str:
"""超时解法"""
<|body_0|>
def shortestPalindrom1e(self, s: str) -> str:
"""kmp 永远滴神"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def shortestPalindrome(self, s: str) -> str:
"""超时解法"""
if not s:
return ''
res = s
s = '#' + '#'.join(list(s)) + '#'
length = len(s)
mid = length // 2
for i in range(mid, -1, -1):
left = i - 1
right = i + 1
... | the_stack_v2_python_sparse | 二刷+题解/每日一题/shortestPalindrome.py | 1oser5/LeetCode | train | 0 | |
d4bf45420edd8bda00e72acc9168c4f09b3bd65d | [
"if method == 'POST':\n path = '/api/rest/subscription/%s/@self/@app' % os_user_id\nelif method == 'GET':\n path = '/api/rest/subscription/%s/@self/@app/%s' % (os_user_id, transaction_id)\nreturn path",
"path = self._api_path(method, os_user_id, transaction_id)\nLog.debug('MonthlypaymentGree:_api_request')\... | <|body_start_0|>
if method == 'POST':
path = '/api/rest/subscription/%s/@self/@app' % os_user_id
elif method == 'GET':
path = '/api/rest/subscription/%s/@self/@app/%s' % (os_user_id, transaction_id)
return path
<|end_body_0|>
<|body_start_1|>
path = self._api_pat... | Monthly Payment API Greeクラス Monthly Payment API Gree Class | MonthlypaymentGree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonthlypaymentGree:
"""Monthly Payment API Greeクラス Monthly Payment API Gree Class"""
def _api_path(self, method, os_user_id, transaction_id=None):
"""apiリスエスト用のpath生成 Create paths for api request"""
<|body_0|>
def _api_request(self, method, os_user_id, transaction_id=Non... | stack_v2_sparse_classes_10k_train_000187 | 2,766 | no_license | [
{
"docstring": "apiリスエスト用のpath生成 Create paths for api request",
"name": "_api_path",
"signature": "def _api_path(self, method, os_user_id, transaction_id=None)"
},
{
"docstring": "apiにリスエスト送信 返り値 正常時: リスエストのレスポンス 異常時: None Request to the api. return value Usually: Request response If problems:No... | 3 | stack_v2_sparse_classes_30k_train_006148 | Implement the Python class `MonthlypaymentGree` described below.
Class description:
Monthly Payment API Greeクラス Monthly Payment API Gree Class
Method signatures and docstrings:
- def _api_path(self, method, os_user_id, transaction_id=None): apiリスエスト用のpath生成 Create paths for api request
- def _api_request(self, method... | Implement the Python class `MonthlypaymentGree` described below.
Class description:
Monthly Payment API Greeクラス Monthly Payment API Gree Class
Method signatures and docstrings:
- def _api_path(self, method, os_user_id, transaction_id=None): apiリスエスト用のpath生成 Create paths for api request
- def _api_request(self, method... | eefd311c6f1edad483b89f9a513bcc2f9dfabe14 | <|skeleton|>
class MonthlypaymentGree:
"""Monthly Payment API Greeクラス Monthly Payment API Gree Class"""
def _api_path(self, method, os_user_id, transaction_id=None):
"""apiリスエスト用のpath生成 Create paths for api request"""
<|body_0|>
def _api_request(self, method, os_user_id, transaction_id=Non... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MonthlypaymentGree:
"""Monthly Payment API Greeクラス Monthly Payment API Gree Class"""
def _api_path(self, method, os_user_id, transaction_id=None):
"""apiリスエスト用のpath生成 Create paths for api request"""
if method == 'POST':
path = '/api/rest/subscription/%s/@self/@app' % os_user_i... | the_stack_v2_python_sparse | anchovy/submodule/gsocial/utils/monthlypayment/gree.py | arpsabbir/anchovy | train | 0 |
ef73339436ae53e0b7927deff34b202f6a79ae75 | [
"self.reqparser = reqparse.RequestParser()\nself.reqparser.add_argument('id', required=False, type=int, store_missing=False)\nself.reqparser.add_argument('user_id', required=False, type=int, store_missing=False)\nself.reqparser.add_argument('attribute_id', required=False, type=str, store_missing=False)",
"args = ... | <|body_start_0|>
self.reqparser = reqparse.RequestParser()
self.reqparser.add_argument('id', required=False, type=int, store_missing=False)
self.reqparser.add_argument('user_id', required=False, type=int, store_missing=False)
self.reqparser.add_argument('attribute_id', required=False, ty... | Delete an alert. Use a POST request to delete an alert. The following parameters can be parsed as a JSON body content: * id: Alert Id. * user_id: User Id. * attribute_Id: Attribute Id. All parameters are optional but at least one of the above parameters are required. | DeleteAlerts | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeleteAlerts:
"""Delete an alert. Use a POST request to delete an alert. The following parameters can be parsed as a JSON body content: * id: Alert Id. * user_id: User Id. * attribute_Id: Attribute Id. All parameters are optional but at least one of the above parameters are required."""
def ... | stack_v2_sparse_classes_10k_train_000188 | 2,911 | permissive | [
{
"docstring": "Instantiate reqpare for POST request.",
"name": "__init__",
"signature": "def __init__(self) -> None"
},
{
"docstring": "Delete an alert. :return: On success, A HTTP response with a a JSON body content containing a message, a list of deleted alerts and an HTTP status code 200 (OK... | 2 | stack_v2_sparse_classes_30k_train_004338 | Implement the Python class `DeleteAlerts` described below.
Class description:
Delete an alert. Use a POST request to delete an alert. The following parameters can be parsed as a JSON body content: * id: Alert Id. * user_id: User Id. * attribute_Id: Attribute Id. All parameters are optional but at least one of the abov... | Implement the Python class `DeleteAlerts` described below.
Class description:
Delete an alert. Use a POST request to delete an alert. The following parameters can be parsed as a JSON body content: * id: Alert Id. * user_id: User Id. * attribute_Id: Attribute Id. All parameters are optional but at least one of the abov... | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | <|skeleton|>
class DeleteAlerts:
"""Delete an alert. Use a POST request to delete an alert. The following parameters can be parsed as a JSON body content: * id: Alert Id. * user_id: User Id. * attribute_Id: Attribute Id. All parameters are optional but at least one of the above parameters are required."""
def ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeleteAlerts:
"""Delete an alert. Use a POST request to delete an alert. The following parameters can be parsed as a JSON body content: * id: Alert Id. * user_id: User Id. * attribute_Id: Attribute Id. All parameters are optional but at least one of the above parameters are required."""
def __init__(self... | the_stack_v2_python_sparse | Analytics/resources/alerts/delete_alert.py | thanosbnt/SharingCitiesDashboard | train | 0 |
ae36c0c8ee5f9ee6c9d882cb856bf9f71e940051 | [
"Inventory.__init__(self, inventory_item.product_code, inventory_item.description, inventory_item.market_price, inventory_item.rental_price)\nself.brand = brand\nself.voltage = voltage",
"output_dict = {}\noutput_dict['product_code'] = self.product_code\noutput_dict['description'] = self.description\noutput_dict[... | <|body_start_0|>
Inventory.__init__(self, inventory_item.product_code, inventory_item.description, inventory_item.market_price, inventory_item.rental_price)
self.brand = brand
self.voltage = voltage
<|end_body_0|>
<|body_start_1|>
output_dict = {}
output_dict['product_code'] = s... | electrical appliance class | ElecAppliances | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElecAppliances:
"""electrical appliance class"""
def __init__(self, inventory_item, brand, voltage):
"""initializes electrical appliance item"""
<|body_0|>
def return_as_dictionary(self):
"""returns electrical appliances as a dictionary"""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k_train_000189 | 1,047 | no_license | [
{
"docstring": "initializes electrical appliance item",
"name": "__init__",
"signature": "def __init__(self, inventory_item, brand, voltage)"
},
{
"docstring": "returns electrical appliances as a dictionary",
"name": "return_as_dictionary",
"signature": "def return_as_dictionary(self)"
... | 2 | null | Implement the Python class `ElecAppliances` described below.
Class description:
electrical appliance class
Method signatures and docstrings:
- def __init__(self, inventory_item, brand, voltage): initializes electrical appliance item
- def return_as_dictionary(self): returns electrical appliances as a dictionary | Implement the Python class `ElecAppliances` described below.
Class description:
electrical appliance class
Method signatures and docstrings:
- def __init__(self, inventory_item, brand, voltage): initializes electrical appliance item
- def return_as_dictionary(self): returns electrical appliances as a dictionary
<|sk... | 99271cd60485bd2e54f8d133c9057a2ccd6c91c2 | <|skeleton|>
class ElecAppliances:
"""electrical appliance class"""
def __init__(self, inventory_item, brand, voltage):
"""initializes electrical appliance item"""
<|body_0|>
def return_as_dictionary(self):
"""returns electrical appliances as a dictionary"""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ElecAppliances:
"""electrical appliance class"""
def __init__(self, inventory_item, brand, voltage):
"""initializes electrical appliance item"""
Inventory.__init__(self, inventory_item.product_code, inventory_item.description, inventory_item.market_price, inventory_item.rental_price)
... | the_stack_v2_python_sparse | students/ZackConnaughton/lesson01/assignment/inventory_management/elec_appliances_class.py | zconn/PythonCert220Assign | train | 2 |
88042edc430f06aaca1393f08e7443568a6ba1eb | [
"self._session = session\nself.start_latitude = start_latitude\nself.start_longitude = start_longitude\nself.end_latitude = end_latitude\nself.end_longitude = end_longitude\nself.products = None",
"try:\n self.fetch_data()\nexcept APIError as exc:\n _LOGGER.error('Error fetching Lyft data: %s', exc)",
"cl... | <|body_start_0|>
self._session = session
self.start_latitude = start_latitude
self.start_longitude = start_longitude
self.end_latitude = end_latitude
self.end_longitude = end_longitude
self.products = None
<|end_body_0|>
<|body_start_1|>
try:
self.fet... | The class for handling the time and price estimate. | LyftEstimate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LyftEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None):
"""Initialize the LyftEstimate object."""
<|body_0|>
def update(self):
"""Get the latest p... | stack_v2_sparse_classes_10k_train_000190 | 9,073 | permissive | [
{
"docstring": "Initialize the LyftEstimate object.",
"name": "__init__",
"signature": "def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None)"
},
{
"docstring": "Get the latest product info and estimates from the Lyft API.",
"name": "update",
... | 3 | null | Implement the Python class `LyftEstimate` described below.
Class description:
The class for handling the time and price estimate.
Method signatures and docstrings:
- def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None): Initialize the LyftEstimate object.
- def update(se... | Implement the Python class `LyftEstimate` described below.
Class description:
The class for handling the time and price estimate.
Method signatures and docstrings:
- def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None): Initialize the LyftEstimate object.
- def update(se... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class LyftEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None):
"""Initialize the LyftEstimate object."""
<|body_0|>
def update(self):
"""Get the latest p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LyftEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude, end_latitude=None, end_longitude=None):
"""Initialize the LyftEstimate object."""
self._session = session
self.start_latitude = start_latitude
... | the_stack_v2_python_sparse | homeassistant/components/lyft/sensor.py | BenWoodford/home-assistant | train | 11 |
dbf4c6bb8984a5fb75df28f25a3c3cdad35c4ce1 | [
"super(Res18, self).__init__(name=name)\nself._output_size = num_outputs\nself._conv_channels = 64\nself._conv_kernel_shape = [7, 7]\nself._conv_stride = 2\nself._pooling_kernel_shape = [2, 2]\nself._pooling_stride = 2\nself._resunit_channels = [64, 64, 128, 128, 256, 256, 512, 512]\nself._num_resunits = len(self._... | <|body_start_0|>
super(Res18, self).__init__(name=name)
self._output_size = num_outputs
self._conv_channels = 64
self._conv_kernel_shape = [7, 7]
self._conv_stride = 2
self._pooling_kernel_shape = [2, 2]
self._pooling_stride = 2
self._resunit_channels = [6... | Res18 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Res18:
def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params):
"""Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional key... | stack_v2_sparse_classes_10k_train_000191 | 48,282 | permissive | [
{
"docstring": "Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional keyword arguments will be passed to all the snt.Conv2D and to the ResUnit layers.",
"name": "__init__",... | 2 | null | Implement the Python class `Res18` described below.
Class description:
Implement the Res18 class.
Method signatures and docstrings:
- def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params): Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation ... | Implement the Python class `Res18` described below.
Class description:
Implement the Res18 class.
Method signatures and docstrings:
- def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params): Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation ... | a10c33346803239db8a64c104db7f22ec4e05bef | <|skeleton|>
class Res18:
def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params):
"""Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional key... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Res18:
def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params):
"""Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional keyword arguments... | the_stack_v2_python_sparse | argo/core/utils/utils_modules.py | ricvo/argo | train | 0 | |
230f5f17b1dc1a7d637581d25d54f89adaa38d6f | [
"super(CNN, self).__init__()\nself.cnn = nn.SequentialCell([nn.Conv1d(n_in, n_hid, kernel_size=5, pad_mode='valid', has_bias=True, weight_init=init.Normal(math.sqrt(2.0 / (5 * n_hid))), bias_init=init.Constant(0.1)), nn.ReLU(), MyBatchNorm1d(n_hid, dim=1), nn.Dropout(p=do_prob), nn.MaxPool1d(kernel_size=2, stride=2... | <|body_start_0|>
super(CNN, self).__init__()
self.cnn = nn.SequentialCell([nn.Conv1d(n_in, n_hid, kernel_size=5, pad_mode='valid', has_bias=True, weight_init=init.Normal(math.sqrt(2.0 / (5 * n_hid))), bias_init=init.Constant(0.1)), nn.ReLU(), MyBatchNorm1d(n_hid, dim=1), nn.Dropout(p=do_prob), nn.MaxPoo... | CNN | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CNN:
def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0):
"""Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension. do_prob : float, optional rate of dropout. The default is 0.."""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_000192 | 9,199 | permissive | [
{
"docstring": "Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension. do_prob : float, optional rate of dropout. The default is 0..",
"name": "__init__",
"signature": "def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0... | 2 | null | Implement the Python class `CNN` described below.
Class description:
Implement the CNN class.
Method signatures and docstrings:
- def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dime... | Implement the Python class `CNN` described below.
Class description:
Implement the CNN class.
Method signatures and docstrings:
- def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dime... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class CNN:
def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0):
"""Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension. do_prob : float, optional rate of dropout. The default is 0.."""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CNN:
def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0):
"""Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension. do_prob : float, optional rate of dropout. The default is 0.."""
super(CNN, self).__init__(... | the_stack_v2_python_sparse | research/gnn/nri-mpm/models/base.py | mindspore-ai/models | train | 301 | |
ef02babe5878a7737cc5671d53e693ee690383d3 | [
"if pattern.islower():\n val = val.lower()\npattern = unidecode(pattern)\nval = unidecode(val)\nreturn pattern in val",
"clause = f'unidecode({self.field})'\nif self.pattern.islower():\n clause = f'lower({clause})'\nreturn (f\"{clause} LIKE ? ESCAPE '\\\\'\", [f'%{unidecode(self.pattern)}%'])"
] | <|body_start_0|>
if pattern.islower():
val = val.lower()
pattern = unidecode(pattern)
val = unidecode(val)
return pattern in val
<|end_body_0|>
<|body_start_1|>
clause = f'unidecode({self.field})'
if self.pattern.islower():
clause = f'lower({claus... | Compare items using bare ASCII, without accents etc. | BareascQuery | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BareascQuery:
"""Compare items using bare ASCII, without accents etc."""
def string_match(cls, pattern, val):
"""Convert both pattern and string to plain ASCII before matching. If pattern is all lower case, also convert string to lower case so match is also case insensitive"""
... | stack_v2_sparse_classes_10k_train_000193 | 3,145 | permissive | [
{
"docstring": "Convert both pattern and string to plain ASCII before matching. If pattern is all lower case, also convert string to lower case so match is also case insensitive",
"name": "string_match",
"signature": "def string_match(cls, pattern, val)"
},
{
"docstring": "Compare ascii version ... | 2 | stack_v2_sparse_classes_30k_val_000156 | Implement the Python class `BareascQuery` described below.
Class description:
Compare items using bare ASCII, without accents etc.
Method signatures and docstrings:
- def string_match(cls, pattern, val): Convert both pattern and string to plain ASCII before matching. If pattern is all lower case, also convert string ... | Implement the Python class `BareascQuery` described below.
Class description:
Compare items using bare ASCII, without accents etc.
Method signatures and docstrings:
- def string_match(cls, pattern, val): Convert both pattern and string to plain ASCII before matching. If pattern is all lower case, also convert string ... | 0e5ade4f711dbf563d35c290affb0254eee41235 | <|skeleton|>
class BareascQuery:
"""Compare items using bare ASCII, without accents etc."""
def string_match(cls, pattern, val):
"""Convert both pattern and string to plain ASCII before matching. If pattern is all lower case, also convert string to lower case so match is also case insensitive"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BareascQuery:
"""Compare items using bare ASCII, without accents etc."""
def string_match(cls, pattern, val):
"""Convert both pattern and string to plain ASCII before matching. If pattern is all lower case, also convert string to lower case so match is also case insensitive"""
if pattern.... | the_stack_v2_python_sparse | beetsplug/bareasc.py | beetbox/beets | train | 8,977 |
47d07d27879c591979bfea06cfb6154c3e92493c | [
"if not root:\n return None\nroot.left, root.right = (self.mirrorTree(root.right), self.mirrorTree(root.left))\nreturn root",
"if not root:\n return None\ndeque = []\ncur = root\ndeque.append(root)\nwhile deque:\n n = len(deque)\n for i in range(n):\n cur = deque.pop(0)\n if cur.left:\n ... | <|body_start_0|>
if not root:
return None
root.left, root.right = (self.mirrorTree(root.right), self.mirrorTree(root.left))
return root
<|end_body_0|>
<|body_start_1|>
if not root:
return None
deque = []
cur = root
deque.append(root)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mirrorTree0(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def mirrorTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return None
... | stack_v2_sparse_classes_10k_train_000194 | 1,316 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "mirrorTree0",
"signature": "def mirrorTree0(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "mirrorTree",
"signature": "def mirrorTree(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mirrorTree0(self, root): :type root: TreeNode :rtype: TreeNode
- def mirrorTree(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 mirrorTree0(self, root): :type root: TreeNode :rtype: TreeNode
- def mirrorTree(self, root): :type root: TreeNode :rtype: TreeNode
<|skeleton|>
class Solution:
def mirr... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def mirrorTree0(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def mirrorTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def mirrorTree0(self, root):
""":type root: TreeNode :rtype: TreeNode"""
if not root:
return None
root.left, root.right = (self.mirrorTree(root.right), self.mirrorTree(root.left))
return root
def mirrorTree(self, root):
""":type root: TreeNode... | the_stack_v2_python_sparse | 剑指 Offer 27. 二叉树的镜像.py | yangyuxiang1996/leetcode | train | 0 | |
7649b34263f80427226e846f791f51d410df528e | [
"if k == 1:\n return max(nums)\nn = nums[-1]\ni, j = (0, len(nums) - 1)\nwhile i <= j:\n if nums[i] < n < nums[j]:\n nums[i], nums[j] = (nums[j], nums[i])\n if nums[i] >= n:\n i += 1\n if nums[j] <= n:\n j -= 1\nnums[j + 1], nums[-1] = (n, nums[j + 1])\nif k - 1 < j + 1:\n return... | <|body_start_0|>
if k == 1:
return max(nums)
n = nums[-1]
i, j = (0, len(nums) - 1)
while i <= j:
if nums[i] < n < nums[j]:
nums[i], nums[j] = (nums[j], nums[i])
if nums[i] >= n:
i += 1
if nums[j] <= n:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
"""04/29/2019 00:26"""
<|body_0|>
def findKthLargest(self, nums: List[int], k: int) -> int:
"""Heap Time complexity: O(nlogk) Sapce complexity: O(k)"""
<|body_1|>
def findKthLargest(self... | stack_v2_sparse_classes_10k_train_000195 | 3,084 | no_license | [
{
"docstring": "04/29/2019 00:26",
"name": "findKthLargest",
"signature": "def findKthLargest(self, nums: List[int], k: int) -> int"
},
{
"docstring": "Heap Time complexity: O(nlogk) Sapce complexity: O(k)",
"name": "findKthLargest",
"signature": "def findKthLargest(self, nums: List[int]... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums: List[int], k: int) -> int: 04/29/2019 00:26
- def findKthLargest(self, nums: List[int], k: int) -> int: Heap Time complexity: O(nlogk) Sapce comple... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums: List[int], k: int) -> int: 04/29/2019 00:26
- def findKthLargest(self, nums: List[int], k: int) -> int: Heap Time complexity: O(nlogk) Sapce comple... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
"""04/29/2019 00:26"""
<|body_0|>
def findKthLargest(self, nums: List[int], k: int) -> int:
"""Heap Time complexity: O(nlogk) Sapce complexity: O(k)"""
<|body_1|>
def findKthLargest(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
"""04/29/2019 00:26"""
if k == 1:
return max(nums)
n = nums[-1]
i, j = (0, len(nums) - 1)
while i <= j:
if nums[i] < n < nums[j]:
nums[i], nums[j] = (nums[j], num... | the_stack_v2_python_sparse | leetcode/solved/215_Kth_Largest_Element_in_an_Array/solution.py | sungminoh/algorithms | train | 0 | |
71c4bb6afa50aa2662b5672778c6438102135141 | [
"if m == 0:\n nums1[:] = nums2\nelif m > 0 and n > 0:\n if nums2[0] >= nums1[m - 1]:\n nums1[-n:] = nums2\n elif nums1[0] >= nums2[n - 1]:\n nums1[-m:] = nums1[:m]\n nums1[:n] = nums2\n else:\n i = 0\n j = 0\n while i < m + n and j < n:\n if nums1[i] ... | <|body_start_0|>
if m == 0:
nums1[:] = nums2
elif m > 0 and n > 0:
if nums2[0] >= nums1[m - 1]:
nums1[-n:] = nums2
elif nums1[0] >= nums2[n - 1]:
nums1[-m:] = nums1[:m]
nums1[:n] = nums2
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge1(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|bod... | stack_v2_sparse_classes_10k_train_000196 | 2,061 | no_license | [
{
"docstring": "Do not return anything, modify nums1 in-place instead.",
"name": "merge",
"signature": "def merge(self, nums1, m: int, nums2, n: int) -> None"
},
{
"docstring": "Do not return anything, modify nums1 in-place instead.",
"name": "merge1",
"signature": "def merge1(self, nums... | 2 | stack_v2_sparse_classes_30k_train_002232 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m: int, nums2, n: int) -> None: Do not return anything, modify nums1 in-place instead.
- def merge1(self, nums1, m: int, nums2, n: int) -> None: Do not ret... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m: int, nums2, n: int) -> None: Do not return anything, modify nums1 in-place instead.
- def merge1(self, nums1, m: int, nums2, n: int) -> None: Do not ret... | c55b0cfd2967a2221c27ed738e8de15034775945 | <|skeleton|>
class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge1(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|bod... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
if m == 0:
nums1[:] = nums2
elif m > 0 and n > 0:
if nums2[0] >= nums1[m - 1]:
nums1[-n:] = nums2
elif nums1... | the_stack_v2_python_sparse | PycharmProjects/leetcode/MySort/88.py | crystal30/DataStructure | train | 0 | |
961223936b42c3d4950ffe18ab4b01f9f82fc440 | [
"LcgCrypto.__init__(self, the_rnt, n_prngs, integer_width, vector_depth, paranoia_level)\nself.vector_depth = vector_depth\nself.entropy_bits = the_rnt.password_hash\nself.bit_selection_mask = integer_width - 1\nself.next_prng = 0\nself.max_integer_mask = (1 << integer_width) - 1\nself.max_integer = 1 << integer_wi... | <|body_start_0|>
LcgCrypto.__init__(self, the_rnt, n_prngs, integer_width, vector_depth, paranoia_level)
self.vector_depth = vector_depth
self.entropy_bits = the_rnt.password_hash
self.bit_selection_mask = integer_width - 1
self.next_prng = 0
self.max_integer_mask = (1 <<... | Uses a set of PRNGs to produce a crypto-quality pseudo-random number generator. Algorithm is to use N PRNGs, with the last PRNG selecting the particular bits from the others. All of the PRNGs have a uniform interface, whether they use all the arguments or not. This uses randomly chosen primes for the two constants, and... | PrngCrypto | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrngCrypto:
"""Uses a set of PRNGs to produce a crypto-quality pseudo-random number generator. Algorithm is to use N PRNGs, with the last PRNG selecting the particular bits from the others. All of the PRNGs have a uniform interface, whether they use all the arguments or not. This uses randomly ch... | stack_v2_sparse_classes_10k_train_000197 | 47,334 | no_license | [
{
"docstring": "Initializes N PRNGs of bit_width and vector_depth. The goal is to calculate and set the tuple ( RNT, int_width, lcg_array_size, multiplier, constant, lag ) for each PRNG instantiated. All PRNG algorithms may not use all of them, but the interfaces are uniform. lcg_array_size is the # of prng_bit... | 2 | stack_v2_sparse_classes_30k_train_000994 | Implement the Python class `PrngCrypto` described below.
Class description:
Uses a set of PRNGs to produce a crypto-quality pseudo-random number generator. Algorithm is to use N PRNGs, with the last PRNG selecting the particular bits from the others. All of the PRNGs have a uniform interface, whether they use all the ... | Implement the Python class `PrngCrypto` described below.
Class description:
Uses a set of PRNGs to produce a crypto-quality pseudo-random number generator. Algorithm is to use N PRNGs, with the last PRNG selecting the particular bits from the others. All of the PRNGs have a uniform interface, whether they use all the ... | 8425cfc9756eab4c8d090c14a11bfe91b0a17271 | <|skeleton|>
class PrngCrypto:
"""Uses a set of PRNGs to produce a crypto-quality pseudo-random number generator. Algorithm is to use N PRNGs, with the last PRNG selecting the particular bits from the others. All of the PRNGs have a uniform interface, whether they use all the arguments or not. This uses randomly ch... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PrngCrypto:
"""Uses a set of PRNGs to produce a crypto-quality pseudo-random number generator. Algorithm is to use N PRNGs, with the last PRNG selecting the particular bits from the others. All of the PRNGs have a uniform interface, whether they use all the arguments or not. This uses randomly chosen primes f... | the_stack_v2_python_sparse | evocprngs.py | lew128/evocrypt | train | 0 |
0f3038d8accb2cbe0d5630cf0cf41a917b903dba | [
"import collections\ndicts = collections.Counter(s)\nmark = [0] * 26\nprint(dicts)\nresult = []\nfor char in s:\n while result and ord(result[-1]) > ord(char) and (dicts[result[-1]] > 0) and (mark[ord(char) - ord('a')] == 0):\n a = result.pop()\n mark[ord(a) - ord('a')] = 0\n dicts[char] -= 1\n ... | <|body_start_0|>
import collections
dicts = collections.Counter(s)
mark = [0] * 26
print(dicts)
result = []
for char in s:
while result and ord(result[-1]) > ord(char) and (dicts[result[-1]] > 0) and (mark[ord(char) - ord('a')] == 0):
a = resul... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str 73ms"""
<|body_0|>
def removeDuplicateLettersOld(self, s):
""":type s: str :rtype: str 49ms"""
<|body_1|>
def removeDuplicateLetters_1(self, s):
""":type s: str :rtype: st... | stack_v2_sparse_classes_10k_train_000198 | 2,912 | no_license | [
{
"docstring": ":type s: str :rtype: str 73ms",
"name": "removeDuplicateLetters",
"signature": "def removeDuplicateLetters(self, s)"
},
{
"docstring": ":type s: str :rtype: str 49ms",
"name": "removeDuplicateLettersOld",
"signature": "def removeDuplicateLettersOld(self, s)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_002742 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicateLetters(self, s): :type s: str :rtype: str 73ms
- def removeDuplicateLettersOld(self, s): :type s: str :rtype: str 49ms
- def removeDuplicateLetters_1(self, s)... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicateLetters(self, s): :type s: str :rtype: str 73ms
- def removeDuplicateLettersOld(self, s): :type s: str :rtype: str 49ms
- def removeDuplicateLetters_1(self, s)... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str 73ms"""
<|body_0|>
def removeDuplicateLettersOld(self, s):
""":type s: str :rtype: str 49ms"""
<|body_1|>
def removeDuplicateLetters_1(self, s):
""":type s: str :rtype: st... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str 73ms"""
import collections
dicts = collections.Counter(s)
mark = [0] * 26
print(dicts)
result = []
for char in s:
while result and ord(result[-1]) > ord(char) and (dic... | the_stack_v2_python_sparse | RemoveDuplicateLetters_HARD_316.py | 953250587/leetcode-python | train | 2 | |
be46cd7531ff525606a8d8ab0fc87b512c849162 | [
"self.username = username\nself.password = password\nself.privkey = None\nself.__set_or_create_key_if_not_exist()",
"pki = PKI(username=self.username, password=self.password)\nprivkey = pki.load_priv_key()\nif not privkey:\n pki.generate_pub_priv_key()\n privkey = pki.load_priv_key()\nself.privkey = privkey... | <|body_start_0|>
self.username = username
self.password = password
self.privkey = None
self.__set_or_create_key_if_not_exist()
<|end_body_0|>
<|body_start_1|>
pki = PKI(username=self.username, password=self.password)
privkey = pki.load_priv_key()
if not privkey:
... | DigitalSigner | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DigitalSigner:
def __init__(self, username, password):
"""class for digitally signing :param username: string, privkey names after username :param password: string, used to decrypt privkey"""
<|body_0|>
def __set_or_create_key_if_not_exist(self):
"""used to set self.... | stack_v2_sparse_classes_10k_train_000199 | 5,078 | permissive | [
{
"docstring": "class for digitally signing :param username: string, privkey names after username :param password: string, used to decrypt privkey",
"name": "__init__",
"signature": "def __init__(self, username, password)"
},
{
"docstring": "used to set self.privkey to private key saved under us... | 5 | stack_v2_sparse_classes_30k_train_002821 | Implement the Python class `DigitalSigner` described below.
Class description:
Implement the DigitalSigner class.
Method signatures and docstrings:
- def __init__(self, username, password): class for digitally signing :param username: string, privkey names after username :param password: string, used to decrypt privk... | Implement the Python class `DigitalSigner` described below.
Class description:
Implement the DigitalSigner class.
Method signatures and docstrings:
- def __init__(self, username, password): class for digitally signing :param username: string, privkey names after username :param password: string, used to decrypt privk... | 218706c2956de47e8c5699a6abcad5cab1af85cd | <|skeleton|>
class DigitalSigner:
def __init__(self, username, password):
"""class for digitally signing :param username: string, privkey names after username :param password: string, used to decrypt privkey"""
<|body_0|>
def __set_or_create_key_if_not_exist(self):
"""used to set self.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DigitalSigner:
def __init__(self, username, password):
"""class for digitally signing :param username: string, privkey names after username :param password: string, used to decrypt privkey"""
self.username = username
self.password = password
self.privkey = None
self.__s... | the_stack_v2_python_sparse | Orses_Cryptography_Core/DigitalSigner.py | snwokenk/Orses_Core | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.