blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2de2527395f849e7b1bd3459b8ff611bb6f626d9 | [
"super(SelfAttention, self).__init__()\nself.W = tf.keras.layers.Dense(units)\nself.U = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)",
"exp_s_prev = tf.expand_dims(s_prev, axis=1)\nscore = self.V(tf.nn.tanh(self.W(exp_s_prev) + self.U(hidden_states)))\nweights = tf.nn.softmax(score, axis=1)\nco... | <|body_start_0|>
super(SelfAttention, self).__init__()
self.W = tf.keras.layers.Dense(units)
self.U = tf.keras.layers.Dense(units)
self.V = tf.keras.layers.Dense(1)
<|end_body_0|>
<|body_start_1|>
exp_s_prev = tf.expand_dims(s_prev, axis=1)
score = self.V(tf.nn.tanh(self... | Self attention class | SelfAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttention:
"""Self attention class"""
def __init__(self, units):
"""Class constructor. Args: units (int): the number of hidden units in the alignment model."""
<|body_0|>
def call(self, s_prev, hidden_states):
"""Args: s_prev (tensor): of shape (batch, units)... | stack_v2_sparse_classes_75kplus_train_067900 | 1,429 | no_license | [
{
"docstring": "Class constructor. Args: units (int): the number of hidden units in the alignment model.",
"name": "__init__",
"signature": "def __init__(self, units)"
},
{
"docstring": "Args: s_prev (tensor): of shape (batch, units) containing the previous decoder hidden state. hidden_states (t... | 2 | stack_v2_sparse_classes_30k_train_033150 | Implement the Python class `SelfAttention` described below.
Class description:
Self attention class
Method signatures and docstrings:
- def __init__(self, units): Class constructor. Args: units (int): the number of hidden units in the alignment model.
- def call(self, s_prev, hidden_states): Args: s_prev (tensor): of... | Implement the Python class `SelfAttention` described below.
Class description:
Self attention class
Method signatures and docstrings:
- def __init__(self, units): Class constructor. Args: units (int): the number of hidden units in the alignment model.
- def call(self, s_prev, hidden_states): Args: s_prev (tensor): of... | 5aff923277cfe9f2b5324a773e4e5c3cac810a0c | <|skeleton|>
class SelfAttention:
"""Self attention class"""
def __init__(self, units):
"""Class constructor. Args: units (int): the number of hidden units in the alignment model."""
<|body_0|>
def call(self, s_prev, hidden_states):
"""Args: s_prev (tensor): of shape (batch, units)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SelfAttention:
"""Self attention class"""
def __init__(self, units):
"""Class constructor. Args: units (int): the number of hidden units in the alignment model."""
super(SelfAttention, self).__init__()
self.W = tf.keras.layers.Dense(units)
self.U = tf.keras.layers.Dense(un... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/1-self_attention.py | cmmolanos1/holbertonschool-machine_learning | train | 1 |
e636e01b750750aebccaf7cb07284e4e4ebe25d5 | [
"self.id = str(uuid4())\nself.created_at = datetime.utcnow()\nself.updated_at = datetime.utcnow()",
"from models import db_session\nquery = db_session.query(cls).order_by(cls.created_at).all()\nreturn query",
"from models import db_session\nquery = db_session.query(cls).count()\nreturn query",
"from models im... | <|body_start_0|>
self.id = str(uuid4())
self.created_at = datetime.utcnow()
self.updated_at = datetime.utcnow()
<|end_body_0|>
<|body_start_1|>
from models import db_session
query = db_session.query(cls).order_by(cls.created_at).all()
return query
<|end_body_1|>
<|body_... | This is a BaseModel class | BaseModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseModel:
"""This is a BaseModel class"""
def __init__(self):
"""Initializes the BaseModel with id, created_at, updated_at"""
<|body_0|>
def all(cls):
"""Returns all instances of the cls from the database"""
<|body_1|>
def count(cls):
"""Ret... | stack_v2_sparse_classes_75kplus_train_067901 | 2,185 | no_license | [
{
"docstring": "Initializes the BaseModel with id, created_at, updated_at",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Returns all instances of the cls from the database",
"name": "all",
"signature": "def all(cls)"
},
{
"docstring": "Returns allthe n... | 6 | stack_v2_sparse_classes_30k_train_003030 | Implement the Python class `BaseModel` described below.
Class description:
This is a BaseModel class
Method signatures and docstrings:
- def __init__(self): Initializes the BaseModel with id, created_at, updated_at
- def all(cls): Returns all instances of the cls from the database
- def count(cls): Returns allthe num... | Implement the Python class `BaseModel` described below.
Class description:
This is a BaseModel class
Method signatures and docstrings:
- def __init__(self): Initializes the BaseModel with id, created_at, updated_at
- def all(cls): Returns all instances of the cls from the database
- def count(cls): Returns allthe num... | 12bb809688ebc19a9d7915e3cd1acbace678cd89 | <|skeleton|>
class BaseModel:
"""This is a BaseModel class"""
def __init__(self):
"""Initializes the BaseModel with id, created_at, updated_at"""
<|body_0|>
def all(cls):
"""Returns all instances of the cls from the database"""
<|body_1|>
def count(cls):
"""Ret... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseModel:
"""This is a BaseModel class"""
def __init__(self):
"""Initializes the BaseModel with id, created_at, updated_at"""
self.id = str(uuid4())
self.created_at = datetime.utcnow()
self.updated_at = datetime.utcnow()
def all(cls):
"""Returns all instances... | the_stack_v2_python_sparse | 0x03-restful_api_users/models/base_model.py | SravanthiSinha/holbertonschool-webstack_back_end | train | 1 |
f21f96b886b9d3e88b5208f2e85d54038f77a5aa | [
"for filename in glob.glob(USERVAR_GLOB):\n if filename in EXCLUDES:\n continue\n try:\n with open(filename, 'r') as f:\n data = yaml.load(f.read())\n if isinstance(data, dict):\n yield data\n except Exception:\n pass",
"for ex in EXCLUDES_CONTAIN... | <|body_start_0|>
for filename in glob.glob(USERVAR_GLOB):
if filename in EXCLUDES:
continue
try:
with open(filename, 'r') as f:
data = yaml.load(f.read())
if isinstance(data, dict):
yield data... | ActionModule | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionModule:
def iter_uservar_files(self):
"""Iterate over all user variable files."""
<|body_0|>
def filter_contains(self, key):
"""Filter keys containing exludes. :param key: Name of the key :type key: str :returns: True for keep, false otherwise :rtype: bool"""
... | stack_v2_sparse_classes_75kplus_train_067902 | 3,175 | permissive | [
{
"docstring": "Iterate over all user variable files.",
"name": "iter_uservar_files",
"signature": "def iter_uservar_files(self)"
},
{
"docstring": "Filter keys containing exludes. :param key: Name of the key :type key: str :returns: True for keep, false otherwise :rtype: bool",
"name": "fil... | 6 | stack_v2_sparse_classes_30k_train_025146 | Implement the Python class `ActionModule` described below.
Class description:
Implement the ActionModule class.
Method signatures and docstrings:
- def iter_uservar_files(self): Iterate over all user variable files.
- def filter_contains(self, key): Filter keys containing exludes. :param key: Name of the key :type ke... | Implement the Python class `ActionModule` described below.
Class description:
Implement the ActionModule class.
Method signatures and docstrings:
- def iter_uservar_files(self): Iterate over all user variable files.
- def filter_contains(self, key): Filter keys containing exludes. :param key: Name of the key :type ke... | aaab76706c8268d3ff3e87c275baee9dd4714314 | <|skeleton|>
class ActionModule:
def iter_uservar_files(self):
"""Iterate over all user variable files."""
<|body_0|>
def filter_contains(self, key):
"""Filter keys containing exludes. :param key: Name of the key :type key: str :returns: True for keep, false otherwise :rtype: bool"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ActionModule:
def iter_uservar_files(self):
"""Iterate over all user variable files."""
for filename in glob.glob(USERVAR_GLOB):
if filename in EXCLUDES:
continue
try:
with open(filename, 'r') as f:
data = yaml.load(f.... | the_stack_v2_python_sparse | collection/action_plugins/uservars_snitch.py | rcbops/FleetDeploymentReporting | train | 1 | |
6451bfd1032ed71f60c4806b847ec5462c0ddcb4 | [
"\"\"\"\n Recall \"count smaller number after self\" where we encountered the problem\n\n count[i] = count of nums[j] - nums[i] < 0 with j > i\n \n Here, after we preprocessed the array, we need to solve the problem\n\n count[i] = count of a <= S[j] - S[i] <= b with j > i\n ... | <|body_start_0|>
"""
Recall "count smaller number after self" where we encountered the problem
count[i] = count of nums[j] - nums[i] < 0 with j > i
Here, after we preprocessed the array, we need to solve the problem
count[i] = count of a <= S[j]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countRangeSum(self, nums, lower, upper):
""":type nums: List[int] :type lower: int :type upper: int :rtype: int"""
<|body_0|>
def countRangeSumBIT(self, nums, lower, upper):
""":type nums: List[int] :type lower: int :type upper: int :rtype: int"""
... | stack_v2_sparse_classes_75kplus_train_067903 | 3,778 | no_license | [
{
"docstring": ":type nums: List[int] :type lower: int :type upper: int :rtype: int",
"name": "countRangeSum",
"signature": "def countRangeSum(self, nums, lower, upper)"
},
{
"docstring": ":type nums: List[int] :type lower: int :type upper: int :rtype: int",
"name": "countRangeSumBIT",
"... | 2 | stack_v2_sparse_classes_30k_train_035956 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countRangeSum(self, nums, lower, upper): :type nums: List[int] :type lower: int :type upper: int :rtype: int
- def countRangeSumBIT(self, nums, lower, upper): :type nums: Lis... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countRangeSum(self, nums, lower, upper): :type nums: List[int] :type lower: int :type upper: int :rtype: int
- def countRangeSumBIT(self, nums, lower, upper): :type nums: Lis... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def countRangeSum(self, nums, lower, upper):
""":type nums: List[int] :type lower: int :type upper: int :rtype: int"""
<|body_0|>
def countRangeSumBIT(self, nums, lower, upper):
""":type nums: List[int] :type lower: int :type upper: int :rtype: int"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def countRangeSum(self, nums, lower, upper):
""":type nums: List[int] :type lower: int :type upper: int :rtype: int"""
"""
Recall "count smaller number after self" where we encountered the problem
count[i] = count of nums[j] - nums[i] < 0 with j > i
... | the_stack_v2_python_sparse | C/CountofRangeSum.py | bssrdf/pyleet | train | 2 | |
e9551ea6a5198dafc8a49a4d8dc17dd983bbf9fb | [
"t, dat = dat\nif len(dat) > 3:\n print('wrong meta', dat, len(dat))\n return None\nr = (t, dat['value'], dat['time'], dat['temp'])\nreturn np.array([r], dtype=cls.fields)",
"if len(dat) == 1:\n dat = dat[0]\nif len(dat) != len(cls.fields):\n return None\nreturn [dat[0], {'value': dat[1], 'time': dat[... | <|body_start_0|>
t, dat = dat
if len(dat) > 3:
print('wrong meta', dat, len(dat))
return None
r = (t, dat['value'], dat['time'], dat['temp'])
return np.array([r], dtype=cls.fields)
<|end_body_0|>
<|body_start_1|>
if len(dat) == 1:
dat = dat[0]... | An Array reference with 4 columns, one for the time, 3 for value,time,temp keys of a Meta option type | Meta | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Meta:
"""An Array reference with 4 columns, one for the time, 3 for value,time,temp keys of a Meta option type"""
def encode(cls, dat):
"""Flatten the Meta dictionary into a float list of t,value,time,temp"""
<|body_0|>
def decode(cls, dat):
"""Rebuild the Meta d... | stack_v2_sparse_classes_75kplus_train_067904 | 6,398 | permissive | [
{
"docstring": "Flatten the Meta dictionary into a float list of t,value,time,temp",
"name": "encode",
"signature": "def encode(cls, dat)"
},
{
"docstring": "Rebuild the Meta dictionary",
"name": "decode",
"signature": "def decode(cls, dat)"
}
] | 2 | stack_v2_sparse_classes_30k_train_029879 | Implement the Python class `Meta` described below.
Class description:
An Array reference with 4 columns, one for the time, 3 for value,time,temp keys of a Meta option type
Method signatures and docstrings:
- def encode(cls, dat): Flatten the Meta dictionary into a float list of t,value,time,temp
- def decode(cls, dat... | Implement the Python class `Meta` described below.
Class description:
An Array reference with 4 columns, one for the time, 3 for value,time,temp keys of a Meta option type
Method signatures and docstrings:
- def encode(cls, dat): Flatten the Meta dictionary into a float list of t,value,time,temp
- def decode(cls, dat... | 726cd8eb6f28070dad3332b8708fc17261de8f94 | <|skeleton|>
class Meta:
"""An Array reference with 4 columns, one for the time, 3 for value,time,temp keys of a Meta option type"""
def encode(cls, dat):
"""Flatten the Meta dictionary into a float list of t,value,time,temp"""
<|body_0|>
def decode(cls, dat):
"""Rebuild the Meta d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Meta:
"""An Array reference with 4 columns, one for the time, 3 for value,time,temp keys of a Meta option type"""
def encode(cls, dat):
"""Flatten the Meta dictionary into a float list of t,value,time,temp"""
t, dat = dat
if len(dat) > 3:
print('wrong meta', dat, len(d... | the_stack_v2_python_sparse | misura/canon/reference/array.py | tainstr/misura.canon | train | 1 |
de1b565ab92f8b99e1e726f62cb4d87d2a621710 | [
"storage = get_storage()\nroles = storage.list_roles()\nreturn jsonify(RoleSchema(many=True).dump(roles))",
"data = request.get_json()\ntry:\n role = RolePostSchema().load(data)\nexcept ValidationError as err:\n raise BadAPIRequest(err.messages)\nstorage = get_storage()\nrole_id = storage.store_role(role)\n... | <|body_start_0|>
storage = get_storage()
roles = storage.list_roles()
return jsonify(RoleSchema(many=True).dump(roles))
<|end_body_0|>
<|body_start_1|>
data = request.get_json()
try:
role = RolePostSchema().load(data)
except ValidationError as err:
... | AllRolesView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllRolesView:
def get(self):
"""--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $r... | stack_v2_sparse_classes_75kplus_train_067905 | 5,492 | permissive | [
{
"docstring": "--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Unauthor... | 2 | stack_v2_sparse_classes_30k_train_034029 | Implement the Python class `AllRolesView` described below.
Class description:
Implement the AllRolesView class.
Method signatures and docstrings:
- def get(self): --- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. ... | Implement the Python class `AllRolesView` described below.
Class description:
Implement the AllRolesView class.
Method signatures and docstrings:
- def get(self): --- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. ... | 280800c73eb7cfd49029462b352887e78f1ff91b | <|skeleton|>
class AllRolesView:
def get(self):
"""--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AllRolesView:
def get(self):
"""--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/compone... | the_stack_v2_python_sparse | sfa_api/roles.py | SolarArbiter/solarforecastarbiter-api | train | 9 | |
0914beece2c2431f064261b90e0eab0ae9dc573a | [
"interactions = interaction_registry.Registry.get_all_interactions()\nobject_default_vals = object_registry.get_default_object_values()\nfor interaction in interactions:\n for rule_name in interaction.rules_dict:\n param_list = interaction.get_rule_param_list(rule_name)\n for _, param_obj_type in p... | <|body_start_0|>
interactions = interaction_registry.Registry.get_all_interactions()
object_default_vals = object_registry.get_default_object_values()
for interaction in interactions:
for rule_name in interaction.rules_dict:
param_list = interaction.get_rule_param_lis... | Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules. | ObjectDefaultValuesUnitTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectDefaultValuesUnitTests:
"""Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules."""
def test_all_rule_input_fields_have_default_values(self) -> None:
... | stack_v2_sparse_classes_75kplus_train_067906 | 3,831 | permissive | [
{
"docstring": "Checks that all rule input fields have a default value, and this is provided in get_default_values().",
"name": "test_all_rule_input_fields_have_default_values",
"signature": "def test_all_rule_input_fields_have_default_values(self) -> None"
},
{
"docstring": "Checks that the def... | 2 | stack_v2_sparse_classes_30k_train_016702 | Implement the Python class `ObjectDefaultValuesUnitTests` described below.
Class description:
Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules.
Method signatures and docstrings:
- de... | Implement the Python class `ObjectDefaultValuesUnitTests` described below.
Class description:
Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules.
Method signatures and docstrings:
- de... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class ObjectDefaultValuesUnitTests:
"""Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules."""
def test_all_rule_input_fields_have_default_values(self) -> None:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ObjectDefaultValuesUnitTests:
"""Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules."""
def test_all_rule_input_fields_have_default_values(self) -> None:
"""Checks... | the_stack_v2_python_sparse | core/domain/object_registry_test.py | oppia/oppia | train | 6,172 |
8e753b7822a1a2802eb91ec30309d37fb4469ec1 | [
"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 Customer Negative Criterion service. Service to manage customer negative criteria. | CustomerNegativeCriterionServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomerNegativeCriterionServiceServicer:
"""Proto file describing the Customer Negative Criterion service. Service to manage customer negative criteria."""
def GetCustomerNegativeCriterion(self, request, context):
"""Returns the requested criterion in full detail."""
<|body_... | stack_v2_sparse_classes_75kplus_train_067907 | 6,280 | permissive | [
{
"docstring": "Returns the requested criterion in full detail.",
"name": "GetCustomerNegativeCriterion",
"signature": "def GetCustomerNegativeCriterion(self, request, context)"
},
{
"docstring": "Creates or removes criteria. Operation statuses are returned.",
"name": "MutateCustomerNegative... | 2 | stack_v2_sparse_classes_30k_train_008526 | Implement the Python class `CustomerNegativeCriterionServiceServicer` described below.
Class description:
Proto file describing the Customer Negative Criterion service. Service to manage customer negative criteria.
Method signatures and docstrings:
- def GetCustomerNegativeCriterion(self, request, context): Returns t... | Implement the Python class `CustomerNegativeCriterionServiceServicer` described below.
Class description:
Proto file describing the Customer Negative Criterion service. Service to manage customer negative criteria.
Method signatures and docstrings:
- def GetCustomerNegativeCriterion(self, request, context): Returns t... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class CustomerNegativeCriterionServiceServicer:
"""Proto file describing the Customer Negative Criterion service. Service to manage customer negative criteria."""
def GetCustomerNegativeCriterion(self, request, context):
"""Returns the requested criterion in full detail."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomerNegativeCriterionServiceServicer:
"""Proto file describing the Customer Negative Criterion service. Service to manage customer negative criteria."""
def GetCustomerNegativeCriterion(self, request, context):
"""Returns the requested criterion in full detail."""
context.set_code(grp... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/customer_negative_criterion_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
d98a75f5bcd631506e8987df995b6d525c712b3f | [
"self.mlp = mlp\nself.eta = kwargs.pop('eta', 0.1)\nself.gamma = kwargs.pop('gamma', 0.9)\nself.v_w_list = [np.zeros(w.shape) for w in mlp.weights_list]\nself.v_b_list = [np.zeros(b.shape) for b in mlp.biases_list]",
"grad_w_list, grad_b_list = self.mlp.get_gradients(x_data, t_data)\nself.v_w_list = [self.gamma *... | <|body_start_0|>
self.mlp = mlp
self.eta = kwargs.pop('eta', 0.1)
self.gamma = kwargs.pop('gamma', 0.9)
self.v_w_list = [np.zeros(w.shape) for w in mlp.weights_list]
self.v_b_list = [np.zeros(b.shape) for b in mlp.biases_list]
<|end_body_0|>
<|body_start_1|>
grad_w_list,... | Class implementing Momentum optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector for the MLP weights v_b_list : np.array Update vector fo... | Momentum | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Momentum:
"""Class implementing Momentum optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector for the MLP weights ... | stack_v2_sparse_classes_75kplus_train_067908 | 20,458 | permissive | [
{
"docstring": "__init__ method for the Momentum class Sets up hyperparameters for the Momentum class Parameters ---------- mlp : MLP Multilayer Perceptron object to be trained **kwargs : Parameters used by the Momentum method (eta, gamma)",
"name": "__init__",
"signature": "def __init__(self, mlp, **kw... | 2 | null | Implement the Python class `Momentum` described below.
Class description:
Class implementing Momentum optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.a... | Implement the Python class `Momentum` described below.
Class description:
Class implementing Momentum optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.a... | 3761ff4f2a68137ac196e75c8651260cb8c79e69 | <|skeleton|>
class Momentum:
"""Class implementing Momentum optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector for the MLP weights ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Momentum:
"""Class implementing Momentum optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector for the MLP weights v_b_list : np... | the_stack_v2_python_sparse | pr3/mlpOptimizer.py | zentonllo/gcom | train | 1 |
d84822256e6e6a6bc84abe09278c9ec38b38fb8d | [
"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... | Missing associated documentation comment in .proto file. | AuthzAppServiceServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthzAppServiceServicer:
"""Missing associated documentation comment in .proto file."""
def is_allowed(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def hash_keys(self, request, context):
"""Missing associated ... | stack_v2_sparse_classes_75kplus_train_067909 | 4,577 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "is_allowed",
"signature": "def is_allowed(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "hash_keys",
"signature": "def hash_keys(self, requ... | 2 | stack_v2_sparse_classes_30k_train_008566 | Implement the Python class `AuthzAppServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def is_allowed(self, request, context): Missing associated documentation comment in .proto file.
- def hash_keys(self, request, context)... | Implement the Python class `AuthzAppServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def is_allowed(self, request, context): Missing associated documentation comment in .proto file.
- def hash_keys(self, request, context)... | 55d36c068e26e13ee5bae5c033e2e17784c63feb | <|skeleton|>
class AuthzAppServiceServicer:
"""Missing associated documentation comment in .proto file."""
def is_allowed(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def hash_keys(self, request, context):
"""Missing associated ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AuthzAppServiceServicer:
"""Missing associated documentation comment in .proto file."""
def is_allowed(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemente... | the_stack_v2_python_sparse | src/resource/proto/_generated/identity/authz_app_service_pb2_grpc.py | arkanmgerges/cafm.identity | train | 0 |
cfe389245f702fada90aebd54b4607652429da45 | [
"if not module_list:\n module_list = [x for x in os.listdir(src_pkg_dir + '/fusetools') if '.py' in x]\ntry:\n os.mkdir(tgt_pkg_dir)\nexcept:\n TransferLocal.clear_delete_directory(directory=tgt_pkg_dir, method='clear')\nif folder_list:\n for folder in folder_list:\n dir_util.copy_tree(src_pkg_di... | <|body_start_0|>
if not module_list:
module_list = [x for x in os.listdir(src_pkg_dir + '/fusetools') if '.py' in x]
try:
os.mkdir(tgt_pkg_dir)
except:
TransferLocal.clear_delete_directory(directory=tgt_pkg_dir, method='clear')
if folder_list:
... | Functions for dealing with Local DevOps tasks. .. image:: ../images_source/devops_tools/local_folder.png | Local | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Local:
"""Functions for dealing with Local DevOps tasks. .. image:: ../images_source/devops_tools/local_folder.png"""
def create_sub_pkg(cls, src_pkg_dir, src_pkg_name, tgt_pkg_dir, tgt_pkg_name, folder_list, file_list, module_list=False, install_pkg=False, python_alias='python3'):
"... | stack_v2_sparse_classes_75kplus_train_067910 | 16,938 | permissive | [
{
"docstring": "Creates a package from another package using specified details. :param src_pkg_dir: Directory of source package :param src_pkg_name: Name of source package :param tgt_pkg_dir: Directory of target package :param tgt_pkg_name: Name of target package :param folder_list: List of file folders to copy... | 3 | stack_v2_sparse_classes_30k_train_023006 | Implement the Python class `Local` described below.
Class description:
Functions for dealing with Local DevOps tasks. .. image:: ../images_source/devops_tools/local_folder.png
Method signatures and docstrings:
- def create_sub_pkg(cls, src_pkg_dir, src_pkg_name, tgt_pkg_dir, tgt_pkg_name, folder_list, file_list, modu... | Implement the Python class `Local` described below.
Class description:
Functions for dealing with Local DevOps tasks. .. image:: ../images_source/devops_tools/local_folder.png
Method signatures and docstrings:
- def create_sub_pkg(cls, src_pkg_dir, src_pkg_name, tgt_pkg_dir, tgt_pkg_name, folder_list, file_list, modu... | f200ccd224170761ed6a73ae8adf84972af2213d | <|skeleton|>
class Local:
"""Functions for dealing with Local DevOps tasks. .. image:: ../images_source/devops_tools/local_folder.png"""
def create_sub_pkg(cls, src_pkg_dir, src_pkg_name, tgt_pkg_dir, tgt_pkg_name, folder_list, file_list, module_list=False, install_pkg=False, python_alias='python3'):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Local:
"""Functions for dealing with Local DevOps tasks. .. image:: ../images_source/devops_tools/local_folder.png"""
def create_sub_pkg(cls, src_pkg_dir, src_pkg_name, tgt_pkg_dir, tgt_pkg_name, folder_list, file_list, module_list=False, install_pkg=False, python_alias='python3'):
"""Creates a p... | the_stack_v2_python_sparse | fusetools/devops_tools.py | TrendingTechnology/fusetools | train | 0 |
e70c1d480265b0ad4ea553ce9a2f1cd0d0bd4a43 | [
"lower_bound = float('-inf')\nstack = []\nfor val in preorder:\n if val < lower_bound:\n return False\n while stack and val > stack[-1]:\n lower_bound = stack.pop()\n stack.append(val)\nreturn True",
"lower_bound = float('-inf')\ni = 0\nfor val in preorder:\n if val < lower_bound:\n ... | <|body_start_0|>
lower_bound = float('-inf')
stack = []
for val in preorder:
if val < lower_bound:
return False
while stack and val > stack[-1]:
lower_bound = stack.pop()
stack.append(val)
return True
<|end_body_0|>
<|b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def verifyPreorder(self, preorder: List[int]) -> bool:
"""In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a de... | stack_v2_sparse_classes_75kplus_train_067911 | 2,035 | no_license | [
{
"docstring": "In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a decreasing val subseq. If we see a val that's greater than its preceeding val ... | 2 | stack_v2_sparse_classes_30k_train_025397 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPreorder(self, preorder: List[int]) -> bool: In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPreorder(self, preorder: List[int]) -> bool: In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf... | 6ff1941ff213a843013100ac7033e2d4f90fbd6a | <|skeleton|>
class Solution:
def verifyPreorder(self, preorder: List[int]) -> bool:
"""In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def verifyPreorder(self, preorder: List[int]) -> bool:
"""In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a decreasing val s... | the_stack_v2_python_sparse | Leetcode 0255. Verify Preorder Sequence in Binary Search Tree.py | Chaoran-sjsu/leetcode | train | 0 | |
f0f7ebdd129fed0c1399de3884d9dbb04b007df9 | [
"try:\n iter(obj)\n return True\nexcept TypeError:\n return False",
"if not isinstance(obj, list) and cls.is_iterable(obj):\n obj = list(obj)\nreturn obj"
] | <|body_start_0|>
try:
iter(obj)
return True
except TypeError:
return False
<|end_body_0|>
<|body_start_1|>
if not isinstance(obj, list) and cls.is_iterable(obj):
obj = list(obj)
return obj
<|end_body_1|>
| TypeUtil | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TypeUtil:
def is_iterable(cls, obj):
"""Determines if obj is iterable. Useful when writing functions that can accept multiple types of input (list, tuple, ndarray, iterator). Pairs well with convert_to_list."""
<|body_0|>
def convert_to_list(cls, obj):
"""Converts ob... | stack_v2_sparse_classes_75kplus_train_067912 | 680 | permissive | [
{
"docstring": "Determines if obj is iterable. Useful when writing functions that can accept multiple types of input (list, tuple, ndarray, iterator). Pairs well with convert_to_list.",
"name": "is_iterable",
"signature": "def is_iterable(cls, obj)"
},
{
"docstring": "Converts obj to a list if i... | 2 | stack_v2_sparse_classes_30k_train_022344 | Implement the Python class `TypeUtil` described below.
Class description:
Implement the TypeUtil class.
Method signatures and docstrings:
- def is_iterable(cls, obj): Determines if obj is iterable. Useful when writing functions that can accept multiple types of input (list, tuple, ndarray, iterator). Pairs well with ... | Implement the Python class `TypeUtil` described below.
Class description:
Implement the TypeUtil class.
Method signatures and docstrings:
- def is_iterable(cls, obj): Determines if obj is iterable. Useful when writing functions that can accept multiple types of input (list, tuple, ndarray, iterator). Pairs well with ... | 1279d2ea65fa7bbeb4d18ab80f7f77685df553b8 | <|skeleton|>
class TypeUtil:
def is_iterable(cls, obj):
"""Determines if obj is iterable. Useful when writing functions that can accept multiple types of input (list, tuple, ndarray, iterator). Pairs well with convert_to_list."""
<|body_0|>
def convert_to_list(cls, obj):
"""Converts ob... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TypeUtil:
def is_iterable(cls, obj):
"""Determines if obj is iterable. Useful when writing functions that can accept multiple types of input (list, tuple, ndarray, iterator). Pairs well with convert_to_list."""
try:
iter(obj)
return True
except TypeError:
... | the_stack_v2_python_sparse | data-science-ipython-notebooks/python-data/type_util.py | amirothman/scikit-learn-course | train | 2 | |
92bc317801df571a85c838690b668a4d299afd97 | [
"item_index = layout.indexOf(widget)\nprint(f'on_remove_widget_fn(...): item_index: {item_index}')\nitem = layout.itemAt(item_index)\nwidget = item.widget()\nlayout.removeWidget(widget)",
"new_view_widget = MatplotlibWidget()\nif show_in_separate_window:\n new_widget_window = PhoPipelineSecondaryWindow([new_vi... | <|body_start_0|>
item_index = layout.indexOf(widget)
print(f'on_remove_widget_fn(...): item_index: {item_index}')
item = layout.itemAt(item_index)
widget = item.widget()
layout.removeWidget(widget)
<|end_body_0|>
<|body_start_1|>
new_view_widget = MatplotlibWidget()
... | Display node is instantiated like so: pipeline_display_node = fc.createNode('PipelineDisplayNode', pos=(280, 120)) pipeline_display_node.setApp(app) # Sets the shared singleton app instance # pipeline_display_node.setView(new_root_render_widget, on_remove_function=on_remove_widget_fn) # Sets the view associated with th... | DisplayNodeViewHelpers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DisplayNodeViewHelpers:
"""Display node is instantiated like so: pipeline_display_node = fc.createNode('PipelineDisplayNode', pos=(280, 120)) pipeline_display_node.setApp(app) # Sets the shared singleton app instance # pipeline_display_node.setView(new_root_render_widget, on_remove_function=on_re... | stack_v2_sparse_classes_75kplus_train_067913 | 13,457 | permissive | [
{
"docstring": "the callback to remove the widget from the layout. implicitly used 'layout'.",
"name": "on_remove_widget_fn",
"signature": "def on_remove_widget_fn(self, widget, layout)"
},
{
"docstring": "uses layout implicitly",
"name": "on_add_widget_fn",
"signature": "def on_add_widg... | 2 | null | Implement the Python class `DisplayNodeViewHelpers` described below.
Class description:
Display node is instantiated like so: pipeline_display_node = fc.createNode('PipelineDisplayNode', pos=(280, 120)) pipeline_display_node.setApp(app) # Sets the shared singleton app instance # pipeline_display_node.setView(new_root_... | Implement the Python class `DisplayNodeViewHelpers` described below.
Class description:
Display node is instantiated like so: pipeline_display_node = fc.createNode('PipelineDisplayNode', pos=(280, 120)) pipeline_display_node.setApp(app) # Sets the shared singleton app instance # pipeline_display_node.setView(new_root_... | 212399d826284b394fce8894ff1a93133aef783f | <|skeleton|>
class DisplayNodeViewHelpers:
"""Display node is instantiated like so: pipeline_display_node = fc.createNode('PipelineDisplayNode', pos=(280, 120)) pipeline_display_node.setApp(app) # Sets the shared singleton app instance # pipeline_display_node.setView(new_root_render_widget, on_remove_function=on_re... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DisplayNodeViewHelpers:
"""Display node is instantiated like so: pipeline_display_node = fc.createNode('PipelineDisplayNode', pos=(280, 120)) pipeline_display_node.setApp(app) # Sets the shared singleton app instance # pipeline_display_node.setView(new_root_render_widget, on_remove_function=on_remove_widget_f... | the_stack_v2_python_sparse | src/pyphoplacecellanalysis/GUI/PyQtPlot/Flowchart/CustomNodes/Mixins/DisplayNodeViewHelpers.py | CommanderPho/pyPhoPlaceCellAnalysis | train | 1 |
db598c8478672c78f4e67f616c61ce799424bce7 | [
"self.mva_number = mva_number\nself.prokura = prokura\nself.signature = signature\nself.report = report\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nmva_number = dictionary.get('MvaNumber')\nprokura = dictionary.get('Prokura')\nsignature = dictionary.get('Signatu... | <|body_start_0|>
self.mva_number = mva_number
self.prokura = prokura
self.signature = signature
self.report = report
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
mva_number = dic... | Implementation of the 'OrganizationResponse' model. TODO: type model description here. Attributes: mva_number (int): TODO: type description here. prokura (string): TODO: type description here. signature (string): TODO: type description here. report (string): TODO: type description here. | OrganizationResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrganizationResponse:
"""Implementation of the 'OrganizationResponse' model. TODO: type model description here. Attributes: mva_number (int): TODO: type description here. prokura (string): TODO: type description here. signature (string): TODO: type description here. report (string): TODO: type de... | stack_v2_sparse_classes_75kplus_train_067914 | 2,534 | permissive | [
{
"docstring": "Constructor for the OrganizationResponse class",
"name": "__init__",
"signature": "def __init__(self, mva_number=None, prokura=None, signature=None, report=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (di... | 2 | null | Implement the Python class `OrganizationResponse` described below.
Class description:
Implementation of the 'OrganizationResponse' model. TODO: type model description here. Attributes: mva_number (int): TODO: type description here. prokura (string): TODO: type description here. signature (string): TODO: type descripti... | Implement the Python class `OrganizationResponse` described below.
Class description:
Implementation of the 'OrganizationResponse' model. TODO: type model description here. Attributes: mva_number (int): TODO: type description here. prokura (string): TODO: type description here. signature (string): TODO: type descripti... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class OrganizationResponse:
"""Implementation of the 'OrganizationResponse' model. TODO: type model description here. Attributes: mva_number (int): TODO: type description here. prokura (string): TODO: type description here. signature (string): TODO: type description here. report (string): TODO: type de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrganizationResponse:
"""Implementation of the 'OrganizationResponse' model. TODO: type model description here. Attributes: mva_number (int): TODO: type description here. prokura (string): TODO: type description here. signature (string): TODO: type description here. report (string): TODO: type description her... | the_stack_v2_python_sparse | idfy_rest_client/models/organization_response.py | dealflowteam/Idfy | train | 0 |
4e65509f2db021b3ec991fcf93ebf4ed9ce6917e | [
"response = self.login()\nself.assertTrue('Filter' in response.data.decode('utf-8'))\nresponse = self.navigate_to('/anichart')\nself.assertTrue('season' in response.data.decode('utf-8'))\nresponse = self.submit_to('/anichart', FALL_2002_DATA)\nself.assertTrue('Naruto' not in response.data.decode('utf-8'))\nresponse... | <|body_start_0|>
response = self.login()
self.assertTrue('Filter' in response.data.decode('utf-8'))
response = self.navigate_to('/anichart')
self.assertTrue('season' in response.data.decode('utf-8'))
response = self.submit_to('/anichart', FALL_2002_DATA)
self.assertTrue('... | AnichartTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnichartTest:
def test_anichart_fall(self):
"""Test anichart functionality through frontend"""
<|body_0|>
def test_anichart_spring(self):
"""Test anichart functionality through frontend"""
<|body_1|>
def test_anichart_summer(self):
"""Test anicha... | stack_v2_sparse_classes_75kplus_train_067915 | 4,119 | no_license | [
{
"docstring": "Test anichart functionality through frontend",
"name": "test_anichart_fall",
"signature": "def test_anichart_fall(self)"
},
{
"docstring": "Test anichart functionality through frontend",
"name": "test_anichart_spring",
"signature": "def test_anichart_spring(self)"
},
... | 5 | stack_v2_sparse_classes_30k_train_036352 | Implement the Python class `AnichartTest` described below.
Class description:
Implement the AnichartTest class.
Method signatures and docstrings:
- def test_anichart_fall(self): Test anichart functionality through frontend
- def test_anichart_spring(self): Test anichart functionality through frontend
- def test_anich... | Implement the Python class `AnichartTest` described below.
Class description:
Implement the AnichartTest class.
Method signatures and docstrings:
- def test_anichart_fall(self): Test anichart functionality through frontend
- def test_anichart_spring(self): Test anichart functionality through frontend
- def test_anich... | 7e9a9de45c5c004f9af68aa76701d9ce302f2d5a | <|skeleton|>
class AnichartTest:
def test_anichart_fall(self):
"""Test anichart functionality through frontend"""
<|body_0|>
def test_anichart_spring(self):
"""Test anichart functionality through frontend"""
<|body_1|>
def test_anichart_summer(self):
"""Test anicha... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnichartTest:
def test_anichart_fall(self):
"""Test anichart functionality through frontend"""
response = self.login()
self.assertTrue('Filter' in response.data.decode('utf-8'))
response = self.navigate_to('/anichart')
self.assertTrue('season' in response.data.decode('u... | the_stack_v2_python_sparse | unittests/AnichartTester.py | aqiu384/MALBuilder | train | 0 | |
5205d572029108efc634f39bd6720b5a0692a170 | [
"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... | Proto file describing the keyword plan service. Service to manage keyword plans. | KeywordPlanServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeywordPlanServiceServicer:
"""Proto file describing the keyword plan service. Service to manage keyword plans."""
def GetKeywordPlan(self, request, context):
"""Returns the requested plan in full detail."""
<|body_0|>
def MutateKeywordPlans(self, request, context):
... | stack_v2_sparse_classes_75kplus_train_067916 | 14,732 | permissive | [
{
"docstring": "Returns the requested plan in full detail.",
"name": "GetKeywordPlan",
"signature": "def GetKeywordPlan(self, request, context)"
},
{
"docstring": "Creates, updates, or removes keyword plans. Operation statuses are returned.",
"name": "MutateKeywordPlans",
"signature": "d... | 6 | stack_v2_sparse_classes_30k_train_014541 | Implement the Python class `KeywordPlanServiceServicer` described below.
Class description:
Proto file describing the keyword plan service. Service to manage keyword plans.
Method signatures and docstrings:
- def GetKeywordPlan(self, request, context): Returns the requested plan in full detail.
- def MutateKeywordPla... | Implement the Python class `KeywordPlanServiceServicer` described below.
Class description:
Proto file describing the keyword plan service. Service to manage keyword plans.
Method signatures and docstrings:
- def GetKeywordPlan(self, request, context): Returns the requested plan in full detail.
- def MutateKeywordPla... | 969eff5b6c3cec59d21191fa178cffb6270074c3 | <|skeleton|>
class KeywordPlanServiceServicer:
"""Proto file describing the keyword plan service. Service to manage keyword plans."""
def GetKeywordPlan(self, request, context):
"""Returns the requested plan in full detail."""
<|body_0|>
def MutateKeywordPlans(self, request, context):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KeywordPlanServiceServicer:
"""Proto file describing the keyword plan service. Service to manage keyword plans."""
def GetKeywordPlan(self, request, context):
"""Returns the requested plan in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Meth... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/keyword_plan_service_pb2_grpc.py | VincentFritzsche/google-ads-python | train | 0 |
4610e2e5387ba24406172aa3d9ab19d3d5bafb6b | [
"if not license_model:\n if engine in self.valid_instance_types.get('license-included'):\n license_model = 'license-included'\n elif engine in self.valid_instance_types.get('bring-your-own-license'):\n license_model = 'bring-your-own-license'\n else:\n license_model = 'general-public-l... | <|body_start_0|>
if not license_model:
if engine in self.valid_instance_types.get('license-included'):
license_model = 'license-included'
elif engine in self.valid_instance_types.get('bring-your-own-license'):
license_model = 'bring-your-own-license'
... | Check if Resources RDS Instance Size is compatible with the RDS type | InstanceSize | [
"MIT-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstanceSize:
"""Check if Resources RDS Instance Size is compatible with the RDS type"""
def _get_license_model(self, engine, license_model):
"""Logic to get the correct license model"""
<|body_0|>
def get_resources(self, cfn):
"""Get resources that can be checke... | stack_v2_sparse_classes_75kplus_train_067917 | 5,624 | permissive | [
{
"docstring": "Logic to get the correct license model",
"name": "_get_license_model",
"signature": "def _get_license_model(self, engine, license_model)"
},
{
"docstring": "Get resources that can be checked",
"name": "get_resources",
"signature": "def get_resources(self, cfn)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_051915 | Implement the Python class `InstanceSize` described below.
Class description:
Check if Resources RDS Instance Size is compatible with the RDS type
Method signatures and docstrings:
- def _get_license_model(self, engine, license_model): Logic to get the correct license model
- def get_resources(self, cfn): Get resourc... | Implement the Python class `InstanceSize` described below.
Class description:
Check if Resources RDS Instance Size is compatible with the RDS type
Method signatures and docstrings:
- def _get_license_model(self, engine, license_model): Logic to get the correct license model
- def get_resources(self, cfn): Get resourc... | 23264106438d79bf77cfa2fa747ed078e2cbf63d | <|skeleton|>
class InstanceSize:
"""Check if Resources RDS Instance Size is compatible with the RDS type"""
def _get_license_model(self, engine, license_model):
"""Logic to get the correct license model"""
<|body_0|>
def get_resources(self, cfn):
"""Get resources that can be checke... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InstanceSize:
"""Check if Resources RDS Instance Size is compatible with the RDS type"""
def _get_license_model(self, engine, license_model):
"""Logic to get the correct license model"""
if not license_model:
if engine in self.valid_instance_types.get('license-included'):
... | the_stack_v2_python_sparse | src/cfnlint/rules/resources/rds/InstanceSize.py | kddejong/cfn-python-lint | train | 0 |
40ecb2662a9d3b74b1bfb38180ba8a4fe3e436db | [
"self.delay = delay\nself.ticks = ticks\nself.tick_count = 0\nself.timer = None\nself.done = False\nself.callback = callback",
"if not self.timer:\n self.timer = now\n self.callback(self.tick_count)\nelif not self.done and now - self.timer > self.delay:\n self.tick_count += 1\n self.timer = now\n i... | <|body_start_0|>
self.delay = delay
self.ticks = ticks
self.tick_count = 0
self.timer = None
self.done = False
self.callback = callback
<|end_body_0|>
<|body_start_1|>
if not self.timer:
self.timer = now
self.callback(self.tick_count)
... | Very simple timer. It does not take care about how late it checks tick. | Timer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Timer:
"""Very simple timer. It does not take care about how late it checks tick."""
def __init__(self, delay, callback, ticks=-1):
"""Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback ... | stack_v2_sparse_classes_75kplus_train_067918 | 4,928 | no_license | [
{
"docstring": "Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback specify function of one argument (tick count), that is called when 'delay' passed, but it is not called automaticly - check_tick must be called.",
... | 2 | stack_v2_sparse_classes_30k_train_025701 | Implement the Python class `Timer` described below.
Class description:
Very simple timer. It does not take care about how late it checks tick.
Method signatures and docstrings:
- def __init__(self, delay, callback, ticks=-1): Delay is given in milliseconds; ticks is a number of ticks the timer will make before settin... | Implement the Python class `Timer` described below.
Class description:
Very simple timer. It does not take care about how late it checks tick.
Method signatures and docstrings:
- def __init__(self, delay, callback, ticks=-1): Delay is given in milliseconds; ticks is a number of ticks the timer will make before settin... | 026ef53b5ed9683691b8f136ceae756fe6dd7f07 | <|skeleton|>
class Timer:
"""Very simple timer. It does not take care about how late it checks tick."""
def __init__(self, delay, callback, ticks=-1):
"""Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Timer:
"""Very simple timer. It does not take care about how late it checks tick."""
def __init__(self, delay, callback, ticks=-1):
"""Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback specify funct... | the_stack_v2_python_sparse | data/tools.py | jpaulovic/Asteroids | train | 0 |
9136e52db0499c4f3428ae1e9d321fb345afccdf | [
"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... | SSHServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SSHServiceServicer:
def SSHUploadPack(self, request_iterator, context):
"""To forward 'git upload-pack' to Gitaly for SSH sessions"""
<|body_0|>
def SSHReceivePack(self, request_iterator, context):
"""To forward 'git receive-pack' to Gitaly for SSH sessions"""
... | stack_v2_sparse_classes_75kplus_train_067919 | 3,094 | permissive | [
{
"docstring": "To forward 'git upload-pack' to Gitaly for SSH sessions",
"name": "SSHUploadPack",
"signature": "def SSHUploadPack(self, request_iterator, context)"
},
{
"docstring": "To forward 'git receive-pack' to Gitaly for SSH sessions",
"name": "SSHReceivePack",
"signature": "def S... | 3 | stack_v2_sparse_classes_30k_train_000935 | Implement the Python class `SSHServiceServicer` described below.
Class description:
Implement the SSHServiceServicer class.
Method signatures and docstrings:
- def SSHUploadPack(self, request_iterator, context): To forward 'git upload-pack' to Gitaly for SSH sessions
- def SSHReceivePack(self, request_iterator, conte... | Implement the Python class `SSHServiceServicer` described below.
Class description:
Implement the SSHServiceServicer class.
Method signatures and docstrings:
- def SSHUploadPack(self, request_iterator, context): To forward 'git upload-pack' to Gitaly for SSH sessions
- def SSHReceivePack(self, request_iterator, conte... | 1d2400593fa7fa261b15c1c7f3494daf009586f8 | <|skeleton|>
class SSHServiceServicer:
def SSHUploadPack(self, request_iterator, context):
"""To forward 'git upload-pack' to Gitaly for SSH sessions"""
<|body_0|>
def SSHReceivePack(self, request_iterator, context):
"""To forward 'git receive-pack' to Gitaly for SSH sessions"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SSHServiceServicer:
def SSHUploadPack(self, request_iterator, context):
"""To forward 'git upload-pack' to Gitaly for SSH sessions"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented... | the_stack_v2_python_sparse | glartifacts/gitaly/proto/ssh_pb2_grpc.py | TimothySprague/glartifacts | train | 0 | |
77e3d562df9d9fcbfa5e8058db904decf2df2dba | [
"for i in self._inOrderGen(self.root):\n if re.match(str(string), i[0].treestr()):\n yield i[1]",
"def generate(root):\n if root:\n yield list(generate(root.left))\n yield (root.key.treestr(), root.val, root.height)\n yield list(generate(root.right))\nreturn str(list(generate(sel... | <|body_start_0|>
for i in self._inOrderGen(self.root):
if re.match(str(string), i[0].treestr()):
yield i[1]
<|end_body_0|>
<|body_start_1|>
def generate(root):
if root:
yield list(generate(root.left))
yield (root.key.treestr(), roo... | Attribute_Date_AVL | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attribute_Date_AVL:
def simsearch(self, string):
"""Simple similarity search for Date tree Time complexity: O(n)"""
<|body_0|>
def treestr(self):
"""Returns string of nested lists(with custom Date treestr) that can be used to build the tree"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_067920 | 9,078 | no_license | [
{
"docstring": "Simple similarity search for Date tree Time complexity: O(n)",
"name": "simsearch",
"signature": "def simsearch(self, string)"
},
{
"docstring": "Returns string of nested lists(with custom Date treestr) that can be used to build the tree",
"name": "treestr",
"signature": ... | 3 | stack_v2_sparse_classes_30k_train_027405 | Implement the Python class `Attribute_Date_AVL` described below.
Class description:
Implement the Attribute_Date_AVL class.
Method signatures and docstrings:
- def simsearch(self, string): Simple similarity search for Date tree Time complexity: O(n)
- def treestr(self): Returns string of nested lists(with custom Date... | Implement the Python class `Attribute_Date_AVL` described below.
Class description:
Implement the Attribute_Date_AVL class.
Method signatures and docstrings:
- def simsearch(self, string): Simple similarity search for Date tree Time complexity: O(n)
- def treestr(self): Returns string of nested lists(with custom Date... | ec7d6fc488f7b82c35a073fe3ea374de2aa0b16a | <|skeleton|>
class Attribute_Date_AVL:
def simsearch(self, string):
"""Simple similarity search for Date tree Time complexity: O(n)"""
<|body_0|>
def treestr(self):
"""Returns string of nested lists(with custom Date treestr) that can be used to build the tree"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Attribute_Date_AVL:
def simsearch(self, string):
"""Simple similarity search for Date tree Time complexity: O(n)"""
for i in self._inOrderGen(self.root):
if re.match(str(string), i[0].treestr()):
yield i[1]
def treestr(self):
"""Returns string of nested... | the_stack_v2_python_sparse | CEP Y3/Unit 2.10 Final Project/cds_attributetrees.py | HTY2003/CEP-Stuff | train | 0 | |
e4ae778222bb15c9e49bab72928768f01a1880d3 | [
"super().__init__()\nself._sample_shape = torch.Size([num_samples])\nself.collapse_batch_dims = collapse_batch_dims\nself.resample = resample\nself.seed = seed if seed is not None else torch.randint(0, 1000000, (1,)).item()",
"if self.resample or not hasattr(self, 'base_samples') or self.base_samples.shape[-2:] !... | <|body_start_0|>
super().__init__()
self._sample_shape = torch.Size([num_samples])
self.collapse_batch_dims = collapse_batch_dims
self.resample = resample
self.seed = seed if seed is not None else torch.randint(0, 1000000, (1,)).item()
<|end_body_0|>
<|body_start_1|>
if ... | Sampler for Gaussian hermite base samples. weight function: standard normal Example: >>> sampler = GaussHermiteSampler(1000, seed=1234) >>> posterior = model.posterior(test_X) >>> samples = sampler(posterior) | GaussHermiteSampler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaussHermiteSampler:
"""Sampler for Gaussian hermite base samples. weight function: standard normal Example: >>> sampler = GaussHermiteSampler(1000, seed=1234) >>> posterior = model.posterior(test_X) >>> samples = sampler(posterior)"""
def __init__(self, num_samples: int, resample: bool=Fals... | stack_v2_sparse_classes_75kplus_train_067921 | 13,572 | permissive | [
{
"docstring": "Sampler for quasi-MC base samples using Sobol sequences. Args: num_samples: The number of samples to use. resample: If `True`, re-draw samples in each `forward` evaluation - this results in stochastic acquisition functions (and thus should not be used with deterministic optimization algorithms).... | 2 | null | Implement the Python class `GaussHermiteSampler` described below.
Class description:
Sampler for Gaussian hermite base samples. weight function: standard normal Example: >>> sampler = GaussHermiteSampler(1000, seed=1234) >>> posterior = model.posterior(test_X) >>> samples = sampler(posterior)
Method signatures and do... | Implement the Python class `GaussHermiteSampler` described below.
Class description:
Sampler for Gaussian hermite base samples. weight function: standard normal Example: >>> sampler = GaussHermiteSampler(1000, seed=1234) >>> posterior = model.posterior(test_X) >>> samples = sampler(posterior)
Method signatures and do... | af13f0a38b579ab504f49a01f1ced13532a3ad49 | <|skeleton|>
class GaussHermiteSampler:
"""Sampler for Gaussian hermite base samples. weight function: standard normal Example: >>> sampler = GaussHermiteSampler(1000, seed=1234) >>> posterior = model.posterior(test_X) >>> samples = sampler(posterior)"""
def __init__(self, num_samples: int, resample: bool=Fals... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GaussHermiteSampler:
"""Sampler for Gaussian hermite base samples. weight function: standard normal Example: >>> sampler = GaussHermiteSampler(1000, seed=1234) >>> posterior = model.posterior(test_X) >>> samples = sampler(posterior)"""
def __init__(self, num_samples: int, resample: bool=False, seed: Opti... | the_stack_v2_python_sparse | botorch/sampling/samplers.py | shalijiang/bo | train | 1 |
69f5e0c67a96409773ef44e42b90527a382f72a8 | [
"self.margin = 1000\nself.motors = {}\nself.ports = ports\nself.attach_motors()",
"for p in ports:\n if self.motors[p].connected:\n self.motors[p].run_forever(speed_sp=speed, speed_regulation=True)\n else:\n raise NotConnectedError(p)",
"self.motors = {}\nfor p in self.ports:\n self.motor... | <|body_start_0|>
self.margin = 1000
self.motors = {}
self.ports = ports
self.attach_motors()
<|end_body_0|>
<|body_start_1|>
for p in ports:
if self.motors[p].connected:
self.motors[p].run_forever(speed_sp=speed, speed_regulation=True)
els... | Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key) | MotorControl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MotorControl:
"""Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)"""
def __init__(self, ports='ABCD', **kwargs):
"""INIT-Argument: p... | stack_v2_sparse_classes_75kplus_train_067922 | 1,867 | no_license | [
{
"docstring": "INIT-Argument: ports = Ports der Motoren",
"name": "__init__",
"signature": "def __init__(self, ports='ABCD', **kwargs)"
},
{
"docstring": "setzt eine Geschwindigkeit(additiv zur mittleren) und schreibt den Wert an bestimmte/alle Motoren Keyword Argumente: sp = zu setzende Geschw... | 5 | stack_v2_sparse_classes_30k_train_036799 | Implement the Python class `MotorControl` described below.
Class description:
Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)
Method signatures and docstrings:
- def... | Implement the Python class `MotorControl` described below.
Class description:
Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)
Method signatures and docstrings:
- def... | a9a7160bf7fb3b528716ebabd4c16b4482d8d9cf | <|skeleton|>
class MotorControl:
"""Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)"""
def __init__(self, ports='ABCD', **kwargs):
"""INIT-Argument: p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MotorControl:
"""Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)"""
def __init__(self, ports='ABCD', **kwargs):
"""INIT-Argument: ports = Ports ... | the_stack_v2_python_sparse | node/MotorControl.py | Fuzzyma/network-controlled-line-follower | train | 0 |
debb9729a7b4c1d5c8836b55546794931979aaaf | [
"if n == 0:\n return 1\nelif n > 0:\n return self.pow_pos(x, n)\nelse:\n return 1.0 / self.pow_pos(x, abs(n))",
"num = x\nresult = 1\nwhile n > 0:\n if n & 1 == 1:\n result *= num\n num = num * num\n n = n >> 1\nreturn result"
] | <|body_start_0|>
if n == 0:
return 1
elif n > 0:
return self.pow_pos(x, n)
else:
return 1.0 / self.pow_pos(x, abs(n))
<|end_body_0|>
<|body_start_1|>
num = x
result = 1
while n > 0:
if n & 1 == 1:
result *= ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def my_pow(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_0|>
def pow_pos(self, x, n):
"""n: 是正整数"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 0:
return 1
elif n > 0:
return s... | stack_v2_sparse_classes_75kplus_train_067923 | 1,687 | no_license | [
{
"docstring": ":type x: float :type n: int :rtype: float",
"name": "my_pow",
"signature": "def my_pow(self, x, n)"
},
{
"docstring": "n: 是正整数",
"name": "pow_pos",
"signature": "def pow_pos(self, x, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004822 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def my_pow(self, x, n): :type x: float :type n: int :rtype: float
- def pow_pos(self, x, n): n: 是正整数 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def my_pow(self, x, n): :type x: float :type n: int :rtype: float
- def pow_pos(self, x, n): n: 是正整数
<|skeleton|>
class Solution:
def my_pow(self, x, n):
""":type x... | dd917b6eba48eef42f1086a54880bab6cd1fbf07 | <|skeleton|>
class Solution:
def my_pow(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_0|>
def pow_pos(self, x, n):
"""n: 是正整数"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def my_pow(self, x, n):
""":type x: float :type n: int :rtype: float"""
if n == 0:
return 1
elif n > 0:
return self.pow_pos(x, n)
else:
return 1.0 / self.pow_pos(x, abs(n))
def pow_pos(self, x, n):
"""n: 是正整数"""
... | the_stack_v2_python_sparse | algorithms/BAT-algorithms/Math/pow(x,n).py | williamsyb/mycookbook | train | 2 | |
0e8618c936db639ed59fb3c650d117924a65f14e | [
"try:\n return data_api.get_by_id(pk, request.user)\nexcept exceptions.DoesNotExist:\n raise Http404",
"try:\n return user_api.get_user_by_id(user_id)\nexcept exceptions.DoesNotExist:\n raise Http404",
"try:\n data_object = self.get_object(request, pk)\n user_object = self.get_user(user_id)\n ... | <|body_start_0|>
try:
return data_api.get_by_id(pk, request.user)
except exceptions.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
try:
return user_api.get_user_by_id(user_id)
except exceptions.DoesNotExist:
raise Http404
<|en... | Change the Owner of a data | DataChangeOwner | [
"NIST-Software"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataChangeOwner:
"""Change the Owner of a data"""
def get_object(self, request, pk):
"""Get data from db Args: request: HTTP request pk: ObjectId Returns: Data"""
<|body_0|>
def get_user(self, user_id):
"""Retrieve a User Args: user_id: ObjectId Returns: - code: ... | stack_v2_sparse_classes_75kplus_train_067924 | 37,144 | permissive | [
{
"docstring": "Get data from db Args: request: HTTP request pk: ObjectId Returns: Data",
"name": "get_object",
"signature": "def get_object(self, request, pk)"
},
{
"docstring": "Retrieve a User Args: user_id: ObjectId Returns: - code: 404 content: Object was not found",
"name": "get_user",... | 3 | stack_v2_sparse_classes_30k_train_047579 | Implement the Python class `DataChangeOwner` described below.
Class description:
Change the Owner of a data
Method signatures and docstrings:
- def get_object(self, request, pk): Get data from db Args: request: HTTP request pk: ObjectId Returns: Data
- def get_user(self, user_id): Retrieve a User Args: user_id: Objec... | Implement the Python class `DataChangeOwner` described below.
Class description:
Change the Owner of a data
Method signatures and docstrings:
- def get_object(self, request, pk): Get data from db Args: request: HTTP request pk: ObjectId Returns: Data
- def get_user(self, user_id): Retrieve a User Args: user_id: Objec... | f032036d95076f92b164389fdbec7415567e7b0f | <|skeleton|>
class DataChangeOwner:
"""Change the Owner of a data"""
def get_object(self, request, pk):
"""Get data from db Args: request: HTTP request pk: ObjectId Returns: Data"""
<|body_0|>
def get_user(self, user_id):
"""Retrieve a User Args: user_id: ObjectId Returns: - code: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataChangeOwner:
"""Change the Owner of a data"""
def get_object(self, request, pk):
"""Get data from db Args: request: HTTP request pk: ObjectId Returns: Data"""
try:
return data_api.get_by_id(pk, request.user)
except exceptions.DoesNotExist:
raise Http404... | the_stack_v2_python_sparse | core_main_app/rest/data/views.py | usnistgov/core_main_app | train | 3 |
d0928ccf84f9aaec11ccdd9fe6234f43d8f243d6 | [
"m = 1000000007\ntotal = 0\nn = len(array)\nfor i in range(n):\n for j in range(n):\n if i != j:\n curr = bin(array[i] ^ array[j])[2:].count('1')\n total = (total + curr % m) % m\nreturn total",
"m = 1000000007\ntotal = 0\nn = len(array)\nfor i in range(32):\n mask = 1 << i\n ... | <|body_start_0|>
m = 1000000007
total = 0
n = len(array)
for i in range(n):
for j in range(n):
if i != j:
curr = bin(array[i] ^ array[j])[2:].count('1')
total = (total + curr % m) % m
return total
<|end_body_0|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def diff_bits_sum_brute(self, array):
"""Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(array)."""
<|body_0|>
def diff_bits_sum(self, array):
"""Bit manipulation improved algorithm. Time complexity: O(n). Space complexity... | stack_v2_sparse_classes_75kplus_train_067925 | 1,614 | no_license | [
{
"docstring": "Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(array).",
"name": "diff_bits_sum_brute",
"signature": "def diff_bits_sum_brute(self, array)"
},
{
"docstring": "Bit manipulation improved algorithm. Time complexity: O(n). Space complexity: O(1), n... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def diff_bits_sum_brute(self, array): Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(array).
- def diff_bits_sum(self, array): Bit manipulatio... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def diff_bits_sum_brute(self, array): Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(array).
- def diff_bits_sum(self, array): Bit manipulatio... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def diff_bits_sum_brute(self, array):
"""Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(array)."""
<|body_0|>
def diff_bits_sum(self, array):
"""Bit manipulation improved algorithm. Time complexity: O(n). Space complexity... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def diff_bits_sum_brute(self, array):
"""Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(array)."""
m = 1000000007
total = 0
n = len(array)
for i in range(n):
for j in range(n):
if i != j:
... | the_stack_v2_python_sparse | Bit_Manipulation/total_hamming_distance.py | vladn90/Algorithms | train | 0 | |
3dc125a9d5996cd1cc45f46831c21983c7cfefd1 | [
"if not isinstance(node.func, ast.Attribute) or node.func.attr != 'create_model':\n return False\nreturn any((keyword.arg in {'serializer', 'deserializer'} for keyword in node.keywords))",
"i = 0\nwhile i < len(node.keywords):\n keyword = node.keywords[i]\n if keyword.arg in {'serializer', 'deserializer'... | <|body_start_0|>
if not isinstance(node.func, ast.Attribute) or node.func.attr != 'create_model':
return False
return any((keyword.arg in {'serializer', 'deserializer'} for keyword in node.keywords))
<|end_body_0|>
<|body_start_1|>
i = 0
while i < len(node.keywords):
... | A class to remove Serde-related keyword arguments from call expressions. | SerdeKeywordRemover | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SerdeKeywordRemover:
"""A class to remove Serde-related keyword arguments from call expressions."""
def node_should_be_modified(self, node):
"""Checks if the ``ast.Call`` node uses deprecated keywords. In particular, this function checks if: - The ``ast.Call`` represents the ``create... | stack_v2_sparse_classes_75kplus_train_067926 | 17,894 | permissive | [
{
"docstring": "Checks if the ``ast.Call`` node uses deprecated keywords. In particular, this function checks if: - The ``ast.Call`` represents the ``create_model`` method. - Either the serializer or deserializer keywords are used. Args: node (ast.Call): a node that represents a function call. For more, see htt... | 2 | stack_v2_sparse_classes_30k_train_030704 | Implement the Python class `SerdeKeywordRemover` described below.
Class description:
A class to remove Serde-related keyword arguments from call expressions.
Method signatures and docstrings:
- def node_should_be_modified(self, node): Checks if the ``ast.Call`` node uses deprecated keywords. In particular, this funct... | Implement the Python class `SerdeKeywordRemover` described below.
Class description:
A class to remove Serde-related keyword arguments from call expressions.
Method signatures and docstrings:
- def node_should_be_modified(self, node): Checks if the ``ast.Call`` node uses deprecated keywords. In particular, this funct... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class SerdeKeywordRemover:
"""A class to remove Serde-related keyword arguments from call expressions."""
def node_should_be_modified(self, node):
"""Checks if the ``ast.Call`` node uses deprecated keywords. In particular, this function checks if: - The ``ast.Call`` represents the ``create... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SerdeKeywordRemover:
"""A class to remove Serde-related keyword arguments from call expressions."""
def node_should_be_modified(self, node):
"""Checks if the ``ast.Call`` node uses deprecated keywords. In particular, this function checks if: - The ``ast.Call`` represents the ``create_model`` meth... | the_stack_v2_python_sparse | src/sagemaker/cli/compatibility/v2/modifiers/serde.py | aws/sagemaker-python-sdk | train | 2,050 |
7f17220bdc515fdeb651e91c932625f9dd41b390 | [
"ThresholdStrategy.__init__(self, **kwargs)\nself._kernel_size = kwargs.get('kernel_size', (3, 3))\nself._gain = kwargs.get('gain')\nself._n_sigma_b = kwargs.get('n_sigma_b', 6)\nself._n_sigma_s = kwargs.get('n_sigma_s', 3)\nself._min_count = kwargs.get('min_count', 2)\nself._threshold = kwargs.get('global_threshol... | <|body_start_0|>
ThresholdStrategy.__init__(self, **kwargs)
self._kernel_size = kwargs.get('kernel_size', (3, 3))
self._gain = kwargs.get('gain')
self._n_sigma_b = kwargs.get('n_sigma_b', 6)
self._n_sigma_s = kwargs.get('n_sigma_s', 3)
self._min_count = kwargs.get('min_co... | A class implementing a 'gain' threshold. | DispersionThresholdStrategy | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DispersionThresholdStrategy:
"""A class implementing a 'gain' threshold."""
def __init__(self, **kwargs):
"""Set the threshold algorithm up"""
<|body_0|>
def __call__(self, image, mask):
"""Call the thresholding function :param image: The image to process :param ... | stack_v2_sparse_classes_75kplus_train_067927 | 4,405 | permissive | [
{
"docstring": "Set the threshold algorithm up",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Call the thresholding function :param image: The image to process :param mask: The mask to use :return: The thresholded image",
"name": "__call__",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_028986 | Implement the Python class `DispersionThresholdStrategy` described below.
Class description:
A class implementing a 'gain' threshold.
Method signatures and docstrings:
- def __init__(self, **kwargs): Set the threshold algorithm up
- def __call__(self, image, mask): Call the thresholding function :param image: The ima... | Implement the Python class `DispersionThresholdStrategy` described below.
Class description:
A class implementing a 'gain' threshold.
Method signatures and docstrings:
- def __init__(self, **kwargs): Set the threshold algorithm up
- def __call__(self, image, mask): Call the thresholding function :param image: The ima... | 88bf7f7c5ac44defc046ebf0719cde748092cfff | <|skeleton|>
class DispersionThresholdStrategy:
"""A class implementing a 'gain' threshold."""
def __init__(self, **kwargs):
"""Set the threshold algorithm up"""
<|body_0|>
def __call__(self, image, mask):
"""Call the thresholding function :param image: The image to process :param ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DispersionThresholdStrategy:
"""A class implementing a 'gain' threshold."""
def __init__(self, **kwargs):
"""Set the threshold algorithm up"""
ThresholdStrategy.__init__(self, **kwargs)
self._kernel_size = kwargs.get('kernel_size', (3, 3))
self._gain = kwargs.get('gain')
... | the_stack_v2_python_sparse | src/dials/algorithms/spot_finding/threshold.py | dials/dials | train | 71 |
4abf5414f8c08d40345ef602bc57dae6cd0bd240 | [
"try:\n result = ServiceManager(cbid).run_chatbot_with_file(request.FILES)\n return Response(json.dumps(result))\nexcept Exception as e:\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))",
"try:\n self.init_time = datetime.datetime.now()\n print('Star... | <|body_start_0|>
try:
result = ServiceManager(cbid).run_chatbot_with_file(request.FILES)
return Response(json.dumps(result))
except Exception as e:
return_data = {'status': '404', 'result': str(e)}
return Response(json.dumps(return_data))
<|end_body_0|>
<... | ChatbotServiceManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChatbotServiceManager:
def post(self, request, cbid):
"""Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description goes here"""
<|body_0|>
def put(self, request, cbid):
"""Your docs --- # Class Name (must... | stack_v2_sparse_classes_75kplus_train_067928 | 2,147 | permissive | [
{
"docstring": "Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description goes here",
"name": "post",
"signature": "def post(self, request, cbid)"
},
{
"docstring": "Your docs --- # Class Name (must be separated by `---`) # Descripti... | 2 | stack_v2_sparse_classes_30k_train_039738 | Implement the Python class `ChatbotServiceManager` described below.
Class description:
Implement the ChatbotServiceManager class.
Method signatures and docstrings:
- def post(self, request, cbid): Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description ... | Implement the Python class `ChatbotServiceManager` described below.
Class description:
Implement the ChatbotServiceManager class.
Method signatures and docstrings:
- def post(self, request, cbid): Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description ... | 6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f | <|skeleton|>
class ChatbotServiceManager:
def post(self, request, cbid):
"""Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description goes here"""
<|body_0|>
def put(self, request, cbid):
"""Your docs --- # Class Name (must... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChatbotServiceManager:
def post(self, request, cbid):
"""Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description goes here"""
try:
result = ServiceManager(cbid).run_chatbot_with_file(request.FILES)
return ... | the_stack_v2_python_sparse | api/views/chatbot_service_manager.py | yurimkoo/tensormsa | train | 1 | |
1b5cc9845e549e1be584d246b375293b6d76be38 | [
"keys = self.getKeys(value)\nif len(keys) > 0:\n return keys[0]\nelse:\n return None",
"keys = []\nfor key, keyedValue in self.items():\n if keyedValue == value:\n keys.append(key)\n continue\nkeys.sort()\nreturn keys"
] | <|body_start_0|>
keys = self.getKeys(value)
if len(keys) > 0:
return keys[0]
else:
return None
<|end_body_0|>
<|body_start_1|>
keys = []
for key, keyedValue in self.items():
if keyedValue == value:
keys.append(key)
... | ValueDict | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValueDict:
def getFirstKey(self, value):
"""Return the first key that has the specified value, returns None if the value can't be found."""
<|body_0|>
def getKeys(self, value):
"""Return a sorted list of keys that have the specified value. Returns an empty list if th... | stack_v2_sparse_classes_75kplus_train_067929 | 733 | no_license | [
{
"docstring": "Return the first key that has the specified value, returns None if the value can't be found.",
"name": "getFirstKey",
"signature": "def getFirstKey(self, value)"
},
{
"docstring": "Return a sorted list of keys that have the specified value. Returns an empty list if the value isn'... | 2 | stack_v2_sparse_classes_30k_train_011792 | Implement the Python class `ValueDict` described below.
Class description:
Implement the ValueDict class.
Method signatures and docstrings:
- def getFirstKey(self, value): Return the first key that has the specified value, returns None if the value can't be found.
- def getKeys(self, value): Return a sorted list of k... | Implement the Python class `ValueDict` described below.
Class description:
Implement the ValueDict class.
Method signatures and docstrings:
- def getFirstKey(self, value): Return the first key that has the specified value, returns None if the value can't be found.
- def getKeys(self, value): Return a sorted list of k... | fa3e3fa061833f04d9a21fa3c29580259243841a | <|skeleton|>
class ValueDict:
def getFirstKey(self, value):
"""Return the first key that has the specified value, returns None if the value can't be found."""
<|body_0|>
def getKeys(self, value):
"""Return a sorted list of keys that have the specified value. Returns an empty list if th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ValueDict:
def getFirstKey(self, value):
"""Return the first key that has the specified value, returns None if the value can't be found."""
keys = self.getKeys(value)
if len(keys) > 0:
return keys[0]
else:
return None
def getKeys(self, value):
... | the_stack_v2_python_sparse | Server/ipl/types/ValueDict.py | shabnamparsa-stemcell/RoboSep-STest | train | 1 | |
f1d61fa611cc283b196ea7dd2bf11061bd0907f5 | [
"self.n_estimators = n_estimators\nself.criteron = criterion\nself.max_depth = max_depth\nself.models = []\nself.col_names = []\nself.X = None\nself.y = None",
"N, col = X.shape\nfor i in range(self.n_estimators):\n base = DecisionTree(criterion=self.criteron)\n base.output = 'discrete'\n base.input = 'r... | <|body_start_0|>
self.n_estimators = n_estimators
self.criteron = criterion
self.max_depth = max_depth
self.models = []
self.col_names = []
self.X = None
self.y = None
<|end_body_0|>
<|body_start_1|>
N, col = X.shape
for i in range(self.n_estimato... | RandomForestClassifier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomForestClassifier:
def __init__(self, n_estimators=100, criterion='gini', max_depth=100):
""":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth ... | stack_v2_sparse_classes_75kplus_train_067930 | 7,799 | no_license | [
{
"docstring": ":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth of the tree.",
"name": "__init__",
"signature": "def __init__(self, n_estimators=100, criterion='g... | 4 | stack_v2_sparse_classes_30k_train_025101 | Implement the Python class `RandomForestClassifier` described below.
Class description:
Implement the RandomForestClassifier class.
Method signatures and docstrings:
- def __init__(self, n_estimators=100, criterion='gini', max_depth=100): :param estimators: DecisionTree :param n_estimators: The number of trees in the... | Implement the Python class `RandomForestClassifier` described below.
Class description:
Implement the RandomForestClassifier class.
Method signatures and docstrings:
- def __init__(self, n_estimators=100, criterion='gini', max_depth=100): :param estimators: DecisionTree :param n_estimators: The number of trees in the... | 18e4733e1bf7713502cce514e1cf7e587b35ca5c | <|skeleton|>
class RandomForestClassifier:
def __init__(self, n_estimators=100, criterion='gini', max_depth=100):
""":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomForestClassifier:
def __init__(self, n_estimators=100, criterion='gini', max_depth=100):
""":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth of the tree.""... | the_stack_v2_python_sparse | assignment-2-jatinkumar762/tree/randomForest.py | jatinkumar762/MachineLearning | train | 0 | |
b763c1f00360f50874b7c0565f4f64de8f386e5f | [
"self.value = value\nself.left = left\nself.right = right",
"sub = []\nif self.left:\n sub = sub + self.left.deconstruct(level + '@')\nif self.right:\n sub = sub + self.right.deconstruct(level + '@')\nreturn [level] + [self.value] + sub",
"treeInString = self.deconstruct()\nlayers = {}\nfor e in treeInStr... | <|body_start_0|>
self.value = value
self.left = left
self.right = right
<|end_body_0|>
<|body_start_1|>
sub = []
if self.left:
sub = sub + self.left.deconstruct(level + '@')
if self.right:
sub = sub + self.right.deconstruct(level + '@')
re... | Node class for a binary tree. | Node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
"""Node class for a binary tree."""
def __init__(self, value, left=None, right=None):
"""Initialize the node."""
<|body_0|>
def deconstruct(self, level='@'):
"""Deconstruct the binary tree into a string."""
<|body_1|>
def printLevelWise(self):
... | stack_v2_sparse_classes_75kplus_train_067931 | 1,627 | no_license | [
{
"docstring": "Initialize the node.",
"name": "__init__",
"signature": "def __init__(self, value, left=None, right=None)"
},
{
"docstring": "Deconstruct the binary tree into a string.",
"name": "deconstruct",
"signature": "def deconstruct(self, level='@')"
},
{
"docstring": "Pri... | 3 | stack_v2_sparse_classes_30k_train_046900 | Implement the Python class `Node` described below.
Class description:
Node class for a binary tree.
Method signatures and docstrings:
- def __init__(self, value, left=None, right=None): Initialize the node.
- def deconstruct(self, level='@'): Deconstruct the binary tree into a string.
- def printLevelWise(self): Prin... | Implement the Python class `Node` described below.
Class description:
Node class for a binary tree.
Method signatures and docstrings:
- def __init__(self, value, left=None, right=None): Initialize the node.
- def deconstruct(self, level='@'): Deconstruct the binary tree into a string.
- def printLevelWise(self): Prin... | 97eae3ee806756f4d646d600f434b1e68164ad34 | <|skeleton|>
class Node:
"""Node class for a binary tree."""
def __init__(self, value, left=None, right=None):
"""Initialize the node."""
<|body_0|>
def deconstruct(self, level='@'):
"""Deconstruct the binary tree into a string."""
<|body_1|>
def printLevelWise(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Node:
"""Node class for a binary tree."""
def __init__(self, value, left=None, right=None):
"""Initialize the node."""
self.value = value
self.left = left
self.right = right
def deconstruct(self, level='@'):
"""Deconstruct the binary tree into a string."""
... | the_stack_v2_python_sparse | Python/2019_05_02_Problem_107_Print_Binary_Tree_Level_Wise.py | BaoCaiH/Daily_Coding_Problem | train | 0 |
f4a38c48a18c88951caf257ed339e8a94031e9ab | [
"cur = dummy = ListNode('X')\nwhile A and B:\n if A.val < B.val:\n cur.next, A = (A, A.next)\n else:\n cur.next, B = (B, B.next)\n cur = cur.next\ncur.next = A if A else B\nreturn dummy.next",
"if head.next:\n fast, slow, prev = (head, head, None)\n while fast is not None and fast.nex... | <|body_start_0|>
cur = dummy = ListNode('X')
while A and B:
if A.val < B.val:
cur.next, A = (A, A.next)
else:
cur.next, B = (B, B.next)
cur = cur.next
cur.next = A if A else B
return dummy.next
<|end_body_0|>
<|body_sta... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergesort(self, A, B):
"""merge two sorted linked list into one linked list"""
<|body_0|>
def divide(self, head):
"""divide a linked list into half and break the linkage in between only divide a linked list that has 2 element and more"""
<|body_... | stack_v2_sparse_classes_75kplus_train_067932 | 2,038 | permissive | [
{
"docstring": "merge two sorted linked list into one linked list",
"name": "mergesort",
"signature": "def mergesort(self, A, B)"
},
{
"docstring": "divide a linked list into half and break the linkage in between only divide a linked list that has 2 element and more",
"name": "divide",
"... | 3 | stack_v2_sparse_classes_30k_train_036848 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergesort(self, A, B): merge two sorted linked list into one linked list
- def divide(self, head): divide a linked list into half and break the linkage in between only divide... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergesort(self, A, B): merge two sorted linked list into one linked list
- def divide(self, head): divide a linked list into half and break the linkage in between only divide... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class Solution:
def mergesort(self, A, B):
"""merge two sorted linked list into one linked list"""
<|body_0|>
def divide(self, head):
"""divide a linked list into half and break the linkage in between only divide a linked list that has 2 element and more"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergesort(self, A, B):
"""merge two sorted linked list into one linked list"""
cur = dummy = ListNode('X')
while A and B:
if A.val < B.val:
cur.next, A = (A, A.next)
else:
cur.next, B = (B, B.next)
cur = ... | the_stack_v2_python_sparse | LeetCode/LC148_sort_list.py | jxie0755/Learning_Python | train | 0 | |
8802a93310830ba217ddd562a326b57c8c90749f | [
"self.p = hyp\nself.pop = []\nself.species = []\nself.innov = []\nself.gen = 0\nself.indType = Ind",
"if len(self.pop) == 0:\n self.initPop()\nelse:\n self.probMoo()\n self.speciate()\n self.evolvePop()\nreturn self.pop",
"for i in range(np.shape(reward)[0]):\n self.pop[i].fitness = reward[i]\n ... | <|body_start_0|>
self.p = hyp
self.pop = []
self.species = []
self.innov = []
self.gen = 0
self.indType = Ind
<|end_body_0|>
<|body_start_1|>
if len(self.pop) == 0:
self.initPop()
else:
self.probMoo()
self.speciate()
... | NEAT main class. Evolves population given fitness values of individuals. | Neat | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Neat:
"""NEAT main class. Evolves population given fitness values of individuals."""
def __init__(self, hyp):
"""Intialize NEAT algorithm with hyperparameters Args: hyp - (dict) - algorithm hyperparameters Attributes: p - (dict) - algorithm hyperparameters (see p/hypkey.txt) pop - (I... | stack_v2_sparse_classes_75kplus_train_067933 | 6,341 | permissive | [
{
"docstring": "Intialize NEAT algorithm with hyperparameters Args: hyp - (dict) - algorithm hyperparameters Attributes: p - (dict) - algorithm hyperparameters (see p/hypkey.txt) pop - (Ind) - Current population species - (Species) - Current species innov - (np_array) - innovation record [5 X nUniqueGenes] [0,:... | 5 | stack_v2_sparse_classes_30k_train_002592 | Implement the Python class `Neat` described below.
Class description:
NEAT main class. Evolves population given fitness values of individuals.
Method signatures and docstrings:
- def __init__(self, hyp): Intialize NEAT algorithm with hyperparameters Args: hyp - (dict) - algorithm hyperparameters Attributes: p - (dict... | Implement the Python class `Neat` described below.
Class description:
NEAT main class. Evolves population given fitness values of individuals.
Method signatures and docstrings:
- def __init__(self, hyp): Intialize NEAT algorithm with hyperparameters Args: hyp - (dict) - algorithm hyperparameters Attributes: p - (dict... | fc46c4936d977179b1525ed7e0f4885e27a8898b | <|skeleton|>
class Neat:
"""NEAT main class. Evolves population given fitness values of individuals."""
def __init__(self, hyp):
"""Intialize NEAT algorithm with hyperparameters Args: hyp - (dict) - algorithm hyperparameters Attributes: p - (dict) - algorithm hyperparameters (see p/hypkey.txt) pop - (I... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Neat:
"""NEAT main class. Evolves population given fitness values of individuals."""
def __init__(self, hyp):
"""Intialize NEAT algorithm with hyperparameters Args: hyp - (dict) - algorithm hyperparameters Attributes: p - (dict) - algorithm hyperparameters (see p/hypkey.txt) pop - (Ind) - Current... | the_stack_v2_python_sparse | neat_src/neat.py | duynguyen158/wann-nlp | train | 1 |
beedbc76faf40f2e6b2533eb151d1ec92c7b9bff | [
"super(Listwise, self).__init__()\nself.input_dim = input_dim\nself.n_hidden = n_hidden\nself.output_dim = output_dim\nself.fc1 = nn.Linear(self.input_dim, self.n_hidden)\nself.fc2 = nn.Linear(self.n_hidden, self.output_dim)\nself.relu = nn.ReLU()\nself.sigmoid = nn.Sigmoid()",
"h_i = self.sigmoid(self.fc1(x_batc... | <|body_start_0|>
super(Listwise, self).__init__()
self.input_dim = input_dim
self.n_hidden = n_hidden
self.output_dim = output_dim
self.fc1 = nn.Linear(self.input_dim, self.n_hidden)
self.fc2 = nn.Linear(self.n_hidden, self.output_dim)
self.relu = nn.ReLU()
... | Listwise LTR model | Listwise | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Listwise:
"""Listwise LTR model"""
def __init__(self, input_dim, n_hidden=128, output_dim=1):
"""Initialize model input_dim: dimensionality of document feature vector n_hidden: dimensionality of hidden layer n_outputs: output dimensionality"""
<|body_0|>
def forward(self... | stack_v2_sparse_classes_75kplus_train_067934 | 13,112 | no_license | [
{
"docstring": "Initialize model input_dim: dimensionality of document feature vector n_hidden: dimensionality of hidden layer n_outputs: output dimensionality",
"name": "__init__",
"signature": "def __init__(self, input_dim, n_hidden=128, output_dim=1)"
},
{
"docstring": "Forward pass - x: batc... | 5 | null | Implement the Python class `Listwise` described below.
Class description:
Listwise LTR model
Method signatures and docstrings:
- def __init__(self, input_dim, n_hidden=128, output_dim=1): Initialize model input_dim: dimensionality of document feature vector n_hidden: dimensionality of hidden layer n_outputs: output d... | Implement the Python class `Listwise` described below.
Class description:
Listwise LTR model
Method signatures and docstrings:
- def __init__(self, input_dim, n_hidden=128, output_dim=1): Initialize model input_dim: dimensionality of document feature vector n_hidden: dimensionality of hidden layer n_outputs: output d... | 39fcf9af8d0f19fa688b189788f40d2c0e332f7c | <|skeleton|>
class Listwise:
"""Listwise LTR model"""
def __init__(self, input_dim, n_hidden=128, output_dim=1):
"""Initialize model input_dim: dimensionality of document feature vector n_hidden: dimensionality of hidden layer n_outputs: output dimensionality"""
<|body_0|>
def forward(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Listwise:
"""Listwise LTR model"""
def __init__(self, input_dim, n_hidden=128, output_dim=1):
"""Initialize model input_dim: dimensionality of document feature vector n_hidden: dimensionality of hidden layer n_outputs: output dimensionality"""
super(Listwise, self).__init__()
self... | the_stack_v2_python_sparse | practical3/listwise_ltr/listwise_ltr.py | Tom-Lotze/Information_retrieval | train | 0 |
92007de2dbf804ea7f42be3bc6c02559e3186034 | [
"azimuth = self.random.uniform(0, 2 * np.pi)\norientation = np.array((np.cos(azimuth / 2), 0, 0, np.sin(azimuth / 2)))\nspawn_radius = 0.9 * physics.named.model.geom_size['floor', 0]\nx_pos, y_pos = self.random.uniform(-spawn_radius, spawn_radius, size=(2,))\n_find_non_contacting_height(physics, orientation, x_pos,... | <|body_start_0|>
azimuth = self.random.uniform(0, 2 * np.pi)
orientation = np.array((np.cos(azimuth / 2), 0, 0, np.sin(azimuth / 2)))
spawn_radius = 0.9 * physics.named.model.geom_size['floor', 0]
x_pos, y_pos = self.random.uniform(-spawn_radius, spawn_radius, size=(2,))
_find_no... | A quadruped task solved by bringing a ball to the origin. | Fetch | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fetch:
"""A quadruped task solved by bringing a ball to the origin."""
def initialize_episode(self, physics):
"""Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`."""
<|body_0|>
def get_observation(self, physics):
... | stack_v2_sparse_classes_75kplus_train_067935 | 17,995 | permissive | [
{
"docstring": "Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`.",
"name": "initialize_episode",
"signature": "def initialize_episode(self, physics)"
},
{
"docstring": "Returns an observation to the agent.",
"name": "get_observation",
... | 3 | stack_v2_sparse_classes_30k_train_001227 | Implement the Python class `Fetch` described below.
Class description:
A quadruped task solved by bringing a ball to the origin.
Method signatures and docstrings:
- def initialize_episode(self, physics): Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`.
- def get... | Implement the Python class `Fetch` described below.
Class description:
A quadruped task solved by bringing a ball to the origin.
Method signatures and docstrings:
- def initialize_episode(self, physics): Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`.
- def get... | 33d3ea2682409ee82bf9c5129ceaf06ab01cd48e | <|skeleton|>
class Fetch:
"""A quadruped task solved by bringing a ball to the origin."""
def initialize_episode(self, physics):
"""Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`."""
<|body_0|>
def get_observation(self, physics):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Fetch:
"""A quadruped task solved by bringing a ball to the origin."""
def initialize_episode(self, physics):
"""Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`."""
azimuth = self.random.uniform(0, 2 * np.pi)
orientation = np... | the_stack_v2_python_sparse | src/env/dm_control/dm_control/suite/quadruped.py | nicklashansen/svea-vit | train | 16 |
ff15ba85ee46dfa88d0cb19d24bbf118579d5d60 | [
"utils.check_admin()\ndata_id = slugify(data_id, separator='_')\nclick.echo(f\"`data_id` set to: {click.style(data_id, fg='green')}\")\ninstance = api.get_instance(model, identifier)\nif data_id in instance['reference_data']:\n raise click.UsageError(f'''{instance['name']} has already reference data registered w... | <|body_start_0|>
utils.check_admin()
data_id = slugify(data_id, separator='_')
click.echo(f"`data_id` set to: {click.style(data_id, fg='green')}")
instance = api.get_instance(model, identifier)
if data_id in instance['reference_data']:
raise click.UsageError(f'''{inst... | An import engine for assemblies' reference_data. | LocalReferenceDataImporter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalReferenceDataImporter:
"""An import engine for assemblies' reference_data."""
def import_data(cls, identifier, data_src, data_id, symlink, description, sub_dir=None, model='assemblies'):
"""Register reference resources for a given assembly. Arguments: identifier (str): name of a... | stack_v2_sparse_classes_75kplus_train_067936 | 34,431 | no_license | [
{
"docstring": "Register reference resources for a given assembly. Arguments: identifier (str): name of assembly or technique. model (str): either `techniques` or `assemblies`. data_src (str): path to reference data. data_id (str): identifier that will be used for reference data. symlink (str): symlink instead ... | 2 | stack_v2_sparse_classes_30k_test_000465 | Implement the Python class `LocalReferenceDataImporter` described below.
Class description:
An import engine for assemblies' reference_data.
Method signatures and docstrings:
- def import_data(cls, identifier, data_src, data_id, symlink, description, sub_dir=None, model='assemblies'): Register reference resources for... | Implement the Python class `LocalReferenceDataImporter` described below.
Class description:
An import engine for assemblies' reference_data.
Method signatures and docstrings:
- def import_data(cls, identifier, data_src, data_id, symlink, description, sub_dir=None, model='assemblies'): Register reference resources for... | 21f3d1575b6e768869b818ee5213e717258eb769 | <|skeleton|>
class LocalReferenceDataImporter:
"""An import engine for assemblies' reference_data."""
def import_data(cls, identifier, data_src, data_id, symlink, description, sub_dir=None, model='assemblies'):
"""Register reference resources for a given assembly. Arguments: identifier (str): name of a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LocalReferenceDataImporter:
"""An import engine for assemblies' reference_data."""
def import_data(cls, identifier, data_src, data_id, symlink, description, sub_dir=None, model='assemblies'):
"""Register reference resources for a given assembly. Arguments: identifier (str): name of assembly or te... | the_stack_v2_python_sparse | cli/isabl_cli/data.py | danielavarelat/cli_apps_isabl | train | 0 |
a8fa1368f96eee4aa49a7d3b0bb5b4b7c02a3323 | [
"if len(nodeData) != n or not self._goodNodeData(nodeData):\n raise BadNodeDataException()\nelse:\n WeightedListGraph.__init__(self, n, nodeData)",
"for val in nodeData:\n if not (type(val) == tuple or type(val) == list):\n return False\n elif len(val) != 2:\n return False\n else:\n ... | <|body_start_0|>
if len(nodeData) != n or not self._goodNodeData(nodeData):
raise BadNodeDataException()
else:
WeightedListGraph.__init__(self, n, nodeData)
<|end_body_0|>
<|body_start_1|>
for val in nodeData:
if not (type(val) == tuple or type(val) == list):... | The purpose of this subclass is to require the user to provide the required data for each node, which must be a coordinate pair, either from some arbitrary global coordinate system, or based on GPS values | MapGraph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MapGraph:
"""The purpose of this subclass is to require the user to provide the required data for each node, which must be a coordinate pair, either from some arbitrary global coordinate system, or based on GPS values"""
def __init__(self, n, nodeData):
"""Takes the number of nodes i... | stack_v2_sparse_classes_75kplus_train_067937 | 2,754 | no_license | [
{
"docstring": "Takes the number of nodes in the graph, plus a list of node data. The list MUST be the same length as the number of nodes, and each value must be a pair of numbers giving the location in the world of the related node. If it is not, then an exception is raised.",
"name": "__init__",
"sign... | 4 | stack_v2_sparse_classes_30k_train_025295 | Implement the Python class `MapGraph` described below.
Class description:
The purpose of this subclass is to require the user to provide the required data for each node, which must be a coordinate pair, either from some arbitrary global coordinate system, or based on GPS values
Method signatures and docstrings:
- def... | Implement the Python class `MapGraph` described below.
Class description:
The purpose of this subclass is to require the user to provide the required data for each node, which must be a coordinate pair, either from some arbitrary global coordinate system, or based on GPS values
Method signatures and docstrings:
- def... | 97bb378a325b1639110de06b88d6e237dffc7330 | <|skeleton|>
class MapGraph:
"""The purpose of this subclass is to require the user to provide the required data for each node, which must be a coordinate pair, either from some arbitrary global coordinate system, or based on GPS values"""
def __init__(self, n, nodeData):
"""Takes the number of nodes i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MapGraph:
"""The purpose of this subclass is to require the user to provide the required data for each node, which must be a coordinate pair, either from some arbitrary global coordinate system, or based on GPS values"""
def __init__(self, n, nodeData):
"""Takes the number of nodes in the graph, ... | the_stack_v2_python_sparse | src/match_seeker/scripts/olri_classifier/DataManipulations/MapGraph.py | FoxRobotLab/catkin_ws | train | 6 |
7fe201b8cafa83bf4ccc9bc6b45d52575bb3e711 | [
"def max_branch(root):\n if not root:\n return 0\n return max([len(root.children)] + [max_branch(ch) for ch in root.children])\nn = max_branch(root)\n\ndef recur(root):\n if not root:\n return ['#']\n ret = [str(root.val)]\n children = root.children\n if len(children) < n:\n c... | <|body_start_0|>
def max_branch(root):
if not root:
return 0
return max([len(root.children)] + [max_branch(ch) for ch in root.children])
n = max_branch(root)
def recur(root):
if not root:
return ['#']
ret = [str(roo... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_067938 | 1,939 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | stack_v2_sparse_classes_30k_train_048559 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 2722c0deafcd094ce64140a9a837b4027d29ed6f | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
def max_branch(root):
if not root:
return 0
return max([len(root.children)] + [max_branch(ch) for ch in root.children])
n = max_branch(root)
... | the_stack_v2_python_sparse | 428_deser_n_ary_tree_h/main.py | chao-shi/lclc | train | 0 | |
3aa2e60c1c63593e1423abf0ea024be82227636c | [
"try:\n object_list = data_structure_api.get_all_by_user(request.user)\n serializer = self.serializer(object_list, many=True)\n return Response(serializer.data, status=status.HTTP_200_OK)\nexcept Exception as api_exception:\n content = {'message': str(api_exception)}\n return Response(content, status... | <|body_start_0|>
try:
object_list = data_structure_api.get_all_by_user(request.user)
serializer = self.serializer(object_list, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
except Exception as api_exception:
content = {'message': s... | List Curate Data Structure by user, create a new one. | CurateDataStructureList | [
"BSD-3-Clause",
"NIST-Software"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CurateDataStructureList:
"""List Curate Data Structure by user, create a new one."""
def get(self, request):
"""Get all user Curate Data Structure Args: request: HTTP request Returns: - code: 200 content: List of curate data structure - code: 403 content: Forbidden - code: 500 conten... | stack_v2_sparse_classes_75kplus_train_067939 | 11,996 | permissive | [
{
"docstring": "Get all user Curate Data Structure Args: request: HTTP request Returns: - code: 200 content: List of curate data structure - code: 403 content: Forbidden - code: 500 content: Internal server error",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Create a ... | 2 | stack_v2_sparse_classes_30k_test_002840 | Implement the Python class `CurateDataStructureList` described below.
Class description:
List Curate Data Structure by user, create a new one.
Method signatures and docstrings:
- def get(self, request): Get all user Curate Data Structure Args: request: HTTP request Returns: - code: 200 content: List of curate data st... | Implement the Python class `CurateDataStructureList` described below.
Class description:
List Curate Data Structure by user, create a new one.
Method signatures and docstrings:
- def get(self, request): Get all user Curate Data Structure Args: request: HTTP request Returns: - code: 200 content: List of curate data st... | 77e9faf6b930d8bb84175a8c2de486b0536582ba | <|skeleton|>
class CurateDataStructureList:
"""List Curate Data Structure by user, create a new one."""
def get(self, request):
"""Get all user Curate Data Structure Args: request: HTTP request Returns: - code: 200 content: List of curate data structure - code: 403 content: Forbidden - code: 500 conten... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CurateDataStructureList:
"""List Curate Data Structure by user, create a new one."""
def get(self, request):
"""Get all user Curate Data Structure Args: request: HTTP request Returns: - code: 200 content: List of curate data structure - code: 403 content: Forbidden - code: 500 content: Internal s... | the_stack_v2_python_sparse | core_curate_app/rest/curate_data_structure/views.py | usnistgov/core_curate_app | train | 0 |
d6f06dfa0aaf9a05a28434ec6d1be871c6690a2a | [
"if sport not in self.sports.keys():\n err_msg = 'update sports.game_status.GameStatus for sport: %s' % sport\n raise self.InvalidSportException(err_msg)\nself.status_map = self.sports.get(sport)",
"if status not in self.status_map.keys():\n err_msg = '%s does not exist and therefore cant have a primary ... | <|body_start_0|>
if sport not in self.sports.keys():
err_msg = 'update sports.game_status.GameStatus for sport: %s' % sport
raise self.InvalidSportException(err_msg)
self.status_map = self.sports.get(sport)
<|end_body_0|>
<|body_start_1|>
if status not in self.status_map... | for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game status like 'odelay', the method get_prima... | GameStatus | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameStatus:
"""for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game stat... | stack_v2_sparse_classes_75kplus_train_067940 | 6,302 | no_license | [
{
"docstring": ":param sport: string name of the sport you want to use the GameStatus object for. :raise InvalidSportException: if the 'sport' arg not found among top-level keys in the status map",
"name": "__init__",
"signature": "def __init__(self, sport)"
},
{
"docstring": "given a granular b... | 2 | stack_v2_sparse_classes_30k_train_016353 | Implement the Python class `GameStatus` described below.
Class description:
for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game st... | Implement the Python class `GameStatus` described below.
Class description:
for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game st... | 4796fa9d88b56f80def011e2b043ce595bfce8c4 | <|skeleton|>
class GameStatus:
"""for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game stat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameStatus:
"""for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game status like 'odel... | the_stack_v2_python_sparse | sports/game_status.py | nakamotohideyoshi/draftboard-web | train | 0 |
79891773f5c74e16e77b77a260b179e79bf8c45c | [
"logger.debug('HANDLER RUNNER ({}): Starting runner'.format(handler_name))\n_handler_callback = self._generate_callback_for_handler(handler_name)\ntpe = concurrent.futures.ThreadPoolExecutor(max_workers=4)\nwhile True:\n handler_arg = inbox.get()\n if isinstance(handler_arg, HandlerRunnerKillerSentinel):\n ... | <|body_start_0|>
logger.debug('HANDLER RUNNER ({}): Starting runner'.format(handler_name))
_handler_callback = self._generate_callback_for_handler(handler_name)
tpe = concurrent.futures.ThreadPoolExecutor(max_workers=4)
while True:
handler_arg = inbox.get()
if isi... | Handler manager for use with synchronous clients | SyncHandlerManager | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SyncHandlerManager:
"""Handler manager for use with synchronous clients"""
def _receiver_handler_runner(self, inbox, handler_name):
"""Run infinite loop that waits for an inbox to receive an object from it, then calls the handler with that object"""
<|body_0|>
def _clien... | stack_v2_sparse_classes_75kplus_train_067941 | 20,895 | permissive | [
{
"docstring": "Run infinite loop that waits for an inbox to receive an object from it, then calls the handler with that object",
"name": "_receiver_handler_runner",
"signature": "def _receiver_handler_runner(self, inbox, handler_name)"
},
{
"docstring": "Run infinite loop that waits for the cli... | 5 | stack_v2_sparse_classes_30k_train_001105 | Implement the Python class `SyncHandlerManager` described below.
Class description:
Handler manager for use with synchronous clients
Method signatures and docstrings:
- def _receiver_handler_runner(self, inbox, handler_name): Run infinite loop that waits for an inbox to receive an object from it, then calls the handl... | Implement the Python class `SyncHandlerManager` described below.
Class description:
Handler manager for use with synchronous clients
Method signatures and docstrings:
- def _receiver_handler_runner(self, inbox, handler_name): Run infinite loop that waits for an inbox to receive an object from it, then calls the handl... | 5d343d5904aaa98c6a88101e0dc40263acff4db2 | <|skeleton|>
class SyncHandlerManager:
"""Handler manager for use with synchronous clients"""
def _receiver_handler_runner(self, inbox, handler_name):
"""Run infinite loop that waits for an inbox to receive an object from it, then calls the handler with that object"""
<|body_0|>
def _clien... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SyncHandlerManager:
"""Handler manager for use with synchronous clients"""
def _receiver_handler_runner(self, inbox, handler_name):
"""Run infinite loop that waits for an inbox to receive an object from it, then calls the handler with that object"""
logger.debug('HANDLER RUNNER ({}): Star... | the_stack_v2_python_sparse | azure-iot-device/azure/iot/device/iothub/sync_handler_manager.py | Azure/azure-iot-sdk-python | train | 441 |
2c863e806bbb5c54ca3fbb9b7e1eea890a36692d | [
"values = dict()\nlength = len(rows)\nfor row in rows:\n try:\n values[row[key_A]][row[key_B]] += 1\n except KeyError:\n try:\n values[row[key_A]][row[key_B]] = 1\n except KeyError:\n values[row[key_A]] = dict()\n values[row[key_A]][row[key_B]] = 1\nentrop... | <|body_start_0|>
values = dict()
length = len(rows)
for row in rows:
try:
values[row[key_A]][row[key_B]] += 1
except KeyError:
try:
values[row[key_A]][row[key_B]] = 1
except KeyError:
... | Joint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Joint:
def bayes(key_A, key_B, rows, val_A=None, val_B=None):
"""H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }"""
<|body_0|>
def fuzzy(A, B, rows: list):
"""H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
values = dic... | stack_v2_sparse_classes_75kplus_train_067942 | 7,816 | no_license | [
{
"docstring": "H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }",
"name": "bayes",
"signature": "def bayes(key_A, key_B, rows, val_A=None, val_B=None)"
},
{
"docstring": "H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }",
"name": "fuzzy",
"signature": "def fuzzy(A, B, rows: list)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023224 | Implement the Python class `Joint` described below.
Class description:
Implement the Joint class.
Method signatures and docstrings:
- def bayes(key_A, key_B, rows, val_A=None, val_B=None): H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }
- def fuzzy(A, B, rows: list): H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] } | Implement the Python class `Joint` described below.
Class description:
Implement the Joint class.
Method signatures and docstrings:
- def bayes(key_A, key_B, rows, val_A=None, val_B=None): H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }
- def fuzzy(A, B, rows: list): H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }
<|skeleton|>
class ... | 4168dfc2f3c70bb8f6ca62fc51626cd07829f8d2 | <|skeleton|>
class Joint:
def bayes(key_A, key_B, rows, val_A=None, val_B=None):
"""H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }"""
<|body_0|>
def fuzzy(A, B, rows: list):
"""H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Joint:
def bayes(key_A, key_B, rows, val_A=None, val_B=None):
"""H(A,B) = Sum{ Sum[ P(A,B) * I(A,B) ] }"""
values = dict()
length = len(rows)
for row in rows:
try:
values[row[key_A]][row[key_B]] += 1
except KeyError:
try:
... | the_stack_v2_python_sparse | Statistics/Entropy.py | spietre/DAZZ | train | 0 | |
fa6bd1c0cf2d167aad3853155ddd0c4c20de476d | [
"self.options.update(kwargs)\nself.options['action'] = 'recording.download'\nreturn self.call(self.options)",
"self.options['type'] = 'findme'\nself.options['id'] = _id\nself.options['action'] = 'recording.list'\nreturn self.call(self.options)",
"self.options.update(kwargs)\nself.options['action'] = 'recording.... | <|body_start_0|>
self.options.update(kwargs)
self.options['action'] = 'recording.download'
return self.call(self.options)
<|end_body_0|>
<|body_start_1|>
self.options['type'] = 'findme'
self.options['id'] = _id
self.options['action'] = 'recording.list'
return sel... | Recordings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Recordings:
def download(self, **kwargs):
"""Download a specific recording keword arguments: type -- type of app to download from | 'findme' sid -- session ID of the call format -- 'wav' or 'mp3' sample_rate -- audio rate of streaming data values: 8000 (default), 11000 (wav only), 22050,... | stack_v2_sparse_classes_75kplus_train_067943 | 2,297 | permissive | [
{
"docstring": "Download a specific recording keword arguments: type -- type of app to download from | 'findme' sid -- session ID of the call format -- 'wav' or 'mp3' sample_rate -- audio rate of streaming data values: 8000 (default), 11000 (wav only), 22050, 44100",
"name": "download",
"signature": "de... | 4 | stack_v2_sparse_classes_30k_train_050692 | Implement the Python class `Recordings` described below.
Class description:
Implement the Recordings class.
Method signatures and docstrings:
- def download(self, **kwargs): Download a specific recording keword arguments: type -- type of app to download from | 'findme' sid -- session ID of the call format -- 'wav' or... | Implement the Python class `Recordings` described below.
Class description:
Implement the Recordings class.
Method signatures and docstrings:
- def download(self, **kwargs): Download a specific recording keword arguments: type -- type of app to download from | 'findme' sid -- session ID of the call format -- 'wav' or... | e4a992860892c46392e7bd651a1fa70acc413ee1 | <|skeleton|>
class Recordings:
def download(self, **kwargs):
"""Download a specific recording keword arguments: type -- type of app to download from | 'findme' sid -- session ID of the call format -- 'wav' or 'mp3' sample_rate -- audio rate of streaming data values: 8000 (default), 11000 (wav only), 22050,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Recordings:
def download(self, **kwargs):
"""Download a specific recording keword arguments: type -- type of app to download from | 'findme' sid -- session ID of the call format -- 'wav' or 'mp3' sample_rate -- audio rate of streaming data values: 8000 (default), 11000 (wav only), 22050, 44100"""
... | the_stack_v2_python_sparse | src/Ifbyphone/api/recordings.py | Opus1no2/Ifbyphone-API-Module | train | 0 | |
0ab3d46aa9155999d1bccc5fb25b5041d5be5896 | [
"super().setUpClass()\ncls.application = 'mysql-innodb-cluster'\ncls.test_config = lifecycle_utils.get_charm_config(fatal=False)\ncls.states = cls.test_config.get('target_deploy_status', {})",
"logging.info('Scale in test: remove leader')\nleader, nons = generic_utils.get_leaders_and_non_leaders(self.application_... | <|body_start_0|>
super().setUpClass()
cls.application = 'mysql-innodb-cluster'
cls.test_config = lifecycle_utils.get_charm_config(fatal=False)
cls.states = cls.test_config.get('target_deploy_status', {})
<|end_body_0|>
<|body_start_1|>
logging.info('Scale in test: remove leader'... | Percona Cluster cold start tests. | MySQLInnoDBClusterScaleTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySQLInnoDBClusterScaleTest:
"""Percona Cluster cold start tests."""
def setUpClass(cls):
"""Run class setup for running mysql-innodb-cluster scale tests."""
<|body_0|>
def test_800_remove_leader(self):
"""Remove leader node. We start with a three node cluster, r... | stack_v2_sparse_classes_75kplus_train_067944 | 45,009 | permissive | [
{
"docstring": "Run class setup for running mysql-innodb-cluster scale tests.",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "Remove leader node. We start with a three node cluster, remove one, down to two. The cluster will be in waiting state.",
"name": "test_8... | 5 | stack_v2_sparse_classes_30k_train_046919 | Implement the Python class `MySQLInnoDBClusterScaleTest` described below.
Class description:
Percona Cluster cold start tests.
Method signatures and docstrings:
- def setUpClass(cls): Run class setup for running mysql-innodb-cluster scale tests.
- def test_800_remove_leader(self): Remove leader node. We start with a ... | Implement the Python class `MySQLInnoDBClusterScaleTest` described below.
Class description:
Percona Cluster cold start tests.
Method signatures and docstrings:
- def setUpClass(cls): Run class setup for running mysql-innodb-cluster scale tests.
- def test_800_remove_leader(self): Remove leader node. We start with a ... | 3b17ad9d97c57b6e62797d4e3333e4b83e43a447 | <|skeleton|>
class MySQLInnoDBClusterScaleTest:
"""Percona Cluster cold start tests."""
def setUpClass(cls):
"""Run class setup for running mysql-innodb-cluster scale tests."""
<|body_0|>
def test_800_remove_leader(self):
"""Remove leader node. We start with a three node cluster, r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MySQLInnoDBClusterScaleTest:
"""Percona Cluster cold start tests."""
def setUpClass(cls):
"""Run class setup for running mysql-innodb-cluster scale tests."""
super().setUpClass()
cls.application = 'mysql-innodb-cluster'
cls.test_config = lifecycle_utils.get_charm_config(fa... | the_stack_v2_python_sparse | zaza/openstack/charm_tests/mysql/tests.py | openstack-charmers/zaza-openstack-tests | train | 7 |
12651451afbbbfb3f032e25c64a22894014763fc | [
"super().__init__(data, axes=axes, name=name)\nself.parameters = self.default_parameters\nfor key, value in kwargs.items():\n if key in self.parameters:\n self.parameters[key] = value\n else:\n raise KeyError(f'Unknown parameter {key}')\nif axes is None:\n p = self.parameters\n nx, ny = se... | <|body_start_0|>
super().__init__(data, axes=axes, name=name)
self.parameters = self.default_parameters
for key, value in kwargs.items():
if key in self.parameters:
self.parameters[key] = value
else:
raise KeyError(f'Unknown parameter {key}... | 2d Igor wave | Wave2d | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Wave2d:
"""2d Igor wave"""
def __init__(self, data=None, axes=None, name=None, **kwargs):
"""Initialize 2d Igor wave Parameters ---------- * data * name * xmin, xdelta, xlabel * ymin, ydelta, ylabel"""
<|body_0|>
def print_data(self):
"""Determines how to print t... | stack_v2_sparse_classes_75kplus_train_067945 | 10,034 | permissive | [
{
"docstring": "Initialize 2d Igor wave Parameters ---------- * data * name * xmin, xdelta, xlabel * ymin, ydelta, ylabel",
"name": "__init__",
"signature": "def __init__(self, data=None, axes=None, name=None, **kwargs)"
},
{
"docstring": "Determines how to print the data block",
"name": "pr... | 2 | stack_v2_sparse_classes_30k_train_049332 | Implement the Python class `Wave2d` described below.
Class description:
2d Igor wave
Method signatures and docstrings:
- def __init__(self, data=None, axes=None, name=None, **kwargs): Initialize 2d Igor wave Parameters ---------- * data * name * xmin, xdelta, xlabel * ymin, ydelta, ylabel
- def print_data(self): Dete... | Implement the Python class `Wave2d` described below.
Class description:
2d Igor wave
Method signatures and docstrings:
- def __init__(self, data=None, axes=None, name=None, **kwargs): Initialize 2d Igor wave Parameters ---------- * data * name * xmin, xdelta, xlabel * ymin, ydelta, ylabel
- def print_data(self): Dete... | e9aee3a51af787ab7a9b8e748225e0b436a97aa1 | <|skeleton|>
class Wave2d:
"""2d Igor wave"""
def __init__(self, data=None, axes=None, name=None, **kwargs):
"""Initialize 2d Igor wave Parameters ---------- * data * name * xmin, xdelta, xlabel * ymin, ydelta, ylabel"""
<|body_0|>
def print_data(self):
"""Determines how to print t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Wave2d:
"""2d Igor wave"""
def __init__(self, data=None, axes=None, name=None, **kwargs):
"""Initialize 2d Igor wave Parameters ---------- * data * name * xmin, xdelta, xlabel * ymin, ydelta, ylabel"""
super().__init__(data, axes=axes, name=name)
self.parameters = self.default_par... | the_stack_v2_python_sparse | aiida_nanotech_empa/utils/igor.py | nanotech-empa/aiida-nanotech-empa | train | 4 |
4e0006352d5b8dc5f80ebb467d94a86b12073fff | [
"credential, unused_project_id = google.auth.default(scopes=['https://www.googleapis.com/auth/gerritcodereview'])\ncredential.refresh(google.auth.transport.requests.Request())\nreturn 'o=git-{service_account_name}={token}'.format(service_account_name=credential.service_account_email, token=credential.token)",
"tr... | <|body_start_0|>
credential, unused_project_id = google.auth.default(scopes=['https://www.googleapis.com/auth/gerritcodereview'])
credential.refresh(google.auth.transport.requests.Request())
return 'o=git-{service_account_name}={token}'.format(service_account_name=credential.service_account_emai... | A helper class for the gerrit connector. | GerritConnectorHelper | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GerritConnectorHelper:
"""A helper class for the gerrit connector."""
def GetGerritAuthCookie(self) -> str:
"""Get the OAuth cookie of gerrit code review. Returns: An string of the cookie."""
<|body_0|>
def ConvertDataToJson(self, data) -> dict:
"""Convert the da... | stack_v2_sparse_classes_75kplus_train_067946 | 5,382 | permissive | [
{
"docstring": "Get the OAuth cookie of gerrit code review. Returns: An string of the cookie.",
"name": "GetGerritAuthCookie",
"signature": "def GetGerritAuthCookie(self) -> str"
},
{
"docstring": "Convert the data responded from the Gerrit Rest API to the json type. Args: data: The string from ... | 3 | stack_v2_sparse_classes_30k_train_046267 | Implement the Python class `GerritConnectorHelper` described below.
Class description:
A helper class for the gerrit connector.
Method signatures and docstrings:
- def GetGerritAuthCookie(self) -> str: Get the OAuth cookie of gerrit code review. Returns: An string of the cookie.
- def ConvertDataToJson(self, data) ->... | Implement the Python class `GerritConnectorHelper` described below.
Class description:
A helper class for the gerrit connector.
Method signatures and docstrings:
- def GetGerritAuthCookie(self) -> str: Get the OAuth cookie of gerrit code review. Returns: An string of the cookie.
- def ConvertDataToJson(self, data) ->... | a1b0fccd68987d8cd9c89710adc3c04b868347ec | <|skeleton|>
class GerritConnectorHelper:
"""A helper class for the gerrit connector."""
def GetGerritAuthCookie(self) -> str:
"""Get the OAuth cookie of gerrit code review. Returns: An string of the cookie."""
<|body_0|>
def ConvertDataToJson(self, data) -> dict:
"""Convert the da... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GerritConnectorHelper:
"""A helper class for the gerrit connector."""
def GetGerritAuthCookie(self) -> str:
"""Get the OAuth cookie of gerrit code review. Returns: An string of the cookie."""
credential, unused_project_id = google.auth.default(scopes=['https://www.googleapis.com/auth/gerr... | the_stack_v2_python_sparse | py/probe_info_service/app_engine/gerrit_connector.py | bridder/factory | train | 0 |
a4b85788736d6d11242ca292860b7b20dddc9b73 | [
"super().__init__()\nself.projection_layer = ProjectPatchesTokenizer(token_dim=token_dim, **projection_kwargs)\nnum_tokens = self.projection_layer.num_tokens\nself.transformer = Transformer(num_tokens=num_tokens, token_dim=token_dim, **transformer_kwargs)",
"assert pool in ['none', 'cls', 'mean']\nx = self.projec... | <|body_start_0|>
super().__init__()
self.projection_layer = ProjectPatchesTokenizer(token_dim=token_dim, **projection_kwargs)
num_tokens = self.projection_layer.num_tokens
self.transformer = Transformer(num_tokens=num_tokens, token_dim=token_dim, **transformer_kwargs)
<|end_body_0|>
<|b... | Projects a 1D/2D/3D image into tokens, and then runs it through a transformer | ViT | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViT:
"""Projects a 1D/2D/3D image into tokens, and then runs it through a transformer"""
def __init__(self, token_dim: int, projection_kwargs: dict, transformer_kwargs: dict):
""":param token_dim: the dimension of each token in the transformer :param projection_kwargs: positional arg... | stack_v2_sparse_classes_75kplus_train_067947 | 6,109 | permissive | [
{
"docstring": ":param token_dim: the dimension of each token in the transformer :param projection_kwargs: positional arguments for the ProjectPatchesTokenizer class :param transformer_kwargs: positional arguments for the Transformer class",
"name": "__init__",
"signature": "def __init__(self, token_dim... | 2 | stack_v2_sparse_classes_30k_train_016176 | Implement the Python class `ViT` described below.
Class description:
Projects a 1D/2D/3D image into tokens, and then runs it through a transformer
Method signatures and docstrings:
- def __init__(self, token_dim: int, projection_kwargs: dict, transformer_kwargs: dict): :param token_dim: the dimension of each token in... | Implement the Python class `ViT` described below.
Class description:
Projects a 1D/2D/3D image into tokens, and then runs it through a transformer
Method signatures and docstrings:
- def __init__(self, token_dim: int, projection_kwargs: dict, transformer_kwargs: dict): :param token_dim: the dimension of each token in... | 8f22cd46c836245b9394b73ce2957afc03706bfc | <|skeleton|>
class ViT:
"""Projects a 1D/2D/3D image into tokens, and then runs it through a transformer"""
def __init__(self, token_dim: int, projection_kwargs: dict, transformer_kwargs: dict):
""":param token_dim: the dimension of each token in the transformer :param projection_kwargs: positional arg... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ViT:
"""Projects a 1D/2D/3D image into tokens, and then runs it through a transformer"""
def __init__(self, token_dim: int, projection_kwargs: dict, transformer_kwargs: dict):
""":param token_dim: the dimension of each token in the transformer :param projection_kwargs: positional arguments for th... | the_stack_v2_python_sparse | fuse/dl/models/backbones/backbone_vit.py | BiomedSciAI/fuse-med-ml | train | 45 |
27a9995676b055c0fdbef5c2fb8df0007d6e5e67 | [
"super().__init__()\nself.blocks = len(rnns)\nfor index, (rnn, deconvrelu) in enumerate(zip(rnns, deconvrelus), 1):\n setattr(self, 'rnn' + str(index), rnn)\n setattr(self, 'deconvrelu' + str(index), deconvrelu)\nself.output_layer = cnn",
"if len(inputs) > 0:\n inputs = inputs.transpose(0, 1)\ncur_deconv... | <|body_start_0|>
super().__init__()
self.blocks = len(rnns)
for index, (rnn, deconvrelu) in enumerate(zip(rnns, deconvrelus), 1):
setattr(self, 'rnn' + str(index), rnn)
setattr(self, 'deconvrelu' + str(index), deconvrelu)
self.output_layer = cnn
<|end_body_0|>
<|... | decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so forth. Finally, the inputs will go throug... | Decoder_pro | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder_pro:
"""decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so fo... | stack_v2_sparse_classes_75kplus_train_067948 | 41,120 | no_license | [
{
"docstring": "rnns are a list of convlstm cells, deconvrelus are a list of deconvrelu cells and cnn is a convcell",
"name": "__init__",
"signature": "def __init__(self, rnns, deconvrelus, cnn)"
},
{
"docstring": "forward pass of the decoder_pro :param seq_len: how long the sequence is decoded ... | 2 | stack_v2_sparse_classes_30k_test_000544 | Implement the Python class `Decoder_pro` described below.
Class description:
decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and the... | Implement the Python class `Decoder_pro` described below.
Class description:
decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and the... | b6a3161635bfa3b5da8ec871e1025e01f878e732 | <|skeleton|>
class Decoder_pro:
"""decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Decoder_pro:
"""decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so forth. Finally,... | the_stack_v2_python_sparse | src/bayesian_neural_net.py | KEHUIYAO/BCLS | train | 0 |
9d60d374b9a4a7863be8f663d8b82b35c888d4d4 | [
"debug = self.get_setting('DEBUG')\noutputs = []\noutput_file = None\nfor item in items:\n label.object_to_print = item\n outputs.append(self.print_label(label, request, debug=debug, **kwargs))\nif self.get_setting('DEBUG'):\n html = '\\n'.join(outputs)\n output_file = ContentFile(html, 'labels.html')\n... | <|body_start_0|>
debug = self.get_setting('DEBUG')
outputs = []
output_file = None
for item in items:
label.object_to_print = item
outputs.append(self.print_label(label, request, debug=debug, **kwargs))
if self.get_setting('DEBUG'):
html = '\n'... | Builtin plugin for label printing. This plugin merges the selected labels into a single PDF file, which is made available for download. | InvenTreeLabelPlugin | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvenTreeLabelPlugin:
"""Builtin plugin for label printing. This plugin merges the selected labels into a single PDF file, which is made available for download."""
def print_labels(self, label: LabelTemplate, items: list, request, **kwargs):
"""Handle printing of multiple labels - La... | stack_v2_sparse_classes_75kplus_train_067949 | 2,953 | permissive | [
{
"docstring": "Handle printing of multiple labels - Label outputs are concatenated together, and we return a single PDF file. - If DEBUG mode is enabled, we return a single HTML file.",
"name": "print_labels",
"signature": "def print_labels(self, label: LabelTemplate, items: list, request, **kwargs)"
... | 2 | stack_v2_sparse_classes_30k_train_004056 | Implement the Python class `InvenTreeLabelPlugin` described below.
Class description:
Builtin plugin for label printing. This plugin merges the selected labels into a single PDF file, which is made available for download.
Method signatures and docstrings:
- def print_labels(self, label: LabelTemplate, items: list, re... | Implement the Python class `InvenTreeLabelPlugin` described below.
Class description:
Builtin plugin for label printing. This plugin merges the selected labels into a single PDF file, which is made available for download.
Method signatures and docstrings:
- def print_labels(self, label: LabelTemplate, items: list, re... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class InvenTreeLabelPlugin:
"""Builtin plugin for label printing. This plugin merges the selected labels into a single PDF file, which is made available for download."""
def print_labels(self, label: LabelTemplate, items: list, request, **kwargs):
"""Handle printing of multiple labels - La... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InvenTreeLabelPlugin:
"""Builtin plugin for label printing. This plugin merges the selected labels into a single PDF file, which is made available for download."""
def print_labels(self, label: LabelTemplate, items: list, request, **kwargs):
"""Handle printing of multiple labels - Label outputs a... | the_stack_v2_python_sparse | InvenTree/plugin/builtin/labels/inventree_label.py | inventree/InvenTree | train | 3,077 |
f424e80554bee1e0d789ebdf3c796eb198698c7e | [
"if not user_data:\n user_data = {'owner': f'{ANONYMOUS_SESSION} session', 'name': f'{ANONYMOUS_SESSION}', 'token': f'{ANONYMOUS_SESSION}'}\nself.ctx = ProjectCloneContext().load({**user_data, **request_data}, unknown=EXCLUDE)\nself.git_url = self.ctx['url_with_auth']\nself.branch = self.ctx['branch']",
"url =... | <|body_start_0|>
if not user_data:
user_data = {'owner': f'{ANONYMOUS_SESSION} session', 'name': f'{ANONYMOUS_SESSION}', 'token': f'{ANONYMOUS_SESSION}'}
self.ctx = ProjectCloneContext().load({**user_data, **request_data}, unknown=EXCLUDE)
self.git_url = self.ctx['url_with_auth']
... | Parent controller for all controllers with remote support. | RemoteProject | [
"Apache-2.0",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteProject:
"""Parent controller for all controllers with remote support."""
def __init__(self, user_data, request_data):
"""Construct remote controller."""
<|body_0|>
def remote_url(self):
"""Construct project metadata remote path."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_067950 | 2,664 | permissive | [
{
"docstring": "Construct remote controller.",
"name": "__init__",
"signature": "def __init__(self, user_data, request_data)"
},
{
"docstring": "Construct project metadata remote path.",
"name": "remote_url",
"signature": "def remote_url(self)"
},
{
"docstring": "Retrieve project... | 3 | stack_v2_sparse_classes_30k_train_010161 | Implement the Python class `RemoteProject` described below.
Class description:
Parent controller for all controllers with remote support.
Method signatures and docstrings:
- def __init__(self, user_data, request_data): Construct remote controller.
- def remote_url(self): Construct project metadata remote path.
- def ... | Implement the Python class `RemoteProject` described below.
Class description:
Parent controller for all controllers with remote support.
Method signatures and docstrings:
- def __init__(self, user_data, request_data): Construct remote controller.
- def remote_url(self): Construct project metadata remote path.
- def ... | e0ff587f507d049eeeb873e8488ba8bb10ac1a15 | <|skeleton|>
class RemoteProject:
"""Parent controller for all controllers with remote support."""
def __init__(self, user_data, request_data):
"""Construct remote controller."""
<|body_0|>
def remote_url(self):
"""Construct project metadata remote path."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RemoteProject:
"""Parent controller for all controllers with remote support."""
def __init__(self, user_data, request_data):
"""Construct remote controller."""
if not user_data:
user_data = {'owner': f'{ANONYMOUS_SESSION} session', 'name': f'{ANONYMOUS_SESSION}', 'token': f'{A... | the_stack_v2_python_sparse | renku/ui/service/controllers/utils/remote_project.py | SwissDataScienceCenter/renku-python | train | 30 |
7a567786be016aa8e52f9996d18bbae469960405 | [
"import pandas as pd\nraw_data = pd.read_excel(filename_1, sheet_name)\nself.df1 = raw_data[raw_data[' Whether or not metasomatism'] == 1].drop(['Whether or not metasomatism', 'CITATION'], axis=1)\nself.df2 = raw_data[raw_data['Whether or not metasomatism'] == -1].drop(['Whether or not metasomatism', 'CITATION'], a... | <|body_start_0|>
import pandas as pd
raw_data = pd.read_excel(filename_1, sheet_name)
self.df1 = raw_data[raw_data[' Whether or not metasomatism'] == 1].drop(['Whether or not metasomatism', 'CITATION'], axis=1)
self.df2 = raw_data[raw_data['Whether or not metasomatism'] == -1].drop(['Whe... | ElementsInCurve | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElementsInCurve:
def __init__(self, filename_1, filename_2, sheet_name):
"""Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi elemen... | stack_v2_sparse_classes_75kplus_train_067951 | 3,811 | permissive | [
{
"docstring": "Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi element",
"name": "__init__",
"signature": "def __init__(self, filename_1, filenam... | 2 | stack_v2_sparse_classes_30k_train_010636 | Implement the Python class `ElementsInCurve` described below.
Class description:
Implement the ElementsInCurve class.
Method signatures and docstrings:
- def __init__(self, filename_1, filename_2, sheet_name): Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filena... | Implement the Python class `ElementsInCurve` described below.
Class description:
Implement the ElementsInCurve class.
Method signatures and docstrings:
- def __init__(self, filename_1, filename_2, sheet_name): Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filena... | ca0f220598ee156028646fbefccde08b2ece62ea | <|skeleton|>
class ElementsInCurve:
def __init__(self, filename_1, filename_2, sheet_name):
"""Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi elemen... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ElementsInCurve:
def __init__(self, filename_1, filename_2, sheet_name):
"""Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi element"""
i... | the_stack_v2_python_sparse | english/others/Elements_in_Curve.py | Lyuyangdaisy/DS_package | train | 0 | |
9963cb40a1d6ab4d2fca307a9122212b9093e8e3 | [
"keys = 'ucagrymkwsbhvdn?-'\nfor k in keys:\n assert k in RnaAlphabet\nfor k in keys.upper():\n assert k in RnaAlphabet\nassert 'X' not in RnaAlphabet",
"degens = [['ucag', 'n'], ['ucag-', '?'], ['ucg', 'b'], ['uag', 'd'], ['uca', 'h'], ['ug', 'k'], ['ca', 'm'], ['ag', 'r'], ['cg', 's'], ['cag', 'v'], ['ua'... | <|body_start_0|>
keys = 'ucagrymkwsbhvdn?-'
for k in keys:
assert k in RnaAlphabet
for k in keys.upper():
assert k in RnaAlphabet
assert 'X' not in RnaAlphabet
<|end_body_0|>
<|body_start_1|>
degens = [['ucag', 'n'], ['ucag-', '?'], ['ucg', 'b'], ['uag', ... | Spot-checks of alphabet functionality applied to RNA alphabet. | RnaAlphabetTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RnaAlphabetTests:
"""Spot-checks of alphabet functionality applied to RNA alphabet."""
def test_contains(self):
"""RnaAlphabet should __contain__ the expected symbols."""
<|body_0|>
def test_InverseDegens(self):
"""RnaAlphabet should have correct inverse degenera... | stack_v2_sparse_classes_75kplus_train_067952 | 27,704 | no_license | [
{
"docstring": "RnaAlphabet should __contain__ the expected symbols.",
"name": "test_contains",
"signature": "def test_contains(self)"
},
{
"docstring": "RnaAlphabet should have correct inverse degenerates",
"name": "test_InverseDegens",
"signature": "def test_InverseDegens(self)"
},
... | 3 | stack_v2_sparse_classes_30k_train_051483 | Implement the Python class `RnaAlphabetTests` described below.
Class description:
Spot-checks of alphabet functionality applied to RNA alphabet.
Method signatures and docstrings:
- def test_contains(self): RnaAlphabet should __contain__ the expected symbols.
- def test_InverseDegens(self): RnaAlphabet should have cor... | Implement the Python class `RnaAlphabetTests` described below.
Class description:
Spot-checks of alphabet functionality applied to RNA alphabet.
Method signatures and docstrings:
- def test_contains(self): RnaAlphabet should __contain__ the expected symbols.
- def test_InverseDegens(self): RnaAlphabet should have cor... | b49442bd793a743188a43809903dc140512420b7 | <|skeleton|>
class RnaAlphabetTests:
"""Spot-checks of alphabet functionality applied to RNA alphabet."""
def test_contains(self):
"""RnaAlphabet should __contain__ the expected symbols."""
<|body_0|>
def test_InverseDegens(self):
"""RnaAlphabet should have correct inverse degenera... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RnaAlphabetTests:
"""Spot-checks of alphabet functionality applied to RNA alphabet."""
def test_contains(self):
"""RnaAlphabet should __contain__ the expected symbols."""
keys = 'ucagrymkwsbhvdn?-'
for k in keys:
assert k in RnaAlphabet
for k in keys.upper():
... | the_stack_v2_python_sparse | old_cogent_tests/base/test_alphabet.py | pycogent/old-cogent | train | 0 |
0a768da32c9a0cb2fc5561088eb31b840f6ace4c | [
"import collections\ntask_cnt = list(collections.Counter(tasks).values())\nk = max(task_cnt)\nfinal = task_cnt.count(k)\nreturn max(len(tasks), (n + 1) * (k - 1) + final)",
"amount_cd = [[0 for _ in range(2)] for _ in range(26)]\nfor t in tasks:\n amount_cd[ord(t) - ord('A')][0] += 1\nsorted(amount_cd, reverse... | <|body_start_0|>
import collections
task_cnt = list(collections.Counter(tasks).values())
k = max(task_cnt)
final = task_cnt.count(k)
return max(len(tasks), (n + 1) * (k - 1) + final)
<|end_body_0|>
<|body_start_1|>
amount_cd = [[0 for _ in range(2)] for _ in range(26)]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def leastInterval(self, tasks, n):
""":type tasks: List[str] :type n: int :rtype: int 使用方塊法, 可以看 solution 3 或 https://leetcode.com/problems/task-scheduler/discuss/104507/Python-Straightforward-with-Explanation 可以分成兩種情況討論 1. 休息時間太短,工作種類太多,也就是可以一直做不一樣的工作都不用休息 這種狀況就是 task 的數量決定工作的... | stack_v2_sparse_classes_75kplus_train_067953 | 2,729 | no_license | [
{
"docstring": ":type tasks: List[str] :type n: int :rtype: int 使用方塊法, 可以看 solution 3 或 https://leetcode.com/problems/task-scheduler/discuss/104507/Python-Straightforward-with-Explanation 可以分成兩種情況討論 1. 休息時間太短,工作種類太多,也就是可以一直做不一樣的工作都不用休息 這種狀況就是 task 的數量決定工作的總 intervals 數 2. 休息時間太長,工作種類太少,也就是每種工作都做過還是需要休息 這種狀況下,所有... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def leastInterval(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int 使用方塊法, 可以看 solution 3 或 https://leetcode.com/problems/task-scheduler/discuss/104507/Python-Stra... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def leastInterval(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int 使用方塊法, 可以看 solution 3 或 https://leetcode.com/problems/task-scheduler/discuss/104507/Python-Stra... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def leastInterval(self, tasks, n):
""":type tasks: List[str] :type n: int :rtype: int 使用方塊法, 可以看 solution 3 或 https://leetcode.com/problems/task-scheduler/discuss/104507/Python-Straightforward-with-Explanation 可以分成兩種情況討論 1. 休息時間太短,工作種類太多,也就是可以一直做不一樣的工作都不用休息 這種狀況就是 task 的數量決定工作的... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def leastInterval(self, tasks, n):
""":type tasks: List[str] :type n: int :rtype: int 使用方塊法, 可以看 solution 3 或 https://leetcode.com/problems/task-scheduler/discuss/104507/Python-Straightforward-with-Explanation 可以分成兩種情況討論 1. 休息時間太短,工作種類太多,也就是可以一直做不一樣的工作都不用休息 這種狀況就是 task 的數量決定工作的總 intervals 數 ... | the_stack_v2_python_sparse | cs_notes/arrays/task_scheduler.py | hwc1824/LeetCodeSolution | train | 0 | |
872250a89dc96cad50d34d4f85f1d8e281923ae8 | [
"bins = np.logspace(min(limits), max(limits), nbins + 1)\nmass = snapshot['m200c'].values\nprint('min mass ----------------->', np.min(mass))\nmass = mass[min(limits) < mass]\nmass_count, edges = np.histogram(mass, bins=bins)\nmass_count = np.cumsum(mass_count[::-1])[::-1]\nmass_bin = (edges[1:] + edges[:-1]) / 2.0... | <|body_start_0|>
bins = np.logspace(min(limits), max(limits), nbins + 1)
mass = snapshot['m200c'].values
print('min mass ----------------->', np.min(mass))
mass = mass[min(limits) < mass]
mass_count, edges = np.histogram(mass, bins=bins)
mass_count = np.cumsum(mass_count[... | Rockstar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rockstar:
def halo_mass_fct(snapshot: pd.DataFrame, limits: tuple=(11.78, 16), nbins: int=20) -> tuple:
"""Compute the halo mass function Args: data: halo mass in [M_{\\odot}/h]"""
<|body_0|>
def histograms(snapshot: pd.DataFrame, nbins: int, dimesions: int, properties: List... | stack_v2_sparse_classes_75kplus_train_067954 | 3,998 | permissive | [
{
"docstring": "Compute the halo mass function Args: data: halo mass in [M_{\\\\odot}/h]",
"name": "halo_mass_fct",
"signature": "def halo_mass_fct(snapshot: pd.DataFrame, limits: tuple=(11.78, 16), nbins: int=20) -> tuple"
},
{
"docstring": "Comput the concentration/mass relation. Args: Returns... | 3 | stack_v2_sparse_classes_30k_train_054154 | Implement the Python class `Rockstar` described below.
Class description:
Implement the Rockstar class.
Method signatures and docstrings:
- def halo_mass_fct(snapshot: pd.DataFrame, limits: tuple=(11.78, 16), nbins: int=20) -> tuple: Compute the halo mass function Args: data: halo mass in [M_{\\odot}/h]
- def histogr... | Implement the Python class `Rockstar` described below.
Class description:
Implement the Rockstar class.
Method signatures and docstrings:
- def halo_mass_fct(snapshot: pd.DataFrame, limits: tuple=(11.78, 16), nbins: int=20) -> tuple: Compute the halo mass function Args: data: halo mass in [M_{\\odot}/h]
- def histogr... | bb15f2d392842f9b32de12b5db5c86079bc97105 | <|skeleton|>
class Rockstar:
def halo_mass_fct(snapshot: pd.DataFrame, limits: tuple=(11.78, 16), nbins: int=20) -> tuple:
"""Compute the halo mass function Args: data: halo mass in [M_{\\odot}/h]"""
<|body_0|>
def histograms(snapshot: pd.DataFrame, nbins: int, dimesions: int, properties: List... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rockstar:
def halo_mass_fct(snapshot: pd.DataFrame, limits: tuple=(11.78, 16), nbins: int=20) -> tuple:
"""Compute the halo mass function Args: data: halo mass in [M_{\\odot}/h]"""
bins = np.logspace(min(limits), max(limits), nbins + 1)
mass = snapshot['m200c'].values
print('mi... | the_stack_v2_python_sparse | src/astrild/particles/hutils/stats_rockstar.py | Christovis/astrild | train | 3 | |
05d8bede933a67b21886355933f601dbda94f83a | [
"for buckets_map in resource_from_api:\n buckets = buckets_map['buckets']\n for item in buckets:\n bucket_json = json.dumps(item)\n try:\n parsed_time = dateutil_parser.parse(item.get('timeCreated'))\n formatted_project_create_time = parsed_time.strftime(self.MYSQL_DATETIME... | <|body_start_0|>
for buckets_map in resource_from_api:
buckets = buckets_map['buckets']
for item in buckets:
bucket_json = json.dumps(item)
try:
parsed_time = dateutil_parser.parse(item.get('timeCreated'))
formatted_... | Pipeline to load project buckets data into Inventory. | LoadProjectsBucketsPipeline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadProjectsBucketsPipeline:
"""Pipeline to load project buckets data into Inventory."""
def _transform(self, resource_from_api):
"""Yield an iterator of loadable buckets. Args: resource_from_api (list): An iterable of buckets as per-project dictionary. Example: {'project_number': 11... | stack_v2_sparse_classes_75kplus_train_067955 | 5,412 | permissive | [
{
"docstring": "Yield an iterator of loadable buckets. Args: resource_from_api (list): An iterable of buckets as per-project dictionary. Example: {'project_number': 11111, 'buckets': buckets_json} Yields: dict: An iterable of buckets, as a per-org dictionary.",
"name": "_transform",
"signature": "def _t... | 3 | stack_v2_sparse_classes_30k_train_022745 | Implement the Python class `LoadProjectsBucketsPipeline` described below.
Class description:
Pipeline to load project buckets data into Inventory.
Method signatures and docstrings:
- def _transform(self, resource_from_api): Yield an iterator of loadable buckets. Args: resource_from_api (list): An iterable of buckets ... | Implement the Python class `LoadProjectsBucketsPipeline` described below.
Class description:
Pipeline to load project buckets data into Inventory.
Method signatures and docstrings:
- def _transform(self, resource_from_api): Yield an iterator of loadable buckets. Args: resource_from_api (list): An iterable of buckets ... | a6a1aa7464cda2ad5948e3e8876eb8dded5e2514 | <|skeleton|>
class LoadProjectsBucketsPipeline:
"""Pipeline to load project buckets data into Inventory."""
def _transform(self, resource_from_api):
"""Yield an iterator of loadable buckets. Args: resource_from_api (list): An iterable of buckets as per-project dictionary. Example: {'project_number': 11... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoadProjectsBucketsPipeline:
"""Pipeline to load project buckets data into Inventory."""
def _transform(self, resource_from_api):
"""Yield an iterator of loadable buckets. Args: resource_from_api (list): An iterable of buckets as per-project dictionary. Example: {'project_number': 11111, 'buckets... | the_stack_v2_python_sparse | google/cloud/security/inventory/pipelines/load_projects_buckets_pipeline.py | shimizu19691210/forseti-security | train | 1 |
3255ee09722cf2e7a86a2b6b0373e85e4e4dc7da | [
"super(StatusBarWidget, self).__init__(parent)\nself.value = None\nself._icon = icon\nself._pixmap = icon.pixmap(QSize(16, 16)) if icon is not None else None\nself.label_icon = QLabel() if icon is not None else None\nself.label_value = QLabel()\nif icon is not None:\n self.label_icon.setPixmap(self._pixmap)\nsel... | <|body_start_0|>
super(StatusBarWidget, self).__init__(parent)
self.value = None
self._icon = icon
self._pixmap = icon.pixmap(QSize(16, 16)) if icon is not None else None
self.label_icon = QLabel() if icon is not None else None
self.label_value = QLabel()
if icon ... | Status bar widget base. | StatusBarWidget | [
"LGPL-3.0-only",
"LGPL-2.1-only",
"Python-2.0",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"CC-BY-2.5",
"OFL-1.1",
"LGPL-3.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only",
"Apache-2.0",
"CC-BY-3.0",
"MIT",
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatusBarWidget:
"""Status bar widget base."""
def __init__(self, parent, statusbar, icon=None):
"""Status bar widget base."""
<|body_0|>
def set_value(self, value):
"""Set formatted text value."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
su... | stack_v2_sparse_classes_75kplus_train_067956 | 5,934 | permissive | [
{
"docstring": "Status bar widget base.",
"name": "__init__",
"signature": "def __init__(self, parent, statusbar, icon=None)"
},
{
"docstring": "Set formatted text value.",
"name": "set_value",
"signature": "def set_value(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001255 | Implement the Python class `StatusBarWidget` described below.
Class description:
Status bar widget base.
Method signatures and docstrings:
- def __init__(self, parent, statusbar, icon=None): Status bar widget base.
- def set_value(self, value): Set formatted text value. | Implement the Python class `StatusBarWidget` described below.
Class description:
Status bar widget base.
Method signatures and docstrings:
- def __init__(self, parent, statusbar, icon=None): Status bar widget base.
- def set_value(self, value): Set formatted text value.
<|skeleton|>
class StatusBarWidget:
"""Sta... | be98b086f95968fccc4e8dbe3f1140154c94a412 | <|skeleton|>
class StatusBarWidget:
"""Status bar widget base."""
def __init__(self, parent, statusbar, icon=None):
"""Status bar widget base."""
<|body_0|>
def set_value(self, value):
"""Set formatted text value."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StatusBarWidget:
"""Status bar widget base."""
def __init__(self, parent, statusbar, icon=None):
"""Status bar widget base."""
super(StatusBarWidget, self).__init__(parent)
self.value = None
self._icon = icon
self._pixmap = icon.pixmap(QSize(16, 16)) if icon is not... | the_stack_v2_python_sparse | spyder/widgets/status.py | zrlzwd/spyder | train | 2 |
9a1fec6a5f68cf484ebbfd2566c6515dbbe380aa | [
"my_module_path = str_plugin_path\nmy_plugin = str_plugin\ntry:\n my_module = importlib.import_module(my_module_path)\n evaluated_plugin_str = 'my_module.%s' % my_plugin\n my_class = eval(evaluated_plugin_str)\nexcept Exception:\n raise Exception('Failed to evaluate ExecEngine plugin %s.%s' % (str_plugi... | <|body_start_0|>
my_module_path = str_plugin_path
my_plugin = str_plugin
try:
my_module = importlib.import_module(my_module_path)
evaluated_plugin_str = 'my_module.%s' % my_plugin
my_class = eval(evaluated_plugin_str)
except Exception:
rais... | Provides services for the execution of algorithms. FacadeExecution.factory is an instance of FactoryExecAlgo, which must be used to instantiate separately executable algorithms Typical use of this facade: 1) Simplest use: my_exec_algo, exec_status = FacadeExecution.execute( ... ) 2) Separating steps : initializing algo... | FacadeExecution | [
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"LGPL-3.0-or-later",
"Zlib",
"BSD-3-Clause",
"Python-2.0",
"ZPL-2.0",
"LicenseRef-scancode-openssl-exception-lgpl3.0plus",
"ZPL-2.1",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FacadeExecution:
"""Provides services for the execution of algorithms. FacadeExecution.factory is an instance of FactoryExecAlgo, which must be used to instantiate separately executable algorithms Typical use of this facade: 1) Simplest use: my_exec_algo, exec_status = FacadeExecution.execute( ..... | stack_v2_sparse_classes_75kplus_train_067957 | 6,584 | permissive | [
{
"docstring": "private class method evaluate the configured engine from module+plugin :param cls: :type cls: :param str_plugin_path: :type str_plugin_path: :param str_plugin: :type str_plugin: :return: subclass of ExecEngine (!!! not an instance !!!)",
"name": "__eval_exec_engine_class",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_000560 | Implement the Python class `FacadeExecution` described below.
Class description:
Provides services for the execution of algorithms. FacadeExecution.factory is an instance of FactoryExecAlgo, which must be used to instantiate separately executable algorithms Typical use of this facade: 1) Simplest use: my_exec_algo, ex... | Implement the Python class `FacadeExecution` described below.
Class description:
Provides services for the execution of algorithms. FacadeExecution.factory is an instance of FactoryExecAlgo, which must be used to instantiate separately executable algorithms Typical use of this facade: 1) Simplest use: my_exec_algo, ex... | 0b04ab448faf1ffdc89687268c6192e69d61f890 | <|skeleton|>
class FacadeExecution:
"""Provides services for the execution of algorithms. FacadeExecution.factory is an instance of FactoryExecAlgo, which must be used to instantiate separately executable algorithms Typical use of this facade: 1) Simplest use: my_exec_algo, exec_status = FacadeExecution.execute( ..... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FacadeExecution:
"""Provides services for the execution of algorithms. FacadeExecution.factory is an instance of FactoryExecAlgo, which must be used to instantiate separately executable algorithms Typical use of this facade: 1) Simplest use: my_exec_algo, exec_status = FacadeExecution.execute( ... ) 2) Separa... | the_stack_v2_python_sparse | src/ikats/processing/apps/algo/execute/models/business/facade.py | IKATS/ikats-pybase | train | 0 |
30eabe53f650439794191e6bc16691dc85eff5b4 | [
"import collections\nself.times = sorted(times)\nself.sort_list = []\nself.persons_vote = collections.defaultdict(int)\ncur_person = None\nfor person, time in sorted(zip(persons, times), key=lambda a: a[1]):\n self.persons_vote[person] += 1\n if cur_person is not None:\n cur_person = cur_person if self... | <|body_start_0|>
import collections
self.times = sorted(times)
self.sort_list = []
self.persons_vote = collections.defaultdict(int)
cur_person = None
for person, time in sorted(zip(persons, times), key=lambda a: a[1]):
self.persons_vote[person] += 1
... | TopVotedCandidate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int] 532 ms,"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import collections
se... | stack_v2_sparse_classes_75kplus_train_067958 | 4,892 | no_license | [
{
"docstring": ":type persons: List[int] :type times: List[int] 532 ms,",
"name": "__init__",
"signature": "def __init__(self, persons, times)"
},
{
"docstring": ":type t: int :rtype: int",
"name": "q",
"signature": "def q(self, t)"
}
] | 2 | null | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int] 532 ms,
- def q(self, t): :type t: int :rtype: int | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int] 532 ms,
- def q(self, t): :type t: int :rtype: int
<|skeleton|>
class TopVo... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int] 532 ms,"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int] 532 ms,"""
import collections
self.times = sorted(times)
self.sort_list = []
self.persons_vote = collections.defaultdict(int)
cur_person = None
for ... | the_stack_v2_python_sparse | OnlineElection_MID_911.py | 953250587/leetcode-python | train | 2 | |
915eff02d8d652cd86dfcb3270527ebd24fa7949 | [
"self.data_path = str(dataset_params['path'])\nself.width = int(common_params['image_size'])\nself.height = int(common_params['image_size'])\nself.batch_size = int(common_params['batch_size'])",
"with open(self.data_path, 'rb') as f:\n images = pickle.load(f)\nwith open(self.data_path + '_labels', 'rb') as f:\... | <|body_start_0|>
self.data_path = str(dataset_params['path'])
self.width = int(common_params['image_size'])
self.height = int(common_params['image_size'])
self.batch_size = int(common_params['batch_size'])
<|end_body_0|>
<|body_start_1|>
with open(self.data_path, 'rb') as f:
... | ImageDataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageDataset:
def __init__(self, common_params, dataset_params):
"""Args: common_params: A dict dataset_params: A dict"""
<|body_0|>
def batch(self):
"""get batch Returns: images: 4-D ndarray [batch_size, height, width, 3] labels: 3-D ndarray [batch_size, max_objects... | stack_v2_sparse_classes_75kplus_train_067959 | 1,630 | no_license | [
{
"docstring": "Args: common_params: A dict dataset_params: A dict",
"name": "__init__",
"signature": "def __init__(self, common_params, dataset_params)"
},
{
"docstring": "get batch Returns: images: 4-D ndarray [batch_size, height, width, 3] labels: 3-D ndarray [batch_size, max_objects, 5]",
... | 2 | stack_v2_sparse_classes_30k_train_000268 | Implement the Python class `ImageDataset` described below.
Class description:
Implement the ImageDataset class.
Method signatures and docstrings:
- def __init__(self, common_params, dataset_params): Args: common_params: A dict dataset_params: A dict
- def batch(self): get batch Returns: images: 4-D ndarray [batch_siz... | Implement the Python class `ImageDataset` described below.
Class description:
Implement the ImageDataset class.
Method signatures and docstrings:
- def __init__(self, common_params, dataset_params): Args: common_params: A dict dataset_params: A dict
- def batch(self): get batch Returns: images: 4-D ndarray [batch_siz... | 7f555727c4761cce933da953fbe14685e7263179 | <|skeleton|>
class ImageDataset:
def __init__(self, common_params, dataset_params):
"""Args: common_params: A dict dataset_params: A dict"""
<|body_0|>
def batch(self):
"""get batch Returns: images: 4-D ndarray [batch_size, height, width, 3] labels: 3-D ndarray [batch_size, max_objects... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageDataset:
def __init__(self, common_params, dataset_params):
"""Args: common_params: A dict dataset_params: A dict"""
self.data_path = str(dataset_params['path'])
self.width = int(common_params['image_size'])
self.height = int(common_params['image_size'])
self.batch... | the_stack_v2_python_sparse | CNN/classicNetwork/leNet/leNetDataset.py | sadiq18/tensorflow | train | 0 | |
549c7c025b0bac7f6b478a0dbf20c886bb6460f9 | [
"wx_code = request.params['usercode']\napp_id = request.params['appid']\nsecret = request.params['secret']\nif not wx_code or not app_id or (not secret):\n return False\nif not api_tool.check_api_access(app_id):\n return False\nurl = 'https://api.weixin.qq.com/sns/jscode2session?'\nnew_url = '{}appid={}&secre... | <|body_start_0|>
wx_code = request.params['usercode']
app_id = request.params['appid']
secret = request.params['secret']
if not wx_code or not app_id or (not secret):
return False
if not api_tool.check_api_access(app_id):
return False
url = 'https:... | 微信api接口 | WeiXinApiInterface | [
"GPL-3.0-only",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeiXinApiInterface:
"""微信api接口"""
def wx_get_openid(self, **kw):
"""用appid和secret到微信api中换取微信用户openid :param kw: :return: openid"""
<|body_0|>
def wx_check_employee_openid(self, **kw):
"""根据微信openid查询员工是否存在 :param kw: :return:"""
<|body_1|>
def wx_get... | stack_v2_sparse_classes_75kplus_train_067960 | 4,391 | permissive | [
{
"docstring": "用appid和secret到微信api中换取微信用户openid :param kw: :return: openid",
"name": "wx_get_openid",
"signature": "def wx_get_openid(self, **kw)"
},
{
"docstring": "根据微信openid查询员工是否存在 :param kw: :return:",
"name": "wx_check_employee_openid",
"signature": "def wx_check_employee_openid(s... | 4 | stack_v2_sparse_classes_30k_train_017527 | Implement the Python class `WeiXinApiInterface` described below.
Class description:
微信api接口
Method signatures and docstrings:
- def wx_get_openid(self, **kw): 用appid和secret到微信api中换取微信用户openid :param kw: :return: openid
- def wx_check_employee_openid(self, **kw): 根据微信openid查询员工是否存在 :param kw: :return:
- def wx_get_ope... | Implement the Python class `WeiXinApiInterface` described below.
Class description:
微信api接口
Method signatures and docstrings:
- def wx_get_openid(self, **kw): 用appid和secret到微信api中换取微信用户openid :param kw: :return: openid
- def wx_check_employee_openid(self, **kw): 根据微信openid查询员工是否存在 :param kw: :return:
- def wx_get_ope... | 8608aaeae7a8c86d53b68ce26b7b308f779c3dd8 | <|skeleton|>
class WeiXinApiInterface:
"""微信api接口"""
def wx_get_openid(self, **kw):
"""用appid和secret到微信api中换取微信用户openid :param kw: :return: openid"""
<|body_0|>
def wx_check_employee_openid(self, **kw):
"""根据微信openid查询员工是否存在 :param kw: :return:"""
<|body_1|>
def wx_get... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WeiXinApiInterface:
"""微信api接口"""
def wx_get_openid(self, **kw):
"""用appid和secret到微信api中换取微信用户openid :param kw: :return: openid"""
wx_code = request.params['usercode']
app_id = request.params['appid']
secret = request.params['secret']
if not wx_code or not app_id o... | the_stack_v2_python_sparse | odoo_hcm/controllers/weixin_api.py | niulinlnc/odooExtModel | train | 4 |
5681ba3edd8f47f054dea9bd80e9efe677df5b8c | [
"self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]",
"x_direction = choice([-1, 1])\nx_distance = choice([0, 1, 2, 3, 4])\nself.x_step = x_direction * x_distance\ny_direction = choice([-1, 1])\ny_distance = choice([0, 1, 2, 3, 4])\nself.y_step = y_direction * y_distance",
"while len(self.x_... | <|body_start_0|>
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
<|end_body_0|>
<|body_start_1|>
x_direction = choice([-1, 1])
x_distance = choice([0, 1, 2, 3, 4])
self.x_step = x_direction * x_distance
y_direction = choice([-1, 1])
y... | in the class we are trying to get x and y co-ordinates. | RandomWalk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWalk:
"""in the class we are trying to get x and y co-ordinates."""
def __init__(self, num_points=5000):
"""we define some useful attribute throught code."""
<|body_0|>
def get_step(self):
"""in this method we do some calculation for x and y co-ordinates.""... | stack_v2_sparse_classes_75kplus_train_067961 | 1,314 | no_license | [
{
"docstring": "we define some useful attribute throught code.",
"name": "__init__",
"signature": "def __init__(self, num_points=5000)"
},
{
"docstring": "in this method we do some calculation for x and y co-ordinates.",
"name": "get_step",
"signature": "def get_step(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_002080 | Implement the Python class `RandomWalk` described below.
Class description:
in the class we are trying to get x and y co-ordinates.
Method signatures and docstrings:
- def __init__(self, num_points=5000): we define some useful attribute throught code.
- def get_step(self): in this method we do some calculation for x ... | Implement the Python class `RandomWalk` described below.
Class description:
in the class we are trying to get x and y co-ordinates.
Method signatures and docstrings:
- def __init__(self, num_points=5000): we define some useful attribute throught code.
- def get_step(self): in this method we do some calculation for x ... | eb40f515564fe781eaaf5202165e06be6b22b34d | <|skeleton|>
class RandomWalk:
"""in the class we are trying to get x and y co-ordinates."""
def __init__(self, num_points=5000):
"""we define some useful attribute throught code."""
<|body_0|>
def get_step(self):
"""in this method we do some calculation for x and y co-ordinates.""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomWalk:
"""in the class we are trying to get x and y co-ordinates."""
def __init__(self, num_points=5000):
"""we define some useful attribute throught code."""
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
def get_step(self):
"""in t... | the_stack_v2_python_sparse | matplotlibpractice/randomwalk_plotly.py | noshah/Python_Practice | train | 0 |
335529c8b4543e96e2b21823a4eb6bb98e1394d8 | [
"BaseElement.__init__(self, cle)\nself.longueur = 8\nself.nb_lever = 1\nself._attributs = {'jetee': Attribut(lambda: False)}",
"longueur = presentation.ajouter_choix(\"longueur de l'ancre\", None, Entier, self, 'longueur')\nlongueur.apercu = '{valeur} brasse(s)'\nlongueur.prompt = \"Longueur de l'ancre : \"\nlong... | <|body_start_0|>
BaseElement.__init__(self, cle)
self.longueur = 8
self.nb_lever = 1
self._attributs = {'jetee': Attribut(lambda: False)}
<|end_body_0|>
<|body_start_1|>
longueur = presentation.ajouter_choix("longueur de l'ancre", None, Entier, self, 'longueur')
longueur... | Classe représentant une ancre. | Ancre | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ancre:
"""Classe représentant une ancre."""
def __init__(self, cle=''):
"""Constructeur d'un type"""
<|body_0|>
def editer(self, presentation):
"""Édition de l'ancre."""
<|body_1|>
def get_description_ligne(self, personnage):
"""Retourne une ... | stack_v2_sparse_classes_75kplus_train_067962 | 7,163 | permissive | [
{
"docstring": "Constructeur d'un type",
"name": "__init__",
"signature": "def __init__(self, cle='')"
},
{
"docstring": "Édition de l'ancre.",
"name": "editer",
"signature": "def editer(self, presentation)"
},
{
"docstring": "Retourne une description d'une ligne de l'élément.",
... | 6 | stack_v2_sparse_classes_30k_train_043051 | Implement the Python class `Ancre` described below.
Class description:
Classe représentant une ancre.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur d'un type
- def editer(self, presentation): Édition de l'ancre.
- def get_description_ligne(self, personnage): Retourne une description d'u... | Implement the Python class `Ancre` described below.
Class description:
Classe représentant une ancre.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur d'un type
- def editer(self, presentation): Édition de l'ancre.
- def get_description_ligne(self, personnage): Retourne une description d'u... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class Ancre:
"""Classe représentant une ancre."""
def __init__(self, cle=''):
"""Constructeur d'un type"""
<|body_0|>
def editer(self, presentation):
"""Édition de l'ancre."""
<|body_1|>
def get_description_ligne(self, personnage):
"""Retourne une ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ancre:
"""Classe représentant une ancre."""
def __init__(self, cle=''):
"""Constructeur d'un type"""
BaseElement.__init__(self, cle)
self.longueur = 8
self.nb_lever = 1
self._attributs = {'jetee': Attribut(lambda: False)}
def editer(self, presentation):
... | the_stack_v2_python_sparse | src/secondaires/navigation/elements/ancre.py | vincent-lg/tsunami | train | 5 |
5e6bc672c1ce065ee12a84c7fa38a65a9df2a875 | [
"request_queryset = Request.objects.filter(sender=primary_key)\nif len(request_queryset) == 0:\n return Response(data={'': 'Your outbox is empty!'}, status=status.HTTP_200_OK)\nresponse_data = []\nfor request in request_queryset:\n data = {'id': request.id, 'request_title': request.title, 'sender': request.se... | <|body_start_0|>
request_queryset = Request.objects.filter(sender=primary_key)
if len(request_queryset) == 0:
return Response(data={'': 'Your outbox is empty!'}, status=status.HTTP_200_OK)
response_data = []
for request in request_queryset:
data = {'id': request.i... | OutboxView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OutboxView:
def get(self, request, primary_key, format=None):
"""Retrieve all requests received"""
<|body_0|>
def delete(self, request, primary_key, format=None):
"""Delete a request by sent currently logged in user"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_75kplus_train_067963 | 14,038 | no_license | [
{
"docstring": "Retrieve all requests received",
"name": "get",
"signature": "def get(self, request, primary_key, format=None)"
},
{
"docstring": "Delete a request by sent currently logged in user",
"name": "delete",
"signature": "def delete(self, request, primary_key, format=None)"
}
... | 2 | stack_v2_sparse_classes_30k_test_002460 | Implement the Python class `OutboxView` described below.
Class description:
Implement the OutboxView class.
Method signatures and docstrings:
- def get(self, request, primary_key, format=None): Retrieve all requests received
- def delete(self, request, primary_key, format=None): Delete a request by sent currently log... | Implement the Python class `OutboxView` described below.
Class description:
Implement the OutboxView class.
Method signatures and docstrings:
- def get(self, request, primary_key, format=None): Retrieve all requests received
- def delete(self, request, primary_key, format=None): Delete a request by sent currently log... | a112a110bf9d932ecb300dd2354914d8297350c4 | <|skeleton|>
class OutboxView:
def get(self, request, primary_key, format=None):
"""Retrieve all requests received"""
<|body_0|>
def delete(self, request, primary_key, format=None):
"""Delete a request by sent currently logged in user"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OutboxView:
def get(self, request, primary_key, format=None):
"""Retrieve all requests received"""
request_queryset = Request.objects.filter(sender=primary_key)
if len(request_queryset) == 0:
return Response(data={'': 'Your outbox is empty!'}, status=status.HTTP_200_OK)
... | the_stack_v2_python_sparse | backend/accounts/views.py | s3855825/BISbackend | train | 0 | |
ae2de0cebcca72fc50ed0898603b49c1bc827754 | [
"self.setFragmentParent(page)\nself.hyperbola = hyperbola\nself._resolver = ixmantissa.ITemplateNameResolver(self.hyperbola.store)\nsuper(BlogListFragment, self).__init__()",
"site = ixmantissa.ISiteURLGenerator(self.hyperbola.store.parent)\nblogURL = websharing.linkTo(blog)\nsiteURL = site.encryptedRoot()\nblogU... | <|body_start_0|>
self.setFragmentParent(page)
self.hyperbola = hyperbola
self._resolver = ixmantissa.ITemplateNameResolver(self.hyperbola.store)
super(BlogListFragment, self).__init__()
<|end_body_0|>
<|body_start_1|>
site = ixmantissa.ISiteURLGenerator(self.hyperbola.store.pare... | Fragment which renders a list of all blogs | BlogListFragment | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlogListFragment:
"""Fragment which renders a list of all blogs"""
def __init__(self, page, hyperbola):
"""@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence"""
<|body_0|>
def _getPostURL(self, blog):
"""Figure out a URL which could be used for ... | stack_v2_sparse_classes_75kplus_train_067964 | 28,777 | permissive | [
{
"docstring": "@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence",
"name": "__init__",
"signature": "def __init__(self, page, hyperbola)"
},
{
"docstring": "Figure out a URL which could be used for posting to C{blog} @type blog: L{xmantissa.sharing.SharedProxy} @rtype: L{nevo... | 3 | stack_v2_sparse_classes_30k_train_027606 | Implement the Python class `BlogListFragment` described below.
Class description:
Fragment which renders a list of all blogs
Method signatures and docstrings:
- def __init__(self, page, hyperbola): @type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence
- def _getPostURL(self, blog): Figure out a URL whi... | Implement the Python class `BlogListFragment` described below.
Class description:
Fragment which renders a list of all blogs
Method signatures and docstrings:
- def __init__(self, page, hyperbola): @type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence
- def _getPostURL(self, blog): Figure out a URL whi... | bf9c26051e8dfd1325bdc63aab1c560dbad7f6b7 | <|skeleton|>
class BlogListFragment:
"""Fragment which renders a list of all blogs"""
def __init__(self, page, hyperbola):
"""@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence"""
<|body_0|>
def _getPostURL(self, blog):
"""Figure out a URL which could be used for ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BlogListFragment:
"""Fragment which renders a list of all blogs"""
def __init__(self, page, hyperbola):
"""@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence"""
self.setFragmentParent(page)
self.hyperbola = hyperbola
self._resolver = ixmantissa.ITemplateN... | the_stack_v2_python_sparse | Hyperbola/hyperbola/hyperbola_view.py | feitianyiren/divmod.org | train | 0 |
8f696f1d0754125353aab074add601178bd97b2c | [
"w = width / 2\nif samples > 0:\n ext = samples / 2 * sample_spacing\n x = np.arange(-ext, ext, sample_spacing, dtype=config.precision)\n y = np.arange(-ext, ext, sample_spacing, dtype=config.precision)\n arr = np.zeros((samples, samples))\nelse:\n arr, x, y = (None, None, None)\nif orientation.lower... | <|body_start_0|>
w = width / 2
if samples > 0:
ext = samples / 2 * sample_spacing
x = np.arange(-ext, ext, sample_spacing, dtype=config.precision)
y = np.arange(-ext, ext, sample_spacing, dtype=config.precision)
arr = np.zeros((samples, samples))
e... | Representation of a slit or pair of slits. | Slit | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Slit:
"""Representation of a slit or pair of slits."""
def __init__(self, width, orientation='Vertical', sample_spacing=None, samples=0):
"""Create a new Slit instancnp. Parameters ---------- width : `float` the width of the slit in microns orientation : `string`, {'Horizontal', 'Ver... | stack_v2_sparse_classes_75kplus_train_067965 | 15,826 | permissive | [
{
"docstring": "Create a new Slit instancnp. Parameters ---------- width : `float` the width of the slit in microns orientation : `string`, {'Horizontal', 'Vertical', 'Crossed', 'Both'} the orientation of the slit; Crossed and Both produce the same results sample_spacing : `float` spacing of samples in the synt... | 2 | stack_v2_sparse_classes_30k_train_044778 | Implement the Python class `Slit` described below.
Class description:
Representation of a slit or pair of slits.
Method signatures and docstrings:
- def __init__(self, width, orientation='Vertical', sample_spacing=None, samples=0): Create a new Slit instancnp. Parameters ---------- width : `float` the width of the sl... | Implement the Python class `Slit` described below.
Class description:
Representation of a slit or pair of slits.
Method signatures and docstrings:
- def __init__(self, width, orientation='Vertical', sample_spacing=None, samples=0): Create a new Slit instancnp. Parameters ---------- width : `float` the width of the sl... | 01fb5572b7a1ac5e3ee095f89f133166050af719 | <|skeleton|>
class Slit:
"""Representation of a slit or pair of slits."""
def __init__(self, width, orientation='Vertical', sample_spacing=None, samples=0):
"""Create a new Slit instancnp. Parameters ---------- width : `float` the width of the slit in microns orientation : `string`, {'Horizontal', 'Ver... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Slit:
"""Representation of a slit or pair of slits."""
def __init__(self, width, orientation='Vertical', sample_spacing=None, samples=0):
"""Create a new Slit instancnp. Parameters ---------- width : `float` the width of the slit in microns orientation : `string`, {'Horizontal', 'Vertical', 'Cros... | the_stack_v2_python_sparse | prysm/objects.py | JakobSilbermann/prysm | train | 0 |
5aba69e32bace2512f6077f56d4679e82f7c1586 | [
"self.mailbox_vec = mailbox_vec\nself.pst_params = pst_params\nself.skip_mbx_permit_for_pst = skip_mbx_permit_for_pst\nself.target_folder_path = target_folder_path\nself.target_mailbox = target_mailbox",
"if dictionary is None:\n return None\nmailbox_vec = None\nif dictionary.get('mailboxVec') != None:\n ma... | <|body_start_0|>
self.mailbox_vec = mailbox_vec
self.pst_params = pst_params
self.skip_mbx_permit_for_pst = skip_mbx_permit_for_pst
self.target_folder_path = target_folder_path
self.target_mailbox = target_mailbox
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mailbox recovery. pst_params (EwsToPstConversionPar... | RestoreOutlookParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreOutlookParams:
"""Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mai... | stack_v2_sparse_classes_75kplus_train_067966 | 4,261 | permissive | [
{
"docstring": "Constructor for the RestoreOutlookParams class",
"name": "__init__",
"signature": "def __init__(self, mailbox_vec=None, pst_params=None, skip_mbx_permit_for_pst=None, target_folder_path=None, target_mailbox=None)"
},
{
"docstring": "Creates an instance of this model from a dictio... | 2 | stack_v2_sparse_classes_30k_train_042157 | Implement the Python class `RestoreOutlookParams` described below.
Class description:
Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is t... | Implement the Python class `RestoreOutlookParams` described below.
Class description:
Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is t... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreOutlookParams:
"""Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mai... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RestoreOutlookParams:
"""Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mailbox recovery... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_outlook_params.py | cohesity/management-sdk-python | train | 24 |
498cde9ae6a58951ac49be55226c54d4b7774693 | [
"Parametre.__init__(self, 'éditer', 'edit')\nself.schema = '<texte_libre>'\nself.aide_courte = \"ouvre l'éditeur de modèle de navires\"\nself.aide_longue = \"Cette commande ouvre l'éditeur de prototype de navire. Le terme modèle est également utilisé. Vous devez préciser en paramètre la clé du modèle (par exemple |... | <|body_start_0|>
Parametre.__init__(self, 'éditer', 'edit')
self.schema = '<texte_libre>'
self.aide_courte = "ouvre l'éditeur de modèle de navires"
self.aide_longue = "Cette commande ouvre l'éditeur de prototype de navire. Le terme modèle est également utilisé. Vous devez préciser en par... | Commande 'navire éditer'. | PrmEditer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmEditer:
"""Commande 'navire éditer'."""
def __init__(self):
"""Constructeur de la commande"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
P... | stack_v2_sparse_classes_75kplus_train_067967 | 3,818 | permissive | [
{
"docstring": "Constructeur de la commande",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Méthode d'interprétation de commande",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | stack_v2_sparse_classes_30k_train_032234 | Implement the Python class `PrmEditer` described below.
Class description:
Commande 'navire éditer'.
Method signatures and docstrings:
- def __init__(self): Constructeur de la commande
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande | Implement the Python class `PrmEditer` described below.
Class description:
Commande 'navire éditer'.
Method signatures and docstrings:
- def __init__(self): Constructeur de la commande
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
<|skeleton|>
class PrmEditer:
"""Commande... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmEditer:
"""Commande 'navire éditer'."""
def __init__(self):
"""Constructeur de la commande"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PrmEditer:
"""Commande 'navire éditer'."""
def __init__(self):
"""Constructeur de la commande"""
Parametre.__init__(self, 'éditer', 'edit')
self.schema = '<texte_libre>'
self.aide_courte = "ouvre l'éditeur de modèle de navires"
self.aide_longue = "Cette commande ou... | the_stack_v2_python_sparse | src/secondaires/navigation/commandes/navire/editer.py | vincent-lg/tsunami | train | 5 |
005e54a5ee815a416767a4bb17f8d0cb6fe2b80f | [
"super().__init__(restaurant_name, cuisine_type='Ice Cream Stand')\nself.cuisine_type = 'Ice Cream Stand'\nself.flavors = ['vanila', 'chocolate', 'rocky road', 'mint chocolate chip', 'chocolate chip cookie dough']",
"message = f'We have the following flavors: \\n'\nfor flavor in self.flavors:\n message += f'\\... | <|body_start_0|>
super().__init__(restaurant_name, cuisine_type='Ice Cream Stand')
self.cuisine_type = 'Ice Cream Stand'
self.flavors = ['vanila', 'chocolate', 'rocky road', 'mint chocolate chip', 'chocolate chip cookie dough']
<|end_body_0|>
<|body_start_1|>
message = f'We have the fol... | represents a specific typ of restaurant in the Restaurant Class | IceCreamStand | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IceCreamStand:
"""represents a specific typ of restaurant in the Restaurant Class"""
def __init__(self, restaurant_name, cuisine_type='Ice Cream Stand'):
"""Initialize attributes of the parent class."""
<|body_0|>
def show_flavors(self):
"""method to list flavors... | stack_v2_sparse_classes_75kplus_train_067968 | 6,180 | no_license | [
{
"docstring": "Initialize attributes of the parent class.",
"name": "__init__",
"signature": "def __init__(self, restaurant_name, cuisine_type='Ice Cream Stand')"
},
{
"docstring": "method to list flavors",
"name": "show_flavors",
"signature": "def show_flavors(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_035784 | Implement the Python class `IceCreamStand` described below.
Class description:
represents a specific typ of restaurant in the Restaurant Class
Method signatures and docstrings:
- def __init__(self, restaurant_name, cuisine_type='Ice Cream Stand'): Initialize attributes of the parent class.
- def show_flavors(self): m... | Implement the Python class `IceCreamStand` described below.
Class description:
represents a specific typ of restaurant in the Restaurant Class
Method signatures and docstrings:
- def __init__(self, restaurant_name, cuisine_type='Ice Cream Stand'): Initialize attributes of the parent class.
- def show_flavors(self): m... | 8ac53cf439bc55896e8f5a6d7f52f60a6cb34ceb | <|skeleton|>
class IceCreamStand:
"""represents a specific typ of restaurant in the Restaurant Class"""
def __init__(self, restaurant_name, cuisine_type='Ice Cream Stand'):
"""Initialize attributes of the parent class."""
<|body_0|>
def show_flavors(self):
"""method to list flavors... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IceCreamStand:
"""represents a specific typ of restaurant in the Restaurant Class"""
def __init__(self, restaurant_name, cuisine_type='Ice Cream Stand'):
"""Initialize attributes of the parent class."""
super().__init__(restaurant_name, cuisine_type='Ice Cream Stand')
self.cuisine... | the_stack_v2_python_sparse | python_work/Chapter_9/9.6-9.8.py | BW1ll/PythonCrashCourse | train | 1 |
199ca5cbce83ec98f09c770564ab3cf7d11bea5b | [
"self.beta = Para.beta\nself.Pi = Para.Pi\nself.mc = MarkovChain(self.Pi)\nself.G = Para.G\nself.S = len(Para.Pi)\nself.Theta = Para.Theta\nself.Para = Para\nself.mugrid = mugrid\nself.solve_time1_bellman()\nself.T.time_0 = True",
"Para, mugrid0 = (self.Para, self.mugrid)\nS = len(Para.Pi)\nPP = Planners_Allocati... | <|body_start_0|>
self.beta = Para.beta
self.Pi = Para.Pi
self.mc = MarkovChain(self.Pi)
self.G = Para.G
self.S = len(Para.Pi)
self.Theta = Para.Theta
self.Para = Para
self.mugrid = mugrid
self.solve_time1_bellman()
self.T.time_0 = True
<|en... | Compute the planner's allocation by solving Bellman equation. | Planners_Allocation_Bellman | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Planners_Allocation_Bellman:
"""Compute the planner's allocation by solving Bellman equation."""
def __init__(self, Para, mugrid):
"""Initializes the class from the calibration Para"""
<|body_0|>
def solve_time1_bellman(self):
"""Solve the time 1 Bellman equation... | stack_v2_sparse_classes_75kplus_train_067969 | 13,164 | permissive | [
{
"docstring": "Initializes the class from the calibration Para",
"name": "__init__",
"signature": "def __init__(self, Para, mugrid)"
},
{
"docstring": "Solve the time 1 Bellman equation for calibration Para and initial grid mugrid0",
"name": "solve_time1_bellman",
"signature": "def solv... | 6 | stack_v2_sparse_classes_30k_test_001532 | Implement the Python class `Planners_Allocation_Bellman` described below.
Class description:
Compute the planner's allocation by solving Bellman equation.
Method signatures and docstrings:
- def __init__(self, Para, mugrid): Initializes the class from the calibration Para
- def solve_time1_bellman(self): Solve the ti... | Implement the Python class `Planners_Allocation_Bellman` described below.
Class description:
Compute the planner's allocation by solving Bellman equation.
Method signatures and docstrings:
- def __init__(self, Para, mugrid): Initializes the class from the calibration Para
- def solve_time1_bellman(self): Solve the ti... | 8832a74acd219a71cb0a99dc63c5e976598ac999 | <|skeleton|>
class Planners_Allocation_Bellman:
"""Compute the planner's allocation by solving Bellman equation."""
def __init__(self, Para, mugrid):
"""Initializes the class from the calibration Para"""
<|body_0|>
def solve_time1_bellman(self):
"""Solve the time 1 Bellman equation... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Planners_Allocation_Bellman:
"""Compute the planner's allocation by solving Bellman equation."""
def __init__(self, Para, mugrid):
"""Initializes the class from the calibration Para"""
self.beta = Para.beta
self.Pi = Para.Pi
self.mc = MarkovChain(self.Pi)
self.G = ... | the_stack_v2_python_sparse | opt_tax_recur/lucas_stokey.py | chenwang/QuantEcon.lectures.code | train | 0 |
96b36dbc37d123211d4e0f679a9080b13a523664 | [
"if Singleton.__instance == None:\n Singleton()\nreturn Singleton.__instance",
"if Singleton.__instance != None:\n print('Raised')\n raise Exception('This class is a singleton!')\nelse:\n Singleton.__instance = self"
] | <|body_start_0|>
if Singleton.__instance == None:
Singleton()
return Singleton.__instance
<|end_body_0|>
<|body_start_1|>
if Singleton.__instance != None:
print('Raised')
raise Exception('This class is a singleton!')
else:
Singleton.__inst... | Singleton | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Singleton:
def getInstance():
"""Static access method."""
<|body_0|>
def __init__(self):
"""Virtually private constructor."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if Singleton.__instance == None:
Singleton()
return Single... | stack_v2_sparse_classes_75kplus_train_067970 | 1,347 | permissive | [
{
"docstring": "Static access method.",
"name": "getInstance",
"signature": "def getInstance()"
},
{
"docstring": "Virtually private constructor.",
"name": "__init__",
"signature": "def __init__(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_034257 | Implement the Python class `Singleton` described below.
Class description:
Implement the Singleton class.
Method signatures and docstrings:
- def getInstance(): Static access method.
- def __init__(self): Virtually private constructor. | Implement the Python class `Singleton` described below.
Class description:
Implement the Singleton class.
Method signatures and docstrings:
- def getInstance(): Static access method.
- def __init__(self): Virtually private constructor.
<|skeleton|>
class Singleton:
def getInstance():
"""Static access me... | 089348c80e3f49a4a56839bfb921033e5386f07e | <|skeleton|>
class Singleton:
def getInstance():
"""Static access method."""
<|body_0|>
def __init__(self):
"""Virtually private constructor."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Singleton:
def getInstance():
"""Static access method."""
if Singleton.__instance == None:
Singleton()
return Singleton.__instance
def __init__(self):
"""Virtually private constructor."""
if Singleton.__instance != None:
print('Raised')
... | the_stack_v2_python_sparse | design_patterns/creational_design_patterns/singleton/singleton_example_learning.py | ppinko/python_knowledge_library | train | 0 | |
9b42a9cdebe9c8d70d467c6afe09e9f31d74560e | [
"self.continue_on_error = continue_on_error\nself.file_recovery_method = file_recovery_method\nself.filenames = filenames\nself.filter_ip_config = filter_ip_config\nself.is_file_based_volume_restore = is_file_based_volume_restore\nself.mount_disks_on_vm = mount_disks_on_vm\nself.name = name\nself.new_base_directory... | <|body_start_0|>
self.continue_on_error = continue_on_error
self.file_recovery_method = file_recovery_method
self.filenames = filenames
self.filter_ip_config = filter_ip_config
self.is_file_based_volume_restore = is_file_based_volume_restore
self.mount_disks_on_vm = mount... | Implementation of the 'RestoreFilesTaskRequest' model. Specifies information about a Restore Task that recovers files and folders. Attributes: continue_on_error (bool): Specifies if the Restore Task should continue even if the copy operation of some files and folders fails. If true, the Cohesity Cluster ignores intermi... | RestoreFilesTaskRequest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreFilesTaskRequest:
"""Implementation of the 'RestoreFilesTaskRequest' model. Specifies information about a Restore Task that recovers files and folders. Attributes: continue_on_error (bool): Specifies if the Restore Task should continue even if the copy operation of some files and folders f... | stack_v2_sparse_classes_75kplus_train_067971 | 10,417 | permissive | [
{
"docstring": "Constructor for the RestoreFilesTaskRequest class",
"name": "__init__",
"signature": "def __init__(self, continue_on_error=None, file_recovery_method=None, filenames=None, filter_ip_config=None, is_file_based_volume_restore=None, mount_disks_on_vm=None, name=None, new_base_directory=None... | 2 | stack_v2_sparse_classes_30k_train_044909 | Implement the Python class `RestoreFilesTaskRequest` described below.
Class description:
Implementation of the 'RestoreFilesTaskRequest' model. Specifies information about a Restore Task that recovers files and folders. Attributes: continue_on_error (bool): Specifies if the Restore Task should continue even if the cop... | Implement the Python class `RestoreFilesTaskRequest` described below.
Class description:
Implementation of the 'RestoreFilesTaskRequest' model. Specifies information about a Restore Task that recovers files and folders. Attributes: continue_on_error (bool): Specifies if the Restore Task should continue even if the cop... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreFilesTaskRequest:
"""Implementation of the 'RestoreFilesTaskRequest' model. Specifies information about a Restore Task that recovers files and folders. Attributes: continue_on_error (bool): Specifies if the Restore Task should continue even if the copy operation of some files and folders f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RestoreFilesTaskRequest:
"""Implementation of the 'RestoreFilesTaskRequest' model. Specifies information about a Restore Task that recovers files and folders. Attributes: continue_on_error (bool): Specifies if the Restore Task should continue even if the copy operation of some files and folders fails. If true... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_files_task_request.py | cohesity/management-sdk-python | train | 24 |
f5be734140feedec0c8a2013125c2766ccb55d0e | [
"self.px, self.py, self.pz = (px, py, pz)\nself.nx, self.ny, self.nz = (nx, ny, nz)\nself.size = size\nself.color = color\nself.weight = weight\nself.update_times = update_times\nself.last_update = last_update",
"p = np.array([self.px, self.py, self.pz, 1])\np = Twc.dot(p)\nn = np.array([self.nx, self.ny, self.nz... | <|body_start_0|>
self.px, self.py, self.pz = (px, py, pz)
self.nx, self.ny, self.nz = (nx, ny, nz)
self.size = size
self.color = color
self.weight = weight
self.update_times = update_times
self.last_update = last_update
<|end_body_0|>
<|body_start_1|>
p =... | SurfelElement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SurfelElement:
def __init__(self, px, py, pz, nx, ny, nz, size, color, weight, update_times, last_update):
"""Surfel Element Data Structure. Arguments: px,py,pz: the surfel center nx,ny,nz: the surfel normal in three axes size: superpixel.size * \\ fabs(superpixel.mean_depth / (camera_f ... | stack_v2_sparse_classes_75kplus_train_067972 | 4,106 | no_license | [
{
"docstring": "Surfel Element Data Structure. Arguments: px,py,pz: the surfel center nx,ny,nz: the surfel normal in three axes size: superpixel.size * \\\\ fabs(superpixel.mean_depth / (camera_f * superpixel.view_cos)) color: intensity weight: min(1.0 / superpixel.mean_depth / superpixel.mean_depth, 1.0) updat... | 5 | stack_v2_sparse_classes_30k_train_041720 | Implement the Python class `SurfelElement` described below.
Class description:
Implement the SurfelElement class.
Method signatures and docstrings:
- def __init__(self, px, py, pz, nx, ny, nz, size, color, weight, update_times, last_update): Surfel Element Data Structure. Arguments: px,py,pz: the surfel center nx,ny,... | Implement the Python class `SurfelElement` described below.
Class description:
Implement the SurfelElement class.
Method signatures and docstrings:
- def __init__(self, px, py, pz, nx, ny, nz, size, color, weight, update_times, last_update): Surfel Element Data Structure. Arguments: px,py,pz: the surfel center nx,ny,... | db19dd07713a534b037394434e752919f4cd2200 | <|skeleton|>
class SurfelElement:
def __init__(self, px, py, pz, nx, ny, nz, size, color, weight, update_times, last_update):
"""Surfel Element Data Structure. Arguments: px,py,pz: the surfel center nx,ny,nz: the surfel normal in three axes size: superpixel.size * \\ fabs(superpixel.mean_depth / (camera_f ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SurfelElement:
def __init__(self, px, py, pz, nx, ny, nz, size, color, weight, update_times, last_update):
"""Surfel Element Data Structure. Arguments: px,py,pz: the surfel center nx,ny,nz: the surfel normal in three axes size: superpixel.size * \\ fabs(superpixel.mean_depth / (camera_f * superpixel.v... | the_stack_v2_python_sparse | src/surfel_element.py | Roger-Chuh/DenseMapping | train | 0 | |
74b48a5be39e8fe2aa2e75f6b7b754824aebbac0 | [
"super(XMLInterfacePlugin, self).initialize()\nremote = RemoteInterfaceSession(self.options.url, self.options.timeout)\ntry:\n remote.connect()\n self.interface = XMLInterface(remote.read_data())\nexcept FTPError as e:\n self.unknown(e)\nexcept HTTPError as e:\n self.unknown(e)",
"super(XMLInterfacePl... | <|body_start_0|>
super(XMLInterfacePlugin, self).initialize()
remote = RemoteInterfaceSession(self.options.url, self.options.timeout)
try:
remote.connect()
self.interface = XMLInterface(remote.read_data())
except FTPError as e:
self.unknown(e)
... | This is the base class to create a new plugin using the XML interface. | XMLInterfacePlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLInterfacePlugin:
"""This is the base class to create a new plugin using the XML interface."""
def initialize(self):
"""Plugin initialization. Establish a connection to the remote server. Set attribute :attr:`interface` that store the XML interface instance and get data from it."""... | stack_v2_sparse_classes_75kplus_train_067973 | 4,066 | permissive | [
{
"docstring": "Plugin initialization. Establish a connection to the remote server. Set attribute :attr:`interface` that store the XML interface instance and get data from it.",
"name": "initialize",
"signature": "def initialize(self)"
},
{
"docstring": "Define extra arguments for this plugin.",... | 2 | null | Implement the Python class `XMLInterfacePlugin` described below.
Class description:
This is the base class to create a new plugin using the XML interface.
Method signatures and docstrings:
- def initialize(self): Plugin initialization. Establish a connection to the remote server. Set attribute :attr:`interface` that ... | Implement the Python class `XMLInterfacePlugin` described below.
Class description:
This is the base class to create a new plugin using the XML interface.
Method signatures and docstrings:
- def initialize(self): Plugin initialization. Establish a connection to the remote server. Set attribute :attr:`interface` that ... | 4a66d26f9d2982609489eaa0f57d6afb16aca37c | <|skeleton|>
class XMLInterfacePlugin:
"""This is the base class to create a new plugin using the XML interface."""
def initialize(self):
"""Plugin initialization. Establish a connection to the remote server. Set attribute :attr:`interface` that store the XML interface instance and get data from it."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XMLInterfacePlugin:
"""This is the base class to create a new plugin using the XML interface."""
def initialize(self):
"""Plugin initialization. Establish a connection to the remote server. Set attribute :attr:`interface` that store the XML interface instance and get data from it."""
supe... | the_stack_v2_python_sparse | plugin/plugins/jit/src/jit/plugin.py | crazy-canux/zplugin | train | 0 |
ff9edaf548a129ab1b37732c94dc0f1193ada842 | [
"self.turbine = turbine\nself.controller = controller\nself.linturb = linturb",
"if fig and ax:\n self.fig = fig\n self.ax = ax\nelse:\n self.fig, self.ax = plt.subplots(1, 1, num=num)\nw, H = self.get_nyquistdata(u, omega, k_float=k_float)\nself.line, = self.ax.plot(H.real, H.imag, **kwargs)\nplt.scatte... | <|body_start_0|>
self.turbine = turbine
self.controller = controller
self.linturb = linturb
<|end_body_0|>
<|body_start_1|>
if fig and ax:
self.fig = fig
self.ax = ax
else:
self.fig, self.ax = plt.subplots(1, 1, num=num)
w, H = self.ge... | lin_plotting | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class lin_plotting:
def __init__(self, controller, turbine, linturb):
"""Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object"""
<|body_0|>
def plot_nyquist(self, u, omega, k_float=0.0, xlim=None... | stack_v2_sparse_classes_75kplus_train_067974 | 2,541 | permissive | [
{
"docstring": "Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object",
"name": "__init__",
"signature": "def __init__(self, controller, turbine, linturb)"
},
{
"docstring": "Plot nyquist diagram Parameters: ---... | 3 | stack_v2_sparse_classes_30k_train_027636 | Implement the Python class `lin_plotting` described below.
Class description:
Implement the lin_plotting class.
Method signatures and docstrings:
- def __init__(self, controller, turbine, linturb): Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object RO... | Implement the Python class `lin_plotting` described below.
Class description:
Implement the lin_plotting class.
Method signatures and docstrings:
- def __init__(self, controller, turbine, linturb): Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object RO... | e3b7db779ad9e7bea5dea692e92f52b10116cf02 | <|skeleton|>
class lin_plotting:
def __init__(self, controller, turbine, linturb):
"""Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object"""
<|body_0|>
def plot_nyquist(self, u, omega, k_float=0.0, xlim=None... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class lin_plotting:
def __init__(self, controller, turbine, linturb):
"""Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object"""
self.turbine = turbine
self.controller = controller
self.linturb = li... | the_stack_v2_python_sparse | ROSCO_toolbox/linear/lin_vis.py | NREL/ROSCO | train | 78 | |
7f493ff3ee9faac65f7389343110f0f061a37840 | [
"if cls.action_map[name]['proc_err']:\n if err > 0:\n return args[1]\n return cls.action_map[name]['func'](*args, **kwargs)\nreturn cls.action_map[name]['func'](err, *args, **kwargs)",
"def wrapper(fun):\n \"\"\"Decorator internal.\"\"\"\n cls.action_map[name] = {}\n cls.action_map[name]['fu... | <|body_start_0|>
if cls.action_map[name]['proc_err']:
if err > 0:
return args[1]
return cls.action_map[name]['func'](*args, **kwargs)
return cls.action_map[name]['func'](err, *args, **kwargs)
<|end_body_0|>
<|body_start_1|>
def wrapper(fun):
"... | Mapping of action names to action functions. | ActionMap | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionMap:
"""Mapping of action names to action functions."""
def call(cls, name, err, *args, **kwargs):
"""Return the function associated with key."""
<|body_0|>
def add(cls, name, proc_err):
"""Adds name => fun to the map."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus_train_067975 | 7,666 | permissive | [
{
"docstring": "Return the function associated with key.",
"name": "call",
"signature": "def call(cls, name, err, *args, **kwargs)"
},
{
"docstring": "Adds name => fun to the map.",
"name": "add",
"signature": "def add(cls, name, proc_err)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001854 | Implement the Python class `ActionMap` described below.
Class description:
Mapping of action names to action functions.
Method signatures and docstrings:
- def call(cls, name, err, *args, **kwargs): Return the function associated with key.
- def add(cls, name, proc_err): Adds name => fun to the map. | Implement the Python class `ActionMap` described below.
Class description:
Mapping of action names to action functions.
Method signatures and docstrings:
- def call(cls, name, err, *args, **kwargs): Return the function associated with key.
- def add(cls, name, proc_err): Adds name => fun to the map.
<|skeleton|>
cla... | b3991698e9eafacfe92449a55f0740ec82cc0302 | <|skeleton|>
class ActionMap:
"""Mapping of action names to action functions."""
def call(cls, name, err, *args, **kwargs):
"""Return the function associated with key."""
<|body_0|>
def add(cls, name, proc_err):
"""Adds name => fun to the map."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ActionMap:
"""Mapping of action names to action functions."""
def call(cls, name, err, *args, **kwargs):
"""Return the function associated with key."""
if cls.action_map[name]['proc_err']:
if err > 0:
return args[1]
return cls.action_map[name]['func... | the_stack_v2_python_sparse | src/backend/opus/pvm/posix/actions.py | charmoniumQ/opus | train | 0 |
a54c4ba79b1eeb552781a310185759e1c9111bc6 | [
"self.sums = list()\nself.matrix = matrix\nfor row in matrix:\n self.sums.append(StupidSum(row))",
"delta = val - self.matrix[row][col]\nself.matrix[row][col] = val\nself.sums[row].update(col, delta)",
"s = 0\nfor i in xrange(row1, row2 + 1):\n s += self.sums[i].query(col2) - self.sums[i].query(col1 - 1)\... | <|body_start_0|>
self.sums = list()
self.matrix = matrix
for row in matrix:
self.sums.append(StupidSum(row))
<|end_body_0|>
<|body_start_1|>
delta = val - self.matrix[row][col]
self.matrix[row][col] = val
self.sums[row].update(col, delta)
<|end_body_1|>
<|bo... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
"""update the element at matrix[row,col] to val. :type row: int :type col: int :type val: int :rtype: void"""
... | stack_v2_sparse_classes_75kplus_train_067976 | 1,919 | no_license | [
{
"docstring": "initialize your data structure here. :type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": "update the element at matrix[row,col] to val. :type row: int :type col: int :type val: int :rtype: void",
"name": "update",
... | 3 | stack_v2_sparse_classes_30k_train_036629 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def update(self, row, col, val): update the element at matrix[row,col] to val. ... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def update(self, row, col, val): update the element at matrix[row,col] to val. ... | 490c38a9478838ff23c9f910cc950633b1e3f994 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
"""update the element at matrix[row,col] to val. :type row: int :type col: int :type val: int :rtype: void"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
self.sums = list()
self.matrix = matrix
for row in matrix:
self.sums.append(StupidSum(row))
def update(self, row, col, val):
"""update the el... | the_stack_v2_python_sparse | Range Sum Query 2D - Mutable/solution.py | normanyahq/LeetCodeSolution | train | 0 | |
ba75b39a7eab16a2f69e24dacad66033d6c364ee | [
"tipocontato = get_a_contacttype(id)\nif not tipocontato:\n api.abort(404)\nelse:\n return tipocontato",
"tipocontato = get_a_contacttype(id)\nif not tipocontato:\n api.abort(404)\nelse:\n data = request.json\n return update_contacttype(tipocontato, data=data)"
] | <|body_start_0|>
tipocontato = get_a_contacttype(id)
if not tipocontato:
api.abort(404)
else:
return tipocontato
<|end_body_0|>
<|body_start_1|>
tipocontato = get_a_contacttype(id)
if not tipocontato:
api.abort(404)
else:
d... | Contato | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Contato:
def get(self, id):
"""Obtem informações de um tipo contato com base no seu id"""
<|body_0|>
def patch(self, id):
"""Atualiza um tipo contato Obs: para inativar, coloque 'ativo': false"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
tipocont... | stack_v2_sparse_classes_75kplus_train_067977 | 2,623 | no_license | [
{
"docstring": "Obtem informações de um tipo contato com base no seu id",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Atualiza um tipo contato Obs: para inativar, coloque 'ativo': false",
"name": "patch",
"signature": "def patch(self, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018304 | Implement the Python class `Contato` described below.
Class description:
Implement the Contato class.
Method signatures and docstrings:
- def get(self, id): Obtem informações de um tipo contato com base no seu id
- def patch(self, id): Atualiza um tipo contato Obs: para inativar, coloque 'ativo': false | Implement the Python class `Contato` described below.
Class description:
Implement the Contato class.
Method signatures and docstrings:
- def get(self, id): Obtem informações de um tipo contato com base no seu id
- def patch(self, id): Atualiza um tipo contato Obs: para inativar, coloque 'ativo': false
<|skeleton|>
... | a86fcb085af8567a661d47876f8b9f13d7b062a9 | <|skeleton|>
class Contato:
def get(self, id):
"""Obtem informações de um tipo contato com base no seu id"""
<|body_0|>
def patch(self, id):
"""Atualiza um tipo contato Obs: para inativar, coloque 'ativo': false"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Contato:
def get(self, id):
"""Obtem informações de um tipo contato com base no seu id"""
tipocontato = get_a_contacttype(id)
if not tipocontato:
api.abort(404)
else:
return tipocontato
def patch(self, id):
"""Atualiza um tipo contato Obs: p... | the_stack_v2_python_sparse | backend/app/main/controller/tipocontato_controller.py | AnderSilva/ozomali | train | 1 | |
919af2847a293420536302dd08ff7e5408c7fe6e | [
"cluster = self.cluster\ncluster.set_configuration_options(values={'start_rpc': 'true', 'rpc_server_type': 'hsha', 'rpc_max_threads': 20})\ncluster.populate(1)\nnode1, = cluster.nodelist()\ncluster.start()\nsession = self.patient_cql_connection(node1)\ncreate_ks(session, 'test', 1)\nsession.execute('CREATE TABLE \"... | <|body_start_0|>
cluster = self.cluster
cluster.set_configuration_options(values={'start_rpc': 'true', 'rpc_server_type': 'hsha', 'rpc_max_threads': 20})
cluster.populate(1)
node1, = cluster.nodelist()
cluster.start()
session = self.patient_cql_connection(node1)
c... | TestThriftHSHA | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestThriftHSHA:
def test_closing_connections(self):
"""@jira_ticket CASSANDRA-6546 Test CASSANDRA-6546 - do connections get closed when disabling / renabling thrift service?"""
<|body_0|>
def test_6285(self):
"""@jira_ticket CASSANDRA-6285 Test CASSANDRA-6285 with Vi... | stack_v2_sparse_classes_75kplus_train_067978 | 4,476 | permissive | [
{
"docstring": "@jira_ticket CASSANDRA-6546 Test CASSANDRA-6546 - do connections get closed when disabling / renabling thrift service?",
"name": "test_closing_connections",
"signature": "def test_closing_connections(self)"
},
{
"docstring": "@jira_ticket CASSANDRA-6285 Test CASSANDRA-6285 with V... | 2 | stack_v2_sparse_classes_30k_train_016118 | Implement the Python class `TestThriftHSHA` described below.
Class description:
Implement the TestThriftHSHA class.
Method signatures and docstrings:
- def test_closing_connections(self): @jira_ticket CASSANDRA-6546 Test CASSANDRA-6546 - do connections get closed when disabling / renabling thrift service?
- def test_... | Implement the Python class `TestThriftHSHA` described below.
Class description:
Implement the TestThriftHSHA class.
Method signatures and docstrings:
- def test_closing_connections(self): @jira_ticket CASSANDRA-6546 Test CASSANDRA-6546 - do connections get closed when disabling / renabling thrift service?
- def test_... | 738d5de93def153338003a26e304a77463a7fd2a | <|skeleton|>
class TestThriftHSHA:
def test_closing_connections(self):
"""@jira_ticket CASSANDRA-6546 Test CASSANDRA-6546 - do connections get closed when disabling / renabling thrift service?"""
<|body_0|>
def test_6285(self):
"""@jira_ticket CASSANDRA-6285 Test CASSANDRA-6285 with Vi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestThriftHSHA:
def test_closing_connections(self):
"""@jira_ticket CASSANDRA-6546 Test CASSANDRA-6546 - do connections get closed when disabling / renabling thrift service?"""
cluster = self.cluster
cluster.set_configuration_options(values={'start_rpc': 'true', 'rpc_server_type': 'hsh... | the_stack_v2_python_sparse | thrift_hsha_test.py | apache/cassandra-dtest | train | 52 | |
cd3ba5abdd2e221f464815bbc9bd5d0f7ea3582f | [
"try:\n import lxml\nexcept ImportError:\n raise ValueError('lxml package not found, please install it with `pip install lxml`')\nsuper().__init__(web_path)\nself.filter_urls = filter_urls\nself.parsing_function = parsing_function or _default_parsing_function",
"els = []\nfor url in soup.find_all('url'):\n ... | <|body_start_0|>
try:
import lxml
except ImportError:
raise ValueError('lxml package not found, please install it with `pip install lxml`')
super().__init__(web_path)
self.filter_urls = filter_urls
self.parsing_function = parsing_function or _default_parsi... | Loader that fetches a sitemap and loads those URLs. | SitemapLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SitemapLoader:
"""Loader that fetches a sitemap and loads those URLs."""
def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None):
"""Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap f... | stack_v2_sparse_classes_75kplus_train_067979 | 2,392 | no_license | [
{
"docstring": "Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap filter_urls: list of strings or regexes that will be applied to filter the urls that are parsed and loaded parsing_function: Function to parse bs4.Soup output",
"name": "__init__",
"signature": "def... | 3 | stack_v2_sparse_classes_30k_train_051813 | Implement the Python class `SitemapLoader` described below.
Class description:
Loader that fetches a sitemap and loads those URLs.
Method signatures and docstrings:
- def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None): Initialize with webpage path and o... | Implement the Python class `SitemapLoader` described below.
Class description:
Loader that fetches a sitemap and loads those URLs.
Method signatures and docstrings:
- def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None): Initialize with webpage path and o... | b7aaa920a52613e3f1f04fa5cd7568ad37302d11 | <|skeleton|>
class SitemapLoader:
"""Loader that fetches a sitemap and loads those URLs."""
def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None):
"""Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SitemapLoader:
"""Loader that fetches a sitemap and loads those URLs."""
def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None):
"""Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap filter_urls: l... | the_stack_v2_python_sparse | openai/venv/lib/python3.10/site-packages/langchain/document_loaders/sitemap.py | henrymendez/garage | train | 0 |
2d2cee9d7cc51dbc4f3941f4006cc7a7b57a3ad9 | [
"with Database() as db:\n data = db.get_all('SELECT * FROM tbl_building_contact WHERE id_building=%s;', (id_building,))\nreturn {'data': data}",
"with Database() as db:\n db.execute('INSERT INTO tbl_building_contact (\\n\\t\\t\\t\\t\\t\\t\\tid_building_contact, id_building, first_name, last_name, phone_numb... | <|body_start_0|>
with Database() as db:
data = db.get_all('SELECT * FROM tbl_building_contact WHERE id_building=%s;', (id_building,))
return {'data': data}
<|end_body_0|>
<|body_start_1|>
with Database() as db:
db.execute('INSERT INTO tbl_building_contact (\n\t\t\t\t\t\t... | BuildingContact | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BuildingContact:
def get(self, id_building):
"""Return all contact for one building :param id_building: UUID"""
<|body_0|>
def assign(self, body):
"""Assign new contact to building :param body: { id_building: UUID, first_name: STRING, last_name: STRING, phone_number:... | stack_v2_sparse_classes_75kplus_train_067980 | 2,702 | no_license | [
{
"docstring": "Return all contact for one building :param id_building: UUID",
"name": "get",
"signature": "def get(self, id_building)"
},
{
"docstring": "Assign new contact to building :param body: { id_building: UUID, first_name: STRING, last_name: STRING, phone_number: INTEGER, phone_extensio... | 4 | stack_v2_sparse_classes_30k_train_011759 | Implement the Python class `BuildingContact` described below.
Class description:
Implement the BuildingContact class.
Method signatures and docstrings:
- def get(self, id_building): Return all contact for one building :param id_building: UUID
- def assign(self, body): Assign new contact to building :param body: { id_... | Implement the Python class `BuildingContact` described below.
Class description:
Implement the BuildingContact class.
Method signatures and docstrings:
- def get(self, id_building): Return all contact for one building :param id_building: UUID
- def assign(self, body): Assign new contact to building :param body: { id_... | 43bd57c466a5cd3b133ddc437cb4a6b9f007d267 | <|skeleton|>
class BuildingContact:
def get(self, id_building):
"""Return all contact for one building :param id_building: UUID"""
<|body_0|>
def assign(self, body):
"""Assign new contact to building :param body: { id_building: UUID, first_name: STRING, last_name: STRING, phone_number:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BuildingContact:
def get(self, id_building):
"""Return all contact for one building :param id_building: UUID"""
with Database() as db:
data = db.get_all('SELECT * FROM tbl_building_contact WHERE id_building=%s;', (id_building,))
return {'data': data}
def assign(self, b... | the_stack_v2_python_sparse | resturls/buildingcontact.py | CAUCA-9-1-1/survip-api | train | 1 | |
737d9a4e631096ec48bf477f265f3869d285174c | [
"super().__init__(machine, name)\nself.shows_queue = deque()\nself._current_show = None",
"self.shows_queue.append((show_config, start_step))\nif not self._current_show:\n self._play_next_show()",
"if not self.shows_queue:\n self._current_show = None\n return\nshow_config, start_step = self.shows_queue... | <|body_start_0|>
super().__init__(machine, name)
self.shows_queue = deque()
self._current_show = None
<|end_body_0|>
<|body_start_1|>
self.shows_queue.append((show_config, start_step))
if not self._current_show:
self._play_next_show()
<|end_body_1|>
<|body_start_2|>... | Represents a show queue. | ShowQueue | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShowQueue:
"""Represents a show queue."""
def __init__(self, machine, name):
"""Initialise show queue."""
<|body_0|>
def enqueue_show(self, show_config: ShowConfig, start_step: int):
"""Add a show to the end of the queue."""
<|body_1|>
def _play_next... | stack_v2_sparse_classes_75kplus_train_067981 | 1,602 | permissive | [
{
"docstring": "Initialise show queue.",
"name": "__init__",
"signature": "def __init__(self, machine, name)"
},
{
"docstring": "Add a show to the end of the queue.",
"name": "enqueue_show",
"signature": "def enqueue_show(self, show_config: ShowConfig, start_step: int)"
},
{
"doc... | 3 | stack_v2_sparse_classes_30k_train_039405 | Implement the Python class `ShowQueue` described below.
Class description:
Represents a show queue.
Method signatures and docstrings:
- def __init__(self, machine, name): Initialise show queue.
- def enqueue_show(self, show_config: ShowConfig, start_step: int): Add a show to the end of the queue.
- def _play_next_sho... | Implement the Python class `ShowQueue` described below.
Class description:
Represents a show queue.
Method signatures and docstrings:
- def __init__(self, machine, name): Initialise show queue.
- def enqueue_show(self, show_config: ShowConfig, start_step: int): Add a show to the end of the queue.
- def _play_next_sho... | 9f90c8b1586363b65340017bfa3af5d56d32c6d9 | <|skeleton|>
class ShowQueue:
"""Represents a show queue."""
def __init__(self, machine, name):
"""Initialise show queue."""
<|body_0|>
def enqueue_show(self, show_config: ShowConfig, start_step: int):
"""Add a show to the end of the queue."""
<|body_1|>
def _play_next... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShowQueue:
"""Represents a show queue."""
def __init__(self, machine, name):
"""Initialise show queue."""
super().__init__(machine, name)
self.shows_queue = deque()
self._current_show = None
def enqueue_show(self, show_config: ShowConfig, start_step: int):
"""... | the_stack_v2_python_sparse | mpf/devices/show_queue.py | missionpinball/mpf | train | 191 |
642b7921733b8fb0d4bed8b8f52e0d57d135ef9b | [
"n = len(arr)\ndp = [0] * n\ndp[0] = 1\nres = 1\nfor i in range(1, n):\n if dp[i - 1] == 1:\n if arr[i] != arr[i - 1]:\n dp[i] = dp[i - 1] + 1\n else:\n dp[i] = 1\n elif arr[i - 1] > arr[i] and arr[i - 2] < arr[i - 1] or (arr[i - 1] < arr[i] and arr[i - 2] > arr[i - 1]):\n ... | <|body_start_0|>
n = len(arr)
dp = [0] * n
dp[0] = 1
res = 1
for i in range(1, n):
if dp[i - 1] == 1:
if arr[i] != arr[i - 1]:
dp[i] = dp[i - 1] + 1
else:
dp[i] = 1
elif arr[i - 1] > a... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxTurbulenceSize(self, arr):
""":type arr: List[int] :rtype: int"""
<|body_0|>
def maxTurbulenceSizeO1Space(self, arr):
""":type arr: List[int] :rtype: int"""
<|body_1|>
def maxTurbulenceSizeO1SpaceFaster(self, arr):
""":type arr: ... | stack_v2_sparse_classes_75kplus_train_067982 | 3,331 | no_license | [
{
"docstring": ":type arr: List[int] :rtype: int",
"name": "maxTurbulenceSize",
"signature": "def maxTurbulenceSize(self, arr)"
},
{
"docstring": ":type arr: List[int] :rtype: int",
"name": "maxTurbulenceSizeO1Space",
"signature": "def maxTurbulenceSizeO1Space(self, arr)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_009166 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxTurbulenceSize(self, arr): :type arr: List[int] :rtype: int
- def maxTurbulenceSizeO1Space(self, arr): :type arr: List[int] :rtype: int
- def maxTurbulenceSizeO1SpaceFaste... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxTurbulenceSize(self, arr): :type arr: List[int] :rtype: int
- def maxTurbulenceSizeO1Space(self, arr): :type arr: List[int] :rtype: int
- def maxTurbulenceSizeO1SpaceFaste... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def maxTurbulenceSize(self, arr):
""":type arr: List[int] :rtype: int"""
<|body_0|>
def maxTurbulenceSizeO1Space(self, arr):
""":type arr: List[int] :rtype: int"""
<|body_1|>
def maxTurbulenceSizeO1SpaceFaster(self, arr):
""":type arr: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxTurbulenceSize(self, arr):
""":type arr: List[int] :rtype: int"""
n = len(arr)
dp = [0] * n
dp[0] = 1
res = 1
for i in range(1, n):
if dp[i - 1] == 1:
if arr[i] != arr[i - 1]:
dp[i] = dp[i - 1] + 1... | the_stack_v2_python_sparse | L/LongestTurbulentSubarray.py | bssrdf/pyleet | train | 2 | |
691c146a0e2ec2407c4c43190e3b0a7182e530da | [
"bit = 0\ntitle = []\nwhile n > 0:\n n = n - 26 ** bit\n remain = n % 26 ** (bit + 1)\n title.append(str(chr(remain // 26 ** bit + 65)))\n n = n - remain\n bit += 1\nreturn ''.join(reversed(title))",
"length = len(s)\nnum = 0\nfor i in range(length):\n num += (ord(s[length - i - 1]) - 64) * 26 *... | <|body_start_0|>
bit = 0
title = []
while n > 0:
n = n - 26 ** bit
remain = n % 26 ** (bit + 1)
title.append(str(chr(remain // 26 ** bit + 65)))
n = n - remain
bit += 1
return ''.join(reversed(title))
<|end_body_0|>
<|body_star... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def convertToTitle(self, n):
""":type n: int :rtype: str"""
<|body_0|>
def titleToNumber(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
bit = 0
title = []
while n > 0:
n = ... | stack_v2_sparse_classes_75kplus_train_067983 | 705 | no_license | [
{
"docstring": ":type n: int :rtype: str",
"name": "convertToTitle",
"signature": "def convertToTitle(self, n)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "titleToNumber",
"signature": "def titleToNumber(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021157 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def convertToTitle(self, n): :type n: int :rtype: str
- def titleToNumber(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def convertToTitle(self, n): :type n: int :rtype: str
- def titleToNumber(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def convertToTitle(self, n):
... | 0584b86642dff667f5bf6b7acfbbce86a41a55b6 | <|skeleton|>
class Solution:
def convertToTitle(self, n):
""":type n: int :rtype: str"""
<|body_0|>
def titleToNumber(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def convertToTitle(self, n):
""":type n: int :rtype: str"""
bit = 0
title = []
while n > 0:
n = n - 26 ** bit
remain = n % 26 ** (bit + 1)
title.append(str(chr(remain // 26 ** bit + 65)))
n = n - remain
bit +... | the_stack_v2_python_sparse | python_solution/161_170/ExcelSheetColumnTitle.py | CescWang1991/LeetCode-Python | train | 1 | |
af65b2fe17ade874005a0b6044d809c3df058fb2 | [
"if not isinstance(rc, int):\n raise ValueError('rc is not a int')\nif not isinstance(data, dict):\n raise ValueError('data is not a dict')\nself.rc = rc\nself.data = data",
"return_code = -1\ndata = dict()\nlines = string.splitlines()\nfor line in lines:\n keyval = line.split(separator, 1)\n if len(k... | <|body_start_0|>
if not isinstance(rc, int):
raise ValueError('rc is not a int')
if not isinstance(data, dict):
raise ValueError('data is not a dict')
self.rc = rc
self.data = data
<|end_body_0|>
<|body_start_1|>
return_code = -1
data = dict()
... | CommandResult | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandResult:
def __init__(self, rc, data):
"""rc : (int) cmd return code data : (dict) key = value result"""
<|body_0|>
def parse(string, separator='='):
"""Parse command results with shape 'xxx = yyy' in a dict."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_067984 | 9,033 | no_license | [
{
"docstring": "rc : (int) cmd return code data : (dict) key = value result",
"name": "__init__",
"signature": "def __init__(self, rc, data)"
},
{
"docstring": "Parse command results with shape 'xxx = yyy' in a dict.",
"name": "parse",
"signature": "def parse(string, separator='=')"
}
... | 2 | stack_v2_sparse_classes_30k_train_005961 | Implement the Python class `CommandResult` described below.
Class description:
Implement the CommandResult class.
Method signatures and docstrings:
- def __init__(self, rc, data): rc : (int) cmd return code data : (dict) key = value result
- def parse(string, separator='='): Parse command results with shape 'xxx = yy... | Implement the Python class `CommandResult` described below.
Class description:
Implement the CommandResult class.
Method signatures and docstrings:
- def __init__(self, rc, data): rc : (int) cmd return code data : (dict) key = value result
- def parse(string, separator='='): Parse command results with shape 'xxx = yy... | 971665b20dcd8d23ed75e09ee90972bde1aad333 | <|skeleton|>
class CommandResult:
def __init__(self, rc, data):
"""rc : (int) cmd return code data : (dict) key = value result"""
<|body_0|>
def parse(string, separator='='):
"""Parse command results with shape 'xxx = yyy' in a dict."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CommandResult:
def __init__(self, rc, data):
"""rc : (int) cmd return code data : (dict) key = value result"""
if not isinstance(rc, int):
raise ValueError('rc is not a int')
if not isinstance(data, dict):
raise ValueError('data is not a dict')
self.rc =... | the_stack_v2_python_sparse | framework/tools/device/Zoovstation.py | littlebuaa/legendarytest | train | 0 | |
ba1e066aa73068624c95947d0ca9f4f235fc1a1d | [
"self.account = account\nself.passwd = passwd\nself.user_info = user_info",
"db_path = setting.USER_INFO_PATH\nuser_file = os.path.join(db_path, self.account)\nif os.path.isfile(user_file):\n f = open(user_file, 'r')\n acc_date = json.load(f)\n if acc_date['passwd'] == self.passwd:\n self.user_inf... | <|body_start_0|>
self.account = account
self.passwd = passwd
self.user_info = user_info
<|end_body_0|>
<|body_start_1|>
db_path = setting.USER_INFO_PATH
user_file = os.path.join(db_path, self.account)
if os.path.isfile(user_file):
f = open(user_file, 'r')
... | Login_auth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Login_auth:
def __init__(self, account, passwd, user_info):
""":param account: :param passwd: :param user_info:"""
<|body_0|>
def user_login(self):
"""普通用户登录验证接口 :return:"""
<|body_1|>
def admin_login(self):
"""管理员登录验证接口 :return:"""
<|bod... | stack_v2_sparse_classes_75kplus_train_067985 | 1,353 | no_license | [
{
"docstring": ":param account: :param passwd: :param user_info:",
"name": "__init__",
"signature": "def __init__(self, account, passwd, user_info)"
},
{
"docstring": "普通用户登录验证接口 :return:",
"name": "user_login",
"signature": "def user_login(self)"
},
{
"docstring": "管理员登录验证接口 :re... | 3 | stack_v2_sparse_classes_30k_train_036872 | Implement the Python class `Login_auth` described below.
Class description:
Implement the Login_auth class.
Method signatures and docstrings:
- def __init__(self, account, passwd, user_info): :param account: :param passwd: :param user_info:
- def user_login(self): 普通用户登录验证接口 :return:
- def admin_login(self): 管理员登录验证接... | Implement the Python class `Login_auth` described below.
Class description:
Implement the Login_auth class.
Method signatures and docstrings:
- def __init__(self, account, passwd, user_info): :param account: :param passwd: :param user_info:
- def user_login(self): 普通用户登录验证接口 :return:
- def admin_login(self): 管理员登录验证接... | 804c8c95ae3502201e7f64542050ee4dafb457ee | <|skeleton|>
class Login_auth:
def __init__(self, account, passwd, user_info):
""":param account: :param passwd: :param user_info:"""
<|body_0|>
def user_login(self):
"""普通用户登录验证接口 :return:"""
<|body_1|>
def admin_login(self):
"""管理员登录验证接口 :return:"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Login_auth:
def __init__(self, account, passwd, user_info):
""":param account: :param passwd: :param user_info:"""
self.account = account
self.passwd = passwd
self.user_info = user_info
def user_login(self):
"""普通用户登录验证接口 :return:"""
db_path = setting.USER_... | the_stack_v2_python_sparse | day9/FTP2.0/core/auth.py | ZhangChengL/s14 | train | 0 | |
f31c21409175f6f92f77d5515fe125ce98a00c7e | [
"self.model = kwargs.pop('model')\nself.field = kwargs.pop('field')\nsuper(TitleWidget, self).__init__(*args, **kwargs)",
"if value:\n try:\n value = self.model.objects.get(pk=value)\n value = getattr(value, self.field)\n except:\n pass\nreturn super(TitleWidget, self).render(name, valu... | <|body_start_0|>
self.model = kwargs.pop('model')
self.field = kwargs.pop('field')
super(TitleWidget, self).__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
if value:
try:
value = self.model.objects.get(pk=value)
value = getattr(value... | A text widget that renders a property of the instance. | TitleWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TitleWidget:
"""A text widget that renders a property of the instance."""
def __init__(self, *args, **kwargs):
"""Create a TitleWidget."""
<|body_0|>
def render(self, name, value, attrs):
"""Render the widget."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_067986 | 16,188 | permissive | [
{
"docstring": "Create a TitleWidget.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Render the widget.",
"name": "render",
"signature": "def render(self, name, value, attrs)"
}
] | 2 | null | Implement the Python class `TitleWidget` described below.
Class description:
A text widget that renders a property of the instance.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create a TitleWidget.
- def render(self, name, value, attrs): Render the widget. | Implement the Python class `TitleWidget` described below.
Class description:
A text widget that renders a property of the instance.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create a TitleWidget.
- def render(self, name, value, attrs): Render the widget.
<|skeleton|>
class TitleWidget:... | e33c2be9fd27e90dcafbf4fd7bd6724658411157 | <|skeleton|>
class TitleWidget:
"""A text widget that renders a property of the instance."""
def __init__(self, *args, **kwargs):
"""Create a TitleWidget."""
<|body_0|>
def render(self, name, value, attrs):
"""Render the widget."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TitleWidget:
"""A text widget that renders a property of the instance."""
def __init__(self, *args, **kwargs):
"""Create a TitleWidget."""
self.model = kwargs.pop('model')
self.field = kwargs.pop('field')
super(TitleWidget, self).__init__(*args, **kwargs)
def render(s... | the_stack_v2_python_sparse | src/happening/forms.py | happeninghq/happening | train | 0 |
1ad9f41312f5fcb7f8538697176b48a66a916152 | [
"if id_ is None:\n id_ = 'default'\nif id_ == VALUE_KEY:\n raise InvalidID(\"'%s' is not a valid Dimension id.\" % VALUE_KEY)\nself.id = id_\nself._allowed_values = None\nself.datatype = None\nif label is None:\n self.label = id_\nelse:\n self.label = label\nif datatype:\n self.datatype = Datatype(da... | <|body_start_0|>
if id_ is None:
id_ = 'default'
if id_ == VALUE_KEY:
raise InvalidID("'%s' is not a valid Dimension id." % VALUE_KEY)
self.id = id_
self._allowed_values = None
self.datatype = None
if label is None:
self.label = id_
... | A dimension in a dataset. | Dimension | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dimension:
"""A dimension in a dataset."""
def __init__(self, id_=None, label=None, allowed_values=None, datatype=None, dialect=None, domain=None):
"""A single dimension. If allowed_values are specified, they will override any allowed values for the datatype"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_067987 | 20,757 | permissive | [
{
"docstring": "A single dimension. If allowed_values are specified, they will override any allowed values for the datatype",
"name": "__init__",
"signature": "def __init__(self, id_=None, label=None, allowed_values=None, datatype=None, dialect=None, domain=None)"
},
{
"docstring": "Return a lis... | 2 | null | Implement the Python class `Dimension` described below.
Class description:
A dimension in a dataset.
Method signatures and docstrings:
- def __init__(self, id_=None, label=None, allowed_values=None, datatype=None, dialect=None, domain=None): A single dimension. If allowed_values are specified, they will override any ... | Implement the Python class `Dimension` described below.
Class description:
A dimension in a dataset.
Method signatures and docstrings:
- def __init__(self, id_=None, label=None, allowed_values=None, datatype=None, dialect=None, domain=None): A single dimension. If allowed_values are specified, they will override any ... | 92ca985310b0fb1793f8a72da1c0e3fd45c46238 | <|skeleton|>
class Dimension:
"""A dimension in a dataset."""
def __init__(self, id_=None, label=None, allowed_values=None, datatype=None, dialect=None, domain=None):
"""A single dimension. If allowed_values are specified, they will override any allowed values for the datatype"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dimension:
"""A dimension in a dataset."""
def __init__(self, id_=None, label=None, allowed_values=None, datatype=None, dialect=None, domain=None):
"""A single dimension. If allowed_values are specified, they will override any allowed values for the datatype"""
if id_ is None:
... | the_stack_v2_python_sparse | statscraper/base_scraper.py | Patechoc/statscraper | train | 1 |
859643e7301dfffd401aebe600e53595571d4ba4 | [
"self.frameHeight, self.frameWidth, channels = image.shape\nself.widthDivisor = int(self.frameWidth / appConfig.camera['resizeWidthDiv'])\nif self.widthDivisor < 1:\n self.widthDivisor = 1\nself.frameResizeWidth = int(self.frameWidth / self.widthDivisor)\nself.frameResizeHeight = int(self.frameHeight / self.widt... | <|body_start_0|>
self.frameHeight, self.frameWidth, channels = image.shape
self.widthDivisor = int(self.frameWidth / appConfig.camera['resizeWidthDiv'])
if self.widthDivisor < 1:
self.widthDivisor = 1
self.frameResizeWidth = int(self.frameWidth / self.widthDivisor)
se... | Detect abstract base class. Common functions for detectors. | detectbase | [
"BSD-2-Clause-Views",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class detectbase:
"""Detect abstract base class. Common functions for detectors."""
def frameInfo(self, image, appConfig):
"""Set common frame info"""
<|body_0|>
def inside(self, r, q):
"""See if one rectangle inside another"""
<|body_1|>
def markRectSize(... | stack_v2_sparse_classes_75kplus_train_067988 | 2,254 | permissive | [
{
"docstring": "Set common frame info",
"name": "frameInfo",
"signature": "def frameInfo(self, image, appConfig)"
},
{
"docstring": "See if one rectangle inside another",
"name": "inside",
"signature": "def inside(self, r, q)"
},
{
"docstring": "Mark rectangles in image",
"na... | 3 | stack_v2_sparse_classes_30k_train_046061 | Implement the Python class `detectbase` described below.
Class description:
Detect abstract base class. Common functions for detectors.
Method signatures and docstrings:
- def frameInfo(self, image, appConfig): Set common frame info
- def inside(self, r, q): See if one rectangle inside another
- def markRectSize(self... | Implement the Python class `detectbase` described below.
Class description:
Detect abstract base class. Common functions for detectors.
Method signatures and docstrings:
- def frameInfo(self, image, appConfig): Set common frame info
- def inside(self, r, q): See if one rectangle inside another
- def markRectSize(self... | a5af3a96d8d465bcbb7a77578f56b2e3e0ad680b | <|skeleton|>
class detectbase:
"""Detect abstract base class. Common functions for detectors."""
def frameInfo(self, image, appConfig):
"""Set common frame info"""
<|body_0|>
def inside(self, r, q):
"""See if one rectangle inside another"""
<|body_1|>
def markRectSize(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class detectbase:
"""Detect abstract base class. Common functions for detectors."""
def frameInfo(self, image, appConfig):
"""Set common frame info"""
self.frameHeight, self.frameWidth, channels = image.shape
self.widthDivisor = int(self.frameWidth / appConfig.camera['resizeWidthDiv'])
... | the_stack_v2_python_sparse | codeferm/detectbase.py | sanderginn/motiondetector | train | 0 |
ba206477d627123128b47a893bc94a5762c61108 | [
"status_cmd = \"minikube status --format='{{.MinikubeStatus}}'\"\nproc = subprocess.Popen(status_cmd, stdout=subprocess.PIPE, shell=True)\ncloud_status = proc.stdout.read().rstrip().decode()\nlogging.debug('Minikube Cloud status is ' + cloud_status)\nif cloud_status == 'Running':\n if not dry_run:\n loggi... | <|body_start_0|>
status_cmd = "minikube status --format='{{.MinikubeStatus}}'"
proc = subprocess.Popen(status_cmd, stdout=subprocess.PIPE, shell=True)
cloud_status = proc.stdout.read().rstrip().decode()
logging.debug('Minikube Cloud status is ' + cloud_status)
if cloud_status == ... | A Minikube-provisioned Virtual Machine Secrets path must exist as: vault write /secret/landscape/clouds/minikube provisioner=minikube Attributes: Inherited from superclass. | MinikubeCloud | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MinikubeCloud:
"""A Minikube-provisioned Virtual Machine Secrets path must exist as: vault write /secret/landscape/clouds/minikube provisioner=minikube Attributes: Inherited from superclass."""
def converge(self, dry_run):
"""Converges state of a minikube VM Checks if a minikube clou... | stack_v2_sparse_classes_75kplus_train_067989 | 4,229 | permissive | [
{
"docstring": "Converges state of a minikube VM Checks if a minikube cloud is already running Initializes it if not yet running Args: None. Returns: None. Raises: None.",
"name": "converge",
"signature": "def converge(self, dry_run)"
},
{
"docstring": "Start minikube. Args: None. Returns: None.... | 3 | stack_v2_sparse_classes_30k_train_049827 | Implement the Python class `MinikubeCloud` described below.
Class description:
A Minikube-provisioned Virtual Machine Secrets path must exist as: vault write /secret/landscape/clouds/minikube provisioner=minikube Attributes: Inherited from superclass.
Method signatures and docstrings:
- def converge(self, dry_run): C... | Implement the Python class `MinikubeCloud` described below.
Class description:
A Minikube-provisioned Virtual Machine Secrets path must exist as: vault write /secret/landscape/clouds/minikube provisioner=minikube Attributes: Inherited from superclass.
Method signatures and docstrings:
- def converge(self, dry_run): C... | a367f54355b2dcc3c9f1f472e850d1f9e68de007 | <|skeleton|>
class MinikubeCloud:
"""A Minikube-provisioned Virtual Machine Secrets path must exist as: vault write /secret/landscape/clouds/minikube provisioner=minikube Attributes: Inherited from superclass."""
def converge(self, dry_run):
"""Converges state of a minikube VM Checks if a minikube clou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MinikubeCloud:
"""A Minikube-provisioned Virtual Machine Secrets path must exist as: vault write /secret/landscape/clouds/minikube provisioner=minikube Attributes: Inherited from superclass."""
def converge(self, dry_run):
"""Converges state of a minikube VM Checks if a minikube cloud is already ... | the_stack_v2_python_sparse | landscape/cloud_minikube.py | shaneramey/landscape-cli | train | 0 |
c87919dc93fafaa2d8e584a99a9487bedd084d4f | [
"if velocity is None:\n velocity = np.zeros(shape=(dim,))\nif massfractions is None:\n if nspecies > 0:\n massfractions = np.zeros(shape=(nspecies,))\nself._nspecies = nspecies\nself._dim = dim\nself._velocity = velocity\nself._pressure = pressure\nself._temperature = temperature\nself._massfracs = mas... | <|body_start_0|>
if velocity is None:
velocity = np.zeros(shape=(dim,))
if massfractions is None:
if nspecies > 0:
massfractions = np.zeros(shape=(nspecies,))
self._nspecies = nspecies
self._dim = dim
self._velocity = velocity
self.... | Solution initializer for multi-species mixture. This initializer creates a physics-consistent mixture solution given an initial thermal state (pressure, temperature) and a mixture-compatible EOS. .. automethod:: __init__ .. automethod:: __call__ | MixtureInitializer | [
"X11",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MixtureInitializer:
"""Solution initializer for multi-species mixture. This initializer creates a physics-consistent mixture solution given an initial thermal state (pressure, temperature) and a mixture-compatible EOS. .. automethod:: __init__ .. automethod:: __call__"""
def __init__(self, *... | stack_v2_sparse_classes_75kplus_train_067990 | 32,800 | permissive | [
{
"docstring": "Initialize mixture parameters. Parameters ---------- dim: int specifies the number of dimensions for the solution nspeces: int specifies the number of mixture species pressure: float specifies the value of :math:`p_0` temperature: float specifies the value of :math:`T_0` massfractions: numpy.nda... | 2 | stack_v2_sparse_classes_30k_train_032884 | Implement the Python class `MixtureInitializer` described below.
Class description:
Solution initializer for multi-species mixture. This initializer creates a physics-consistent mixture solution given an initial thermal state (pressure, temperature) and a mixture-compatible EOS. .. automethod:: __init__ .. automethod:... | Implement the Python class `MixtureInitializer` described below.
Class description:
Solution initializer for multi-species mixture. This initializer creates a physics-consistent mixture solution given an initial thermal state (pressure, temperature) and a mixture-compatible EOS. .. automethod:: __init__ .. automethod:... | 47f144782258eae2b1fb39520e96f414ae176ff4 | <|skeleton|>
class MixtureInitializer:
"""Solution initializer for multi-species mixture. This initializer creates a physics-consistent mixture solution given an initial thermal state (pressure, temperature) and a mixture-compatible EOS. .. automethod:: __init__ .. automethod:: __call__"""
def __init__(self, *... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MixtureInitializer:
"""Solution initializer for multi-species mixture. This initializer creates a physics-consistent mixture solution given an initial thermal state (pressure, temperature) and a mixture-compatible EOS. .. automethod:: __init__ .. automethod:: __call__"""
def __init__(self, *, dim=3, nspe... | the_stack_v2_python_sparse | mirgecom/initializers.py | kaushikcfd/mirgecom | train | 0 |
0347f81f7dcc2873c1eeee142c20e1649542dc71 | [
"self.name = name\nself.network_type = network_type\nself.vcd_uuid = vcd_uuid\nself.vcenter_moref_uuid = vcenter_moref_uuid",
"if dictionary is None:\n return None\nname = dictionary.get('name')\nnetwork_type = dictionary.get('networkType')\nvcd_uuid = dictionary.get('vcdUuid')\nvcenter_moref_uuid = dictionary... | <|body_start_0|>
self.name = name
self.network_type = network_type
self.vcd_uuid = vcd_uuid
self.vcenter_moref_uuid = vcenter_moref_uuid
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
name = dictionary.get('name')
network_type = di... | Implementation of the 'OrgVDCNetwork' model. TODO: type description here. Attributes: name (string): This is the name of the Org VDC network. network_type (string): This is the type of the corresponding network on VCenter. vcd_uuid (string): This is the uuid of Org VDC network as identified by VCD. vcenter_moref_uuid (... | OrgVDCNetwork | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrgVDCNetwork:
"""Implementation of the 'OrgVDCNetwork' model. TODO: type description here. Attributes: name (string): This is the name of the Org VDC network. network_type (string): This is the type of the corresponding network on VCenter. vcd_uuid (string): This is the uuid of Org VDC network a... | stack_v2_sparse_classes_75kplus_train_067991 | 2,169 | permissive | [
{
"docstring": "Constructor for the OrgVDCNetwork class",
"name": "__init__",
"signature": "def __init__(self, name=None, network_type=None, vcd_uuid=None, vcenter_moref_uuid=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary... | 2 | stack_v2_sparse_classes_30k_train_035822 | Implement the Python class `OrgVDCNetwork` described below.
Class description:
Implementation of the 'OrgVDCNetwork' model. TODO: type description here. Attributes: name (string): This is the name of the Org VDC network. network_type (string): This is the type of the corresponding network on VCenter. vcd_uuid (string)... | Implement the Python class `OrgVDCNetwork` described below.
Class description:
Implementation of the 'OrgVDCNetwork' model. TODO: type description here. Attributes: name (string): This is the name of the Org VDC network. network_type (string): This is the type of the corresponding network on VCenter. vcd_uuid (string)... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class OrgVDCNetwork:
"""Implementation of the 'OrgVDCNetwork' model. TODO: type description here. Attributes: name (string): This is the name of the Org VDC network. network_type (string): This is the type of the corresponding network on VCenter. vcd_uuid (string): This is the uuid of Org VDC network a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrgVDCNetwork:
"""Implementation of the 'OrgVDCNetwork' model. TODO: type description here. Attributes: name (string): This is the name of the Org VDC network. network_type (string): This is the type of the corresponding network on VCenter. vcd_uuid (string): This is the uuid of Org VDC network as identified ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/org_v_d_c_network.py | cohesity/management-sdk-python | train | 24 |
a26d20e07f112fa49754ee6f53ab356f0d83f767 | [
"try:\n user_id = get_jwt_identity()\n credential = Credential.objects.get\n body = request.get_json()\n Credential.objects.get.update(**body)\n return ('', 200)\nexcept InvalidQueryError:\n raise SchemaValidationError\nexcept DoesNotExist:\n raise UpdatingCredentialError\nexcept Exception:\n ... | <|body_start_0|>
try:
user_id = get_jwt_identity()
credential = Credential.objects.get
body = request.get_json()
Credential.objects.get.update(**body)
return ('', 200)
except InvalidQueryError:
raise SchemaValidationError
ex... | CredentialApi | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CredentialApi:
def put(self, id):
"""--- post: description: increments the input by x requestBody: required: true content: application/json: schema: InputSchema responses: '200': description: call successful content: application/json: schema: OutputSchema tags: - calculation"""
<... | stack_v2_sparse_classes_75kplus_train_067992 | 4,440 | permissive | [
{
"docstring": "--- post: description: increments the input by x requestBody: required: true content: application/json: schema: InputSchema responses: '200': description: call successful content: application/json: schema: OutputSchema tags: - calculation",
"name": "put",
"signature": "def put(self, id)"... | 3 | null | Implement the Python class `CredentialApi` described below.
Class description:
Implement the CredentialApi class.
Method signatures and docstrings:
- def put(self, id): --- post: description: increments the input by x requestBody: required: true content: application/json: schema: InputSchema responses: '200': descrip... | Implement the Python class `CredentialApi` described below.
Class description:
Implement the CredentialApi class.
Method signatures and docstrings:
- def put(self, id): --- post: description: increments the input by x requestBody: required: true content: application/json: schema: InputSchema responses: '200': descrip... | 243ceab532007ee4fb05b205e1125fab5d3d325b | <|skeleton|>
class CredentialApi:
def put(self, id):
"""--- post: description: increments the input by x requestBody: required: true content: application/json: schema: InputSchema responses: '200': description: call successful content: application/json: schema: OutputSchema tags: - calculation"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CredentialApi:
def put(self, id):
"""--- post: description: increments the input by x requestBody: required: true content: application/json: schema: InputSchema responses: '200': description: call successful content: application/json: schema: OutputSchema tags: - calculation"""
try:
... | the_stack_v2_python_sparse | ika_web/app/api/resources/credential.py | Harisonm/Ika | train | 6 | |
3a74bd5b3088db2b47ad3c232996393896d6b2fc | [
"_initialize_stripe(live_mode=self.live_mode)\nitem = {}\nif isinstance(price_or_plan, str) or isinstance(price_or_plan, type(u'')):\n item['price'] = price_or_plan\nelif isinstance(price_or_plan, dict):\n item['price_data'] = price_or_plan\nelse:\n raise Exception('Unsupported price_or_plan type: %s' % ty... | <|body_start_0|>
_initialize_stripe(live_mode=self.live_mode)
item = {}
if isinstance(price_or_plan, str) or isinstance(price_or_plan, type(u'')):
item['price'] = price_or_plan
elif isinstance(price_or_plan, dict):
item['price_data'] = price_or_plan
else:
... | Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions | BaseStripeSubscription | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseStripeSubscription:
"""Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions"""
def create(self, price_or_plan, invoice=True):
"""Creates a new Subscription ht... | stack_v2_sparse_classes_75kplus_train_067993 | 22,449 | permissive | [
{
"docstring": "Creates a new Subscription https://stripe.com/docs/api/subscriptions/create",
"name": "create",
"signature": "def create(self, price_or_plan, invoice=True)"
},
{
"docstring": "Modifies a Subscription plan https://stripe.com/docs/api/subscriptions/update",
"name": "modify",
... | 3 | stack_v2_sparse_classes_30k_train_007887 | Implement the Python class `BaseStripeSubscription` described below.
Class description:
Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions
Method signatures and docstrings:
- def create(self, pr... | Implement the Python class `BaseStripeSubscription` described below.
Class description:
Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions
Method signatures and docstrings:
- def create(self, pr... | 935c4913e33d959f8c29583825f72b238f85b380 | <|skeleton|>
class BaseStripeSubscription:
"""Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions"""
def create(self, price_or_plan, invoice=True):
"""Creates a new Subscription ht... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseStripeSubscription:
"""Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions"""
def create(self, price_or_plan, invoice=True):
"""Creates a new Subscription https://stripe.... | the_stack_v2_python_sparse | lib/stripe_lib/models.py | hacktoolkit/django-htk | train | 210 |
e8c5ec6b6bb9472db9e0d2be57d6d16e0478ee20 | [
"if get_jwt_claims()['roles'] == 'admin':\n return Fqdns().publish()\nreturn Fqdns().publish(get_jwt_identity())",
"if get_jwt_claims()['roles'] == 'admin':\n return Fqdns().unpublish()\nreturn Fqdns().unpublish(get_jwt_identity())"
] | <|body_start_0|>
if get_jwt_claims()['roles'] == 'admin':
return Fqdns().publish()
return Fqdns().publish(get_jwt_identity())
<|end_body_0|>
<|body_start_1|>
if get_jwt_claims()['roles'] == 'admin':
return Fqdns().unpublish()
return Fqdns().unpublish(get_jwt_iden... | fqdn publish | PublishFqdn | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublishFqdn:
"""fqdn publish"""
def put(self):
"""Publish all owned fqdn (only fqdn with state 'publish')"""
<|body_0|>
def delete(self):
"""Unpublish all owned fqdn (state isnt modified)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if get_jw... | stack_v2_sparse_classes_75kplus_train_067994 | 5,403 | permissive | [
{
"docstring": "Publish all owned fqdn (only fqdn with state 'publish')",
"name": "put",
"signature": "def put(self)"
},
{
"docstring": "Unpublish all owned fqdn (state isnt modified)",
"name": "delete",
"signature": "def delete(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000071 | Implement the Python class `PublishFqdn` described below.
Class description:
fqdn publish
Method signatures and docstrings:
- def put(self): Publish all owned fqdn (only fqdn with state 'publish')
- def delete(self): Unpublish all owned fqdn (state isnt modified) | Implement the Python class `PublishFqdn` described below.
Class description:
fqdn publish
Method signatures and docstrings:
- def put(self): Publish all owned fqdn (only fqdn with state 'publish')
- def delete(self): Unpublish all owned fqdn (state isnt modified)
<|skeleton|>
class PublishFqdn:
"""fqdn publish""... | 6a9bf3a3d73fb3faa7cf1e5cfc757cc360fbafde | <|skeleton|>
class PublishFqdn:
"""fqdn publish"""
def put(self):
"""Publish all owned fqdn (only fqdn with state 'publish')"""
<|body_0|>
def delete(self):
"""Unpublish all owned fqdn (state isnt modified)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PublishFqdn:
"""fqdn publish"""
def put(self):
"""Publish all owned fqdn (only fqdn with state 'publish')"""
if get_jwt_claims()['roles'] == 'admin':
return Fqdns().publish()
return Fqdns().publish(get_jwt_identity())
def delete(self):
"""Unpublish all own... | the_stack_v2_python_sparse | haprestio/api_v1/pub.py | innofocus/haprestio | train | 0 |
e7337b6e9dd27871838fb0bbd4b022abd2804d1c | [
"self.model_conf = model_conf\nself.inputs = inputs\nself.utils = utils\nself.layer = None",
"with tf.keras.backend.name_scope('LSTM'):\n self.layer = tf.keras.layers.CuDNNLSTM(units=self.model_conf.units_num * 2, return_sequences=True)\n outputs = self.layer(self.inputs, training=self.utils.is_training)\nr... | <|body_start_0|>
self.model_conf = model_conf
self.inputs = inputs
self.utils = utils
self.layer = None
<|end_body_0|>
<|body_start_1|>
with tf.keras.backend.name_scope('LSTM'):
self.layer = tf.keras.layers.CuDNNLSTM(units=self.model_conf.units_num * 2, return_sequen... | LSTMcuDNN | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSTMcuDNN:
def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils):
"""同上"""
<|body_0|>
def build(self):
"""同上"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.model_conf = model_conf
self.inputs = inputs
... | stack_v2_sparse_classes_75kplus_train_067995 | 3,290 | permissive | [
{
"docstring": "同上",
"name": "__init__",
"signature": "def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils)"
},
{
"docstring": "同上",
"name": "build",
"signature": "def build(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021939 | Implement the Python class `LSTMcuDNN` described below.
Class description:
Implement the LSTMcuDNN class.
Method signatures and docstrings:
- def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): 同上
- def build(self): 同上 | Implement the Python class `LSTMcuDNN` described below.
Class description:
Implement the LSTMcuDNN class.
Method signatures and docstrings:
- def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): 同上
- def build(self): 同上
<|skeleton|>
class LSTMcuDNN:
def __init__(self, model_conf:... | 6fd35c0c789aaa43130de46d4c04622ec2948052 | <|skeleton|>
class LSTMcuDNN:
def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils):
"""同上"""
<|body_0|>
def build(self):
"""同上"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LSTMcuDNN:
def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils):
"""同上"""
self.model_conf = model_conf
self.inputs = inputs
self.utils = utils
self.layer = None
def build(self):
"""同上"""
with tf.keras.backend.name_scop... | the_stack_v2_python_sparse | network/LSTM.py | kerlomz/captcha_trainer | train | 2,977 | |
9361a03824c0138cb41ec7f82cabc2fc4137cdd2 | [
"dummy_head = ListNode(0)\ncurrent_node = dummy_head\nfor i in list:\n current_node.next = ListNode(i)\n current_node = current_node.next\nreturn dummy_head.next",
"curr = list\nans = []\nwhile curr:\n ans.append(curr.val)\n curr = curr.next\nreturn ans"
] | <|body_start_0|>
dummy_head = ListNode(0)
current_node = dummy_head
for i in list:
current_node.next = ListNode(i)
current_node = current_node.next
return dummy_head.next
<|end_body_0|>
<|body_start_1|>
curr = list
ans = []
while curr:
... | LinkListHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkListHelper:
def listToLinkList(self, list):
""":type list: List[int] :rtype: ListNode"""
<|body_0|>
def linkListToList(self, list):
""":type list: ListNode :rtype: List"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dummy_head = ListNode(0)
... | stack_v2_sparse_classes_75kplus_train_067996 | 3,744 | no_license | [
{
"docstring": ":type list: List[int] :rtype: ListNode",
"name": "listToLinkList",
"signature": "def listToLinkList(self, list)"
},
{
"docstring": ":type list: ListNode :rtype: List",
"name": "linkListToList",
"signature": "def linkListToList(self, list)"
}
] | 2 | stack_v2_sparse_classes_30k_train_037912 | Implement the Python class `LinkListHelper` described below.
Class description:
Implement the LinkListHelper class.
Method signatures and docstrings:
- def listToLinkList(self, list): :type list: List[int] :rtype: ListNode
- def linkListToList(self, list): :type list: ListNode :rtype: List | Implement the Python class `LinkListHelper` described below.
Class description:
Implement the LinkListHelper class.
Method signatures and docstrings:
- def listToLinkList(self, list): :type list: List[int] :rtype: ListNode
- def linkListToList(self, list): :type list: ListNode :rtype: List
<|skeleton|>
class LinkLis... | a57282895fb213b68e5d81db301903721a92d80f | <|skeleton|>
class LinkListHelper:
def listToLinkList(self, list):
""":type list: List[int] :rtype: ListNode"""
<|body_0|>
def linkListToList(self, list):
""":type list: ListNode :rtype: List"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinkListHelper:
def listToLinkList(self, list):
""":type list: List[int] :rtype: ListNode"""
dummy_head = ListNode(0)
current_node = dummy_head
for i in list:
current_node.next = ListNode(i)
current_node = current_node.next
return dummy_head.next... | the_stack_v2_python_sparse | Python/helper.py | antonylu/leetcode2 | train | 0 | |
0bd24d04ee281b3ab80a925e0270c4aa7750a7ba | [
"if engine_pool_id:\n return f'{console_url}/api/3/scan_engine_pools/{engine_pool_id}'\nelse:\n return f'{console_url}/api/3/scan_engine_pools'",
"if engine_id:\n return f'{console_url}/api/3/scan_engine_pools/{engine_pool_id}/engines/{engine_id}'\nelse:\n return f'{console_url}/api/3/scan_engine_pool... | <|body_start_0|>
if engine_pool_id:
return f'{console_url}/api/3/scan_engine_pools/{engine_pool_id}'
else:
return f'{console_url}/api/3/scan_engine_pools'
<|end_body_0|>
<|body_start_1|>
if engine_id:
return f'{console_url}/api/3/scan_engine_pools/{engine_poo... | ScanEnginePool | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScanEnginePool:
def scan_engine_pools(console_url, engine_pool_id=None):
"""Engine pool endpoint operation :param console_url: URL to the InsightVM console :param engine_pool_id: ID of a scan engine pool :return: pre-populated /api/3/engines/{id}"""
<|body_0|>
def scan_engin... | stack_v2_sparse_classes_75kplus_train_067997 | 22,639 | permissive | [
{
"docstring": "Engine pool endpoint operation :param console_url: URL to the InsightVM console :param engine_pool_id: ID of a scan engine pool :return: pre-populated /api/3/engines/{id}",
"name": "scan_engine_pools",
"signature": "def scan_engine_pools(console_url, engine_pool_id=None)"
},
{
"d... | 2 | null | Implement the Python class `ScanEnginePool` described below.
Class description:
Implement the ScanEnginePool class.
Method signatures and docstrings:
- def scan_engine_pools(console_url, engine_pool_id=None): Engine pool endpoint operation :param console_url: URL to the InsightVM console :param engine_pool_id: ID of ... | Implement the Python class `ScanEnginePool` described below.
Class description:
Implement the ScanEnginePool class.
Method signatures and docstrings:
- def scan_engine_pools(console_url, engine_pool_id=None): Engine pool endpoint operation :param console_url: URL to the InsightVM console :param engine_pool_id: ID of ... | 718d15ca36c57231bb89df0aebc53d0210db400c | <|skeleton|>
class ScanEnginePool:
def scan_engine_pools(console_url, engine_pool_id=None):
"""Engine pool endpoint operation :param console_url: URL to the InsightVM console :param engine_pool_id: ID of a scan engine pool :return: pre-populated /api/3/engines/{id}"""
<|body_0|>
def scan_engin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScanEnginePool:
def scan_engine_pools(console_url, engine_pool_id=None):
"""Engine pool endpoint operation :param console_url: URL to the InsightVM console :param engine_pool_id: ID of a scan engine pool :return: pre-populated /api/3/engines/{id}"""
if engine_pool_id:
return f'{con... | the_stack_v2_python_sparse | plugins/rapid7_insightvm/komand_rapid7_insightvm/util/endpoints.py | rapid7/insightconnect-plugins | train | 61 | |
8bc93f26d98afe5eeb1033d318cf01e700104187 | [
"s1, t1 = (Counter(s), Counter(t))\ninter = t1 - s1\nreturn ''.join(inter.keys())",
"s = ''.join(sorted(s))\nt = ''.join(sorted(t))\nfor i in range(len(s)):\n if s[i] != t[i]:\n return t[i]\nreturn t[-1]",
"ans = 0\nfor c in s + t:\n ans ^= ord(c)\nreturn chr(ans)"
] | <|body_start_0|>
s1, t1 = (Counter(s), Counter(t))
inter = t1 - s1
return ''.join(inter.keys())
<|end_body_0|>
<|body_start_1|>
s = ''.join(sorted(s))
t = ''.join(sorted(t))
for i in range(len(s)):
if s[i] != t[i]:
return t[i]
return t... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def findTheDifference2(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_1|>
def findTheDifference2(self, s, t):
""":type s: str :ty... | stack_v2_sparse_classes_75kplus_train_067998 | 1,091 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "findTheDifference",
"signature": "def findTheDifference(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "findTheDifference2",
"signature": "def findTheDifference2(self, s, t)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_000131 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self... | 0fc4c7af59246e3064db41989a45d9db413a624b | <|skeleton|>
class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def findTheDifference2(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_1|>
def findTheDifference2(self, s, t):
""":type s: str :ty... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
s1, t1 = (Counter(s), Counter(t))
inter = t1 - s1
return ''.join(inter.keys())
def findTheDifference2(self, s, t):
""":type s: str :type t: str :rtype: str"""
s = ''.jo... | the_stack_v2_python_sparse | 389. Find the Difference/difference.py | Macielyoung/LeetCode | train | 1 | |
d8dcca9d54989dbf7c7e0a29b829a7746134e1fe | [
"threading.Thread.__init__(self, group=group, target=target, name=name, verbose=verbose)\nself.current_forks = []\nself.index = args[0]\nself.set_forks(args[1])\nself.has_eaten = 0",
"logging.debug('Thinking for a few seconds')\ntime.sleep(random.random())\nself.pick_up_forks()",
"if self.index == 0:\n self.... | <|body_start_0|>
threading.Thread.__init__(self, group=group, target=target, name=name, verbose=verbose)
self.current_forks = []
self.index = args[0]
self.set_forks(args[1])
self.has_eaten = 0
<|end_body_0|>
<|body_start_1|>
logging.debug('Thinking for a few seconds')
... | Philosopher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Philosopher:
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None):
"""Setup our philosopher."""
<|body_0|>
def run(self):
"""Main thread process where they are deep in thought."""
<|body_1|>
def set_forks(self, forks... | stack_v2_sparse_classes_75kplus_train_067999 | 3,062 | no_license | [
{
"docstring": "Setup our philosopher.",
"name": "__init__",
"signature": "def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None)"
},
{
"docstring": "Main thread process where they are deep in thought.",
"name": "run",
"signature": "def run(self)"
},... | 6 | stack_v2_sparse_classes_30k_train_005477 | Implement the Python class `Philosopher` described below.
Class description:
Implement the Philosopher class.
Method signatures and docstrings:
- def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None): Setup our philosopher.
- def run(self): Main thread process where they are deep ... | Implement the Python class `Philosopher` described below.
Class description:
Implement the Philosopher class.
Method signatures and docstrings:
- def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None): Setup our philosopher.
- def run(self): Main thread process where they are deep ... | 913964dff3fd2e37e1eab44896f70b5bb5bfffba | <|skeleton|>
class Philosopher:
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None):
"""Setup our philosopher."""
<|body_0|>
def run(self):
"""Main thread process where they are deep in thought."""
<|body_1|>
def set_forks(self, forks... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Philosopher:
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None):
"""Setup our philosopher."""
threading.Thread.__init__(self, group=group, target=target, name=name, verbose=verbose)
self.current_forks = []
self.index = args[0]
sel... | the_stack_v2_python_sparse | python/concurrency/problems/dining_philosophers/threading_solution.py | dansackett/learning-playground | train | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.