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
efb3f0d27244d0b54a18d0d36cccfe32c8369258
[ "valid_names = ['Test', 'Another Test']\nserver_types = []\nfor name in valid_names:\n server_type = Shard.objects.create(name=name)\n server_type.full_clean()\n server_types.append(server_type)\nself.assertSequenceEqual(Shard.objects.all(), server_types)", "shard = Shard.objects.create(name='Test')\nwit...
<|body_start_0|> valid_names = ['Test', 'Another Test'] server_types = [] for name in valid_names: server_type = Shard.objects.create(name=name) server_type.full_clean() server_types.append(server_type) self.assertSequenceEqual(Shard.objects.all(), ser...
ShardTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShardTests: def test_normal_creation(self): """Normal creation of shards""" <|body_0|> def test_duplicate_creation(self): """Creation of duplicate shard must fail.""" <|body_1|> def test_invalid_creation(self): """Creation of invalid shard must f...
stack_v2_sparse_classes_75kplus_train_072300
42,627
no_license
[ { "docstring": "Normal creation of shards", "name": "test_normal_creation", "signature": "def test_normal_creation(self)" }, { "docstring": "Creation of duplicate shard must fail.", "name": "test_duplicate_creation", "signature": "def test_duplicate_creation(self)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_005083
Implement the Python class `ShardTests` described below. Class description: Implement the ShardTests class. Method signatures and docstrings: - def test_normal_creation(self): Normal creation of shards - def test_duplicate_creation(self): Creation of duplicate shard must fail. - def test_invalid_creation(self): Creat...
Implement the Python class `ShardTests` described below. Class description: Implement the ShardTests class. Method signatures and docstrings: - def test_normal_creation(self): Normal creation of shards - def test_duplicate_creation(self): Creation of duplicate shard must fail. - def test_invalid_creation(self): Creat...
88808f4444a06fb5b3cfb9817a36c2738fee3dc1
<|skeleton|> class ShardTests: def test_normal_creation(self): """Normal creation of shards""" <|body_0|> def test_duplicate_creation(self): """Creation of duplicate shard must fail.""" <|body_1|> def test_invalid_creation(self): """Creation of invalid shard must f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShardTests: def test_normal_creation(self): """Normal creation of shards""" valid_names = ['Test', 'Another Test'] server_types = [] for name in valid_names: server_type = Shard.objects.create(name=name) server_type.full_clean() server_types....
the_stack_v2_python_sparse
server/tests.py
nooperation/slutils
train
0
d1e816ae2201f112f22607de404a53ca968d9ca1
[ "self.name = name\nself.new_parent_id = new_parent_id\nself.objects = objects\nself.target = target", "if dictionary is None:\n return None\nname = dictionary.get('name')\nnew_parent_id = dictionary.get('newParentId')\nobjects = None\nif dictionary.get('objects') != None:\n objects = list()\n for structu...
<|body_start_0|> self.name = name self.new_parent_id = new_parent_id self.objects = objects self.target = target <|end_body_0|> <|body_start_1|> if dictionary is None: return None name = dictionary.get('name') new_parent_id = dictionary.get('newParent...
Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specifies a new registered parent Protection Source...
DeployTaskRequest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployTaskRequest: """Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specif...
stack_v2_sparse_classes_75kplus_train_072301
3,108
permissive
[ { "docstring": "Constructor for the DeployTaskRequest class", "name": "__init__", "signature": "def __init__(self, name=None, new_parent_id=None, objects=None, target=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe...
2
stack_v2_sparse_classes_30k_train_052654
Implement the Python class `DeployTaskRequest` described below. Class description: Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique...
Implement the Python class `DeployTaskRequest` described below. Class description: Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DeployTaskRequest: """Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specif...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeployTaskRequest: """Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specifies a new reg...
the_stack_v2_python_sparse
cohesity_management_sdk/models/deploy_task_request.py
cohesity/management-sdk-python
train
24
ebc4e47b76658f8ce751bd43a4571064e03a6833
[ "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...
BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.
BudgetServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BudgetServiceServicer: """BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.""" def CreateBudget(self, request, context): """Creates a new budget. See <a href="https://cloud.google.com/billing/quotas">Quota...
stack_v2_sparse_classes_75kplus_train_072302
6,857
permissive
[ { "docstring": "Creates a new budget. See <a href=\"https://cloud.google.com/billing/quotas\">Quotas and limits</a> for more information on the limits of the number of budgets you can create.", "name": "CreateBudget", "signature": "def CreateBudget(self, request, context)" }, { "docstring": "Upd...
5
stack_v2_sparse_classes_30k_train_018855
Implement the Python class `BudgetServiceServicer` described below. Class description: BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan. Method signatures and docstrings: - def CreateBudget(self, request, context): Creates a new budget. Se...
Implement the Python class `BudgetServiceServicer` described below. Class description: BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan. Method signatures and docstrings: - def CreateBudget(self, request, context): Creates a new budget. Se...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class BudgetServiceServicer: """BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.""" def CreateBudget(self, request, context): """Creates a new budget. See <a href="https://cloud.google.com/billing/quotas">Quota...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BudgetServiceServicer: """BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.""" def CreateBudget(self, request, context): """Creates a new budget. See <a href="https://cloud.google.com/billing/quotas">Quotas and limits<...
the_stack_v2_python_sparse
billingbudgets/google/cloud/billing_budgets_v1beta1/proto/budget_service_pb2_grpc.py
tswast/google-cloud-python
train
1
1afa1c6a694d315ade76cf6f35a6e7ac68991a10
[ "for parent_id_option_expression in PARENT_ID_OPTION_EXPRESSIONS:\n if parent_id_option_expression.match(option):\n return True\nreturn False", "for parent_id_option_expression in PARENT_ID_OPTION_EXPRESSIONS:\n match = parent_id_option_expression.match(option)\n if match is not None:\n ret...
<|body_start_0|> for parent_id_option_expression in PARENT_ID_OPTION_EXPRESSIONS: if parent_id_option_expression.match(option): return True return False <|end_body_0|> <|body_start_1|> for parent_id_option_expression in PARENT_ID_OPTION_EXPRESSIONS: match...
OptionHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionHelper: def is_parent_id_option(option): """Checks if the given option name is a reference to a parent entity.""" <|body_0|> def get_parent_id_type(option): """Extracts the name of the type from an option that is a reference to a parent entity. For example, if ...
stack_v2_sparse_classes_75kplus_train_072303
1,932
permissive
[ { "docstring": "Checks if the given option name is a reference to a parent entity.", "name": "is_parent_id_option", "signature": "def is_parent_id_option(option)" }, { "docstring": "Extracts the name of the type from an option that is a reference to a parent entity. For example, if the option is...
2
stack_v2_sparse_classes_30k_train_052818
Implement the Python class `OptionHelper` described below. Class description: Implement the OptionHelper class. Method signatures and docstrings: - def is_parent_id_option(option): Checks if the given option name is a reference to a parent entity. - def get_parent_id_type(option): Extracts the name of the type from a...
Implement the Python class `OptionHelper` described below. Class description: Implement the OptionHelper class. Method signatures and docstrings: - def is_parent_id_option(option): Checks if the given option name is a reference to a parent entity. - def get_parent_id_type(option): Extracts the name of the type from a...
422d70e1dc422f0ca248abea47a472e3605caa4b
<|skeleton|> class OptionHelper: def is_parent_id_option(option): """Checks if the given option name is a reference to a parent entity.""" <|body_0|> def get_parent_id_type(option): """Extracts the name of the type from an option that is a reference to a parent entity. For example, if ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OptionHelper: def is_parent_id_option(option): """Checks if the given option name is a reference to a parent entity.""" for parent_id_option_expression in PARENT_ID_OPTION_EXPRESSIONS: if parent_id_option_expression.match(option): return True return False ...
the_stack_v2_python_sparse
src/ovirtcli/utils/optionhelper.py
minqf/ovirt-engine-cli
train
0
229316925710ccb5015c4660d6e8ed805ca32e99
[ "super().__init__()\nself._block_args = block_args\nself._ensemble_size = ensemble_size\nself._random_sign_init = random_sign_init\nself._batch_norm_momentum = batch_norm_momentum\nself._batch_norm_epsilon = batch_norm_epsilon\nself._batch_norm = batch_norm\nself._data_format = data_format\nif self._data_format == ...
<|body_start_0|> super().__init__() self._block_args = block_args self._ensemble_size = ensemble_size self._random_sign_init = random_sign_init self._batch_norm_momentum = batch_norm_momentum self._batch_norm_epsilon = batch_norm_epsilon self._batch_norm = batch_n...
A class of MBConv: Mobile Inverted Residual Bottleneck.
MBConvBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MBConvBlock: """A class of MBConv: Mobile Inverted Residual Bottleneck.""" def __init__(self, block_args, ensemble_size, random_sign_init, batch_norm_momentum, batch_norm_epsilon, batch_norm, data_format, relu_fn, use_se, clip_projection_output): """Initializes a MBConv block. Args: ...
stack_v2_sparse_classes_75kplus_train_072304
17,450
permissive
[ { "docstring": "Initializes a MBConv block. Args: block_args: BlockArgs, arguments to create a Block. ensemble_size: Size of ensemble. random_sign_init: Probability/stddev for fast weight initialization. batch_norm_momentum: Momentum for batch normalization. batch_norm_epsilon: Epsilon for batch normalization. ...
3
stack_v2_sparse_classes_30k_train_036099
Implement the Python class `MBConvBlock` described below. Class description: A class of MBConv: Mobile Inverted Residual Bottleneck. Method signatures and docstrings: - def __init__(self, block_args, ensemble_size, random_sign_init, batch_norm_momentum, batch_norm_epsilon, batch_norm, data_format, relu_fn, use_se, cl...
Implement the Python class `MBConvBlock` described below. Class description: A class of MBConv: Mobile Inverted Residual Bottleneck. Method signatures and docstrings: - def __init__(self, block_args, ensemble_size, random_sign_init, batch_norm_momentum, batch_norm_epsilon, batch_norm, data_format, relu_fn, use_se, cl...
f5f6f50f82bd441339c9d9efbef3f09e72c5fef6
<|skeleton|> class MBConvBlock: """A class of MBConv: Mobile Inverted Residual Bottleneck.""" def __init__(self, block_args, ensemble_size, random_sign_init, batch_norm_momentum, batch_norm_epsilon, batch_norm, data_format, relu_fn, use_se, clip_projection_output): """Initializes a MBConv block. Args: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MBConvBlock: """A class of MBConv: Mobile Inverted Residual Bottleneck.""" def __init__(self, block_args, ensemble_size, random_sign_init, batch_norm_momentum, batch_norm_epsilon, batch_norm, data_format, relu_fn, use_se, clip_projection_output): """Initializes a MBConv block. Args: block_args: B...
the_stack_v2_python_sparse
uncertainty_baselines/models/efficientnet_batch_ensemble.py
google/uncertainty-baselines
train
1,235
96e68d825b1e5d873f2d22b5ab79d661ccdf56c2
[ "self._hass = hass\nself._store = Store[dict[str, dict[str, Union[bool, int]]]](hass, STORAGE_VERSION, STORAGE_KEY)\nself._prefs: dict[str, dict[str, bool | int]] | None = None", "if (prefs := (await self._store.async_load())) is None:\n prefs = {}\nself._prefs = prefs", "if preload_stream is not UNDEFINED:\...
<|body_start_0|> self._hass = hass self._store = Store[dict[str, dict[str, Union[bool, int]]]](hass, STORAGE_VERSION, STORAGE_KEY) self._prefs: dict[str, dict[str, bool | int]] | None = None <|end_body_0|> <|body_start_1|> if (prefs := (await self._store.async_load())) is None: ...
Handle camera preferences.
CameraPreferences
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" <|body_0|> async def async_initialize(self) -> None: """Finish initializing the preferences.""" <|body_1|> async def a...
stack_v2_sparse_classes_75kplus_train_072305
3,632
permissive
[ { "docstring": "Initialize camera prefs.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant) -> None" }, { "docstring": "Finish initializing the preferences.", "name": "async_initialize", "signature": "async def async_initialize(self) -> None" }, { "docstr...
4
stack_v2_sparse_classes_30k_train_022570
Implement the Python class `CameraPreferences` described below. Class description: Handle camera preferences. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize camera prefs. - async def async_initialize(self) -> None: Finish initializing the preferences. - async def async...
Implement the Python class `CameraPreferences` described below. Class description: Handle camera preferences. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize camera prefs. - async def async_initialize(self) -> None: Finish initializing the preferences. - async def async...
dcf68d768e4f628d038f1fdd6e40bad713fbc222
<|skeleton|> class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" <|body_0|> async def async_initialize(self) -> None: """Finish initializing the preferences.""" <|body_1|> async def a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" self._hass = hass self._store = Store[dict[str, dict[str, Union[bool, int]]]](hass, STORAGE_VERSION, STORAGE_KEY) self._prefs: dict[str, dict...
the_stack_v2_python_sparse
homeassistant/components/camera/prefs.py
Adminiuga/home-assistant
train
5
43d009584835f32acc6c63385ddf90d98d5bcc2c
[ "if crn is None:\n raise ValueError('crn must be provided')\nauthenticator = get_authenticator_from_environment(service_name)\nservice = cls(crn, authenticator)\nservice.configure_service(service_name)\nreturn service", "if crn is None:\n raise ValueError('crn must be provided')\nBaseService.__init__(self, ...
<|body_start_0|> if crn is None: raise ValueError('crn must be provided') authenticator = get_authenticator_from_environment(service_name) service = cls(crn, authenticator) service.configure_service(service_name) return service <|end_body_0|> <|body_start_1|> ...
The Global Load Balancer Events V1 service.
GlobalLoadBalancerEventsV1
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalLoadBalancerEventsV1: """The Global Load Balancer Events V1 service.""" def new_instance(cls, crn: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'GlobalLoadBalancerEventsV1': """Return a new client for the Global Load Balancer Events service using the specified parameters and...
stack_v2_sparse_classes_75kplus_train_072306
22,652
permissive
[ { "docstring": "Return a new client for the Global Load Balancer Events service using the specified parameters and external configuration. :param str crn: Full url-encoded cloud resource name (CRN) of resource instance.", "name": "new_instance", "signature": "def new_instance(cls, crn: str, service_name...
3
null
Implement the Python class `GlobalLoadBalancerEventsV1` described below. Class description: The Global Load Balancer Events V1 service. Method signatures and docstrings: - def new_instance(cls, crn: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'GlobalLoadBalancerEventsV1': Return a new client for the Global Load B...
Implement the Python class `GlobalLoadBalancerEventsV1` described below. Class description: The Global Load Balancer Events V1 service. Method signatures and docstrings: - def new_instance(cls, crn: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'GlobalLoadBalancerEventsV1': Return a new client for the Global Load B...
7eed5185f1e93a57e43d0d7a1e83ee8c708179e0
<|skeleton|> class GlobalLoadBalancerEventsV1: """The Global Load Balancer Events V1 service.""" def new_instance(cls, crn: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'GlobalLoadBalancerEventsV1': """Return a new client for the Global Load Balancer Events service using the specified parameters and...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GlobalLoadBalancerEventsV1: """The Global Load Balancer Events V1 service.""" def new_instance(cls, crn: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'GlobalLoadBalancerEventsV1': """Return a new client for the Global Load Balancer Events service using the specified parameters and external con...
the_stack_v2_python_sparse
ibm_cloud_networking_services/global_load_balancer_events_v1.py
mauriceDevsM/networking-python-sdk
train
0
0b368b141825af36b0d380fa3a8f20f42576cd2d
[ "if num1 == '0' or num2 == '0':\n return '0'\nlead = 0\nresult = '0'\nfor digit in reversed(num1):\n mult = self.str_multiply(num2, digit)\n result = self.str_add(result, mult + lead * '0')\n lead += 1\nreturn result", "result = ''\nadd_on = 0\nidx1, idx2 = (len(num1) - 1, len(num2) - 1)\nwhile idx1 >...
<|body_start_0|> if num1 == '0' or num2 == '0': return '0' lead = 0 result = '0' for digit in reversed(num1): mult = self.str_multiply(num2, digit) result = self.str_add(result, mult + lead * '0') lead += 1 return result <|end_body_...
Solution_D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_D: def multiply(self, num1: str, num2: str) -> str: """Break down into two str calculations: 1. Add: Any two numbers in str 2. Multiply: Two numbers in str, one to be single digit Overall: num2 * each digit in num1, and add up, just like manual calculation Pay attention to the l...
stack_v2_sparse_classes_75kplus_train_072307
7,010
permissive
[ { "docstring": "Break down into two str calculations: 1. Add: Any two numbers in str 2. Multiply: Two numbers in str, one to be single digit Overall: num2 * each digit in num1, and add up, just like manual calculation Pay attention to the leading number (when n1*n2 > 10 or n1*n2 > 10).", "name": "multiply",...
3
null
Implement the Python class `Solution_D` described below. Class description: Implement the Solution_D class. Method signatures and docstrings: - def multiply(self, num1: str, num2: str) -> str: Break down into two str calculations: 1. Add: Any two numbers in str 2. Multiply: Two numbers in str, one to be single digit ...
Implement the Python class `Solution_D` described below. Class description: Implement the Solution_D class. Method signatures and docstrings: - def multiply(self, num1: str, num2: str) -> str: Break down into two str calculations: 1. Add: Any two numbers in str 2. Multiply: Two numbers in str, one to be single digit ...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution_D: def multiply(self, num1: str, num2: str) -> str: """Break down into two str calculations: 1. Add: Any two numbers in str 2. Multiply: Two numbers in str, one to be single digit Overall: num2 * each digit in num1, and add up, just like manual calculation Pay attention to the l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution_D: def multiply(self, num1: str, num2: str) -> str: """Break down into two str calculations: 1. Add: Any two numbers in str 2. Multiply: Two numbers in str, one to be single digit Overall: num2 * each digit in num1, and add up, just like manual calculation Pay attention to the leading number ...
the_stack_v2_python_sparse
LeetCode/LC043_multiply_strings.py
jxie0755/Learning_Python
train
0
1fddf4ad55981f139b96d4a14571880282c2b664
[ "if request.version in ['market_1_0']:\n return v1_0.ShiftAppeals().get(request, **kwargs)\nraise HttpException(status_code=RESTErrors.NOT_FOUND.value, detail=ErrorsCodes.METHOD_NOT_FOUND.value)", "if request.version in ['market_1_0']:\n return v1_0.ShiftAppeals().post(request, **kwargs)\nraise HttpExceptio...
<|body_start_0|> if request.version in ['market_1_0']: return v1_0.ShiftAppeals().get(request, **kwargs) raise HttpException(status_code=RESTErrors.NOT_FOUND.value, detail=ErrorsCodes.METHOD_NOT_FOUND.value) <|end_body_0|> <|body_start_1|> if request.version in ['market_1_0']: ...
ShiftAppeals
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShiftAppeals: def get(request, **kwargs): """Список своих откликов на рабочие смены""" <|body_0|> def post(request, **kwargs): """Откликнуться на рабочую смену""" <|body_1|> def put(request, **kwargs): """Редактирование отклика""" <|body_...
stack_v2_sparse_classes_75kplus_train_072308
39,790
no_license
[ { "docstring": "Список своих откликов на рабочие смены", "name": "get", "signature": "def get(request, **kwargs)" }, { "docstring": "Откликнуться на рабочую смену", "name": "post", "signature": "def post(request, **kwargs)" }, { "docstring": "Редактирование отклика", "name": ...
3
null
Implement the Python class `ShiftAppeals` described below. Class description: Implement the ShiftAppeals class. Method signatures and docstrings: - def get(request, **kwargs): Список своих откликов на рабочие смены - def post(request, **kwargs): Откликнуться на рабочую смену - def put(request, **kwargs): Редактирован...
Implement the Python class `ShiftAppeals` described below. Class description: Implement the ShiftAppeals class. Method signatures and docstrings: - def get(request, **kwargs): Список своих откликов на рабочие смены - def post(request, **kwargs): Откликнуться на рабочую смену - def put(request, **kwargs): Редактирован...
19ffefa3f818c04831aaed28e6540274ba4fbc90
<|skeleton|> class ShiftAppeals: def get(request, **kwargs): """Список своих откликов на рабочие смены""" <|body_0|> def post(request, **kwargs): """Откликнуться на рабочую смену""" <|body_1|> def put(request, **kwargs): """Редактирование отклика""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShiftAppeals: def get(request, **kwargs): """Список своих откликов на рабочие смены""" if request.version in ['market_1_0']: return v1_0.ShiftAppeals().get(request, **kwargs) raise HttpException(status_code=RESTErrors.NOT_FOUND.value, detail=ErrorsCodes.METHOD_NOT_FOUND.val...
the_stack_v2_python_sparse
app_market/views.py
shmeser/giberno-postman
train
0
040f65038172d2fdd2e6e8f8e3b7f13bc413b971
[ "super(FocalLoss, self).__init__()\nself.weights = weights\nself.gamma = gamma\nself.alpha = alpha", "cross_entropy = F.cross_entropy(output, target, self.weights)\ncross_entropy_log = torch.log(cross_entropy)\nlogpt = -F.cross_entropy(output, target)\npt = torch.exp(logpt)\nfocal_loss = -(1 - pt) ** self.gamma *...
<|body_start_0|> super(FocalLoss, self).__init__() self.weights = weights self.gamma = gamma self.alpha = alpha <|end_body_0|> <|body_start_1|> cross_entropy = F.cross_entropy(output, target, self.weights) cross_entropy_log = torch.log(cross_entropy) logpt = -F.c...
Class for computing the focal loss
FocalLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FocalLoss: """Class for computing the focal loss""" def __init__(self, weights, gamma=0, alpha=1): """:param weights: weight of the classes :param gamma: a parameter for focal loss :param alpha: a parameter for focal loss""" <|body_0|> def forward(self, output, target): ...
stack_v2_sparse_classes_75kplus_train_072309
5,607
no_license
[ { "docstring": ":param weights: weight of the classes :param gamma: a parameter for focal loss :param alpha: a parameter for focal loss", "name": "__init__", "signature": "def __init__(self, weights, gamma=0, alpha=1)" }, { "docstring": "Function to use output and target to find focal loss Args:...
2
stack_v2_sparse_classes_30k_train_050206
Implement the Python class `FocalLoss` described below. Class description: Class for computing the focal loss Method signatures and docstrings: - def __init__(self, weights, gamma=0, alpha=1): :param weights: weight of the classes :param gamma: a parameter for focal loss :param alpha: a parameter for focal loss - def...
Implement the Python class `FocalLoss` described below. Class description: Class for computing the focal loss Method signatures and docstrings: - def __init__(self, weights, gamma=0, alpha=1): :param weights: weight of the classes :param gamma: a parameter for focal loss :param alpha: a parameter for focal loss - def...
32f35d91ef3402d116fc22d0cfbb82482584f6d8
<|skeleton|> class FocalLoss: """Class for computing the focal loss""" def __init__(self, weights, gamma=0, alpha=1): """:param weights: weight of the classes :param gamma: a parameter for focal loss :param alpha: a parameter for focal loss""" <|body_0|> def forward(self, output, target): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FocalLoss: """Class for computing the focal loss""" def __init__(self, weights, gamma=0, alpha=1): """:param weights: weight of the classes :param gamma: a parameter for focal loss :param alpha: a parameter for focal loss""" super(FocalLoss, self).__init__() self.weights = weights...
the_stack_v2_python_sparse
src/losses/losses.py
ahanagemini/QuadRoad
train
0
a04b470e7d25d5e3c84ed20fcccf8888c8eb304f
[ "self.max_frames = max_frames\nself.count = 0\nself.payload = b''", "self.count += 1\nself.payload += data\nif self.count == self.max_frames:\n self.process(cli)", "get_processor(cli).process(self.count, self.payload, cli)\nself.count = 0\nself.payload = b''" ]
<|body_start_0|> self.max_frames = max_frames self.count = 0 self.payload = b'' <|end_body_0|> <|body_start_1|> self.count += 1 self.payload += data if self.count == self.max_frames: self.process(cli) <|end_body_1|> <|body_start_2|> get_processor(cli...
BufferedPipe
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BufferedPipe: def __init__(self, max_frames): """Create a buffer which will call the provided processor (sink) when full. It will call the processor with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames.""" <|body_0|> def append(self, d...
stack_v2_sparse_classes_75kplus_train_072310
13,915
permissive
[ { "docstring": "Create a buffer which will call the provided processor (sink) when full. It will call the processor with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames.", "name": "__init__", "signature": "def __init__(self, max_frames)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_034620
Implement the Python class `BufferedPipe` described below. Class description: Implement the BufferedPipe class. Method signatures and docstrings: - def __init__(self, max_frames): Create a buffer which will call the provided processor (sink) when full. It will call the processor with the number of frames and the accu...
Implement the Python class `BufferedPipe` described below. Class description: Implement the BufferedPipe class. Method signatures and docstrings: - def __init__(self, max_frames): Create a buffer which will call the provided processor (sink) when full. It will call the processor with the number of frames and the accu...
11991dc8d2220fef19e9a5ed10acbb3e6311bca8
<|skeleton|> class BufferedPipe: def __init__(self, max_frames): """Create a buffer which will call the provided processor (sink) when full. It will call the processor with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames.""" <|body_0|> def append(self, d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BufferedPipe: def __init__(self, max_frames): """Create a buffer which will call the provided processor (sink) when full. It will call the processor with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames.""" self.max_frames = max_frames self.count ...
the_stack_v2_python_sparse
legacy-server/sepia_stt_server.py
SEPIA-Framework/sepia-stt-server
train
98
ad5481e9b26a8ea9f9d56a19ed369ce6fad3ce59
[ "user = request.user\ncheck_user_status(user)\nuser_id = user.id\nvalidate(instance=request.data, schema=schemas.post_schema)\nbody = request.data\nbody['owner_user_id'] = user_id\nRestaurantPost.field_validate(body)\npost = RestaurantPost.insert(body, request)\nreturn JsonResponse(model_to_json(post))", "user = ...
<|body_start_0|> user = request.user check_user_status(user) user_id = user.id validate(instance=request.data, schema=schemas.post_schema) body = request.data body['owner_user_id'] = user_id RestaurantPost.field_validate(body) post = RestaurantPost.insert(...
Restaurant posts view
PostView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostView: """Restaurant posts view""" def post(self, request): """Insert a new post for a restaurant""" <|body_0|> def get(self, request): """Get all posts for a restaurant (for ROs)""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = request...
stack_v2_sparse_classes_75kplus_train_072311
19,356
no_license
[ { "docstring": "Insert a new post for a restaurant", "name": "post", "signature": "def post(self, request)" }, { "docstring": "Get all posts for a restaurant (for ROs)", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_053856
Implement the Python class `PostView` described below. Class description: Restaurant posts view Method signatures and docstrings: - def post(self, request): Insert a new post for a restaurant - def get(self, request): Get all posts for a restaurant (for ROs)
Implement the Python class `PostView` described below. Class description: Restaurant posts view Method signatures and docstrings: - def post(self, request): Insert a new post for a restaurant - def get(self, request): Get all posts for a restaurant (for ROs) <|skeleton|> class PostView: """Restaurant posts view"...
2707062c9a9a8bb4baca955e8a60ba08cc9f8953
<|skeleton|> class PostView: """Restaurant posts view""" def post(self, request): """Insert a new post for a restaurant""" <|body_0|> def get(self, request): """Get all posts for a restaurant (for ROs)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostView: """Restaurant posts view""" def post(self, request): """Insert a new post for a restaurant""" user = request.user check_user_status(user) user_id = user.id validate(instance=request.data, schema=schemas.post_schema) body = request.data bod...
the_stack_v2_python_sparse
backend/restaurant/views.py
MochiTarts/Find-Dining-The-Bridge
train
1
f67c1e9a546d6897df86aba00de3628f30611bb3
[ "self._folder = folder\nself._fallback_file = fallback_file\nif not self._folder.endswith('/'):\n self._folder += '/'", "request, response, session = state.unfold()\ntry:\n if self._fallback_file and (not path.isfile(self._folder + request.path_info)):\n full_path = self._folder + self._fallback_file...
<|body_start_0|> self._folder = folder self._fallback_file = fallback_file if not self._folder.endswith('/'): self._folder += '/' <|end_body_0|> <|body_start_1|> request, response, session = state.unfold() try: if self._fallback_file and (not path.isfile(...
StaticHandler handles request to static files and serves these files.
StaticHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StaticHandler: """StaticHandler handles request to static files and serves these files.""" def __init__(self, folder, fallback_file=None): """Create new StaticHandler, point it to the base folder to search files in""" <|body_0|> def handle(self, state): """Handle...
stack_v2_sparse_classes_75kplus_train_072312
1,748
no_license
[ { "docstring": "Create new StaticHandler, point it to the base folder to search files in", "name": "__init__", "signature": "def __init__(self, folder, fallback_file=None)" }, { "docstring": "Handles a request to a static file. Serves the file", "name": "handle", "signature": "def handle...
2
stack_v2_sparse_classes_30k_train_045071
Implement the Python class `StaticHandler` described below. Class description: StaticHandler handles request to static files and serves these files. Method signatures and docstrings: - def __init__(self, folder, fallback_file=None): Create new StaticHandler, point it to the base folder to search files in - def handle...
Implement the Python class `StaticHandler` described below. Class description: StaticHandler handles request to static files and serves these files. Method signatures and docstrings: - def __init__(self, folder, fallback_file=None): Create new StaticHandler, point it to the base folder to search files in - def handle...
d8319206fb5e4137cb337ed45ff34bfa19e9c245
<|skeleton|> class StaticHandler: """StaticHandler handles request to static files and serves these files.""" def __init__(self, folder, fallback_file=None): """Create new StaticHandler, point it to the base folder to search files in""" <|body_0|> def handle(self, state): """Handle...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StaticHandler: """StaticHandler handles request to static files and serves these files.""" def __init__(self, folder, fallback_file=None): """Create new StaticHandler, point it to the base folder to search files in""" self._folder = folder self._fallback_file = fallback_file ...
the_stack_v2_python_sparse
framework/statichandler.py
Tohnmeister/SimpleFramework
train
0
665943cb6cad28ece2080e4cd084fb9b436ba927
[ "super().__init__()\nself._N_antenna = N_antenna\nself._N_px = N_px\nself._K = K\nself._N_cell = self._K + 1 + self._N_px * (2 * self._N_antenna + 1)", "if buffer is None:\n enc = np.zeros((self._N_cell,))\nelse:\n if not buffer.shape == (self._N_cell,):\n raise ValueError('Parameter[buffer] must be ...
<|body_start_0|> super().__init__() self._N_antenna = N_antenna self._N_px = N_px self._K = K self._N_cell = self._K + 1 + self._N_px * (2 * self._N_antenna + 1) <|end_body_0|> <|body_start_1|> if buffer is None: enc = np.zeros((self._N_cell,)) else: ...
Serializer to encode/decode RNN parameters.
Parameter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parameter: """Serializer to encode/decode RNN parameters.""" def __init__(self, N_antenna, N_px, K): """Parameters ---------- N_antenna : int N_px : int K : int""" <|body_0|> def encode(self, buffer=None, mu=None, D=None, tau=None): """Encode parameter informatio...
stack_v2_sparse_classes_75kplus_train_072313
22,688
no_license
[ { "docstring": "Parameters ---------- N_antenna : int N_px : int K : int", "name": "__init__", "signature": "def __init__(self, N_antenna, N_px, K)" }, { "docstring": "Encode parameter information in buffer. Parameters ---------- buffer : :py:class:`~numpy.ndarray` (N_cell,) buffer in which to w...
3
null
Implement the Python class `Parameter` described below. Class description: Serializer to encode/decode RNN parameters. Method signatures and docstrings: - def __init__(self, N_antenna, N_px, K): Parameters ---------- N_antenna : int N_px : int K : int - def encode(self, buffer=None, mu=None, D=None, tau=None): Encode...
Implement the Python class `Parameter` described below. Class description: Serializer to encode/decode RNN parameters. Method signatures and docstrings: - def __init__(self, N_antenna, N_px, K): Parameters ---------- N_antenna : int N_px : int K : int - def encode(self, buffer=None, mu=None, D=None, tau=None): Encode...
6bb46f330d9745d4a4871d412cd4f4730bbbcfdd
<|skeleton|> class Parameter: """Serializer to encode/decode RNN parameters.""" def __init__(self, N_antenna, N_px, K): """Parameters ---------- N_antenna : int N_px : int K : int""" <|body_0|> def encode(self, buffer=None, mu=None, D=None, tau=None): """Encode parameter informatio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Parameter: """Serializer to encode/decode RNN parameters.""" def __init__(self, N_antenna, N_px, K): """Parameters ---------- N_antenna : int N_px : int K : int""" super().__init__() self._N_antenna = N_antenna self._N_px = N_px self._K = K self._N_cell = s...
the_stack_v2_python_sparse
deepwave/nn/crnn.py
imagingofthings/DeepWave
train
6
3220ea8294c904af990f69af6f1b28a79f07030a
[ "self.__rects = list(rects)\nself.__prefix_sum = map(lambda x: (x[2] - x[0] + 1) * (x[3] - x[1] + 1), rects)\nfor i in xrange(1, len(self.__prefix_sum)):\n self.__prefix_sum[i] += self.__prefix_sum[i - 1]", "target = random.randint(0, self.__prefix_sum[-1] - 1)\nleft = bisect.bisect_right(self.__prefix_sum, ta...
<|body_start_0|> self.__rects = list(rects) self.__prefix_sum = map(lambda x: (x[2] - x[0] + 1) * (x[3] - x[1] + 1), rects) for i in xrange(1, len(self.__prefix_sum)): self.__prefix_sum[i] += self.__prefix_sum[i - 1] <|end_body_0|> <|body_start_1|> target = random.randint(0,...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.__rects = list(rects) self.__prefix_sum = map(lambda x: (x[2] - x[0]...
stack_v2_sparse_classes_75kplus_train_072314
848
permissive
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_037498
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
4dc4e6642dc92f1983c13564cc0fd99917cab358
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.__rects = list(rects) self.__prefix_sum = map(lambda x: (x[2] - x[0] + 1) * (x[3] - x[1] + 1), rects) for i in xrange(1, len(self.__prefix_sum)): self.__prefix_sum[i] += self.__prefix_sum[i...
the_stack_v2_python_sparse
Python/random-point-in-non-overlapping-rectangles.py
kamyu104/LeetCode-Solutions
train
4,549
5b0dcb0ec0beaf31c59e3c432492484d6a76671f
[ "KerasClassifier.__init__(self, messageHandler, **kwargs)\nself.printTag = 'KerasLSTMClassifier'\nself.allowedLayers = self.basicLayers + self.kerasROMDict['kerasRcurrentLayersList']", "for index, layerName in enumerate(self.layerLayout[:-1]):\n layerType = self.initOptionDict[layerName].get('type').lower()\n ...
<|body_start_0|> KerasClassifier.__init__(self, messageHandler, **kwargs) self.printTag = 'KerasLSTMClassifier' self.allowedLayers = self.basicLayers + self.kerasROMDict['kerasRcurrentLayersList'] <|end_body_0|> <|body_start_1|> for index, layerName in enumerate(self.layerLayout[:-1]): ...
recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow
KerasLSTMClassifier
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KerasLSTMClassifier: """recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow""" def __init__(self, messageHandler, **kwargs): """A constructor that will appropriately intialize a supervised learning object @ In, messageHa...
stack_v2_sparse_classes_75kplus_train_072315
3,214
permissive
[ { "docstring": "A constructor that will appropriately intialize a supervised learning object @ In, messageHandler, MessageHandler, a MessageHandler object in charge of raising errors, and printing messages @ In, kwargs, dict, an arbitrary dictionary of keywords and values @ Out, None", "name": "__init__", ...
3
stack_v2_sparse_classes_30k_train_013237
Implement the Python class `KerasLSTMClassifier` described below. Class description: recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow Method signatures and docstrings: - def __init__(self, messageHandler, **kwargs): A constructor that will appropriate...
Implement the Python class `KerasLSTMClassifier` described below. Class description: recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow Method signatures and docstrings: - def __init__(self, messageHandler, **kwargs): A constructor that will appropriate...
bf49370966bdade783f8bca13d17748eabf54505
<|skeleton|> class KerasLSTMClassifier: """recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow""" def __init__(self, messageHandler, **kwargs): """A constructor that will appropriately intialize a supervised learning object @ In, messageHa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KerasLSTMClassifier: """recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow""" def __init__(self, messageHandler, **kwargs): """A constructor that will appropriately intialize a supervised learning object @ In, messageHandler, Messag...
the_stack_v2_python_sparse
framework/SupervisedLearning/KerasLSTMClassifier.py
amoyyy/raven
train
0
ac0b4069aaddb2b98353d623801f7800b2545b9f
[ "index = (y >> 3) * framebuf.stride + x\noffset = y & 7\nframebuf.buf[index] = framebuf.buf[index] & ~(1 << offset) | (color != 0) << offset", "index = (y >> 3) * framebuf.stride + x\noffset = y & 7\nreturn framebuf.buf[index] >> offset & 1", "while height > 0:\n index = (y >> 3) * framebuf.stride + x\n o...
<|body_start_0|> index = (y >> 3) * framebuf.stride + x offset = y & 7 framebuf.buf[index] = framebuf.buf[index] & ~(1 << offset) | (color != 0) << offset <|end_body_0|> <|body_start_1|> index = (y >> 3) * framebuf.stride + x offset = y & 7 return framebuf.buf[index] >> ...
MVLSBFormat
MVLSBFormat
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MVLSBFormat: """MVLSBFormat""" def set_pixel(framebuf, x, y, color): """Set a given pixel to a color.""" <|body_0|> def get_pixel(framebuf, x, y): """Get the color of a given pixel""" <|body_1|> def fill_rect(framebuf, x, y, width, height, color): ...
stack_v2_sparse_classes_75kplus_train_072316
10,632
no_license
[ { "docstring": "Set a given pixel to a color.", "name": "set_pixel", "signature": "def set_pixel(framebuf, x, y, color)" }, { "docstring": "Get the color of a given pixel", "name": "get_pixel", "signature": "def get_pixel(framebuf, x, y)" }, { "docstring": "Draw a rectangle at th...
3
stack_v2_sparse_classes_30k_train_013845
Implement the Python class `MVLSBFormat` described below. Class description: MVLSBFormat Method signatures and docstrings: - def set_pixel(framebuf, x, y, color): Set a given pixel to a color. - def get_pixel(framebuf, x, y): Get the color of a given pixel - def fill_rect(framebuf, x, y, width, height, color): Draw a...
Implement the Python class `MVLSBFormat` described below. Class description: MVLSBFormat Method signatures and docstrings: - def set_pixel(framebuf, x, y, color): Set a given pixel to a color. - def get_pixel(framebuf, x, y): Get the color of a given pixel - def fill_rect(framebuf, x, y, width, height, color): Draw a...
78cdde343961ba4a2f1b9e0833540f1b20b18bfc
<|skeleton|> class MVLSBFormat: """MVLSBFormat""" def set_pixel(framebuf, x, y, color): """Set a given pixel to a color.""" <|body_0|> def get_pixel(framebuf, x, y): """Get the color of a given pixel""" <|body_1|> def fill_rect(framebuf, x, y, width, height, color): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MVLSBFormat: """MVLSBFormat""" def set_pixel(framebuf, x, y, color): """Set a given pixel to a color.""" index = (y >> 3) * framebuf.stride + x offset = y & 7 framebuf.buf[index] = framebuf.buf[index] & ~(1 << offset) | (color != 0) << offset def get_pixel(framebuf, x...
the_stack_v2_python_sparse
led_matrix/framebuf.py
ben-64/led_matrix
train
0
39c78eda7b4d537c784bae9680c2e4da557b4ec8
[ "super(AI, self).__init__()\nself.flag = {}\nself.flag['hasShowDebugInfo'] = False", "self.setting = setting\nself.data = data\nif data['ball']['pos'][0] <= setting['ScreenSize'][0] / 2 and data['ball']['speed'][0] >= 0:\n return self.AIMoveTo(data['yourBat']['pos'][0], data['yourBat']['pos'][1], 64)\nelif dat...
<|body_start_0|> super(AI, self).__init__() self.flag = {} self.flag['hasShowDebugInfo'] = False <|end_body_0|> <|body_start_1|> self.setting = setting self.data = data if data['ball']['pos'][0] <= setting['ScreenSize'][0] / 2 and data['ball']['speed'][0] >= 0: ...
docstring for AI
AI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AI: """docstring for AI""" def __init__(self): """docstring for __init__""" <|body_0|> def doAI(self, setting, data): """(设定:dic, 即时数据:dic) return [yourBat.pos.x:int, yourBat.pos.y:int]""" <|body_1|> def AIGetInfo(self): """获取AI.Bat与Ball之间的相对...
stack_v2_sparse_classes_75kplus_train_072317
3,399
no_license
[ { "docstring": "docstring for __init__", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "(设定:dic, 即时数据:dic) return [yourBat.pos.x:int, yourBat.pos.y:int]", "name": "doAI", "signature": "def doAI(self, setting, data)" }, { "docstring": "获取AI.Bat与Ball之间的相对距...
5
null
Implement the Python class `AI` described below. Class description: docstring for AI Method signatures and docstrings: - def __init__(self): docstring for __init__ - def doAI(self, setting, data): (设定:dic, 即时数据:dic) return [yourBat.pos.x:int, yourBat.pos.y:int] - def AIGetInfo(self): 获取AI.Bat与Ball之间的相对距离。 () return [...
Implement the Python class `AI` described below. Class description: docstring for AI Method signatures and docstrings: - def __init__(self): docstring for __init__ - def doAI(self, setting, data): (设定:dic, 即时数据:dic) return [yourBat.pos.x:int, yourBat.pos.y:int] - def AIGetInfo(self): 获取AI.Bat与Ball之间的相对距离。 () return [...
da95966846e09f5adc118fd746e63051ea700866
<|skeleton|> class AI: """docstring for AI""" def __init__(self): """docstring for __init__""" <|body_0|> def doAI(self, setting, data): """(设定:dic, 即时数据:dic) return [yourBat.pos.x:int, yourBat.pos.y:int]""" <|body_1|> def AIGetInfo(self): """获取AI.Bat与Ball之间的相对...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AI: """docstring for AI""" def __init__(self): """docstring for __init__""" super(AI, self).__init__() self.flag = {} self.flag['hasShowDebugInfo'] = False def doAI(self, setting, data): """(设定:dic, 即时数据:dic) return [yourBat.pos.x:int, yourBat.pos.y:int]""" ...
the_stack_v2_python_sparse
dist/lib_AI.py
miswanting/PingPong
train
0
eab8038431e54bd67040d5e9e6e483b7f0cd75c5
[ "slist = []\npre = ' '\nfor i in range(len(s) - 1, -1, -1):\n if s[i] != ' ' or (s[i] == ' ' and pre != ' '):\n slist.append(s[i])\n pre = s[i]\nl = len(slist)\nj = 0\nfor i in range(l + 1):\n if i == l or slist[i] == ' ':\n if i < l - 1 and slist[i + 1] == ' ':\n continue\n ...
<|body_start_0|> slist = [] pre = ' ' for i in range(len(s) - 1, -1, -1): if s[i] != ' ' or (s[i] == ' ' and pre != ' '): slist.append(s[i]) pre = s[i] l = len(slist) j = 0 for i in range(l + 1): if i == l or slist[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseWords(self, s): """:type s: str :rtype: str""" <|body_0|> def reverseWordsII(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> slist = [] pre = ' ' for i in range(len(s) - 1, -...
stack_v2_sparse_classes_75kplus_train_072318
1,984
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "reverseWords", "signature": "def reverseWords(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "reverseWordsII", "signature": "def reverseWordsII(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_019424
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseWords(self, s): :type s: str :rtype: str - def reverseWordsII(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseWords(self, s): :type s: str :rtype: str - def reverseWordsII(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def reverseWords(self, s): ...
8f44df0bcb521bbc3a7ff2564cbe931e146ae297
<|skeleton|> class Solution: def reverseWords(self, s): """:type s: str :rtype: str""" <|body_0|> def reverseWordsII(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverseWords(self, s): """:type s: str :rtype: str""" slist = [] pre = ' ' for i in range(len(s) - 1, -1, -1): if s[i] != ' ' or (s[i] == ' ' and pre != ' '): slist.append(s[i]) pre = s[i] l = len(slist) ...
the_stack_v2_python_sparse
leetcode/python/151_Reverse_Words_in_a_String.py
JaySurplus/online_code
train
0
bbe9d8126ccc0fe21de4bdf3c77d5775af0c3950
[ "q = f\"Are you sure you want to implode the deepstar path {os.environ['DEEPSTAR_PATH']} [y/n]? \"\ny = 'The deepstar path was succesfully imploded'\nn = 'The deepstar path was not imploded'\nif input(q).strip() == 'y':\n for path in [DBDir.path(), FileDir.path()]:\n shutil.rmtree(path)\n debug(y, 3)\n...
<|body_start_0|> q = f"Are you sure you want to implode the deepstar path {os.environ['DEEPSTAR_PATH']} [y/n]? " y = 'The deepstar path was succesfully imploded' n = 'The deepstar path was not imploded' if input(q).strip() == 'y': for path in [DBDir.path(), FileDir.path()]: ...
This class implements the ImplodeCommandLineRouteHandler class.
ImplodeCommandLineRouteHandler
[ "BSD-3-Clause-Clear" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImplodeCommandLineRouteHandler: """This class implements the ImplodeCommandLineRouteHandler class.""" def implode(self): """This method implodes the deepstar path including delete the DB and all files. :rtype: None""" <|body_0|> def usage(self): """This method pr...
stack_v2_sparse_classes_75kplus_train_072319
1,755
permissive
[ { "docstring": "This method implodes the deepstar path including delete the DB and all files. :rtype: None", "name": "implode", "signature": "def implode(self)" }, { "docstring": "This method prints usage. :rtype: None", "name": "usage", "signature": "def usage(self)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_019613
Implement the Python class `ImplodeCommandLineRouteHandler` described below. Class description: This class implements the ImplodeCommandLineRouteHandler class. Method signatures and docstrings: - def implode(self): This method implodes the deepstar path including delete the DB and all files. :rtype: None - def usage(...
Implement the Python class `ImplodeCommandLineRouteHandler` described below. Class description: This class implements the ImplodeCommandLineRouteHandler class. Method signatures and docstrings: - def implode(self): This method implodes the deepstar path including delete the DB and all files. :rtype: None - def usage(...
fe0fe12317975104fa6ff6c058d141f11e6e951d
<|skeleton|> class ImplodeCommandLineRouteHandler: """This class implements the ImplodeCommandLineRouteHandler class.""" def implode(self): """This method implodes the deepstar path including delete the DB and all files. :rtype: None""" <|body_0|> def usage(self): """This method pr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImplodeCommandLineRouteHandler: """This class implements the ImplodeCommandLineRouteHandler class.""" def implode(self): """This method implodes the deepstar path including delete the DB and all files. :rtype: None""" q = f"Are you sure you want to implode the deepstar path {os.environ['D...
the_stack_v2_python_sparse
deepstar/command_line_route_handlers/implode_command_line_route_handler.py
lcsouzamenezes/deepstar
train
0
075dba322732bda43f10249317e2faf634a277ff
[ "if id:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries is None or not list_dictionaries:\n return '[]'\nelse:\n return json.dumps(list_dictionaries)", "fn = str(cls.__name__) + '.json'\nlsd = []\nif list_objs is None:\n with open(fn, 'w') a...
<|body_start_0|> if id: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries is None or not list_dictionaries: return '[]' else: return json.dumps(list_dicti...
Base class for almost a circle project. Currently contains a constructor & a private class attribute __nb_objects. The goal is to manage id attribute in all future classes & avoid duplicating same code (by extension, same bugs). Attributes: __nb_objects = number of objects.
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """Base class for almost a circle project. Currently contains a constructor & a private class attribute __nb_objects. The goal is to manage id attribute in all future classes & avoid duplicating same code (by extension, same bugs). Attributes: __nb_objects = number of objects.""" def _...
stack_v2_sparse_classes_75kplus_train_072320
3,949
no_license
[ { "docstring": "Base class constructor. Args: self: lfes id: If id is not None, assign the public istance attribute id with this value. id is assumed to be an integer(no test needed). Otherwise, increment __nb_objects & assign the new value to the public instance attribute id.", "name": "__init__", "sig...
6
null
Implement the Python class `Base` described below. Class description: Base class for almost a circle project. Currently contains a constructor & a private class attribute __nb_objects. The goal is to manage id attribute in all future classes & avoid duplicating same code (by extension, same bugs). Attributes: __nb_obj...
Implement the Python class `Base` described below. Class description: Base class for almost a circle project. Currently contains a constructor & a private class attribute __nb_objects. The goal is to manage id attribute in all future classes & avoid duplicating same code (by extension, same bugs). Attributes: __nb_obj...
d469bebcf78ca5c2931500bb7a7d2bc0d2387608
<|skeleton|> class Base: """Base class for almost a circle project. Currently contains a constructor & a private class attribute __nb_objects. The goal is to manage id attribute in all future classes & avoid duplicating same code (by extension, same bugs). Attributes: __nb_objects = number of objects.""" def _...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Base: """Base class for almost a circle project. Currently contains a constructor & a private class attribute __nb_objects. The goal is to manage id attribute in all future classes & avoid duplicating same code (by extension, same bugs). Attributes: __nb_objects = number of objects.""" def __init__(self,...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
corbinenterline1/holbertonschool-higher_level_programming
train
0
dd740be3da9fd0b284fef64de8b7d30a7f07c308
[ "self._list_maps()\nselected_map = pre_selected\nmaps = self.maps\nwhile selected_map is None:\n selected_map = input('Entrez un nombre pour choisir un labyrithe: ')\n try:\n selected_map = int(selected_map)\n except:\n print(\"Ceci n'est pas un nombre...\")\n selected_map = None\n ...
<|body_start_0|> self._list_maps() selected_map = pre_selected maps = self.maps while selected_map is None: selected_map = input('Entrez un nombre pour choisir un labyrithe: ') try: selected_map = int(selected_map) except: ...
Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur.
ServerIhm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerIhm: """Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur.""" def get_map(self, pre_selected=None): """On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si...
stack_v2_sparse_classes_75kplus_train_072321
11,965
no_license
[ { "docstring": "On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si le nombre entré ne correspond à aucune carte, on boucle. Sinon, on retourne le chemin vers la carte. L'argument pre_selected, peut nous permettre de présélectionner un labyrinthe.", "name": "g...
3
stack_v2_sparse_classes_30k_train_014748
Implement the Python class `ServerIhm` described below. Class description: Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur. Method signatures and docstrings: - def get_map(self, pre_selected=None): On recupère la chemin vers la carte choisi...
Implement the Python class `ServerIhm` described below. Class description: Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur. Method signatures and docstrings: - def get_map(self, pre_selected=None): On recupère la chemin vers la carte choisi...
10d973bc939bc2b48b16acc59d259f955513409e
<|skeleton|> class ServerIhm: """Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur.""" def get_map(self, pre_selected=None): """On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServerIhm: """Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur.""" def get_map(self, pre_selected=None): """On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si le nombre en...
the_stack_v2_python_sparse
Python/OC/activity2/server_controllers/server.py
fherbine/trainingPython-Kivy
train
0
af94657814654afc6d3bd06ece648db8f2a680a0
[ "self.prefix = prefix\nself.loss = tf.keras.metrics.Mean(name=prefix + '_loss')\nself.accuracy = tf.keras.metrics.BinaryAccuracy(name=prefix + '_accuracy')\nself.precision = tf.keras.metrics.Precision(name=prefix + '_precision')\nself.recall = tf.keras.metrics.Recall(name=prefix + '_recall')\nself.auroc = tf.keras....
<|body_start_0|> self.prefix = prefix self.loss = tf.keras.metrics.Mean(name=prefix + '_loss') self.accuracy = tf.keras.metrics.BinaryAccuracy(name=prefix + '_accuracy') self.precision = tf.keras.metrics.Precision(name=prefix + '_precision') self.recall = tf.keras.metrics.Recall(...
Metrics
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Metrics: def __init__(self, prefix): """Groups several keras metric objects: CrossEntropy, BinaryAccuracy, Precision, Recall, AuROC, AuPRC :param prefix: prefix for the names of the keras metrics, which will be also used in summary file (e.g 'train_to_test' or 'test')""" <|body_0...
stack_v2_sparse_classes_75kplus_train_072322
26,860
permissive
[ { "docstring": "Groups several keras metric objects: CrossEntropy, BinaryAccuracy, Precision, Recall, AuROC, AuPRC :param prefix: prefix for the names of the keras metrics, which will be also used in summary file (e.g 'train_to_test' or 'test')", "name": "__init__", "signature": "def __init__(self, pref...
5
stack_v2_sparse_classes_30k_val_000233
Implement the Python class `Metrics` described below. Class description: Implement the Metrics class. Method signatures and docstrings: - def __init__(self, prefix): Groups several keras metric objects: CrossEntropy, BinaryAccuracy, Precision, Recall, AuROC, AuPRC :param prefix: prefix for the names of the keras metr...
Implement the Python class `Metrics` described below. Class description: Implement the Metrics class. Method signatures and docstrings: - def __init__(self, prefix): Groups several keras metric objects: CrossEntropy, BinaryAccuracy, Precision, Recall, AuROC, AuPRC :param prefix: prefix for the names of the keras metr...
4fb69dc2526579a7677c27e75eae3a0b0000b5de
<|skeleton|> class Metrics: def __init__(self, prefix): """Groups several keras metric objects: CrossEntropy, BinaryAccuracy, Precision, Recall, AuROC, AuPRC :param prefix: prefix for the names of the keras metrics, which will be also used in summary file (e.g 'train_to_test' or 'test')""" <|body_0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Metrics: def __init__(self, prefix): """Groups several keras metric objects: CrossEntropy, BinaryAccuracy, Precision, Recall, AuROC, AuPRC :param prefix: prefix for the names of the keras metrics, which will be also used in summary file (e.g 'train_to_test' or 'test')""" self.prefix = prefix ...
the_stack_v2_python_sparse
custom_trainer.py
DawyD/illumination-preserving-rotations
train
3
4e779ddf04109f9b997523037c3a40c6b74f521d
[ "room = (yield self.object_store.create_object(settings.ROOM_PARENT, name='Another room'))\nself.assertIsInstance(room.id, int)\nself.assertEqual('Another room', room.name)", "parent_path = settings.ROOM_PARENT\nroom1 = (yield self.object_store.create_object(parent_path, name='Some room'))\nroom2 = (yield self.ob...
<|body_start_0|> room = (yield self.object_store.create_object(settings.ROOM_PARENT, name='Another room')) self.assertIsInstance(room.id, int) self.assertEqual('Another room', room.name) <|end_body_0|> <|body_start_1|> parent_path = settings.ROOM_PARENT room1 = (yield self.objec...
Testing of the ObjectStore storage backend.
GeneralObjectStoreTests
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralObjectStoreTests: """Testing of the ObjectStore storage backend.""" def test_create_room(self): """Creates a room and double-checks some values.""" <|body_0|> def test_global_name_search(self): """Tests the global_name_search method on the object store. Fu...
stack_v2_sparse_classes_75kplus_train_072323
5,015
permissive
[ { "docstring": "Creates a room and double-checks some values.", "name": "test_create_room", "signature": "def test_create_room(self)" }, { "docstring": "Tests the global_name_search method on the object store. Fuzzy name matching.", "name": "test_global_name_search", "signature": "def te...
3
null
Implement the Python class `GeneralObjectStoreTests` described below. Class description: Testing of the ObjectStore storage backend. Method signatures and docstrings: - def test_create_room(self): Creates a room and double-checks some values. - def test_global_name_search(self): Tests the global_name_search method on...
Implement the Python class `GeneralObjectStoreTests` described below. Class description: Testing of the ObjectStore storage backend. Method signatures and docstrings: - def test_create_room(self): Creates a room and double-checks some values. - def test_global_name_search(self): Tests the global_name_search method on...
b0dfbecc1171ed82566ecf814a73ce3dcaa468be
<|skeleton|> class GeneralObjectStoreTests: """Testing of the ObjectStore storage backend.""" def test_create_room(self): """Creates a room and double-checks some values.""" <|body_0|> def test_global_name_search(self): """Tests the global_name_search method on the object store. Fu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeneralObjectStoreTests: """Testing of the ObjectStore storage backend.""" def test_create_room(self): """Creates a room and double-checks some values.""" room = (yield self.object_store.create_object(settings.ROOM_PARENT, name='Another room')) self.assertIsInstance(room.id, int) ...
the_stack_v2_python_sparse
src/daemons/server/objects/tests.py
gtaylor/dott
train
6
8bf88d39e35e5320660da83d0e681d1c48f589aa
[ "super().__init__(n_components=n_components, **kwargs)\nif n_components == 0:\n raise ValueError('n_components must be set to a non-zero integer')\nself.n_components = n_components\nself.trunc_svd_obj = None", "if self.trunc_svd_obj is not None:\n comps = self.trunc_svd_obj.components_\n index = []\n ...
<|body_start_0|> super().__init__(n_components=n_components, **kwargs) if n_components == 0: raise ValueError('n_components must be set to a non-zero integer') self.n_components = n_components self.trunc_svd_obj = None <|end_body_0|> <|body_start_1|> if self.trunc_sv...
Truncated_SVD_Decomposer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Truncated_SVD_Decomposer: def __init__(self, n_components=0, **kwargs): """Perform a truncated SVD decomposition. This is very useful for extremely high dimensional data (>10000 features) although it's not guaranteed to return the same coefficients each run. Parameters ---------- n_compo...
stack_v2_sparse_classes_75kplus_train_072324
2,204
permissive
[ { "docstring": "Perform a truncated SVD decomposition. This is very useful for extremely high dimensional data (>10000 features) although it's not guaranteed to return the same coefficients each run. Parameters ---------- n_components : int Number of components required (not optional). If 0 (default), will rais...
3
stack_v2_sparse_classes_30k_train_001620
Implement the Python class `Truncated_SVD_Decomposer` described below. Class description: Implement the Truncated_SVD_Decomposer class. Method signatures and docstrings: - def __init__(self, n_components=0, **kwargs): Perform a truncated SVD decomposition. This is very useful for extremely high dimensional data (>100...
Implement the Python class `Truncated_SVD_Decomposer` described below. Class description: Implement the Truncated_SVD_Decomposer class. Method signatures and docstrings: - def __init__(self, n_components=0, **kwargs): Perform a truncated SVD decomposition. This is very useful for extremely high dimensional data (>100...
041391f4ef0667e555046fc66f5beb67b4975dda
<|skeleton|> class Truncated_SVD_Decomposer: def __init__(self, n_components=0, **kwargs): """Perform a truncated SVD decomposition. This is very useful for extremely high dimensional data (>10000 features) although it's not guaranteed to return the same coefficients each run. Parameters ---------- n_compo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Truncated_SVD_Decomposer: def __init__(self, n_components=0, **kwargs): """Perform a truncated SVD decomposition. This is very useful for extremely high dimensional data (>10000 features) although it's not guaranteed to return the same coefficients each run. Parameters ---------- n_components : int Nu...
the_stack_v2_python_sparse
astronomaly/dimensionality_reduction/truncated_svd.py
MichelleLochner/astronomaly
train
69
c5a469a11370985eb1dcff314ffaba5c1e474f3a
[ "self._key = key[:]\nself._child_name = self._key[-1] if self._key else None\nself._parent_key = self._key[:-1] if self._key else None\nself._items = None\nself._resource = None", "if self._items is None:\n self._resource = resource_projector.MakeSerializable(resource)\n self._items = resource_property.Get(...
<|body_start_0|> self._key = key[:] self._child_name = self._key[-1] if self._key else None self._parent_key = self._key[:-1] if self._key else None self._items = None self._resource = None <|end_body_0|> <|body_start_1|> if self._items is None: self._resourc...
A Tapper class that flattens a resource key slice to separate records. A serialized copy of the resource is modified in place. This means the same resource object is returned for each flattened slice item. This is OK because the downstream is not guaranteed uniqueness. Attributes: _child_name: The flattened value to se...
Flattener
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Flattener: """A Tapper class that flattens a resource key slice to separate records. A serialized copy of the resource is modified in place. This means the same resource object is returned for each flattened slice item. This is OK because the downstream is not guaranteed uniqueness. Attributes: _...
stack_v2_sparse_classes_75kplus_train_072325
8,125
permissive
[ { "docstring": "Constructor. Args: key: The resource key of the slice to flatten.", "name": "__init__", "signature": "def __init__(self, key)" }, { "docstring": "Returns the next slice item in resource. Args: resource: The resource to flatten. Returns: True if the next slice is not a list, False...
2
stack_v2_sparse_classes_30k_test_002245
Implement the Python class `Flattener` described below. Class description: A Tapper class that flattens a resource key slice to separate records. A serialized copy of the resource is modified in place. This means the same resource object is returned for each flattened slice item. This is OK because the downstream is n...
Implement the Python class `Flattener` described below. Class description: A Tapper class that flattens a resource key slice to separate records. A serialized copy of the resource is modified in place. This means the same resource object is returned for each flattened slice item. This is OK because the downstream is n...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class Flattener: """A Tapper class that flattens a resource key slice to separate records. A serialized copy of the resource is modified in place. This means the same resource object is returned for each flattened slice item. This is OK because the downstream is not guaranteed uniqueness. Attributes: _...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Flattener: """A Tapper class that flattens a resource key slice to separate records. A serialized copy of the resource is modified in place. This means the same resource object is returned for each flattened slice item. This is OK because the downstream is not guaranteed uniqueness. Attributes: _child_name: T...
the_stack_v2_python_sparse
google-cloud-sdk/.install/.backup/lib/googlecloudsdk/calliope/display_taps.py
KaranToor/MA450
train
1
60ec195d6f85c8201761d454ec2f8282a4bdb752
[ "self.verbose = verbose\nself.case_dict = Params.initialize(model_parameters_path, verbose)\nself.results = Result.initialize(Params.results_inputs, Params.case_definitions)\nif verbose:\n self.visualization = Visualization(Params)\n self.visualization.class_summary()", "starts = time.time()\nfor key, value...
<|body_start_0|> self.verbose = verbose self.case_dict = Params.initialize(model_parameters_path, verbose) self.results = Result.initialize(Params.results_inputs, Params.case_definitions) if verbose: self.visualization = Visualization(Params) self.visualization.cl...
StorageVET API. This will eventually allow StorageVET to be imported and used like any other python library.
StorageVET
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageVET: """StorageVET API. This will eventually allow StorageVET to be imported and used like any other python library.""" def __init__(self, model_parameters_path, verbose=False): """Constructor to initialize the parameters and data needed to run StorageVET. Initialize the Param...
stack_v2_sparse_classes_75kplus_train_072326
3,503
permissive
[ { "docstring": "Constructor to initialize the parameters and data needed to run StorageVET. Initialize the Params Object from Model Parameters Args: model_parameters_path (str): Filename of the model parameters CSV or XML that describes the case to be analysed", "name": "__init__", "signature": "def __i...
2
null
Implement the Python class `StorageVET` described below. Class description: StorageVET API. This will eventually allow StorageVET to be imported and used like any other python library. Method signatures and docstrings: - def __init__(self, model_parameters_path, verbose=False): Constructor to initialize the parameter...
Implement the Python class `StorageVET` described below. Class description: StorageVET API. This will eventually allow StorageVET to be imported and used like any other python library. Method signatures and docstrings: - def __init__(self, model_parameters_path, verbose=False): Constructor to initialize the parameter...
eb490d94baac2c287a77f1b403ce7337cf51aaf4
<|skeleton|> class StorageVET: """StorageVET API. This will eventually allow StorageVET to be imported and used like any other python library.""" def __init__(self, model_parameters_path, verbose=False): """Constructor to initialize the parameters and data needed to run StorageVET. Initialize the Param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StorageVET: """StorageVET API. This will eventually allow StorageVET to be imported and used like any other python library.""" def __init__(self, model_parameters_path, verbose=False): """Constructor to initialize the parameters and data needed to run StorageVET. Initialize the Params Object from...
the_stack_v2_python_sparse
storagevet_dervet_1.0/storagevet/StorageVET.py
pajalevi/StorageVET
train
0
c3a8c7f4e389872df9d951fe78ea39b5b5daa9a1
[ "self.surface = pygame.Surface(dim)\nself.pos = pos\nself.size = size\nself.color = color\nself.arcs = []\ncount = 10\npalette = get_rgb_color_gradient((50, 140, 70), (240, 0, 70), count)\nfor i in range(count):\n start_angle = random.randint(-360, 360)\n stop_angle = random.randint(-360, 360)\n width = 10...
<|body_start_0|> self.surface = pygame.Surface(dim) self.pos = pos self.size = size self.color = color self.arcs = [] count = 10 palette = get_rgb_color_gradient((50, 140, 70), (240, 0, 70), count) for i in range(count): start_angle = random.ra...
Draw Superformula Object and vary some parameters on every frame
ArcAnimation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArcAnimation: """Draw Superformula Object and vary some parameters on every frame""" def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple): """animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :...
stack_v2_sparse_classes_75kplus_train_072327
5,052
no_license
[ { "docstring": "animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :param pos: position to set particle, center of particle :param size: size of particle :param color: color of particle :param parms: tuple oof four (m, n1, n2, n3)", "name": "...
2
stack_v2_sparse_classes_30k_train_036202
Implement the Python class `ArcAnimation` described below. Class description: Draw Superformula Object and vary some parameters on every frame Method signatures and docstrings: - def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple): animated superformula figure in 2D, altering some parameters ...
Implement the Python class `ArcAnimation` described below. Class description: Draw Superformula Object and vary some parameters on every frame Method signatures and docstrings: - def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple): animated superformula figure in 2D, altering some parameters ...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class ArcAnimation: """Draw Superformula Object and vary some parameters on every frame""" def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple): """animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArcAnimation: """Draw Superformula Object and vary some parameters on every frame""" def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple): """animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :param pos: po...
the_stack_v2_python_sparse
effects/CircleArcs.py
gunny26/pygame
train
5
4b7dbc37ca1193edfd9c28576acc69bafc348d05
[ "if self._context is None:\n self._context = {}\nactive_id = self._context and self._context.get('active_id', False) or False\nif not active_id:\n return False\nlead_brw = self.env['crm.lead'].browse(active_id)\nlead = lead_brw.read(['partner_id'])[0]\nreturn lead['partner_id'][0] if lead['partner_id'] else F...
<|body_start_0|> if self._context is None: self._context = {} active_id = self._context and self._context.get('active_id', False) or False if not active_id: return False lead_brw = self.env['crm.lead'].browse(active_id) lead = lead_brw.read(['partner_id'])...
Make contract order for crm
crm_make_contract
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class crm_make_contract: """Make contract order for crm""" def _selectPartner(self): """This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field.""" <|body_0|> def makecontract(self): """This func...
stack_v2_sparse_classes_75kplus_train_072328
6,484
no_license
[ { "docstring": "This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field.", "name": "_selectPartner", "signature": "def _selectPartner(self)" }, { "docstring": "This function create Quotation on given case. @param self: The...
2
stack_v2_sparse_classes_30k_train_042746
Implement the Python class `crm_make_contract` described below. Class description: Make contract order for crm Method signatures and docstrings: - def _selectPartner(self): This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field. - def makecont...
Implement the Python class `crm_make_contract` described below. Class description: Make contract order for crm Method signatures and docstrings: - def _selectPartner(self): This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field. - def makecont...
faf6dfa178c869ba660b86bf0efb307985250c76
<|skeleton|> class crm_make_contract: """Make contract order for crm""" def _selectPartner(self): """This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field.""" <|body_0|> def makecontract(self): """This func...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class crm_make_contract: """Make contract order for crm""" def _selectPartner(self): """This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field.""" if self._context is None: self._context = {} active_i...
the_stack_v2_python_sparse
realestate/models/crm_lead.py
eman000tahaz/arc-s
train
0
44d160bd335180af752386c8ffa6662bacf81c5c
[ "self._dbg = debug\nself._log = get_logger(self.__class__.__name__, self._dbg)\nself._log.debug('server_host:server_port=%s:%s', server_host, server_port)\nself._log.debug('cmd=%s', cmd)\nself._server_host = server_host\nself._server_port = server_port\nself._cmd = cmd\nself._client = WsClientHostPort(self._server_...
<|body_start_0|> self._dbg = debug self._log = get_logger(self.__class__.__name__, self._dbg) self._log.debug('server_host:server_port=%s:%s', server_host, server_port) self._log.debug('cmd=%s', cmd) self._server_host = server_host self._server_port = server_port ...
Music Box Websocket Client App for simple command
WsCmdApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WsCmdApp: """Music Box Websocket Client App for simple command""" def __init__(self, server_host, server_port, cmd, debug=False): """Constructor Parameters ---------- server_host: str server_port: int cmd: str""" <|body_0|> def main(self): """main""" <|bo...
stack_v2_sparse_classes_75kplus_train_072329
25,197
no_license
[ { "docstring": "Constructor Parameters ---------- server_host: str server_port: int cmd: str", "name": "__init__", "signature": "def __init__(self, server_host, server_port, cmd, debug=False)" }, { "docstring": "main", "name": "main", "signature": "def main(self)" } ]
2
stack_v2_sparse_classes_30k_train_052082
Implement the Python class `WsCmdApp` described below. Class description: Music Box Websocket Client App for simple command Method signatures and docstrings: - def __init__(self, server_host, server_port, cmd, debug=False): Constructor Parameters ---------- server_host: str server_port: int cmd: str - def main(self):...
Implement the Python class `WsCmdApp` described below. Class description: Music Box Websocket Client App for simple command Method signatures and docstrings: - def __init__(self, server_host, server_port, cmd, debug=False): Constructor Parameters ---------- server_host: str server_port: int cmd: str - def main(self):...
b8264118d19c7f6c6be9b11f18c890c598eb1295
<|skeleton|> class WsCmdApp: """Music Box Websocket Client App for simple command""" def __init__(self, server_host, server_port, cmd, debug=False): """Constructor Parameters ---------- server_host: str server_port: int cmd: str""" <|body_0|> def main(self): """main""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WsCmdApp: """Music Box Websocket Client App for simple command""" def __init__(self, server_host, server_port, cmd, debug=False): """Constructor Parameters ---------- server_host: str server_port: int cmd: str""" self._dbg = debug self._log = get_logger(self.__class__.__name__, se...
the_stack_v2_python_sparse
musicbox/__main__.py
ytani01/MusicBox
train
1
b998610e6ab9cbfa1ef1766d705ba51903a42a1b
[ "try:\n return self._metadata\nexcept AttributeError:\n self._metadata = {'pages': 0, 'original_height': 0, 'original_width': 0, 'original_color_space': 'TBD'}\n return self._metadata", "print('%s.generate_previews called' % self.__class__.__name__)\nprint('+- Get original file')\nprint('+- \"Print\" eac...
<|body_start_0|> try: return self._metadata except AttributeError: self._metadata = {'pages': 0, 'original_height': 0, 'original_width': 0, 'original_color_space': 'TBD'} return self._metadata <|end_body_0|> <|body_start_1|> print('%s.generate_previews called...
Provides concrete implementation of functionality required by BaseAsset for PDF assets
PDFAsset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDFAsset: """Provides concrete implementation of functionality required by BaseAsset for PDF assets""" def metadata(self): """Gets the metadata associated with the instance""" <|body_0|> def generate_previews(self): """Generates a set of preview-images of the ass...
stack_v2_sparse_classes_75kplus_train_072330
13,347
permissive
[ { "docstring": "Gets the metadata associated with the instance", "name": "metadata", "signature": "def metadata(self)" }, { "docstring": "Generates a set of preview-images of the asset.", "name": "generate_previews", "signature": "def generate_previews(self)" } ]
2
stack_v2_sparse_classes_30k_train_050868
Implement the Python class `PDFAsset` described below. Class description: Provides concrete implementation of functionality required by BaseAsset for PDF assets Method signatures and docstrings: - def metadata(self): Gets the metadata associated with the instance - def generate_previews(self): Generates a set of prev...
Implement the Python class `PDFAsset` described below. Class description: Provides concrete implementation of functionality required by BaseAsset for PDF assets Method signatures and docstrings: - def metadata(self): Gets the metadata associated with the instance - def generate_previews(self): Generates a set of prev...
4840b0ee9e155c8ed664886c0aad20d44d48dac2
<|skeleton|> class PDFAsset: """Provides concrete implementation of functionality required by BaseAsset for PDF assets""" def metadata(self): """Gets the metadata associated with the instance""" <|body_0|> def generate_previews(self): """Generates a set of preview-images of the ass...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PDFAsset: """Provides concrete implementation of functionality required by BaseAsset for PDF assets""" def metadata(self): """Gets the metadata associated with the instance""" try: return self._metadata except AttributeError: self._metadata = {'pages': 0, '...
the_stack_v2_python_sparse
Chapter04/C04R03_SubclassRegistrationMetaclass.py
PacktPublishing/Python-Object-Oriented-Programming-Cookbook
train
17
18a0249ae46633da735ed28b4f0920c4eafd7c49
[ "protocol = super().__new__(cls, name, bases, attributes, **kwds)\nprotocol.pyre_locator = tracking.here(level=1)\nreturn protocol", "super().__init__(name, bases, attributes, **kwds)\nfrom .. import dashboard\nregistrar = dashboard.registrar\nregistrar.registerProtocolClass(protocol=self)\nself.pyre_classRegiste...
<|body_start_0|> protocol = super().__new__(cls, name, bases, attributes, **kwds) protocol.pyre_locator = tracking.here(level=1) return protocol <|end_body_0|> <|body_start_1|> super().__init__(name, bases, attributes, **kwds) from .. import dashboard registrar = dashboa...
The metaclass for protocols
Role
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Role: """The metaclass for protocols""" def __new__(cls, name, bases, attributes, **kwds): """Build a new protocol class record""" <|body_0|> def __init__(self, name, bases, attributes, **kwds): """Initialize a freshly minted protocol record""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_072331
1,790
no_license
[ { "docstring": "Build a new protocol class record", "name": "__new__", "signature": "def __new__(cls, name, bases, attributes, **kwds)" }, { "docstring": "Initialize a freshly minted protocol record", "name": "__init__", "signature": "def __init__(self, name, bases, attributes, **kwds)" ...
3
stack_v2_sparse_classes_30k_train_011406
Implement the Python class `Role` described below. Class description: The metaclass for protocols Method signatures and docstrings: - def __new__(cls, name, bases, attributes, **kwds): Build a new protocol class record - def __init__(self, name, bases, attributes, **kwds): Initialize a freshly minted protocol record ...
Implement the Python class `Role` described below. Class description: The metaclass for protocols Method signatures and docstrings: - def __new__(cls, name, bases, attributes, **kwds): Build a new protocol class record - def __init__(self, name, bases, attributes, **kwds): Initialize a freshly minted protocol record ...
fd9a82d7dafa815dd68f679eb2b4b1a6287d02ea
<|skeleton|> class Role: """The metaclass for protocols""" def __new__(cls, name, bases, attributes, **kwds): """Build a new protocol class record""" <|body_0|> def __init__(self, name, bases, attributes, **kwds): """Initialize a freshly minted protocol record""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Role: """The metaclass for protocols""" def __new__(cls, name, bases, attributes, **kwds): """Build a new protocol class record""" protocol = super().__new__(cls, name, bases, attributes, **kwds) protocol.pyre_locator = tracking.here(level=1) return protocol def __ini...
the_stack_v2_python_sparse
pkg/p2/components/Role.py
aivazis/p2
train
2
0e6524a905e16b79d8ef85b5a26a930ff8007986
[ "super(TextCNN, self).__init__()\nself.num_labels = num_labels\nself.embedding_size = embedding_size\nself.max_length = max_length\nif self.max_length == 1:\n self.conv_1 = nn.Conv1d(1, 1, 3)\n self.conv_2 = nn.Conv1d(1, 1, 4)\n self.conv_3 = nn.Conv1d(1, 1, 5)\n self.max_pool_1 = nn.MaxPool1d(kernel_si...
<|body_start_0|> super(TextCNN, self).__init__() self.num_labels = num_labels self.embedding_size = embedding_size self.max_length = max_length if self.max_length == 1: self.conv_1 = nn.Conv1d(1, 1, 3) self.conv_2 = nn.Conv1d(1, 1, 4) self.conv...
TextCNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextCNN: def __init__(self, num_labels: int, embedding_size: int, max_length: int): """Initialize TextCNN classifier :param num_labels: :param embedding_size: :param max_length:""" <|body_0|> def forward(self, x): """Forward method for torch.nn.Module :param x: :retu...
stack_v2_sparse_classes_75kplus_train_072332
6,098
permissive
[ { "docstring": "Initialize TextCNN classifier :param num_labels: :param embedding_size: :param max_length:", "name": "__init__", "signature": "def __init__(self, num_labels: int, embedding_size: int, max_length: int)" }, { "docstring": "Forward method for torch.nn.Module :param x: :return:", ...
2
stack_v2_sparse_classes_30k_train_008783
Implement the Python class `TextCNN` described below. Class description: Implement the TextCNN class. Method signatures and docstrings: - def __init__(self, num_labels: int, embedding_size: int, max_length: int): Initialize TextCNN classifier :param num_labels: :param embedding_size: :param max_length: - def forward(...
Implement the Python class `TextCNN` described below. Class description: Implement the TextCNN class. Method signatures and docstrings: - def __init__(self, num_labels: int, embedding_size: int, max_length: int): Initialize TextCNN classifier :param num_labels: :param embedding_size: :param max_length: - def forward(...
3df2c604d4f9934be9019ac3d6fdef48c6cc7c33
<|skeleton|> class TextCNN: def __init__(self, num_labels: int, embedding_size: int, max_length: int): """Initialize TextCNN classifier :param num_labels: :param embedding_size: :param max_length:""" <|body_0|> def forward(self, x): """Forward method for torch.nn.Module :param x: :retu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextCNN: def __init__(self, num_labels: int, embedding_size: int, max_length: int): """Initialize TextCNN classifier :param num_labels: :param embedding_size: :param max_length:""" super(TextCNN, self).__init__() self.num_labels = num_labels self.embedding_size = embedding_size...
the_stack_v2_python_sparse
sentivi/classifier/text_cnn.py
TinDang97/sentivi
train
0
a0b997994484bf56c89ccad2df6b41e104916c8c
[ "data = {}\nfor group in props.find_children('ItemVar'):\n if not group.has_children():\n LOGGER.warning('Illegal leaf keyvalue \"{}\" in ItemVar conf', group.name)\n for widget in group:\n data[f'{group.real_name}:{widget.real_name}'] = WidgetConfig.parse_kv1(widget, 1)\nreturn data", "assert...
<|body_start_0|> data = {} for group in props.find_children('ItemVar'): if not group.has_children(): LOGGER.warning('Illegal leaf keyvalue "{}" in ItemVar conf', group.name) for widget in group: data[f'{group.real_name}:{widget.real_name}'] = Widge...
Saved values for package-customisable widgets in the Item/Style Properties Pane.
WidgetConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WidgetConfig: """Saved values for package-customisable widgets in the Item/Style Properties Pane.""" def parse_legacy(cls, props: Property) -> Dict[str, 'WidgetConfig']: """Parse from the old legacy config.""" <|body_0|> def parse_kv1(cls, data: Property, version: int) -...
stack_v2_sparse_classes_75kplus_train_072333
2,540
no_license
[ { "docstring": "Parse from the old legacy config.", "name": "parse_legacy", "signature": "def parse_legacy(cls, props: Property) -> Dict[str, 'WidgetConfig']" }, { "docstring": "Parse Keyvalues config values.", "name": "parse_kv1", "signature": "def parse_kv1(cls, data: Property, version...
5
stack_v2_sparse_classes_30k_train_041910
Implement the Python class `WidgetConfig` described below. Class description: Saved values for package-customisable widgets in the Item/Style Properties Pane. Method signatures and docstrings: - def parse_legacy(cls, props: Property) -> Dict[str, 'WidgetConfig']: Parse from the old legacy config. - def parse_kv1(cls,...
Implement the Python class `WidgetConfig` described below. Class description: Saved values for package-customisable widgets in the Item/Style Properties Pane. Method signatures and docstrings: - def parse_legacy(cls, props: Property) -> Dict[str, 'WidgetConfig']: Parse from the old legacy config. - def parse_kv1(cls,...
9f9219934b8f4af3c03d0080fad6078a18f3d530
<|skeleton|> class WidgetConfig: """Saved values for package-customisable widgets in the Item/Style Properties Pane.""" def parse_legacy(cls, props: Property) -> Dict[str, 'WidgetConfig']: """Parse from the old legacy config.""" <|body_0|> def parse_kv1(cls, data: Property, version: int) -...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WidgetConfig: """Saved values for package-customisable widgets in the Item/Style Properties Pane.""" def parse_legacy(cls, props: Property) -> Dict[str, 'WidgetConfig']: """Parse from the old legacy config.""" data = {} for group in props.find_children('ItemVar'): if n...
the_stack_v2_python_sparse
src/config/widgets.py
BEEmod/BEE2.4
train
276
fbb5f8d9ad107e9eb0949031e21c44463e580496
[ "with create_session() as session:\n matched_parking_list = session.query(MatchedParkingSpaceList).filter(MatchedParkingSpaceList.plate == plate).one()\n entity = MatchedParkingSpaceMapper.to_entity(record=matched_parking_list)\n raise Return(entity)", "with create_session() as session:\n matched_park...
<|body_start_0|> with create_session() as session: matched_parking_list = session.query(MatchedParkingSpaceList).filter(MatchedParkingSpaceList.plate == plate).one() entity = MatchedParkingSpaceMapper.to_entity(record=matched_parking_list) raise Return(entity) <|end_body_0|> ...
MatchedParkingList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" <|body_0|> def read_many(cls, user_id): """Read many and only return list<MatchedPa...
stack_v2_sparse_classes_75kplus_train_072334
3,429
no_license
[ { "docstring": "Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user", "name": "read_one", "signature": "def read_one(cls, plate)" }, { "docstring": "Read many and only return list<MatchedParkingSpace> :param str user...
5
stack_v2_sparse_classes_30k_train_033801
Implement the Python class `MatchedParkingList` described below. Class description: Implement the MatchedParkingList class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user ...
Implement the Python class `MatchedParkingList` described below. Class description: Implement the MatchedParkingList class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user ...
fd759c16b9864f6b1b47b1ba3f1af77f8d08af20
<|skeleton|> class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" <|body_0|> def read_many(cls, user_id): """Read many and only return list<MatchedPa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" with create_session() as session: matched_parking_list = session.query(MatchedParkingSpaceList).fi...
the_stack_v2_python_sparse
ParkingFinder/repositories/matched_parking_list.py
Big-Lemon/ParkingFinder
train
2
175cf8cc571e1c8cd0a6909539bfbfa724a6a556
[ "a = 0\nb = 1\nwhile b < len(nums):\n if nums[b] != nums[a]:\n a += 1\n nums[a] = nums[b]\n b += 1\nreturn a + 1", "a = 0\nb = 1\nwhile b < len(nums):\n if nums[b] == nums[a]:\n b += 1\n else:\n a += 1\n nums[a] = nums[b]\n b += 1\nreturn a + 1", "a = 0\nb =...
<|body_start_0|> a = 0 b = 1 while b < len(nums): if nums[b] != nums[a]: a += 1 nums[a] = nums[b] b += 1 return a + 1 <|end_body_0|> <|body_start_1|> a = 0 b = 1 while b < len(nums): if nums[b] =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype:...
stack_v2_sparse_classes_75kplus_train_072335
1,470
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums)" }, { "docstring": ":t...
4
stack_v2_sparse_classes_30k_train_019382
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :typ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :typ...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" a = 0 b = 1 while b < len(nums): if nums[b] != nums[a]: a += 1 nums[a] = nums[b] b += 1 return a + 1 def removeDuplicates(sel...
the_stack_v2_python_sparse
0026_Remove_Duplicates_from_Sorted_Array.py
bingli8802/leetcode
train
0
e2964caeda3503acb835b41490fe8396310faf3e
[ "uploads = await get_data_from_req(self.request).uploads.find(user, page, per_page, upload_type, paginate)\nif paginate:\n return json_response(uploads)\nreturn json_response({'documents': uploads})", "errors = naive_validator(self.request)\nif errors:\n raise InvalidQuery(errors)\nif upload_type and upload...
<|body_start_0|> uploads = await get_data_from_req(self.request).uploads.find(user, page, per_page, upload_type, paginate) if paginate: return json_response(uploads) return json_response({'documents': uploads}) <|end_body_0|> <|body_start_1|> errors = naive_validator(self.re...
UploadsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadsView: async def get(self, user: Optional[str]=None, page: conint(ge=1)=1, per_page: conint(ge=1, le=100)=25, upload_type: Optional[str]=None, paginate: Optional[bool]=False) -> r200[List[GetUploadsResponse]]: """List uploads. Lists JSON details of all files uploaded to the instanc...
stack_v2_sparse_classes_75kplus_train_072336
6,109
permissive
[ { "docstring": "List uploads. Lists JSON details of all files uploaded to the instance. Status Codes: 200: Successful operation", "name": "get", "signature": "async def get(self, user: Optional[str]=None, page: conint(ge=1)=1, per_page: conint(ge=1, le=100)=25, upload_type: Optional[str]=None, paginate:...
2
stack_v2_sparse_classes_30k_train_026465
Implement the Python class `UploadsView` described below. Class description: Implement the UploadsView class. Method signatures and docstrings: - async def get(self, user: Optional[str]=None, page: conint(ge=1)=1, per_page: conint(ge=1, le=100)=25, upload_type: Optional[str]=None, paginate: Optional[bool]=False) -> r...
Implement the Python class `UploadsView` described below. Class description: Implement the UploadsView class. Method signatures and docstrings: - async def get(self, user: Optional[str]=None, page: conint(ge=1)=1, per_page: conint(ge=1, le=100)=25, upload_type: Optional[str]=None, paginate: Optional[bool]=False) -> r...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class UploadsView: async def get(self, user: Optional[str]=None, page: conint(ge=1)=1, per_page: conint(ge=1, le=100)=25, upload_type: Optional[str]=None, paginate: Optional[bool]=False) -> r200[List[GetUploadsResponse]]: """List uploads. Lists JSON details of all files uploaded to the instanc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UploadsView: async def get(self, user: Optional[str]=None, page: conint(ge=1)=1, per_page: conint(ge=1, le=100)=25, upload_type: Optional[str]=None, paginate: Optional[bool]=False) -> r200[List[GetUploadsResponse]]: """List uploads. Lists JSON details of all files uploaded to the instance. Status Code...
the_stack_v2_python_sparse
virtool/uploads/api.py
virtool/virtool
train
45
77ea59edc75bc37bbb84ebc9e8b4a6a458150b94
[ "name = read_unicode_string(fp)\nclassID = read_length_and_key(fp)\nvalue = read_unicode_string(fp)\nreturn cls(name, classID, value)", "written = write_unicode_string(fp, self.name)\nwritten += write_length_and_key(fp, self.classID)\nwritten += write_unicode_string(fp, self.value)\nreturn written" ]
<|body_start_0|> name = read_unicode_string(fp) classID = read_length_and_key(fp) value = read_unicode_string(fp) return cls(name, classID, value) <|end_body_0|> <|body_start_1|> written = write_unicode_string(fp, self.name) written += write_length_and_key(fp, self.class...
Name structure (Undocumented).
Name
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Name: """Name structure (Undocumented).""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" <|body_0|> def write(self, fp): """Write the element to a file-like object. :param fp: file-like object""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_072337
19,890
permissive
[ { "docstring": "Read the element from a file-like object. :param fp: file-like object", "name": "read", "signature": "def read(cls, fp)" }, { "docstring": "Write the element to a file-like object. :param fp: file-like object", "name": "write", "signature": "def write(self, fp)" } ]
2
stack_v2_sparse_classes_30k_val_002303
Implement the Python class `Name` described below. Class description: Name structure (Undocumented). Method signatures and docstrings: - def read(cls, fp): Read the element from a file-like object. :param fp: file-like object - def write(self, fp): Write the element to a file-like object. :param fp: file-like object
Implement the Python class `Name` described below. Class description: Name structure (Undocumented). Method signatures and docstrings: - def read(cls, fp): Read the element from a file-like object. :param fp: file-like object - def write(self, fp): Write the element to a file-like object. :param fp: file-like object ...
0e3ac5b64061c7eb87c6eeacce4b9792d1f479b5
<|skeleton|> class Name: """Name structure (Undocumented).""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" <|body_0|> def write(self, fp): """Write the element to a file-like object. :param fp: file-like object""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Name: """Name structure (Undocumented).""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" name = read_unicode_string(fp) classID = read_length_and_key(fp) value = read_unicode_string(fp) return cls(name, classID, valu...
the_stack_v2_python_sparse
psd_tools/psd/descriptor.py
sfneal/psd-tools3
train
30
09c773641dc0820734ced0ab86e7a30b6ddce629
[ "for logger in trainer.loggers:\n if isinstance(logger, AnomalibWandbLogger):\n logger.watch(pl_module, log_graph=True, log='all')\n break", "for logger in trainer.loggers:\n if isinstance(logger, (AnomalibCometLogger, AnomalibTensorBoardLogger)):\n logger.log_graph(pl_module, input_arr...
<|body_start_0|> for logger in trainer.loggers: if isinstance(logger, AnomalibWandbLogger): logger.watch(pl_module, log_graph=True, log='all') break <|end_body_0|> <|body_start_1|> for logger in trainer.loggers: if isinstance(logger, (AnomalibCome...
Log model graph to respective logger.
GraphLogger
[ "CC-BY-SA-4.0", "CC-BY-SA-3.0", "CC-BY-NC-SA-4.0", "Python-2.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphLogger: """Log model graph to respective logger.""" def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None: """Log model graph to respective logger. Args: trainer: Trainer object which contans reference to loggers. pl_module: LightningModule object which ...
stack_v2_sparse_classes_75kplus_train_072338
1,734
permissive
[ { "docstring": "Log model graph to respective logger. Args: trainer: Trainer object which contans reference to loggers. pl_module: LightningModule object which is logged.", "name": "on_train_start", "signature": "def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None" }, { ...
2
stack_v2_sparse_classes_30k_train_010271
Implement the Python class `GraphLogger` described below. Class description: Log model graph to respective logger. Method signatures and docstrings: - def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None: Log model graph to respective logger. Args: trainer: Trainer object which contans refer...
Implement the Python class `GraphLogger` described below. Class description: Log model graph to respective logger. Method signatures and docstrings: - def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None: Log model graph to respective logger. Args: trainer: Trainer object which contans refer...
4abfa93dcfcb98771bc768b334c929ff9a02ce8b
<|skeleton|> class GraphLogger: """Log model graph to respective logger.""" def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None: """Log model graph to respective logger. Args: trainer: Trainer object which contans reference to loggers. pl_module: LightningModule object which ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraphLogger: """Log model graph to respective logger.""" def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None: """Log model graph to respective logger. Args: trainer: Trainer object which contans reference to loggers. pl_module: LightningModule object which is logged."""...
the_stack_v2_python_sparse
src/anomalib/utils/callbacks/graph.py
openvinotoolkit/anomalib
train
2,325
f54c70bccf53b3a61009efc4e4c59dec03e03fc0
[ "super().__init__(**kwds)\nlayout = parent.layout()\nself.channels = []\nself.which_checked = []\nfor i, channel in enumerate(channels):\n self.powers.append(0.0)\n self.which_checked.append(False)\n channel_text = QtWidgets.QLabel(parent)\n channel_text.setText(channel)\n layout.addWidget(channel_te...
<|body_start_0|> super().__init__(**kwds) layout = parent.layout() self.channels = [] self.which_checked = [] for i, channel in enumerate(channels): self.powers.append(0.0) self.which_checked.append(False) channel_text = QtWidgets.QLabel(parent...
Channels class for mathematical progressions (linear, exponential).
MathChannels
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MathChannels: """Channels class for mathematical progressions (linear, exponential).""" def __init__(self, configuration=None, channels=None, parent=None, **kwds): """Called to layout the GUI for math channels. These channels match the channels of the illumination.""" <|body_...
stack_v2_sparse_classes_75kplus_train_072339
25,535
permissive
[ { "docstring": "Called to layout the GUI for math channels. These channels match the channels of the illumination.", "name": "__init__", "signature": "def __init__(self, configuration=None, channels=None, parent=None, **kwds)" }, { "docstring": "This is called by an external program to specify t...
4
stack_v2_sparse_classes_30k_val_000728
Implement the Python class `MathChannels` described below. Class description: Channels class for mathematical progressions (linear, exponential). Method signatures and docstrings: - def __init__(self, configuration=None, channels=None, parent=None, **kwds): Called to layout the GUI for math channels. These channels m...
Implement the Python class `MathChannels` described below. Class description: Channels class for mathematical progressions (linear, exponential). Method signatures and docstrings: - def __init__(self, configuration=None, channels=None, parent=None, **kwds): Called to layout the GUI for math channels. These channels m...
f185df3d23b231a26c46f33b0b91fffa86356dc4
<|skeleton|> class MathChannels: """Channels class for mathematical progressions (linear, exponential).""" def __init__(self, configuration=None, channels=None, parent=None, **kwds): """Called to layout the GUI for math channels. These channels match the channels of the illumination.""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MathChannels: """Channels class for mathematical progressions (linear, exponential).""" def __init__(self, configuration=None, channels=None, parent=None, **kwds): """Called to layout the GUI for math channels. These channels match the channels of the illumination.""" super().__init__(**k...
the_stack_v2_python_sparse
storm_control/hal4000/progressions/progressions.py
ZhuangLab/storm-control
train
54
6565dd37f814dd602ed8b9dbf4480676f157da9f
[ "if rel.to not in self.admin_site._registry:\n for parent in rel.to.mro():\n if parent in self.admin_site._registry and hasattr(self.admin_site._registry[parent], '_child_admin_site'):\n return self.admin_site._registry[parent]._child_admin_site\nreturn self.admin_site", "db = kwargs.get('usi...
<|body_start_0|> if rel.to not in self.admin_site._registry: for parent in rel.to.mro(): if parent in self.admin_site._registry and hasattr(self.admin_site._registry[parent], '_child_admin_site'): return self.admin_site._registry[parent]._child_admin_site ...
Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.
PolymorphicAdminRawIdFix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models...
stack_v2_sparse_classes_75kplus_train_072340
9,643
permissive
[ { "docstring": "Returns the separate AdminSite instance that django-polymorphic maintains for child models. This admin site needs to be passed to the widget so that it passes the check of whether the field is pointing to a model that's registered in the admin. The hackiness of this implementation reflects the h...
3
stack_v2_sparse_classes_30k_train_005593
Implement the Python class `PolymorphicAdminRawIdFix` described below. Class description: Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field. Method signatures and docstrings: - def _get_child_admin_site(self, rel): Returns the separate AdminSite in...
Implement the Python class `PolymorphicAdminRawIdFix` described below. Class description: Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field. Method signatures and docstrings: - def _get_child_admin_site(self, rel): Returns the separate AdminSite in...
c507ea5b1864303732c53ad7c5800571fca5fa94
<|skeleton|> class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models. This admin ...
the_stack_v2_python_sparse
icekit/admin_tools/polymorphic.py
ic-labs/django-icekit
train
53
5dbc889ee969f27b6eb0448fb10647882657fe2f
[ "super().__init__(plugin, 'system database')\nself.plugins_settings_service = PluginSettingsService(project, plugin)\nself.session = project_engine(project)[1]", "session = self.session()\ntry:\n self.plugins_settings_service.reset(store=SettingValueStore.DB, session=session)\nexcept sqlalchemy.exc.Operational...
<|body_start_0|> super().__init__(plugin, 'system database') self.plugins_settings_service = PluginSettingsService(project, plugin) self.session = project_engine(project)[1] <|end_body_0|> <|body_start_1|> session = self.session() try: self.plugins_settings_service.r...
Handle removal of a plugin's settings from the system database `plugin_settings` table.
DbRemoveManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbRemoveManager: """Handle removal of a plugin's settings from the system database `plugin_settings` table.""" def __init__(self, plugin, project): """Construct a DbRemoveManager instance.""" <|body_0|> def remove(self): """Remove the plugin's settings from the s...
stack_v2_sparse_classes_75kplus_train_072341
4,693
permissive
[ { "docstring": "Construct a DbRemoveManager instance.", "name": "__init__", "signature": "def __init__(self, plugin, project)" }, { "docstring": "Remove the plugin's settings from the system database `plugin_settings` table.", "name": "remove", "signature": "def remove(self)" } ]
2
stack_v2_sparse_classes_30k_train_016539
Implement the Python class `DbRemoveManager` described below. Class description: Handle removal of a plugin's settings from the system database `plugin_settings` table. Method signatures and docstrings: - def __init__(self, plugin, project): Construct a DbRemoveManager instance. - def remove(self): Remove the plugin'...
Implement the Python class `DbRemoveManager` described below. Class description: Handle removal of a plugin's settings from the system database `plugin_settings` table. Method signatures and docstrings: - def __init__(self, plugin, project): Construct a DbRemoveManager instance. - def remove(self): Remove the plugin'...
332959c88e2f8d6dbdd7d91b56edadf8723abd2f
<|skeleton|> class DbRemoveManager: """Handle removal of a plugin's settings from the system database `plugin_settings` table.""" def __init__(self, plugin, project): """Construct a DbRemoveManager instance.""" <|body_0|> def remove(self): """Remove the plugin's settings from the s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DbRemoveManager: """Handle removal of a plugin's settings from the system database `plugin_settings` table.""" def __init__(self, plugin, project): """Construct a DbRemoveManager instance.""" super().__init__(plugin, 'system database') self.plugins_settings_service = PluginSetting...
the_stack_v2_python_sparse
src/meltano/core/plugin_location_remove.py
forestlzj/meltano
train
0
ff5b2f99ecc05cc92fd9076a0e778347c379d6ff
[ "if context is None:\n context = {}\nres = super(stock_picking_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)\nif context.get('active_model', '') == 'stock.picking' and len(context['active_ids']) < 2:\n raise osv.except_osv(_('Warni...
<|body_start_0|> if context is None: context = {} res = super(stock_picking_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) if context.get('active_model', '') == 'stock.picking' and len(context['active_ids']...
stock_picking_merge
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking_merge: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context...
stack_v2_sparse_classes_75kplus_train_072342
2,342
no_license
[ { "docstring": "Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view.", "name": "fields_view_get", "signature": "def fields_view_get(self, cr, uid, view_id...
2
stack_v2_sparse_classes_30k_train_025260
Implement the Python class `stock_picking_merge` described below. Class description: Implement the stock_picking_merge class. Method signatures and docstrings: - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): Changes the view dynamically @param self: Th...
Implement the Python class `stock_picking_merge` described below. Class description: Implement the stock_picking_merge class. Method signatures and docstrings: - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): Changes the view dynamically @param self: Th...
af1bcf7b77a3212bc8a8a0e41e6042a134587ed4
<|skeleton|> class stock_picking_merge: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class stock_picking_merge: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard d...
the_stack_v2_python_sparse
dym_stock/wizard/dym_stock_picking_merge.py
Rizalimami/dym
train
0
90be4e4f890b28942af4a8f24311f8e105ab6a03
[ "if not len(times) == len(values):\n raise PaaError('Lengths of times and values did not match')\nself.t = np.array(times)\nself.v = np.array(values)", "v = self.v\nt = self.t\nstart_pos = 0\nend_pos = 0\nwhile start_pos < len(t):\n t_start = t[start_pos]\n end_pos = np.searchsorted(t[start_pos:], t_star...
<|body_start_0|> if not len(times) == len(values): raise PaaError('Lengths of times and values did not match') self.t = np.array(times) self.v = np.array(values) <|end_body_0|> <|body_start_1|> v = self.v t = self.t start_pos = 0 end_pos = 0 w...
Paa
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Paa: def __init__(self, times, values): """Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values""" <|body_0|> def paa(self, interval): """Calcul...
stack_v2_sparse_classes_75kplus_train_072343
1,451
no_license
[ { "docstring": "Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values", "name": "__init__", "signature": "def __init__(self, times, values)" }, { "docstring": "Calculate PAA....
2
stack_v2_sparse_classes_30k_train_027772
Implement the Python class `Paa` described below. Class description: Implement the Paa class. Method signatures and docstrings: - def __init__(self, times, values): Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values...
Implement the Python class `Paa` described below. Class description: Implement the Paa class. Method signatures and docstrings: - def __init__(self, times, values): Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values...
c1a9bcd9e40837ceb267b454b7ebdd541dd7368b
<|skeleton|> class Paa: def __init__(self, times, values): """Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values""" <|body_0|> def paa(self, interval): """Calcul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Paa: def __init__(self, times, values): """Prepare a PAA (Piecewise Aggregate Approximation) object to calculate PAA of a given dataset Args: times (numpy.Array): epoch times in millisecods values (numpy.Array): values""" if not len(times) == len(values): raise PaaError('Lengths of...
the_stack_v2_python_sparse
services/sax/sax/paa.py
t0mmyt/msc-mk2
train
0
b6d477d862bd615f44e6299546155d82a5331d40
[ "with tf.variable_scope('generator'):\n encoder_layers, encoder_layer_channels = self._encoder(images)\n decoder_layers = self._decoder(encoder_layers, encoder_layer_channels)\n output = decoder_layers[-1]\n output = tf.identity(output, name='generated_images')\n return output", "layers = []\nlayer...
<|body_start_0|> with tf.variable_scope('generator'): encoder_layers, encoder_layer_channels = self._encoder(images) decoder_layers = self._decoder(encoder_layers, encoder_layer_channels) output = decoder_layers[-1] output = tf.identity(output, name='generated_ima...
Generator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: def create(self, images): """Generates fake images based off the input images. Uses a "U-net" architecture, an encoder-decoder with skip connections @images: A set of images normalized to [-1, 1], with shape [batch_size, img_size, img_size, input_channels] @returns: A set of g...
stack_v2_sparse_classes_75kplus_train_072344
5,008
no_license
[ { "docstring": "Generates fake images based off the input images. Uses a \"U-net\" architecture, an encoder-decoder with skip connections @images: A set of images normalized to [-1, 1], with shape [batch_size, img_size, img_size, input_channels] @returns: A set of generated images in range [-1, 1], with shape [...
3
stack_v2_sparse_classes_30k_train_021910
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def create(self, images): Generates fake images based off the input images. Uses a "U-net" architecture, an encoder-decoder with skip connections @images: A set of images norma...
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def create(self, images): Generates fake images based off the input images. Uses a "U-net" architecture, an encoder-decoder with skip connections @images: A set of images norma...
0d5c75877eecda2f812afa0576c0b947e3818b73
<|skeleton|> class Generator: def create(self, images): """Generates fake images based off the input images. Uses a "U-net" architecture, an encoder-decoder with skip connections @images: A set of images normalized to [-1, 1], with shape [batch_size, img_size, img_size, input_channels] @returns: A set of g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Generator: def create(self, images): """Generates fake images based off the input images. Uses a "U-net" architecture, an encoder-decoder with skip connections @images: A set of images normalized to [-1, 1], with shape [batch_size, img_size, img_size, input_channels] @returns: A set of generated image...
the_stack_v2_python_sparse
trainer/generator.py
3a1b2c3/Image-to-Image-Translation
train
0
62423d55f14e6d0cc31939ece2fc31bbdceb3748
[ "for preds in data_samples:\n pred_box = preds['pred_bboxes'].squeeze()\n box_gt = torch.Tensor(preds['gt_bboxes']).squeeze()\n result = {'box': pred_box.to('cpu').squeeze(), 'box_target': box_gt.squeeze()}\n self.results.append(result)", "pred_boxes = torch.stack([each['box'] for each in results])\ng...
<|body_start_0|> for preds in data_samples: pred_box = preds['pred_bboxes'].squeeze() box_gt = torch.Tensor(preds['gt_bboxes']).squeeze() result = {'box': pred_box.to('cpu').squeeze(), 'box_target': box_gt.squeeze()} self.results.append(result) <|end_body_0|> <|b...
Visual Grounding evaluator. Calculate the box mIOU and box grounding accuracy for visual grounding model. Args: collect_device (str): Device name used for collecting results from different ranks during distributed training. Must be 'cpu' or 'gpu'. Defaults to 'cpu'. prefix (str, optional): The prefix that will be added...
VisualGroundingMetric
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisualGroundingMetric: """Visual Grounding evaluator. Calculate the box mIOU and box grounding accuracy for visual grounding model. Args: collect_device (str): Device name used for collecting results from different ranks during distributed training. Must be 'cpu' or 'gpu'. Defaults to 'cpu'. pref...
stack_v2_sparse_classes_75kplus_train_072345
2,915
permissive
[ { "docstring": "Process one batch of data samples. The processed results should be stored in ``self.results``, which will be used to computed the metrics when all batches have been processed. Args: data_batch: A batch of data from the dataloader. data_samples (Sequence[dict]): A batch of outputs from the model....
2
stack_v2_sparse_classes_30k_train_022659
Implement the Python class `VisualGroundingMetric` described below. Class description: Visual Grounding evaluator. Calculate the box mIOU and box grounding accuracy for visual grounding model. Args: collect_device (str): Device name used for collecting results from different ranks during distributed training. Must be ...
Implement the Python class `VisualGroundingMetric` described below. Class description: Visual Grounding evaluator. Calculate the box mIOU and box grounding accuracy for visual grounding model. Args: collect_device (str): Device name used for collecting results from different ranks during distributed training. Must be ...
d2ccc44a2c8e5d49bb26187aff42f2abc90aee28
<|skeleton|> class VisualGroundingMetric: """Visual Grounding evaluator. Calculate the box mIOU and box grounding accuracy for visual grounding model. Args: collect_device (str): Device name used for collecting results from different ranks during distributed training. Must be 'cpu' or 'gpu'. Defaults to 'cpu'. pref...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VisualGroundingMetric: """Visual Grounding evaluator. Calculate the box mIOU and box grounding accuracy for visual grounding model. Args: collect_device (str): Device name used for collecting results from different ranks during distributed training. Must be 'cpu' or 'gpu'. Defaults to 'cpu'. prefix (str, opti...
the_stack_v2_python_sparse
mmpretrain/evaluation/metrics/visual_grounding_eval.py
open-mmlab/mmpretrain
train
652
23ab1bd3739ccf116c3415bb57fc5fcafaf2e3b9
[ "self.directory: str = directory\nself.files_summary: Dict[str, Dict[str, int]] = dict()\nself.analyze_files()\nself.pretty_print()", "num_lines: int = 0\nnum_class: int = 0\nnum_def: int = 0\nnum_char: int = 0\nfilename: str = ''\nfile_list = os.listdir(self.directory)\nfor i in range(len(file_list)):\n if fi...
<|body_start_0|> self.directory: str = directory self.files_summary: Dict[str, Dict[str, int]] = dict() self.analyze_files() self.pretty_print() <|end_body_0|> <|body_start_1|> num_lines: int = 0 num_class: int = 0 num_def: int = 0 num_char: int = 0 ...
This function searches that directory for Python files (i.e. files ending with .py). For each .py file in the directory, opens each file and calculates a summary of the file including: the file name the total number of lines in the file the total number of characters in the file the number of Python functions (lines th...
FileAnalyzer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileAnalyzer: """This function searches that directory for Python files (i.e. files ending with .py). For each .py file in the directory, opens each file and calculates a summary of the file including: the file name the total number of lines in the file the total number of characters in the file ...
stack_v2_sparse_classes_75kplus_train_072346
5,661
no_license
[ { "docstring": "Your docstring should go here for the description of the method.", "name": "__init__", "signature": "def __init__(self, directory: str) -> None" }, { "docstring": "A method that populate the summarized data into self.files_summary.", "name": "analyze_files", "signature": ...
3
stack_v2_sparse_classes_30k_test_001050
Implement the Python class `FileAnalyzer` described below. Class description: This function searches that directory for Python files (i.e. files ending with .py). For each .py file in the directory, opens each file and calculates a summary of the file including: the file name the total number of lines in the file the ...
Implement the Python class `FileAnalyzer` described below. Class description: This function searches that directory for Python files (i.e. files ending with .py). For each .py file in the directory, opens each file and calculates a summary of the file including: the file name the total number of lines in the file the ...
7fe7bb8518584cc98f00f16d6b1cd0a288254ee3
<|skeleton|> class FileAnalyzer: """This function searches that directory for Python files (i.e. files ending with .py). For each .py file in the directory, opens each file and calculates a summary of the file including: the file name the total number of lines in the file the total number of characters in the file ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileAnalyzer: """This function searches that directory for Python files (i.e. files ending with .py). For each .py file in the directory, opens each file and calculates a summary of the file including: the file name the total number of lines in the file the total number of characters in the file the number of...
the_stack_v2_python_sparse
HW_08_Rohan_Ratwani/HW08_Rohan_Ratwani.py
RohanRatwani/SSW-810
train
0
9de3c8c1a5859a0f3d83957c2a1150b6ca92b801
[ "test_node = package_dependency.JavaPackage(self.TEST_PKG_1)\nself.assertEqual(test_node.name, self.TEST_PKG_1)\nself.assertEqual(test_node.classes, {})", "test_node = package_dependency.JavaPackage(self.TEST_PKG_1)\nmock_class_node = create_mock_java_class()\ntest_node.add_class(mock_class_node)\nself.assertEqua...
<|body_start_0|> test_node = package_dependency.JavaPackage(self.TEST_PKG_1) self.assertEqual(test_node.name, self.TEST_PKG_1) self.assertEqual(test_node.classes, {}) <|end_body_0|> <|body_start_1|> test_node = package_dependency.JavaPackage(self.TEST_PKG_1) mock_class_node = cr...
Unit tests for dependency_analysis.class_dependency.JavaPackage.
TestJavaPackage
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-2.0-only", "Apache-2.0", "LGPL-2.0-only", "LicenseRef-scancode-unknown", "LGPL-2.1-only", "MIT", "LicenseRef-scancode-unknown-license-reference", "APSL-2.0", "MPL-1.1", "Zlib" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestJavaPackage: """Unit tests for dependency_analysis.class_dependency.JavaPackage.""" def test_initialization(self): """Tests that JavaPackage is initialized correctly.""" <|body_0|> def test_add_class(self): """Tests adding a single class to this package.""" ...
stack_v2_sparse_classes_75kplus_train_072347
8,568
permissive
[ { "docstring": "Tests that JavaPackage is initialized correctly.", "name": "test_initialization", "signature": "def test_initialization(self)" }, { "docstring": "Tests adding a single class to this package.", "name": "test_add_class", "signature": "def test_add_class(self)" }, { ...
6
stack_v2_sparse_classes_30k_train_015765
Implement the Python class `TestJavaPackage` described below. Class description: Unit tests for dependency_analysis.class_dependency.JavaPackage. Method signatures and docstrings: - def test_initialization(self): Tests that JavaPackage is initialized correctly. - def test_add_class(self): Tests adding a single class ...
Implement the Python class `TestJavaPackage` described below. Class description: Unit tests for dependency_analysis.class_dependency.JavaPackage. Method signatures and docstrings: - def test_initialization(self): Tests that JavaPackage is initialized correctly. - def test_add_class(self): Tests adding a single class ...
87244f4ee50062e59667bf8b9ca4d5291b6818d7
<|skeleton|> class TestJavaPackage: """Unit tests for dependency_analysis.class_dependency.JavaPackage.""" def test_initialization(self): """Tests that JavaPackage is initialized correctly.""" <|body_0|> def test_add_class(self): """Tests adding a single class to this package.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestJavaPackage: """Unit tests for dependency_analysis.class_dependency.JavaPackage.""" def test_initialization(self): """Tests that JavaPackage is initialized correctly.""" test_node = package_dependency.JavaPackage(self.TEST_PKG_1) self.assertEqual(test_node.name, self.TEST_PKG_...
the_stack_v2_python_sparse
chromium/tools/android/dependency_analysis/package_dependency_unittest.py
ric2b/Vivaldi-browser
train
166
20824c108905a0d786a0d1cbd44a5e249d31d131
[ "source = Path(source)\nif source.is_dir():\n return ReportFileLoader.load_dir(source)\nreturn ReportFileLoader.load_file(source)", "zstatus, zfs = ReportFileBuilder.build_zipfs(path, StringIO())\nif not zstatus.success():\n error_msg = '; '.join(zstatus.get_errors())\n raise ReportFileLoaderError(\"Erro...
<|body_start_0|> source = Path(source) if source.is_dir(): return ReportFileLoader.load_dir(source) return ReportFileLoader.load_file(source) <|end_body_0|> <|body_start_1|> zstatus, zfs = ReportFileBuilder.build_zipfs(path, StringIO()) if not zstatus.success(): ...
ReportFileLoader
[ "MIT", "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportFileLoader: def load(source: str) -> ReportFile: """Load ReportFile from a source (either directory or a ZPT) :param source: :return: ReportFile""" <|body_0|> def load_dir(path: str) -> ReportFile: """Generate ReportFile from a directory with a valid report tem...
stack_v2_sparse_classes_75kplus_train_072348
2,603
permissive
[ { "docstring": "Load ReportFile from a source (either directory or a ZPT) :param source: :return: ReportFile", "name": "load", "signature": "def load(source: str) -> ReportFile" }, { "docstring": "Generate ReportFile from a directory with a valid report template :param path: template path :retur...
4
stack_v2_sparse_classes_30k_train_019326
Implement the Python class `ReportFileLoader` described below. Class description: Implement the ReportFileLoader class. Method signatures and docstrings: - def load(source: str) -> ReportFile: Load ReportFile from a source (either directory or a ZPT) :param source: :return: ReportFile - def load_dir(path: str) -> Rep...
Implement the Python class `ReportFileLoader` described below. Class description: Implement the ReportFileLoader class. Method signatures and docstrings: - def load(source: str) -> ReportFile: Load ReportFile from a source (either directory or a ZPT) :param source: :return: ReportFile - def load_dir(path: str) -> Rep...
50341161951fd2f9cc3fbb4dcdf2dc1eeae5922a
<|skeleton|> class ReportFileLoader: def load(source: str) -> ReportFile: """Load ReportFile from a source (either directory or a ZPT) :param source: :return: ReportFile""" <|body_0|> def load_dir(path: str) -> ReportFile: """Generate ReportFile from a directory with a valid report tem...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReportFileLoader: def load(source: str) -> ReportFile: """Load ReportFile from a source (either directory or a ZPT) :param source: :return: ReportFile""" source = Path(source) if source.is_dir(): return ReportFileLoader.load_dir(source) return ReportFileLoader.load_...
the_stack_v2_python_sparse
zipreport/report/loader.py
prashanthhulimajjigi-agi/zipreport
train
0
8e83d6dde8ff444074e84aa57439de681acc276c
[ "try:\n user = AppUser.objects.get(username__iexact=username.lower())\n if settings.ALLOW_NATIONAL_ID_LOGIN:\n if not user:\n user = AppUser.objects.get(national_id=username)\n if user and check_password(password, user.password):\n return user\nexcept AppUser.DoesNotExist:\n ret...
<|body_start_0|> try: user = AppUser.objects.get(username__iexact=username.lower()) if settings.ALLOW_NATIONAL_ID_LOGIN: if not user: user = AppUser.objects.get(national_id=username) if user and check_password(password, user.password): ...
CPOVCAuthenticationBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CPOVCAuthenticationBackend: def authenticate(self, username=None, password=None): """Authenticate a user based on workforce_id / national_id.""" <|body_0|> def get_user(self, user_id): """Get a AppUser object from the user_id.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_072349
989
no_license
[ { "docstring": "Authenticate a user based on workforce_id / national_id.", "name": "authenticate", "signature": "def authenticate(self, username=None, password=None)" }, { "docstring": "Get a AppUser object from the user_id.", "name": "get_user", "signature": "def get_user(self, user_id)...
2
null
Implement the Python class `CPOVCAuthenticationBackend` described below. Class description: Implement the CPOVCAuthenticationBackend class. Method signatures and docstrings: - def authenticate(self, username=None, password=None): Authenticate a user based on workforce_id / national_id. - def get_user(self, user_id): ...
Implement the Python class `CPOVCAuthenticationBackend` described below. Class description: Implement the CPOVCAuthenticationBackend class. Method signatures and docstrings: - def authenticate(self, username=None, password=None): Authenticate a user based on workforce_id / national_id. - def get_user(self, user_id): ...
cb392be0402543acf074425fcaf8edf054269012
<|skeleton|> class CPOVCAuthenticationBackend: def authenticate(self, username=None, password=None): """Authenticate a user based on workforce_id / national_id.""" <|body_0|> def get_user(self, user_id): """Get a AppUser object from the user_id.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CPOVCAuthenticationBackend: def authenticate(self, username=None, password=None): """Authenticate a user based on workforce_id / national_id.""" try: user = AppUser.objects.get(username__iexact=username.lower()) if settings.ALLOW_NATIONAL_ID_LOGIN: if no...
the_stack_v2_python_sparse
cpovc_auth/backends.py
uonafya/cpims-2.3beta
train
4
b65e497d8cd37eb720817567cc65f9264a86637f
[ "self.orig_fname = filename\nself.fname = filename\nmode = 'w'\nif append:\n mode = 'a'\nself.filep = open(self.fname, mode)\nself.save_stdout_fd = os.dup(1)\nself.save_stderr_fd = os.dup(2)\nos.dup2(self.filep.fileno(), 1)\nos.dup2(self.filep.fileno(), 2)", "sys.stdout.flush()\nsys.stderr.flush()\nos.dup2(sel...
<|body_start_0|> self.orig_fname = filename self.fname = filename mode = 'w' if append: mode = 'a' self.filep = open(self.fname, mode) self.save_stdout_fd = os.dup(1) self.save_stderr_fd = os.dup(2) os.dup2(self.filep.fileno(), 1) os.du...
A convenience class to redirect the current process's stdout & stderr to a file.
Redirect
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Redirect: """A convenience class to redirect the current process's stdout & stderr to a file.""" def __init__(self, filename, append=False): """If the 'append' value is True, the filename is appended rather than overwritten. Call the close() method to stop the redirection.""" ...
stack_v2_sparse_classes_75kplus_train_072350
24,226
no_license
[ { "docstring": "If the 'append' value is True, the filename is appended rather than overwritten. Call the close() method to stop the redirection.", "name": "__init__", "signature": "def __init__(self, filename, append=False)" }, { "docstring": "Call this to stop the redirection and reset stdout ...
2
null
Implement the Python class `Redirect` described below. Class description: A convenience class to redirect the current process's stdout & stderr to a file. Method signatures and docstrings: - def __init__(self, filename, append=False): If the 'append' value is True, the filename is appended rather than overwritten. Ca...
Implement the Python class `Redirect` described below. Class description: A convenience class to redirect the current process's stdout & stderr to a file. Method signatures and docstrings: - def __init__(self, filename, append=False): If the 'append' value is True, the filename is appended rather than overwritten. Ca...
2d07558737127077f97e9347d84e6ca46885b0bc
<|skeleton|> class Redirect: """A convenience class to redirect the current process's stdout & stderr to a file.""" def __init__(self, filename, append=False): """If the 'append' value is True, the filename is appended rather than overwritten. Call the close() method to stop the redirection.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Redirect: """A convenience class to redirect the current process's stdout & stderr to a file.""" def __init__(self, filename, append=False): """If the 'append' value is True, the filename is appended rather than overwritten. Call the close() method to stop the redirection.""" self.orig_fn...
the_stack_v2_python_sparse
trig/trigger.py
rrdrake/vvtools
train
5
e1e04b0521fbfa40d4fe5c1d49e2575dca0c59e3
[ "goal_as_string = _theorem_to_string(goal)\nif goal_as_string in self.nodes_map:\n node = self.nodes[self.nodes_map[goal_as_string]]\n assert len(node.goal.hypotheses) == len(goal.hypotheses)\n for i, hyp in enumerate(goal.hypotheses):\n assert hyp == node.goal.hypotheses[i]\n assert goal.conclus...
<|body_start_0|> goal_as_string = _theorem_to_string(goal) if goal_as_string in self.nodes_map: node = self.nodes[self.nodes_map[goal_as_string]] assert len(node.goal.hypotheses) == len(goal.hypotheses) for i, hyp in enumerate(goal.hypotheses): assert ...
Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgoal-sharing. It is unclear if this ever happ...
ProofSearchTree
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProofSearchTree: """Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgo...
stack_v2_sparse_classes_75kplus_train_072351
25,964
permissive
[ { "docstring": "Append a new node to the tree.", "name": "add_node", "signature": "def add_node(self, goal: proof_assistant_pb2.Theorem, parent: Optional[SubGoalRef])" }, { "docstring": "Constructor for a proof search tree. Args: proof_assistant_obj: An interface to the proof assistant. goal: Th...
3
stack_v2_sparse_classes_30k_train_004551
Implement the Python class `ProofSearchTree` described below. Class description: Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of th...
Implement the Python class `ProofSearchTree` described below. Class description: Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of th...
c526cc957be0f6067ef9de1ea18f3e8bbc3be0e8
<|skeleton|> class ProofSearchTree: """Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProofSearchTree: """Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgoal-sharing. I...
the_stack_v2_python_sparse
deepmath/deephol/proof_search_tree.py
magualas/deepmath
train
1
11eac46a5163108d34fa502e4f08e3fcf2d6550c
[ "self._sa_id_card = SAIDCard()\nself._sa_id_book = SAIDBook()\nself._sa_id_book_old = SAIDBookOld()\nself._up_card = UPStudentCard()", "if id_type == 'idcard':\n return self._sa_id_card\nelif id_type == 'idbook':\n return self._sa_id_book\nelif id_type == 'idbookold':\n return self._sa_id_book_old\nelif ...
<|body_start_0|> self._sa_id_card = SAIDCard() self._sa_id_book = SAIDBook() self._sa_id_book_old = SAIDBookOld() self._up_card = UPStudentCard() <|end_body_0|> <|body_start_1|> if id_type == 'idcard': return self._sa_id_card elif id_type == 'idbook': ...
A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStudentCard): A University of Pretoria staff/st...
ContextManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextManager: """A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStude...
stack_v2_sparse_classes_75kplus_train_072352
2,120
permissive
[ { "docstring": "Responsible for initialising the ContextManager object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Returns an ID context based on the ID type that is passed in as an arg. :param id_type (str): A string indicating a type of ID. Returns: - (IDContext...
2
stack_v2_sparse_classes_30k_train_051747
Implement the Python class `ContextManager` described below. Class description: A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South Afri...
Implement the Python class `ContextManager` described below. Class description: A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South Afri...
d62917262080f09d7c9e7262f507e2c1482d7c56
<|skeleton|> class ContextManager: """A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStude...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContextManager: """A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStudentCard): A Un...
the_stack_v2_python_sparse
src/main/python/hutts_verification/image_processing/context_manager.py
javaTheHutts/Java-the-Hutts
train
2
734cd3d837f80c655776e364190d926be8d8e22a
[ "sizeBasedDf = validator.convertToSizeBasedDf(df['ValueNew'])\ncounts = sizeBasedDf.groupby(['Report'])['Report'].count()\nprint(counts)\nerrors = []\nfor index, value in counts.items():\n if value < 10:\n errors.append('{0} has less than 10 results'.format(index))\nif fail:\n self.assertEqual([], erro...
<|body_start_0|> sizeBasedDf = validator.convertToSizeBasedDf(df['ValueNew']) counts = sizeBasedDf.groupby(['Report'])['Report'].count() print(counts) errors = [] for index, value in counts.items(): if value < 10: errors.append('{0} has less than 10 re...
TestHighLevelScenarios
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHighLevelScenarios: def test_check_report_counts(self, fail=True): """Takes an input list (df) then will convert all the reports into the parsed result. It will then output a count of all the different repor types found. If the number of report is under 10, it's assumed that the pars...
stack_v2_sparse_classes_75kplus_train_072353
12,496
no_license
[ { "docstring": "Takes an input list (df) then will convert all the reports into the parsed result. It will then output a count of all the different repor types found. If the number of report is under 10, it's assumed that the parser chopped off a report.", "name": "test_check_report_counts", "signature"...
2
stack_v2_sparse_classes_30k_train_010348
Implement the Python class `TestHighLevelScenarios` described below. Class description: Implement the TestHighLevelScenarios class. Method signatures and docstrings: - def test_check_report_counts(self, fail=True): Takes an input list (df) then will convert all the reports into the parsed result. It will then output ...
Implement the Python class `TestHighLevelScenarios` described below. Class description: Implement the TestHighLevelScenarios class. Method signatures and docstrings: - def test_check_report_counts(self, fail=True): Takes an input list (df) then will convert all the reports into the parsed result. It will then output ...
f55a430b4fea4785b26f78f5526d1665d62c0187
<|skeleton|> class TestHighLevelScenarios: def test_check_report_counts(self, fail=True): """Takes an input list (df) then will convert all the reports into the parsed result. It will then output a count of all the different repor types found. If the number of report is under 10, it's assumed that the pars...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestHighLevelScenarios: def test_check_report_counts(self, fail=True): """Takes an input list (df) then will convert all the reports into the parsed result. It will then output a count of all the different repor types found. If the number of report is under 10, it's assumed that the parser chopped off...
the_stack_v2_python_sparse
test_report_extract.py
Kar98/MicrobiologyTemp
train
0
859a94d0ef963453910eef49e1908e40c8e9f7d5
[ "profile = get_object_or_404(UserProfile, user=request.user)\ntv_show = get_object_or_404(TVShow, tv_show_id=tv_show_id)\nserializer = TVShowDetailsSerializer(tv_show, context={'profile': profile, 'request': request})\nreturn Response(serializer.data, status=status.HTTP_200_OK)", "tv_show = get_object_or_404(TVSh...
<|body_start_0|> profile = get_object_or_404(UserProfile, user=request.user) tv_show = get_object_or_404(TVShow, tv_show_id=tv_show_id) serializer = TVShowDetailsSerializer(tv_show, context={'profile': profile, 'request': request}) return Response(serializer.data, status=status.HTTP_200_...
A view for TV Show Details.
TVShowDetailsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TVShowDetailsView: """A view for TV Show Details.""" def get(request, tv_show_id): """Get TV Show Details.""" <|body_0|> def put(request, tv_show_id): """Update TV Show Details""" <|body_1|> <|end_skeleton|> <|body_start_0|> profile = get_object...
stack_v2_sparse_classes_75kplus_train_072354
18,490
no_license
[ { "docstring": "Get TV Show Details.", "name": "get", "signature": "def get(request, tv_show_id)" }, { "docstring": "Update TV Show Details", "name": "put", "signature": "def put(request, tv_show_id)" } ]
2
stack_v2_sparse_classes_30k_train_039171
Implement the Python class `TVShowDetailsView` described below. Class description: A view for TV Show Details. Method signatures and docstrings: - def get(request, tv_show_id): Get TV Show Details. - def put(request, tv_show_id): Update TV Show Details
Implement the Python class `TVShowDetailsView` described below. Class description: A view for TV Show Details. Method signatures and docstrings: - def get(request, tv_show_id): Get TV Show Details. - def put(request, tv_show_id): Update TV Show Details <|skeleton|> class TVShowDetailsView: """A view for TV Show ...
328ef409911b2a80ce3de926386c93511c6d1793
<|skeleton|> class TVShowDetailsView: """A view for TV Show Details.""" def get(request, tv_show_id): """Get TV Show Details.""" <|body_0|> def put(request, tv_show_id): """Update TV Show Details""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TVShowDetailsView: """A view for TV Show Details.""" def get(request, tv_show_id): """Get TV Show Details.""" profile = get_object_or_404(UserProfile, user=request.user) tv_show = get_object_or_404(TVShow, tv_show_id=tv_show_id) serializer = TVShowDetailsSerializer(tv_show...
the_stack_v2_python_sparse
backend/api/views.py
CirXe0N/Wekker
train
0
d0002796ecd2f66bcbc062445a12bc7099d327b4
[ "try:\n structure = self._CRON_MESSAGE.parseString(body)\nexcept pyparsing.ParseException as exception:\n logger.debug('Unable to parse cron message body with error: {0!s}'.format(exception))\n return None\nkeys = list(structure.keys())\nif len(keys) != 1:\n return None\nkey = keys[0]\nstructure = struc...
<|body_start_0|> try: structure = self._CRON_MESSAGE.parseString(body) except pyparsing.ParseException as exception: logger.debug('Unable to parse cron message body with error: {0!s}'.format(exception)) return None keys = list(structure.keys()) if len(...
Shared functionality for syslog log file text parser plugins.
BaseSyslogTextPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSyslogTextPlugin: """Shared functionality for syslog log file text parser plugins.""" def _ParseCronMessageBody(self, body): """Parses a cron syslog message body. Args: body (str): syslog message body. Returns: SyslogCronTaskRunEventData: event data or None if not available.""" ...
stack_v2_sparse_classes_75kplus_train_072355
25,619
permissive
[ { "docstring": "Parses a cron syslog message body. Args: body (str): syslog message body. Returns: SyslogCronTaskRunEventData: event data or None if not available.", "name": "_ParseCronMessageBody", "signature": "def _ParseCronMessageBody(self, body)" }, { "docstring": "Parses a sshd syslog mess...
2
null
Implement the Python class `BaseSyslogTextPlugin` described below. Class description: Shared functionality for syslog log file text parser plugins. Method signatures and docstrings: - def _ParseCronMessageBody(self, body): Parses a cron syslog message body. Args: body (str): syslog message body. Returns: SyslogCronTa...
Implement the Python class `BaseSyslogTextPlugin` described below. Class description: Shared functionality for syslog log file text parser plugins. Method signatures and docstrings: - def _ParseCronMessageBody(self, body): Parses a cron syslog message body. Args: body (str): syslog message body. Returns: SyslogCronTa...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class BaseSyslogTextPlugin: """Shared functionality for syslog log file text parser plugins.""" def _ParseCronMessageBody(self, body): """Parses a cron syslog message body. Args: body (str): syslog message body. Returns: SyslogCronTaskRunEventData: event data or None if not available.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseSyslogTextPlugin: """Shared functionality for syslog log file text parser plugins.""" def _ParseCronMessageBody(self, body): """Parses a cron syslog message body. Args: body (str): syslog message body. Returns: SyslogCronTaskRunEventData: event data or None if not available.""" try: ...
the_stack_v2_python_sparse
plaso/parsers/text_plugins/syslog.py
log2timeline/plaso
train
1,506
e8dbd5ce3250768fd702521ca2b7f66661924ed9
[ "super(Item, self).__init__()\nself.key = key\nself.value = value", "if not kwargs:\n return ItemSequence([self])\nelse:\n return ItemOptionDict({self: kwargs})" ]
<|body_start_0|> super(Item, self).__init__() self.key = key self.value = value <|end_body_0|> <|body_start_1|> if not kwargs: return ItemSequence([self]) else: return ItemOptionDict({self: kwargs}) <|end_body_1|>
Item
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Item: def __init__(self, key=None, value=None): """Construct a new `Item` object. :param string key: The key to initialize this item with :param object value: The value to initialize this item with The `Item` class is a sublcass of a :class:`~couchbase.result.ValueResult`. Its members ar...
stack_v2_sparse_classes_75kplus_train_072356
6,230
permissive
[ { "docstring": "Construct a new `Item` object. :param string key: The key to initialize this item with :param object value: The value to initialize this item with The `Item` class is a sublcass of a :class:`~couchbase.result.ValueResult`. Its members are all writeable and accessible from this object. .. warning...
2
stack_v2_sparse_classes_30k_train_030886
Implement the Python class `Item` described below. Class description: Implement the Item class. Method signatures and docstrings: - def __init__(self, key=None, value=None): Construct a new `Item` object. :param string key: The key to initialize this item with :param object value: The value to initialize this item wi...
Implement the Python class `Item` described below. Class description: Implement the Item class. Method signatures and docstrings: - def __init__(self, key=None, value=None): Construct a new `Item` object. :param string key: The key to initialize this item with :param object value: The value to initialize this item wi...
1aa78f1559fe2407d664b7d5fd1f885359750147
<|skeleton|> class Item: def __init__(self, key=None, value=None): """Construct a new `Item` object. :param string key: The key to initialize this item with :param object value: The value to initialize this item with The `Item` class is a sublcass of a :class:`~couchbase.result.ValueResult`. Its members ar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Item: def __init__(self, key=None, value=None): """Construct a new `Item` object. :param string key: The key to initialize this item with :param object value: The value to initialize this item with The `Item` class is a sublcass of a :class:`~couchbase.result.ValueResult`. Its members are all writeabl...
the_stack_v2_python_sparse
couchbase/items.py
what-studio/couchbase-python-client
train
1
6c944724d3e8c32c23cfa3223ac5298c2b606a61
[ "logger.debug('warming target_roots for: %r', target_roots)\nsubjects = [Specs(tuple(target_roots.specs))]\nrequest = self.scheduler.execution_request([TransitiveHydratedTargets], subjects)\nresult = self.scheduler.execute(request)\nif result.error:\n raise result.error", "logger.debug('target_roots are: %r', ...
<|body_start_0|> logger.debug('warming target_roots for: %r', target_roots) subjects = [Specs(tuple(target_roots.specs))] request = self.scheduler.execution_request([TransitiveHydratedTargets], subjects) result = self.scheduler.execute(request) if result.error: raise ...
A container for the components necessary to construct a legacy BuildGraph facade.
LegacyGraphHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LegacyGraphHelper: """A container for the components necessary to construct a legacy BuildGraph facade.""" def warm_product_graph(self, target_roots): """Warm the scheduler's `ProductGraph` with `TransitiveHydratedTargets` products. :param TargetRoots target_roots: The targets root o...
stack_v2_sparse_classes_75kplus_train_072357
8,626
permissive
[ { "docstring": "Warm the scheduler's `ProductGraph` with `TransitiveHydratedTargets` products. :param TargetRoots target_roots: The targets root of the request.", "name": "warm_product_graph", "signature": "def warm_product_graph(self, target_roots)" }, { "docstring": "Construct and return a `Bu...
2
null
Implement the Python class `LegacyGraphHelper` described below. Class description: A container for the components necessary to construct a legacy BuildGraph facade. Method signatures and docstrings: - def warm_product_graph(self, target_roots): Warm the scheduler's `ProductGraph` with `TransitiveHydratedTargets` prod...
Implement the Python class `LegacyGraphHelper` described below. Class description: A container for the components necessary to construct a legacy BuildGraph facade. Method signatures and docstrings: - def warm_product_graph(self, target_roots): Warm the scheduler's `ProductGraph` with `TransitiveHydratedTargets` prod...
f0627cfa6ab05fc9a10686a499d1fb1d6ebdb68b
<|skeleton|> class LegacyGraphHelper: """A container for the components necessary to construct a legacy BuildGraph facade.""" def warm_product_graph(self, target_roots): """Warm the scheduler's `ProductGraph` with `TransitiveHydratedTargets` products. :param TargetRoots target_roots: The targets root o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LegacyGraphHelper: """A container for the components necessary to construct a legacy BuildGraph facade.""" def warm_product_graph(self, target_roots): """Warm the scheduler's `ProductGraph` with `TransitiveHydratedTargets` products. :param TargetRoots target_roots: The targets root of the request...
the_stack_v2_python_sparse
src/python/pants/bin/engine_initializer.py
foursquare/pants
train
1
8596aaf7999fe93958bbec105e312ddaf31cf4f6
[ "prem_1, prem_2 = task\nquant1 = prem_1[0].replace('All', 'A').replace('Some not', 'O').replace('Some', 'I').replace('No', 'E')\nquant2 = prem_2[0].replace('All', 'A').replace('Some not', 'O').replace('Some', 'I').replace('No', 'E')\nfigure = 1\nif prem_1[1] == prem_2[1]:\n figure = 4\nelif prem_1[2] == prem_2[1...
<|body_start_0|> prem_1, prem_2 = task quant1 = prem_1[0].replace('All', 'A').replace('Some not', 'O').replace('Some', 'I').replace('No', 'E') quant2 = prem_2[0].replace('All', 'A').replace('Some not', 'O').replace('Some', 'I').replace('No', 'E') figure = 1 if prem_1[1] == prem_2...
Syllogistic encoder. Provides functions for abbreviating syllogistic tasks.
SyllogisticTaskEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyllogisticTaskEncoder: """Syllogistic encoder. Provides functions for abbreviating syllogistic tasks.""" def encode_task(task): """Encodes a task to its syllogistic encoding. Parameters ---------- task : list(list(str)) List representation of the syllogism (e.g., [['All', 'A', 'B'],...
stack_v2_sparse_classes_75kplus_train_072358
2,457
permissive
[ { "docstring": "Encodes a task to its syllogistic encoding. Parameters ---------- task : list(list(str)) List representation of the syllogism (e.g., [['All', 'A', 'B'], ['Some', 'B', 'C']]). Returns ------- str Syllogistic task encoding (e.g., 'AI1'). Raises ------ ValueError If figure of syllogism cannot be de...
2
null
Implement the Python class `SyllogisticTaskEncoder` described below. Class description: Syllogistic encoder. Provides functions for abbreviating syllogistic tasks. Method signatures and docstrings: - def encode_task(task): Encodes a task to its syllogistic encoding. Parameters ---------- task : list(list(str)) List r...
Implement the Python class `SyllogisticTaskEncoder` described below. Class description: Syllogistic encoder. Provides functions for abbreviating syllogistic tasks. Method signatures and docstrings: - def encode_task(task): Encodes a task to its syllogistic encoding. Parameters ---------- task : list(list(str)) List r...
432753acff6072c158047000111a66f822aa51f3
<|skeleton|> class SyllogisticTaskEncoder: """Syllogistic encoder. Provides functions for abbreviating syllogistic tasks.""" def encode_task(task): """Encodes a task to its syllogistic encoding. Parameters ---------- task : list(list(str)) List representation of the syllogism (e.g., [['All', 'A', 'B'],...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SyllogisticTaskEncoder: """Syllogistic encoder. Provides functions for abbreviating syllogistic tasks.""" def encode_task(task): """Encodes a task to its syllogistic encoding. Parameters ---------- task : list(list(str)) List representation of the syllogism (e.g., [['All', 'A', 'B'], ['Some', 'B'...
the_stack_v2_python_sparse
ccobra/syllogistic/task_encoder_syl.py
CognitiveComputationLab/ccobra
train
11
a1720898ccca12b23b30a4148f82f0940245e57a
[ "s_new = [char for char in s.lower() if char.isalnum()]\nprint(s_new)\nres = s_new == s_new[::-1]\nprint(res)\nreturn res", "s_new = list(filter(str.isalnum, s.lower()))\nprint(s_new)\nres = s_new == s_new[::-1]\nprint(res)\nreturn res" ]
<|body_start_0|> s_new = [char for char in s.lower() if char.isalnum()] print(s_new) res = s_new == s_new[::-1] print(res) return res <|end_body_0|> <|body_start_1|> s_new = list(filter(str.isalnum, s.lower())) print(s_new) res = s_new == s_new[::-1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s:str :rtype: bool""" <|body_0|> def isPalindrome_2(self, s): """:type s:str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> s_new = [char for char in s.lower() if char.isalnum()] pr...
stack_v2_sparse_classes_75kplus_train_072359
1,208
no_license
[ { "docstring": ":type s:str :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, s)" }, { "docstring": ":type s:str :rtype: bool", "name": "isPalindrome_2", "signature": "def isPalindrome_2(self, s)" } ]
2
stack_v2_sparse_classes_30k_val_000106
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s:str :rtype: bool - def isPalindrome_2(self, s): :type s:str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s:str :rtype: bool - def isPalindrome_2(self, s): :type s:str :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, s): ...
4f2802d4773eddd2a2e06e61c51463056886b730
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s:str :rtype: bool""" <|body_0|> def isPalindrome_2(self, s): """:type s:str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPalindrome(self, s): """:type s:str :rtype: bool""" s_new = [char for char in s.lower() if char.isalnum()] print(s_new) res = s_new == s_new[::-1] print(res) return res def isPalindrome_2(self, s): """:type s:str :rtype: bool""" ...
the_stack_v2_python_sparse
leetcode/16_isPalindrome.py
Yara7L/python_algorithm
train
0
31a941af911a631cd9ed2f6c8f784070b9da018b
[ "if not id:\n id = ''\nself.logger = logging.getLogger('app')\nself.created = datetime.now()\ntry:\n firebase = pyrebase.initialize_app(config.ENV.FIREBASE_CONFIG)\n self.auth = firebase.auth()\n self.user = self.auth.sign_in_with_email_and_password(config.ENV.FIREBASE_AUTH.get('login'), config.ENV.FIRE...
<|body_start_0|> if not id: id = '' self.logger = logging.getLogger('app') self.created = datetime.now() try: firebase = pyrebase.initialize_app(config.ENV.FIREBASE_CONFIG) self.auth = firebase.auth() self.user = self.auth.sign_in_with_emai...
A firebase connection to be cached in the pool to be reused
FirebaseConnection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FirebaseConnection: """A firebase connection to be cached in the pool to be reused""" def __init__(self, id=None): """param id: optional connection id, useful to identify a connection in a pool for instance. Can be set arbitrarely""" <|body_0|> def token(self): "...
stack_v2_sparse_classes_75kplus_train_072360
4,877
no_license
[ { "docstring": "param id: optional connection id, useful to identify a connection in a pool for instance. Can be set arbitrarely", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "Firebase tokens make an open connection become obsolete thus we need to refresh it ...
2
null
Implement the Python class `FirebaseConnection` described below. Class description: A firebase connection to be cached in the pool to be reused Method signatures and docstrings: - def __init__(self, id=None): param id: optional connection id, useful to identify a connection in a pool for instance. Can be set arbitrar...
Implement the Python class `FirebaseConnection` described below. Class description: A firebase connection to be cached in the pool to be reused Method signatures and docstrings: - def __init__(self, id=None): param id: optional connection id, useful to identify a connection in a pool for instance. Can be set arbitrar...
5b591b3b86725cb1a64d67ce356d852683626fd8
<|skeleton|> class FirebaseConnection: """A firebase connection to be cached in the pool to be reused""" def __init__(self, id=None): """param id: optional connection id, useful to identify a connection in a pool for instance. Can be set arbitrarely""" <|body_0|> def token(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FirebaseConnection: """A firebase connection to be cached in the pool to be reused""" def __init__(self, id=None): """param id: optional connection id, useful to identify a connection in a pool for instance. Can be set arbitrarely""" if not id: id = '' self.logger = lo...
the_stack_v2_python_sparse
web/services/cache.py
gustelle/rebot
train
0
0585300ad5394565d03bdcffc6a41484d181e432
[ "if type(self).batch_insert == BaseSDS.batch_insert:\n raise NotImplementedError('insert or batch_insert need to be overridden')\nself.batch_insert(document[None], [index], *args, **kwargs)\nreturn self", "if type(self).insert == BaseSDS.insert:\n raise NotImplementedError('insert or batch_insert need to be...
<|body_start_0|> if type(self).batch_insert == BaseSDS.batch_insert: raise NotImplementedError('insert or batch_insert need to be overridden') self.batch_insert(document[None], [index], *args, **kwargs) return self <|end_body_0|> <|body_start_1|> if type(self).insert == Base...
Base Search Data Structure, need to be instantiate. Maintains an index for documents to be retrieved with query. When queried the appropriate index(es) will be returned (not the document(s))
BaseSDS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSDS: """Base Search Data Structure, need to be instantiate. Maintains an index for documents to be retrieved with query. When queried the appropriate index(es) will be returned (not the document(s))""" def insert(self, document, index, *args, **kwargs): """Insert a single documen...
stack_v2_sparse_classes_75kplus_train_072361
6,136
permissive
[ { "docstring": "Insert a single document in the data structure by saving the index. The document is not saved for scalability. This is the default implementation that uses batch_insert. See batch_insert documentation. Parameters ---------- document : numpy.ndarray or torch.Tensor The document to by inserted (wi...
6
stack_v2_sparse_classes_30k_train_050738
Implement the Python class `BaseSDS` described below. Class description: Base Search Data Structure, need to be instantiate. Maintains an index for documents to be retrieved with query. When queried the appropriate index(es) will be returned (not the document(s)) Method signatures and docstrings: - def insert(self, d...
Implement the Python class `BaseSDS` described below. Class description: Base Search Data Structure, need to be instantiate. Maintains an index for documents to be retrieved with query. When queried the appropriate index(es) will be returned (not the document(s)) Method signatures and docstrings: - def insert(self, d...
3d9dbad51e1bfc0bbb1a60d0aa03c99340f6930c
<|skeleton|> class BaseSDS: """Base Search Data Structure, need to be instantiate. Maintains an index for documents to be retrieved with query. When queried the appropriate index(es) will be returned (not the document(s))""" def insert(self, document, index, *args, **kwargs): """Insert a single documen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseSDS: """Base Search Data Structure, need to be instantiate. Maintains an index for documents to be retrieved with query. When queried the appropriate index(es) will be returned (not the document(s))""" def insert(self, document, index, *args, **kwargs): """Insert a single document in the data...
the_stack_v2_python_sparse
radbm/search/base.py
duchesneaumathieu/radbm
train
0
0614b9daee019bb698a7bc855dfb6bb4d67e71c0
[ "super(CPUTimeProfiler, self).__init__()\nself._identifier = identifier\nself._profile_measurements = {}\nself._sample_file = u'{0:s}-{1!s}.csv'.format(self._FILENAME_PREFIX, identifier)", "if profile_name not in self._profile_measurements:\n return\nself._profile_measurements[profile_name].SampleStop()", "i...
<|body_start_0|> super(CPUTimeProfiler, self).__init__() self._identifier = identifier self._profile_measurements = {} self._sample_file = u'{0:s}-{1!s}.csv'.format(self._FILENAME_PREFIX, identifier) <|end_body_0|> <|body_start_1|> if profile_name not in self._profile_measuremen...
The CPU time profiler.
CPUTimeProfiler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CPUTimeProfiler: """The CPU time profiler.""" def __init__(self, identifier): """Initializes the CPU time profiler object. Args: identifier: the profile identifier.""" <|body_0|> def StopTiming(self, profile_name): """Stops timing CPU time. Args: profile_name: th...
stack_v2_sparse_classes_75kplus_train_072362
4,630
permissive
[ { "docstring": "Initializes the CPU time profiler object. Args: identifier: the profile identifier.", "name": "__init__", "signature": "def __init__(self, identifier)" }, { "docstring": "Stops timing CPU time. Args: profile_name: the name of the profile to sample.", "name": "StopTiming", ...
4
stack_v2_sparse_classes_30k_train_007993
Implement the Python class `CPUTimeProfiler` described below. Class description: The CPU time profiler. Method signatures and docstrings: - def __init__(self, identifier): Initializes the CPU time profiler object. Args: identifier: the profile identifier. - def StopTiming(self, profile_name): Stops timing CPU time. A...
Implement the Python class `CPUTimeProfiler` described below. Class description: The CPU time profiler. Method signatures and docstrings: - def __init__(self, identifier): Initializes the CPU time profiler object. Args: identifier: the profile identifier. - def StopTiming(self, profile_name): Stops timing CPU time. A...
923797fc00664fa9e3277781b0334d6eed5664fd
<|skeleton|> class CPUTimeProfiler: """The CPU time profiler.""" def __init__(self, identifier): """Initializes the CPU time profiler object. Args: identifier: the profile identifier.""" <|body_0|> def StopTiming(self, profile_name): """Stops timing CPU time. Args: profile_name: th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CPUTimeProfiler: """The CPU time profiler.""" def __init__(self, identifier): """Initializes the CPU time profiler object. Args: identifier: the profile identifier.""" super(CPUTimeProfiler, self).__init__() self._identifier = identifier self._profile_measurements = {} ...
the_stack_v2_python_sparse
plaso/engine/profiler.py
CNR-ITTIG/plasodfaxp
train
1
471d2f791f86f996fa061967d95ecb388b1d6f8f
[ "self.algorithm = algorithm\nself._input_length = input_length\nself.hash_algorithm = hash_algorithm", "if self._input_length is None:\n return encryption.data_key_length\nreturn self._input_length" ]
<|body_start_0|> self.algorithm = algorithm self._input_length = input_length self.hash_algorithm = hash_algorithm <|end_body_0|> <|body_start_1|> if self._input_length is None: return encryption.data_key_length return self._input_length <|end_body_1|>
Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF function :param hash_algorithm: Has...
KDFSuite
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KDFSuite: """Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF...
stack_v2_sparse_classes_75kplus_train_072363
14,661
permissive
[ { "docstring": "Prepare a new KDFSuite.", "name": "__init__", "signature": "def __init__(self, algorithm, input_length, hash_algorithm)" }, { "docstring": "Determine the correct KDF input value length for this KDFSuite when used with a specific EncryptionSuite. :param encryption: EncryptionSuite...
2
stack_v2_sparse_classes_30k_train_029820
Implement the Python class `KDFSuite` described below. Class description: Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number ...
Implement the Python class `KDFSuite` described below. Class description: Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number ...
3ba8019681ed95c41bb9448f0c3897d1aecc7559
<|skeleton|> class KDFSuite: """Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KDFSuite: """Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF function :pa...
the_stack_v2_python_sparse
src/aws_encryption_sdk/identifiers.py
aws/aws-encryption-sdk-python
train
137
14f533e0b4fb8a485494d3bc2a97dce7bc01e2c4
[ "threading.Thread.__init__(self)\nself.threadName = name\nself.people = people", "print('开始线程: ' + self.threadName)\nchiHuoGuo(self.people)\nprint('结束线程: ' + self.name)" ]
<|body_start_0|> threading.Thread.__init__(self) self.threadName = name self.people = people <|end_body_0|> <|body_start_1|> print('开始线程: ' + self.threadName) chiHuoGuo(self.people) print('结束线程: ' + self.name) <|end_body_1|>
myThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class myThread: def __init__(self, people, name): """重写threading.Thread初始化内容""" <|body_0|> def run(self): """重写run方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> threading.Thread.__init__(self) self.threadName = name self.people = peopl...
stack_v2_sparse_classes_75kplus_train_072364
31,701
no_license
[ { "docstring": "重写threading.Thread初始化内容", "name": "__init__", "signature": "def __init__(self, people, name)" }, { "docstring": "重写run方法", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_054262
Implement the Python class `myThread` described below. Class description: Implement the myThread class. Method signatures and docstrings: - def __init__(self, people, name): 重写threading.Thread初始化内容 - def run(self): 重写run方法
Implement the Python class `myThread` described below. Class description: Implement the myThread class. Method signatures and docstrings: - def __init__(self, people, name): 重写threading.Thread初始化内容 - def run(self): 重写run方法 <|skeleton|> class myThread: def __init__(self, people, name): """重写threading.Thr...
5e08f6a0e4033778f107cc89b422ab107082e4ab
<|skeleton|> class myThread: def __init__(self, people, name): """重写threading.Thread初始化内容""" <|body_0|> def run(self): """重写run方法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class myThread: def __init__(self, people, name): """重写threading.Thread初始化内容""" threading.Thread.__init__(self) self.threadName = name self.people = people def run(self): """重写run方法""" print('开始线程: ' + self.threadName) chiHuoGuo(self.people) print...
the_stack_v2_python_sparse
knowledge_point/多线程/多线程-基础入门(threading).py
TigerZhao007/GitHub
train
0
424990829676769e5f4aa2a6cb7dd3a330b55fd4
[ "self.initialize()\nself.setNumChildren(2)\nif not isinstance(expr, Expression):\n raise InvalidTypeForSwitchExpressionError(type(expr))\nself.setChild(0, expr)\nif not isinstance(body, CompoundStatement):\n raise InvalidTypeForSwitchBodyError(type(body))\nself.setChild(1, body)", "retval = 'switch (' + rep...
<|body_start_0|> self.initialize() self.setNumChildren(2) if not isinstance(expr, Expression): raise InvalidTypeForSwitchExpressionError(type(expr)) self.setChild(0, expr) if not isinstance(body, CompoundStatement): raise InvalidTypeForSwitchBodyError(type...
Represents an Ansi C switch statement, for ex switch(expr) {...} Is represented independent of case statements. We need to have the 'case:', 'default:' cases for the control flow graph to look meaningful. It is upto the User or the parser to get this set up correctly for the input C code
SwitchStatement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwitchStatement: """Represents an Ansi C switch statement, for ex switch(expr) {...} Is represented independent of case statements. We need to have the 'case:', 'default:' cases for the control flow graph to look meaningful. It is upto the User or the parser to get this set up correctly for the i...
stack_v2_sparse_classes_75kplus_train_072365
1,939
permissive
[ { "docstring": "Initializes an Expression type for the switch condition and a CompoundStatement body type for the body of the switch type. Both values are added to the children of the underlying Traversable type", "name": "__init__", "signature": "def __init__(self, expr, body)" }, { "docstring"...
2
null
Implement the Python class `SwitchStatement` described below. Class description: Represents an Ansi C switch statement, for ex switch(expr) {...} Is represented independent of case statements. We need to have the 'case:', 'default:' cases for the control flow graph to look meaningful. It is upto the User or the parser...
Implement the Python class `SwitchStatement` described below. Class description: Represents an Ansi C switch statement, for ex switch(expr) {...} Is represented independent of case statements. We need to have the 'case:', 'default:' cases for the control flow graph to look meaningful. It is upto the User or the parser...
fe7b4b86f6f652ef791c4d1520e46aa7066defda
<|skeleton|> class SwitchStatement: """Represents an Ansi C switch statement, for ex switch(expr) {...} Is represented independent of case statements. We need to have the 'case:', 'default:' cases for the control flow graph to look meaningful. It is upto the User or the parser to get this set up correctly for the i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SwitchStatement: """Represents an Ansi C switch statement, for ex switch(expr) {...} Is represented independent of case statements. We need to have the 'case:', 'default:' cases for the control flow graph to look meaningful. It is upto the User or the parser to get this set up correctly for the input C code""...
the_stack_v2_python_sparse
c_ast/hir/SwitchStatement.py
qram9/c_ast
train
0
4d79518c6c3ac7168d7359e3997eb58d11992aa6
[ "data = copy.deepcopy(ipifdata)\ndata.pop('@id', None)\ndata.pop('id', None)\nfor uri in self.uris:\n uri.safe_delete()\n db.flush()\ndata['uris'] = [SourceURI.get(uri=u) or SourceURI(uri=u) for u in data.get('uris', [])]\nif data.get('createdWhen', ''):\n data['createdWhen'] = fix_datetime(data['createdWh...
<|body_start_0|> data = copy.deepcopy(ipifdata) data.pop('@id', None) data.pop('id', None) for uri in self.uris: uri.safe_delete() db.flush() data['uris'] = [SourceURI.get(uri=u) or SourceURI(uri=u) for u in data.get('uris', [])] if data.get('creat...
A Soure ORM entitiy.
Source
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Source: """A Soure ORM entitiy.""" def update_from_ipif(self, ipifdata): """Update Source using `ipifdata`. `ipifdata` is a IPIF conform dict.""" <|body_0|> def deep_delete(self): """Like delete but also removes orphaned SourceURIs.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_072366
23,399
permissive
[ { "docstring": "Update Source using `ipifdata`. `ipifdata` is a IPIF conform dict.", "name": "update_from_ipif", "signature": "def update_from_ipif(self, ipifdata)" }, { "docstring": "Like delete but also removes orphaned SourceURIs.", "name": "deep_delete", "signature": "def deep_delete...
2
stack_v2_sparse_classes_30k_train_045061
Implement the Python class `Source` described below. Class description: A Soure ORM entitiy. Method signatures and docstrings: - def update_from_ipif(self, ipifdata): Update Source using `ipifdata`. `ipifdata` is a IPIF conform dict. - def deep_delete(self): Like delete but also removes orphaned SourceURIs.
Implement the Python class `Source` described below. Class description: A Soure ORM entitiy. Method signatures and docstrings: - def update_from_ipif(self, ipifdata): Update Source using `ipifdata`. `ipifdata` is a IPIF conform dict. - def deep_delete(self): Like delete but also removes orphaned SourceURIs. <|skelet...
7683da0a56daf77450f962caaf58b7cfe3acf408
<|skeleton|> class Source: """A Soure ORM entitiy.""" def update_from_ipif(self, ipifdata): """Update Source using `ipifdata`. `ipifdata` is a IPIF conform dict.""" <|body_0|> def deep_delete(self): """Like delete but also removes orphaned SourceURIs.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Source: """A Soure ORM entitiy.""" def update_from_ipif(self, ipifdata): """Update Source using `ipifdata`. `ipifdata` is a IPIF conform dict.""" data = copy.deepcopy(ipifdata) data.pop('@id', None) data.pop('id', None) for uri in self.uris: uri.safe_de...
the_stack_v2_python_sparse
src/papilotte/connectors/pony/database.py
gvasold/papilotte
train
4
1129a19491f5090f5f1b4b4b7bc2e64d987a2b9c
[ "if not self.request.user.is_superuser:\n return redirect('users:login')\nself.object = form.save(commit=False)\nself.object.author = self.request.user\nself.object.save()\ntag_id_list = self.request.POST.getlist('tags')\nfor tag_id in tag_id_list:\n self.object.tags.add(Tag.objects.get(pk=tag_id))\nself.obje...
<|body_start_0|> if not self.request.user.is_superuser: return redirect('users:login') self.object = form.save(commit=False) self.object.author = self.request.user self.object.save() tag_id_list = self.request.POST.getlist('tags') for tag_id in tag_id_list: ...
PostCreateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostCreateView: def form_valid(self, form): """If the form is valid, redirect to the supplied URL.""" <|body_0|> def form_invalid(self, form): """If the form is invalid, render the invalid form.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not...
stack_v2_sparse_classes_75kplus_train_072367
9,543
no_license
[ { "docstring": "If the form is valid, redirect to the supplied URL.", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "If the form is invalid, render the invalid form.", "name": "form_invalid", "signature": "def form_invalid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_011233
Implement the Python class `PostCreateView` described below. Class description: Implement the PostCreateView class. Method signatures and docstrings: - def form_valid(self, form): If the form is valid, redirect to the supplied URL. - def form_invalid(self, form): If the form is invalid, render the invalid form.
Implement the Python class `PostCreateView` described below. Class description: Implement the PostCreateView class. Method signatures and docstrings: - def form_valid(self, form): If the form is valid, redirect to the supplied URL. - def form_invalid(self, form): If the form is invalid, render the invalid form. <|sk...
1243142d9fd4966119ff83b9d14a33437384d440
<|skeleton|> class PostCreateView: def form_valid(self, form): """If the form is valid, redirect to the supplied URL.""" <|body_0|> def form_invalid(self, form): """If the form is invalid, render the invalid form.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostCreateView: def form_valid(self, form): """If the form is valid, redirect to the supplied URL.""" if not self.request.user.is_superuser: return redirect('users:login') self.object = form.save(commit=False) self.object.author = self.request.user self.obje...
the_stack_v2_python_sparse
blog/views.py
kakitgogogo/myblog
train
1
5b2cb8b94c067325f3a82fe1c38f1c66ace185a9
[ "self.models = model_functions\nself._cached_parameters = {model: None for model in self.models}\nself._cached_probability = {model: None for model in self.models}\nself.parameters = dict()", "probability = 1.0\nfor ii, function in enumerate(self.models):\n function_parameters = self._get_function_parameters(f...
<|body_start_0|> self.models = model_functions self._cached_parameters = {model: None for model in self.models} self._cached_probability = {model: None for model in self.models} self.parameters = dict() <|end_body_0|> <|body_start_1|> probability = 1.0 for ii, function i...
Population model that combines a set of factorizable models. This should take population parameters and return the probability. .. math:: p(\\theta | \\Lambda) = \\prod_{i} p_{i}(\\theta | \\Lambda)
Model
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """Population model that combines a set of factorizable models. This should take population parameters and return the probability. .. math:: p(\\theta | \\Lambda) = \\prod_{i} p_{i}(\\theta | \\Lambda)""" def __init__(self, model_functions=None): """Parameters ========== model...
stack_v2_sparse_classes_75kplus_train_072368
2,875
permissive
[ { "docstring": "Parameters ========== model_functions: list List of callables to compute the probability. If this includes classes, the `__call__` method should return the probability. The requires variables are chosen at run time based on either inspection or querying a :code:`variable_names` attribute.", ...
3
stack_v2_sparse_classes_30k_train_012675
Implement the Python class `Model` described below. Class description: Population model that combines a set of factorizable models. This should take population parameters and return the probability. .. math:: p(\\theta | \\Lambda) = \\prod_{i} p_{i}(\\theta | \\Lambda) Method signatures and docstrings: - def __init__...
Implement the Python class `Model` described below. Class description: Population model that combines a set of factorizable models. This should take population parameters and return the probability. .. math:: p(\\theta | \\Lambda) = \\prod_{i} p_{i}(\\theta | \\Lambda) Method signatures and docstrings: - def __init__...
9c1dda6cc1510692ce4ac75c608de5fae53e971c
<|skeleton|> class Model: """Population model that combines a set of factorizable models. This should take population parameters and return the probability. .. math:: p(\\theta | \\Lambda) = \\prod_{i} p_{i}(\\theta | \\Lambda)""" def __init__(self, model_functions=None): """Parameters ========== model...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Model: """Population model that combines a set of factorizable models. This should take population parameters and return the probability. .. math:: p(\\theta | \\Lambda) = \\prod_{i} p_{i}(\\theta | \\Lambda)""" def __init__(self, model_functions=None): """Parameters ========== model_functions: l...
the_stack_v2_python_sparse
bilby/hyper/model.py
khunsang/bilby
train
0
bfda53fbb253e99a8aa1086af9e69c1c83720e8e
[ "def traverse_longest(row, col, prev_num):\n if not (0 <= row < m and 0 <= col < n):\n return 0\n current_num = matrix[row][col]\n if current_num <= prev_num:\n return 0\n up = traverse_longest(row - 1, col, current_num)\n down = traverse_longest(row + 1, col, current_num)\n left = t...
<|body_start_0|> def traverse_longest(row, col, prev_num): if not (0 <= row < m and 0 <= col < n): return 0 current_num = matrix[row][col] if current_num <= prev_num: return 0 up = traverse_longest(row - 1, col, current_num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" <|body_0|> def longestIncreasingPath(self, matrix: List[List[int]]) -> int: """memoization""" <|body_1|> <|end_skeleton|> <|body_start_0|> def traverse_longest(row,...
stack_v2_sparse_classes_75kplus_train_072369
1,958
no_license
[ { "docstring": "DFS", "name": "longestIncreasingPath", "signature": "def longestIncreasingPath(self, matrix: list[list[int]]) -> int" }, { "docstring": "memoization", "name": "longestIncreasingPath", "signature": "def longestIncreasingPath(self, matrix: List[List[int]]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_019808
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix: list[list[int]]) -> int: DFS - def longestIncreasingPath(self, matrix: List[List[int]]) -> int: memoization
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix: list[list[int]]) -> int: DFS - def longestIncreasingPath(self, matrix: List[List[int]]) -> int: memoization <|skeleton|> class Solution: ...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" <|body_0|> def longestIncreasingPath(self, matrix: List[List[int]]) -> int: """memoization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" def traverse_longest(row, col, prev_num): if not (0 <= row < m and 0 <= col < n): return 0 current_num = matrix[row][col] if current_num <= prev_num: ...
the_stack_v2_python_sparse
Leetcode/329. Longest Increasing Path in a Matrix.py
brlala/Educative-Grokking-Coding-Exercise
train
3
df2a3038d307c16f6c7ea0ef1ccd4e11876e461a
[ "self.face_cascade = cv.CascadeClassifier(cascade_file_path)\nif self.face_cascade.empty():\n print(\"Classifier failed to load '{}' filepath\".format(cascade_file_path))\n raise", "rows, cols = frame.shape[:2]\nself.all_faces = self.face_cascade.detectMultiScale(frame, scaleFactor=1.3, minNeighbors=5)\nif ...
<|body_start_0|> self.face_cascade = cv.CascadeClassifier(cascade_file_path) if self.face_cascade.empty(): print("Classifier failed to load '{}' filepath".format(cascade_file_path)) raise <|end_body_0|> <|body_start_1|> rows, cols = frame.shape[:2] self.all_faces...
Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.
FaceDetector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default...
stack_v2_sparse_classes_75kplus_train_072370
3,297
permissive
[ { "docstring": "Loads the image classifier and raises an exception if the classifier fails to load the xml classifier file. When using a different classifier xml, make sure to take into account relative file paths to avoid raising an exception.", "name": "__init__", "signature": "def __init__(self, casc...
2
stack_v2_sparse_classes_30k_train_008079
Implement the Python class `FaceDetector` described below. Class description: Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces. Method signa...
Implement the Python class `FaceDetector` described below. Class description: Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces. Method signa...
c9cf67c7c502406465d647d013f0d98cad2d4c44
<|skeleton|> class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default_cascade_file...
the_stack_v2_python_sparse
ComputerVisionServer/moedx/facial_detection/face_detector.py
mobiledgex/edge-cloud-sampleapps
train
12
157c7f970e89f84e3c0c56f4802293b1f009727f
[ "self.logger = logging\nself.root_dir = dh.get_root_dir()\nself.log_dir = None\nself.log_file_path = self.set_logger()\nself.set_logger_handler(filename=self.log_file_path)", "calling_test = os.environ.get('PYTEST_CURRENT_TEST')\ntarget = re.findall('\\\\[(.*?)\\\\]', calling_test) or ['']\ntarget = target[0]\nfi...
<|body_start_0|> self.logger = logging self.root_dir = dh.get_root_dir() self.log_dir = None self.log_file_path = self.set_logger() self.set_logger_handler(filename=self.log_file_path) <|end_body_0|> <|body_start_1|> calling_test = os.environ.get('PYTEST_CURRENT_TEST') ...
This is a wrapper around the logging module.
Logger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: """This is a wrapper around the logging module.""" def __init__(self): """This is the constructor for Logging.""" <|body_0|> def set_logger(self, by_time=False): """This sets up the logging directories and file paths. Args: by_time (bool): Whether to keep...
stack_v2_sparse_classes_75kplus_train_072371
2,240
permissive
[ { "docstring": "This is the constructor for Logging.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "This sets up the logging directories and file paths. Args: by_time (bool): Whether to keep all successive runs by time. Returns: log_file_path: The path of the log file...
3
stack_v2_sparse_classes_30k_train_035200
Implement the Python class `Logger` described below. Class description: This is a wrapper around the logging module. Method signatures and docstrings: - def __init__(self): This is the constructor for Logging. - def set_logger(self, by_time=False): This sets up the logging directories and file paths. Args: by_time (b...
Implement the Python class `Logger` described below. Class description: This is a wrapper around the logging module. Method signatures and docstrings: - def __init__(self): This is the constructor for Logging. - def set_logger(self, by_time=False): This sets up the logging directories and file paths. Args: by_time (b...
815f606de1b7f43890a0313dcd0581273acd3952
<|skeleton|> class Logger: """This is a wrapper around the logging module.""" def __init__(self): """This is the constructor for Logging.""" <|body_0|> def set_logger(self, by_time=False): """This sets up the logging directories and file paths. Args: by_time (bool): Whether to keep...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Logger: """This is a wrapper around the logging module.""" def __init__(self): """This is the constructor for Logging.""" self.logger = logging self.root_dir = dh.get_root_dir() self.log_dir = None self.log_file_path = self.set_logger() self.set_logger_hand...
the_stack_v2_python_sparse
uiautomationtools/logging/logger.py
webclinic017/ui-automation-tools-mbt
train
0
062e3840ed3be135188b65eecd5a1ca05de0ac15
[ "self.preset = preset\nself.tags = []\nself.keys = []", "f = open(self.preset)\nxml = f.read()\ntree = etree.parse(StringIO(xml))\nitems = tree.xpath('//ns:item', namespaces=self.namespaces)\nfor item in items:\n self.process_item_and_children(item)\nreturn self.tags", "geometrytypes = None\nif item.get('typ...
<|body_start_0|> self.preset = preset self.tags = [] self.keys = [] <|end_body_0|> <|body_start_1|> f = open(self.preset) xml = f.read() tree = etree.parse(StringIO(xml)) items = tree.xpath('//ns:item', namespaces=self.namespaces) for item in items: ...
Parses uploaded JOSM Presets and creates Tag model instances based on the contents of the preset file. See jobs.models.Tag for the instance fields. Looks for the 'key', 'text', 'combo', 'multiselect' and 'check' child elements of all 'item' elements in the preset. Pulls out the 'key' attribute of these elements.
UnfilteredPresetParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnfilteredPresetParser: """Parses uploaded JOSM Presets and creates Tag model instances based on the contents of the preset file. See jobs.models.Tag for the instance fields. Looks for the 'key', 'text', 'combo', 'multiselect' and 'check' child elements of all 'item' elements in the preset. Pulls...
stack_v2_sparse_classes_75kplus_train_072372
15,693
no_license
[ { "docstring": "Initialize the parser with the preset.", "name": "__init__", "signature": "def __init__(self, preset=None, *args, **kwargs)" }, { "docstring": "Read in the JOSM Preset and processes the 'item' elements.", "name": "parse", "signature": "def parse(self)" }, { "docst...
6
stack_v2_sparse_classes_30k_train_029654
Implement the Python class `UnfilteredPresetParser` described below. Class description: Parses uploaded JOSM Presets and creates Tag model instances based on the contents of the preset file. See jobs.models.Tag for the instance fields. Looks for the 'key', 'text', 'combo', 'multiselect' and 'check' child elements of a...
Implement the Python class `UnfilteredPresetParser` described below. Class description: Parses uploaded JOSM Presets and creates Tag model instances based on the contents of the preset file. See jobs.models.Tag for the instance fields. Looks for the 'key', 'text', 'combo', 'multiselect' and 'check' child elements of a...
f90b2ba55fa82d6c0dc35f0aeb28dc3d35159bf3
<|skeleton|> class UnfilteredPresetParser: """Parses uploaded JOSM Presets and creates Tag model instances based on the contents of the preset file. See jobs.models.Tag for the instance fields. Looks for the 'key', 'text', 'combo', 'multiselect' and 'check' child elements of all 'item' elements in the preset. Pulls...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnfilteredPresetParser: """Parses uploaded JOSM Presets and creates Tag model instances based on the contents of the preset file. See jobs.models.Tag for the instance fields. Looks for the 'key', 'text', 'combo', 'multiselect' and 'check' child elements of all 'item' elements in the preset. Pulls out the 'key...
the_stack_v2_python_sparse
jobs/presets.py
posm/osm-export-tool2
train
2
86a60d68fc0f446ea3d69e05852b07040350b4c0
[ "dic = {}\nfor i in range(n):\n dic[i] = set()\nfor each in relation:\n dic[each[0]].add(each[1])\n\ndef dfs(d, j):\n \"\"\"\n :param d: 深度\n :param j: 当前索引\n :return:\n \"\"\"\n if d == k:\n if n - 1 == j:\n return 1\n else:\n ...
<|body_start_0|> dic = {} for i in range(n): dic[i] = set() for each in relation: dic[each[0]].add(each[1]) def dfs(d, j): """ :param d: 深度 :param j: 当前索引 :return: """ ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numWays(self, n: int, relation: List[List[int]], k: int) -> int: """创建表, dfs 最大的编号为n-1, 经过k轮 :param n: :param relation: :param k: :return:""" <|body_0|> def numWays(self, n: int, relation: List[List[int]], k: int) -> int: """创建表, bfs 最大的编号为n-1, 经过k轮 :pa...
stack_v2_sparse_classes_75kplus_train_072373
4,806
no_license
[ { "docstring": "创建表, dfs 最大的编号为n-1, 经过k轮 :param n: :param relation: :param k: :return:", "name": "numWays", "signature": "def numWays(self, n: int, relation: List[List[int]], k: int) -> int" }, { "docstring": "创建表, bfs 最大的编号为n-1, 经过k轮 :param n: :param relation: :param k: :return:", "name": "...
3
stack_v2_sparse_classes_30k_train_034524
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numWays(self, n: int, relation: List[List[int]], k: int) -> int: 创建表, dfs 最大的编号为n-1, 经过k轮 :param n: :param relation: :param k: :return: - def numWays(self, n: int, relation: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numWays(self, n: int, relation: List[List[int]], k: int) -> int: 创建表, dfs 最大的编号为n-1, 经过k轮 :param n: :param relation: :param k: :return: - def numWays(self, n: int, relation: ...
b1680014ce3f55ba952a1e64241c0cbb783cc436
<|skeleton|> class Solution: def numWays(self, n: int, relation: List[List[int]], k: int) -> int: """创建表, dfs 最大的编号为n-1, 经过k轮 :param n: :param relation: :param k: :return:""" <|body_0|> def numWays(self, n: int, relation: List[List[int]], k: int) -> int: """创建表, bfs 最大的编号为n-1, 经过k轮 :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numWays(self, n: int, relation: List[List[int]], k: int) -> int: """创建表, dfs 最大的编号为n-1, 经过k轮 :param n: :param relation: :param k: :return:""" dic = {} for i in range(n): dic[i] = set() for each in relation: dic[each[0]].add(each[1]) ...
the_stack_v2_python_sparse
LCP_7.py
sun510001/leetcode_jianzhi_offer_2
train
0
81104be1bdf8a80387489743434326b3bf9c1d87
[ "self.plug = plug\nself._attr_unique_id = self.plug.mac\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, self.plug.mac)}, name=name, manufacturer=MANUFACTURER, sw_version=self.plug.firmware)", "try:\n await self.plug.turn_on()\nexcept MyStromConnectionError:\n _LOGGER.error('No route to myStrom pl...
<|body_start_0|> self.plug = plug self._attr_unique_id = self.plug.mac self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, self.plug.mac)}, name=name, manufacturer=MANUFACTURER, sw_version=self.plug.firmware) <|end_body_0|> <|body_start_1|> try: await self.plug.turn_on...
Representation of a myStrom switch/plug.
MyStromSwitch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyStromSwitch: """Representation of a myStrom switch/plug.""" def __init__(self, plug, name): """Initialize the myStrom switch/plug.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn the switch on.""" <|body_1|> async def as...
stack_v2_sparse_classes_75kplus_train_072374
3,599
permissive
[ { "docstring": "Initialize the myStrom switch/plug.", "name": "__init__", "signature": "def __init__(self, plug, name)" }, { "docstring": "Turn the switch on.", "name": "async_turn_on", "signature": "async def async_turn_on(self, **kwargs: Any) -> None" }, { "docstring": "Turn th...
4
null
Implement the Python class `MyStromSwitch` described below. Class description: Representation of a myStrom switch/plug. Method signatures and docstrings: - def __init__(self, plug, name): Initialize the myStrom switch/plug. - async def async_turn_on(self, **kwargs: Any) -> None: Turn the switch on. - async def async_...
Implement the Python class `MyStromSwitch` described below. Class description: Representation of a myStrom switch/plug. Method signatures and docstrings: - def __init__(self, plug, name): Initialize the myStrom switch/plug. - async def async_turn_on(self, **kwargs: Any) -> None: Turn the switch on. - async def async_...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class MyStromSwitch: """Representation of a myStrom switch/plug.""" def __init__(self, plug, name): """Initialize the myStrom switch/plug.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn the switch on.""" <|body_1|> async def as...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyStromSwitch: """Representation of a myStrom switch/plug.""" def __init__(self, plug, name): """Initialize the myStrom switch/plug.""" self.plug = plug self._attr_unique_id = self.plug.mac self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, self.plug.mac)}, name=nam...
the_stack_v2_python_sparse
homeassistant/components/mystrom/switch.py
home-assistant/core
train
35,501
ad7d8c952cdf446c3233ac417eb335338d045066
[ "model_name = config_dict['MODEL']['NETWORK_NAME']\nema_dacay = config_dict['TRICKS']['MOVING_AVERAGE_DECAY']\nenable_ema = False if ema_decay == -1 else True\nself._gpu_index = config_dict['GPU_OPTIONS']['GPU_DEVICES']\nif self._gpu_index is not None:\n if not isinstance(self._gpu_index, str):\n self._gp...
<|body_start_0|> model_name = config_dict['MODEL']['NETWORK_NAME'] ema_dacay = config_dict['TRICKS']['MOVING_AVERAGE_DECAY'] enable_ema = False if ema_decay == -1 else True self._gpu_index = config_dict['GPU_OPTIONS']['GPU_DEVICES'] if self._gpu_index is not None: if ...
Classify images to predifined classes.
EfficientNet_Predictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EfficientNet_Predictor: """Classify images to predifined classes.""" def __init__(self, checkpoint_path, config_dict): """Constructor. Args: frozen_inference_graph_path: Path to frozen inference graph. gpu_index: The GPU index to be used. Default None.""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus_train_072375
4,664
no_license
[ { "docstring": "Constructor. Args: frozen_inference_graph_path: Path to frozen inference graph. gpu_index: The GPU index to be used. Default None.", "name": "__init__", "signature": "def __init__(self, checkpoint_path, config_dict)" }, { "docstring": "Restore variables from checkpoint dir.", ...
4
null
Implement the Python class `EfficientNet_Predictor` described below. Class description: Classify images to predifined classes. Method signatures and docstrings: - def __init__(self, checkpoint_path, config_dict): Constructor. Args: frozen_inference_graph_path: Path to frozen inference graph. gpu_index: The GPU index ...
Implement the Python class `EfficientNet_Predictor` described below. Class description: Classify images to predifined classes. Method signatures and docstrings: - def __init__(self, checkpoint_path, config_dict): Constructor. Args: frozen_inference_graph_path: Path to frozen inference graph. gpu_index: The GPU index ...
e08f1b9dc7460a147a704ec099c64785663ce070
<|skeleton|> class EfficientNet_Predictor: """Classify images to predifined classes.""" def __init__(self, checkpoint_path, config_dict): """Constructor. Args: frozen_inference_graph_path: Path to frozen inference graph. gpu_index: The GPU index to be used. Default None.""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EfficientNet_Predictor: """Classify images to predifined classes.""" def __init__(self, checkpoint_path, config_dict): """Constructor. Args: frozen_inference_graph_path: Path to frozen inference graph. gpu_index: The GPU index to be used. Default None.""" model_name = config_dict['MODEL']...
the_stack_v2_python_sparse
src/net/efficient_net/efficient_net_ckpt_predictor.py
tonylibing/tf_classification_framework
train
0
942f7e2ac06f33815a91e6f04e0527deb23a6d66
[ "result = RecursiveFilter()\nself.assertIsNone(result.iterations)\nself.assertEqual(result.edge_width, 15)", "iterations = 0\nmsg = 'Invalid number of iterations: must be >= 1: 0'\nwith self.assertRaisesRegex(ValueError, msg):\n RecursiveFilter(iterations=iterations, edge_width=1)", "iterations = 5\nwarning_...
<|body_start_0|> result = RecursiveFilter() self.assertIsNone(result.iterations) self.assertEqual(result.edge_width, 15) <|end_body_0|> <|body_start_1|> iterations = 0 msg = 'Invalid number of iterations: must be >= 1: 0' with self.assertRaisesRegex(ValueError, msg): ...
Test plugin initialisation.
Test__init__
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__init__: """Test plugin initialisation.""" def test_basic(self): """Test using the default arguments.""" <|body_0|> def test_iterations(self): """Test when iterations value less than unity is given (invalid).""" <|body_1|> def test_iterations_wa...
stack_v2_sparse_classes_75kplus_train_072376
22,857
permissive
[ { "docstring": "Test using the default arguments.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test when iterations value less than unity is given (invalid).", "name": "test_iterations", "signature": "def test_iterations(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_034510
Implement the Python class `Test__init__` described below. Class description: Test plugin initialisation. Method signatures and docstrings: - def test_basic(self): Test using the default arguments. - def test_iterations(self): Test when iterations value less than unity is given (invalid). - def test_iterations_warn(s...
Implement the Python class `Test__init__` described below. Class description: Test plugin initialisation. Method signatures and docstrings: - def test_basic(self): Test using the default arguments. - def test_iterations(self): Test when iterations value less than unity is given (invalid). - def test_iterations_warn(s...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__init__: """Test plugin initialisation.""" def test_basic(self): """Test using the default arguments.""" <|body_0|> def test_iterations(self): """Test when iterations value less than unity is given (invalid).""" <|body_1|> def test_iterations_wa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test__init__: """Test plugin initialisation.""" def test_basic(self): """Test using the default arguments.""" result = RecursiveFilter() self.assertIsNone(result.iterations) self.assertEqual(result.edge_width, 15) def test_iterations(self): """Test when iterat...
the_stack_v2_python_sparse
improver_tests/nbhood/recursive_filter/test_RecursiveFilter.py
metoppv/improver
train
101
887cc014f6ea3f57abd3d0350894f93c11a21a13
[ "args = self.args\nif args and (not args[0] in [\"'\", ',', ':']):\n args = ' %s' % args.strip()\nself.args = args", "if not self.args:\n msg = 'What do you want to do?'\n self.caller.msg(msg)\nelse:\n msg = f'{self.caller.name}{self.args}'\n self.caller.location.msg_contents(text=(msg, {'type': 'p...
<|body_start_0|> args = self.args if args and (not args[0] in ["'", ',', ':']): args = ' %s' % args.strip() self.args = args <|end_body_0|> <|body_start_1|> if not self.args: msg = 'What do you want to do?' self.caller.msg(msg) else: ...
strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.
CmdPose
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): ""...
stack_v2_sparse_classes_75kplus_train_072377
22,494
permissive
[ { "docstring": "Custom parse the cases where the emote starts with some special letter, such as 's, at which we don't want to separate the caller's name and the emote with a space.", "name": "parse", "signature": "def parse(self)" }, { "docstring": "Hook function", "name": "func", "signa...
2
stack_v2_sparse_classes_30k_train_005848
Implement the Python class `CmdPose` described below. Class description: strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your na...
Implement the Python class `CmdPose` described below. Class description: strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your na...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): """Custom parse...
the_stack_v2_python_sparse
evennia/commands/default/general.py
evennia/evennia
train
1,781
9023e601db5423fd0b05288d395446f45b2b64ac
[ "self.end_time_usecs = end_time_usecs\nself.error = error\nself.job_run_id = job_run_id\nself.run_type = run_type\nself.start_time_usecs = start_time_usecs\nself.status = status", "if dictionary is None:\n return None\nend_time_usecs = dictionary.get('endTimeUsecs')\nerror = dictionary.get('error')\njob_run_id...
<|body_start_0|> self.end_time_usecs = end_time_usecs self.error = error self.job_run_id = job_run_id self.run_type = run_type self.start_time_usecs = start_time_usecs self.status = status <|end_body_0|> <|body_start_1|> if dictionary is None: return ...
Implementation of the 'ProtectionShellInfo' model. TODO: type description here. Attributes: end_time_usecs (long|int): Specifies the end time of the Protection Run. The end time is specified as a Unix epoch Timestamp (in microseconds). error (string): Specifies if an error occurred (if any) while running this task. Thi...
ProtectionShellInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionShellInfo: """Implementation of the 'ProtectionShellInfo' model. TODO: type description here. Attributes: end_time_usecs (long|int): Specifies the end time of the Protection Run. The end time is specified as a Unix epoch Timestamp (in microseconds). error (string): Specifies if an error...
stack_v2_sparse_classes_75kplus_train_072378
4,560
permissive
[ { "docstring": "Constructor for the ProtectionShellInfo class", "name": "__init__", "signature": "def __init__(self, end_time_usecs=None, error=None, job_run_id=None, run_type=None, start_time_usecs=None, status=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: ...
2
stack_v2_sparse_classes_30k_test_000622
Implement the Python class `ProtectionShellInfo` described below. Class description: Implementation of the 'ProtectionShellInfo' model. TODO: type description here. Attributes: end_time_usecs (long|int): Specifies the end time of the Protection Run. The end time is specified as a Unix epoch Timestamp (in microseconds)...
Implement the Python class `ProtectionShellInfo` described below. Class description: Implementation of the 'ProtectionShellInfo' model. TODO: type description here. Attributes: end_time_usecs (long|int): Specifies the end time of the Protection Run. The end time is specified as a Unix epoch Timestamp (in microseconds)...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionShellInfo: """Implementation of the 'ProtectionShellInfo' model. TODO: type description here. Attributes: end_time_usecs (long|int): Specifies the end time of the Protection Run. The end time is specified as a Unix epoch Timestamp (in microseconds). error (string): Specifies if an error...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProtectionShellInfo: """Implementation of the 'ProtectionShellInfo' model. TODO: type description here. Attributes: end_time_usecs (long|int): Specifies the end time of the Protection Run. The end time is specified as a Unix epoch Timestamp (in microseconds). error (string): Specifies if an error occurred (if...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_shell_info.py
cohesity/management-sdk-python
train
24
7718fcac74303c40e585d458749b1ebf98cafef0
[ "patterns = [re_path('^list/$', self.wrapper(self.changelist), name=self.get_list_name), re_path('^add/$', self.wrapper(self.add_view), name=self.get_add_name), re_path('^change/(?P<pk>\\\\d+)/$', self.wrapper(self.change_view), name=self.get_change_name), re_path('^del/(?P<pk>\\\\d+)/$', self.wrapper(self.delete_v...
<|body_start_0|> patterns = [re_path('^list/$', self.wrapper(self.changelist), name=self.get_list_name), re_path('^add/$', self.wrapper(self.add_view), name=self.get_add_name), re_path('^change/(?P<pk>\\d+)/$', self.wrapper(self.change_view), name=self.get_change_name), re_path('^del/(?P<pk>\\d+)/$', self.wrapp...
TutorHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TutorHandler: def get_urls(self): """预留的重新自定义url钩子函数,主要是覆盖掉默认的url,并设置name别名""" <|body_0|> def save(self, request, form, is_update, *args, **kwargs): """预留钩子函数 :param form: :param is_update:是否是更新数据,true即为更新,false即为添加数据 :return:""" <|body_1|> def get_list_...
stack_v2_sparse_classes_75kplus_train_072379
1,569
permissive
[ { "docstring": "预留的重新自定义url钩子函数,主要是覆盖掉默认的url,并设置name别名", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "预留钩子函数 :param form: :param is_update:是否是更新数据,true即为更新,false即为添加数据 :return:", "name": "save", "signature": "def save(self, request, form, is_update, *args, **k...
3
stack_v2_sparse_classes_30k_train_024455
Implement the Python class `TutorHandler` described below. Class description: Implement the TutorHandler class. Method signatures and docstrings: - def get_urls(self): 预留的重新自定义url钩子函数,主要是覆盖掉默认的url,并设置name别名 - def save(self, request, form, is_update, *args, **kwargs): 预留钩子函数 :param form: :param is_update:是否是更新数据,true即...
Implement the Python class `TutorHandler` described below. Class description: Implement the TutorHandler class. Method signatures and docstrings: - def get_urls(self): 预留的重新自定义url钩子函数,主要是覆盖掉默认的url,并设置name别名 - def save(self, request, form, is_update, *args, **kwargs): 预留钩子函数 :param form: :param is_update:是否是更新数据,true即...
59053c88faf76de3592b5aa02b1425b126fe2f2d
<|skeleton|> class TutorHandler: def get_urls(self): """预留的重新自定义url钩子函数,主要是覆盖掉默认的url,并设置name别名""" <|body_0|> def save(self, request, form, is_update, *args, **kwargs): """预留钩子函数 :param form: :param is_update:是否是更新数据,true即为更新,false即为添加数据 :return:""" <|body_1|> def get_list_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TutorHandler: def get_urls(self): """预留的重新自定义url钩子函数,主要是覆盖掉默认的url,并设置name别名""" patterns = [re_path('^list/$', self.wrapper(self.changelist), name=self.get_list_name), re_path('^add/$', self.wrapper(self.add_view), name=self.get_add_name), re_path('^change/(?P<pk>\\d+)/$', self.wrapper(self.cha...
the_stack_v2_python_sparse
OnlineStudy/generic/handlers/tutor.py
NanRenTeam-9/MongoMicroCourse
train
0
968f8cd5fe2ab7b138c28ea947c1d4027f3cb8a2
[ "S = self\nenv = S.smooth(width=width)\nreturn S / env", "S = np.abs(self)\nwidth = width * (1 / S.df.value)\nwindow = np.ones(2 * width)\nS = np.convolve(S, window / (2 * width), 'same')\nS = Spec(S)\nS.__dict__ = self.copy_metadata()\nreturn S" ]
<|body_start_0|> S = self env = S.smooth(width=width) return S / env <|end_body_0|> <|body_start_1|> S = np.abs(self) width = width * (1 / S.df.value) window = np.ones(2 * width) S = np.convolve(S, window / (2 * width), 'same') S = Spec(S) S.__dic...
Spec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Spec: def whiten(self, width=1): """whitens spectrum by getting a smoothed version of the absolute value of the spectrum and dividing out by that smoothed version. Parameters ---------- width : `int`, kwarg, optional, default=1 width over which to smooth (in Hz) Returns ------- out : `Sp...
stack_v2_sparse_classes_75kplus_train_072380
1,312
no_license
[ { "docstring": "whitens spectrum by getting a smoothed version of the absolute value of the spectrum and dividing out by that smoothed version. Parameters ---------- width : `int`, kwarg, optional, default=1 width over which to smooth (in Hz) Returns ------- out : `Spec`, whitened spectrum", "name": "whiten...
2
stack_v2_sparse_classes_30k_train_048418
Implement the Python class `Spec` described below. Class description: Implement the Spec class. Method signatures and docstrings: - def whiten(self, width=1): whitens spectrum by getting a smoothed version of the absolute value of the spectrum and dividing out by that smoothed version. Parameters ---------- width : `...
Implement the Python class `Spec` described below. Class description: Implement the Spec class. Method signatures and docstrings: - def whiten(self, width=1): whitens spectrum by getting a smoothed version of the absolute value of the spectrum and dividing out by that smoothed version. Parameters ---------- width : `...
d4c758203ce0c004dcba89309650a7b1f2128a10
<|skeleton|> class Spec: def whiten(self, width=1): """whitens spectrum by getting a smoothed version of the absolute value of the spectrum and dividing out by that smoothed version. Parameters ---------- width : `int`, kwarg, optional, default=1 width over which to smooth (in Hz) Returns ------- out : `Sp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Spec: def whiten(self, width=1): """whitens spectrum by getting a smoothed version of the absolute value of the spectrum and dividing out by that smoothed version. Parameters ---------- width : `int`, kwarg, optional, default=1 width over which to smooth (in Hz) Returns ------- out : `Spec`, whitened ...
the_stack_v2_python_sparse
seispy/spec.py
pmeyers279/seispy
train
0
dcd20fd748fbba693d5e25d90bf337822a7e99e3
[ "params = self.get_set_params(locals())\nresponse = await self.api.request('store.addStickersToFavorite', params)\nmodel = base.OkResponse\nreturn model(**response).response", "params = self.get_set_params(locals())\nresponse = await self.api.request('store.getFavoriteStickers', params)\nmodel = store.GetFavorite...
<|body_start_0|> params = self.get_set_params(locals()) response = await self.api.request('store.addStickersToFavorite', params) model = base.OkResponse return model(**response).response <|end_body_0|> <|body_start_1|> params = self.get_set_params(locals()) response = aw...
StoreCategory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoreCategory: async def add_stickers_to_favorite(self, sticker_ids: List[int], **kwargs) -> base.OkResponseModel: """Adds given sticker IDs to the list of user's favorite stickers :param sticker_ids: Sticker IDs to be added""" <|body_0|> async def get_favorite_stickers(self...
stack_v2_sparse_classes_75kplus_train_072381
2,743
permissive
[ { "docstring": "Adds given sticker IDs to the list of user's favorite stickers :param sticker_ids: Sticker IDs to be added", "name": "add_stickers_to_favorite", "signature": "async def add_stickers_to_favorite(self, sticker_ids: List[int], **kwargs) -> base.OkResponseModel" }, { "docstring": "st...
5
stack_v2_sparse_classes_30k_train_049996
Implement the Python class `StoreCategory` described below. Class description: Implement the StoreCategory class. Method signatures and docstrings: - async def add_stickers_to_favorite(self, sticker_ids: List[int], **kwargs) -> base.OkResponseModel: Adds given sticker IDs to the list of user's favorite stickers :para...
Implement the Python class `StoreCategory` described below. Class description: Implement the StoreCategory class. Method signatures and docstrings: - async def add_stickers_to_favorite(self, sticker_ids: List[int], **kwargs) -> base.OkResponseModel: Adds given sticker IDs to the list of user's favorite stickers :para...
dfcedd4023aa170dd7f802ac662f0e2ed9033904
<|skeleton|> class StoreCategory: async def add_stickers_to_favorite(self, sticker_ids: List[int], **kwargs) -> base.OkResponseModel: """Adds given sticker IDs to the list of user's favorite stickers :param sticker_ids: Sticker IDs to be added""" <|body_0|> async def get_favorite_stickers(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StoreCategory: async def add_stickers_to_favorite(self, sticker_ids: List[int], **kwargs) -> base.OkResponseModel: """Adds given sticker IDs to the list of user's favorite stickers :param sticker_ids: Sticker IDs to be added""" params = self.get_set_params(locals()) response = await se...
the_stack_v2_python_sparse
codegen/results/methods/store.py
ScriptHound/vkbottle-types
train
0
4ee7177256b4549b1d771d25b9575797ed45c0db
[ "if not isinstance(command, (list, tuple)):\n raise SubprocessRuntimeError(f'Command ({command}) is not of type list or tuple.')\nself.base_command = command[0]\nself.command = command\nself.stdout = stdout\nself.stderr = stderr\nself.timeout = timeout\nself.verbose = verbose\ncommand[0] = self.__which()", "ab...
<|body_start_0|> if not isinstance(command, (list, tuple)): raise SubprocessRuntimeError(f'Command ({command}) is not of type list or tuple.') self.base_command = command[0] self.command = command self.stdout = stdout self.stderr = stderr self.timeout = timeou...
Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.
Subprocess
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subprocess: """Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.""" def __init__(self, command, stdout=DEVNULL, stderr=DEVNULL, verbose=0, timeout=None): """Cla...
stack_v2_sparse_classes_75kplus_train_072382
6,457
permissive
[ { "docstring": "Class initializer. Creates a command object that can be executed. :param command: Command to execute on operating system in tuple format :param stdout: Optional location to redirect standard output stream :param stderr: Optional location to redirect error output stream :param verbose: Optional v...
6
stack_v2_sparse_classes_30k_train_048630
Implement the Python class `Subprocess` described below. Class description: Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures. Method signatures and docstrings: - def __init__(self, command, stdo...
Implement the Python class `Subprocess` described below. Class description: Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures. Method signatures and docstrings: - def __init__(self, command, stdo...
9c25ba4d986f73962598d0e9ec09ac8fe4121a88
<|skeleton|> class Subprocess: """Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.""" def __init__(self, command, stdout=DEVNULL, stderr=DEVNULL, verbose=0, timeout=None): """Cla...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Subprocess: """Class to handle the execution of all command line tooling. User friendly subprocess wrapper, providing useful and informative error messages to the user in case of failures.""" def __init__(self, command, stdout=DEVNULL, stderr=DEVNULL, verbose=0, timeout=None): """Class initialize...
the_stack_v2_python_sparse
src/facility/subprocess.py
rschuitema/sqatt
train
6
d74dd15925a50779fa249df5b21b941141df0fd0
[ "device_actions = list(ndb_models.DeviceAction.query().order(ndb_models.DeviceAction.name))\ndevice_action_msgs = mtt_messages.ConvertList(device_actions, mtt_messages.DeviceAction)\nreturn mtt_messages.DeviceActionList(device_actions=device_action_msgs)", "device_action = mtt_messages.Convert(request, ndb_models...
<|body_start_0|> device_actions = list(ndb_models.DeviceAction.query().order(ndb_models.DeviceAction.name)) device_action_msgs = mtt_messages.ConvertList(device_actions, mtt_messages.DeviceAction) return mtt_messages.DeviceActionList(device_actions=device_action_msgs) <|end_body_0|> <|body_star...
A handler for Device Action API.
DeviceActionApi
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceActionApi: """A handler for Device Action API.""" def List(self, request): """Lists device actions.""" <|body_0|> def Create(self, request): """Creates a device action. Body: Device action data""" <|body_1|> def Get(self, request): """F...
stack_v2_sparse_classes_75kplus_train_072383
4,521
permissive
[ { "docstring": "Lists device actions.", "name": "List", "signature": "def List(self, request)" }, { "docstring": "Creates a device action. Body: Device action data", "name": "Create", "signature": "def Create(self, request)" }, { "docstring": "Fetches a device action. Parameters:...
5
stack_v2_sparse_classes_30k_train_024232
Implement the Python class `DeviceActionApi` described below. Class description: A handler for Device Action API. Method signatures and docstrings: - def List(self, request): Lists device actions. - def Create(self, request): Creates a device action. Body: Device action data - def Get(self, request): Fetches a device...
Implement the Python class `DeviceActionApi` described below. Class description: A handler for Device Action API. Method signatures and docstrings: - def List(self, request): Lists device actions. - def Create(self, request): Creates a device action. Body: Device action data - def Get(self, request): Fetches a device...
5e10bed02089e4cf29ae4d9d67e127f77e8fb3c9
<|skeleton|> class DeviceActionApi: """A handler for Device Action API.""" def List(self, request): """Lists device actions.""" <|body_0|> def Create(self, request): """Creates a device action. Body: Device action data""" <|body_1|> def Get(self, request): """F...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeviceActionApi: """A handler for Device Action API.""" def List(self, request): """Lists device actions.""" device_actions = list(ndb_models.DeviceAction.query().order(ndb_models.DeviceAction.name)) device_action_msgs = mtt_messages.ConvertList(device_actions, mtt_messages.Device...
the_stack_v2_python_sparse
multitest_transport/api/device_action_api.py
maksonlee/multitest_transport
train
0
a609dc2341e1872907f38304d70d9ae4fff8c8e7
[ "idx = i + 1\nscene = '{0:d}'.format(idx)\nimg = scene + '.png'\nparts = copy.copy(self.parts_template)\nparts['image'] = [img]\nparts['flip'] = self.augment and np.random.sample() >= 0.5\nparts['gray'] = self.augment and np.random.sample() < 0.1\nparts['id'] = [np.floor(idx / 400)]\nreturn parts", "if 'input' in...
<|body_start_0|> idx = i + 1 scene = '{0:d}'.format(idx) img = scene + '.png' parts = copy.copy(self.parts_template) parts['image'] = [img] parts['flip'] = self.augment and np.random.sample() >= 0.5 parts['gray'] = self.augment and np.random.sample() < 0.1 ...
Dataset class for BFMId, where targets are the IDs of each image.
BFMId
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BFMId: """Dataset class for BFMId, where targets are the IDs of each image.""" def trials(self, i, f): """Returns a dictionary of paths per part in the trial Args: i (int): the trial index f (file handle): root of the dataset Returns: parts (dict) : paths to data organized with keys ...
stack_v2_sparse_classes_75kplus_train_072384
3,210
no_license
[ { "docstring": "Returns a dictionary of paths per part in the trial Args: i (int): the trial index f (file handle): root of the dataset Returns: parts (dict) : paths to data organized with keys corresponding to `self.trail_funcs`.", "name": "trials", "signature": "def trials(self, i, f)" }, { "d...
4
stack_v2_sparse_classes_30k_train_050793
Implement the Python class `BFMId` described below. Class description: Dataset class for BFMId, where targets are the IDs of each image. Method signatures and docstrings: - def trials(self, i, f): Returns a dictionary of paths per part in the trial Args: i (int): the trial index f (file handle): root of the dataset R...
Implement the Python class `BFMId` described below. Class description: Dataset class for BFMId, where targets are the IDs of each image. Method signatures and docstrings: - def trials(self, i, f): Returns a dictionary of paths per part in the trial Args: i (int): the trial index f (file handle): root of the dataset R...
15bf1c9680411424141eab0ab368f3b4d9b384c7
<|skeleton|> class BFMId: """Dataset class for BFMId, where targets are the IDs of each image.""" def trials(self, i, f): """Returns a dictionary of paths per part in the trial Args: i (int): the trial index f (file handle): root of the dataset Returns: parts (dict) : paths to data organized with keys ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BFMId: """Dataset class for BFMId, where targets are the IDs of each image.""" def trials(self, i, f): """Returns a dictionary of paths per part in the trial Args: i (int): the trial index f (file handle): root of the dataset Returns: parts (dict) : paths to data organized with keys corresponding...
the_stack_v2_python_sparse
datasets/bfm_id.py
MasaStanisavljevic/EIG-faces
train
0
f604f028b5943f170e1c8a7c1f88bb8793d18dc6
[ "existing_files = []\nfor root, _, files in os.walk(self.output_path):\n for name in files:\n existing_files.append(os.path.join(root, name))\ncaterpillar.copy_static_code([], self.output_path, BOILERPLATE_DIR)\nfor root, _, files in os.walk(self.output_path):\n for name in files:\n path = os.pa...
<|body_start_0|> existing_files = [] for root, _, files in os.walk(self.output_path): for name in files: existing_files.append(os.path.join(root, name)) caterpillar.copy_static_code([], self.output_path, BOILERPLATE_DIR) for root, _, files in os.walk(self.outp...
Tests copy_static_code.
TestCopyStaticCode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCopyStaticCode: """Tests copy_static_code.""" def test_no_copy(self): """Tests copying no files.""" <|body_0|> def test_copy_one(self): """Tests copying one file.""" <|body_1|> def test_copy_many(self): """Tests copying many files.""" ...
stack_v2_sparse_classes_75kplus_train_072385
27,663
permissive
[ { "docstring": "Tests copying no files.", "name": "test_no_copy", "signature": "def test_no_copy(self)" }, { "docstring": "Tests copying one file.", "name": "test_copy_one", "signature": "def test_copy_one(self)" }, { "docstring": "Tests copying many files.", "name": "test_co...
3
null
Implement the Python class `TestCopyStaticCode` described below. Class description: Tests copy_static_code. Method signatures and docstrings: - def test_no_copy(self): Tests copying no files. - def test_copy_one(self): Tests copying one file. - def test_copy_many(self): Tests copying many files.
Implement the Python class `TestCopyStaticCode` described below. Class description: Tests copy_static_code. Method signatures and docstrings: - def test_no_copy(self): Tests copying no files. - def test_copy_one(self): Tests copying one file. - def test_copy_many(self): Tests copying many files. <|skeleton|> class T...
985419af32f9bbd3abc934db3edc09523477118a
<|skeleton|> class TestCopyStaticCode: """Tests copy_static_code.""" def test_no_copy(self): """Tests copying no files.""" <|body_0|> def test_copy_one(self): """Tests copying one file.""" <|body_1|> def test_copy_many(self): """Tests copying many files.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCopyStaticCode: """Tests copy_static_code.""" def test_no_copy(self): """Tests copying no files.""" existing_files = [] for root, _, files in os.walk(self.output_path): for name in files: existing_files.append(os.path.join(root, name)) cater...
the_stack_v2_python_sparse
src/caterpillar_test.py
HoeDetector/caterpillar
train
0
dcaee25ef2eae840730946cde9009cf88a030689
[ "def isCompleteSubTree(root):\n if not root:\n return (0, 0)\n if root:\n left_deep = isCompleteSubTree(root.left)\n right_deep = isCompleteSubTree(root.right)\n print(root.val, left_deep, right_deep)\n if not left_deep or not right_deep:\n return None\n if...
<|body_start_0|> def isCompleteSubTree(root): if not root: return (0, 0) if root: left_deep = isCompleteSubTree(root.left) right_deep = isCompleteSubTree(root.right) print(root.val, left_deep, right_deep) if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isCompleteTree(self, root): """:type root: TreeNode :rtype: bool 44 ms""" <|body_0|> def isCompleteTree_1(self, root): """:type root: TreeNode :rtype: bool 24ms 排序输出查看情况""" <|body_1|> <|end_skeleton|> <|body_start_0|> def isCompleteSub...
stack_v2_sparse_classes_75kplus_train_072386
3,277
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool 44 ms", "name": "isCompleteTree", "signature": "def isCompleteTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool 24ms 排序输出查看情况", "name": "isCompleteTree_1", "signature": "def isCompleteTree_1(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_011945
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root): :type root: TreeNode :rtype: bool 44 ms - def isCompleteTree_1(self, root): :type root: TreeNode :rtype: bool 24ms 排序输出查看情况
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root): :type root: TreeNode :rtype: bool 44 ms - def isCompleteTree_1(self, root): :type root: TreeNode :rtype: bool 24ms 排序输出查看情况 <|skeleton|> class So...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def isCompleteTree(self, root): """:type root: TreeNode :rtype: bool 44 ms""" <|body_0|> def isCompleteTree_1(self, root): """:type root: TreeNode :rtype: bool 24ms 排序输出查看情况""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isCompleteTree(self, root): """:type root: TreeNode :rtype: bool 44 ms""" def isCompleteSubTree(root): if not root: return (0, 0) if root: left_deep = isCompleteSubTree(root.left) right_deep = isCompleteSubTr...
the_stack_v2_python_sparse
CheckCompletenessOfABinaryTree_MID_958.py
953250587/leetcode-python
train
2
073e5879f2d1d360170659525002db5640191fa2
[ "with open('./tables/json/' + filePath + '.json', 'w') as f:\n ls = []\n for i in table:\n data = JsonSerialize._prepareSave(i.__dict__)\n className = i.__class__.__name__\n ls.append([data, className])\n json.dump(ls, f)", "res = {}\nfor key, value in obj.items():\n if type(value...
<|body_start_0|> with open('./tables/json/' + filePath + '.json', 'w') as f: ls = [] for i in table: data = JsonSerialize._prepareSave(i.__dict__) className = i.__class__.__name__ ls.append([data, className]) json.dump(ls, f) <|...
Serialize database with json module
JsonSerialize
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonSerialize: """Serialize database with json module""" def save(filePath, table): """serialize to file :filePath list :table""" <|body_0|> def _prepareSave(obj): """create a dictionary from objects. If object contains another object, recursively and return dict...
stack_v2_sparse_classes_75kplus_train_072387
4,673
no_license
[ { "docstring": "serialize to file :filePath list :table", "name": "save", "signature": "def save(filePath, table)" }, { "docstring": "create a dictionary from objects. If object contains another object, recursively and return dict", "name": "_prepareSave", "signature": "def _prepareSave(...
5
stack_v2_sparse_classes_30k_train_034734
Implement the Python class `JsonSerialize` described below. Class description: Serialize database with json module Method signatures and docstrings: - def save(filePath, table): serialize to file :filePath list :table - def _prepareSave(obj): create a dictionary from objects. If object contains another object, recurs...
Implement the Python class `JsonSerialize` described below. Class description: Serialize database with json module Method signatures and docstrings: - def save(filePath, table): serialize to file :filePath list :table - def _prepareSave(obj): create a dictionary from objects. If object contains another object, recurs...
16af7d45e436f6a57836e5e21b5d15b2e44f522a
<|skeleton|> class JsonSerialize: """Serialize database with json module""" def save(filePath, table): """serialize to file :filePath list :table""" <|body_0|> def _prepareSave(obj): """create a dictionary from objects. If object contains another object, recursively and return dict...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JsonSerialize: """Serialize database with json module""" def save(filePath, table): """serialize to file :filePath list :table""" with open('./tables/json/' + filePath + '.json', 'w') as f: ls = [] for i in table: data = JsonSerialize._prepareSave(i...
the_stack_v2_python_sparse
lab4/serializers.py
savtym/architecture
train
0
4e8534fcf0ceb3f3a6d6d3baa2e882c166d0b82d
[ "if nums:\n result = nums[0]\n for i in range(1, len(nums)):\n result ^= nums[i]\n return result\nelse:\n return 0", "result = 0\nfor n in nums:\n result ^= n\nreturn result" ]
<|body_start_0|> if nums: result = nums[0] for i in range(1, len(nums)): result ^= nums[i] return result else: return 0 <|end_body_0|> <|body_start_1|> result = 0 for n in nums: result ^= n return result...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_self(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if nums: result = nums[0] ...
stack_v2_sparse_classes_75kplus_train_072388
509
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber_self", "signature": "def singleNumber_self(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber_self(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber_self(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def sing...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_self(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" if nums: result = nums[0] for i in range(1, len(nums)): result ^= nums[i] return result else: return 0 def singleNumber_self(self, nums):...
the_stack_v2_python_sparse
136_single_number/sol.py
lianke123321/leetcode_sol
train
0
b29eb80c76763994fcce9832679322cedc7b307d
[ "a %= self.base\nresult = 0\nfor i in range(b):\n result = result * a % self.base\nreturn result", "if not b:\n return 1\nlast_digit = b.pop()\nreturn self.f(self.superPow(a, b), 10) * self.f(a, last_digit) % self.base", "p = 0\nfor num in b:\n p = (p * 10 + num) % 1140\nif p == 0:\n p += 1140\nretu...
<|body_start_0|> a %= self.base result = 0 for i in range(b): result = result * a % self.base return result <|end_body_0|> <|body_start_1|> if not b: return 1 last_digit = b.pop() return self.f(self.superPow(a, b), 10) * self.f(a, last_dig...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def f(self, a, b): """calculate a^b/1337 0<= b < 10 :param a: :param b: :return:""" <|body_0|> def superPow(self, a, b): """:type a: int :type b: List[int] :rtype: int""" <|body_1|> def superPow1(self, a, b): """:type a: int :type b: Li...
stack_v2_sparse_classes_75kplus_train_072389
967
no_license
[ { "docstring": "calculate a^b/1337 0<= b < 10 :param a: :param b: :return:", "name": "f", "signature": "def f(self, a, b)" }, { "docstring": ":type a: int :type b: List[int] :rtype: int", "name": "superPow", "signature": "def superPow(self, a, b)" }, { "docstring": ":type a: int ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def f(self, a, b): calculate a^b/1337 0<= b < 10 :param a: :param b: :return: - def superPow(self, a, b): :type a: int :type b: List[int] :rtype: int - def superPow1(self, a, b):...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def f(self, a, b): calculate a^b/1337 0<= b < 10 :param a: :param b: :return: - def superPow(self, a, b): :type a: int :type b: List[int] :rtype: int - def superPow1(self, a, b):...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def f(self, a, b): """calculate a^b/1337 0<= b < 10 :param a: :param b: :return:""" <|body_0|> def superPow(self, a, b): """:type a: int :type b: List[int] :rtype: int""" <|body_1|> def superPow1(self, a, b): """:type a: int :type b: Li...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def f(self, a, b): """calculate a^b/1337 0<= b < 10 :param a: :param b: :return:""" a %= self.base result = 0 for i in range(b): result = result * a % self.base return result def superPow(self, a, b): """:type a: int :type b: List[int]...
the_stack_v2_python_sparse
python/leetcode/372_Super_Pow.py
bobcaoge/my-code
train
0
e37bb8385ad1dee9e26b23557f786216c82d1acb
[ "self.parent = parent\nself.chanceToHit = toHit\nself.pierce = pierce", "dodging = super(PierceDodgeDelegate, self).dodging(target)\nif dodging and target.dodge != self.pierce:\n return True\nelse:\n return False" ]
<|body_start_0|> self.parent = parent self.chanceToHit = toHit self.pierce = pierce <|end_body_0|> <|body_start_1|> dodging = super(PierceDodgeDelegate, self).dodging(target) if dodging and target.dodge != self.pierce: return True else: return Fal...
Represents an attack that pierces a certain kind of dodge
PierceDodgeDelegate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PierceDodgeDelegate: """Represents an attack that pierces a certain kind of dodge""" def __init__(self, parent, toHit, pierce): """Build a core hit Delegate""" <|body_0|> def dodging(self, target): """Returns if the opp is dodging the current attack""" <|...
stack_v2_sparse_classes_75kplus_train_072390
656
no_license
[ { "docstring": "Build a core hit Delegate", "name": "__init__", "signature": "def __init__(self, parent, toHit, pierce)" }, { "docstring": "Returns if the opp is dodging the current attack", "name": "dodging", "signature": "def dodging(self, target)" } ]
2
stack_v2_sparse_classes_30k_train_052096
Implement the Python class `PierceDodgeDelegate` described below. Class description: Represents an attack that pierces a certain kind of dodge Method signatures and docstrings: - def __init__(self, parent, toHit, pierce): Build a core hit Delegate - def dodging(self, target): Returns if the opp is dodging the current...
Implement the Python class `PierceDodgeDelegate` described below. Class description: Represents an attack that pierces a certain kind of dodge Method signatures and docstrings: - def __init__(self, parent, toHit, pierce): Build a core hit Delegate - def dodging(self, target): Returns if the opp is dodging the current...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class PierceDodgeDelegate: """Represents an attack that pierces a certain kind of dodge""" def __init__(self, parent, toHit, pierce): """Build a core hit Delegate""" <|body_0|> def dodging(self, target): """Returns if the opp is dodging the current attack""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PierceDodgeDelegate: """Represents an attack that pierces a certain kind of dodge""" def __init__(self, parent, toHit, pierce): """Build a core hit Delegate""" self.parent = parent self.chanceToHit = toHit self.pierce = pierce def dodging(self, target): """Ret...
the_stack_v2_python_sparse
src/Battle/Attack/HitDelegates/piercedodge_delegate.py
sgtnourry/Pokemon-Project
train
0
89aff1c7f830d2af2833704660c9d395c210f07c
[ "super().__init__()\nself.yaml_file_path = yaml_file_path\nself.key = key\nself.expected = expected", "base_message = self.base_message.format(filename=self.yaml_file_path)\nerror_message = ERROR_MESSAGE.format(key=self.key, expected=self.expected)\nreturn base_message + error_message" ]
<|body_start_0|> super().__init__() self.yaml_file_path = yaml_file_path self.key = key self.expected = expected <|end_body_0|> <|body_start_1|> base_message = self.base_message.format(filename=self.yaml_file_path) error_message = ERROR_MESSAGE.format(key=self.key, expec...
Custom error for invalid config file value.
InvalidYAMLValueError
[ "CC-BY-NC-SA-4.0", "BSD-3-Clause", "CC0-1.0", "ISC", "Unlicense", "LicenseRef-scancode-secret-labs-2011", "WTFPL", "Apache-2.0", "LGPL-3.0-only", "MIT", "CC-BY-SA-4.0", "LicenseRef-scancode-public-domain", "CC-BY-NC-2.5", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown...
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvalidYAMLValueError: """Custom error for invalid config file value.""" def __init__(self, yaml_file_path, key, expected): """Create error for invalid config file value.""" <|body_0|> def __str__(self): """Override default error string. Returns: Error message fo...
stack_v2_sparse_classes_75kplus_train_072391
859
permissive
[ { "docstring": "Create error for invalid config file value.", "name": "__init__", "signature": "def __init__(self, yaml_file_path, key, expected)" }, { "docstring": "Override default error string. Returns: Error message for invalid config file value.", "name": "__str__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_040416
Implement the Python class `InvalidYAMLValueError` described below. Class description: Custom error for invalid config file value. Method signatures and docstrings: - def __init__(self, yaml_file_path, key, expected): Create error for invalid config file value. - def __str__(self): Override default error string. Retu...
Implement the Python class `InvalidYAMLValueError` described below. Class description: Custom error for invalid config file value. Method signatures and docstrings: - def __init__(self, yaml_file_path, key, expected): Create error for invalid config file value. - def __str__(self): Override default error string. Retu...
ea3281ec6f4d17538f6d3cf6f88d74fa54581b34
<|skeleton|> class InvalidYAMLValueError: """Custom error for invalid config file value.""" def __init__(self, yaml_file_path, key, expected): """Create error for invalid config file value.""" <|body_0|> def __str__(self): """Override default error string. Returns: Error message fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InvalidYAMLValueError: """Custom error for invalid config file value.""" def __init__(self, yaml_file_path, key, expected): """Create error for invalid config file value.""" super().__init__() self.yaml_file_path = yaml_file_path self.key = key self.expected = expe...
the_stack_v2_python_sparse
csfieldguide/utils/errors/InvalidYAMLValueError.py
uccser/cs-field-guide
train
364
6269d8d4f5120b1c608477a7e1a9793cc79edd40
[ "layout_section_slug = request.GET.get('layout_section_slug', None)\nlayout_template_slug = request.GET.get('layout_template_slug', None)\nplugin_relation_default = request.GET.getlist('plugin_relation_default[]')\nplugin_relation_default_placeholder = request.GET.getlist('plugin_relation_default_placeholder[]')\ni...
<|body_start_0|> layout_section_slug = request.GET.get('layout_section_slug', None) layout_template_slug = request.GET.get('layout_template_slug', None) plugin_relation_default = request.GET.getlist('plugin_relation_default[]') plugin_relation_default_placeholder = request.GET.getlist('p...
Manage the layout of a placeholder.
LayoutListView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayoutListView: """Manage the layout of a placeholder.""" def get(self, request): """Change and preview the layout of a placeholder""" <|body_0|> def post(self, request): """Change the page layout""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_072392
5,299
permissive
[ { "docstring": "Change and preview the layout of a placeholder", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Change the page layout", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_015139
Implement the Python class `LayoutListView` described below. Class description: Manage the layout of a placeholder. Method signatures and docstrings: - def get(self, request): Change and preview the layout of a placeholder - def post(self, request): Change the page layout
Implement the Python class `LayoutListView` described below. Class description: Manage the layout of a placeholder. Method signatures and docstrings: - def get(self, request): Change and preview the layout of a placeholder - def post(self, request): Change the page layout <|skeleton|> class LayoutListView: """Ma...
00947315b5bca4977f1de40ddb951f843c345532
<|skeleton|> class LayoutListView: """Manage the layout of a placeholder.""" def get(self, request): """Change and preview the layout of a placeholder""" <|body_0|> def post(self, request): """Change the page layout""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LayoutListView: """Manage the layout of a placeholder.""" def get(self, request): """Change and preview the layout of a placeholder""" layout_section_slug = request.GET.get('layout_section_slug', None) layout_template_slug = request.GET.get('layout_template_slug', None) pl...
the_stack_v2_python_sparse
ionyweb/administration/views/manifest.py
ionyse/ionyweb
train
4
b42a87a44dcea7cf9fba3ff05f185b705ed082e0
[ "super(bottleneck_IR, self).__init__()\nif in_channel == depth:\n self.shortcut_layer = MaxPool2d(1, stride)\nelse:\n self.shortcut_layer = Sequential(Conv2d(in_channel, depth, (1, 1), stride, bias=False), BatchNorm2d(depth))\nself.res_layer = Sequential(BatchNorm2d(in_channel), Conv2d(in_channel, depth, (3, ...
<|body_start_0|> super(bottleneck_IR, self).__init__() if in_channel == depth: self.shortcut_layer = MaxPool2d(1, stride) else: self.shortcut_layer = Sequential(Conv2d(in_channel, depth, (1, 1), stride, bias=False), BatchNorm2d(depth)) self.res_layer = Sequential(...
Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): Output channels. stride (int): Conv2d stride.
bottleneck_IR
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bottleneck_IR: """Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): Output channels. stride (int): Conv2d stride.""" def __init__(self, in_channel, depth, stride): """Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. ...
stack_v2_sparse_classes_75kplus_train_072393
6,054
permissive
[ { "docstring": "Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): Output channels. stride (int): Conv2d stride.", "name": "__init__", "signature": "def __init__(self, in_channel, depth, stride)" }, { "docstring": "Forward function.", "name": "forward",...
2
null
Implement the Python class `bottleneck_IR` described below. Class description: Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): Output channels. stride (int): Conv2d stride. Method signatures and docstrings: - def __init__(self, in_channel, depth, stride): Intermediate Resbloc...
Implement the Python class `bottleneck_IR` described below. Class description: Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): Output channels. stride (int): Conv2d stride. Method signatures and docstrings: - def __init__(self, in_channel, depth, stride): Intermediate Resbloc...
a382f143c0fd20d227e1e5524831ba26a568190d
<|skeleton|> class bottleneck_IR: """Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): Output channels. stride (int): Conv2d stride.""" def __init__(self, in_channel, depth, stride): """Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class bottleneck_IR: """Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): Output channels. stride (int): Conv2d stride.""" def __init__(self, in_channel, depth, stride): """Intermediate Resblock of bottleneck. Args: in_channel (int): Input channels. depth (int): ...
the_stack_v2_python_sparse
mmagic/models/editors/arcface/arcface_modules.py
open-mmlab/mmagic
train
1,370
c6f49a2953acba0dec6b46bd88d0def15d967eb4
[ "super(GradientDescentLearningRule, self).__init__()\nassert learning_rate > 0.0, 'learning_rate should be positive.'\nself.learning_rate = torch.ones(1) * learning_rate\nself.learning_rate.to(device)", "updated_names_weights_dict = dict()\nfor key in names_weights_dict.keys():\n updated_names_weights_dict[key...
<|body_start_0|> super(GradientDescentLearningRule, self).__init__() assert learning_rate > 0.0, 'learning_rate should be positive.' self.learning_rate = torch.ones(1) * learning_rate self.learning_rate.to(device) <|end_body_0|> <|body_start_1|> updated_names_weights_dict = dict...
Simple (stochastic) gradient descent learning rule. For a scalar error function `E(p[0], p_[1] ... )` of some set of potentially multidimensional parameters this attempts to find a local minimum of the loss function by applying updates to each parameter of the form p[i] := p[i] - learning_rate * dE/dp[i] With `learning...
GradientDescentLearningRule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradientDescentLearningRule: """Simple (stochastic) gradient descent learning rule. For a scalar error function `E(p[0], p_[1] ... )` of some set of potentially multidimensional parameters this attempts to find a local minimum of the loss function by applying updates to each parameter of the form...
stack_v2_sparse_classes_75kplus_train_072394
5,727
permissive
[ { "docstring": "Creates a new learning rule object. Args: learning_rate: A postive scalar to scale gradient updates to the parameters by. This needs to be carefully set - if too large the learning dynamic will be unstable and may diverge, while if set too small learning will proceed very slowly.", "name": "...
2
stack_v2_sparse_classes_30k_train_010739
Implement the Python class `GradientDescentLearningRule` described below. Class description: Simple (stochastic) gradient descent learning rule. For a scalar error function `E(p[0], p_[1] ... )` of some set of potentially multidimensional parameters this attempts to find a local minimum of the loss function by applyin...
Implement the Python class `GradientDescentLearningRule` described below. Class description: Simple (stochastic) gradient descent learning rule. For a scalar error function `E(p[0], p_[1] ... )` of some set of potentially multidimensional parameters this attempts to find a local minimum of the loss function by applyin...
2ff0aab6d2c7991e566200d8e4da4b2cbf025a4a
<|skeleton|> class GradientDescentLearningRule: """Simple (stochastic) gradient descent learning rule. For a scalar error function `E(p[0], p_[1] ... )` of some set of potentially multidimensional parameters this attempts to find a local minimum of the loss function by applying updates to each parameter of the form...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GradientDescentLearningRule: """Simple (stochastic) gradient descent learning rule. For a scalar error function `E(p[0], p_[1] ... )` of some set of potentially multidimensional parameters this attempts to find a local minimum of the loss function by applying updates to each parameter of the form p[i] := p[i]...
the_stack_v2_python_sparse
MAML_plus_plus/inner_loop_optimizers.py
mbonto/fewshot_neuroimaging_classification
train
9
6f6231354f84d3e7b2c91e9c4a8055c56ec2ea40
[ "super(FocalLoss, self).__init__()\nself.size_average = size_average\nif isinstance(alpha, list):\n assert len(alpha) == num_classes\n self.alpha = torch.Tensor(alpha)\nelse:\n assert alpha < 1\n self.alpha = torch.zeros(num_classes)\n self.alpha[0] += alpha\n self.alpha[1:] += 1 - alpha\nself.gam...
<|body_start_0|> super(FocalLoss, self).__init__() self.size_average = size_average if isinstance(alpha, list): assert len(alpha) == num_classes self.alpha = torch.Tensor(alpha) else: assert alpha < 1 self.alpha = torch.zeros(num_classes) ...
FocalLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FocalLoss: def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True): """focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本...
stack_v2_sparse_classes_75kplus_train_072395
6,576
no_license
[ { "docstring": "focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本调节参数. retainnet中设置为2 :param num_classes: 类别数量 :param size_average: 损失计算方式,默认取均值", "name": "__...
2
stack_v2_sparse_classes_30k_train_038248
Implement the Python class `FocalLoss` described below. Class description: Implement the FocalLoss class. Method signatures and docstrings: - def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True): focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,...
Implement the Python class `FocalLoss` described below. Class description: Implement the FocalLoss class. Method signatures and docstrings: - def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True): focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,...
4b138537ad35448f65f6695aee68c68ca60c4b7c
<|skeleton|> class FocalLoss: def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True): """focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FocalLoss: def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True): """focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本调节参数. retainne...
the_stack_v2_python_sparse
src/loss/focalloss.py
jimeffry/retinanet-pytorch
train
1
952a8eb34b3771346aeabf99f13c46e7c2c4860f
[ "self.input_size = input_size\nself.fill_value = fill_value\nif isinstance(self.input_size, List) or isinstance(self.input_size, Tuple):\n assert self.input_size[0] == self.input_size[1], 'Input weight and width are not the same.'\n self.input_size = int(self.input_size[0])", "old_h, old_w, _ = image.shape\...
<|body_start_0|> self.input_size = input_size self.fill_value = fill_value if isinstance(self.input_size, List) or isinstance(self.input_size, Tuple): assert self.input_size[0] == self.input_size[1], 'Input weight and width are not the same.' self.input_size = int(self.in...
Preprocess
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preprocess: def __init__(self, input_size, fill_value: int=128): """Initialize parametyers for preprocessing. Parameters ---------- input_size : int or tuple input dimensions of the input image may be tuple of (H, W) or an int fill_value : int Fill-in values for padding areas""" ...
stack_v2_sparse_classes_75kplus_train_072396
8,071
permissive
[ { "docstring": "Initialize parametyers for preprocessing. Parameters ---------- input_size : int or tuple input dimensions of the input image may be tuple of (H, W) or an int fill_value : int Fill-in values for padding areas", "name": "__init__", "signature": "def __init__(self, input_size, fill_value: ...
3
stack_v2_sparse_classes_30k_train_022391
Implement the Python class `Preprocess` described below. Class description: Implement the Preprocess class. Method signatures and docstrings: - def __init__(self, input_size, fill_value: int=128): Initialize parametyers for preprocessing. Parameters ---------- input_size : int or tuple input dimensions of the input i...
Implement the Python class `Preprocess` described below. Class description: Implement the Preprocess class. Method signatures and docstrings: - def __init__(self, input_size, fill_value: int=128): Initialize parametyers for preprocessing. Parameters ---------- input_size : int or tuple input dimensions of the input i...
f59a0db21821f7fe6a3527d26c59fd173e1b514a
<|skeleton|> class Preprocess: def __init__(self, input_size, fill_value: int=128): """Initialize parametyers for preprocessing. Parameters ---------- input_size : int or tuple input dimensions of the input image may be tuple of (H, W) or an int fill_value : int Fill-in values for padding areas""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Preprocess: def __init__(self, input_size, fill_value: int=128): """Initialize parametyers for preprocessing. Parameters ---------- input_size : int or tuple input dimensions of the input image may be tuple of (H, W) or an int fill_value : int Fill-in values for padding areas""" self.input_siz...
the_stack_v2_python_sparse
reader_writer_queue_thread.py
HtutLynn/AsyncCV
train
1
a7669150fc762245c8fb0d68f8df6901ff0b2d8d
[ "storage = get_storage()\nsites = storage.list_sites()\nreturn jsonify(SiteResponseSchema(many=True).dump(sites))", "data = request.get_json()\ntry:\n site = SiteSchema().load(data)\nexcept ValidationError as err:\n return (jsonify({'errors': err.messages}), 400)\nstorage = get_storage()\nsite_id = storage....
<|body_start_0|> storage = get_storage() sites = storage.list_sites() return jsonify(SiteResponseSchema(many=True).dump(sites)) <|end_body_0|> <|body_start_1|> data = request.get_json() try: site = SiteSchema().load(data) except ValidationError as err: ...
AllSitesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllSitesView: def get(self, *args): """--- summary: List sites description: List all sites that the user has access to. tags: - Sites responses: 200: description: A list of sites content: application/json: schema: type: array items: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#...
stack_v2_sparse_classes_75kplus_train_072397
10,882
permissive
[ { "docstring": "--- summary: List sites description: List all sites that the user has access to. tags: - Sites responses: 200: description: A list of sites content: application/json: schema: type: array items: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#/components/responses/401-Unauthorized'", "...
2
stack_v2_sparse_classes_30k_train_027125
Implement the Python class `AllSitesView` described below. Class description: Implement the AllSitesView class. Method signatures and docstrings: - def get(self, *args): --- summary: List sites description: List all sites that the user has access to. tags: - Sites responses: 200: description: A list of sites content:...
Implement the Python class `AllSitesView` described below. Class description: Implement the AllSitesView class. Method signatures and docstrings: - def get(self, *args): --- summary: List sites description: List all sites that the user has access to. tags: - Sites responses: 200: description: A list of sites content:...
280800c73eb7cfd49029462b352887e78f1ff91b
<|skeleton|> class AllSitesView: def get(self, *args): """--- summary: List sites description: List all sites that the user has access to. tags: - Sites responses: 200: description: A list of sites content: application/json: schema: type: array items: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AllSitesView: def get(self, *args): """--- summary: List sites description: List all sites that the user has access to. tags: - Sites responses: 200: description: A list of sites content: application/json: schema: type: array items: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#/components/re...
the_stack_v2_python_sparse
sfa_api/sites.py
SolarArbiter/solarforecastarbiter-api
train
9
be253ce7d07cd3c3ddaa83a409c12f0c513cc5da
[ "user_list = None\nif query == None:\n user_list = User.objects.filter(Q(user_profile__isnull=False))\nelse:\n user_list = User.objects.filter(Q(first_name__icontains=query) | Q(last_name__icontains=query)).distinct()\nreturn user_list", "user_list = None\nif query == None:\n user_list = User.objects.fil...
<|body_start_0|> user_list = None if query == None: user_list = User.objects.filter(Q(user_profile__isnull=False)) else: user_list = User.objects.filter(Q(first_name__icontains=query) | Q(last_name__icontains=query)).distinct() return user_list <|end_body_0|> <|b...
This module contains service classes for performing services related searching user profiles.
UserSearchService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSearchService: """This module contains service classes for performing services related searching user profiles.""" def get_users_by_name(query): """This static method searches for all users with given query in their first name or last name or query as one of their skills.""" ...
stack_v2_sparse_classes_75kplus_train_072398
1,909
permissive
[ { "docstring": "This static method searches for all users with given query in their first name or last name or query as one of their skills.", "name": "get_users_by_name", "signature": "def get_users_by_name(query)" }, { "docstring": "This static method searches for all users with given query as...
3
stack_v2_sparse_classes_30k_train_003373
Implement the Python class `UserSearchService` described below. Class description: This module contains service classes for performing services related searching user profiles. Method signatures and docstrings: - def get_users_by_name(query): This static method searches for all users with given query in their first n...
Implement the Python class `UserSearchService` described below. Class description: This module contains service classes for performing services related searching user profiles. Method signatures and docstrings: - def get_users_by_name(query): This static method searches for all users with given query in their first n...
3ad913e1030da5c4fb0ac4690488a48dec278f3b
<|skeleton|> class UserSearchService: """This module contains service classes for performing services related searching user profiles.""" def get_users_by_name(query): """This static method searches for all users with given query in their first name or last name or query as one of their skills.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserSearchService: """This module contains service classes for performing services related searching user profiles.""" def get_users_by_name(query): """This static method searches for all users with given query in their first name or last name or query as one of their skills.""" user_list...
the_stack_v2_python_sparse
sase/mycraze/services/search.py
SrikrishnanS/ProfilesHub
train
0
dec2f87205f505a6d7bff655506b0bfadae68be9
[ "self.ad_domain_name = ad_domain_name\nself.attribute_common_name = attribute_common_name\nself.attribute_gid = attribute_gid\nself.attribute_member_of = attribute_member_of\nself.attribute_uid = attribute_uid\nself.attribute_user_name = attribute_user_name\nself.auth_type = auth_type\nself.base_distinguished_name ...
<|body_start_0|> self.ad_domain_name = ad_domain_name self.attribute_common_name = attribute_common_name self.attribute_gid = attribute_gid self.attribute_member_of = attribute_member_of self.attribute_uid = attribute_uid self.attribute_user_name = attribute_user_name ...
Implementation of the 'LdapProviderResponse' model. LDAP provider response struct. Attributes: ad_domain_name (string): Specifies the domain name of an Active Directory which is mapped to this LDAP provider attribute_common_name (string): Name of the LDAP attribute used for common name of an object. attribute_gid (stri...
LdapProviderResponse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LdapProviderResponse: """Implementation of the 'LdapProviderResponse' model. LDAP provider response struct. Attributes: ad_domain_name (string): Specifies the domain name of an Active Directory which is mapped to this LDAP provider attribute_common_name (string): Name of the LDAP attribute used f...
stack_v2_sparse_classes_75kplus_train_072399
7,420
permissive
[ { "docstring": "Constructor for the LdapProviderResponse class", "name": "__init__", "signature": "def __init__(self, ad_domain_name=None, attribute_common_name=None, attribute_gid=None, attribute_member_of=None, attribute_uid=None, attribute_user_name=None, auth_type=None, base_distinguished_name=None,...
2
stack_v2_sparse_classes_30k_train_012712
Implement the Python class `LdapProviderResponse` described below. Class description: Implementation of the 'LdapProviderResponse' model. LDAP provider response struct. Attributes: ad_domain_name (string): Specifies the domain name of an Active Directory which is mapped to this LDAP provider attribute_common_name (str...
Implement the Python class `LdapProviderResponse` described below. Class description: Implementation of the 'LdapProviderResponse' model. LDAP provider response struct. Attributes: ad_domain_name (string): Specifies the domain name of an Active Directory which is mapped to this LDAP provider attribute_common_name (str...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class LdapProviderResponse: """Implementation of the 'LdapProviderResponse' model. LDAP provider response struct. Attributes: ad_domain_name (string): Specifies the domain name of an Active Directory which is mapped to this LDAP provider attribute_common_name (string): Name of the LDAP attribute used f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LdapProviderResponse: """Implementation of the 'LdapProviderResponse' model. LDAP provider response struct. Attributes: ad_domain_name (string): Specifies the domain name of an Active Directory which is mapped to this LDAP provider attribute_common_name (string): Name of the LDAP attribute used for common nam...
the_stack_v2_python_sparse
cohesity_management_sdk/models/ldap_provider_response.py
cohesity/management-sdk-python
train
24