blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3bd441f462a7eb76665697e83b18b49416109305 | [
"if node.value in [True, False]:\n return self.visit_mutation_site(node)\nreturn node",
"if node.id in ['True', 'False']:\n return self.visit_mutation_site(node)\nreturn node",
"if sys.version_info >= (3, 4):\n return ast.NameConstant(value=not node.value)\nreturn ast.Name(id=not ast.literal_eval(node.... | <|body_start_0|>
if node.value in [True, False]:
return self.visit_mutation_site(node)
return node
<|end_body_0|>
<|body_start_1|>
if node.id in ['True', 'False']:
return self.visit_mutation_site(node)
return node
<|end_body_1|>
<|body_start_2|>
if sys.v... | An operator that modifies True/False constants. | ReplaceTrueFalse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReplaceTrueFalse:
"""An operator that modifies True/False constants."""
def visit_NameConstant(self, node):
"""New in version 3.4: Previously, these constants were instances of ``Name``: http://greentreesnakes.readthedocs.io/en/latest/nodes.html#NameConstant"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_003400 | 4,264 | permissive | [
{
"docstring": "New in version 3.4: Previously, these constants were instances of ``Name``: http://greentreesnakes.readthedocs.io/en/latest/nodes.html#NameConstant",
"name": "visit_NameConstant",
"signature": "def visit_NameConstant(self, node)"
},
{
"docstring": "For backward compatibility with... | 3 | stack_v2_sparse_classes_30k_train_006256 | Implement the Python class `ReplaceTrueFalse` described below.
Class description:
An operator that modifies True/False constants.
Method signatures and docstrings:
- def visit_NameConstant(self, node): New in version 3.4: Previously, these constants were instances of ``Name``: http://greentreesnakes.readthedocs.io/en... | Implement the Python class `ReplaceTrueFalse` described below.
Class description:
An operator that modifies True/False constants.
Method signatures and docstrings:
- def visit_NameConstant(self, node): New in version 3.4: Previously, these constants were instances of ``Name``: http://greentreesnakes.readthedocs.io/en... | 0d5ba9c773299385195f6c32e5bf4de55d3494a6 | <|skeleton|>
class ReplaceTrueFalse:
"""An operator that modifies True/False constants."""
def visit_NameConstant(self, node):
"""New in version 3.4: Previously, these constants were instances of ``Name``: http://greentreesnakes.readthedocs.io/en/latest/nodes.html#NameConstant"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReplaceTrueFalse:
"""An operator that modifies True/False constants."""
def visit_NameConstant(self, node):
"""New in version 3.4: Previously, these constants were instances of ``Name``: http://greentreesnakes.readthedocs.io/en/latest/nodes.html#NameConstant"""
if node.value in [True, Fal... | the_stack_v2_python_sparse | cosmic_ray/operators/boolean_replacer.py | sobolevn/cosmic-ray | train | 0 |
0dbb563dc5e7ac920c597c3a48abb2fc84c0c2bf | [
"self.assertEqual(D20Coin.pp(1), 1000)\nself.assertEqual(D20Coin.gp(1), 100)\nself.assertEqual(D20Coin.sp(1), 10)\nself.assertEqual(D20Coin.cp(1), 1)",
"treasure = D20Coin(pp=1, gp=2, sp=3, cp=4)\nself.assertEqual(treasure.value, 1234)\nself.assertEqual(treasure.sale_value, 1234)\nself.assertEqual(treasure.name, ... | <|body_start_0|>
self.assertEqual(D20Coin.pp(1), 1000)
self.assertEqual(D20Coin.gp(1), 100)
self.assertEqual(D20Coin.sp(1), 10)
self.assertEqual(D20Coin.cp(1), 1)
<|end_body_0|>
<|body_start_1|>
treasure = D20Coin(pp=1, gp=2, sp=3, cp=4)
self.assertEqual(treasure.value, ... | A test suite for the D20Coin class | TestD20Coin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestD20Coin:
"""A test suite for the D20Coin class"""
def test_convert_coin_types(self):
"""Try the four coin type conversions"""
<|body_0|>
def test_coin_treasure(self):
"""Create a coin-only treasure object"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_003401 | 3,068 | permissive | [
{
"docstring": "Try the four coin type conversions",
"name": "test_convert_coin_types",
"signature": "def test_convert_coin_types(self)"
},
{
"docstring": "Create a coin-only treasure object",
"name": "test_coin_treasure",
"signature": "def test_coin_treasure(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009325 | Implement the Python class `TestD20Coin` described below.
Class description:
A test suite for the D20Coin class
Method signatures and docstrings:
- def test_convert_coin_types(self): Try the four coin type conversions
- def test_coin_treasure(self): Create a coin-only treasure object | Implement the Python class `TestD20Coin` described below.
Class description:
A test suite for the D20Coin class
Method signatures and docstrings:
- def test_convert_coin_types(self): Try the four coin type conversions
- def test_coin_treasure(self): Create a coin-only treasure object
<|skeleton|>
class TestD20Coin:
... | 75504d2443cdc80db120c5dcdc14db379d15396e | <|skeleton|>
class TestD20Coin:
"""A test suite for the D20Coin class"""
def test_convert_coin_types(self):
"""Try the four coin type conversions"""
<|body_0|>
def test_coin_treasure(self):
"""Create a coin-only treasure object"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestD20Coin:
"""A test suite for the D20Coin class"""
def test_convert_coin_types(self):
"""Try the four coin type conversions"""
self.assertEqual(D20Coin.pp(1), 1000)
self.assertEqual(D20Coin.gp(1), 100)
self.assertEqual(D20Coin.sp(1), 10)
self.assertEqual(D20Coin... | the_stack_v2_python_sparse | games/d20/pathfinder/test_pathfindertreasure.py | ajs/tools | train | 5 |
221af954ec827e037fdab8c1c32d0d14bcb7daeb | [
"if accepting_variables is None and rejecting_variables is None and (not no_variables):\n raise ValueError('Cannot create a symbolic subring since nothing is specified.')\nif accepting_variables is not None and rejecting_variables is not None or (rejecting_variables is not None and no_variables) or (no_variables... | <|body_start_0|>
if accepting_variables is None and rejecting_variables is None and (not no_variables):
raise ValueError('Cannot create a symbolic subring since nothing is specified.')
if accepting_variables is not None and rejecting_variables is not None or (rejecting_variables is not None ... | A factory creating a symbolic subring. INPUT: Specify one of the following keywords to create a subring. - ``accepting_variables`` (default: ``None``) -- a tuple or other iterable of variables. If specified, then a symbolic subring of expressions in only these variables is created. - ``rejecting_variables`` (default: `... | SymbolicSubringFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SymbolicSubringFactory:
"""A factory creating a symbolic subring. INPUT: Specify one of the following keywords to create a subring. - ``accepting_variables`` (default: ``None``) -- a tuple or other iterable of variables. If specified, then a symbolic subring of expressions in only these variables... | stack_v2_sparse_classes_36k_train_003402 | 31,870 | no_license | [
{
"docstring": "Given the arguments and keyword, create a key that uniquely determines this object. See :class:`SymbolicSubringFactory` for details. TESTS:: sage: from sage.symbolic.subring import SymbolicSubring sage: SymbolicSubring.create_key_and_extra_args() Traceback (most recent call last): ... ValueError... | 2 | stack_v2_sparse_classes_30k_train_012811 | Implement the Python class `SymbolicSubringFactory` described below.
Class description:
A factory creating a symbolic subring. INPUT: Specify one of the following keywords to create a subring. - ``accepting_variables`` (default: ``None``) -- a tuple or other iterable of variables. If specified, then a symbolic subring... | Implement the Python class `SymbolicSubringFactory` described below.
Class description:
A factory creating a symbolic subring. INPUT: Specify one of the following keywords to create a subring. - ``accepting_variables`` (default: ``None``) -- a tuple or other iterable of variables. If specified, then a symbolic subring... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class SymbolicSubringFactory:
"""A factory creating a symbolic subring. INPUT: Specify one of the following keywords to create a subring. - ``accepting_variables`` (default: ``None``) -- a tuple or other iterable of variables. If specified, then a symbolic subring of expressions in only these variables... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SymbolicSubringFactory:
"""A factory creating a symbolic subring. INPUT: Specify one of the following keywords to create a subring. - ``accepting_variables`` (default: ``None``) -- a tuple or other iterable of variables. If specified, then a symbolic subring of expressions in only these variables is created. ... | the_stack_v2_python_sparse | sage/src/sage/symbolic/subring.py | bopopescu/geosci | train | 0 |
e4c0af4eb3c97f8942a6cff4465914e4aeebfc8b | [
"i, j = (0, 0)\nm, n = (len(s), len(t))\nwhile i < m and j < n:\n if s[i] == t[j]:\n i += 1\n j += 1\nif i == m:\n return True\nelse:\n return False",
"m, n = (len(s), len(t))\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n if s[i -... | <|body_start_0|>
i, j = (0, 0)
m, n = (len(s), len(t))
while i < m and j < n:
if s[i] == t[j]:
i += 1
j += 1
if i == m:
return True
else:
return False
<|end_body_0|>
<|body_start_1|>
m, n = (len(s), len(t))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSubsequence1(self, s: str, t: str) -> bool:
"""思路:双指针移动 时间复杂度:O(n)"""
<|body_0|>
def isSubsequence2(self, s: str, t: str) -> bool:
"""思路:动态规划法 时间复杂度:O(mn)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i, j = (0, 0)
m, n = (... | stack_v2_sparse_classes_36k_train_003403 | 1,979 | no_license | [
{
"docstring": "思路:双指针移动 时间复杂度:O(n)",
"name": "isSubsequence1",
"signature": "def isSubsequence1(self, s: str, t: str) -> bool"
},
{
"docstring": "思路:动态规划法 时间复杂度:O(mn)",
"name": "isSubsequence2",
"signature": "def isSubsequence2(self, s: str, t: str) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSubsequence1(self, s: str, t: str) -> bool: 思路:双指针移动 时间复杂度:O(n)
- def isSubsequence2(self, s: str, t: str) -> bool: 思路:动态规划法 时间复杂度:O(mn) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSubsequence1(self, s: str, t: str) -> bool: 思路:双指针移动 时间复杂度:O(n)
- def isSubsequence2(self, s: str, t: str) -> bool: 思路:动态规划法 时间复杂度:O(mn)
<|skeleton|>
class Solution:
... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def isSubsequence1(self, s: str, t: str) -> bool:
"""思路:双指针移动 时间复杂度:O(n)"""
<|body_0|>
def isSubsequence2(self, s: str, t: str) -> bool:
"""思路:动态规划法 时间复杂度:O(mn)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isSubsequence1(self, s: str, t: str) -> bool:
"""思路:双指针移动 时间复杂度:O(n)"""
i, j = (0, 0)
m, n = (len(s), len(t))
while i < m and j < n:
if s[i] == t[j]:
i += 1
j += 1
if i == m:
return True
else:
... | the_stack_v2_python_sparse | LeetCode/字符串/392. 判断子序列.py | yiming1012/MyLeetCode | train | 2 | |
a819dd7ca947547a4b2a9697da31a5cd3e15044f | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | AuthAppServiceServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthAppServiceServicer:
"""Missing associated documentation comment in .proto file."""
def authenticate_user_by_email_and_password(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def is_authenticated(self, request, conte... | stack_v2_sparse_classes_36k_train_003404 | 6,710 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "authenticate_user_by_email_and_password",
"signature": "def authenticate_user_by_email_and_password(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name... | 3 | null | Implement the Python class `AuthAppServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def authenticate_user_by_email_and_password(self, request, context): Missing associated documentation comment in .proto file.
- def is_au... | Implement the Python class `AuthAppServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def authenticate_user_by_email_and_password(self, request, context): Missing associated documentation comment in .proto file.
- def is_au... | 55d36c068e26e13ee5bae5c033e2e17784c63feb | <|skeleton|>
class AuthAppServiceServicer:
"""Missing associated documentation comment in .proto file."""
def authenticate_user_by_email_and_password(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def is_authenticated(self, request, conte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AuthAppServiceServicer:
"""Missing associated documentation comment in .proto file."""
def authenticate_user_by_email_and_password(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_de... | the_stack_v2_python_sparse | src/resource/proto/_generated/identity/auth_app_service_pb2_grpc.py | arkanmgerges/cafm.identity | train | 0 |
a5962431384bcfd881d799dbef0c0e3f6a357991 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookRangeFont()",
"from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'bold': lambda n: setattr(self, 'bold', n.get_bool_value()), 'color': lambda n: setattr(self, 'color', n.get_str... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WorkbookRangeFont()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .entity import Entity
fields: Dict[str, Callable[[Any], None]] = {'bold': lambda n: setattr(se... | WorkbookRangeFont | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkbookRangeFont:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeFont:
"""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... | stack_v2_sparse_classes_36k_train_003405 | 3,082 | 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: WorkbookRangeFont",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_v... | 3 | null | Implement the Python class `WorkbookRangeFont` described below.
Class description:
Implement the WorkbookRangeFont class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeFont: Creates a new instance of the appropriate class based on discrim... | Implement the Python class `WorkbookRangeFont` described below.
Class description:
Implement the WorkbookRangeFont class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeFont: Creates a new instance of the appropriate class based on discrim... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WorkbookRangeFont:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeFont:
"""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... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkbookRangeFont:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeFont:
"""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: Work... | the_stack_v2_python_sparse | msgraph/generated/models/workbook_range_font.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
6b39ff9c53a979931ce7bf0c667a608b44034da3 | [
"super(CnnFnn, self).__init__()\nself.num_var = num_var\nself.kernel_size = kernel_size\nself.stride = stride\nself.cnns = nn.ModuleList([nn.Sequential(nn.Conv3d(1, 1, (1, self.kernel_size, self.kernel_size), (1, self.stride, self.stride)), nn.ReLU(inplace=True)) for i in range(self.num_var)])\nself.input_dim = inp... | <|body_start_0|>
super(CnnFnn, self).__init__()
self.num_var = num_var
self.kernel_size = kernel_size
self.stride = stride
self.cnns = nn.ModuleList([nn.Sequential(nn.Conv3d(1, 1, (1, self.kernel_size, self.kernel_size), (1, self.stride, self.stride)), nn.ReLU(inplace=True)) for ... | Class for CNN model | CnnFnn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CnnFnn:
"""Class for CNN model"""
def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001):
"""Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate inp... | stack_v2_sparse_classes_36k_train_003406 | 6,027 | no_license | [
{
"docstring": "Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate input_dim: int -- dimension of the input for fully connected layers after apply cnn output_dim: int -- dimension of the output feature kernel_size: int -- Size of the convolving kernel srtide: int... | 5 | stack_v2_sparse_classes_30k_train_012786 | Implement the Python class `CnnFnn` described below.
Class description:
Class for CNN model
Method signatures and docstrings:
- def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001): Initilize CNN model Args: num_var: int -- numb... | Implement the Python class `CnnFnn` described below.
Class description:
Class for CNN model
Method signatures and docstrings:
- def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001): Initilize CNN model Args: num_var: int -- numb... | d7e651024b07587b46497183d90934561a4839e2 | <|skeleton|>
class CnnFnn:
"""Class for CNN model"""
def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001):
"""Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate inp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CnnFnn:
"""Class for CNN model"""
def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001):
"""Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate input_dim: int -... | the_stack_v2_python_sparse | model/cnn_fnn.py | SSF-climate/SSF | train | 7 |
253f102fbef223540badd419c880717224d32ba6 | [
"self._type = 'ssh'\nself._client = client\nself._ssh_timeout = timeout\nself._debug = debug\nself._cmd = 'ssh'\nself._destination = destination\nself._ssh_userid = userid\nself._ssh_passwd = passwd\nself._remote_cmd = rcmd\nself._logfile = logfile\nself._ssh_timeout = timeout\nself._build_ssh_cmd()",
"cmd = self... | <|body_start_0|>
self._type = 'ssh'
self._client = client
self._ssh_timeout = timeout
self._debug = debug
self._cmd = 'ssh'
self._destination = destination
self._ssh_userid = userid
self._ssh_passwd = passwd
self._remote_cmd = rcmd
self._lo... | Ssh implements the Ssh traffic class. | Ssh | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ssh:
"""Ssh implements the Ssh traffic class."""
def __init__(self, client=None, destination=None, userid='varmour', passwd='varmour', rcmd=['ls', 'pwd', 'uname'], timeout=None, debug=False, logfile='sshlogs.logs'):
"""Initializes the Ssh Traffic object. kwargs: :client (va_lab linux... | stack_v2_sparse_classes_36k_train_003407 | 5,566 | no_license | [
{
"docstring": "Initializes the Ssh Traffic object. kwargs: :client (va_lab linux device object): Client where SSH session initiated :destination (str): destination ip address, which is destination IP address for SSH session :timeout (int): ssh timeout, by default it is tcp timeout 180 :debug (bool): enable deb... | 4 | stack_v2_sparse_classes_30k_train_007632 | Implement the Python class `Ssh` described below.
Class description:
Ssh implements the Ssh traffic class.
Method signatures and docstrings:
- def __init__(self, client=None, destination=None, userid='varmour', passwd='varmour', rcmd=['ls', 'pwd', 'uname'], timeout=None, debug=False, logfile='sshlogs.logs'): Initiali... | Implement the Python class `Ssh` described below.
Class description:
Ssh implements the Ssh traffic class.
Method signatures and docstrings:
- def __init__(self, client=None, destination=None, userid='varmour', passwd='varmour', rcmd=['ls', 'pwd', 'uname'], timeout=None, debug=False, logfile='sshlogs.logs'): Initiali... | cb02979e233ce772bd5fe88ecdc31caf8764d306 | <|skeleton|>
class Ssh:
"""Ssh implements the Ssh traffic class."""
def __init__(self, client=None, destination=None, userid='varmour', passwd='varmour', rcmd=['ls', 'pwd', 'uname'], timeout=None, debug=False, logfile='sshlogs.logs'):
"""Initializes the Ssh Traffic object. kwargs: :client (va_lab linux... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ssh:
"""Ssh implements the Ssh traffic class."""
def __init__(self, client=None, destination=None, userid='varmour', passwd='varmour', rcmd=['ls', 'pwd', 'uname'], timeout=None, debug=False, logfile='sshlogs.logs'):
"""Initializes the Ssh Traffic object. kwargs: :client (va_lab linux device objec... | the_stack_v2_python_sparse | automation/vats/ssh.py | 18782967131/test | train | 1 |
805bfbf43cf1efe8510ae0c42617b37696836059 | [
"for clean, _ in self.file_list:\n proc = subprocess.Popen(['../mat-cli', '-c', clean], stdout=subprocess.PIPE)\n stdout, _ = proc.communicate()\n self.assertEqual(stdout.strip('\\n'), '[+] %s is clean' % clean)",
"for _, dirty in self.file_list:\n proc = subprocess.Popen(['../mat-cli', '-c', dirty], ... | <|body_start_0|>
for clean, _ in self.file_list:
proc = subprocess.Popen(['../mat-cli', '-c', clean], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertEqual(stdout.strip('\n'), '[+] %s is clean' % clean)
<|end_body_0|>
<|body_start_1|>
for _, dirty i... | check if cli correctly check if a file is clean or not | TestisCleancli | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestisCleancli:
"""check if cli correctly check if a file is clean or not"""
def test_clean(self):
"""test is_clean on clean files"""
<|body_0|>
def test_dirty(self):
"""test is_clean on dirty files"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_003408 | 2,739 | no_license | [
{
"docstring": "test is_clean on clean files",
"name": "test_clean",
"signature": "def test_clean(self)"
},
{
"docstring": "test is_clean on dirty files",
"name": "test_dirty",
"signature": "def test_dirty(self)"
}
] | 2 | null | Implement the Python class `TestisCleancli` described below.
Class description:
check if cli correctly check if a file is clean or not
Method signatures and docstrings:
- def test_clean(self): test is_clean on clean files
- def test_dirty(self): test is_clean on dirty files | Implement the Python class `TestisCleancli` described below.
Class description:
check if cli correctly check if a file is clean or not
Method signatures and docstrings:
- def test_clean(self): test is_clean on clean files
- def test_dirty(self): test is_clean on dirty files
<|skeleton|>
class TestisCleancli:
"""... | e67b23fc4eb3e50b722a28336f93163946912bac | <|skeleton|>
class TestisCleancli:
"""check if cli correctly check if a file is clean or not"""
def test_clean(self):
"""test is_clean on clean files"""
<|body_0|>
def test_dirty(self):
"""test is_clean on dirty files"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestisCleancli:
"""check if cli correctly check if a file is clean or not"""
def test_clean(self):
"""test is_clean on clean files"""
for clean, _ in self.file_list:
proc = subprocess.Popen(['../mat-cli', '-c', clean], stdout=subprocess.PIPE)
stdout, _ = proc.commu... | the_stack_v2_python_sparse | data/python/46.py | devsagul/HanabiHack | train | 0 |
ee82efc3a6d5117ebdd9c7317dfdc0d90184844d | [
"self.color = color\nself.x = x\nself.y = y\nself.width = width\nself.height = height\nself.text = text\nself.filepath = FILEPATH\nself.textcolor = textcolor\nself.size = size",
"if outline:\n pygame.draw.rect(win, outline, (self.x - 2, self.y - 2, self.width + 4, self.height + 4), 0)\npygame.draw.rect(win, se... | <|body_start_0|>
self.color = color
self.x = x
self.y = y
self.width = width
self.height = height
self.text = text
self.filepath = FILEPATH
self.textcolor = textcolor
self.size = size
<|end_body_0|>
<|body_start_1|>
if outline:
... | button | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class button:
def __init__(self, color, x, y, width, height, FILEPATH, textcolor, text='', size=60):
"""Button Class Args: color (tuple): Color (r, g, b) x (int): Button top left coordinate y (int): Button top left y coordinate width (int): Button width in px height (int): Button height in px ... | stack_v2_sparse_classes_36k_train_003409 | 2,375 | no_license | [
{
"docstring": "Button Class Args: color (tuple): Color (r, g, b) x (int): Button top left coordinate y (int): Button top left y coordinate width (int): Button width in px height (int): Button height in px FILEPATH (str): File path for fonts file textcolor (tuple): Text color in (r, g, b) text (str, optional): ... | 3 | stack_v2_sparse_classes_30k_train_014574 | Implement the Python class `button` described below.
Class description:
Implement the button class.
Method signatures and docstrings:
- def __init__(self, color, x, y, width, height, FILEPATH, textcolor, text='', size=60): Button Class Args: color (tuple): Color (r, g, b) x (int): Button top left coordinate y (int): ... | Implement the Python class `button` described below.
Class description:
Implement the button class.
Method signatures and docstrings:
- def __init__(self, color, x, y, width, height, FILEPATH, textcolor, text='', size=60): Button Class Args: color (tuple): Color (r, g, b) x (int): Button top left coordinate y (int): ... | 9bace5f633e5c034a432e9d05e9c4f815ba3cd53 | <|skeleton|>
class button:
def __init__(self, color, x, y, width, height, FILEPATH, textcolor, text='', size=60):
"""Button Class Args: color (tuple): Color (r, g, b) x (int): Button top left coordinate y (int): Button top left y coordinate width (int): Button width in px height (int): Button height in px ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class button:
def __init__(self, color, x, y, width, height, FILEPATH, textcolor, text='', size=60):
"""Button Class Args: color (tuple): Color (r, g, b) x (int): Button top left coordinate y (int): Button top left y coordinate width (int): Button width in px height (int): Button height in px FILEPATH (str)... | the_stack_v2_python_sparse | Algorithms/nodes/button.py | studpeps/Algorithm-Maze-Builder | train | 0 | |
6420d70b7357a13f00e3f107df7832798e1d70a4 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | The greeting service definition. | GreeterServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GreeterServicer:
"""The greeting service definition."""
def SayHello(self, request, context):
"""Sends a greeting"""
<|body_0|>
def SayHelloAgain(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_003410 | 9,709 | no_license | [
{
"docstring": "Sends a greeting",
"name": "SayHello",
"signature": "def SayHello(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SayHelloAgain",
"signature": "def SayHelloAgain(self, request, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005194 | Implement the Python class `GreeterServicer` described below.
Class description:
The greeting service definition.
Method signatures and docstrings:
- def SayHello(self, request, context): Sends a greeting
- def SayHelloAgain(self, request, context): Missing associated documentation comment in .proto file. | Implement the Python class `GreeterServicer` described below.
Class description:
The greeting service definition.
Method signatures and docstrings:
- def SayHello(self, request, context): Sends a greeting
- def SayHelloAgain(self, request, context): Missing associated documentation comment in .proto file.
<|skeleton... | af490823a1b016867d8119a7e0bb5e0c3e2a60a9 | <|skeleton|>
class GreeterServicer:
"""The greeting service definition."""
def SayHello(self, request, context):
"""Sends a greeting"""
<|body_0|>
def SayHelloAgain(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GreeterServicer:
"""The greeting service definition."""
def SayHello(self, request, context):
"""Sends a greeting"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def... | the_stack_v2_python_sparse | joinorder_rpc/server/join_order_pb2_grpc.py | ehds/learned-tidb | train | 0 |
3d53c1aec4a26c471e66d8c60b20d73e7b36de34 | [
"key_list = ['decision_table_name', 'event_to_time', 'request_reception_time', 'event_info', 'trace_id']\nfor k in key_list:\n if k not in notify_param:\n notify_param[k] = ''\nsuper(OASEMailUnknownEventNotify, self).__init__(self.MAILACC, addr_to, '', '', inquiry_url, login_url, charset)\nself.create_mai... | <|body_start_0|>
key_list = ['decision_table_name', 'event_to_time', 'request_reception_time', 'event_info', 'trace_id']
for k in key_list:
if k not in notify_param:
notify_param[k] = ''
super(OASEMailUnknownEventNotify, self).__init__(self.MAILACC, addr_to, '', '', i... | [クラス概要] 未知事象通知メール | OASEMailUnknownEventNotify | [
"Apache-2.0",
"BSD-3-Clause",
"LGPL-3.0-only",
"MIT",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OASEMailUnknownEventNotify:
"""[クラス概要] 未知事象通知メール"""
def __init__(self, addr_to, notify_param, inquiry_url, login_url, charset='utf-8'):
"""[メソッド概要] 初期化処理 [引数] addr_to : str 宛先メールアドレス dt_name : str ディシジョンテーブル名 evinfo : str リクエストされたイベント情報"""
<|body_0|>
def create_mail_text... | stack_v2_sparse_classes_36k_train_003411 | 20,173 | permissive | [
{
"docstring": "[メソッド概要] 初期化処理 [引数] addr_to : str 宛先メールアドレス dt_name : str ディシジョンテーブル名 evinfo : str リクエストされたイベント情報",
"name": "__init__",
"signature": "def __init__(self, addr_to, notify_param, inquiry_url, login_url, charset='utf-8')"
},
{
"docstring": "[メソッド概要] メール本文作成 [引数] dt_name : str ディシジョンテ... | 2 | null | Implement the Python class `OASEMailUnknownEventNotify` described below.
Class description:
[クラス概要] 未知事象通知メール
Method signatures and docstrings:
- def __init__(self, addr_to, notify_param, inquiry_url, login_url, charset='utf-8'): [メソッド概要] 初期化処理 [引数] addr_to : str 宛先メールアドレス dt_name : str ディシジョンテーブル名 evinfo : str リクエスト... | Implement the Python class `OASEMailUnknownEventNotify` described below.
Class description:
[クラス概要] 未知事象通知メール
Method signatures and docstrings:
- def __init__(self, addr_to, notify_param, inquiry_url, login_url, charset='utf-8'): [メソッド概要] 初期化処理 [引数] addr_to : str 宛先メールアドレス dt_name : str ディシジョンテーブル名 evinfo : str リクエスト... | c00ea4fe1bf4b4a18d545aabeaaf1d95c7664b94 | <|skeleton|>
class OASEMailUnknownEventNotify:
"""[クラス概要] 未知事象通知メール"""
def __init__(self, addr_to, notify_param, inquiry_url, login_url, charset='utf-8'):
"""[メソッド概要] 初期化処理 [引数] addr_to : str 宛先メールアドレス dt_name : str ディシジョンテーブル名 evinfo : str リクエストされたイベント情報"""
<|body_0|>
def create_mail_text... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OASEMailUnknownEventNotify:
"""[クラス概要] 未知事象通知メール"""
def __init__(self, addr_to, notify_param, inquiry_url, login_url, charset='utf-8'):
"""[メソッド概要] 初期化処理 [引数] addr_to : str 宛先メールアドレス dt_name : str ディシジョンテーブル名 evinfo : str リクエストされたイベント情報"""
key_list = ['decision_table_name', 'event_to_time... | the_stack_v2_python_sparse | oase-root/libs/webcommonlibs/oase_mail.py | exastro-suite/oase | train | 10 |
7cd3e8f61b99ef9e8e8232a33358bfd1f2a463b9 | [
"a = min(nums)\nres = 0\nfor i in range(len(nums)):\n cur = nums[i] - a\n res += cur\nreturn res",
"nums.sort()\nres = 0\nfor i in range(len(nums)):\n cur = nums[i] - nums[0]\n res += cur\nreturn res",
"nums.sort()\nres = 0\nlast_cur = 0\ncur_sum = 0\ni_max = len(nums) - 1\ni = 0\nwhile True:\n i... | <|body_start_0|>
a = min(nums)
res = 0
for i in range(len(nums)):
cur = nums[i] - a
res += cur
return res
<|end_body_0|>
<|body_start_1|>
nums.sort()
res = 0
for i in range(len(nums)):
cur = nums[i] - nums[0]
res +=... | Ex453 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ex453:
def minMoves0(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def minMoves0(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def minMoves(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_36k_train_003412 | 1,375 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "minMoves0",
"signature": "def minMoves0(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "minMoves0",
"signature": "def minMoves0(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: ... | 3 | null | Implement the Python class `Ex453` described below.
Class description:
Implement the Ex453 class.
Method signatures and docstrings:
- def minMoves0(self, nums): :type nums: List[int] :rtype: int
- def minMoves0(self, nums): :type nums: List[int] :rtype: int
- def minMoves(self, nums): :type nums: List[int] :rtype: in... | Implement the Python class `Ex453` described below.
Class description:
Implement the Ex453 class.
Method signatures and docstrings:
- def minMoves0(self, nums): :type nums: List[int] :rtype: int
- def minMoves0(self, nums): :type nums: List[int] :rtype: int
- def minMoves(self, nums): :type nums: List[int] :rtype: in... | 8f9327a1879949f61b462cc6c82e00e7c27b8b07 | <|skeleton|>
class Ex453:
def minMoves0(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def minMoves0(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def minMoves(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ex453:
def minMoves0(self, nums):
""":type nums: List[int] :rtype: int"""
a = min(nums)
res = 0
for i in range(len(nums)):
cur = nums[i] - a
res += cur
return res
def minMoves0(self, nums):
""":type nums: List[int] :rtype: int"""
... | the_stack_v2_python_sparse | LeetCode/Ex400/Ex453.py | JasonVann/CrackingCodingInterview | train | 0 | |
8c2a99816f180eb1522a6eb22c3de3b1f825ba6d | [
"super(DiskIO, self).__init__(host, port, community, version)\nself.disk = disk\nINDEXES['values'][disk] = None\nfor key, item in PERFDATA['data'].items():\n item['index_label'] = disk\nself.sleep = sleep\nself.io_key = '%s:check_disk_io:%s' % (self.host, self.disk)",
"exist, contains = self.cache.check_if_exi... | <|body_start_0|>
super(DiskIO, self).__init__(host, port, community, version)
self.disk = disk
INDEXES['values'][disk] = None
for key, item in PERFDATA['data'].items():
item['index_label'] = disk
self.sleep = sleep
self.io_key = '%s:check_disk_io:%s' % (self.h... | DiskIO | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiskIO:
def __init__(self, host, port, community, version, disk, sleep):
"""Class Initialization :param host: hostname of the machine :param port: port number of SNMP in the machine :param community: SNMP community :param version: SNMP version (1, 2c, 3) :param disk: label of the disk in... | stack_v2_sparse_classes_36k_train_003413 | 6,438 | no_license | [
{
"docstring": "Class Initialization :param host: hostname of the machine :param port: port number of SNMP in the machine :param community: SNMP community :param version: SNMP version (1, 2c, 3) :param disk: label of the disk in the machine to monitor :param sleep: sleep time to get I/O differences if there are... | 4 | stack_v2_sparse_classes_30k_train_009376 | Implement the Python class `DiskIO` described below.
Class description:
Implement the DiskIO class.
Method signatures and docstrings:
- def __init__(self, host, port, community, version, disk, sleep): Class Initialization :param host: hostname of the machine :param port: port number of SNMP in the machine :param comm... | Implement the Python class `DiskIO` described below.
Class description:
Implement the DiskIO class.
Method signatures and docstrings:
- def __init__(self, host, port, community, version, disk, sleep): Class Initialization :param host: hostname of the machine :param port: port number of SNMP in the machine :param comm... | fc8c808c46f65696f7c6ac8fd6266c1091dbb14d | <|skeleton|>
class DiskIO:
def __init__(self, host, port, community, version, disk, sleep):
"""Class Initialization :param host: hostname of the machine :param port: port number of SNMP in the machine :param community: SNMP community :param version: SNMP version (1, 2c, 3) :param disk: label of the disk in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiskIO:
def __init__(self, host, port, community, version, disk, sleep):
"""Class Initialization :param host: hostname of the machine :param port: port number of SNMP in the machine :param community: SNMP community :param version: SNMP version (1, 2c, 3) :param disk: label of the disk in the machine t... | the_stack_v2_python_sparse | old/check_disk_io.py | aurimukas/icinga2_plugins | train | 3 | |
c858f3e2a1977317f395dfe0f1e4948d519aaa6b | [
"if x == 0:\n return x\nupper = x / 2 + 1\nlower = 1\nwhile upper - lower > 1:\n middle = int((upper + lower) / 2)\n if x > middle ** 2:\n lower = middle\n elif x < middle ** 2:\n upper = middle\n elif x == middle ** 2:\n return middle\nreturn lower",
"if x <= 1:\n return x\... | <|body_start_0|>
if x == 0:
return x
upper = x / 2 + 1
lower = 1
while upper - lower > 1:
middle = int((upper + lower) / 2)
if x > middle ** 2:
lower = middle
elif x < middle ** 2:
upper = middle
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt_float(self, x):
"""this method is useful for if we need to retun a more accurate float number type x: int rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_003414 | 1,038 | no_license | [
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt",
"signature": "def mySqrt(self, x)"
},
{
"docstring": "this method is useful for if we need to retun a more accurate float number type x: int rtype: float",
"name": "mySqrt_float",
"signature": "def mySqrt_float(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000627 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt(self, x): :type x: int :rtype: int
- def mySqrt_float(self, x): this method is useful for if we need to retun a more accurate float number type x: int rtype: float | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt(self, x): :type x: int :rtype: int
- def mySqrt_float(self, x): this method is useful for if we need to retun a more accurate float number type x: int rtype: float
<|... | 54d777e11b91c5debe49c1aef723234c66a5d2cc | <|skeleton|>
class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt_float(self, x):
"""this method is useful for if we need to retun a more accurate float number type x: int rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
if x == 0:
return x
upper = x / 2 + 1
lower = 1
while upper - lower > 1:
middle = int((upper + lower) / 2)
if x > middle ** 2:
lower = middle
el... | the_stack_v2_python_sparse | leetcode_solution/math/#69.Sqrt.py | HsiangHung/Code-Challenges | train | 0 | |
13d66e87f939505f7226a8fdeedeaf4eb0c3ade8 | [
"game_name = self.request.GET.get('term', '')\nsearched_games = Game.objects.search_by_term(game_name, annotated=False)\nreturn searched_games",
"context = super(GameSearch, self).get_context_data()\ncontext['games_list'] = self.object_list\ncontext['title'] = 'Search Results'\ncontext['searching'] = True\ncontex... | <|body_start_0|>
game_name = self.request.GET.get('term', '')
searched_games = Game.objects.search_by_term(game_name, annotated=False)
return searched_games
<|end_body_0|>
<|body_start_1|>
context = super(GameSearch, self).get_context_data()
context['games_list'] = self.object_l... | Handle searching of games. | GameSearch | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameSearch:
"""Handle searching of games."""
def get_queryset(self):
"""Search for games based on a provided term."""
<|body_0|>
def get_context_data(self):
"""Set the list and the page title."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
game... | stack_v2_sparse_classes_36k_train_003415 | 9,267 | permissive | [
{
"docstring": "Search for games based on a provided term.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Set the list and the page title.",
"name": "get_context_data",
"signature": "def get_context_data(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012553 | Implement the Python class `GameSearch` described below.
Class description:
Handle searching of games.
Method signatures and docstrings:
- def get_queryset(self): Search for games based on a provided term.
- def get_context_data(self): Set the list and the page title. | Implement the Python class `GameSearch` described below.
Class description:
Handle searching of games.
Method signatures and docstrings:
- def get_queryset(self): Search for games based on a provided term.
- def get_context_data(self): Set the list and the page title.
<|skeleton|>
class GameSearch:
"""Handle sea... | 1d9edd1959a7d401a76ced29ffbc430017d3dd8b | <|skeleton|>
class GameSearch:
"""Handle searching of games."""
def get_queryset(self):
"""Search for games based on a provided term."""
<|body_0|>
def get_context_data(self):
"""Set the list and the page title."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GameSearch:
"""Handle searching of games."""
def get_queryset(self):
"""Search for games based on a provided term."""
game_name = self.request.GET.get('term', '')
searched_games = Game.objects.search_by_term(game_name, annotated=False)
return searched_games
def get_co... | the_stack_v2_python_sparse | core/views/games.py | joshsamara/game-website | train | 3 |
4a9c3d47c77c3afe195a78d36f406d1ead16b517 | [
"self.assertTrue(binary is not None)\nself.assertEqual(binary.count('pageforest'), 1)\nself.assertEqual(binary.count('Blob'), 2)\nself.assertEqual(binary.count('myapp/mydoc/key/with/slashes/'), 2)\nself.assertEqual(binary.count('created'), 2)\nself.assertEqual(binary.count('created_ip'), 1)\nself.assertEqual(binary... | <|body_start_0|>
self.assertTrue(binary is not None)
self.assertEqual(binary.count('pageforest'), 1)
self.assertEqual(binary.count('Blob'), 2)
self.assertEqual(binary.count('myapp/mydoc/key/with/slashes/'), 2)
self.assertEqual(binary.count('created'), 2)
self.assertEqual(... | MemcacheTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MemcacheTest:
def assertProtoBuf(self, binary, data=None):
"""Check binary protocol buffer."""
<|body_0|>
def test_crud(self):
"""Tests create, read, update, delete with memcache."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.assertTrue(binar... | stack_v2_sparse_classes_36k_train_003416 | 28,221 | no_license | [
{
"docstring": "Check binary protocol buffer.",
"name": "assertProtoBuf",
"signature": "def assertProtoBuf(self, binary, data=None)"
},
{
"docstring": "Tests create, read, update, delete with memcache.",
"name": "test_crud",
"signature": "def test_crud(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000230 | Implement the Python class `MemcacheTest` described below.
Class description:
Implement the MemcacheTest class.
Method signatures and docstrings:
- def assertProtoBuf(self, binary, data=None): Check binary protocol buffer.
- def test_crud(self): Tests create, read, update, delete with memcache. | Implement the Python class `MemcacheTest` described below.
Class description:
Implement the MemcacheTest class.
Method signatures and docstrings:
- def assertProtoBuf(self, binary, data=None): Check binary protocol buffer.
- def test_crud(self): Tests create, read, update, delete with memcache.
<|skeleton|>
class Me... | fb15f64b16d5cda6370ee185d047072de82f8d09 | <|skeleton|>
class MemcacheTest:
def assertProtoBuf(self, binary, data=None):
"""Check binary protocol buffer."""
<|body_0|>
def test_crud(self):
"""Tests create, read, update, delete with memcache."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MemcacheTest:
def assertProtoBuf(self, binary, data=None):
"""Check binary protocol buffer."""
self.assertTrue(binary is not None)
self.assertEqual(binary.count('pageforest'), 1)
self.assertEqual(binary.count('Blob'), 2)
self.assertEqual(binary.count('myapp/mydoc/key/wi... | the_stack_v2_python_sparse | appengine/blobs/tests.py | mckoss/pageforest | train | 0 | |
7c381b1817c9f13a8c86894569fc85b5b0c76c03 | [
"string = 'Hello, my name is Felix and these koans are based ' + \"on Ben's book: Regular Expressions in 10 minutes.\"\nm = re.search('Felix', string)\nself.assertTrue(m and m.group(0) and (m.group(0) == 'Felix'), 'I want my name')",
"string = 'Hello, my name is Felix and these koans are based ' + \"on Ben's book... | <|body_start_0|>
string = 'Hello, my name is Felix and these koans are based ' + "on Ben's book: Regular Expressions in 10 minutes."
m = re.search('Felix', string)
self.assertTrue(m and m.group(0) and (m.group(0) == 'Felix'), 'I want my name')
<|end_body_0|>
<|body_start_1|>
string = 'H... | These koans are based on Ben's book: Regular Expressions in 10 minutes. I found this book very useful, so I decided to write a koan file in order to practice everything it taught me. http://www.forta.com/books/0672325667/ | AboutRegex | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AboutRegex:
"""These koans are based on Ben's book: Regular Expressions in 10 minutes. I found this book very useful, so I decided to write a koan file in order to practice everything it taught me. http://www.forta.com/books/0672325667/"""
def test_matching_literal_text(self):
"""Les... | stack_v2_sparse_classes_36k_train_003417 | 5,209 | permissive | [
{
"docstring": "Lesson 1 Matching Literal String",
"name": "test_matching_literal_text",
"signature": "def test_matching_literal_text(self)"
},
{
"docstring": "Lesson 1 -- How many matches? The default behaviour of most regular expression engines is to return just the first match. In python you ... | 6 | null | Implement the Python class `AboutRegex` described below.
Class description:
These koans are based on Ben's book: Regular Expressions in 10 minutes. I found this book very useful, so I decided to write a koan file in order to practice everything it taught me. http://www.forta.com/books/0672325667/
Method signatures an... | Implement the Python class `AboutRegex` described below.
Class description:
These koans are based on Ben's book: Regular Expressions in 10 minutes. I found this book very useful, so I decided to write a koan file in order to practice everything it taught me. http://www.forta.com/books/0672325667/
Method signatures an... | 1c5b1433c3d6bfd834df35dee08607fcbdd9f4e3 | <|skeleton|>
class AboutRegex:
"""These koans are based on Ben's book: Regular Expressions in 10 minutes. I found this book very useful, so I decided to write a koan file in order to practice everything it taught me. http://www.forta.com/books/0672325667/"""
def test_matching_literal_text(self):
"""Les... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AboutRegex:
"""These koans are based on Ben's book: Regular Expressions in 10 minutes. I found this book very useful, so I decided to write a koan file in order to practice everything it taught me. http://www.forta.com/books/0672325667/"""
def test_matching_literal_text(self):
"""Lesson 1 Matchin... | the_stack_v2_python_sparse | python/python_koans/python2/koans/about_regex.py | topliceanu/learn | train | 26 |
e4617a8df60833b78d5bab20ba34a2ae40340e99 | [
"scheduler = AsyncIOScheduler()\nscheduler.add_job(job_fn, misfire_grace_time=None, timezone=EASTERN_STANDARD_TIME, **kwargs)\nscheduler.start()\nif not scheduler.running:\n asyncio.get_event_loop().run_forever()",
"scheduler = AsyncIOScheduler()\nscheduler.add_job(job_fn, misfire_grace_time=None, timezone=EAS... | <|body_start_0|>
scheduler = AsyncIOScheduler()
scheduler.add_job(job_fn, misfire_grace_time=None, timezone=EASTERN_STANDARD_TIME, **kwargs)
scheduler.start()
if not scheduler.running:
asyncio.get_event_loop().run_forever()
<|end_body_0|>
<|body_start_1|>
scheduler =... | Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler | DaemonHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DaemonHelper:
"""Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler"""
def add(job_fn, **kwargs) -> None:
"""Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedula... | stack_v2_sparse_classes_36k_train_003418 | 1,537 | permissive | [
{
"docstring": "Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedular",
"name": "add",
"signature": "def add(job_fn, **kwargs) -> None"
},
{
"docstring": "Create a simple job with a function for the s... | 2 | stack_v2_sparse_classes_30k_train_018427 | Implement the Python class `DaemonHelper` described below.
Class description:
Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler
Method signatures and docstrings:
- def add(job_fn, **kwargs) -> None: Create a simple job with available kwargs from the scheduler Parameters ----------- **kwarg... | Implement the Python class `DaemonHelper` described below.
Class description:
Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler
Method signatures and docstrings:
- def add(job_fn, **kwargs) -> None: Create a simple job with available kwargs from the scheduler Parameters ----------- **kwarg... | f438c6a7d1f2c1797755eb8287bc1499c0cf2a88 | <|skeleton|>
class DaemonHelper:
"""Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler"""
def add(job_fn, **kwargs) -> None:
"""Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedula... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DaemonHelper:
"""Simple wrapper class to wire up cron and interval tasks with AsyncIoScheduler"""
def add(job_fn, **kwargs) -> None:
"""Create a simple job with available kwargs from the scheduler Parameters ----------- **kwargs: any Keyword arguments to align with the async schedular"""
... | the_stack_v2_python_sparse | src/core/daemon.py | fugwenna/bunkbot | train | 2 |
4e0faa6e994386076b722987ca909bbb149f1607 | [
"row = len(matrix)\nif row == 0:\n return 0\narea = 0\ncol = len(matrix[0])\nheights: List[int] = [0] * col\nfor i in range(row):\n for j in range(col):\n if matrix[i][j] == '1':\n heights[j] += 1\n else:\n heights[j] = 0\n area = max(area, self.largest_rectangle_area(he... | <|body_start_0|>
row = len(matrix)
if row == 0:
return 0
area = 0
col = len(matrix[0])
heights: List[int] = [0] * col
for i in range(row):
for j in range(col):
if matrix[i][j] == '1':
heights[j] += 1
... | OfficialSolution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfficialSolution:
def maximal_rectangle(self, matrix: List[List[str]]) -> int:
"""计算每层高度,求柱形图中最大的矩形面积。"""
<|body_0|>
def largest_rectangle_area(self, heights: List[int]) -> int:
"""单调栈。"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
row = len(matri... | stack_v2_sparse_classes_36k_train_003419 | 3,665 | no_license | [
{
"docstring": "计算每层高度,求柱形图中最大的矩形面积。",
"name": "maximal_rectangle",
"signature": "def maximal_rectangle(self, matrix: List[List[str]]) -> int"
},
{
"docstring": "单调栈。",
"name": "largest_rectangle_area",
"signature": "def largest_rectangle_area(self, heights: List[int]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_013907 | Implement the Python class `OfficialSolution` described below.
Class description:
Implement the OfficialSolution class.
Method signatures and docstrings:
- def maximal_rectangle(self, matrix: List[List[str]]) -> int: 计算每层高度,求柱形图中最大的矩形面积。
- def largest_rectangle_area(self, heights: List[int]) -> int: 单调栈。 | Implement the Python class `OfficialSolution` described below.
Class description:
Implement the OfficialSolution class.
Method signatures and docstrings:
- def maximal_rectangle(self, matrix: List[List[str]]) -> int: 计算每层高度,求柱形图中最大的矩形面积。
- def largest_rectangle_area(self, heights: List[int]) -> int: 单调栈。
<|skeleton|... | 6932d69353b94ec824dd0ddc86a92453f6673232 | <|skeleton|>
class OfficialSolution:
def maximal_rectangle(self, matrix: List[List[str]]) -> int:
"""计算每层高度,求柱形图中最大的矩形面积。"""
<|body_0|>
def largest_rectangle_area(self, heights: List[int]) -> int:
"""单调栈。"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OfficialSolution:
def maximal_rectangle(self, matrix: List[List[str]]) -> int:
"""计算每层高度,求柱形图中最大的矩形面积。"""
row = len(matrix)
if row == 0:
return 0
area = 0
col = len(matrix[0])
heights: List[int] = [0] * col
for i in range(row):
fo... | the_stack_v2_python_sparse | 0085_maximal-rectangle.py | Nigirimeshi/leetcode | train | 0 | |
897fdbe53e5e28a8bd8d7101b59c1625d47c2f80 | [
"super().__init__(*args, **kwargs)\nself.model_dir: str = model_dir\nfrom .common import Filter\nself._transforms = [Filter(reserved_keys=['input', 'target'])]",
"for t in self._transforms:\n data = t(data)\nreturn data"
] | <|body_start_0|>
super().__init__(*args, **kwargs)
self.model_dir: str = model_dir
from .common import Filter
self._transforms = [Filter(reserved_keys=['input', 'target'])]
<|end_body_0|>
<|body_start_1|>
for t in self._transforms:
data = t(data)
return data
... | ImageDenoisePreprocessor | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageDenoisePreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""Args: model_dir (str): model path"""
<|body_0|>
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
"""process the raw input data Args: data Dict[str, Any] Returns: Dict[str, An... | stack_v2_sparse_classes_36k_train_003420 | 8,906 | permissive | [
{
"docstring": "Args: model_dir (str): model path",
"name": "__init__",
"signature": "def __init__(self, model_dir: str, *args, **kwargs)"
},
{
"docstring": "process the raw input data Args: data Dict[str, Any] Returns: Dict[str, Any]: the preprocessed data",
"name": "__call__",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_012404 | Implement the Python class `ImageDenoisePreprocessor` described below.
Class description:
Implement the ImageDenoisePreprocessor class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, *args, **kwargs): Args: model_dir (str): model path
- def __call__(self, data: Dict[str, Any]) -> Dict[str, Any... | Implement the Python class `ImageDenoisePreprocessor` described below.
Class description:
Implement the ImageDenoisePreprocessor class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, *args, **kwargs): Args: model_dir (str): model path
- def __call__(self, data: Dict[str, Any]) -> Dict[str, Any... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class ImageDenoisePreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""Args: model_dir (str): model path"""
<|body_0|>
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
"""process the raw input data Args: data Dict[str, Any] Returns: Dict[str, An... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageDenoisePreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""Args: model_dir (str): model path"""
super().__init__(*args, **kwargs)
self.model_dir: str = model_dir
from .common import Filter
self._transforms = [Filter(reserved_keys=['input', 'target... | the_stack_v2_python_sparse | ai/modelscope/modelscope/preprocessors/image.py | alldatacenter/alldata | train | 774 | |
4aa234aacdb5389f8238abbddc613c11a0f1bed5 | [
"replace_token = True\nvalue_match = re.match('[uU]rl(\\\\[.*?\\\\])', self.replacement)\nif value_match:\n value_list_str = value_match.group(1)\n value_list = eval(value_list_str)\n for each in value_list:\n if each not in ['ip_host', 'fqdn_host', 'path', 'query', 'protocol', 'full']:\n ... | <|body_start_0|>
replace_token = True
value_match = re.match('[uU]rl(\\[.*?\\])', self.replacement)
if value_match:
value_list_str = value_match.group(1)
value_list = eval(value_list_str)
for each in value_list:
if each not in ['ip_host', 'fqdn... | UrlRule | UrlRule | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UrlRule:
"""UrlRule"""
def replace(self, sample, token_count):
"""Yields a random url replacement value from the list of values mentioned in token. Possible values: ["ip_host", "fqdn_host", "path", "query", "protocol", "full"] Args: sample (SampleEvent): Instance containing event inf... | stack_v2_sparse_classes_36k_train_003421 | 45,700 | permissive | [
{
"docstring": "Yields a random url replacement value from the list of values mentioned in token. Possible values: [\"ip_host\", \"fqdn_host\", \"path\", \"query\", \"protocol\", \"full\"] Args: sample (SampleEvent): Instance containing event info token_count (int): No. of token in sample event where rule is ap... | 2 | stack_v2_sparse_classes_30k_train_005467 | Implement the Python class `UrlRule` described below.
Class description:
UrlRule
Method signatures and docstrings:
- def replace(self, sample, token_count): Yields a random url replacement value from the list of values mentioned in token. Possible values: ["ip_host", "fqdn_host", "path", "query", "protocol", "full"] ... | Implement the Python class `UrlRule` described below.
Class description:
UrlRule
Method signatures and docstrings:
- def replace(self, sample, token_count): Yields a random url replacement value from the list of values mentioned in token. Possible values: ["ip_host", "fqdn_host", "path", "query", "protocol", "full"] ... | 082f75cddcc4975f0e97eded5fcb77e864874292 | <|skeleton|>
class UrlRule:
"""UrlRule"""
def replace(self, sample, token_count):
"""Yields a random url replacement value from the list of values mentioned in token. Possible values: ["ip_host", "fqdn_host", "path", "query", "protocol", "full"] Args: sample (SampleEvent): Instance containing event inf... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UrlRule:
"""UrlRule"""
def replace(self, sample, token_count):
"""Yields a random url replacement value from the list of values mentioned in token. Possible values: ["ip_host", "fqdn_host", "path", "query", "protocol", "full"] Args: sample (SampleEvent): Instance containing event info token_count... | the_stack_v2_python_sparse | pytest_splunk_addon/standard_lib/sample_generation/rule.py | livehybrid/pytest-splunk-addon | train | 0 |
8d2315e4e4a29f9b34993beab48de9b8414c48bf | [
"self.__multiDomain = multiDomain\nself.__ns = ns\nself.__domain = domain\nself.__watchingPaths = []\nself.__watchingVnfs = dict()",
"nsLinkBw = self.__ns.getLink(vnf1, vnf2)['bw']\nif path[-1][0] != path[-1][-1]:\n for nodeA, nodeB in path:\n self.__multiDomain.incrLnkResource(self.__domain, nodeA, nod... | <|body_start_0|>
self.__multiDomain = multiDomain
self.__ns = ns
self.__domain = domain
self.__watchingPaths = []
self.__watchingVnfs = dict()
<|end_body_0|>
<|body_start_1|>
nsLinkBw = self.__ns.getLink(vnf1, vnf2)['bw']
if path[-1][0] != path[-1][-1]:
... | Class to monitor the resources consumption during mapping | ResourcesWatchDog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourcesWatchDog:
"""Class to monitor the resources consumption during mapping"""
def __init__(self, multiDomain, ns, domain):
"""Initializes the watch dog to with the multiDomain, NS and domain resources that is going to take care of :multiDomain: MultiDomain instance :ns: NS insta... | stack_v2_sparse_classes_36k_train_003422 | 5,618 | no_license | [
{
"docstring": "Initializes the watch dog to with the multiDomain, NS and domain resources that is going to take care of :multiDomain: MultiDomain instance :ns: NS instance :domain: domain index",
"name": "__init__",
"signature": "def __init__(self, multiDomain, ns, domain)"
},
{
"docstring": "C... | 5 | null | Implement the Python class `ResourcesWatchDog` described below.
Class description:
Class to monitor the resources consumption during mapping
Method signatures and docstrings:
- def __init__(self, multiDomain, ns, domain): Initializes the watch dog to with the multiDomain, NS and domain resources that is going to take... | Implement the Python class `ResourcesWatchDog` described below.
Class description:
Class to monitor the resources consumption during mapping
Method signatures and docstrings:
- def __init__(self, multiDomain, ns, domain): Initializes the watch dog to with the multiDomain, NS and domain resources that is going to take... | ff0d9cbcf4bbaa0118a8e12de264ae0457352def | <|skeleton|>
class ResourcesWatchDog:
"""Class to monitor the resources consumption during mapping"""
def __init__(self, multiDomain, ns, domain):
"""Initializes the watch dog to with the multiDomain, NS and domain resources that is going to take care of :multiDomain: MultiDomain instance :ns: NS insta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResourcesWatchDog:
"""Class to monitor the resources consumption during mapping"""
def __init__(self, multiDomain, ns, domain):
"""Initializes the watch dog to with the multiDomain, NS and domain resources that is going to take care of :multiDomain: MultiDomain instance :ns: NS instance :domain: ... | the_stack_v2_python_sparse | pa/cluster-garrote/R2/generator/src/vnfsMapping/ResourcesWatchDog.py | NajibOdhah/5gr-so | train | 0 |
0585a76b1418b599c32a59a6effb8a81cfcf5923 | [
"if parameters.Has(old_variable_name):\n if not parameters.Has(new_variable_name):\n KM.Logger.PrintWarning(context_string, '\\n\\x1b[1;31m[DEPRECATED INPUT PARAMETERS] \\x1b[0m' + \"'\" + old_variable_name + \"' is deprecated; use '\" + new_variable_name + \"' instead.\")\n return True\n else:\... | <|body_start_0|>
if parameters.Has(old_variable_name):
if not parameters.Has(new_variable_name):
KM.Logger.PrintWarning(context_string, '\n\x1b[1;31m[DEPRECATED INPUT PARAMETERS] \x1b[0m' + "'" + old_variable_name + "' is deprecated; use '" + new_variable_name + "' instead.")
... | This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this encapsulation are: 1. Avoid repeating too much cod... | DeprecationManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeprecationManager:
"""This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this enca... | stack_v2_sparse_classes_36k_train_003423 | 3,012 | permissive | [
{
"docstring": "Check if a given deprecated variable is present in a given parameters object (Parameters object)",
"name": "HasDeprecatedVariable",
"signature": "def HasDeprecatedVariable(context_string, parameters, old_variable_name, new_variable_name)"
},
{
"docstring": "Replace a key by anoth... | 2 | null | Implement the Python class `DeprecationManager` described below.
Class description:
This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. ... | Implement the Python class `DeprecationManager` described below.
Class description:
This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. ... | 366949ec4e3651702edc6ac3061d2988f10dd271 | <|skeleton|>
class DeprecationManager:
"""This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this enca... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeprecationManager:
"""This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this encapsulation are... | the_stack_v2_python_sparse | kratos/python_scripts/deprecation_management.py | KratosMultiphysics/Kratos | train | 994 |
2e22951686867aa72a212ce803f5395b70a991a1 | [
"ind = [str(i) for i in range(1, n + 1)]\nf = [1, 1, 2, 6, 24, 120, 720, 5040, 40320]\nnum = ''\nnew_n = n - 1\nfor i in range(n):\n mi = f[new_n]\n index = k // mi\n if k % mi == 0:\n index -= 1\n num += ind.pop(index)\n k %= mi\n new_n -= 1\nreturn num",
"ind = [str(i) for i in range(1,... | <|body_start_0|>
ind = [str(i) for i in range(1, n + 1)]
f = [1, 1, 2, 6, 24, 120, 720, 5040, 40320]
num = ''
new_n = n - 1
for i in range(n):
mi = f[new_n]
index = k // mi
if k % mi == 0:
index -= 1
num += ind.pop(i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation_1(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ind = [str(i) for i in range(... | stack_v2_sparse_classes_36k_train_003424 | 1,235 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation",
"signature": "def getPermutation(self, n, k)"
},
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation_1",
"signature": "def getPermutation_1(self, n, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020872 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation_1(self, n, k): :type n: int :type k: int :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation_1(self, n, k): :type n: int :type k: int :rtype: str
<|skeleton|>
class Solution:
... | 5b535795cdd742b7810ea163e0868b022736647d | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation_1(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
ind = [str(i) for i in range(1, n + 1)]
f = [1, 1, 2, 6, 24, 120, 720, 5040, 40320]
num = ''
new_n = n - 1
for i in range(n):
mi = f[new_n]
index = k //... | the_stack_v2_python_sparse | LeetCode_Kth_Permutation_Sequence.py | Cbkhare/Codes | train | 0 | |
d3ebd052df120a4f43fd5c4cbf7101889991661c | [
"proxy = mgmt_session.proxy(RwsdnalYang)\nxpath = \"/rw-project:project[rw-project:name='default']/sdn-accounts/sdn-account-list[name=%s]\" % quoted_key(sdn_account_name)\nproxy.delete_config(xpath)",
"proxy = mgmt_session.proxy(RwSdnYang)\nxpath = '/rw-project:project[rw-project:name=\"default\"]/sdn/account[nam... | <|body_start_0|>
proxy = mgmt_session.proxy(RwsdnalYang)
xpath = "/rw-project:project[rw-project:name='default']/sdn-accounts/sdn-account-list[name=%s]" % quoted_key(sdn_account_name)
proxy.delete_config(xpath)
<|end_body_0|>
<|body_start_1|>
proxy = mgmt_session.proxy(RwSdnYang)
... | TestSdnTeardown | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSdnTeardown:
def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name):
"""Unconfigure sdn account"""
<|body_0|>
def test_delete_openstack_sdn_account(self, mgmt_session, openstack_sdn_account_name):
"""Unconfigure sdn account"""
<|body_1|>
<... | stack_v2_sparse_classes_36k_train_003425 | 8,232 | no_license | [
{
"docstring": "Unconfigure sdn account",
"name": "test_delete_odl_sdn_account",
"signature": "def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name)"
},
{
"docstring": "Unconfigure sdn account",
"name": "test_delete_openstack_sdn_account",
"signature": "def test_delete_op... | 2 | null | Implement the Python class `TestSdnTeardown` described below.
Class description:
Implement the TestSdnTeardown class.
Method signatures and docstrings:
- def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name): Unconfigure sdn account
- def test_delete_openstack_sdn_account(self, mgmt_session, openstack... | Implement the Python class `TestSdnTeardown` described below.
Class description:
Implement the TestSdnTeardown class.
Method signatures and docstrings:
- def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name): Unconfigure sdn account
- def test_delete_openstack_sdn_account(self, mgmt_session, openstack... | cdd0abe80a76d533d08a51c7970d8ded06624b7d | <|skeleton|>
class TestSdnTeardown:
def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name):
"""Unconfigure sdn account"""
<|body_0|>
def test_delete_openstack_sdn_account(self, mgmt_session, openstack_sdn_account_name):
"""Unconfigure sdn account"""
<|body_1|>
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSdnTeardown:
def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name):
"""Unconfigure sdn account"""
proxy = mgmt_session.proxy(RwsdnalYang)
xpath = "/rw-project:project[rw-project:name='default']/sdn-accounts/sdn-account-list[name=%s]" % quoted_key(sdn_account_name)
... | the_stack_v2_python_sparse | osm/SO/rwlaunchpad/ra/pytest/test_launchpad.py | dennis-me/Pishahang | train | 2 | |
0db09147c112199a1a5bae054547ef7d292847a8 | [
"args = parser.parse_args()\npage = args.get('pgnum')\nevent_request_id = args.get('event_request_id')\ntask_request_id = args.get('task_request_id')\nsubmitter = args.get('submitter')\noperation_resources_id = args.get('operation_resources_id')\nif not page:\n page = 1\noptions = {'page': page, 'event_request_i... | <|body_start_0|>
args = parser.parse_args()
page = args.get('pgnum')
event_request_id = args.get('event_request_id')
task_request_id = args.get('task_request_id')
submitter = args.get('submitter')
operation_resources_id = args.get('operation_resources_id')
if not ... | LogEvent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogEvent:
def get(self):
"""获取事件日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: event_request_id type: string description: 请求id - in: query name: task_request_id type: string description: 任务id - in: query name: page type: int description: 页码 - name... | stack_v2_sparse_classes_36k_train_003426 | 3,987 | no_license | [
{
"docstring": "获取事件日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: event_request_id type: string description: 请求id - in: query name: task_request_id type: string description: 任务id - in: query name: page type: int description: 页码 - name: submitter type: string in: query d... | 2 | null | Implement the Python class `LogEvent` described below.
Class description:
Implement the LogEvent class.
Method signatures and docstrings:
- def get(self): 获取事件日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: event_request_id type: string description: 请求id - in: query name: task_... | Implement the Python class `LogEvent` described below.
Class description:
Implement the LogEvent class.
Method signatures and docstrings:
- def get(self): 获取事件日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: event_request_id type: string description: 请求id - in: query name: task_... | 73246bbd492fd991e0329b9a011b5380b11a1618 | <|skeleton|>
class LogEvent:
def get(self):
"""获取事件日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: event_request_id type: string description: 请求id - in: query name: task_request_id type: string description: 任务id - in: query name: page type: int description: 页码 - name... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogEvent:
def get(self):
"""获取事件日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: event_request_id type: string description: 请求id - in: query name: task_request_id type: string description: 任务id - in: query name: page type: int description: 页码 - name: submitter ty... | the_stack_v2_python_sparse | app/main/base/apis/event_logs.py | zhouliang0v0/naguan-kpy | train | 0 | |
a6729489e4e5ee63bc402903e393d8a1ac798027 | [
"n = len(floor)\ndp = [[0 for _ in range(numCarpets + 1)] for _ in range(n)]\ndp[0][0] = int(floor[0])\nfor i in range(1, n):\n dp[i][0] = dp[i - 1][0] + int(floor[i])\nfor i in range(1, n):\n for j in range(1, numCarpets + 1):\n dp[i][j] = min(dp[i - 1][j - 1], dp[i][j])\n curr = dp[i - 1][j] +... | <|body_start_0|>
n = len(floor)
dp = [[0 for _ in range(numCarpets + 1)] for _ in range(n)]
dp[0][0] = int(floor[0])
for i in range(1, n):
dp[i][0] = dp[i - 1][0] + int(floor[i])
for i in range(1, n):
for j in range(1, numCarpets + 1):
dp[i... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minimumWhiteTiles2(self, floor: str, numCarpets: int, carpetLen: int) -> int:
"""1 <= carpetLen <= floor.length <= 1000 floor[i] is either '0' or '1'. 1 <= numCarpets <= 1000"""
<|body_0|>
def minimumWhiteTiles(self, floor: str, numCarpets: int, carpetLen: int)... | stack_v2_sparse_classes_36k_train_003427 | 2,367 | permissive | [
{
"docstring": "1 <= carpetLen <= floor.length <= 1000 floor[i] is either '0' or '1'. 1 <= numCarpets <= 1000",
"name": "minimumWhiteTiles2",
"signature": "def minimumWhiteTiles2(self, floor: str, numCarpets: int, carpetLen: int) -> int"
},
{
"docstring": "Ref: https://leetcode.com/problems/mini... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumWhiteTiles2(self, floor: str, numCarpets: int, carpetLen: int) -> int: 1 <= carpetLen <= floor.length <= 1000 floor[i] is either '0' or '1'. 1 <= numCarpets <= 1000
- ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumWhiteTiles2(self, floor: str, numCarpets: int, carpetLen: int) -> int: 1 <= carpetLen <= floor.length <= 1000 floor[i] is either '0' or '1'. 1 <= numCarpets <= 1000
- ... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def minimumWhiteTiles2(self, floor: str, numCarpets: int, carpetLen: int) -> int:
"""1 <= carpetLen <= floor.length <= 1000 floor[i] is either '0' or '1'. 1 <= numCarpets <= 1000"""
<|body_0|>
def minimumWhiteTiles(self, floor: str, numCarpets: int, carpetLen: int)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minimumWhiteTiles2(self, floor: str, numCarpets: int, carpetLen: int) -> int:
"""1 <= carpetLen <= floor.length <= 1000 floor[i] is either '0' or '1'. 1 <= numCarpets <= 1000"""
n = len(floor)
dp = [[0 for _ in range(numCarpets + 1)] for _ in range(n)]
dp[0][0] = ... | the_stack_v2_python_sparse | src/2209-MinimumWhiteTilesAfterCoveringWithCarpets.py | Jiezhi/myleetcode | train | 1 | |
5db9854cf3c0f1fc3907b81fa0b4d06bb72cb2d8 | [
"left, right = (0, len(height) - 1)\nleft_max = right_max = area = 0\nwhile left < right:\n if height[left] < height[right]:\n if height[left] >= left_max:\n left_max = height[left]\n area += left_max - height[left]\n left += 1\n else:\n if height[right] >= right_max:\n ... | <|body_start_0|>
left, right = (0, len(height) - 1)
left_max = right_max = area = 0
while left < right:
if height[left] < height[right]:
if height[left] >= left_max:
left_max = height[left]
area += left_max - height[left]
... | Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current] | ElevationMap | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElevationMap:
"""Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]"""
def get_trapped_rain_water_area(self, height... | stack_v2_sparse_classes_36k_train_003428 | 5,285 | no_license | [
{
"docstring": "Approach: Two Pointers Time Complexity: O(n) Space Complexity: O(1) Algorithm: - Initialize left and right pointer with 0 and last elevation position - loop until left is less than right - if elevation of left positioned is less then elevation of right positioned - if left elevation is greater t... | 3 | stack_v2_sparse_classes_30k_train_011336 | Implement the Python class `ElevationMap` described below.
Class description:
Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]
Method signa... | Implement the Python class `ElevationMap` described below.
Class description:
Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]
Method signa... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class ElevationMap:
"""Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]"""
def get_trapped_rain_water_area(self, height... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElevationMap:
"""Formulae to find trapping rain water: elevation = [0, 2, 3] [0, 1, 2] current_index = 1 water_area = minimum( maximum(elevation[previous], elevation[current]), maximum(elevation[current], elevation[next]) ) - elevation[current]"""
def get_trapped_rain_water_area(self, height: List[int]) ... | the_stack_v2_python_sparse | data_structures/trapping_rain_water.py | Shiv2157k/leet_code | train | 1 |
d72ce3187a2d3dcaadc879d8dcc3b0dae44e774b | [
"self.records = int(records)\nself.sql = sql\nself.group_id = group_id\nself.token = token\nself.pagesql = self.get_page_sql()",
"page_sql = ''\nif self.group_id == None:\n page_sql = self.sql[:-5] + ' order by adddate desc'\nelif self.group_id == '0':\n groupid = GROP_OPT(self.token).getGroupID()\n if g... | <|body_start_0|>
self.records = int(records)
self.sql = sql
self.group_id = group_id
self.token = token
self.pagesql = self.get_page_sql()
<|end_body_0|>
<|body_start_1|>
page_sql = ''
if self.group_id == None:
page_sql = self.sql[:-5] + ' order by ad... | 分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回 | Paginator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Paginator:
"""分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回"""
def __init__(self, records, sql, group_id=None, token=None):
"""初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID"""
<|body_0|>
def get_page_sql(self):
"""获取数据查询sql语句 :param group... | stack_v2_sparse_classes_36k_train_003429 | 7,184 | permissive | [
{
"docstring": "初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID",
"name": "__init__",
"signature": "def __init__(self, records, sql, group_id=None, token=None)"
},
{
"docstring": "获取数据查询sql语句 :param group_id:分组ID :return: 数据查询sql",
"name": "get_page_sql",
"signatu... | 6 | stack_v2_sparse_classes_30k_train_013076 | Implement the Python class `Paginator` described below.
Class description:
分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回
Method signatures and docstrings:
- def __init__(self, records, sql, group_id=None, token=None): 初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID
- def get_page_sql(self): 获取数... | Implement the Python class `Paginator` described below.
Class description:
分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回
Method signatures and docstrings:
- def __init__(self, records, sql, group_id=None, token=None): 初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID
- def get_page_sql(self): 获取数... | e188b15a0aa4a9fde00dba15e8300e4b87973e2d | <|skeleton|>
class Paginator:
"""分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回"""
def __init__(self, records, sql, group_id=None, token=None):
"""初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID"""
<|body_0|>
def get_page_sql(self):
"""获取数据查询sql语句 :param group... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Paginator:
"""分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回"""
def __init__(self, records, sql, group_id=None, token=None):
"""初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID"""
self.records = int(records)
self.sql = sql
self.group_id = group_id
... | the_stack_v2_python_sparse | at_tmp/model/util/TMP_PAGINATOR.py | zuoleilei3253/zuoleilei | train | 0 |
9483b633b891a22f75f72194b6eaf591e5bd6787 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | A set of methods for scanning Docker images. | ScannerServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScannerServiceServicer:
"""A set of methods for scanning Docker images."""
def Scan(self, request, context):
"""Executes scanning of specified image."""
<|body_0|>
def Get(self, request, context):
"""Returns the specified ScanResult resource. To get the list of S... | stack_v2_sparse_classes_36k_train_003430 | 10,850 | permissive | [
{
"docstring": "Executes scanning of specified image.",
"name": "Scan",
"signature": "def Scan(self, request, context)"
},
{
"docstring": "Returns the specified ScanResult resource. To get the list of ScanResults for specified Image, make a [List] request.",
"name": "Get",
"signature": "... | 5 | stack_v2_sparse_classes_30k_train_006222 | Implement the Python class `ScannerServiceServicer` described below.
Class description:
A set of methods for scanning Docker images.
Method signatures and docstrings:
- def Scan(self, request, context): Executes scanning of specified image.
- def Get(self, request, context): Returns the specified ScanResult resource.... | Implement the Python class `ScannerServiceServicer` described below.
Class description:
A set of methods for scanning Docker images.
Method signatures and docstrings:
- def Scan(self, request, context): Executes scanning of specified image.
- def Get(self, request, context): Returns the specified ScanResult resource.... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class ScannerServiceServicer:
"""A set of methods for scanning Docker images."""
def Scan(self, request, context):
"""Executes scanning of specified image."""
<|body_0|>
def Get(self, request, context):
"""Returns the specified ScanResult resource. To get the list of S... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScannerServiceServicer:
"""A set of methods for scanning Docker images."""
def Scan(self, request, context):
"""Executes scanning of specified image."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError... | the_stack_v2_python_sparse | yandex/cloud/containerregistry/v1/scanner_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
2ccc503f8a9efd4aa08f95ef77e3b4988adb1420 | [
"comments = CommentsShows.query.order_by(asc(CommentsShows.ShowID), asc(CommentsShows.Created)).all()\ncontents = jsonify({'comments': [{'commentID': comment.CommentID, 'showID': comment.ShowID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'createdAt': get_iso_format(c... | <|body_start_0|>
comments = CommentsShows.query.order_by(asc(CommentsShows.ShowID), asc(CommentsShows.Created)).all()
contents = jsonify({'comments': [{'commentID': comment.CommentID, 'showID': comment.ShowID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'c... | ShowCommentsView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShowCommentsView:
def index(self):
"""Return all comments for all shows."""
<|body_0|>
def get(self, show_id):
"""Return the comments for a specific show."""
<|body_1|>
def post(self):
"""Add a comment to a show specified in the payload."""
... | stack_v2_sparse_classes_36k_train_003431 | 26,847 | permissive | [
{
"docstring": "Return all comments for all shows.",
"name": "index",
"signature": "def index(self)"
},
{
"docstring": "Return the comments for a specific show.",
"name": "get",
"signature": "def get(self, show_id)"
},
{
"docstring": "Add a comment to a show specified in the payl... | 5 | stack_v2_sparse_classes_30k_train_002113 | Implement the Python class `ShowCommentsView` described below.
Class description:
Implement the ShowCommentsView class.
Method signatures and docstrings:
- def index(self): Return all comments for all shows.
- def get(self, show_id): Return the comments for a specific show.
- def post(self): Add a comment to a show s... | Implement the Python class `ShowCommentsView` described below.
Class description:
Implement the ShowCommentsView class.
Method signatures and docstrings:
- def index(self): Return all comments for all shows.
- def get(self, show_id): Return the comments for a specific show.
- def post(self): Add a comment to a show s... | 62f8e8e904e379541193f0cbb91a8434b47f538f | <|skeleton|>
class ShowCommentsView:
def index(self):
"""Return all comments for all shows."""
<|body_0|>
def get(self, show_id):
"""Return the comments for a specific show."""
<|body_1|>
def post(self):
"""Add a comment to a show specified in the payload."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShowCommentsView:
def index(self):
"""Return all comments for all shows."""
comments = CommentsShows.query.order_by(asc(CommentsShows.ShowID), asc(CommentsShows.Created)).all()
contents = jsonify({'comments': [{'commentID': comment.CommentID, 'showID': comment.ShowID, 'userID': comment... | the_stack_v2_python_sparse | apps/comments/views.py | Torniojaws/vortech-backend | train | 0 | |
1bfb0df09ef74d203272202818c49c9c0ef4fc08 | [
"if not nums:\n return []\nres = []\nused = [False for i in nums]\nself.__dfs(nums, [], used, res)\nreturn res",
"if len(path) == len(nums):\n res.append(path.copy())\n return\nfor i in range(len(nums)):\n if not used[i]:\n used[i] = True\n path.append(nums[i])\n self.__dfs(nums, ... | <|body_start_0|>
if not nums:
return []
res = []
used = [False for i in nums]
self.__dfs(nums, [], used, res)
return res
<|end_body_0|>
<|body_start_1|>
if len(path) == len(nums):
res.append(path.copy())
return
for i in range(l... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
"""思路: 1、循环遍历,增加到数组 => 时间复杂度高 2、回溯算法:permutation,枚举每个位置可以放哪些数字 基本思想: DFS => 深度优先遍历 + 状态重置 + 剪枝 DFS结构: 1、存储变量 >> 需要遍历的数据 > nums: 需要填充的数组 【原始数据】 > res:排列结果变量 【DFS路径信息保存】 >> 用什么来区别不同的分支状态,用什么来记录数据: used记录状态, path记录数据 > used: 当... | stack_v2_sparse_classes_36k_train_003432 | 2,663 | no_license | [
{
"docstring": "思路: 1、循环遍历,增加到数组 => 时间复杂度高 2、回溯算法:permutation,枚举每个位置可以放哪些数字 基本思想: DFS => 深度优先遍历 + 状态重置 + 剪枝 DFS结构: 1、存储变量 >> 需要遍历的数据 > nums: 需要填充的数组 【原始数据】 > res:排列结果变量 【DFS路径信息保存】 >> 用什么来区别不同的分支状态,用什么来记录数据: used记录状态, path记录数据 > used: 当前的位置有哪些数字可以放 【DFS填充选择】 > path: 已有path中包含的数据 【DFS路径信息】 2、框架 > 递归终止条件 如果已经得到的p... | 2 | stack_v2_sparse_classes_30k_train_006331 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permute(self, nums: List[int]) -> List[List[int]]: 思路: 1、循环遍历,增加到数组 => 时间复杂度高 2、回溯算法:permutation,枚举每个位置可以放哪些数字 基本思想: DFS => 深度优先遍历 + 状态重置 + 剪枝 DFS结构: 1、存储变量 >> 需要遍历的数据 > nums... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permute(self, nums: List[int]) -> List[List[int]]: 思路: 1、循环遍历,增加到数组 => 时间复杂度高 2、回溯算法:permutation,枚举每个位置可以放哪些数字 基本思想: DFS => 深度优先遍历 + 状态重置 + 剪枝 DFS结构: 1、存储变量 >> 需要遍历的数据 > nums... | 6708479302cca3ea3d930e6e80264f213ea29c5f | <|skeleton|>
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
"""思路: 1、循环遍历,增加到数组 => 时间复杂度高 2、回溯算法:permutation,枚举每个位置可以放哪些数字 基本思想: DFS => 深度优先遍历 + 状态重置 + 剪枝 DFS结构: 1、存储变量 >> 需要遍历的数据 > nums: 需要填充的数组 【原始数据】 > res:排列结果变量 【DFS路径信息保存】 >> 用什么来区别不同的分支状态,用什么来记录数据: used记录状态, path记录数据 > used: 当... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
"""思路: 1、循环遍历,增加到数组 => 时间复杂度高 2、回溯算法:permutation,枚举每个位置可以放哪些数字 基本思想: DFS => 深度优先遍历 + 状态重置 + 剪枝 DFS结构: 1、存储变量 >> 需要遍历的数据 > nums: 需要填充的数组 【原始数据】 > res:排列结果变量 【DFS路径信息保存】 >> 用什么来区别不同的分支状态,用什么来记录数据: used记录状态, path记录数据 > used: 当前的位置有哪些数字可以放 【... | the_stack_v2_python_sparse | DFS回溯/leetcode_46_回溯算法.py | Gyczero/Leetcode_practice | train | 0 | |
3973eee0f3d17e2be9ad03b835f0626d8d4260ae | [
"mocker.patch.object(Client, 'http_request', side_effect=[{'objects': INDICATOR * 50}, {'objects': []}])\nclient = Client(base_url='', user_name='', api_key='', verify=False, proxy=False, reliability='B - Usually reliable', should_create_relationships=False)\nresults = get_indicators(client, limit='7000')\nassert l... | <|body_start_0|>
mocker.patch.object(Client, 'http_request', side_effect=[{'objects': INDICATOR * 50}, {'objects': []}])
client = Client(base_url='', user_name='', api_key='', verify=False, proxy=False, reliability='B - Usually reliable', should_create_relationships=False)
results = get_indicato... | TestGetIndicators | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGetIndicators:
def test_sanity(mocker):
"""Given a limit above the number of available indicators When calling the get_indicator command Then verify that the maximum available amount is returned."""
<|body_0|>
def test_pagination(mocker):
"""Given a limit above t... | stack_v2_sparse_classes_36k_train_003433 | 31,154 | permissive | [
{
"docstring": "Given a limit above the number of available indicators When calling the get_indicator command Then verify that the maximum available amount is returned.",
"name": "test_sanity",
"signature": "def test_sanity(mocker)"
},
{
"docstring": "Given a limit above the page size When calli... | 2 | null | Implement the Python class `TestGetIndicators` described below.
Class description:
Implement the TestGetIndicators class.
Method signatures and docstrings:
- def test_sanity(mocker): Given a limit above the number of available indicators When calling the get_indicator command Then verify that the maximum available am... | Implement the Python class `TestGetIndicators` described below.
Class description:
Implement the TestGetIndicators class.
Method signatures and docstrings:
- def test_sanity(mocker): Given a limit above the number of available indicators When calling the get_indicator command Then verify that the maximum available am... | 01b57f8c658c2faed047313d3034e8052ffa83ce | <|skeleton|>
class TestGetIndicators:
def test_sanity(mocker):
"""Given a limit above the number of available indicators When calling the get_indicator command Then verify that the maximum available amount is returned."""
<|body_0|>
def test_pagination(mocker):
"""Given a limit above t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestGetIndicators:
def test_sanity(mocker):
"""Given a limit above the number of available indicators When calling the get_indicator command Then verify that the maximum available amount is returned."""
mocker.patch.object(Client, 'http_request', side_effect=[{'objects': INDICATOR * 50}, {'obj... | the_stack_v2_python_sparse | Packs/Anomali_ThreatStream/Integrations/AnomaliThreatStreamv3/AnomaliThreatStreamv3_test.py | adambaumeister/content | train | 2 | |
488451854a3c0df8eaf4c34fbf79defc064719fc | [
"self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-sum' if model_name_or_path == '' else model_name_or_path, max_length=max_length, device=device, cache_dir=cache_dir)\nself.task = 'data2text'\nself.dimensions = ['naturalness', 'informativeness']",
"n_data = len(data)\neval_scores = [{} for _ in ra... | <|body_start_0|>
self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-sum' if model_name_or_path == '' else model_name_or_path, max_length=max_length, device=device, cache_dir=cache_dir)
self.task = 'data2text'
self.dimensions = ['naturalness', 'informativeness']
<|end_body_0|>
<|bo... | D2tEvaluator | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class D2tEvaluator:
def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None):
"""Set up evaluator for data-to-text"""
<|body_0|>
def evaluate(self, data, category, dims=None, overall=True):
"""Get the scores of all the given dimensions categ... | stack_v2_sparse_classes_36k_train_003434 | 14,573 | permissive | [
{
"docstring": "Set up evaluator for data-to-text",
"name": "__init__",
"signature": "def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None)"
},
{
"docstring": "Get the scores of all the given dimensions category: The category to be evaluated. dims: A list of di... | 2 | stack_v2_sparse_classes_30k_train_013010 | Implement the Python class `D2tEvaluator` described below.
Class description:
Implement the D2tEvaluator class.
Method signatures and docstrings:
- def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up evaluator for data-to-text
- def evaluate(self, data, category, dims=None... | Implement the Python class `D2tEvaluator` described below.
Class description:
Implement the D2tEvaluator class.
Method signatures and docstrings:
- def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up evaluator for data-to-text
- def evaluate(self, data, category, dims=None... | c7b60f75470f067d1342705708810a660eabd684 | <|skeleton|>
class D2tEvaluator:
def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None):
"""Set up evaluator for data-to-text"""
<|body_0|>
def evaluate(self, data, category, dims=None, overall=True):
"""Get the scores of all the given dimensions categ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class D2tEvaluator:
def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None):
"""Set up evaluator for data-to-text"""
self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-sum' if model_name_or_path == '' else model_name_or_path, max_length=max_length, devi... | the_stack_v2_python_sparse | applications/Chat/evaluate/unieval/evaluator.py | hpcaitech/ColossalAI | train | 32,044 | |
e9d4d3849ca4fdaa8c3d437098f472d2ad00c4bb | [
"alto_path = os.path.join(self.path, 'ALTO')\nif not os.path.exists(alto_path):\n logger.critical(f'Could not find pages for {self.id}')\npage_file_names = [file for file in os.listdir(alto_path) if not file.startswith('.') and '.xml' in file]\npage_numbers = []\nfor fname in page_file_names:\n page_no = fnam... | <|body_start_0|>
alto_path = os.path.join(self.path, 'ALTO')
if not os.path.exists(alto_path):
logger.critical(f'Could not find pages for {self.id}')
page_file_names = [file for file in os.listdir(alto_path) if not file.startswith('.') and '.xml' in file]
page_numbers = []
... | Class representing an issue in RERO (Mets/Alto) data. All functions defined in this child class are specific to parsing RERO Mets/Alto format | ReroNewspaperIssue | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReroNewspaperIssue:
"""Class representing an issue in RERO (Mets/Alto) data. All functions defined in this child class are specific to parsing RERO Mets/Alto format"""
def _find_pages(self):
"""Detects the Alto XML page files for a newspaper issue and initializes page objects."""
... | stack_v2_sparse_classes_36k_train_003435 | 7,435 | permissive | [
{
"docstring": "Detects the Alto XML page files for a newspaper issue and initializes page objects.",
"name": "_find_pages",
"signature": "def _find_pages(self)"
},
{
"docstring": "Given the div of a content item, this function parses the children and constructs the legacy `parts` component :par... | 5 | stack_v2_sparse_classes_30k_train_001463 | Implement the Python class `ReroNewspaperIssue` described below.
Class description:
Class representing an issue in RERO (Mets/Alto) data. All functions defined in this child class are specific to parsing RERO Mets/Alto format
Method signatures and docstrings:
- def _find_pages(self): Detects the Alto XML page files f... | Implement the Python class `ReroNewspaperIssue` described below.
Class description:
Class representing an issue in RERO (Mets/Alto) data. All functions defined in this child class are specific to parsing RERO Mets/Alto format
Method signatures and docstrings:
- def _find_pages(self): Detects the Alto XML page files f... | ed8f0586ed6a4f7de94b1504b292570bce1f51c5 | <|skeleton|>
class ReroNewspaperIssue:
"""Class representing an issue in RERO (Mets/Alto) data. All functions defined in this child class are specific to parsing RERO Mets/Alto format"""
def _find_pages(self):
"""Detects the Alto XML page files for a newspaper issue and initializes page objects."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReroNewspaperIssue:
"""Class representing an issue in RERO (Mets/Alto) data. All functions defined in this child class are specific to parsing RERO Mets/Alto format"""
def _find_pages(self):
"""Detects the Alto XML page files for a newspaper issue and initializes page objects."""
alto_pat... | the_stack_v2_python_sparse | text_importer/importers/rero/classes.py | aflueckiger/impresso-text-acquisition | train | 0 |
27444fc096e0e08618c022977ec54160a70ce654 | [
"d = domain.STEM_Domain()\nself.lat_stem = d.get_lat()\nself.lon_stem = d.get_lon()\nself.field_124x124 = field_124x124",
"self.map = NAMapFigure(t_str=t_str, cb_axis=True, fast_or_pretty=fast_or_pretty, label_latlon=label_latlon)\nif maskoceans_switch:\n self.field_124x124 = maskoceans(self.lon_stem, self.lat... | <|body_start_0|>
d = domain.STEM_Domain()
self.lat_stem = d.get_lat()
self.lon_stem = d.get_lon()
self.field_124x124 = field_124x124
<|end_body_0|>
<|body_start_1|>
self.map = NAMapFigure(t_str=t_str, cb_axis=True, fast_or_pretty=fast_or_pretty, label_latlon=label_latlon)
... | Class for Drawing a quick map of a 124x124 STEM field. The map is superimposed over North America. The 124x124 field is assumed to use the N Pole stereographic projection grid typically used for N American-wide STEM runs in the Campbell lab. | Mapper124x124 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mapper124x124:
"""Class for Drawing a quick map of a 124x124 STEM field. The map is superimposed over North America. The 124x124 field is assumed to use the N Pole stereographic projection grid typically used for N American-wide STEM runs in the Campbell lab."""
def __init__(self, field_124x... | stack_v2_sparse_classes_36k_train_003436 | 2,848 | permissive | [
{
"docstring": "Class constructor ARGS: field_124x124 (np.array): a 124 by 124 numpy array",
"name": "__init__",
"signature": "def __init__(self, field_124x124=None)"
},
{
"docstring": "draw a map of a 124x124 field on the N Pole stereographic N American STEM domain. ARGS: fast_or_pretty ({'fast... | 2 | stack_v2_sparse_classes_30k_train_013229 | Implement the Python class `Mapper124x124` described below.
Class description:
Class for Drawing a quick map of a 124x124 STEM field. The map is superimposed over North America. The 124x124 field is assumed to use the N Pole stereographic projection grid typically used for N American-wide STEM runs in the Campbell lab... | Implement the Python class `Mapper124x124` described below.
Class description:
Class for Drawing a quick map of a 124x124 STEM field. The map is superimposed over North America. The 124x124 field is assumed to use the N Pole stereographic projection grid typically used for N American-wide STEM runs in the Campbell lab... | 17fbabb7206e0a80d9e2d01c6535ac718fcddbb2 | <|skeleton|>
class Mapper124x124:
"""Class for Drawing a quick map of a 124x124 STEM field. The map is superimposed over North America. The 124x124 field is assumed to use the N Pole stereographic projection grid typically used for N American-wide STEM runs in the Campbell lab."""
def __init__(self, field_124x... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mapper124x124:
"""Class for Drawing a quick map of a 124x124 STEM field. The map is superimposed over North America. The 124x124 field is assumed to use the N Pole stereographic projection grid typically used for N American-wide STEM runs in the Campbell lab."""
def __init__(self, field_124x124=None):
... | the_stack_v2_python_sparse | stem_pytools/STEM_mapper.py | Timothy-W-Hilton/STEMPyTools | train | 1 |
a1bf59e97e61330f0ba7c69e348c15ff7727b4be | [
"def backtrack(start, track):\n if sum(track) == n and len(track) == k:\n return res.append(track[:])\n if sum(track) > n or len(track) > k:\n return\n for i in range(start, 10):\n track.append(i)\n backtrack(i + 1, track)\n track.pop()\nres = []\nif n <= 0 or k <= 0:\n ... | <|body_start_0|>
def backtrack(start, track):
if sum(track) == n and len(track) == k:
return res.append(track[:])
if sum(track) > n or len(track) > k:
return
for i in range(start, 10):
track.append(i)
backtrack(i... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
"""k 限制了树的高度,n 限制了树的宽度。"""
<|body_0|>
def combinationSum3_1(self, k: int, n: int) -> List[List[int]]:
"""k 限制了树的高度,n 限制了树的宽度。"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def... | stack_v2_sparse_classes_36k_train_003437 | 2,352 | permissive | [
{
"docstring": "k 限制了树的高度,n 限制了树的宽度。",
"name": "combinationSum3",
"signature": "def combinationSum3(self, k: int, n: int) -> List[List[int]]"
},
{
"docstring": "k 限制了树的高度,n 限制了树的宽度。",
"name": "combinationSum3_1",
"signature": "def combinationSum3_1(self, k: int, n: int) -> List[List[int]... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum3(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。
- def combinationSum3_1(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum3(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。
- def combinationSum3_1(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。
<|skele... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
"""k 限制了树的高度,n 限制了树的宽度。"""
<|body_0|>
def combinationSum3_1(self, k: int, n: int) -> List[List[int]]:
"""k 限制了树的高度,n 限制了树的宽度。"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
"""k 限制了树的高度,n 限制了树的宽度。"""
def backtrack(start, track):
if sum(track) == n and len(track) == k:
return res.append(track[:])
if sum(track) > n or len(track) > k:
retur... | the_stack_v2_python_sparse | 216-combination-sum-iii.py | yuenliou/leetcode | train | 0 | |
6acd4eb5b0fd9558732acbb70f7169e23fb68b38 | [
"config_help = super(MemoryLxcCollector, self).get_default_config_help()\nconfig_help.update({'sys_path': \"Defaults to '/sys/fs/cgroup/lxc'\"})\nreturn config_help",
"config = super(MemoryLxcCollector, self).get_default_config()\nconfig.update({'path': 'lxc', 'sys_path': '/sys/fs/cgroup/lxc'})\nreturn config",
... | <|body_start_0|>
config_help = super(MemoryLxcCollector, self).get_default_config_help()
config_help.update({'sys_path': "Defaults to '/sys/fs/cgroup/lxc'"})
return config_help
<|end_body_0|>
<|body_start_1|>
config = super(MemoryLxcCollector, self).get_default_config()
config.u... | MemoryLxcCollector | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MemoryLxcCollector:
def get_default_config_help(self):
"""Return help text for collector configuration."""
<|body_0|>
def get_default_config(self):
"""Returns default settings for collector."""
<|body_1|>
def collect(self):
"""Collect memory stat... | stack_v2_sparse_classes_36k_train_003438 | 2,599 | permissive | [
{
"docstring": "Return help text for collector configuration.",
"name": "get_default_config_help",
"signature": "def get_default_config_help(self)"
},
{
"docstring": "Returns default settings for collector.",
"name": "get_default_config",
"signature": "def get_default_config(self)"
},
... | 4 | stack_v2_sparse_classes_30k_train_014995 | Implement the Python class `MemoryLxcCollector` described below.
Class description:
Implement the MemoryLxcCollector class.
Method signatures and docstrings:
- def get_default_config_help(self): Return help text for collector configuration.
- def get_default_config(self): Returns default settings for collector.
- def... | Implement the Python class `MemoryLxcCollector` described below.
Class description:
Implement the MemoryLxcCollector class.
Method signatures and docstrings:
- def get_default_config_help(self): Return help text for collector configuration.
- def get_default_config(self): Returns default settings for collector.
- def... | 461caf29e84db8cbf46f9fc4c895f56353e10c61 | <|skeleton|>
class MemoryLxcCollector:
def get_default_config_help(self):
"""Return help text for collector configuration."""
<|body_0|>
def get_default_config(self):
"""Returns default settings for collector."""
<|body_1|>
def collect(self):
"""Collect memory stat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MemoryLxcCollector:
def get_default_config_help(self):
"""Return help text for collector configuration."""
config_help = super(MemoryLxcCollector, self).get_default_config_help()
config_help.update({'sys_path': "Defaults to '/sys/fs/cgroup/lxc'"})
return config_help
def ge... | the_stack_v2_python_sparse | src/collectors/memory_lxc/memory_lxc.py | python-diamond/Diamond | train | 1,874 | |
2f4d20696e208a2838251475fb3c24c94f0c1cf1 | [
"def cal(n):\n if n < 0:\n return False\n if n == 0:\n return 1\n return n * cal(n - 1)\nans = cal(n)\ncount = 0\nwhile ans / 10 == ans // 10:\n count += 1\n ans = ans / 10\nreturn count",
"cnt = 0\nwhile n >= 5:\n n //= 5\n cnt += n\nreturn cnt"
] | <|body_start_0|>
def cal(n):
if n < 0:
return False
if n == 0:
return 1
return n * cal(n - 1)
ans = cal(n)
count = 0
while ans / 10 == ans // 10:
count += 1
ans = ans / 10
return count
<|e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def trailingZeroes2(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def cal(n):
if n < 0:
return False... | stack_v2_sparse_classes_36k_train_003439 | 1,127 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "trailingZeroes",
"signature": "def trailingZeroes(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "trailingZeroes2",
"signature": "def trailingZeroes2(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011428 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def trailingZeroes(self, n): :type n: int :rtype: int
- def trailingZeroes2(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def trailingZeroes(self, n): :type n: int :rtype: int
- def trailingZeroes2(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def trailingZeroes(self, n):
... | 6bb1cf5f5a2c21a3a23198f179b0a608fcb5dbfc | <|skeleton|>
class Solution:
def trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def trailingZeroes2(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def trailingZeroes(self, n):
""":type n: int :rtype: int"""
def cal(n):
if n < 0:
return False
if n == 0:
return 1
return n * cal(n - 1)
ans = cal(n)
count = 0
while ans / 10 == ans // 10:
... | the_stack_v2_python_sparse | Factorial Trailing Zeroes.py | zq13xw24/leetcode | train | 0 | |
095860ab1ea28084c29bdd666896f162edcbc049 | [
"self.config['url'] = url\nlogger.info('Taking screenshot for url: %s' % url)\ngenerate_resp_json = self.generate_screenshots()\njob_id = generate_resp_json['job_id']\nlogger.info('Browserstack is processing: http://www.browserstack.com/screenshots/%s' % job_id)\nscreenshots_json = self.get_screenshots(job_id)\nwhi... | <|body_start_0|>
self.config['url'] = url
logger.info('Taking screenshot for url: %s' % url)
generate_resp_json = self.generate_screenshots()
job_id = generate_resp_json['job_id']
logger.info('Browserstack is processing: http://www.browserstack.com/screenshots/%s' % job_id)
... | Expansion for browserstack screenshots Lib. Adds ability to download files | ScreenShot | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScreenShot:
"""Expansion for browserstack screenshots Lib. Adds ability to download files"""
def take(self, url, dst_dir):
"""take a screenshot from a url and save it to the dst_dir"""
<|body_0|>
def _build_filename_from_browserstack_json(self, j):
"""Build usefu... | stack_v2_sparse_classes_36k_train_003440 | 2,062 | permissive | [
{
"docstring": "take a screenshot from a url and save it to the dst_dir",
"name": "take",
"signature": "def take(self, url, dst_dir)"
},
{
"docstring": "Build useful filename for an image from the screenshot json metadata",
"name": "_build_filename_from_browserstack_json",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_000993 | Implement the Python class `ScreenShot` described below.
Class description:
Expansion for browserstack screenshots Lib. Adds ability to download files
Method signatures and docstrings:
- def take(self, url, dst_dir): take a screenshot from a url and save it to the dst_dir
- def _build_filename_from_browserstack_json(... | Implement the Python class `ScreenShot` described below.
Class description:
Expansion for browserstack screenshots Lib. Adds ability to download files
Method signatures and docstrings:
- def take(self, url, dst_dir): take a screenshot from a url and save it to the dst_dir
- def _build_filename_from_browserstack_json(... | 94bfe028915ee2b8d5b8308a2a66bb28baea334f | <|skeleton|>
class ScreenShot:
"""Expansion for browserstack screenshots Lib. Adds ability to download files"""
def take(self, url, dst_dir):
"""take a screenshot from a url and save it to the dst_dir"""
<|body_0|>
def _build_filename_from_browserstack_json(self, j):
"""Build usefu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScreenShot:
"""Expansion for browserstack screenshots Lib. Adds ability to download files"""
def take(self, url, dst_dir):
"""take a screenshot from a url and save it to the dst_dir"""
self.config['url'] = url
logger.info('Taking screenshot for url: %s' % url)
generate_res... | the_stack_v2_python_sparse | Lib/diffbrowsers/screenshot.py | graphicore/diffbrowsers | train | 0 |
65cca0aed5cb191bd4c9e2bf89aad5e78bd93b6d | [
"self.__io: BackupPcCloneStyle = io\n'\\n The output style.\\n '\nself.__host: str = ''\n'\\n The host of the backup.\\n '",
"self.__io.writeln(' Removing files')\nhost_dir_clone = Config.instance.host_dir_clone(self.__host)\nif os.path.isdir(host_dir_clone):\n os.system('rm -fr \"%... | <|body_start_0|>
self.__io: BackupPcCloneStyle = io
'\n The output style.\n '
self.__host: str = ''
'\n The host of the backup.\n '
<|end_body_0|>
<|body_start_1|>
self.__io.writeln(' Removing files')
host_dir_clone = Config.instance.host_dir_... | Deletes a host entirely frm the clone. | HostDelete | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostDelete:
"""Deletes a host entirely frm the clone."""
def __init__(self, io: BackupPcCloneStyle):
"""Object constructor. @param BackupPcCloneStyle io: The output style."""
<|body_0|>
def __delete_files(self) -> None:
"""Removes the host from the clone file sys... | stack_v2_sparse_classes_36k_train_003441 | 2,018 | permissive | [
{
"docstring": "Object constructor. @param BackupPcCloneStyle io: The output style.",
"name": "__init__",
"signature": "def __init__(self, io: BackupPcCloneStyle)"
},
{
"docstring": "Removes the host from the clone file system.",
"name": "__delete_files",
"signature": "def __delete_files... | 4 | stack_v2_sparse_classes_30k_train_004899 | Implement the Python class `HostDelete` described below.
Class description:
Deletes a host entirely frm the clone.
Method signatures and docstrings:
- def __init__(self, io: BackupPcCloneStyle): Object constructor. @param BackupPcCloneStyle io: The output style.
- def __delete_files(self) -> None: Removes the host fr... | Implement the Python class `HostDelete` described below.
Class description:
Deletes a host entirely frm the clone.
Method signatures and docstrings:
- def __init__(self, io: BackupPcCloneStyle): Object constructor. @param BackupPcCloneStyle io: The output style.
- def __delete_files(self) -> None: Removes the host fr... | a4009868f6cbec42f247f392965077c55f7265c5 | <|skeleton|>
class HostDelete:
"""Deletes a host entirely frm the clone."""
def __init__(self, io: BackupPcCloneStyle):
"""Object constructor. @param BackupPcCloneStyle io: The output style."""
<|body_0|>
def __delete_files(self) -> None:
"""Removes the host from the clone file sys... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HostDelete:
"""Deletes a host entirely frm the clone."""
def __init__(self, io: BackupPcCloneStyle):
"""Object constructor. @param BackupPcCloneStyle io: The output style."""
self.__io: BackupPcCloneStyle = io
'\n The output style.\n '
self.__host: str = ''
... | the_stack_v2_python_sparse | backuppc_clone/helper/HostDelete.py | SetBased/BackupPC-Clone | train | 7 |
ec380a248843695a86f852a9aa8f1079cef95a1d | [
"bid = itertools.count(0)\nget_norm_name = lambda: 'tpu_batch_normalization' + ('' if not next(bid) else '_' + str(next(bid) // 2))\ncid = itertools.count(0)\nget_conv_name = lambda: 'conv2d' + ('' if not next(cid) else '_' + str(next(cid) // 2))\nmconfig = self._mconfig\nblock_args = self._block_args\nfilters = bl... | <|body_start_0|>
bid = itertools.count(0)
get_norm_name = lambda: 'tpu_batch_normalization' + ('' if not next(bid) else '_' + str(next(bid) // 2))
cid = itertools.count(0)
get_conv_name = lambda: 'conv2d' + ('' if not next(cid) else '_' + str(next(cid) // 2))
mconfig = self._mcon... | Fusing the proj conv1x1 and depthwise_conv into a conv2d. | FusedMBConvBlock | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FusedMBConvBlock:
"""Fusing the proj conv1x1 and depthwise_conv into a conv2d."""
def _build(self):
"""Builds block according to the arguments."""
<|body_0|>
def call(self, inputs, training, survival_prob=None):
"""Implementation of call(). Args: inputs: the inpu... | stack_v2_sparse_classes_36k_train_003442 | 27,831 | permissive | [
{
"docstring": "Builds block according to the arguments.",
"name": "_build",
"signature": "def _build(self)"
},
{
"docstring": "Implementation of call(). Args: inputs: the inputs tensor. training: boolean, whether the model is constructed for training. survival_prob: float, between 0 to 1, drop ... | 2 | null | Implement the Python class `FusedMBConvBlock` described below.
Class description:
Fusing the proj conv1x1 and depthwise_conv into a conv2d.
Method signatures and docstrings:
- def _build(self): Builds block according to the arguments.
- def call(self, inputs, training, survival_prob=None): Implementation of call(). A... | Implement the Python class `FusedMBConvBlock` described below.
Class description:
Fusing the proj conv1x1 and depthwise_conv into a conv2d.
Method signatures and docstrings:
- def _build(self): Builds block according to the arguments.
- def call(self, inputs, training, survival_prob=None): Implementation of call(). A... | c7392f2bab3165244d1c565b66409fa11fa82367 | <|skeleton|>
class FusedMBConvBlock:
"""Fusing the proj conv1x1 and depthwise_conv into a conv2d."""
def _build(self):
"""Builds block according to the arguments."""
<|body_0|>
def call(self, inputs, training, survival_prob=None):
"""Implementation of call(). Args: inputs: the inpu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FusedMBConvBlock:
"""Fusing the proj conv1x1 and depthwise_conv into a conv2d."""
def _build(self):
"""Builds block according to the arguments."""
bid = itertools.count(0)
get_norm_name = lambda: 'tpu_batch_normalization' + ('' if not next(bid) else '_' + str(next(bid) // 2))
... | the_stack_v2_python_sparse | efficientnetv2/effnetv2_model.py | google/automl | train | 6,415 |
7d41419ff583e3450ff30ffb820f89b150619850 | [
"self.W, self.K = topics.shape\nassert self.W > self.K\nself.topics = topics\nMixtureModel.__init__(self, weights, topics)",
"cnts = multinomial(n, self.weights)\ndocs = []\nfor k, cnt in zip(xrange(self.K), cnts):\n for i in xrange(cnt):\n docs.append(multinomial(words, self.topics.T[k]))\ndocs = sc.ro... | <|body_start_0|>
self.W, self.K = topics.shape
assert self.W > self.K
self.topics = topics
MixtureModel.__init__(self, weights, topics)
<|end_body_0|>
<|body_start_1|>
cnts = multinomial(n, self.weights)
docs = []
for k, cnt in zip(xrange(self.K), cnts):
... | A simple topic model where each topic is represented as a multinomial and topics are independent and drawn according to some multinomial distribution. | TopicModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopicModel:
"""A simple topic model where each topic is represented as a multinomial and topics are independent and drawn according to some multinomial distribution."""
def __init__(self, weights, topics):
"""Create a mixture model for components using given weights"""
<|body... | stack_v2_sparse_classes_36k_train_003443 | 4,834 | no_license | [
{
"docstring": "Create a mixture model for components using given weights",
"name": "__init__",
"signature": "def __init__(self, weights, topics)"
},
{
"docstring": "Sample n samples from the topic model with the following process, (a) For each document, draw a particular topic (b) Draw w words ... | 3 | stack_v2_sparse_classes_30k_train_002466 | Implement the Python class `TopicModel` described below.
Class description:
A simple topic model where each topic is represented as a multinomial and topics are independent and drawn according to some multinomial distribution.
Method signatures and docstrings:
- def __init__(self, weights, topics): Create a mixture m... | Implement the Python class `TopicModel` described below.
Class description:
A simple topic model where each topic is represented as a multinomial and topics are independent and drawn according to some multinomial distribution.
Method signatures and docstrings:
- def __init__(self, weights, topics): Create a mixture m... | 202d58f325874189433548aa0db68462608d6d3d | <|skeleton|>
class TopicModel:
"""A simple topic model where each topic is represented as a multinomial and topics are independent and drawn according to some multinomial distribution."""
def __init__(self, weights, topics):
"""Create a mixture model for components using given weights"""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TopicModel:
"""A simple topic model where each topic is represented as a multinomial and topics are independent and drawn according to some multinomial distribution."""
def __init__(self, weights, topics):
"""Create a mixture model for components using given weights"""
self.W, self.K = to... | the_stack_v2_python_sparse | models/TopicModel.py | imaluengo/polymom | train | 0 |
07a1bfa504e4541ab4ea1a5e7c540382ebbec7d7 | [
"super().__init__()\nself.label_embedding = torch.nn.Embedding(n_classes, n_classes)\nself.model = torch.nn.Sequential(torch.nn.Linear(n_classes + int(reduce(mul, img_shape)), 512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, 512), torch.nn.Dropout(0.4), torch.nn.LeakyReLU(0.2, inplace=True), torch.... | <|body_start_0|>
super().__init__()
self.label_embedding = torch.nn.Embedding(n_classes, n_classes)
self.model = torch.nn.Sequential(torch.nn.Linear(n_classes + int(reduce(mul, img_shape)), 512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, 512), torch.nn.Dropout(0.4), torch.nn.Le... | A very simple discriminator network for conditionally generated images | Discriminator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Discriminator:
"""A very simple discriminator network for conditionally generated images"""
def __init__(self, n_classes, img_shape):
"""Parameters ---------- n_classes : int the total number of classes img_shape : tuple the shape of the input images (including channel-dimension, exc... | stack_v2_sparse_classes_36k_train_003444 | 3,667 | permissive | [
{
"docstring": "Parameters ---------- n_classes : int the total number of classes img_shape : tuple the shape of the input images (including channel-dimension, excluding batch-dimension)",
"name": "__init__",
"signature": "def __init__(self, n_classes, img_shape)"
},
{
"docstring": "Feeds an ima... | 2 | null | Implement the Python class `Discriminator` described below.
Class description:
A very simple discriminator network for conditionally generated images
Method signatures and docstrings:
- def __init__(self, n_classes, img_shape): Parameters ---------- n_classes : int the total number of classes img_shape : tuple the sh... | Implement the Python class `Discriminator` described below.
Class description:
A very simple discriminator network for conditionally generated images
Method signatures and docstrings:
- def __init__(self, n_classes, img_shape): Parameters ---------- n_classes : int the total number of classes img_shape : tuple the sh... | 1078f5030b8aac2bf022daf5fa14d66f74c3c893 | <|skeleton|>
class Discriminator:
"""A very simple discriminator network for conditionally generated images"""
def __init__(self, n_classes, img_shape):
"""Parameters ---------- n_classes : int the total number of classes img_shape : tuple the shape of the input images (including channel-dimension, exc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Discriminator:
"""A very simple discriminator network for conditionally generated images"""
def __init__(self, n_classes, img_shape):
"""Parameters ---------- n_classes : int the total number of classes img_shape : tuple the shape of the input images (including channel-dimension, excluding batch-... | the_stack_v2_python_sparse | dlutils/models/gans/conditional/models.py | justusschock/dl-utils | train | 15 |
30d16061e5d35c0b7cf7061e9787f9bf524500e9 | [
"self.current_shoot_params = {'video_file': '', 'audio_file': '', 'merged_file': ''}\nself.current_shot_params = {'file': ''}\nself.current_video_file = ''\nself.current_audio_file = ''\nself.current_merged_file = ''\nself.shoot_formats = {'video': shoot_formats[0], 'audio': shoot_formats[1], 'merged': shoot_format... | <|body_start_0|>
self.current_shoot_params = {'video_file': '', 'audio_file': '', 'merged_file': ''}
self.current_shot_params = {'file': ''}
self.current_video_file = ''
self.current_audio_file = ''
self.current_merged_file = ''
self.shoot_formats = {'video': shoot_format... | Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audio_and_video` for merging separate au... | Recorder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Recorder:
"""Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audi... | stack_v2_sparse_classes_36k_train_003445 | 18,130 | permissive | [
{
"docstring": "Initialization method of :class:`t_system.recordation.Recorder` class. Args: shot_format (str): Format of the shot. (jpg, png etc.) shoot_formats (list): Formats of the records for video, audio and merged. camera: Camera object from PiCamera. hearer: Hearer object.",
"name": "__init__",
... | 6 | stack_v2_sparse_classes_30k_train_019587 | Implement the Python class `Recorder` described below.
Class description:
Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_syst... | Implement the Python class `Recorder` described below.
Class description:
Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_syst... | 4cf34572b8f8eac54d6c339f37aa72b6a13d8934 | <|skeleton|>
class Recorder:
"""Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Recorder:
"""Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audio_and_video` ... | the_stack_v2_python_sparse | t_system/recordation.py | LookAtMe-Genius-Cameraman/T_System | train | 9 |
10d23eb14c95df3f69d5caaa95ddfa7cb8e0635a | [
"self.scrreningconditionInt = scrreningconditionInt\nself.samlingConditionInt = samplingConditionInt\nself.screeningconditionFloat = screeningconditionFloat\nself.samlingConditionFloat = samlingConditionFloat\nself.screeningConditionStr = screeningConditionStr\nself.samlingConditionStr = samlingConditionStr\nself.s... | <|body_start_0|>
self.scrreningconditionInt = scrreningconditionInt
self.samlingConditionInt = samplingConditionInt
self.screeningconditionFloat = screeningconditionFloat
self.samlingConditionFloat = samlingConditionFloat
self.screeningConditionStr = screeningConditionStr
... | SamplingAndScreeningFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SamplingAndScreeningFactory:
def __init__(self, intNum, samplingConditionInt, scrreningconditionInt, floatNum, samlingConditionFloat, screeningconditionFloat, strNum, samlingConditionStr, screeningConditionStr, strlen=6):
""":param intNum:产生整数随机数的个数 :param samplingConditionInt: 整数随机数生成范围... | stack_v2_sparse_classes_36k_train_003446 | 2,892 | no_license | [
{
"docstring": ":param intNum:产生整数随机数的个数 :param samplingConditionInt: 整数随机数生成范围 :param scrreningconditionInt: 整数随机数筛选范围 :param floatNum: 产生浮点数的个数 :param samlingConditionFloat:浮点数的生成范围 :param screeningconditionFloat:浮点数的筛选范围 :param strNum:产生字符串的个数 :param samlingConditionStr:字符串的生成范围 :param screeningConditionStr:... | 2 | stack_v2_sparse_classes_30k_train_018288 | Implement the Python class `SamplingAndScreeningFactory` described below.
Class description:
Implement the SamplingAndScreeningFactory class.
Method signatures and docstrings:
- def __init__(self, intNum, samplingConditionInt, scrreningconditionInt, floatNum, samlingConditionFloat, screeningconditionFloat, strNum, sa... | Implement the Python class `SamplingAndScreeningFactory` described below.
Class description:
Implement the SamplingAndScreeningFactory class.
Method signatures and docstrings:
- def __init__(self, intNum, samplingConditionInt, scrreningconditionInt, floatNum, samlingConditionFloat, screeningconditionFloat, strNum, sa... | 661dba7ea846859056fd6ee7a310d352ca178e98 | <|skeleton|>
class SamplingAndScreeningFactory:
def __init__(self, intNum, samplingConditionInt, scrreningconditionInt, floatNum, samlingConditionFloat, screeningconditionFloat, strNum, samlingConditionStr, screeningConditionStr, strlen=6):
""":param intNum:产生整数随机数的个数 :param samplingConditionInt: 整数随机数生成范围... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SamplingAndScreeningFactory:
def __init__(self, intNum, samplingConditionInt, scrreningconditionInt, floatNum, samlingConditionFloat, screeningconditionFloat, strNum, samlingConditionStr, screeningConditionStr, strlen=6):
""":param intNum:产生整数随机数的个数 :param samplingConditionInt: 整数随机数生成范围 :param scrren... | the_stack_v2_python_sparse | 林一夫2017012923/平时作业3/SamplingAndScreeningFactory.py | wanghan79/2020_Python | train | 4 | |
a2cf3507045b07adb76a9eb86df98b65b453ec7c | [
"Process.__init__(self)\nself.daemonic = True\nself.work_queue = work_queue",
"while True:\n work_arg = self.work_queue.get()\n if work_arg is None:\n self.work_queue.task_done()\n return\n try:\n cine_fname, cine_hash, hdf_fname_template = work_arg\n proc_cine_fname(cine_fnam... | <|body_start_0|>
Process.__init__(self)
self.daemonic = True
self.work_queue = work_queue
<|end_body_0|>
<|body_start_1|>
while True:
work_arg = self.work_queue.get()
if work_arg is None:
self.work_queue.task_done()
return
... | Worker class for farming out the work of doing the least squares fit | worker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class worker:
"""Worker class for farming out the work of doing the least squares fit"""
def __init__(self, work_queue):
"""Work queue is a joinable queue, res_queue can be any sort of thing that supports put()"""
<|body_0|>
def run(self):
"""The assumption is that the... | stack_v2_sparse_classes_36k_train_003447 | 8,273 | no_license | [
{
"docstring": "Work queue is a joinable queue, res_queue can be any sort of thing that supports put()",
"name": "__init__",
"signature": "def __init__(self, work_queue)"
},
{
"docstring": "The assumption is that these will be run daemonic and reused for multiple work sessions",
"name": "run... | 2 | stack_v2_sparse_classes_30k_train_018414 | Implement the Python class `worker` described below.
Class description:
Worker class for farming out the work of doing the least squares fit
Method signatures and docstrings:
- def __init__(self, work_queue): Work queue is a joinable queue, res_queue can be any sort of thing that supports put()
- def run(self): The a... | Implement the Python class `worker` described below.
Class description:
Worker class for farming out the work of doing the least squares fit
Method signatures and docstrings:
- def __init__(self, work_queue): Work queue is a joinable queue, res_queue can be any sort of thing that supports put()
- def run(self): The a... | 78abcd84d3d2d2d4ecf15d0c77d1eeb86f5ab3e0 | <|skeleton|>
class worker:
"""Worker class for farming out the work of doing the least squares fit"""
def __init__(self, work_queue):
"""Work queue is a joinable queue, res_queue can be any sort of thing that supports put()"""
<|body_0|>
def run(self):
"""The assumption is that the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class worker:
"""Worker class for farming out the work of doing the least squares fit"""
def __init__(self, work_queue):
"""Work queue is a joinable queue, res_queue can be any sort of thing that supports put()"""
Process.__init__(self)
self.daemonic = True
self.work_queue = wor... | the_stack_v2_python_sparse | scripts/proc_mongo.py | tacaswell/leidenfrost | train | 1 |
7dce4b3c567b0d7994063c20572be4f103f2d391 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessReviewScheduleDefinition()",
"from .access_review_instance import AccessReviewInstance\nfrom .access_review_notification_recipient_item import AccessReviewNotificationRecipientItem\nfrom .access_review_reviewer_scope import Acces... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return AccessReviewScheduleDefinition()
<|end_body_0|>
<|body_start_1|>
from .access_review_instance import AccessReviewInstance
from .access_review_notification_recipient_item import AccessRev... | AccessReviewScheduleDefinition | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccessReviewScheduleDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewScheduleDefinition:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v... | stack_v2_sparse_classes_36k_train_003448 | 11,054 | 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: AccessReviewScheduleDefinition",
"name": "create_from_discriminator_value",
"signature": "def create_from_di... | 3 | stack_v2_sparse_classes_30k_train_015077 | Implement the Python class `AccessReviewScheduleDefinition` described below.
Class description:
Implement the AccessReviewScheduleDefinition class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewScheduleDefinition: Creates a new instance of... | Implement the Python class `AccessReviewScheduleDefinition` described below.
Class description:
Implement the AccessReviewScheduleDefinition class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewScheduleDefinition: Creates a new instance of... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class AccessReviewScheduleDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewScheduleDefinition:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccessReviewScheduleDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewScheduleDefinition:
"""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 creat... | the_stack_v2_python_sparse | msgraph/generated/models/access_review_schedule_definition.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
fd77a11921f75386b8cc6769895ab2e1ad1e174a | [
"self.n = np.zeros(nb_inputs)\nself.mean = np.zeros(nb_inputs)\nself.mean_diff = np.zeros(nb_inputs)\nself.var = np.zeros(nb_inputs)",
"self.n += 1.0\nlast_mean = self.mean.copy()\nself.mean += (x - self.mean) / self.n\nself.mean_diff += (x - last_mean) * (x - self.mean)\nself.var = (self.mean_diff / self.n).clip... | <|body_start_0|>
self.n = np.zeros(nb_inputs)
self.mean = np.zeros(nb_inputs)
self.mean_diff = np.zeros(nb_inputs)
self.var = np.zeros(nb_inputs)
<|end_body_0|>
<|body_start_1|>
self.n += 1.0
last_mean = self.mean.copy()
self.mean += (x - self.mean) / self.n
... | Normalizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Normalizer:
def __init__(self, nb_inputs):
"""self.n : Keeps a count of number of steps into the training self.mean : numpy array keeps a list of means for each dimension of the state space self.mean_diff : numpy array keeps a list of something needed to calculate variance for each dimen... | stack_v2_sparse_classes_36k_train_003449 | 12,703 | no_license | [
{
"docstring": "self.n : Keeps a count of number of steps into the training self.mean : numpy array keeps a list of means for each dimension of the state space self.mean_diff : numpy array keeps a list of something needed to calculate variance for each dimension of the state space self.var : numpy array keeps a... | 3 | stack_v2_sparse_classes_30k_train_014367 | Implement the Python class `Normalizer` described below.
Class description:
Implement the Normalizer class.
Method signatures and docstrings:
- def __init__(self, nb_inputs): self.n : Keeps a count of number of steps into the training self.mean : numpy array keeps a list of means for each dimension of the state space... | Implement the Python class `Normalizer` described below.
Class description:
Implement the Normalizer class.
Method signatures and docstrings:
- def __init__(self, nb_inputs): self.n : Keeps a count of number of steps into the training self.mean : numpy array keeps a list of means for each dimension of the state space... | f9db1d20b136f04e64021ecdfdfd55c6443770f6 | <|skeleton|>
class Normalizer:
def __init__(self, nb_inputs):
"""self.n : Keeps a count of number of steps into the training self.mean : numpy array keeps a list of means for each dimension of the state space self.mean_diff : numpy array keeps a list of something needed to calculate variance for each dimen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Normalizer:
def __init__(self, nb_inputs):
"""self.n : Keeps a count of number of steps into the training self.mean : numpy array keeps a list of means for each dimension of the state space self.mean_diff : numpy array keeps a list of something needed to calculate variance for each dimension of the st... | the_stack_v2_python_sparse | experiments/ars_new.py | ZhongKang97/pybRL | train | 0 | |
c7062b2fedb190599f2b5b302aeeeae054d3a9ba | [
"super().__init__()\nif type(uni_prob) == int:\n self.class_weights = Variable(torch.ones(uni_prob)).cuda()\nelif self.samp_prob is not None:\n usamp = uni_prob.pow(0.75)\n self.samp_prob = usamp / usamp.sum()\n assert self.samp_prob.sum().data == 1.0\nelse:\n self.samp_prob = Variable(torch.ones(uni... | <|body_start_0|>
super().__init__()
if type(uni_prob) == int:
self.class_weights = Variable(torch.ones(uni_prob)).cuda()
elif self.samp_prob is not None:
usamp = uni_prob.pow(0.75)
self.samp_prob = usamp / usamp.sum()
assert self.samp_prob.sum().da... | This criterion (`BinaryCrossEntropyLoss`) combines `LogSigmoid` and `NLLLoss` in one single class. Therefore, no Softmax used, but instead a Sigmoid for each unit in the output. NOTE: Computes per-element losses for a mini-batch (instead of the average loss over the entire mini-batch). | BinaryCrossEntropyLoss | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryCrossEntropyLoss:
"""This criterion (`BinaryCrossEntropyLoss`) combines `LogSigmoid` and `NLLLoss` in one single class. Therefore, no Softmax used, but instead a Sigmoid for each unit in the output. NOTE: Computes per-element losses for a mini-batch (instead of the average loss over the ent... | stack_v2_sparse_classes_36k_train_003450 | 9,463 | permissive | [
{
"docstring": ":param class_weights: weights certain classes more than others :param uni_prob: counts for getting negative samples OR an int that is the length of the vocabulary :param num_neighbors:",
"name": "__init__",
"signature": "def __init__(self, uni_prob, num_neighbors=10)"
},
{
"docst... | 3 | stack_v2_sparse_classes_30k_train_018432 | Implement the Python class `BinaryCrossEntropyLoss` described below.
Class description:
This criterion (`BinaryCrossEntropyLoss`) combines `LogSigmoid` and `NLLLoss` in one single class. Therefore, no Softmax used, but instead a Sigmoid for each unit in the output. NOTE: Computes per-element losses for a mini-batch (i... | Implement the Python class `BinaryCrossEntropyLoss` described below.
Class description:
This criterion (`BinaryCrossEntropyLoss`) combines `LogSigmoid` and `NLLLoss` in one single class. Therefore, no Softmax used, but instead a Sigmoid for each unit in the output. NOTE: Computes per-element losses for a mini-batch (i... | 99cba1030ed8c012a453bc7715830fc99fb980dc | <|skeleton|>
class BinaryCrossEntropyLoss:
"""This criterion (`BinaryCrossEntropyLoss`) combines `LogSigmoid` and `NLLLoss` in one single class. Therefore, no Softmax used, but instead a Sigmoid for each unit in the output. NOTE: Computes per-element losses for a mini-batch (instead of the average loss over the ent... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BinaryCrossEntropyLoss:
"""This criterion (`BinaryCrossEntropyLoss`) combines `LogSigmoid` and `NLLLoss` in one single class. Therefore, no Softmax used, but instead a Sigmoid for each unit in the output. NOTE: Computes per-element losses for a mini-batch (instead of the average loss over the entire mini-batc... | the_stack_v2_python_sparse | models/loss/ce.py | jamesoneill12/LayerFusion | train | 2 |
7202ea08bbd31da7f38630503677349a5a5e13a3 | [
"self.gui_app = gui_app\nself.get_parent = get_parent\nself.field = field",
"toset = self.get_parent()\nif isinstance(toset, list):\n toset.__setitem__(self.field, value)\nelse:\n setattr(toset, self.field, value)",
"toget = self.get_parent()\nif isinstance(toget, list):\n return toget.__getitem__(self... | <|body_start_0|>
self.gui_app = gui_app
self.get_parent = get_parent
self.field = field
<|end_body_0|>
<|body_start_1|>
toset = self.get_parent()
if isinstance(toset, list):
toset.__setitem__(self.field, value)
else:
setattr(toset, self.field, val... | ModelBinding the the base class for binding part of the optical model to a UI element. UI elements should extend this class. When more getters/setters are needed, overwrite the get/set functions to directly get/set the model part | ModelBinding | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelBinding:
"""ModelBinding the the base class for binding part of the optical model to a UI element. UI elements should extend this class. When more getters/setters are needed, overwrite the get/set functions to directly get/set the model part"""
def __init__(self, gui_app, get_parent, fi... | stack_v2_sparse_classes_36k_train_003451 | 12,837 | permissive | [
{
"docstring": "Create a new ModelBinding. gui_app is the instance that should be refreshed on change, get_parent is a function which returns the parent of the optical model element being bound, and field is the name of element (or list index if get_parent() returns a list) E.g: if the model part being changed ... | 3 | null | Implement the Python class `ModelBinding` described below.
Class description:
ModelBinding the the base class for binding part of the optical model to a UI element. UI elements should extend this class. When more getters/setters are needed, overwrite the get/set functions to directly get/set the model part
Method sig... | Implement the Python class `ModelBinding` described below.
Class description:
ModelBinding the the base class for binding part of the optical model to a UI element. UI elements should extend this class. When more getters/setters are needed, overwrite the get/set functions to directly get/set the model part
Method sig... | 41ea6d618a93fe14f8bee45fb3efff6a6762bcce | <|skeleton|>
class ModelBinding:
"""ModelBinding the the base class for binding part of the optical model to a UI element. UI elements should extend this class. When more getters/setters are needed, overwrite the get/set functions to directly get/set the model part"""
def __init__(self, gui_app, get_parent, fi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelBinding:
"""ModelBinding the the base class for binding part of the optical model to a UI element. UI elements should extend this class. When more getters/setters are needed, overwrite the get/set functions to directly get/set the model part"""
def __init__(self, gui_app, get_parent, field):
... | the_stack_v2_python_sparse | src/rayoptics/qtgui/dockpanels.py | mjhoptics/ray-optics | train | 195 |
df916322fff4077b5c5d87f3f148e3c3d934f6c6 | [
"super().__init__(shape, pooling)\nself.layers = torch.nn.ModuleList([])\nfor idx in range(1, len(shape)):\n self.layers.append(GATConv(shape[idx - 1], shape[idx] // heads if concat else shape[idx], heads=heads, concat=concat))\nself.pool = pooling\nself.shape = shape\nself.concat = concat",
"feats, edge_index... | <|body_start_0|>
super().__init__(shape, pooling)
self.layers = torch.nn.ModuleList([])
for idx in range(1, len(shape)):
self.layers.append(GATConv(shape[idx - 1], shape[idx] // heads if concat else shape[idx], heads=heads, concat=concat))
self.pool = pooling
self.sha... | Basic GAT implementation. | GAT | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GAT:
"""Basic GAT implementation."""
def __init__(self, shape: Sequence[int], pooling: Optional[Callable[..., torch.Tensor]], heads: int, concat: bool) -> None:
"""Create a GAT with layer sizes according to `shape`."""
<|body_0|>
def forward(self, graphs: Batch) -> Tuple... | stack_v2_sparse_classes_36k_train_003452 | 1,532 | no_license | [
{
"docstring": "Create a GAT with layer sizes according to `shape`.",
"name": "__init__",
"signature": "def __init__(self, shape: Sequence[int], pooling: Optional[Callable[..., torch.Tensor]], heads: int, concat: bool) -> None"
},
{
"docstring": "Perform a forward GAT pass.",
"name": "forwar... | 2 | stack_v2_sparse_classes_30k_train_015752 | Implement the Python class `GAT` described below.
Class description:
Basic GAT implementation.
Method signatures and docstrings:
- def __init__(self, shape: Sequence[int], pooling: Optional[Callable[..., torch.Tensor]], heads: int, concat: bool) -> None: Create a GAT with layer sizes according to `shape`.
- def forwa... | Implement the Python class `GAT` described below.
Class description:
Basic GAT implementation.
Method signatures and docstrings:
- def __init__(self, shape: Sequence[int], pooling: Optional[Callable[..., torch.Tensor]], heads: int, concat: bool) -> None: Create a GAT with layer sizes according to `shape`.
- def forwa... | 78c479f8d0b3209ece9f9ccbbf63810802293f61 | <|skeleton|>
class GAT:
"""Basic GAT implementation."""
def __init__(self, shape: Sequence[int], pooling: Optional[Callable[..., torch.Tensor]], heads: int, concat: bool) -> None:
"""Create a GAT with layer sizes according to `shape`."""
<|body_0|>
def forward(self, graphs: Batch) -> Tuple... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GAT:
"""Basic GAT implementation."""
def __init__(self, shape: Sequence[int], pooling: Optional[Callable[..., torch.Tensor]], heads: int, concat: bool) -> None:
"""Create a GAT with layer sizes according to `shape`."""
super().__init__(shape, pooling)
self.layers = torch.nn.Module... | the_stack_v2_python_sparse | gat_vqa/modules/sparse/gat.py | alexmirrington/gat-vqa | train | 4 |
e9d5f911db466574d83bbbdff41d017b178f8281 | [
"self.rotation = rotation\nself.lazy = lazy\nself.reference = reference\nself.tx = tio.ANTsTransform(precision='float', dimension=2, transform_type='AffineTransform')\nif self.reference is not None:\n self.tx.set_fixed_parameters(self.reference.get_center_of_mass())",
"rotation = self.rotation\ntheta = math.pi... | <|body_start_0|>
self.rotation = rotation
self.lazy = lazy
self.reference = reference
self.tx = tio.ANTsTransform(precision='float', dimension=2, transform_type='AffineTransform')
if self.reference is not None:
self.tx.set_fixed_parameters(self.reference.get_center_of... | Create an ANTs Affine Transform with a specified level of rotation. | Rotate2D | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rotate2D:
"""Create an ANTs Affine Transform with a specified level of rotation."""
def __init__(self, rotation, reference=None, lazy=False):
"""Initialize a Rotate2D object Arguments --------- rotation : scalar rotation value in degrees. Negative values can be used for rotation in t... | stack_v2_sparse_classes_36k_train_003453 | 21,674 | permissive | [
{
"docstring": "Initialize a Rotate2D object Arguments --------- rotation : scalar rotation value in degrees. Negative values can be used for rotation in the other direction reference : ANTsImage (optional but recommended) image providing the reference space for the transform. this will also set the transform f... | 2 | null | Implement the Python class `Rotate2D` described below.
Class description:
Create an ANTs Affine Transform with a specified level of rotation.
Method signatures and docstrings:
- def __init__(self, rotation, reference=None, lazy=False): Initialize a Rotate2D object Arguments --------- rotation : scalar rotation value ... | Implement the Python class `Rotate2D` described below.
Class description:
Create an ANTs Affine Transform with a specified level of rotation.
Method signatures and docstrings:
- def __init__(self, rotation, reference=None, lazy=False): Initialize a Rotate2D object Arguments --------- rotation : scalar rotation value ... | 41f2dd3fcf72654f284dac1a9448033e963f0afb | <|skeleton|>
class Rotate2D:
"""Create an ANTs Affine Transform with a specified level of rotation."""
def __init__(self, rotation, reference=None, lazy=False):
"""Initialize a Rotate2D object Arguments --------- rotation : scalar rotation value in degrees. Negative values can be used for rotation in t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rotate2D:
"""Create an ANTs Affine Transform with a specified level of rotation."""
def __init__(self, rotation, reference=None, lazy=False):
"""Initialize a Rotate2D object Arguments --------- rotation : scalar rotation value in degrees. Negative values can be used for rotation in the other dire... | the_stack_v2_python_sparse | ants/contrib/sampling/affine2d.py | ANTsX/ANTsPy | train | 483 |
5a2cf3dc6d7b81410e56a0d1ab944519aabc82f0 | [
"self.logger = logging.getLogger('BeamShutter')\nself.port_opened = False\ntry:\n self.beam_shutter_serial_port = serial.Serial(port, baudrate=115200, timeout=0.1, write_timeout=1)\n self.port_opened = True\nexcept serial.SerialException:\n self.logger.error('Cannot open Beam Shutter Controller port!')\n ... | <|body_start_0|>
self.logger = logging.getLogger('BeamShutter')
self.port_opened = False
try:
self.beam_shutter_serial_port = serial.Serial(port, baudrate=115200, timeout=0.1, write_timeout=1)
self.port_opened = True
except serial.SerialException:
self... | Beam Shutter class | BeamShutter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BeamShutter:
"""Beam Shutter class"""
def __init__(self, port):
"""Init function"""
<|body_0|>
def beam_off(self):
"""Close the beam shutter"""
<|body_1|>
def beam_on(self):
"""Open the beam shutter"""
<|body_2|>
def beam_shutter... | stack_v2_sparse_classes_36k_train_003454 | 3,253 | no_license | [
{
"docstring": "Init function",
"name": "__init__",
"signature": "def __init__(self, port)"
},
{
"docstring": "Close the beam shutter",
"name": "beam_off",
"signature": "def beam_off(self)"
},
{
"docstring": "Open the beam shutter",
"name": "beam_on",
"signature": "def be... | 5 | stack_v2_sparse_classes_30k_train_017585 | Implement the Python class `BeamShutter` described below.
Class description:
Beam Shutter class
Method signatures and docstrings:
- def __init__(self, port): Init function
- def beam_off(self): Close the beam shutter
- def beam_on(self): Open the beam shutter
- def beam_shutter_2_off(self): Open the beam shutter
- de... | Implement the Python class `BeamShutter` described below.
Class description:
Beam Shutter class
Method signatures and docstrings:
- def __init__(self, port): Init function
- def beam_off(self): Close the beam shutter
- def beam_on(self): Open the beam shutter
- def beam_shutter_2_off(self): Open the beam shutter
- de... | a50506f31b667107b8b08dfdf47d4798556a8e8c | <|skeleton|>
class BeamShutter:
"""Beam Shutter class"""
def __init__(self, port):
"""Init function"""
<|body_0|>
def beam_off(self):
"""Close the beam shutter"""
<|body_1|>
def beam_on(self):
"""Open the beam shutter"""
<|body_2|>
def beam_shutter... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BeamShutter:
"""Beam Shutter class"""
def __init__(self, port):
"""Init function"""
self.logger = logging.getLogger('BeamShutter')
self.port_opened = False
try:
self.beam_shutter_serial_port = serial.Serial(port, baudrate=115200, timeout=0.1, write_timeout=1)
... | the_stack_v2_python_sparse | RU_GUI_release/py_gui/beam_shutter.py | ycorrales/LANL_P25_RU_Felix_GUI | train | 0 |
69746af90ba335af041a1de93b86eecf7a37a909 | [
"if balance < Decimal('0.00'):\n raise ValueError('Initial balance must be >= to 0.00.')\nself.name = name\nself.balance = balance",
"if amount < Decimal('0.00'):\n raise ValueError('amount must be positive.')\nself.balance += amount",
"if amount > self.balance:\n raise ValueError('amount must be <= to... | <|body_start_0|>
if balance < Decimal('0.00'):
raise ValueError('Initial balance must be >= to 0.00.')
self.name = name
self.balance = balance
<|end_body_0|>
<|body_start_1|>
if amount < Decimal('0.00'):
raise ValueError('amount must be positive.')
self.b... | Account class for maintaining a bank account balance. | Account | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Account:
"""Account class for maintaining a bank account balance."""
def __init__(self, name, balance):
"""Initialize an Account object."""
<|body_0|>
def deposit(self, amount):
"""Deposit money to the account."""
<|body_1|>
def withdraw(self, amount... | stack_v2_sparse_classes_36k_train_003455 | 1,081 | no_license | [
{
"docstring": "Initialize an Account object.",
"name": "__init__",
"signature": "def __init__(self, name, balance)"
},
{
"docstring": "Deposit money to the account.",
"name": "deposit",
"signature": "def deposit(self, amount)"
},
{
"docstring": "Withdraw money from the account."... | 3 | stack_v2_sparse_classes_30k_test_000401 | Implement the Python class `Account` described below.
Class description:
Account class for maintaining a bank account balance.
Method signatures and docstrings:
- def __init__(self, name, balance): Initialize an Account object.
- def deposit(self, amount): Deposit money to the account.
- def withdraw(self, amount): W... | Implement the Python class `Account` described below.
Class description:
Account class for maintaining a bank account balance.
Method signatures and docstrings:
- def __init__(self, name, balance): Initialize an Account object.
- def deposit(self, amount): Deposit money to the account.
- def withdraw(self, amount): W... | b36ce1c9029eab390f380563912ccc09f678c053 | <|skeleton|>
class Account:
"""Account class for maintaining a bank account balance."""
def __init__(self, name, balance):
"""Initialize an Account object."""
<|body_0|>
def deposit(self, amount):
"""Deposit money to the account."""
<|body_1|>
def withdraw(self, amount... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Account:
"""Account class for maintaining a bank account balance."""
def __init__(self, name, balance):
"""Initialize an Account object."""
if balance < Decimal('0.00'):
raise ValueError('Initial balance must be >= to 0.00.')
self.name = name
self.balance = bal... | the_stack_v2_python_sparse | Deitel P., Deitel H. - Intro to Python for Computer Science and Data Science - 2020/classes10/account.py | valex/PythonLearning | train | 0 |
1576c586beff949b9797000b76bbcfd91cb139b5 | [
"try:\n del info\n subscriber = aiopubsub.Subscriber(ax_pubsub.hub, 'action_notify_subscriber')\n subscriber.subscribe(aiopubsub.Key('do_action'))\n while True:\n key, payload = await subscriber.consume()\n del key\n if payload['form_db_name'] == form_db_name:\n if row_gu... | <|body_start_0|>
try:
del info
subscriber = aiopubsub.Subscriber(ax_pubsub.hub, 'action_notify_subscriber')
subscriber.subscribe(aiopubsub.Key('do_action'))
while True:
key, payload = await subscriber.consume()
del key
... | GraphQL subscriptions | ActionSubscription | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionSubscription:
"""GraphQL subscriptions"""
async def resolve_action_notify(self, info, form_db_name, row_guid=None):
"""Web-socket subscription on every performed action AxForm.vue will display message, that current row have been modified AxGrid.vue will reload data of grid Args... | stack_v2_sparse_classes_36k_train_003456 | 35,425 | no_license | [
{
"docstring": "Web-socket subscription on every performed action AxForm.vue will display message, that current row have been modified AxGrid.vue will reload data of grid Args: form_db_name (str): db_name of AxForm row_guid (str): If it is set, then the subscriber will be notified only on actions performed with... | 2 | null | Implement the Python class `ActionSubscription` described below.
Class description:
GraphQL subscriptions
Method signatures and docstrings:
- async def resolve_action_notify(self, info, form_db_name, row_guid=None): Web-socket subscription on every performed action AxForm.vue will display message, that current row ha... | Implement the Python class `ActionSubscription` described below.
Class description:
GraphQL subscriptions
Method signatures and docstrings:
- async def resolve_action_notify(self, info, form_db_name, row_guid=None): Web-socket subscription on every performed action AxForm.vue will display message, that current row ha... | 3540979e680732d38e25a6b39f09338985de6743 | <|skeleton|>
class ActionSubscription:
"""GraphQL subscriptions"""
async def resolve_action_notify(self, info, form_db_name, row_guid=None):
"""Web-socket subscription on every performed action AxForm.vue will display message, that current row have been modified AxGrid.vue will reload data of grid Args... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActionSubscription:
"""GraphQL subscriptions"""
async def resolve_action_notify(self, info, form_db_name, row_guid=None):
"""Web-socket subscription on every performed action AxForm.vue will display message, that current row have been modified AxGrid.vue will reload data of grid Args: form_db_nam... | the_stack_v2_python_sparse | Calculation methods/CalcMethods_Lab_3_V15_Task_3_15/venv/Lib/site-packages/ax/backend/schemas/action_schema.py | areyykarthik/Zhukouski_Pavel_BSU_Projects | train | 0 |
6269d8d4f5120b1c608477a7e1a9793cc79edd40 | [
"list_themes = sorted(themes_info(), key=lambda theme: theme['title'].lower())\nhtml = render_to_string('administration/manifest/themes-list.html', {'list_themes': list_themes, 'current': request.website.theme}, context_instance=RequestContext(request))\nresponse = Response(status.HTTP_200_OK, {'html': html})\nretu... | <|body_start_0|>
list_themes = sorted(themes_info(), key=lambda theme: theme['title'].lower())
html = render_to_string('administration/manifest/themes-list.html', {'list_themes': list_themes, 'current': request.website.theme}, context_instance=RequestContext(request))
response = Response(status.... | Management of the authentication of users. | ThemesListView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThemesListView:
"""Management of the authentication of users."""
def get(self, request):
"""Managements of the Themes List"""
<|body_0|>
def post(self, request):
"""Change the page layout"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
list_them... | stack_v2_sparse_classes_36k_train_003457 | 5,299 | permissive | [
{
"docstring": "Managements of the Themes List",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Change the page layout",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012947 | Implement the Python class `ThemesListView` described below.
Class description:
Management of the authentication of users.
Method signatures and docstrings:
- def get(self, request): Managements of the Themes List
- def post(self, request): Change the page layout | Implement the Python class `ThemesListView` described below.
Class description:
Management of the authentication of users.
Method signatures and docstrings:
- def get(self, request): Managements of the Themes List
- def post(self, request): Change the page layout
<|skeleton|>
class ThemesListView:
"""Management ... | 00947315b5bca4977f1de40ddb951f843c345532 | <|skeleton|>
class ThemesListView:
"""Management of the authentication of users."""
def get(self, request):
"""Managements of the Themes List"""
<|body_0|>
def post(self, request):
"""Change the page layout"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ThemesListView:
"""Management of the authentication of users."""
def get(self, request):
"""Managements of the Themes List"""
list_themes = sorted(themes_info(), key=lambda theme: theme['title'].lower())
html = render_to_string('administration/manifest/themes-list.html', {'list_th... | the_stack_v2_python_sparse | ionyweb/administration/views/manifest.py | ionyse/ionyweb | train | 4 |
08f8a2cbb160444f31125c8ba80b5e22b126adc7 | [
"api_file = 'api_key.json'\nwith open(api_file, 'w') as f:\n json.dump(api_key_dict, f, indent=2)\nos.environ['GOOGLE_APPLICATION_CREDENTIALS'] = api_file\nself._client = storage.Client()\nself._bucket = self._client.get_bucket(bucket_name)\nself.bucket_name = bucket_name\nos.remove(api_file)",
"blob = self._b... | <|body_start_0|>
api_file = 'api_key.json'
with open(api_file, 'w') as f:
json.dump(api_key_dict, f, indent=2)
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = api_file
self._client = storage.Client()
self._bucket = self._client.get_bucket(bucket_name)
self.buck... | GCP ストレージへのサービスアカウントAPIを使うときはこのクラスを利用する | StorageGateway | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StorageGateway:
"""GCP ストレージへのサービスアカウントAPIを使うときはこのクラスを利用する"""
def __init__(self, bucket_name, api_key_dict):
""":param bucket_name: string バケット名 :param api_key_dict: dict サービスアカウントのAPIキー 認証用にjsonを作成できるので、その内容が入っている [ type, project_id, private_key_id, private_key, client_email, client... | stack_v2_sparse_classes_36k_train_003458 | 1,686 | no_license | [
{
"docstring": ":param bucket_name: string バケット名 :param api_key_dict: dict サービスアカウントのAPIキー 認証用にjsonを作成できるので、その内容が入っている [ type, project_id, private_key_id, private_key, client_email, client_id, auth_uri, token_uri, auth_provider_x509_cert_url, client_x509_cert_url, ]",
"name": "__init__",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_010886 | Implement the Python class `StorageGateway` described below.
Class description:
GCP ストレージへのサービスアカウントAPIを使うときはこのクラスを利用する
Method signatures and docstrings:
- def __init__(self, bucket_name, api_key_dict): :param bucket_name: string バケット名 :param api_key_dict: dict サービスアカウントのAPIキー 認証用にjsonを作成できるので、その内容が入っている [ type, proj... | Implement the Python class `StorageGateway` described below.
Class description:
GCP ストレージへのサービスアカウントAPIを使うときはこのクラスを利用する
Method signatures and docstrings:
- def __init__(self, bucket_name, api_key_dict): :param bucket_name: string バケット名 :param api_key_dict: dict サービスアカウントのAPIキー 認証用にjsonを作成できるので、その内容が入っている [ type, proj... | c8b013344472459b386890cacf4a39b39e9bb5a7 | <|skeleton|>
class StorageGateway:
"""GCP ストレージへのサービスアカウントAPIを使うときはこのクラスを利用する"""
def __init__(self, bucket_name, api_key_dict):
""":param bucket_name: string バケット名 :param api_key_dict: dict サービスアカウントのAPIキー 認証用にjsonを作成できるので、その内容が入っている [ type, project_id, private_key_id, private_key, client_email, client... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StorageGateway:
"""GCP ストレージへのサービスアカウントAPIを使うときはこのクラスを利用する"""
def __init__(self, bucket_name, api_key_dict):
""":param bucket_name: string バケット名 :param api_key_dict: dict サービスアカウントのAPIキー 認証用にjsonを作成できるので、その内容が入っている [ type, project_id, private_key_id, private_key, client_email, client_id, auth_uri... | the_stack_v2_python_sparse | Jupyter/work/bitbank/modules/datamanager/storagegateway.py | yamaguchi-milkcocholate/milkcocholate | train | 0 |
83265bf9cd3e30b46a3ea5685f95eabfcc653aae | [
"InferenceEngine.__init__(self, bnet, verbose, is_quantum)\nmoral_graph = MoralGraph(self.bnet)\ntri_graph = TriangulatedGraph(moral_graph)\nself.jtree = JoinTree(tri_graph, bnet)\nif verbose:\n print('------------------triangulated graph:')\n tri_graph.print_neighbors()\n print('------------------JoinTree... | <|body_start_0|>
InferenceEngine.__init__(self, bnet, verbose, is_quantum)
moral_graph = MoralGraph(self.bnet)
tri_graph = TriangulatedGraph(moral_graph)
self.jtree = JoinTree(tri_graph, bnet)
if verbose:
print('------------------triangulated graph:')
tri_... | Our implementation of the Join Tree (or Junction Tree) inference algorithm follows very closely the very detailed and clear reference: "Belief Networks: A Procedural Guide" By Cecil Huang an Adnan Darwiche ( 1996). As far as I know, the Join Tree algorithm has only been used in the past for CBnets, but this computer pr... | JoinTreeEngine | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JoinTreeEngine:
"""Our implementation of the Join Tree (or Junction Tree) inference algorithm follows very closely the very detailed and clear reference: "Belief Networks: A Procedural Guide" By Cecil Huang an Adnan Darwiche ( 1996). As far as I know, the Join Tree algorithm has only been used in... | stack_v2_sparse_classes_36k_train_003459 | 10,011 | permissive | [
{
"docstring": "Constructor. Note that the constructor of every inference engine is designed so that one of its objects can be created just once at the beginning and then reused to calculate probabilities under several evidence assumptions. Parameters ---------- bnet : BayesNet verbose : bool is_quantum : bool ... | 6 | null | Implement the Python class `JoinTreeEngine` described below.
Class description:
Our implementation of the Join Tree (or Junction Tree) inference algorithm follows very closely the very detailed and clear reference: "Belief Networks: A Procedural Guide" By Cecil Huang an Adnan Darwiche ( 1996). As far as I know, the Jo... | Implement the Python class `JoinTreeEngine` described below.
Class description:
Our implementation of the Join Tree (or Junction Tree) inference algorithm follows very closely the very detailed and clear reference: "Belief Networks: A Procedural Guide" By Cecil Huang an Adnan Darwiche ( 1996). As far as I know, the Jo... | 5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2 | <|skeleton|>
class JoinTreeEngine:
"""Our implementation of the Join Tree (or Junction Tree) inference algorithm follows very closely the very detailed and clear reference: "Belief Networks: A Procedural Guide" By Cecil Huang an Adnan Darwiche ( 1996). As far as I know, the Join Tree algorithm has only been used in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JoinTreeEngine:
"""Our implementation of the Join Tree (or Junction Tree) inference algorithm follows very closely the very detailed and clear reference: "Belief Networks: A Procedural Guide" By Cecil Huang an Adnan Darwiche ( 1996). As far as I know, the Join Tree algorithm has only been used in the past for... | the_stack_v2_python_sparse | inference/JoinTreeEngine.py | artiste-qb-net/quantum-fog | train | 95 |
07d98b5fb90d4ac7f6b6befd7cb28ea8d3df29dd | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | A set of methods for managing API keys. | ApiKeyServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiKeyServiceServicer:
"""A set of methods for managing API keys."""
def List(self, request, context):
"""Retrieves the list of API keys for the specified service account."""
<|body_0|>
def Get(self, request, context):
"""Returns the specified API key. To get the... | stack_v2_sparse_classes_36k_train_003460 | 11,954 | permissive | [
{
"docstring": "Retrieves the list of API keys for the specified service account.",
"name": "List",
"signature": "def List(self, request, context)"
},
{
"docstring": "Returns the specified API key. To get the list of available API keys, make a [List] request.",
"name": "Get",
"signature"... | 6 | stack_v2_sparse_classes_30k_val_000271 | Implement the Python class `ApiKeyServiceServicer` described below.
Class description:
A set of methods for managing API keys.
Method signatures and docstrings:
- def List(self, request, context): Retrieves the list of API keys for the specified service account.
- def Get(self, request, context): Returns the specifie... | Implement the Python class `ApiKeyServiceServicer` described below.
Class description:
A set of methods for managing API keys.
Method signatures and docstrings:
- def List(self, request, context): Retrieves the list of API keys for the specified service account.
- def Get(self, request, context): Returns the specifie... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class ApiKeyServiceServicer:
"""A set of methods for managing API keys."""
def List(self, request, context):
"""Retrieves the list of API keys for the specified service account."""
<|body_0|>
def Get(self, request, context):
"""Returns the specified API key. To get the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiKeyServiceServicer:
"""A set of methods for managing API keys."""
def List(self, request, context):
"""Retrieves the list of API keys for the specified service account."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
rai... | the_stack_v2_python_sparse | yandex/cloud/iam/v1/api_key_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
ae650e6ef8dcb1c0941cfb86e935f8c71f157c8a | [
"from icu import Locale, BreakIterator\nif locale in {'en', 'de', 'es', 'it', 'pt'}:\n locale += '@ss=standard'\nself.locale = Locale(locale)\nself.breaker = BreakIterator.createSentenceInstance(self.locale)",
"text = ''.join((c if c <= '\\uffff' else ' ' for c in text))\nself.breaker.setText(text)\nstart_idx ... | <|body_start_0|>
from icu import Locale, BreakIterator
if locale in {'en', 'de', 'es', 'it', 'pt'}:
locale += '@ss=standard'
self.locale = Locale(locale)
self.breaker = BreakIterator.createSentenceInstance(self.locale)
<|end_body_0|>
<|body_start_1|>
text = ''.join((... | Segment text to sentences. | ICUSentenceTokenizer | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ICUSentenceTokenizer:
"""Segment text to sentences."""
def __init__(self, locale='en'):
"""init fun"""
<|body_0|>
def span_tokenize(self, text: str):
"""ICU's BreakIterator gives boundary indices by counting *codeunits*, not *codepoints*. (https://stackoverflow.c... | stack_v2_sparse_classes_36k_train_003461 | 4,704 | permissive | [
{
"docstring": "init fun",
"name": "__init__",
"signature": "def __init__(self, locale='en')"
},
{
"docstring": "ICU's BreakIterator gives boundary indices by counting *codeunits*, not *codepoints*. (https://stackoverflow.com/questions/30775689/python-length-of-unicode-string-confusion) As a res... | 2 | null | Implement the Python class `ICUSentenceTokenizer` described below.
Class description:
Segment text to sentences.
Method signatures and docstrings:
- def __init__(self, locale='en'): init fun
- def span_tokenize(self, text: str): ICU's BreakIterator gives boundary indices by counting *codeunits*, not *codepoints*. (ht... | Implement the Python class `ICUSentenceTokenizer` described below.
Class description:
Segment text to sentences.
Method signatures and docstrings:
- def __init__(self, locale='en'): init fun
- def span_tokenize(self, text: str): ICU's BreakIterator gives boundary indices by counting *codeunits*, not *codepoints*. (ht... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class ICUSentenceTokenizer:
"""Segment text to sentences."""
def __init__(self, locale='en'):
"""init fun"""
<|body_0|>
def span_tokenize(self, text: str):
"""ICU's BreakIterator gives boundary indices by counting *codeunits*, not *codepoints*. (https://stackoverflow.c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ICUSentenceTokenizer:
"""Segment text to sentences."""
def __init__(self, locale='en'):
"""init fun"""
from icu import Locale, BreakIterator
if locale in {'en', 'de', 'es', 'it', 'pt'}:
locale += '@ss=standard'
self.locale = Locale(locale)
self.breaker ... | the_stack_v2_python_sparse | research/nlp/luke/src/utils/sentence_tokenizer.py | mindspore-ai/models | train | 301 |
4395971b7d74e4ae6a4349881674b8f84da8c061 | [
"if seed is not None:\n np.random.seed(seed)\nif images.shape[0] != labels.shape[0]:\n raise ValueError('Image and labels should have the same size')\nif batch_size > images.shape[0]:\n raise ValueError('Batch size should not exceed image number')\nself._len = images.shape[0]\nself._images = images\nself._... | <|body_start_0|>
if seed is not None:
np.random.seed(seed)
if images.shape[0] != labels.shape[0]:
raise ValueError('Image and labels should have the same size')
if batch_size > images.shape[0]:
raise ValueError('Batch size should not exceed image number')
... | Container class for a dataset. | Dataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""Container class for a dataset."""
def __init__(self, images, labels, batch_size, shuffle=True, seed=None):
"""Construct a Dataset. Args: images: Image data. labels: Label data. batch_size: Batch size. shuffle: Whether to shuffle data or not. seed: Random seed. Raises: Val... | stack_v2_sparse_classes_36k_train_003462 | 4,320 | permissive | [
{
"docstring": "Construct a Dataset. Args: images: Image data. labels: Label data. batch_size: Batch size. shuffle: Whether to shuffle data or not. seed: Random seed. Raises: ValueError: Wrong input arguments.",
"name": "__init__",
"signature": "def __init__(self, images, labels, batch_size, shuffle=Tru... | 3 | null | Implement the Python class `Dataset` described below.
Class description:
Container class for a dataset.
Method signatures and docstrings:
- def __init__(self, images, labels, batch_size, shuffle=True, seed=None): Construct a Dataset. Args: images: Image data. labels: Label data. batch_size: Batch size. shuffle: Wheth... | Implement the Python class `Dataset` described below.
Class description:
Container class for a dataset.
Method signatures and docstrings:
- def __init__(self, images, labels, batch_size, shuffle=True, seed=None): Construct a Dataset. Args: images: Image data. labels: Label data. batch_size: Batch size. shuffle: Wheth... | 757aac75a0f3921c6d1b4d98599bd7d4ffda936b | <|skeleton|>
class Dataset:
"""Container class for a dataset."""
def __init__(self, images, labels, batch_size, shuffle=True, seed=None):
"""Construct a Dataset. Args: images: Image data. labels: Label data. batch_size: Batch size. shuffle: Whether to shuffle data or not. seed: Random seed. Raises: Val... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dataset:
"""Container class for a dataset."""
def __init__(self, images, labels, batch_size, shuffle=True, seed=None):
"""Construct a Dataset. Args: images: Image data. labels: Label data. batch_size: Batch size. shuffle: Whether to shuffle data or not. seed: Random seed. Raises: ValueError: Wron... | the_stack_v2_python_sparse | python/level1_single_api/9_amct/amct_tensorflow/tensor_decompose/src/common/dataset.py | RomanGaraev/samples | train | 0 |
4f925336fee1c73f66a34c3b12a347e1a1b10e15 | [
"list_dict = []\nfor niv1 in data:\n for niv2 in niv1:\n list_dict.append(niv2)\nstring_dict = list_dict[0]\ndictionary = ast.literal_eval(string_dict)\nlist_index = []\nfor key, value in dictionary.items():\n list_index.append(key)\nj = -1\nfor i in list_index:\n j = j + 1\n label = str(i)\n ... | <|body_start_0|>
list_dict = []
for niv1 in data:
for niv2 in niv1:
list_dict.append(niv2)
string_dict = list_dict[0]
dictionary = ast.literal_eval(string_dict)
list_index = []
for key, value in dictionary.items():
list_index.append... | InstagramConnectionReader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstagramConnectionReader:
def get_and_concat_dataframe(self, data):
"""This function perform the following operations in order to transform data into a dataframe: --> data are ordrered by str(dictionaries) (ie following, blocked_users etc...) into a list --> ast.litteral_eval recognise ... | stack_v2_sparse_classes_36k_train_003463 | 4,133 | permissive | [
{
"docstring": "This function perform the following operations in order to transform data into a dataframe: --> data are ordrered by str(dictionaries) (ie following, blocked_users etc...) into a list --> ast.litteral_eval recognise the list as a dictionnary --> from this dictionnary with collect keys, these one... | 2 | null | Implement the Python class `InstagramConnectionReader` described below.
Class description:
Implement the InstagramConnectionReader class.
Method signatures and docstrings:
- def get_and_concat_dataframe(self, data): This function perform the following operations in order to transform data into a dataframe: --> data a... | Implement the Python class `InstagramConnectionReader` described below.
Class description:
Implement the InstagramConnectionReader class.
Method signatures and docstrings:
- def get_and_concat_dataframe(self, data): This function perform the following operations in order to transform data into a dataframe: --> data a... | 179dd4f04713026656c0849916166fd1ed0d6f31 | <|skeleton|>
class InstagramConnectionReader:
def get_and_concat_dataframe(self, data):
"""This function perform the following operations in order to transform data into a dataframe: --> data are ordrered by str(dictionaries) (ie following, blocked_users etc...) into a list --> ast.litteral_eval recognise ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InstagramConnectionReader:
def get_and_concat_dataframe(self, data):
"""This function perform the following operations in order to transform data into a dataframe: --> data are ordrered by str(dictionaries) (ie following, blocked_users etc...) into a list --> ast.litteral_eval recognise the list as a ... | the_stack_v2_python_sparse | Package/instagram_sub_readers/connection.py | AdrienCarthoblaz/Master-Thesis | train | 2 | |
3597588e3098aa04ef38b3a65fa995ed19282795 | [
"if not nums2 or not nums1:\n return []\nheap = []\nret = []\nheappush(heap, [nums1[0] + nums2[0], 0, 0])\nwhile len(ret) < k and heap:\n min_of_cur = heappop(heap)\n _, i, j = min_of_cur\n ret.append([nums1[i], nums2[j]])\n if j + 1 < len(nums2):\n heappush(heap, [nums1[i] + nums2[j + 1], i, ... | <|body_start_0|>
if not nums2 or not nums1:
return []
heap = []
ret = []
heappush(heap, [nums1[0] + nums2[0], 0, 0])
while len(ret) < k and heap:
min_of_cur = heappop(heap)
_, i, j = min_of_cur
ret.append([nums1[i], nums2[j]])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kSmallestPairs(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]"""
<|body_0|>
def kSmallestPairs3(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: ... | stack_v2_sparse_classes_36k_train_003464 | 3,335 | no_license | [
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]",
"name": "kSmallestPairs",
"signature": "def kSmallestPairs(self, nums1, nums2, k)"
},
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]",
"nam... | 4 | stack_v2_sparse_classes_30k_train_006995 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kSmallestPairs(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]
- def kSmallestPairs3(self, nums1, nums2, k): :type ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kSmallestPairs(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]
- def kSmallestPairs3(self, nums1, nums2, k): :type ... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def kSmallestPairs(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]"""
<|body_0|>
def kSmallestPairs3(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def kSmallestPairs(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]"""
if not nums2 or not nums1:
return []
heap = []
ret = []
heappush(heap, [nums1[0] + nums2[0], 0, 0])
while le... | the_stack_v2_python_sparse | python/leetcode/373_Find_K_Pairs_with_Smallest_Sums.py | bobcaoge/my-code | train | 0 | |
9a8966ce68ea662ef0a641b6ea73fa95f7860c9a | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the FeedItem service. Service to manage feed items. | FeedItemServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeedItemServiceServicer:
"""Proto file describing the FeedItem service. Service to manage feed items."""
def GetFeedItem(self, request, context):
"""Returns the requested feed item in full detail."""
<|body_0|>
def MutateFeedItems(self, request, context):
"""Crea... | stack_v2_sparse_classes_36k_train_003465 | 5,302 | permissive | [
{
"docstring": "Returns the requested feed item in full detail.",
"name": "GetFeedItem",
"signature": "def GetFeedItem(self, request, context)"
},
{
"docstring": "Creates, updates, or removes feed items. Operation statuses are returned.",
"name": "MutateFeedItems",
"signature": "def Muta... | 2 | stack_v2_sparse_classes_30k_train_001593 | Implement the Python class `FeedItemServiceServicer` described below.
Class description:
Proto file describing the FeedItem service. Service to manage feed items.
Method signatures and docstrings:
- def GetFeedItem(self, request, context): Returns the requested feed item in full detail.
- def MutateFeedItems(self, re... | Implement the Python class `FeedItemServiceServicer` described below.
Class description:
Proto file describing the FeedItem service. Service to manage feed items.
Method signatures and docstrings:
- def GetFeedItem(self, request, context): Returns the requested feed item in full detail.
- def MutateFeedItems(self, re... | 969eff5b6c3cec59d21191fa178cffb6270074c3 | <|skeleton|>
class FeedItemServiceServicer:
"""Proto file describing the FeedItem service. Service to manage feed items."""
def GetFeedItem(self, request, context):
"""Returns the requested feed item in full detail."""
<|body_0|>
def MutateFeedItems(self, request, context):
"""Crea... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeedItemServiceServicer:
"""Proto file describing the FeedItem service. Service to manage feed items."""
def GetFeedItem(self, request, context):
"""Returns the requested feed item in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not i... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/feed_item_service_pb2_grpc.py | VincentFritzsche/google-ads-python | train | 0 |
1857385805335074b725509986efd9f8ce10338b | [
"label = self.label\nif label[:1] == '=':\n return label[1:]\nlabel = xgetattr(object, label, '')\nif self.formatter is None:\n return label\nreturn self.formatter(object, label)",
"label_name = self.label\nif label_name[:1] != '=':\n xsetattr(object, label_name, label)",
"label = self.label\nif label[... | <|body_start_0|>
label = self.label
if label[:1] == '=':
return label[1:]
label = xgetattr(object, label, '')
if self.formatter is None:
return label
return self.formatter(object, label)
<|end_body_0|>
<|body_start_1|>
label_name = self.label
... | Defines a representation of a graph node for use by the graph editor and the graph editor factory classes. | GraphNode | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphNode:
"""Defines a representation of a graph node for use by the graph editor and the graph editor factory classes."""
def get_label(self, object):
"""Gets the label to display for a specified object."""
<|body_0|>
def set_label(self, object, label):
"""Sets... | stack_v2_sparse_classes_36k_train_003466 | 14,223 | permissive | [
{
"docstring": "Gets the label to display for a specified object.",
"name": "get_label",
"signature": "def get_label(self, object)"
},
{
"docstring": "Sets the label for a specified object.",
"name": "set_label",
"signature": "def set_label(self, object, label)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_012480 | Implement the Python class `GraphNode` described below.
Class description:
Defines a representation of a graph node for use by the graph editor and the graph editor factory classes.
Method signatures and docstrings:
- def get_label(self, object): Gets the label to display for a specified object.
- def set_label(self,... | Implement the Python class `GraphNode` described below.
Class description:
Defines a representation of a graph node for use by the graph editor and the graph editor factory classes.
Method signatures and docstrings:
- def get_label(self, object): Gets the label to display for a specified object.
- def set_label(self,... | 013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f | <|skeleton|>
class GraphNode:
"""Defines a representation of a graph node for use by the graph editor and the graph editor factory classes."""
def get_label(self, object):
"""Gets the label to display for a specified object."""
<|body_0|>
def set_label(self, object, label):
"""Sets... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphNode:
"""Defines a representation of a graph node for use by the graph editor and the graph editor factory classes."""
def get_label(self, object):
"""Gets the label to display for a specified object."""
label = self.label
if label[:1] == '=':
return label[1:]
... | the_stack_v2_python_sparse | godot/ui/graph_editor.py | rwl/godot | train | 5 |
3a662e8d4cf1d4553166846095905edda675f733 | [
"if value is None:\n return ''\nelse:\n return value",
"if isinstance(value, models.CharField):\n return value\nif value is None:\n return ''\nreturn value",
"if value is '':\n return None\nelse:\n return value"
] | <|body_start_0|>
if value is None:
return ''
else:
return value
<|end_body_0|>
<|body_start_1|>
if isinstance(value, models.CharField):
return value
if value is None:
return ''
return value
<|end_body_1|>
<|body_start_2|>
... | Subclass of the CharField that allows empty strings to be stored as NULL. | NullableCharField | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NullableCharField:
"""Subclass of the CharField that allows empty strings to be stored as NULL."""
def from_db_value(self, value, expression, connection, contex):
"""Gets value right out of the db and changes it if its ``None``."""
<|body_0|>
def to_python(self, value):
... | stack_v2_sparse_classes_36k_train_003467 | 6,255 | no_license | [
{
"docstring": "Gets value right out of the db and changes it if its ``None``.",
"name": "from_db_value",
"signature": "def from_db_value(self, value, expression, connection, contex)"
},
{
"docstring": "Gets value right out of the db or an instance, and changes it if its ``None``.",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_013095 | Implement the Python class `NullableCharField` described below.
Class description:
Subclass of the CharField that allows empty strings to be stored as NULL.
Method signatures and docstrings:
- def from_db_value(self, value, expression, connection, contex): Gets value right out of the db and changes it if its ``None``... | Implement the Python class `NullableCharField` described below.
Class description:
Subclass of the CharField that allows empty strings to be stored as NULL.
Method signatures and docstrings:
- def from_db_value(self, value, expression, connection, contex): Gets value right out of the db and changes it if its ``None``... | 9077681aa1857c8a40639c81d346f4b007edd42d | <|skeleton|>
class NullableCharField:
"""Subclass of the CharField that allows empty strings to be stored as NULL."""
def from_db_value(self, value, expression, connection, contex):
"""Gets value right out of the db and changes it if its ``None``."""
<|body_0|>
def to_python(self, value):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NullableCharField:
"""Subclass of the CharField that allows empty strings to be stored as NULL."""
def from_db_value(self, value, expression, connection, contex):
"""Gets value right out of the db and changes it if its ``None``."""
if value is None:
return ''
else:
... | the_stack_v2_python_sparse | socialwebproject/networkinstitute/models.py | danicretu/SocialWeb | train | 0 |
e06bd0c296584f8b6c31e8855247088ee3a5d479 | [
"user = self.object\nemail = attrs[source]\nif email.lower() == user.email:\n raise serializers.ValidationError(self.error_messages['already_known'])\nquery = User.objects.filter(email__iexact=email).exclude(email__iexact=user.email)\nif query.exists():\n raise serializers.ValidationError(self.error_messages[... | <|body_start_0|>
user = self.object
email = attrs[source]
if email.lower() == user.email:
raise serializers.ValidationError(self.error_messages['already_known'])
query = User.objects.filter(email__iexact=email).exclude(email__iexact=user.email)
if query.exists():
... | EmailChangeSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailChangeSerializer:
def validate_email(self, attrs, source):
"""Validate that the email is not already registered with another user"""
<|body_0|>
def restore_object(self, attrs, instance):
"""Save method calls :func:`user.change_email()` method which sends out an ... | stack_v2_sparse_classes_36k_train_003468 | 13,804 | no_license | [
{
"docstring": "Validate that the email is not already registered with another user",
"name": "validate_email",
"signature": "def validate_email(self, attrs, source)"
},
{
"docstring": "Save method calls :func:`user.change_email()` method which sends out an email with an verification key to veri... | 2 | stack_v2_sparse_classes_30k_train_005805 | Implement the Python class `EmailChangeSerializer` described below.
Class description:
Implement the EmailChangeSerializer class.
Method signatures and docstrings:
- def validate_email(self, attrs, source): Validate that the email is not already registered with another user
- def restore_object(self, attrs, instance)... | Implement the Python class `EmailChangeSerializer` described below.
Class description:
Implement the EmailChangeSerializer class.
Method signatures and docstrings:
- def validate_email(self, attrs, source): Validate that the email is not already registered with another user
- def restore_object(self, attrs, instance)... | 3cb4354b812d6b90347f63c389b3f023168915bd | <|skeleton|>
class EmailChangeSerializer:
def validate_email(self, attrs, source):
"""Validate that the email is not already registered with another user"""
<|body_0|>
def restore_object(self, attrs, instance):
"""Save method calls :func:`user.change_email()` method which sends out an ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmailChangeSerializer:
def validate_email(self, attrs, source):
"""Validate that the email is not already registered with another user"""
user = self.object
email = attrs[source]
if email.lower() == user.email:
raise serializers.ValidationError(self.error_messages['... | the_stack_v2_python_sparse | backend/api/serializers.py | zerrrow/workin | train | 0 | |
c4f2a117597257df75b93c6c5cab6fe31ed99a71 | [
"try:\n return ast.literal_eval(s)\nexcept:\n return s",
"self.__config__ = self.__class__.__name__\nsorted_dict = collections.OrderedDict(sorted(self.__dict__.items()))\nconfig = configparser.ConfigParser()\nconfig.add_section(self.__config__)\nfor k, v in sorted_dict.items():\n if not k.startswith('_')... | <|body_start_0|>
try:
return ast.literal_eval(s)
except:
return s
<|end_body_0|>
<|body_start_1|>
self.__config__ = self.__class__.__name__
sorted_dict = collections.OrderedDict(sorted(self.__dict__.items()))
config = configparser.ConfigParser()
c... | Generic base class to load/save config | Config | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Config:
"""Generic base class to load/save config"""
def _eval_str(self, s):
"""convert type to actual type"""
<|body_0|>
def save(self, filename):
"""Save configuration to file."""
<|body_1|>
def load(self, filename):
"""Load configuration f... | stack_v2_sparse_classes_36k_train_003469 | 4,361 | permissive | [
{
"docstring": "convert type to actual type",
"name": "_eval_str",
"signature": "def _eval_str(self, s)"
},
{
"docstring": "Save configuration to file.",
"name": "save",
"signature": "def save(self, filename)"
},
{
"docstring": "Load configuration from file",
"name": "load",
... | 3 | stack_v2_sparse_classes_30k_train_020779 | Implement the Python class `Config` described below.
Class description:
Generic base class to load/save config
Method signatures and docstrings:
- def _eval_str(self, s): convert type to actual type
- def save(self, filename): Save configuration to file.
- def load(self, filename): Load configuration from file | Implement the Python class `Config` described below.
Class description:
Generic base class to load/save config
Method signatures and docstrings:
- def _eval_str(self, s): convert type to actual type
- def save(self, filename): Save configuration to file.
- def load(self, filename): Load configuration from file
<|ske... | 99d1356aca5c47218d8d72b363ab583c1ea931d9 | <|skeleton|>
class Config:
"""Generic base class to load/save config"""
def _eval_str(self, s):
"""convert type to actual type"""
<|body_0|>
def save(self, filename):
"""Save configuration to file."""
<|body_1|>
def load(self, filename):
"""Load configuration f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Config:
"""Generic base class to load/save config"""
def _eval_str(self, s):
"""convert type to actual type"""
try:
return ast.literal_eval(s)
except:
return s
def save(self, filename):
"""Save configuration to file."""
self.__config__ ... | the_stack_v2_python_sparse | osas/io_utils/config.py | NoellyB76/OSAS | train | 0 |
ca0a2a6984b8214c0ce214c666b4c8423107166d | [
"self.meshing_enabled = meshing_enabled\nself.ipv_6_bridge_enabled = ipv_6_bridge_enabled\nself.location_analytics_enabled = location_analytics_enabled\nself.led_lights_on = led_lights_on",
"if dictionary is None:\n return None\nmeshing_enabled = dictionary.get('meshingEnabled')\nipv_6_bridge_enabled = diction... | <|body_start_0|>
self.meshing_enabled = meshing_enabled
self.ipv_6_bridge_enabled = ipv_6_bridge_enabled
self.location_analytics_enabled = location_analytics_enabled
self.led_lights_on = led_lights_on
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None... | Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridging in a network (Note: if enabled, SSIDs must also be configu... | UpdateNetworkWirelessSettingsModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateNetworkWirelessSettingsModel:
"""Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridg... | stack_v2_sparse_classes_36k_train_003470 | 2,821 | permissive | [
{
"docstring": "Constructor for the UpdateNetworkWirelessSettingsModel class",
"name": "__init__",
"signature": "def __init__(self, meshing_enabled=None, ipv_6_bridge_enabled=None, location_analytics_enabled=None, led_lights_on=None)"
},
{
"docstring": "Creates an instance of this model from a d... | 2 | stack_v2_sparse_classes_30k_train_019141 | Implement the Python class `UpdateNetworkWirelessSettingsModel` described below.
Class description:
Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Togg... | Implement the Python class `UpdateNetworkWirelessSettingsModel` described below.
Class description:
Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Togg... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class UpdateNetworkWirelessSettingsModel:
"""Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridg... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateNetworkWirelessSettingsModel:
"""Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridging in a netw... | the_stack_v2_python_sparse | meraki_sdk/models/update_network_wireless_settings_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
e145001fb24506444cc0f7841d2bbe0bb9e78171 | [
"self.orgnr_field = orgnr_field\nself.intern_ref_field = intern_ref_field\nself.fodt_dato_field = APIHelper.RFC3339DateTime(fodt_dato_field) if fodt_dato_field else None\nself.navn_field = navn_field\nself.postnr_field = postnr_field\nself.poststed_field = poststed_field\nself.eierandel_field = eierandel_field\nsel... | <|body_start_0|>
self.orgnr_field = orgnr_field
self.intern_ref_field = intern_ref_field
self.fodt_dato_field = APIHelper.RFC3339DateTime(fodt_dato_field) if fodt_dato_field else None
self.navn_field = navn_field
self.postnr_field = postnr_field
self.poststed_field = post... | Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type description here. postnr_field (int): ... | Aksjonar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Aksjonar:
"""Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type de... | stack_v2_sparse_classes_36k_train_003471 | 3,698 | permissive | [
{
"docstring": "Constructor for the Aksjonar class",
"name": "__init__",
"signature": "def __init__(self, orgnr_field=None, intern_ref_field=None, fodt_dato_field=None, navn_field=None, postnr_field=None, poststed_field=None, eierandel_field=None, additional_properties={})"
},
{
"docstring": "Cr... | 2 | stack_v2_sparse_classes_30k_train_008587 | Implement the Python class `Aksjonar` described below.
Class description:
Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description h... | Implement the Python class `Aksjonar` described below.
Class description:
Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description h... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Aksjonar:
"""Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Aksjonar:
"""Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type description her... | the_stack_v2_python_sparse | idfy_rest_client/models/aksjonar.py | dealflowteam/Idfy | train | 0 |
f4b26ff15f55031f782a57b94e9011210b35d245 | [
"self = object.__new__(cls)\nself.name = cls.DEFAULT_NAME\nself.value = value\nself.value_type = ApplicationRoleConnectionValueType.none\nreturn self",
"self.value = value\nself.name = name\nself.value_type = value_type\nself.INSTANCES[value] = self"
] | <|body_start_0|>
self = object.__new__(cls)
self.name = cls.DEFAULT_NAME
self.value = value
self.value_type = ApplicationRoleConnectionValueType.none
return self
<|end_body_0|>
<|body_start_1|>
self.value = value
self.name = name
self.value_type = value_t... | Represents an application role connection type. Attributes ---------- name : `str` The name of the application role connection type. value : `int` The Discord side identifier value of the application role connection type. value_type : ``ApplicationRoleConnectionValueType`` Additional information describing the metadata... | ApplicationRoleConnectionMetadataType | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApplicationRoleConnectionMetadataType:
"""Represents an application role connection type. Attributes ---------- name : `str` The name of the application role connection type. value : `int` The Discord side identifier value of the application role connection type. value_type : ``ApplicationRoleCon... | stack_v2_sparse_classes_36k_train_003472 | 9,302 | permissive | [
{
"docstring": "Creates a new application role connection metadata type with the given value. Parameters ---------- value : `int` The application role connection metadata type's identifier value. Returns ------- self : ``ApplicationRoleConnectionMetadataType`` The created instance.",
"name": "_from_value",
... | 2 | null | Implement the Python class `ApplicationRoleConnectionMetadataType` described below.
Class description:
Represents an application role connection type. Attributes ---------- name : `str` The name of the application role connection type. value : `int` The Discord side identifier value of the application role connection ... | Implement the Python class `ApplicationRoleConnectionMetadataType` described below.
Class description:
Represents an application role connection type. Attributes ---------- name : `str` The name of the application role connection type. value : `int` The Discord side identifier value of the application role connection ... | 53f24fdb38459dc5a4fd04f11bdbfee8295b76a4 | <|skeleton|>
class ApplicationRoleConnectionMetadataType:
"""Represents an application role connection type. Attributes ---------- name : `str` The name of the application role connection type. value : `int` The Discord side identifier value of the application role connection type. value_type : ``ApplicationRoleCon... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApplicationRoleConnectionMetadataType:
"""Represents an application role connection type. Attributes ---------- name : `str` The name of the application role connection type. value : `int` The Discord side identifier value of the application role connection type. value_type : ``ApplicationRoleConnectionValueT... | the_stack_v2_python_sparse | hata/discord/application/application_role_connection_metadata/preinstanced.py | HuyaneMatsu/hata | train | 3 |
72e145095956267476b7ebf802d0115640cb0378 | [
"realPoints = RoutePoint.objects.get(point, keys_only=True)\nif type(point) == type(list()) or type(point) == type(set()):\n return [user.routeuserpoint_set.filter('point =', p).get() for p in realPoints]\nreturn user.routeuserpoint_set.filter('point =', realPoints).get()",
"if type(point) == type(list()):\n ... | <|body_start_0|>
realPoints = RoutePoint.objects.get(point, keys_only=True)
if type(point) == type(list()) or type(point) == type(set()):
return [user.routeuserpoint_set.filter('point =', p).get() for p in realPoints]
return user.routeuserpoint_set.filter('point =', realPoints).get()... | Helper function for :class:`RouteUserPoint`, accesed by :class:`RouteUserPoint.objects` | RouteUserPointHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RouteUserPointHelper:
"""Helper function for :class:`RouteUserPoint`, accesed by :class:`RouteUserPoint.objects`"""
def get(self, user, point):
"""Returns the :class:`RouteUserPoint` for this point or list of points :param user: The user wanted :type user: :class:`georemindme.models.... | stack_v2_sparse_classes_36k_train_003473 | 19,846 | no_license | [
{
"docstring": "Returns the :class:`RouteUserPoint` for this point or list of points :param user: The user wanted :type user: :class:`georemindme.models.User` :param point: point or list searching :type point: :class:`db.GeoPt` :returns: None or :class:`RouteUserPoint`",
"name": "get",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_019518 | Implement the Python class `RouteUserPointHelper` described below.
Class description:
Helper function for :class:`RouteUserPoint`, accesed by :class:`RouteUserPoint.objects`
Method signatures and docstrings:
- def get(self, user, point): Returns the :class:`RouteUserPoint` for this point or list of points :param user... | Implement the Python class `RouteUserPointHelper` described below.
Class description:
Helper function for :class:`RouteUserPoint`, accesed by :class:`RouteUserPoint.objects`
Method signatures and docstrings:
- def get(self, user, point): Returns the :class:`RouteUserPoint` for this point or list of points :param user... | d441693eedb32c36fe853895110df808a9959941 | <|skeleton|>
class RouteUserPointHelper:
"""Helper function for :class:`RouteUserPoint`, accesed by :class:`RouteUserPoint.objects`"""
def get(self, user, point):
"""Returns the :class:`RouteUserPoint` for this point or list of points :param user: The user wanted :type user: :class:`georemindme.models.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RouteUserPointHelper:
"""Helper function for :class:`RouteUserPoint`, accesed by :class:`RouteUserPoint.objects`"""
def get(self, user, point):
"""Returns the :class:`RouteUserPoint` for this point or list of points :param user: The user wanted :type user: :class:`georemindme.models.User` :param ... | the_stack_v2_python_sparse | src/webapp/georoute/models.py | GeoRemindMe/GeoRemindMe_Web | train | 8 |
7def24d98f4b997deb189c2698ed1cd030d796b9 | [
"self.filenames = filenames\nself.cutoff = cutoff\nself.exceptionsToIgnore = exceptionsToIgnore\nself.mapStarts = mapStarts\nself.mapN = mapN\nself.contactFunction = contactFunction\nself.loadFunction = loadFunction\nself.i = 0\nself.curStarts = []",
"try:\n if len(self.curStarts) == 0:\n if self.i == l... | <|body_start_0|>
self.filenames = filenames
self.cutoff = cutoff
self.exceptionsToIgnore = exceptionsToIgnore
self.mapStarts = mapStarts
self.mapN = mapN
self.contactFunction = contactFunction
self.loadFunction = loadFunction
self.i = 0
self.curSta... | This is a interator for the repeated contact map finder | filenameContactMapRepeat | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class filenameContactMapRepeat:
"""This is a interator for the repeated contact map finder"""
def __init__(self, filenames, mapStarts, mapN, cutoff=1.7, loadFunction=None, exceptionsToIgnore=[], contactFunction=None):
"""Init accepts arguments to initialize the iterator. filenames will be ... | stack_v2_sparse_classes_36k_train_003474 | 22,325 | permissive | [
{
"docstring": "Init accepts arguments to initialize the iterator. filenames will be one of the items in the inValues list of the \"averageContacts\" function cutoff and loadFunction should be provided either in classInitArgs or classInitKwargs of averageContacts When initialized, the iterator should store thes... | 2 | stack_v2_sparse_classes_30k_train_007090 | Implement the Python class `filenameContactMapRepeat` described below.
Class description:
This is a interator for the repeated contact map finder
Method signatures and docstrings:
- def __init__(self, filenames, mapStarts, mapN, cutoff=1.7, loadFunction=None, exceptionsToIgnore=[], contactFunction=None): Init accepts... | Implement the Python class `filenameContactMapRepeat` described below.
Class description:
This is a interator for the repeated contact map finder
Method signatures and docstrings:
- def __init__(self, filenames, mapStarts, mapN, cutoff=1.7, loadFunction=None, exceptionsToIgnore=[], contactFunction=None): Init accepts... | 8052c597b0566f88a7b7ef80658a3f077e474a7e | <|skeleton|>
class filenameContactMapRepeat:
"""This is a interator for the repeated contact map finder"""
def __init__(self, filenames, mapStarts, mapN, cutoff=1.7, loadFunction=None, exceptionsToIgnore=[], contactFunction=None):
"""Init accepts arguments to initialize the iterator. filenames will be ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class filenameContactMapRepeat:
"""This is a interator for the repeated contact map finder"""
def __init__(self, filenames, mapStarts, mapN, cutoff=1.7, loadFunction=None, exceptionsToIgnore=[], contactFunction=None):
"""Init accepts arguments to initialize the iterator. filenames will be one of the it... | the_stack_v2_python_sparse | polychrom/contactmaps.py | open2c/polychrom | train | 24 |
761d059bc51ee29c9b235411e3002479972c7202 | [
"adm = ProjectAdministration()\nrole_list = adm.get_all_roles()\nreturn role_list",
"adm = ProjectAdministration()\nproposal = Role.from_dict(api.payload)\nif proposal is not None:\n 'Wir verwenden role_id des Proposals für die Erzeugung eines Role-Objektes.'\n rol = adm.create_role_for_person(proposal.get_... | <|body_start_0|>
adm = ProjectAdministration()
role_list = adm.get_all_roles()
return role_list
<|end_body_0|>
<|body_start_1|>
adm = ProjectAdministration()
proposal = Role.from_dict(api.payload)
if proposal is not None:
'Wir verwenden role_id des Proposals ... | RoleListOperations | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleListOperations:
def get(self):
"""Auslesen aller Role-Objekte"""
<|body_0|>
def post(self):
"""Anlegen eines neuen Role-Objekts"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
adm = ProjectAdministration()
role_list = adm.get_all_roles()... | stack_v2_sparse_classes_36k_train_003475 | 44,493 | no_license | [
{
"docstring": "Auslesen aller Role-Objekte",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Anlegen eines neuen Role-Objekts",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003898 | Implement the Python class `RoleListOperations` described below.
Class description:
Implement the RoleListOperations class.
Method signatures and docstrings:
- def get(self): Auslesen aller Role-Objekte
- def post(self): Anlegen eines neuen Role-Objekts | Implement the Python class `RoleListOperations` described below.
Class description:
Implement the RoleListOperations class.
Method signatures and docstrings:
- def get(self): Auslesen aller Role-Objekte
- def post(self): Anlegen eines neuen Role-Objekts
<|skeleton|>
class RoleListOperations:
def get(self):
... | 4b2826225525ae855e15e1174f5cf90466097021 | <|skeleton|>
class RoleListOperations:
def get(self):
"""Auslesen aller Role-Objekte"""
<|body_0|>
def post(self):
"""Anlegen eines neuen Role-Objekts"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoleListOperations:
def get(self):
"""Auslesen aller Role-Objekte"""
adm = ProjectAdministration()
role_list = adm.get_all_roles()
return role_list
def post(self):
"""Anlegen eines neuen Role-Objekts"""
adm = ProjectAdministration()
proposal = Role.... | the_stack_v2_python_sparse | src/main.py | KieserChristian/SW_Praktikum_Gruppe1 | train | 0 | |
145737dc8a2eec4e3d8961f8d2085070f4bac26c | [
"if cls.__controller is None:\n cls.__controller = cls.instanciate_controller()\nreturn cls.__controller",
"dynamic_controller_name = ''\nif len(sys.argv) > 1:\n dynamic_controller_name = sys.argv[1]\nelse:\n lst_controller_files = os.listdir(os.path.realpath(os.path.join(project_directory, 'ElectronicCo... | <|body_start_0|>
if cls.__controller is None:
cls.__controller = cls.instanciate_controller()
return cls.__controller
<|end_body_0|>
<|body_start_1|>
dynamic_controller_name = ''
if len(sys.argv) > 1:
dynamic_controller_name = sys.argv[1]
else:
... | Controller Factory can analyze the driver library presented to the application If the driver is transmit as a parameter, it load and return it to the application | ControllerFactory | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ControllerFactory:
"""Controller Factory can analyze the driver library presented to the application If the driver is transmit as a parameter, it load and return it to the application"""
def get_controller(cls):
"""Cause the physical driver point to electronic component, it must be s... | stack_v2_sparse_classes_36k_train_003476 | 2,502 | permissive | [
{
"docstring": "Cause the physical driver point to electronic component, it must be single Used as a singleton",
"name": "get_controller",
"signature": "def get_controller(cls)"
},
{
"docstring": "Method to select the controller and instantiate it (like a singleton)",
"name": "instanciate_co... | 2 | stack_v2_sparse_classes_30k_train_012641 | Implement the Python class `ControllerFactory` described below.
Class description:
Controller Factory can analyze the driver library presented to the application If the driver is transmit as a parameter, it load and return it to the application
Method signatures and docstrings:
- def get_controller(cls): Cause the ph... | Implement the Python class `ControllerFactory` described below.
Class description:
Controller Factory can analyze the driver library presented to the application If the driver is transmit as a parameter, it load and return it to the application
Method signatures and docstrings:
- def get_controller(cls): Cause the ph... | dc6a3d8ee8b9dc67753d5b713bfa5f81f0a20f6a | <|skeleton|>
class ControllerFactory:
"""Controller Factory can analyze the driver library presented to the application If the driver is transmit as a parameter, it load and return it to the application"""
def get_controller(cls):
"""Cause the physical driver point to electronic component, it must be s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ControllerFactory:
"""Controller Factory can analyze the driver library presented to the application If the driver is transmit as a parameter, it load and return it to the application"""
def get_controller(cls):
"""Cause the physical driver point to electronic component, it must be single Used as... | the_stack_v2_python_sparse | src/build/lib/Controller/FactoryController.py | pierrecontri/TrainManagement | train | 0 |
d8d1db1c6308975cf5314ef81198c3b3c82bd6b9 | [
"super().__init__()\nself._dates_cache: Optional[pd.DataFrame] = None\nself._cache_lock = asyncio.Lock()",
"name = self._log_and_validate_group(table_name, outer.TRADING_DATES)\nif name != outer.TRADING_DATES:\n raise outer.DataError(f'Некорректное имя таблицы для обновления {table_name}')\nasync with self._ca... | <|body_start_0|>
super().__init__()
self._dates_cache: Optional[pd.DataFrame] = None
self._cache_lock = asyncio.Lock()
<|end_body_0|>
<|body_start_1|>
name = self._log_and_validate_group(table_name, outer.TRADING_DATES)
if name != outer.TRADING_DATES:
raise outer.Dat... | Обновление для таблиц с диапазоном доступных торговых дат. | TradingDatesLoader | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TradingDatesLoader:
"""Обновление для таблиц с диапазоном доступных торговых дат."""
def __init__(self) -> None:
"""Кэшируются данные, чтобы сократить количество обращений к серверу MOEX."""
<|body_0|>
async def get(self, table_name: outer.TableName) -> pd.DataFrame:
... | stack_v2_sparse_classes_36k_train_003477 | 1,823 | permissive | [
{
"docstring": "Кэшируются данные, чтобы сократить количество обращений к серверу MOEX.",
"name": "__init__",
"signature": "def __init__(self) -> None"
},
{
"docstring": "Получение обновленных данных о доступном диапазоне торговых дат.",
"name": "get",
"signature": "async def get(self, t... | 2 | stack_v2_sparse_classes_30k_train_000053 | Implement the Python class `TradingDatesLoader` described below.
Class description:
Обновление для таблиц с диапазоном доступных торговых дат.
Method signatures and docstrings:
- def __init__(self) -> None: Кэшируются данные, чтобы сократить количество обращений к серверу MOEX.
- async def get(self, table_name: outer... | Implement the Python class `TradingDatesLoader` described below.
Class description:
Обновление для таблиц с диапазоном доступных торговых дат.
Method signatures and docstrings:
- def __init__(self) -> None: Кэшируются данные, чтобы сократить количество обращений к серверу MOEX.
- async def get(self, table_name: outer... | e5d0f2c28de25568e4515b63aaad4aa337e2e522 | <|skeleton|>
class TradingDatesLoader:
"""Обновление для таблиц с диапазоном доступных торговых дат."""
def __init__(self) -> None:
"""Кэшируются данные, чтобы сократить количество обращений к серверу MOEX."""
<|body_0|>
async def get(self, table_name: outer.TableName) -> pd.DataFrame:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TradingDatesLoader:
"""Обновление для таблиц с диапазоном доступных торговых дат."""
def __init__(self) -> None:
"""Кэшируются данные, чтобы сократить количество обращений к серверу MOEX."""
super().__init__()
self._dates_cache: Optional[pd.DataFrame] = None
self._cache_lo... | the_stack_v2_python_sparse | poptimizer/data/adapters/loaders/trading_dates.py | chekanskiy/poptimizer | train | 0 |
b8b9cbdd0d22beb943304524fd5bce94486a25d7 | [
"self.capacity = capacity\nself.l = DoublyLL()\nself.d = {}",
"try:\n n = self.d[key]\nexcept KeyError:\n return -1\nself.l.Remove(n)\nself.l.InsertFirst(n)\nreturn n.value",
"if key in self.d:\n node = self.d[key]\n self.l.Remove(node)\n self.l.InsertFirst(node)\n node.value = value\nelse:\n ... | <|body_start_0|>
self.capacity = capacity
self.l = DoublyLL()
self.d = {}
<|end_body_0|>
<|body_start_1|>
try:
n = self.d[key]
except KeyError:
return -1
self.l.Remove(n)
self.l.InsertFirst(n)
return n.value
<|end_body_1|>
<|body_... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_003478 | 2,641 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_006067 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | 786e1597b18cf5f16df0a3d7dfa0b80c1435de4d | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.l = DoublyLL()
self.d = {}
def get(self, key):
""":type key: int :rtype: int"""
try:
n = self.d[key]
except KeyError:
return -1
... | the_stack_v2_python_sparse | No_146_LRU_Cache.py | georgewashingturd/leetcode | train | 0 | |
5073913d6e256830fd8c17b1ebb9789bbe833329 | [
"factors = [2, 3, 5]\nnums = [1]\nwhile len(nums) < n:\n t = min([x * y for x in nums for y in factors if x * y > nums[-1]])\n nums.append(t)\nreturn nums[-1]",
"nums = [1] * n\nf2 = f3 = f5 = 0\ni = 1\nwhile i < n:\n nums[i] = min(nums[f2] * 2, nums[f3] * 3, nums[f5] * 5)\n if nums[f2] * 2 == nums[i]... | <|body_start_0|>
factors = [2, 3, 5]
nums = [1]
while len(nums) < n:
t = min([x * y for x in nums for y in factors if x * y > nums[-1]])
nums.append(t)
return nums[-1]
<|end_body_0|>
<|body_start_1|>
nums = [1] * n
f2 = f3 = f5 = 0
i = 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nthUglyNumber1(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def nthUglyNumber(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
factors = [2, 3, 5]
nums = [1]
while len(nums) <... | stack_v2_sparse_classes_36k_train_003479 | 701 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "nthUglyNumber1",
"signature": "def nthUglyNumber1(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "nthUglyNumber",
"signature": "def nthUglyNumber(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nthUglyNumber1(self, n): :type n: int :rtype: int
- def nthUglyNumber(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nthUglyNumber1(self, n): :type n: int :rtype: int
- def nthUglyNumber(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def nthUglyNumber1(self, n):
... | e5b018493bbd12edcdcd0434f35d9c358106d391 | <|skeleton|>
class Solution:
def nthUglyNumber1(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def nthUglyNumber(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def nthUglyNumber1(self, n):
""":type n: int :rtype: int"""
factors = [2, 3, 5]
nums = [1]
while len(nums) < n:
t = min([x * y for x in nums for y in factors if x * y > nums[-1]])
nums.append(t)
return nums[-1]
def nthUglyNumber(se... | the_stack_v2_python_sparse | py/leetcode/264.py | wfeng1991/learnpy | train | 0 | |
378233ad859a5b8468c17383613d4d7207e7f60c | [
"if not self._MAPPING:\n self._MAPPING['\\\\Device\\\\Mup'] = None\n self._MAPPING['\\\\SystemRoot'] = os.environ['SystemRoot']\n for letter in (chr(l) for l in range(ord('C'), ord('Z') + 1)):\n try:\n letter = '%s:' % letter\n mapped = QueryDosDevice(letter)\n if ma... | <|body_start_0|>
if not self._MAPPING:
self._MAPPING['\\Device\\Mup'] = None
self._MAPPING['\\SystemRoot'] = os.environ['SystemRoot']
for letter in (chr(l) for l in range(ord('C'), ord('Z') + 1)):
try:
letter = '%s:' % letter
... | Maps \\Device\\HarddiskVolumeN to N: on Windows. | DosDriveMap | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DosDriveMap:
"""Maps \\Device\\HarddiskVolumeN to N: on Windows."""
def __init__(self):
"""Lazy loads the cache."""
<|body_0|>
def to_win32(self, path):
"""Converts a native NT path to Win32/DOS compatible path."""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_003480 | 42,355 | permissive | [
{
"docstring": "Lazy loads the cache.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Converts a native NT path to Win32/DOS compatible path.",
"name": "to_win32",
"signature": "def to_win32(self, path)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011150 | Implement the Python class `DosDriveMap` described below.
Class description:
Maps \\Device\\HarddiskVolumeN to N: on Windows.
Method signatures and docstrings:
- def __init__(self): Lazy loads the cache.
- def to_win32(self, path): Converts a native NT path to Win32/DOS compatible path. | Implement the Python class `DosDriveMap` described below.
Class description:
Maps \\Device\\HarddiskVolumeN to N: on Windows.
Method signatures and docstrings:
- def __init__(self): Lazy loads the cache.
- def to_win32(self, path): Converts a native NT path to Win32/DOS compatible path.
<|skeleton|>
class DosDriveMa... | 10cc5fdcca53e2a1690867acbe6fce099273f092 | <|skeleton|>
class DosDriveMap:
"""Maps \\Device\\HarddiskVolumeN to N: on Windows."""
def __init__(self):
"""Lazy loads the cache."""
<|body_0|>
def to_win32(self, path):
"""Converts a native NT path to Win32/DOS compatible path."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DosDriveMap:
"""Maps \\Device\\HarddiskVolumeN to N: on Windows."""
def __init__(self):
"""Lazy loads the cache."""
if not self._MAPPING:
self._MAPPING['\\Device\\Mup'] = None
self._MAPPING['\\SystemRoot'] = os.environ['SystemRoot']
for letter in (chr(l... | the_stack_v2_python_sparse | client/utils/file_path.py | luci/luci-py | train | 84 |
1e0cd92cab8c61cf19c86d96124603454b08636f | [
"super().install()\nif not os.path.exists(os.path.join('src', 'templates', 'mail')):\n os.mkdir(os.path.join('src', 'templates', 'mail'))",
"super().uninstall()\nif os.path.exists(os.path.join('src', 'templates', 'mail')):\n shutil.rmtree(os.path.join('src', 'templates', 'mail'))",
"if not os.path.exists(... | <|body_start_0|>
super().install()
if not os.path.exists(os.path.join('src', 'templates', 'mail')):
os.mkdir(os.path.join('src', 'templates', 'mail'))
<|end_body_0|>
<|body_start_1|>
super().uninstall()
if os.path.exists(os.path.join('src', 'templates', 'mail')):
... | FlaskMailInstaller | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlaskMailInstaller:
def install(cls):
"""Extend default install function by creating a 'mail' folder in 'src/templates'"""
<|body_0|>
def uninstall(cls):
"""Extend default uninstall function by deleting the 'mail' folder in 'src/templates'"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_003481 | 1,541 | permissive | [
{
"docstring": "Extend default install function by creating a 'mail' folder in 'src/templates'",
"name": "install",
"signature": "def install(cls)"
},
{
"docstring": "Extend default uninstall function by deleting the 'mail' folder in 'src/templates'",
"name": "uninstall",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_003127 | Implement the Python class `FlaskMailInstaller` described below.
Class description:
Implement the FlaskMailInstaller class.
Method signatures and docstrings:
- def install(cls): Extend default install function by creating a 'mail' folder in 'src/templates'
- def uninstall(cls): Extend default uninstall function by de... | Implement the Python class `FlaskMailInstaller` described below.
Class description:
Implement the FlaskMailInstaller class.
Method signatures and docstrings:
- def install(cls): Extend default install function by creating a 'mail' folder in 'src/templates'
- def uninstall(cls): Extend default uninstall function by de... | 2aeb0d47543fc85a15e752a00bfa0d0ba9e23988 | <|skeleton|>
class FlaskMailInstaller:
def install(cls):
"""Extend default install function by creating a 'mail' folder in 'src/templates'"""
<|body_0|>
def uninstall(cls):
"""Extend default uninstall function by deleting the 'mail' folder in 'src/templates'"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlaskMailInstaller:
def install(cls):
"""Extend default install function by creating a 'mail' folder in 'src/templates'"""
super().install()
if not os.path.exists(os.path.join('src', 'templates', 'mail')):
os.mkdir(os.path.join('src', 'templates', 'mail'))
def uninstal... | the_stack_v2_python_sparse | src/flask_batteries/installers/flask_mail.py | graydenshand/flask-batteries | train | 1 | |
e6380e103209b26201de874a7b615e7fa1d6ebfd | [
"if not root1 and (not root2):\n return True\nif root1 and root2 and (root1.val == root2.val):\n return self.is_mirror(root1.left, root2.right) and self.is_mirror(root1.right, root2.left)\nreturn False",
"if not root:\n return 1\nif self.is_mirror(root.left, root.right):\n return 1\nreturn 0"
] | <|body_start_0|>
if not root1 and (not root2):
return True
if root1 and root2 and (root1.val == root2.val):
return self.is_mirror(root1.left, root2.right) and self.is_mirror(root1.right, root2.left)
return False
<|end_body_0|>
<|body_start_1|>
if not root:
... | SolutionInterviewBit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolutionInterviewBit:
def is_mirror(self, root1, root2):
"""Returns True if two trees are mirror of one another, False otherwise."""
<|body_0|>
def isSymmetric(self, root):
"""Returns True if binary tree is symmetric, False otherwise. Time complexity: O(n). Space com... | stack_v2_sparse_classes_36k_train_003482 | 3,032 | no_license | [
{
"docstring": "Returns True if two trees are mirror of one another, False otherwise.",
"name": "is_mirror",
"signature": "def is_mirror(self, root1, root2)"
},
{
"docstring": "Returns True if binary tree is symmetric, False otherwise. Time complexity: O(n). Space complexity: O(n), n is number o... | 2 | stack_v2_sparse_classes_30k_train_014531 | Implement the Python class `SolutionInterviewBit` described below.
Class description:
Implement the SolutionInterviewBit class.
Method signatures and docstrings:
- def is_mirror(self, root1, root2): Returns True if two trees are mirror of one another, False otherwise.
- def isSymmetric(self, root): Returns True if bi... | Implement the Python class `SolutionInterviewBit` described below.
Class description:
Implement the SolutionInterviewBit class.
Method signatures and docstrings:
- def is_mirror(self, root1, root2): Returns True if two trees are mirror of one another, False otherwise.
- def isSymmetric(self, root): Returns True if bi... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class SolutionInterviewBit:
def is_mirror(self, root1, root2):
"""Returns True if two trees are mirror of one another, False otherwise."""
<|body_0|>
def isSymmetric(self, root):
"""Returns True if binary tree is symmetric, False otherwise. Time complexity: O(n). Space com... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SolutionInterviewBit:
def is_mirror(self, root1, root2):
"""Returns True if two trees are mirror of one another, False otherwise."""
if not root1 and (not root2):
return True
if root1 and root2 and (root1.val == root2.val):
return self.is_mirror(root1.left, root... | the_stack_v2_python_sparse | Trees/symmetric_binary_tree.py | vladn90/Algorithms | train | 0 | |
17e98ef3f8d9d8ec6163df00234fb04602bc0eaf | [
"self.directory = dir\nself.times_for_files = self.modification_times()\nself.n_by_month = self.count_by_month()",
"times_for_files = {}\nfor root, dirs, files in os.walk(self.directory):\n for file in files:\n time_of_modification = os.path.getmtime(os.path.join(root, file))\n readable_time = da... | <|body_start_0|>
self.directory = dir
self.times_for_files = self.modification_times()
self.n_by_month = self.count_by_month()
<|end_body_0|>
<|body_start_1|>
times_for_files = {}
for root, dirs, files in os.walk(self.directory):
for file in files:
ti... | ModTimes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModTimes:
def __init__(self, dir):
"""inicjator klasy :param dir: (str) - ścieżka folderu do analizy"""
<|body_0|>
def modification_times(self):
"""czyta czas modyfikacji plików z directory metodą os.walk() i os.path.getmtime() :return times_for_files: (dict) - {plik... | stack_v2_sparse_classes_36k_train_003483 | 2,311 | no_license | [
{
"docstring": "inicjator klasy :param dir: (str) - ścieżka folderu do analizy",
"name": "__init__",
"signature": "def __init__(self, dir)"
},
{
"docstring": "czyta czas modyfikacji plików z directory metodą os.walk() i os.path.getmtime() :return times_for_files: (dict) - {plik (str) : rrrr-mm-d... | 4 | stack_v2_sparse_classes_30k_train_003974 | Implement the Python class `ModTimes` described below.
Class description:
Implement the ModTimes class.
Method signatures and docstrings:
- def __init__(self, dir): inicjator klasy :param dir: (str) - ścieżka folderu do analizy
- def modification_times(self): czyta czas modyfikacji plików z directory metodą os.walk()... | Implement the Python class `ModTimes` described below.
Class description:
Implement the ModTimes class.
Method signatures and docstrings:
- def __init__(self, dir): inicjator klasy :param dir: (str) - ścieżka folderu do analizy
- def modification_times(self): czyta czas modyfikacji plików z directory metodą os.walk()... | d04cff1a33d3526f1b2e412ad062baed73725ea7 | <|skeleton|>
class ModTimes:
def __init__(self, dir):
"""inicjator klasy :param dir: (str) - ścieżka folderu do analizy"""
<|body_0|>
def modification_times(self):
"""czyta czas modyfikacji plików z directory metodą os.walk() i os.path.getmtime() :return times_for_files: (dict) - {plik... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModTimes:
def __init__(self, dir):
"""inicjator klasy :param dir: (str) - ścieżka folderu do analizy"""
self.directory = dir
self.times_for_files = self.modification_times()
self.n_by_month = self.count_by_month()
def modification_times(self):
"""czyta czas modyfik... | the_stack_v2_python_sparse | Lista-2/zadanie_4.py | maciejratajski1999/listy-na-programowanie | train | 0 | |
f15df479c6a2892d19a92f4acc8c92bd9d64a399 | [
"super(PostingList, self).__init__(*arg, **kwargs)\nself.add_handlers({'+': self.move_up, '-': self.move_down})\nself.scroll_exit = True",
"lis = self.values\nif len(lis) < 2:\n return False\nnew_index = move_list_entry(lis=lis, index=self.cursor_line, direction=1)\nself.cursor_line = new_index",
"lis = self... | <|body_start_0|>
super(PostingList, self).__init__(*arg, **kwargs)
self.add_handlers({'+': self.move_up, '-': self.move_down})
self.scroll_exit = True
<|end_body_0|>
<|body_start_1|>
lis = self.values
if len(lis) < 2:
return False
new_index = move_list_entry(... | PostingList holding teh posts. | PostingList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostingList:
"""PostingList holding teh posts."""
def __init__(self, *arg, **kwargs):
"""Initialize the class."""
<|body_0|>
def move_up(self, keypress=None):
"""Move selected offer up in the list."""
<|body_1|>
def move_down(self, keypress=None):
... | stack_v2_sparse_classes_36k_train_003484 | 12,594 | no_license | [
{
"docstring": "Initialize the class.",
"name": "__init__",
"signature": "def __init__(self, *arg, **kwargs)"
},
{
"docstring": "Move selected offer up in the list.",
"name": "move_up",
"signature": "def move_up(self, keypress=None)"
},
{
"docstring": "Move selected offer down in... | 3 | stack_v2_sparse_classes_30k_train_005672 | Implement the Python class `PostingList` described below.
Class description:
PostingList holding teh posts.
Method signatures and docstrings:
- def __init__(self, *arg, **kwargs): Initialize the class.
- def move_up(self, keypress=None): Move selected offer up in the list.
- def move_down(self, keypress=None): Move s... | Implement the Python class `PostingList` described below.
Class description:
PostingList holding teh posts.
Method signatures and docstrings:
- def __init__(self, *arg, **kwargs): Initialize the class.
- def move_up(self, keypress=None): Move selected offer up in the list.
- def move_down(self, keypress=None): Move s... | a5b13c2a6191c3074e6b9b2e9c7672220b282911 | <|skeleton|>
class PostingList:
"""PostingList holding teh posts."""
def __init__(self, *arg, **kwargs):
"""Initialize the class."""
<|body_0|>
def move_up(self, keypress=None):
"""Move selected offer up in the list."""
<|body_1|>
def move_down(self, keypress=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PostingList:
"""PostingList holding teh posts."""
def __init__(self, *arg, **kwargs):
"""Initialize the class."""
super(PostingList, self).__init__(*arg, **kwargs)
self.add_handlers({'+': self.move_up, '-': self.move_down})
self.scroll_exit = True
def move_up(self, ke... | the_stack_v2_python_sparse | npy_gui/npy_transactionform.py | Tagirijus/ledger-add | train | 7 |
d34fe4525b2687ea782db2ffb487ea1db1a6e8b9 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Media File service. Service to manage media files. | MediaFileServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MediaFileServiceServicer:
"""Proto file describing the Media File service. Service to manage media files."""
def GetMediaFile(self, request, context):
"""Returns the requested media file in full detail."""
<|body_0|>
def MutateMediaFiles(self, request, context):
... | stack_v2_sparse_classes_36k_train_003485 | 5,357 | permissive | [
{
"docstring": "Returns the requested media file in full detail.",
"name": "GetMediaFile",
"signature": "def GetMediaFile(self, request, context)"
},
{
"docstring": "Creates media files. Operation statuses are returned.",
"name": "MutateMediaFiles",
"signature": "def MutateMediaFiles(sel... | 2 | null | Implement the Python class `MediaFileServiceServicer` described below.
Class description:
Proto file describing the Media File service. Service to manage media files.
Method signatures and docstrings:
- def GetMediaFile(self, request, context): Returns the requested media file in full detail.
- def MutateMediaFiles(s... | Implement the Python class `MediaFileServiceServicer` described below.
Class description:
Proto file describing the Media File service. Service to manage media files.
Method signatures and docstrings:
- def GetMediaFile(self, request, context): Returns the requested media file in full detail.
- def MutateMediaFiles(s... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class MediaFileServiceServicer:
"""Proto file describing the Media File service. Service to manage media files."""
def GetMediaFile(self, request, context):
"""Returns the requested media file in full detail."""
<|body_0|>
def MutateMediaFiles(self, request, context):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MediaFileServiceServicer:
"""Proto file describing the Media File service. Service to manage media files."""
def GetMediaFile(self, request, context):
"""Returns the requested media file in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method... | the_stack_v2_python_sparse | google/ads/google_ads/v5/proto/services/media_file_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
a41d8b96ccdfb544605222bcef69cd6cb18564cd | [
"for key in params.keys():\n if key not in SequenceType:\n raise ValueError(f'{key} is not a supported SequenceType.')\nself._params = params",
"for key, transforms in self._params.items():\n data[key] = VideoAugmentor.MAP[key](data[key], transforms)\nreturn data"
] | <|body_start_0|>
for key in params.keys():
if key not in SequenceType:
raise ValueError(f'{key} is not a supported SequenceType.')
self._params = params
<|end_body_0|>
<|body_start_1|>
for key, transforms in self._params.items():
data[key] = VideoAugmento... | Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augmented. | VideoAugmentor | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VideoAugmentor:
"""Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augm... | stack_v2_sparse_classes_36k_train_003486 | 4,197 | permissive | [
{
"docstring": "Constructor. Args: params: Raises: ValueError: If params contains an unsupported data augmentation.",
"name": "__init__",
"signature": "def __init__(self, params)"
},
{
"docstring": "Iterate and transform the data values. Currently, data augmentation is only applied to video fram... | 2 | stack_v2_sparse_classes_30k_train_002172 | Implement the Python class `VideoAugmentor` described below.
Class description:
Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. Seq... | Implement the Python class `VideoAugmentor` described below.
Class description:
Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. Seq... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class VideoAugmentor:
"""Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augm... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VideoAugmentor:
"""Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augmented."""
... | the_stack_v2_python_sparse | xirl/xirl/transforms.py | Jimmy-INL/google-research | train | 1 |
52d20d665cb4da7b0875f4c066faf29dff8c0ab3 | [
"parsed = urlparse(url)\nif parsed.scheme == '':\n _tld = tldextract.extract(url)\n _tld = f'{_tld.subdomain}.{_tld.domain}.{_tld.suffix}'\n try:\n tls_supported = tls_support[_tld]\n except KeyError:\n tls_supported = TlsTest.test_tls_supported(url)\n tls_support[_tld] = tls_suppor... | <|body_start_0|>
parsed = urlparse(url)
if parsed.scheme == '':
_tld = tldextract.extract(url)
_tld = f'{_tld.subdomain}.{_tld.domain}.{_tld.suffix}'
try:
tls_supported = tls_support[_tld]
except KeyError:
tls_supported = Tl... | A cleanup function takes one parameter and returns the "cleaned" version if an update is required, otherwise None. Cleanup functions are dispatched in the _cleanup_config dictionary. | CleanupFunctions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CleanupFunctions:
"""A cleanup function takes one parameter and returns the "cleaned" version if an update is required, otherwise None. Cleanup functions are dispatched in the _cleanup_config dictionary."""
def cleanup_url(url, tls_support):
"""Add protocols to the URI if they are mi... | stack_v2_sparse_classes_36k_train_003487 | 10,693 | permissive | [
{
"docstring": "Add protocols to the URI if they are missing, else return None.",
"name": "cleanup_url",
"signature": "def cleanup_url(url, tls_support)"
},
{
"docstring": "Delete tags because they have low accuracy or because they are in the denylist. If no change is made, return None. :return:... | 2 | null | Implement the Python class `CleanupFunctions` described below.
Class description:
A cleanup function takes one parameter and returns the "cleaned" version if an update is required, otherwise None. Cleanup functions are dispatched in the _cleanup_config dictionary.
Method signatures and docstrings:
- def cleanup_url(u... | Implement the Python class `CleanupFunctions` described below.
Class description:
A cleanup function takes one parameter and returns the "cleaned" version if an update is required, otherwise None. Cleanup functions are dispatched in the _cleanup_config dictionary.
Method signatures and docstrings:
- def cleanup_url(u... | 5fedb5e20db71bf58c09004f10f966cedb8a6e89 | <|skeleton|>
class CleanupFunctions:
"""A cleanup function takes one parameter and returns the "cleaned" version if an update is required, otherwise None. Cleanup functions are dispatched in the _cleanup_config dictionary."""
def cleanup_url(url, tls_support):
"""Add protocols to the URI if they are mi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CleanupFunctions:
"""A cleanup function takes one parameter and returns the "cleaned" version if an update is required, otherwise None. Cleanup functions are dispatched in the _cleanup_config dictionary."""
def cleanup_url(url, tls_support):
"""Add protocols to the URI if they are missing, else r... | the_stack_v2_python_sparse | ingestion_server/ingestion_server/cleanup.py | wenxuefeng3930/openverse-api | train | 1 |
5b82728ecdb8af261742df9cdf47c4237b1d2a6e | [
"assert cluster\nosh = ObjectStateHolder('mscluster')\nosh.setAttribute('data_name', cluster.name)\nmodeling.setAppSystemVendor(osh)\nif cluster.version:\n osh.setAttribute('version', cluster.version)\ndetails = cluster.details\nif details:\n if details.defaultNetworkRole:\n osh.setAttribute('defaultNe... | <|body_start_0|>
assert cluster
osh = ObjectStateHolder('mscluster')
osh.setAttribute('data_name', cluster.name)
modeling.setAppSystemVendor(osh)
if cluster.version:
osh.setAttribute('version', cluster.version)
details = cluster.details
if details:
... | Builder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Builder:
def buildCluster(self, cluster):
"""@types: Cluster -> ObjectStateHolder"""
<|body_0|>
def buildClusterPdo(self, pdo):
"""@types: Builder.Pdo -> ObjectStateHolder"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
assert cluster
osh = ... | stack_v2_sparse_classes_36k_train_003488 | 15,554 | no_license | [
{
"docstring": "@types: Cluster -> ObjectStateHolder",
"name": "buildCluster",
"signature": "def buildCluster(self, cluster)"
},
{
"docstring": "@types: Builder.Pdo -> ObjectStateHolder",
"name": "buildClusterPdo",
"signature": "def buildClusterPdo(self, pdo)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004064 | Implement the Python class `Builder` described below.
Class description:
Implement the Builder class.
Method signatures and docstrings:
- def buildCluster(self, cluster): @types: Cluster -> ObjectStateHolder
- def buildClusterPdo(self, pdo): @types: Builder.Pdo -> ObjectStateHolder | Implement the Python class `Builder` described below.
Class description:
Implement the Builder class.
Method signatures and docstrings:
- def buildCluster(self, cluster): @types: Cluster -> ObjectStateHolder
- def buildClusterPdo(self, pdo): @types: Builder.Pdo -> ObjectStateHolder
<|skeleton|>
class Builder:
d... | c431e809e8d0f82e1bca7e3429dd0245560b5680 | <|skeleton|>
class Builder:
def buildCluster(self, cluster):
"""@types: Cluster -> ObjectStateHolder"""
<|body_0|>
def buildClusterPdo(self, pdo):
"""@types: Builder.Pdo -> ObjectStateHolder"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Builder:
def buildCluster(self, cluster):
"""@types: Cluster -> ObjectStateHolder"""
assert cluster
osh = ObjectStateHolder('mscluster')
osh.setAttribute('data_name', cluster.name)
modeling.setAppSystemVendor(osh)
if cluster.version:
osh.setAttribute... | the_stack_v2_python_sparse | reference/ucmdb/discovery/ms_cluster.py | madmonkyang/cda-record | train | 0 | |
08a41435bf1c3a01fbba4b4e721bfa5725e5ae9b | [
"self.url = '/api/auth/signup/'\nself.request_content_type = 'application/json'\nself.client = Client()\nself.data = {'username': 'exampler', 'email': 'example@text.com', 'password': '1234567890', 'confirm_password': '1234567890'}",
"self.data['password'] = ''\nresponse = self.client.post(self.url, self.data, con... | <|body_start_0|>
self.url = '/api/auth/signup/'
self.request_content_type = 'application/json'
self.client = Client()
self.data = {'username': 'exampler', 'email': 'example@text.com', 'password': '1234567890', 'confirm_password': '1234567890'}
<|end_body_0|>
<|body_start_1|>
sel... | TestSignUp | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSignUp:
def setUp(self):
"""Tests setups"""
<|body_0|>
def test_sign_up_bad_request(self):
"""Test to call status 400"""
<|body_1|>
def test_sign_up_ok(self):
"""Test to call status 200. New user created"""
<|body_2|>
def test_si... | stack_v2_sparse_classes_36k_train_003489 | 3,401 | no_license | [
{
"docstring": "Tests setups",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test to call status 400",
"name": "test_sign_up_bad_request",
"signature": "def test_sign_up_bad_request(self)"
},
{
"docstring": "Test to call status 200. New user created",
"na... | 4 | stack_v2_sparse_classes_30k_train_005084 | Implement the Python class `TestSignUp` described below.
Class description:
Implement the TestSignUp class.
Method signatures and docstrings:
- def setUp(self): Tests setups
- def test_sign_up_bad_request(self): Test to call status 400
- def test_sign_up_ok(self): Test to call status 200. New user created
- def test_... | Implement the Python class `TestSignUp` described below.
Class description:
Implement the TestSignUp class.
Method signatures and docstrings:
- def setUp(self): Tests setups
- def test_sign_up_bad_request(self): Test to call status 400
- def test_sign_up_ok(self): Test to call status 200. New user created
- def test_... | a93e0eee39e1f45fa73de84514ca254e235a17bd | <|skeleton|>
class TestSignUp:
def setUp(self):
"""Tests setups"""
<|body_0|>
def test_sign_up_bad_request(self):
"""Test to call status 400"""
<|body_1|>
def test_sign_up_ok(self):
"""Test to call status 200. New user created"""
<|body_2|>
def test_si... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSignUp:
def setUp(self):
"""Tests setups"""
self.url = '/api/auth/signup/'
self.request_content_type = 'application/json'
self.client = Client()
self.data = {'username': 'exampler', 'email': 'example@text.com', 'password': '1234567890', 'confirm_password': '12345678... | the_stack_v2_python_sparse | cashapp_tests/server/auth/test_api_controllers.py | dmitryshepelev/cashapp | train | 0 | |
5c2665991f1c6144cdf761f8368d2a5989c39c99 | [
"intervals.sort(key=lambda x: x.start)\nans = []\nfor i in range(len(intervals)):\n if ans == []:\n ans.append(intervals[i])\n else:\n currlen = len(ans)\n if ans[currlen - 1].start <= intervals[i].start <= ans[currlen - 1].end:\n ans[currlen - 1].end = max(ans[currlen - 1].end... | <|body_start_0|>
intervals.sort(key=lambda x: x.start)
ans = []
for i in range(len(intervals)):
if ans == []:
ans.append(intervals[i])
else:
currlen = len(ans)
if ans[currlen - 1].start <= intervals[i].start <= ans[currlen -... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge(self, intervals):
""":type intervals: List[Interval] :rtype: List[Interval]"""
<|body_0|>
def merge_no_class(self, intervals, newInterval):
""":type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]"""
<|body_1|>... | stack_v2_sparse_classes_36k_train_003490 | 1,941 | no_license | [
{
"docstring": ":type intervals: List[Interval] :rtype: List[Interval]",
"name": "merge",
"signature": "def merge(self, intervals)"
},
{
"docstring": ":type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]",
"name": "merge_no_class",
"signature": "def merge_no... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval]
- def merge_no_class(self, intervals, newInterval): :type intervals: List[Interval] :type newIn... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval]
- def merge_no_class(self, intervals, newInterval): :type intervals: List[Interval] :type newIn... | 2d5fa4cd696d5035ea8859befeadc5cc436959c9 | <|skeleton|>
class Solution:
def merge(self, intervals):
""":type intervals: List[Interval] :rtype: List[Interval]"""
<|body_0|>
def merge_no_class(self, intervals, newInterval):
""":type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]"""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def merge(self, intervals):
""":type intervals: List[Interval] :rtype: List[Interval]"""
intervals.sort(key=lambda x: x.start)
ans = []
for i in range(len(intervals)):
if ans == []:
ans.append(intervals[i])
else:
... | the_stack_v2_python_sparse | SourceCode/Python/Problem/00056.Merge Intervals.py | roger6blog/LeetCode | train | 0 | |
23c5bd12875d9ac2ebcadcfa244d8a59e886092e | [
"dt = self.qd.get('downloadtype', '')\nif dt != None and dt != '':\n self.dtype = dt",
"lData = []\nsData = ''\noErr = ErrHandle()\ntry:\n if dtype == 'json':\n sData = self.obj.data\n elif dtype == 'hist-svg':\n pass\n elif dtype == 'hist-png':\n pass\n elif dtype == 'ps':\n ... | <|body_start_0|>
dt = self.qd.get('downloadtype', '')
if dt != None and dt != '':
self.dtype = dt
<|end_body_0|>
<|body_start_1|>
lData = []
sData = ''
oErr = ErrHandle()
try:
if dtype == 'json':
sData = self.obj.data
e... | Generic treatment of Visualization downloads for SSGs | StemmaDownload | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StemmaDownload:
"""Generic treatment of Visualization downloads for SSGs"""
def custom_init(self):
"""Calculate stuff"""
<|body_0|>
def get_data(self, prefix, dtype, response=None):
"""Gather the data as CSV, including a header line and comma-separated"""
... | stack_v2_sparse_classes_36k_train_003491 | 34,230 | permissive | [
{
"docstring": "Calculate stuff",
"name": "custom_init",
"signature": "def custom_init(self)"
},
{
"docstring": "Gather the data as CSV, including a header line and comma-separated",
"name": "get_data",
"signature": "def get_data(self, prefix, dtype, response=None)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000998 | Implement the Python class `StemmaDownload` described below.
Class description:
Generic treatment of Visualization downloads for SSGs
Method signatures and docstrings:
- def custom_init(self): Calculate stuff
- def get_data(self, prefix, dtype, response=None): Gather the data as CSV, including a header line and comma... | Implement the Python class `StemmaDownload` described below.
Class description:
Generic treatment of Visualization downloads for SSGs
Method signatures and docstrings:
- def custom_init(self): Calculate stuff
- def get_data(self, prefix, dtype, response=None): Gather the data as CSV, including a header line and comma... | 921fb5ec3f5b40b169bd3f65417580878365ccab | <|skeleton|>
class StemmaDownload:
"""Generic treatment of Visualization downloads for SSGs"""
def custom_init(self):
"""Calculate stuff"""
<|body_0|>
def get_data(self, prefix, dtype, response=None):
"""Gather the data as CSV, including a header line and comma-separated"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StemmaDownload:
"""Generic treatment of Visualization downloads for SSGs"""
def custom_init(self):
"""Calculate stuff"""
dt = self.qd.get('downloadtype', '')
if dt != None and dt != '':
self.dtype = dt
def get_data(self, prefix, dtype, response=None):
"""G... | the_stack_v2_python_sparse | passim/passim/stemma/views.py | ErwinKomen/RU-passim | train | 0 |
a1fff8fc17bb72491be6d189cfc5ff8610bec0b7 | [
"self.val = None\nself.prev = None\nself.next = None",
"if index == 0:\n if self.val != None:\n return self.val\n else:\n return -1\nif self.next:\n return self.next.get(index - 1)\nelse:\n return -1",
"new = MyLinkedList()\nnew.val = self.val\nnew.prev = self\nnew.next = self.next\nif... | <|body_start_0|>
self.val = None
self.prev = None
self.next = None
<|end_body_0|>
<|body_start_1|>
if index == 0:
if self.val != None:
return self.val
else:
return -1
if self.next:
return self.next.get(index - 1... | MyLinkedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
<|body_1|>
def addAtHead(self, val:... | stack_v2_sparse_classes_36k_train_003492 | 4,061 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get the value of the index-th node in the linked list. If the index is invalid, return -1.",
"name": "get",
"signature": "def get(self, index: int) -> int"
},... | 6 | stack_v2_sparse_classes_30k_train_011202 | Implement the Python class `MyLinkedList` described below.
Class description:
Implement the MyLinkedList class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali... | Implement the Python class `MyLinkedList` described below.
Class description:
Implement the MyLinkedList class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali... | 4bf1a7814b5c76e11242e7933e09c59ede3284a3 | <|skeleton|>
class MyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
<|body_1|>
def addAtHead(self, val:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
self.val = None
self.prev = None
self.next = None
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
... | the_stack_v2_python_sparse | Explore/Linked List/Singly Linked List/0707_Design_Linked_List.py | actcheng/leetcode-solutions | train | 2 | |
ad3e822a848fb09cb289c5f4a5df3359ac7a962e | [
"if self.request.method == 'GET':\n return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity())\nreturn tuple()",
"queryset = self.get_queryset()\nqueryset = filter_queryset_permission(queryset, request, self.get_permissions())\ntry:\n query = request.query_params.get('user')\n if query is not None:\n... | <|body_start_0|>
if self.request.method == 'GET':
return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity())
return tuple()
<|end_body_0|>
<|body_start_1|>
queryset = self.get_queryset()
queryset = filter_queryset_permission(queryset, request, self.get_permissions())
... | Membership log view set | MembershipLogViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MembershipLogViewSet:
"""Membership log view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def list(self, request, *args, **kwargs):
"""List membership logs"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.request.met... | stack_v2_sparse_classes_36k_train_003493 | 27,778 | permissive | [
{
"docstring": "Get permissions",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "List membership logs",
"name": "list",
"signature": "def list(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009205 | Implement the Python class `MembershipLogViewSet` described below.
Class description:
Membership log view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def list(self, request, *args, **kwargs): List membership logs | Implement the Python class `MembershipLogViewSet` described below.
Class description:
Membership log view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def list(self, request, *args, **kwargs): List membership logs
<|skeleton|>
class MembershipLogViewSet:
"""Membership log ... | cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8 | <|skeleton|>
class MembershipLogViewSet:
"""Membership log view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def list(self, request, *args, **kwargs):
"""List membership logs"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MembershipLogViewSet:
"""Membership log view set"""
def get_permissions(self):
"""Get permissions"""
if self.request.method == 'GET':
return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity())
return tuple()
def list(self, request, *args, **kwargs):
""... | the_stack_v2_python_sparse | membership/views.py | 810Teams/clubs-and-events-backend | train | 3 |
28214f4f210989418f9c7ac1507b0edb367ecdb1 | [
"if HAS_ISBD and ISelectableBrowserDefault.providedBy(target):\n return target.getLayout()\nelse:\n view = target.getTypeInfo().getActionById('view') or 'base_view'\n if view == 'view':\n view = target.portal_type.lower() + '_view'\n return view",
"data = [HelpCenterReferenceManualPage.Searchab... | <|body_start_0|>
if HAS_ISBD and ISelectableBrowserDefault.providedBy(target):
return target.getLayout()
else:
view = target.getTypeInfo().getActionById('view') or 'base_view'
if view == 'view':
view = target.portal_type.lower() + '_view'
r... | A tutorial containing TutorialPages, Files and Images. | BungeniHelpCenterReferenceManualPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BungeniHelpCenterReferenceManualPage:
"""A tutorial containing TutorialPages, Files and Images."""
def getTargetObjectLayout(self, target):
"""Returns target object 'view' action page template"""
<|body_0|>
def SearchableText(self):
"""Append references' searchab... | stack_v2_sparse_classes_36k_train_003494 | 34,826 | no_license | [
{
"docstring": "Returns target object 'view' action page template",
"name": "getTargetObjectLayout",
"signature": "def getTargetObjectLayout(self, target)"
},
{
"docstring": "Append references' searchable fields.",
"name": "SearchableText",
"signature": "def SearchableText(self)"
}
] | 2 | null | Implement the Python class `BungeniHelpCenterReferenceManualPage` described below.
Class description:
A tutorial containing TutorialPages, Files and Images.
Method signatures and docstrings:
- def getTargetObjectLayout(self, target): Returns target object 'view' action page template
- def SearchableText(self): Append... | Implement the Python class `BungeniHelpCenterReferenceManualPage` described below.
Class description:
A tutorial containing TutorialPages, Files and Images.
Method signatures and docstrings:
- def getTargetObjectLayout(self, target): Returns target object 'view' action page template
- def SearchableText(self): Append... | 5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d | <|skeleton|>
class BungeniHelpCenterReferenceManualPage:
"""A tutorial containing TutorialPages, Files and Images."""
def getTargetObjectLayout(self, target):
"""Returns target object 'view' action page template"""
<|body_0|>
def SearchableText(self):
"""Append references' searchab... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BungeniHelpCenterReferenceManualPage:
"""A tutorial containing TutorialPages, Files and Images."""
def getTargetObjectLayout(self, target):
"""Returns target object 'view' action page template"""
if HAS_ISBD and ISelectableBrowserDefault.providedBy(target):
return target.getLa... | the_stack_v2_python_sparse | plone.products/BungeniHelpCenter/branches/plone4/content/HelpCenter.py | malangalanga/bungeni-portal | train | 0 |
42bc1ee512dfb512abafd9824941588e1facd443 | [
"index_df = self.evaluate_by_index(y_true, y_pred, multioutput)\nout_df = pd.DataFrame(index_df.mean(axis=0)).T\nout_df.columns = index_df.columns\nif multioutput == 'uniform_average':\n out_df = _coerce_to_scalar(out_df)\nreturn out_df",
"multivariate = self.multivariate\ny_true = convert_to(y_true, to_type=P... | <|body_start_0|>
index_df = self.evaluate_by_index(y_true, y_pred, multioutput)
out_df = pd.DataFrame(index_df.mean(axis=0)).T
out_df.columns = index_df.columns
if multioutput == 'uniform_average':
out_df = _coerce_to_scalar(out_df)
return out_df
<|end_body_0|>
<|bod... | Intermediate base class for distributional prediction metrics/scores. Developer note: Experimental and overrides public methods of _BaseProbaForecastingErrorMetric. This should be refactored into one base class. | _BaseDistrForecastingMetric | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _BaseDistrForecastingMetric:
"""Intermediate base class for distributional prediction metrics/scores. Developer note: Experimental and overrides public methods of _BaseProbaForecastingErrorMetric. This should be refactored into one base class."""
def evaluate(self, y_true, y_pred, multioutpu... | stack_v2_sparse_classes_36k_train_003495 | 35,057 | permissive | [
{
"docstring": "Evaluate the desired metric on given inputs. Parameters ---------- y_true : pd.Series, pd.DataFrame or np.array of shape (fh,) or (fh, n_outputs) where fh is the forecasting horizon Ground truth (correct) target values. y_pred : return object of probabilistic predictition method scitype:y_pred m... | 2 | null | Implement the Python class `_BaseDistrForecastingMetric` described below.
Class description:
Intermediate base class for distributional prediction metrics/scores. Developer note: Experimental and overrides public methods of _BaseProbaForecastingErrorMetric. This should be refactored into one base class.
Method signat... | Implement the Python class `_BaseDistrForecastingMetric` described below.
Class description:
Intermediate base class for distributional prediction metrics/scores. Developer note: Experimental and overrides public methods of _BaseProbaForecastingErrorMetric. This should be refactored into one base class.
Method signat... | 70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f | <|skeleton|>
class _BaseDistrForecastingMetric:
"""Intermediate base class for distributional prediction metrics/scores. Developer note: Experimental and overrides public methods of _BaseProbaForecastingErrorMetric. This should be refactored into one base class."""
def evaluate(self, y_true, y_pred, multioutpu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _BaseDistrForecastingMetric:
"""Intermediate base class for distributional prediction metrics/scores. Developer note: Experimental and overrides public methods of _BaseProbaForecastingErrorMetric. This should be refactored into one base class."""
def evaluate(self, y_true, y_pred, multioutput=None, **kwa... | the_stack_v2_python_sparse | sktime/performance_metrics/forecasting/probabilistic/_classes.py | sktime/sktime | train | 1,117 |
86606bc769437f84b37de8eb1be2a52e0111826a | [
"for key in inparsers:\n if not key.startswith('text search parser '):\n raise KeyError('Unrecognized object type: %s' % key)\n tsp = key[19:]\n self[schema.name, tsp] = parser = TSParser(schema=schema.name, name=tsp)\n inparser = inparsers[key]\n if inparser:\n for attr, val in list(in... | <|body_start_0|>
for key in inparsers:
if not key.startswith('text search parser '):
raise KeyError('Unrecognized object type: %s' % key)
tsp = key[19:]
self[schema.name, tsp] = parser = TSParser(schema=schema.name, name=tsp)
inparser = inparsers[k... | The collection of text search parsers in a database | TSParserDict | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TSParserDict:
"""The collection of text search parsers in a database"""
def from_map(self, schema, inparsers):
"""Initialize the dictionary of parsers by examining the input map :param schema: schema owning the parsers :param inparsers: input YAML map defining the parsers"""
... | stack_v2_sparse_classes_36k_train_003496 | 15,925 | permissive | [
{
"docstring": "Initialize the dictionary of parsers by examining the input map :param schema: schema owning the parsers :param inparsers: input YAML map defining the parsers",
"name": "from_map",
"signature": "def from_map(self, schema, inparsers)"
},
{
"docstring": "Generate SQL to transform e... | 2 | stack_v2_sparse_classes_30k_train_006598 | Implement the Python class `TSParserDict` described below.
Class description:
The collection of text search parsers in a database
Method signatures and docstrings:
- def from_map(self, schema, inparsers): Initialize the dictionary of parsers by examining the input map :param schema: schema owning the parsers :param i... | Implement the Python class `TSParserDict` described below.
Class description:
The collection of text search parsers in a database
Method signatures and docstrings:
- def from_map(self, schema, inparsers): Initialize the dictionary of parsers by examining the input map :param schema: schema owning the parsers :param i... | 0133f3bc522890e0564d27de6791824acb4d2773 | <|skeleton|>
class TSParserDict:
"""The collection of text search parsers in a database"""
def from_map(self, schema, inparsers):
"""Initialize the dictionary of parsers by examining the input map :param schema: schema owning the parsers :param inparsers: input YAML map defining the parsers"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TSParserDict:
"""The collection of text search parsers in a database"""
def from_map(self, schema, inparsers):
"""Initialize the dictionary of parsers by examining the input map :param schema: schema owning the parsers :param inparsers: input YAML map defining the parsers"""
for key in in... | the_stack_v2_python_sparse | pyrseas/dbobject/textsearch.py | vayerx/Pyrseas | train | 1 |
7cc296ad15e082c0c1620cdcf92e8ae3f2d4c54c | [
"if self.onOffset(date):\n return date\nelse:\n return date + QuarterEnd(month=self.month)",
"if self.onOffset(date):\n return date\nelse:\n return date - QuarterEnd(month=self.month)"
] | <|body_start_0|>
if self.onOffset(date):
return date
else:
return date + QuarterEnd(month=self.month)
<|end_body_0|>
<|body_start_1|>
if self.onOffset(date):
return date
else:
return date - QuarterEnd(month=self.month)
<|end_body_1|>
| QuarterEnd | [
"BSD-3-Clause",
"CC-BY-4.0",
"Apache-2.0",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuarterEnd:
def rollforward(self, date):
"""Roll date forward to nearest end of quarter"""
<|body_0|>
def rollback(self, date):
"""Roll date backward to nearest end of quarter"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.onOffset(date):
... | stack_v2_sparse_classes_36k_train_003497 | 47,274 | permissive | [
{
"docstring": "Roll date forward to nearest end of quarter",
"name": "rollforward",
"signature": "def rollforward(self, date)"
},
{
"docstring": "Roll date backward to nearest end of quarter",
"name": "rollback",
"signature": "def rollback(self, date)"
}
] | 2 | null | Implement the Python class `QuarterEnd` described below.
Class description:
Implement the QuarterEnd class.
Method signatures and docstrings:
- def rollforward(self, date): Roll date forward to nearest end of quarter
- def rollback(self, date): Roll date backward to nearest end of quarter | Implement the Python class `QuarterEnd` described below.
Class description:
Implement the QuarterEnd class.
Method signatures and docstrings:
- def rollforward(self, date): Roll date forward to nearest end of quarter
- def rollback(self, date): Roll date backward to nearest end of quarter
<|skeleton|>
class QuarterE... | dd09bddc62d701721565bbed3731e9586ea306d0 | <|skeleton|>
class QuarterEnd:
def rollforward(self, date):
"""Roll date forward to nearest end of quarter"""
<|body_0|>
def rollback(self, date):
"""Roll date backward to nearest end of quarter"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuarterEnd:
def rollforward(self, date):
"""Roll date forward to nearest end of quarter"""
if self.onOffset(date):
return date
else:
return date + QuarterEnd(month=self.month)
def rollback(self, date):
"""Roll date backward to nearest end of quarter... | the_stack_v2_python_sparse | xarray/coding/cftime_offsets.py | pydata/xarray | train | 2,916 | |
0b44e2a90da5efd8fdae4d38c0488cadbec007b0 | [
"channel = self.query('SOURce:SEL?')\nif channel:\n return int(channel)\nelse:\n raise InstrIOError",
"self.write('SOURce:SEL {}'.format(channel))\nresult = int(self.query('SOURce:SEL?'))\nif result and channel != result:\n msg = 'Instrument could not select channel {}'\n raise InstrIOError(msg.format... | <|body_start_0|>
channel = self.query('SOURce:SEL?')
if channel:
return int(channel)
else:
raise InstrIOError
<|end_body_0|>
<|body_start_1|>
self.write('SOURce:SEL {}'.format(channel))
result = int(self.query('SOURce:SEL?'))
if result and channel... | Generic driver for multi-channel Anapico Signal Generators, using the VISA library. Parameters ---------- see the `VisaInstrument` parameters Attributes ---------- channel: int Channel currently selected frequency_unit : str Frequency unit used by the driver. The default unit is 'GHz'. Other valid units are : 'MHz', 'K... | AnapicoMulti | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnapicoMulti:
"""Generic driver for multi-channel Anapico Signal Generators, using the VISA library. Parameters ---------- see the `VisaInstrument` parameters Attributes ---------- channel: int Channel currently selected frequency_unit : str Frequency unit used by the driver. The default unit is ... | stack_v2_sparse_classes_36k_train_003498 | 8,574 | permissive | [
{
"docstring": "Currently selected channel",
"name": "channel",
"signature": "def channel(self)"
},
{
"docstring": "Current channel setter method",
"name": "channel",
"signature": "def channel(self, channel)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012961 | Implement the Python class `AnapicoMulti` described below.
Class description:
Generic driver for multi-channel Anapico Signal Generators, using the VISA library. Parameters ---------- see the `VisaInstrument` parameters Attributes ---------- channel: int Channel currently selected frequency_unit : str Frequency unit u... | Implement the Python class `AnapicoMulti` described below.
Class description:
Generic driver for multi-channel Anapico Signal Generators, using the VISA library. Parameters ---------- see the `VisaInstrument` parameters Attributes ---------- channel: int Channel currently selected frequency_unit : str Frequency unit u... | b6f1f5b236c7a4e28d9a3bc8da9820c52d789309 | <|skeleton|>
class AnapicoMulti:
"""Generic driver for multi-channel Anapico Signal Generators, using the VISA library. Parameters ---------- see the `VisaInstrument` parameters Attributes ---------- channel: int Channel currently selected frequency_unit : str Frequency unit used by the driver. The default unit is ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnapicoMulti:
"""Generic driver for multi-channel Anapico Signal Generators, using the VISA library. Parameters ---------- see the `VisaInstrument` parameters Attributes ---------- channel: int Channel currently selected frequency_unit : str Frequency unit used by the driver. The default unit is 'GHz'. Other ... | the_stack_v2_python_sparse | exopy_hqc_legacy/instruments/drivers/visa/anapico.py | Exopy/exopy_hqc_legacy | train | 0 |
6c9ed91e08f8772267418c94e7d53d9a2e05d03e | [
"parser = argparse.ArgumentParser()\nparser.add_argument('input', type=Path, nargs='?', help='Input PDF')\nparser.add_argument('output', type=Path, nargs='?', help='Output PDF')\nparser.add_argument('-f', '--first-page', type=int, help='First page')\nparser.add_argument('-l', '--last-page', type=int, help='Last pag... | <|body_start_0|>
parser = argparse.ArgumentParser()
parser.add_argument('input', type=Path, nargs='?', help='Input PDF')
parser.add_argument('output', type=Path, nargs='?', help='Output PDF')
parser.add_argument('-f', '--first-page', type=int, help='First page')
parser.add_argume... | Crop PDF even more | CropMore | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CropMore:
"""Crop PDF even more"""
def parse_args(self):
"""Command-line arguments"""
<|body_0|>
def main(self):
"""Do it"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
parser = argparse.ArgumentParser()
parser.add_argument('input', typ... | stack_v2_sparse_classes_36k_train_003499 | 3,647 | permissive | [
{
"docstring": "Command-line arguments",
"name": "parse_args",
"signature": "def parse_args(self)"
},
{
"docstring": "Do it",
"name": "main",
"signature": "def main(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008439 | Implement the Python class `CropMore` described below.
Class description:
Crop PDF even more
Method signatures and docstrings:
- def parse_args(self): Command-line arguments
- def main(self): Do it | Implement the Python class `CropMore` described below.
Class description:
Crop PDF even more
Method signatures and docstrings:
- def parse_args(self): Command-line arguments
- def main(self): Do it
<|skeleton|>
class CropMore:
"""Crop PDF even more"""
def parse_args(self):
"""Command-line arguments"... | ff1a9e00e3c07e0a23638a5d7676dac849f259d3 | <|skeleton|>
class CropMore:
"""Crop PDF even more"""
def parse_args(self):
"""Command-line arguments"""
<|body_0|>
def main(self):
"""Do it"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CropMore:
"""Crop PDF even more"""
def parse_args(self):
"""Command-line arguments"""
parser = argparse.ArgumentParser()
parser.add_argument('input', type=Path, nargs='?', help='Input PDF')
parser.add_argument('output', type=Path, nargs='?', help='Output PDF')
pars... | the_stack_v2_python_sparse | attic/cropmore.py | ErezVolk/evstuff | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.