blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
3a005c5ad54df10eb57e4795d2ce367a16971efb
[ "self.mode = mode\nself.detection_timeout = detection_timeout\nself.silence_timeout = silence_timeout\nself.speech_threshold = speech_threshold\nself.speech_end_threshold = speech_end_threshold\nself.machine_speech_end_threshold = machine_speech_end_threshold\nself.delay_result = delay_result\nself.callback_url = c...
<|body_start_0|> self.mode = mode self.detection_timeout = detection_timeout self.silence_timeout = silence_timeout self.speech_threshold = speech_threshold self.speech_end_threshold = speech_end_threshold self.machine_speech_end_threshold = machine_speech_end_threshold ...
Implementation of the 'MachineDetectionRequest' model. TODO: type model description here. Attributes: mode (ModeEnum): The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionComplete' callback. If set to 'sync', the 'answer' callback will wait for the machine detection to...
MachineDetectionConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineDetectionConfiguration: """Implementation of the 'MachineDetectionRequest' model. TODO: type model description here. Attributes: mode (ModeEnum): The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionComplete' callback. If set to 'sync', the...
stack_v2_sparse_classes_36k_train_012100
6,854
permissive
[ { "docstring": "Constructor for the MachineDetectionRequest class", "name": "__init__", "signature": "def __init__(self, mode=None, detection_timeout=None, silence_timeout=None, speech_threshold=None, speech_end_threshold=None, machine_speech_end_threshold=None, delay_result=None, callback_url=None, cal...
2
null
Implement the Python class `MachineDetectionConfiguration` described below. Class description: Implementation of the 'MachineDetectionRequest' model. TODO: type model description here. Attributes: mode (ModeEnum): The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionCo...
Implement the Python class `MachineDetectionConfiguration` described below. Class description: Implementation of the 'MachineDetectionRequest' model. TODO: type model description here. Attributes: mode (ModeEnum): The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionCo...
447df3cc8cb7acaf3361d842630c432a9c31ce6e
<|skeleton|> class MachineDetectionConfiguration: """Implementation of the 'MachineDetectionRequest' model. TODO: type model description here. Attributes: mode (ModeEnum): The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionComplete' callback. If set to 'sync', the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MachineDetectionConfiguration: """Implementation of the 'MachineDetectionRequest' model. TODO: type model description here. Attributes: mode (ModeEnum): The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionComplete' callback. If set to 'sync', the 'answer' cal...
the_stack_v2_python_sparse
bandwidth/voice/models/machine_detection_configuration.py
Bandwidth/python-sdk
train
10
0dfeae045626a29e4454ec233aa351bfded982de
[ "check_classification_targets(y)\nlab_enc = LabelEncoder()\nenc_y = lab_enc.fit_transform(y).astype(np.float64, copy=False)\nself.classes_ = lab_enc.classes_\nif self.classes_.shape[0] != self.num_classes:\n raise ValueError('Number of classes defined in configuration file and the classes derived from the data d...
<|body_start_0|> check_classification_targets(y) lab_enc = LabelEncoder() enc_y = lab_enc.fit_transform(y).astype(np.float64, copy=False) self.classes_ = lab_enc.classes_ if self.classes_.shape[0] != self.num_classes: raise ValueError('Number of classes defined in con...
XGBClassifierFLModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XGBClassifierFLModel: def encode_target(self, y): """Converts the input y to the expected dtype and performs a label encoding. Here, we assume that each party has at least one sample of the corresponding class label type for each different classes. :param y: The corresponding target data...
stack_v2_sparse_classes_36k_train_012101
17,389
no_license
[ { "docstring": "Converts the input y to the expected dtype and performs a label encoding. Here, we assume that each party has at least one sample of the corresponding class label type for each different classes. :param y: The corresponding target data from the dataset to encode. :type y: `np.array` :return y: R...
5
stack_v2_sparse_classes_30k_train_020126
Implement the Python class `XGBClassifierFLModel` described below. Class description: Implement the XGBClassifierFLModel class. Method signatures and docstrings: - def encode_target(self, y): Converts the input y to the expected dtype and performs a label encoding. Here, we assume that each party has at least one sam...
Implement the Python class `XGBClassifierFLModel` described below. Class description: Implement the XGBClassifierFLModel class. Method signatures and docstrings: - def encode_target(self, y): Converts the input y to the expected dtype and performs a label encoding. Here, we assume that each party has at least one sam...
a4cd429484e857b849df08d93688d35e632b3e29
<|skeleton|> class XGBClassifierFLModel: def encode_target(self, y): """Converts the input y to the expected dtype and performs a label encoding. Here, we assume that each party has at least one sample of the corresponding class label type for each different classes. :param y: The corresponding target data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XGBClassifierFLModel: def encode_target(self, y): """Converts the input y to the expected dtype and performs a label encoding. Here, we assume that each party has at least one sample of the corresponding class label type for each different classes. :param y: The corresponding target data from the data...
the_stack_v2_python_sparse
venv/Lib/site-packages/ibmfl/model/xgb_fl_model.py
yusufcet/healty-hearts
train
0
8d6a1029cf5e4f9797ad21c8afc18b99c3dc36a5
[ "self.path = path\nself.name = os.path.basename(path)\nself.detector_path, self.description = self.get_data()", "detector_path = None\ndescription = ''\nfor name in os.listdir(self.path):\n suffix = pathlib.Path(os.path.join(self.path, name)).suffix\n prefix = pathlib.Path(os.path.join(self.path, name)).ste...
<|body_start_0|> self.path = path self.name = os.path.basename(path) self.detector_path, self.description = self.get_data() <|end_body_0|> <|body_start_1|> detector_path = None description = '' for name in os.listdir(self.path): suffix = pathlib.Path(os.path....
This class holds the data and path of the event detector.
EventDetector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventDetector: """This class holds the data and path of the event detector.""" def __init__(self, path): """:param path: the inserted path of the event detector.""" <|body_0|> def get_data(self): """:return: the file path, a sample image and a description of the ...
stack_v2_sparse_classes_36k_train_012102
1,161
permissive
[ { "docstring": ":param path: the inserted path of the event detector.", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": ":return: the file path, a sample image and a description of the event detector.", "name": "get_data", "signature": "def get_data(self)" ...
2
stack_v2_sparse_classes_30k_train_000192
Implement the Python class `EventDetector` described below. Class description: This class holds the data and path of the event detector. Method signatures and docstrings: - def __init__(self, path): :param path: the inserted path of the event detector. - def get_data(self): :return: the file path, a sample image and ...
Implement the Python class `EventDetector` described below. Class description: This class holds the data and path of the event detector. Method signatures and docstrings: - def __init__(self, path): :param path: the inserted path of the event detector. - def get_data(self): :return: the file path, a sample image and ...
8d03f5f7c85ccc113a0561c58b7e3bf76e888f03
<|skeleton|> class EventDetector: """This class holds the data and path of the event detector.""" def __init__(self, path): """:param path: the inserted path of the event detector.""" <|body_0|> def get_data(self): """:return: the file path, a sample image and a description of the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventDetector: """This class holds the data and path of the event detector.""" def __init__(self, path): """:param path: the inserted path of the event detector.""" self.path = path self.name = os.path.basename(path) self.detector_path, self.description = self.get_data() ...
the_stack_v2_python_sparse
entities/event_detector.py
biktokle/Automated-Microscope
train
0
30147ad08d1449da20967b35b58fb82ef743d49f
[ "_AgentBase.__init__(self, reactor, pool)\nendpoint_factory = ReplicationEndpointFactory(reactor, instance_map, contextFactory)\nself._endpointFactory = endpoint_factory", "parsedURI = URI.fromBytes(uri)\ntry:\n endpoint = self._endpointFactory.endpointForURI(parsedURI)\nexcept SchemeNotSupported:\n return ...
<|body_start_0|> _AgentBase.__init__(self, reactor, pool) endpoint_factory = ReplicationEndpointFactory(reactor, instance_map, contextFactory) self._endpointFactory = endpoint_factory <|end_body_0|> <|body_start_1|> parsedURI = URI.fromBytes(uri) try: endpoint = self...
Client for connecting to replication endpoints via HTTP and HTTPS. Much of this code is copied from Twisted's twisted.web.client.Agent.
ReplicationAgent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReplicationAgent: """Client for connecting to replication endpoints via HTTP and HTTPS. Much of this code is copied from Twisted's twisted.web.client.Agent.""" def __init__(self, reactor: ISynapseReactor, instance_map: Dict[str, InstanceLocationConfig], contextFactory: IPolicyForHTTPS, conne...
stack_v2_sparse_classes_36k_train_012103
6,722
permissive
[ { "docstring": "Create a ReplicationAgent. Args: reactor: A reactor for this Agent to place outgoing connections. contextFactory: A factory for TLS contexts, to control the verification parameters of OpenSSL. The default is to use a BrowserLikePolicyForHTTPS, so unless you have special requirements you can leav...
2
stack_v2_sparse_classes_30k_train_014205
Implement the Python class `ReplicationAgent` described below. Class description: Client for connecting to replication endpoints via HTTP and HTTPS. Much of this code is copied from Twisted's twisted.web.client.Agent. Method signatures and docstrings: - def __init__(self, reactor: ISynapseReactor, instance_map: Dict[...
Implement the Python class `ReplicationAgent` described below. Class description: Client for connecting to replication endpoints via HTTP and HTTPS. Much of this code is copied from Twisted's twisted.web.client.Agent. Method signatures and docstrings: - def __init__(self, reactor: ISynapseReactor, instance_map: Dict[...
d35bed8369514fe727b4fe1afb68f48cc8b2655a
<|skeleton|> class ReplicationAgent: """Client for connecting to replication endpoints via HTTP and HTTPS. Much of this code is copied from Twisted's twisted.web.client.Agent.""" def __init__(self, reactor: ISynapseReactor, instance_map: Dict[str, InstanceLocationConfig], contextFactory: IPolicyForHTTPS, conne...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReplicationAgent: """Client for connecting to replication endpoints via HTTP and HTTPS. Much of this code is copied from Twisted's twisted.web.client.Agent.""" def __init__(self, reactor: ISynapseReactor, instance_map: Dict[str, InstanceLocationConfig], contextFactory: IPolicyForHTTPS, connectTimeout: Op...
the_stack_v2_python_sparse
synapse/http/replicationagent.py
matrix-org/synapse
train
12,215
1c33403e20decec3471fab228037b980e1532ad2
[ "if InChannel != growRate:\n self.InConv = op.Conv2d(in_channels=InChannel, out_channels=growRate, kernel_size=1, stride=1, padding=0)\n self.make_conv(nConvLayers, growRate, OutChannel)\nelse:\n self.make_conv(nConvLayers, growRate, OutChannel)", "convs = []\nfor c in range(nConvLayers):\n conv = Blo...
<|body_start_0|> if InChannel != growRate: self.InConv = op.Conv2d(in_channels=InChannel, out_channels=growRate, kernel_size=1, stride=1, padding=0) self.make_conv(nConvLayers, growRate, OutChannel) else: self.make_conv(nConvLayers, growRate, OutChannel) <|end_body_0|...
Create InConv_Group SearchSpace.
InConv_Group
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InConv_Group: """Create InConv_Group SearchSpace.""" def constructor(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Create InConv_Group Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel...
stack_v2_sparse_classes_36k_train_012104
16,263
permissive
[ { "docstring": "Create InConv_Group Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRate: growth rate of block :type growRate: int :param nConvLayers: the number of convlution layer :type nConvLayers: int :param k...
2
null
Implement the Python class `InConv_Group` described below. Class description: Create InConv_Group SearchSpace. Method signatures and docstrings: - def constructor(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Create InConv_Group Block. :param InChannel: channel number of input :type InChannel: int :pa...
Implement the Python class `InConv_Group` described below. Class description: Create InConv_Group SearchSpace. Method signatures and docstrings: - def constructor(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Create InConv_Group Block. :param InChannel: channel number of input :type InChannel: int :pa...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class InConv_Group: """Create InConv_Group SearchSpace.""" def constructor(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Create InConv_Group Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InConv_Group: """Create InConv_Group SearchSpace.""" def constructor(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Create InConv_Group Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param ...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/fine_grained_space/blocks/sr.py
Huawei-Ascend/modelzoo
train
1
a853f6c0349144676faabd315be16355aeb06b4a
[ "i, count = (0, 1)\nl = len(nums)\nwhile i < l:\n num = nums[i]\n if 1 <= num < l and nums[num - 1] != nums[i]:\n nums[num - 1], nums[i] = (nums[i], nums[num - 1])\n else:\n i += 1\n while count - 1 < l and nums[count - 1] == count:\n count += 1\nreturn count", "n = len(nu...
<|body_start_0|> i, count = (0, 1) l = len(nums) while i < l: num = nums[i] if 1 <= num < l and nums[num - 1] != nums[i]: nums[num - 1], nums[i] = (nums[i], nums[num - 1]) else: i += 1 while count - 1 < l and num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstMissingPositive_solution_1(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove...
stack_v2_sparse_classes_36k_train_012105
9,733
no_license
[ { "docstring": ":type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove the rest. 2. we can use the array index as the hash to restore the frequency of each nu...
3
stack_v2_sparse_classes_30k_train_017576
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive_solution_1(self, nums: List[int]) -> int: :type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive mu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive_solution_1(self, nums: List[int]) -> int: :type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive mu...
f2621cd76822a922c49b60f32931f26cce1c571d
<|skeleton|> class Solution: def firstMissingPositive_solution_1(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstMissingPositive_solution_1(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove the rest. 2. ...
the_stack_v2_python_sparse
Arrays/032_leetcode_P_041_FirstMissingPositive/Solution.py
Keshav1506/competitive_programming
train
0
94c4848ee9abfedf54b9bc281ac420e9cabe4e93
[ "zero = 0\nfor i, n in enumerate(nums):\n if n == 0:\n continue\n nums[zero], nums[i] = (nums[i], nums[zero])\n zero += 1", "snowball_size = 0\nfor i, n in enumerate(nums):\n if n == 0:\n snowball_size += 1\n else:\n nums[i], nums[i - snowball_size] = (0, n)" ]
<|body_start_0|> zero = 0 for i, n in enumerate(nums): if n == 0: continue nums[zero], nums[i] = (nums[i], nums[zero]) zero += 1 <|end_body_0|> <|body_start_1|> snowball_size = 0 for i, n in enumerate(nums): if n == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtyp""" <|body_0|> def move_zeroes_by_snowball(self, nums): """雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0""" <|body_1|> <|end_skeleton|> <|body_start_0|> zero = 0 ...
stack_v2_sparse_classes_36k_train_012106
1,055
no_license
[ { "docstring": ":type nums: List[int] :rtyp", "name": "move_zeroes", "signature": "def move_zeroes(self, nums)" }, { "docstring": "雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0", "name": "move_zeroes_by_snowball", "signature": "def move_zeroes_by_snowball(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def move_zeroes(self, nums): :type nums: List[int] :rtyp - def move_zeroes_by_snowball(self, nums): 雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def move_zeroes(self, nums): :type nums: List[int] :rtyp - def move_zeroes_by_snowball(self, nums): 雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0 <|skeleton|> class...
2b7f4a9fefbfd358f8ff31362d60e2007641ca29
<|skeleton|> class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtyp""" <|body_0|> def move_zeroes_by_snowball(self, nums): """雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtyp""" zero = 0 for i, n in enumerate(nums): if n == 0: continue nums[zero], nums[i] = (nums[i], nums[zero]) zero += 1 def move_zeroes_by_snowball(self, nums): ...
the_stack_v2_python_sparse
Week_01/G20190343020166/LeetCode_283_0166.py
algorithm005-class01/algorithm005-class01
train
27
6a2daec0823f97ea5e6b50cf3e544791ff3d8998
[ "if target in nums:\n return nums.index(target)\nelse:\n for i in range(len(nums)):\n if nums[i] > target:\n return i\nreturn len(nums)", "left, right = (0, len(nums) - 1)\nif nums[right] < target:\n return len(nums)\nelse:\n while left <= right:\n mid = (left + right) // 2\n ...
<|body_start_0|> if target in nums: return nums.index(target) else: for i in range(len(nums)): if nums[i] > target: return i return len(nums) <|end_body_0|> <|body_start_1|> left, right = (0, len(nums) - 1) if nums[righ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert(self, nums, target): """常规版本""" <|body_0|> def searchInsert2(self, nums, target): """二分搜索版本""" <|body_1|> <|end_skeleton|> <|body_start_0|> if target in nums: return nums.index(target) else: ...
stack_v2_sparse_classes_36k_train_012107
899
no_license
[ { "docstring": "常规版本", "name": "searchInsert", "signature": "def searchInsert(self, nums, target)" }, { "docstring": "二分搜索版本", "name": "searchInsert2", "signature": "def searchInsert2(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_train_008177
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): 常规版本 - def searchInsert2(self, nums, target): 二分搜索版本
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): 常规版本 - def searchInsert2(self, nums, target): 二分搜索版本 <|skeleton|> class Solution: def searchInsert(self, nums, target): """常规版...
04810f2603ef6e4e5627ab64a5d4cd8678d429ac
<|skeleton|> class Solution: def searchInsert(self, nums, target): """常规版本""" <|body_0|> def searchInsert2(self, nums, target): """二分搜索版本""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsert(self, nums, target): """常规版本""" if target in nums: return nums.index(target) else: for i in range(len(nums)): if nums[i] > target: return i return len(nums) def searchInsert2(self, nums,...
the_stack_v2_python_sparse
leetcode/35_ 搜索插入位置.py
Rsj-Python/project
train
0
12a34f6fcb6b0bd7d129ceff3f8d3d5c170484a8
[ "super(VolumeStagingWorkflow, self).__init__(__name__, **opts)\nself.workflow = self._create_workflow()\n'\\n The staging workflow sequence described in\\n :class:`qipipe.pipeline.staging.StagingWorkflow`.\\n '", "input_spec = self.workflow.get_node('input_spec')\ninput_spec.inputs.collection...
<|body_start_0|> super(VolumeStagingWorkflow, self).__init__(__name__, **opts) self.workflow = self._create_workflow() '\n The staging workflow sequence described in\n :class:`qipipe.pipeline.staging.StagingWorkflow`.\n ' <|end_body_0|> <|body_start_1|> input_spec =...
The StagingWorkflow class builds and executes the staging Nipype workflow. The staging workflow includes the following steps: - Group the input DICOM images into volume. - Fix each input DICOM file header using the :class:`qipipe.interfaces.fix_dicom.FixDicom` interface. - Compress each corrected DICOM file. - Upload e...
VolumeStagingWorkflow
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VolumeStagingWorkflow: """The StagingWorkflow class builds and executes the staging Nipype workflow. The staging workflow includes the following steps: - Group the input DICOM images into volume. - Fix each input DICOM file header using the :class:`qipipe.interfaces.fix_dicom.FixDicom` interface....
stack_v2_sparse_classes_36k_train_012108
26,347
permissive
[ { "docstring": "If the optional configuration file is specified, then the workflow settings in that file override the default settings. :param opts: the :class:`qipipe.pipeline.workflow_base.WorkflowBase` initializer keyword arguments", "name": "__init__", "signature": "def __init__(self, **opts)" }, ...
3
stack_v2_sparse_classes_30k_train_019387
Implement the Python class `VolumeStagingWorkflow` described below. Class description: The StagingWorkflow class builds and executes the staging Nipype workflow. The staging workflow includes the following steps: - Group the input DICOM images into volume. - Fix each input DICOM file header using the :class:`qipipe.in...
Implement the Python class `VolumeStagingWorkflow` described below. Class description: The StagingWorkflow class builds and executes the staging Nipype workflow. The staging workflow includes the following steps: - Group the input DICOM images into volume. - Fix each input DICOM file header using the :class:`qipipe.in...
5c468bb5e53f87bf280b0abcd4b5321068a27cc3
<|skeleton|> class VolumeStagingWorkflow: """The StagingWorkflow class builds and executes the staging Nipype workflow. The staging workflow includes the following steps: - Group the input DICOM images into volume. - Fix each input DICOM file header using the :class:`qipipe.interfaces.fix_dicom.FixDicom` interface....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VolumeStagingWorkflow: """The StagingWorkflow class builds and executes the staging Nipype workflow. The staging workflow includes the following steps: - Group the input DICOM images into volume. - Fix each input DICOM file header using the :class:`qipipe.interfaces.fix_dicom.FixDicom` interface. - Compress e...
the_stack_v2_python_sparse
qipipe/pipeline/staging.py
ohsu-qin/qipipe
train
0
c051275ca47b9101d783269539d6b03c1b6b7a11
[ "end = res = 0\nwhile end < T:\n tmp = max([r for l, r in clips if l <= end] or [0])\n if tmp == end:\n return -1\n end = tmp\n res += 1\nreturn res", "T += 1\ndp = [-1] * T\ndp[0] = 0\nclips = sorted(clips, key=lambda a: a[0])\nfor c in clips:\n if c[0] >= T:\n break\n if dp[c[0]]...
<|body_start_0|> end = res = 0 while end < T: tmp = max([r for l, r in clips if l <= end] or [0]) if tmp == end: return -1 end = tmp res += 1 return res <|end_body_0|> <|body_start_1|> T += 1 dp = [-1] * T d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_0|> def videoStitching2(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_1|> def videoStitching3(self, cli...
stack_v2_sparse_classes_36k_train_012109
3,920
no_license
[ { "docstring": ":type clips: List[List[int]] :type T: int :rtype: int", "name": "videoStitching", "signature": "def videoStitching(self, clips, T)" }, { "docstring": ":type clips: List[List[int]] :type T: int :rtype: int", "name": "videoStitching2", "signature": "def videoStitching2(self...
4
stack_v2_sparse_classes_30k_train_008228
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching(self, clips, T): :type clips: List[List[int]] :type T: int :rtype: int - def videoStitching2(self, clips, T): :type clips: List[List[int]] :type T: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching(self, clips, T): :type clips: List[List[int]] :type T: int :rtype: int - def videoStitching2(self, clips, T): :type clips: List[List[int]] :type T: int :rtype:...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_0|> def videoStitching2(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_1|> def videoStitching3(self, cli...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" end = res = 0 while end < T: tmp = max([r for l, r in clips if l <= end] or [0]) if tmp == end: return -1 end = tmp ...
the_stack_v2_python_sparse
1024_视频拼接.py
lovehhf/LeetCode
train
0
1552b956f077527d5298877a4e1597a5e9a78d57
[ "self.char_map = string.ascii_lowercase\nif key == '':\n key = ''.join((random.choice(self.char_map) for _ in range(100)))\nself.key = key.lower()", "key = self.key\nwhile len(key) < len(buf):\n key += self.key\nreturn key", "try:\n ndx_plain = self.char_map.index(plain.lower())\n ndx_key = self.cha...
<|body_start_0|> self.char_map = string.ascii_lowercase if key == '': key = ''.join((random.choice(self.char_map) for _ in range(100))) self.key = key.lower() <|end_body_0|> <|body_start_1|> key = self.key while len(key) < len(buf): key += self.key ...
implement a simple substitution cipher encode/decode mechanism
Cipher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cipher: """implement a simple substitution cipher encode/decode mechanism""" def __init__(self, key=''): """init the key, make up a 100char random key if not specified""" <|body_0|> def lengthen_key(self, buf): """lengthen key to be as long as buffer""" <...
stack_v2_sparse_classes_36k_train_012110
2,060
no_license
[ { "docstring": "init the key, make up a 100char random key if not specified", "name": "__init__", "signature": "def __init__(self, key='')" }, { "docstring": "lengthen key to be as long as buffer", "name": "lengthen_key", "signature": "def lengthen_key(self, buf)" }, { "docstring...
6
null
Implement the Python class `Cipher` described below. Class description: implement a simple substitution cipher encode/decode mechanism Method signatures and docstrings: - def __init__(self, key=''): init the key, make up a 100char random key if not specified - def lengthen_key(self, buf): lengthen key to be as long a...
Implement the Python class `Cipher` described below. Class description: implement a simple substitution cipher encode/decode mechanism Method signatures and docstrings: - def __init__(self, key=''): init the key, make up a 100char random key if not specified - def lengthen_key(self, buf): lengthen key to be as long a...
be0e2f635a7558f56c61bc0b36c6146b01d1e6e6
<|skeleton|> class Cipher: """implement a simple substitution cipher encode/decode mechanism""" def __init__(self, key=''): """init the key, make up a 100char random key if not specified""" <|body_0|> def lengthen_key(self, buf): """lengthen key to be as long as buffer""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cipher: """implement a simple substitution cipher encode/decode mechanism""" def __init__(self, key=''): """init the key, make up a 100char random key if not specified""" self.char_map = string.ascii_lowercase if key == '': key = ''.join((random.choice(self.char_map) f...
the_stack_v2_python_sparse
all_data/exercism_data/python/simple-cipher/7c01cf41b0f24cea85c35bdef068d4ef.py
itsolutionscorp/AutoStyle-Clustering
train
4
bc8a35fbaec6f622cb69d1508c583f4d9349e342
[ "self.temp_type = temp_type\nself.convert_to = convert_to\nself.temp = temp", "if self.temp_type == 'C' and self.convert_to == 'F':\n new_temp = self.temp * 9 / 5 + 32\nelif self.temp_type == 'F' and self.convert_to == 'C':\n new_temp = (self.temp - 32) * 5 / 9\nreturn new_temp" ]
<|body_start_0|> self.temp_type = temp_type self.convert_to = convert_to self.temp = temp <|end_body_0|> <|body_start_1|> if self.temp_type == 'C' and self.convert_to == 'F': new_temp = self.temp * 9 / 5 + 32 elif self.temp_type == 'F' and self.convert_to == 'C': ...
Represents a temperature conversion calculator Attributes: TEMP_SCALES: Constant. Defines the temperatures scales usable by the class CONVERT_SCALES: Constant. Map of value to convert to temp_type: The scale in which the user enters a temperature to convert convert_to: The scale the temperature should be converted to t...
TempConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempConverter: """Represents a temperature conversion calculator Attributes: TEMP_SCALES: Constant. Defines the temperatures scales usable by the class CONVERT_SCALES: Constant. Map of value to convert to temp_type: The scale in which the user enters a temperature to convert convert_to: The scale...
stack_v2_sparse_classes_36k_train_012111
2,431
no_license
[ { "docstring": "Initializes the class", "name": "__init__", "signature": "def __init__(self, temp_type=None, convert_to=None, temp=None)" }, { "docstring": "Converts from one temperature scale to another The formulas to convert from Celsius (C) to Fahrenheit (F) and vice versa are shown below: C...
2
null
Implement the Python class `TempConverter` described below. Class description: Represents a temperature conversion calculator Attributes: TEMP_SCALES: Constant. Defines the temperatures scales usable by the class CONVERT_SCALES: Constant. Map of value to convert to temp_type: The scale in which the user enters a tempe...
Implement the Python class `TempConverter` described below. Class description: Represents a temperature conversion calculator Attributes: TEMP_SCALES: Constant. Defines the temperatures scales usable by the class CONVERT_SCALES: Constant. Map of value to convert to temp_type: The scale in which the user enters a tempe...
218894fbad8ac3389003ce7321fd4c4020239fd6
<|skeleton|> class TempConverter: """Represents a temperature conversion calculator Attributes: TEMP_SCALES: Constant. Defines the temperatures scales usable by the class CONVERT_SCALES: Constant. Map of value to convert to temp_type: The scale in which the user enters a temperature to convert convert_to: The scale...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TempConverter: """Represents a temperature conversion calculator Attributes: TEMP_SCALES: Constant. Defines the temperatures scales usable by the class CONVERT_SCALES: Constant. Map of value to convert to temp_type: The scale in which the user enters a temperature to convert convert_to: The scale the temperat...
the_stack_v2_python_sparse
challenges/c18_TemperatureConverter/temp_convert/temp_convert.py
andrew-rietz/FiftySeven_Coding_Challenges
train
0
a226ac26d353ffc140c0d5c0e6f4f124ba8fb790
[ "self.ax_kw.update(kwargs)\nDynaPlotBackTest.__init__(self, fig=fig, ax=ax, size=size, **self.ax_kw)\nself.set_axes()\nself.ax2 = self.ax.twinx()", "if clear:\n self.clear()\n self.ax2.clear()\nself.h_test = self.ax.plot(test, **self.test_plot_kw)\nself.h_eval = self.ax2.plot(eval, **self.eval_plot_kw)\nsel...
<|body_start_0|> self.ax_kw.update(kwargs) DynaPlotBackTest.__init__(self, fig=fig, ax=ax, size=size, **self.ax_kw) self.set_axes() self.ax2 = self.ax.twinx() <|end_body_0|> <|body_start_1|> if clear: self.clear() self.ax2.clear() self.h_test = se...
Plot dynamically the performance values. Attributes ---------- fig : matplotlib.figure.Figure Figure to display backtest. ax : matplotlib.axes Axe(s) to display a part of backtest. ax_kwargs : dict Parameters of matplotlib axes containing title, ylabel, xlabel, yscale, xscale and ticks_params. Methods ------- plot set_...
DynaPlotPerf
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynaPlotPerf: """Plot dynamically the performance values. Attributes ---------- fig : matplotlib.figure.Figure Figure to display backtest. ax : matplotlib.axes Axe(s) to display a part of backtest. ax_kwargs : dict Parameters of matplotlib axes containing title, ylabel, xlabel, yscale, xscale and...
stack_v2_sparse_classes_36k_train_012112
21,693
permissive
[ { "docstring": "Initialize method. Parameters ---------- fig : matplotlib.figure.Figure, optional Figure to display backtest. ax : matplotlib.axes, optional Axe(s) to display a part of backtest. size : tuple, optional Size of figure, default is (9, 6) kwargs : dict, optional Axes configuration, cf matplotlib do...
3
stack_v2_sparse_classes_30k_train_015282
Implement the Python class `DynaPlotPerf` described below. Class description: Plot dynamically the performance values. Attributes ---------- fig : matplotlib.figure.Figure Figure to display backtest. ax : matplotlib.axes Axe(s) to display a part of backtest. ax_kwargs : dict Parameters of matplotlib axes containing ti...
Implement the Python class `DynaPlotPerf` described below. Class description: Plot dynamically the performance values. Attributes ---------- fig : matplotlib.figure.Figure Figure to display backtest. ax : matplotlib.axes Axe(s) to display a part of backtest. ax_kwargs : dict Parameters of matplotlib axes containing ti...
b7e9bfce52fc5d732f340348945bde3b514f5a3a
<|skeleton|> class DynaPlotPerf: """Plot dynamically the performance values. Attributes ---------- fig : matplotlib.figure.Figure Figure to display backtest. ax : matplotlib.axes Axe(s) to display a part of backtest. ax_kwargs : dict Parameters of matplotlib axes containing title, ylabel, xlabel, yscale, xscale and...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynaPlotPerf: """Plot dynamically the performance values. Attributes ---------- fig : matplotlib.figure.Figure Figure to display backtest. ax : matplotlib.axes Axe(s) to display a part of backtest. ax_kwargs : dict Parameters of matplotlib axes containing title, ylabel, xlabel, yscale, xscale and ticks_params...
the_stack_v2_python_sparse
fynance/backtest/dynamic_plot_backtest.py
ArthurBernard/Fynance
train
22
6fb8102d093237d7fae68bf6523a4e94eb2c7044
[ "self.k = k\nself.kheap = []\nheapq.heapify(self.kheap)\nfor i in nums:\n self.add(i)", "heapq.heappush(self.kheap, val)\nif len(self.kheap) > self.k:\n heapq.heappop(self.kheap)\nreturn self.kheap[0]" ]
<|body_start_0|> self.k = k self.kheap = [] heapq.heapify(self.kheap) for i in nums: self.add(i) <|end_body_0|> <|body_start_1|> heapq.heappush(self.kheap, val) if len(self.kheap) > self.k: heapq.heappop(self.kheap) return self.kheap[0] <|...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.kheap = [] heapq.heapify(s...
stack_v2_sparse_classes_36k_train_012113
650
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_004948
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
70d8827f430b484fd3407001e02107b2545ef787
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.kheap = [] heapq.heapify(self.kheap) for i in nums: self.add(i) def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.kh...
the_stack_v2_python_sparse
leetcode/algorithms/heap/kth-largest-element-in-a-stream.py
AnujPancholi/codingQuestionSolutions
train
1
2ec589c14498750098724158d44fc12a80ec5260
[ "BasePoller.__init__(self, config, generator)\nself.couch = None\nself._query = '/_stats'\nself._setUp()", "try:\n couchURL = getattr(self.config, 'couchURL', None)\n if not couchURL:\n raise Exception(\"Configuration value 'couchURL' missing, can't connect to CouchDB.\")\n self.couch = CouchServe...
<|body_start_0|> BasePoller.__init__(self, config, generator) self.couch = None self._query = '/_stats' self._setUp() <|end_body_0|> <|body_start_1|> try: couchURL = getattr(self.config, 'couchURL', None) if not couchURL: raise Exception("...
Polling CouchDb statistics values - number of status error codes (configurable).
CouchErrorsPoller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CouchErrorsPoller: """Polling CouchDb statistics values - number of status error codes (configurable).""" def __init__(self, config, generator): """couch - instance of CouchServer class""" <|body_0|> def _setUp(self): """Instantiate CouchServer reference. Test co...
stack_v2_sparse_classes_36k_train_012114
9,060
no_license
[ { "docstring": "couch - instance of CouchServer class", "name": "__init__", "signature": "def __init__(self, config, generator)" }, { "docstring": "Instantiate CouchServer reference. Test connection with CouchDB (first connect and retrieve attempt).", "name": "_setUp", "signature": "def ...
4
stack_v2_sparse_classes_30k_train_004823
Implement the Python class `CouchErrorsPoller` described below. Class description: Polling CouchDb statistics values - number of status error codes (configurable). Method signatures and docstrings: - def __init__(self, config, generator): couch - instance of CouchServer class - def _setUp(self): Instantiate CouchServ...
Implement the Python class `CouchErrorsPoller` described below. Class description: Polling CouchDb statistics values - number of status error codes (configurable). Method signatures and docstrings: - def __init__(self, config, generator): couch - instance of CouchServer class - def _setUp(self): Instantiate CouchServ...
f4cb398de940560e40491ba676b704e1489d4682
<|skeleton|> class CouchErrorsPoller: """Polling CouchDb statistics values - number of status error codes (configurable).""" def __init__(self, config, generator): """couch - instance of CouchServer class""" <|body_0|> def _setUp(self): """Instantiate CouchServer reference. Test co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CouchErrorsPoller: """Polling CouchDb statistics values - number of status error codes (configurable).""" def __init__(self, config, generator): """couch - instance of CouchServer class""" BasePoller.__init__(self, config, generator) self.couch = None self._query = '/_stat...
the_stack_v2_python_sparse
src/python/WMComponent/AlertGenerator/Pollers/Couch.py
PerilousApricot/WMCore
train
1
1a4ee4664525da3082e070eaa359ef95c3c63e50
[ "super(FactorizedReduce, self).__init__()\nif desc.channel_out % 2 != 0:\n raise Exception('channel_out must be divided by 2.')\naffine = desc.get('affine', True)\nself.relu = nn.ReLU(inplace=False)\nself.conv1 = nn.Conv2d(desc.channel_in, desc.channel_out // 2, 1, stride=2, padding=0, bias=False)\nself.conv2 = ...
<|body_start_0|> super(FactorizedReduce, self).__init__() if desc.channel_out % 2 != 0: raise Exception('channel_out must be divided by 2.') affine = desc.get('affine', True) self.relu = nn.ReLU(inplace=False) self.conv1 = nn.Conv2d(desc.channel_in, desc.channel_out /...
Class of Factorized Reduce operation. :param desc: description of FactorizedReduce :type desc: Config
FactorizedReduce
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactorizedReduce: """Class of Factorized Reduce operation. :param desc: description of FactorizedReduce :type desc: Config""" def __init__(self, desc): """Init FactorizedReduce.""" <|body_0|> def forward(self, x): """Forward function of FactorizedReduce.""" ...
stack_v2_sparse_classes_36k_train_012115
5,395
permissive
[ { "docstring": "Init FactorizedReduce.", "name": "__init__", "signature": "def __init__(self, desc)" }, { "docstring": "Forward function of FactorizedReduce.", "name": "forward", "signature": "def forward(self, x)" } ]
2
null
Implement the Python class `FactorizedReduce` described below. Class description: Class of Factorized Reduce operation. :param desc: description of FactorizedReduce :type desc: Config Method signatures and docstrings: - def __init__(self, desc): Init FactorizedReduce. - def forward(self, x): Forward function of Facto...
Implement the Python class `FactorizedReduce` described below. Class description: Class of Factorized Reduce operation. :param desc: description of FactorizedReduce :type desc: Config Method signatures and docstrings: - def __init__(self, desc): Init FactorizedReduce. - def forward(self, x): Forward function of Facto...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class FactorizedReduce: """Class of Factorized Reduce operation. :param desc: description of FactorizedReduce :type desc: Config""" def __init__(self, desc): """Init FactorizedReduce.""" <|body_0|> def forward(self, x): """Forward function of FactorizedReduce.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FactorizedReduce: """Class of Factorized Reduce operation. :param desc: description of FactorizedReduce :type desc: Config""" def __init__(self, desc): """Init FactorizedReduce.""" super(FactorizedReduce, self).__init__() if desc.channel_out % 2 != 0: raise Exception('...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/networks/pytorch/blocks/operations.py
Huawei-Ascend/modelzoo
train
1
120dab200c3109aededeffda58951351287bed1e
[ "returned = super().__init__(*args, **kwargs)\nnew_fields = OrderedDict()\nfor symptom in SYMPTOM_CHOICES:\n if symptom[0] not in self.initial:\n self.initial[symptom[0]] = 0\n new_fields[symptom[0]] = forms.IntegerField(required=False, min_value=min([x[0] for x in SYMPTOM_INTENSITY_CHOICES]), max_valu...
<|body_start_0|> returned = super().__init__(*args, **kwargs) new_fields = OrderedDict() for symptom in SYMPTOM_CHOICES: if symptom[0] not in self.initial: self.initial[symptom[0]] = 0 new_fields[symptom[0]] = forms.IntegerField(required=False, min_value=m...
SymptomReportForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SymptomReportForm: def __init__(self, *args, **kwargs): """Add fields to the form for each potential symptom. This reorders to place the symptom list first, in the order of SYMPTOM_CHOICES. The value is initialized to 0 if none is provided.""" <|body_0|> def save(self): ...
stack_v2_sparse_classes_36k_train_012116
2,503
permissive
[ { "docstring": "Add fields to the form for each potential symptom. This reorders to place the symptom list first, in the order of SYMPTOM_CHOICES. The value is initialized to 0 if none is provided.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Add sa...
2
null
Implement the Python class `SymptomReportForm` described below. Class description: Implement the SymptomReportForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Add fields to the form for each potential symptom. This reorders to place the symptom list first, in the order of SYMPTOM_C...
Implement the Python class `SymptomReportForm` described below. Class description: Implement the SymptomReportForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Add fields to the form for each potential symptom. This reorders to place the symptom list first, in the order of SYMPTOM_C...
3ee9bdefbd567299b27bb22f0bf35d64f7764b3a
<|skeleton|> class SymptomReportForm: def __init__(self, *args, **kwargs): """Add fields to the form for each potential symptom. This reorders to place the symptom list first, in the order of SYMPTOM_CHOICES. The value is initialized to 0 if none is provided.""" <|body_0|> def save(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SymptomReportForm: def __init__(self, *args, **kwargs): """Add fields to the form for each potential symptom. This reorders to place the symptom list first, in the order of SYMPTOM_CHOICES. The value is initialized to 0 if none is provided.""" returned = super().__init__(*args, **kwargs) ...
the_stack_v2_python_sparse
reports/forms.py
OpenHumans/quantified-flu
train
18
6f446e2ef3f403c60ff5f7f25eb434eea7ca3343
[ "if not root:\n return ''\nrt = []\nstk = [root]\nwhile stk:\n newstk = []\n while stk:\n p = stk.pop(0)\n if p == None:\n rt.append('#')\n else:\n rt.append(str(p.val))\n newstk.extend([p.left, p.right])\n stk = newstk\nreturn ':'.join(rt)", "if n...
<|body_start_0|> if not root: return '' rt = [] stk = [root] while stk: newstk = [] while stk: p = stk.pop(0) if p == None: rt.append('#') else: rt.append(str(p.val...
Codec1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_012117
3,374
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003203
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' rt = [] stk = [root] while stk: newstk = [] while stk: p = stk.pop(0) ...
the_stack_v2_python_sparse
medium/tree/test_449_Serialize_and_Deserialize_BST.py
wuxu1019/leetcode_sophia
train
1
bd3b9ce934873ae57b6560d24fcd136ee542c0aa
[ "Functor.__init__(self, Rings(), Rings())\nfrom .graded_ring import canonical_parameters\nself._group, R, red_hom, n = canonical_parameters(group, ZZ, red_hom)\nself._red_hom = bool(red_hom)\nself._analytic_type = self.AT(analytic_type)", "if isinstance(R, BaseFacade):\n R = _get_base_ring(R._ring)\n return...
<|body_start_0|> Functor.__init__(self, Rings(), Rings()) from .graded_ring import canonical_parameters self._group, R, red_hom, n = canonical_parameters(group, ZZ, red_hom) self._red_hom = bool(red_hom) self._analytic_type = self.AT(analytic_type) <|end_body_0|> <|body_start_1|...
Construction functor for forms rings. NOTE: When the base ring is not a ``BaseFacade`` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions. (when trying to find a common parent between a forms ring and a ring which is not a ``BaseFacade``).
FormsRingFunctor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormsRingFunctor: """Construction functor for forms rings. NOTE: When the base ring is not a ``BaseFacade`` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions. (when trying to find a common parent between a forms ring and a ring which is ...
stack_v2_sparse_classes_36k_train_012118
31,146
no_license
[ { "docstring": "Construction functor for the forms ring with the given ``analytic_type``, ``group`` and variable ``red_hom`` See :meth:`__call__` for a description of the functor. INPUT: - ``analytic_type`` -- An element of ``AnalyticType()``. - ``group`` -- The index of a Hecke Triangle group. - ``red_hom`` --...
5
null
Implement the Python class `FormsRingFunctor` described below. Class description: Construction functor for forms rings. NOTE: When the base ring is not a ``BaseFacade`` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions. (when trying to find a common parent be...
Implement the Python class `FormsRingFunctor` described below. Class description: Construction functor for forms rings. NOTE: When the base ring is not a ``BaseFacade`` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions. (when trying to find a common parent be...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class FormsRingFunctor: """Construction functor for forms rings. NOTE: When the base ring is not a ``BaseFacade`` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions. (when trying to find a common parent between a forms ring and a ring which is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormsRingFunctor: """Construction functor for forms rings. NOTE: When the base ring is not a ``BaseFacade`` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions. (when trying to find a common parent between a forms ring and a ring which is not a ``BaseF...
the_stack_v2_python_sparse
sage/src/sage/modular/modform_hecketriangle/functors.py
bopopescu/geosci
train
0
5dfc6676c56dfad32159938555132555f1c9e5e5
[ "try:\n task = taskqueue.add(queue_name=queue_name, **kwargs)\n return task\nexcept (taskqueue.TombstonedTaskError, taskqueue.DuplicateTaskNameError, taskqueue.BadTransactionStateError, taskqueue.BadTaskStateError, taskqueue.TooManyTasksError, taskqueue.UnknownQueueError) as e:\n logger.error('Task for que...
<|body_start_0|> try: task = taskqueue.add(queue_name=queue_name, **kwargs) return task except (taskqueue.TombstonedTaskError, taskqueue.DuplicateTaskNameError, taskqueue.BadTransactionStateError, taskqueue.BadTaskStateError, taskqueue.TooManyTasksError, taskqueue.UnknownQueueErr...
TaskQueueMixin
TaskQueueMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskQueueMixin: """TaskQueueMixin""" def add_task(queue_name='default', **kwargs): """Enqueue a task as part of a Datastore transaction https://cloud.google.com/appengine/docs/python/ndb/transactions https://cloud.google.com/appengine/docs/python/taskqueue/queues https://cloud.google...
stack_v2_sparse_classes_36k_train_012119
2,029
permissive
[ { "docstring": "Enqueue a task as part of a Datastore transaction https://cloud.google.com/appengine/docs/python/ndb/transactions https://cloud.google.com/appengine/docs/python/taskqueue/queues https://cloud.google.com/appengine/docs/python/taskqueue/push/ :param url: :param params: :return:", "name": "add_...
2
stack_v2_sparse_classes_30k_train_011343
Implement the Python class `TaskQueueMixin` described below. Class description: TaskQueueMixin Method signatures and docstrings: - def add_task(queue_name='default', **kwargs): Enqueue a task as part of a Datastore transaction https://cloud.google.com/appengine/docs/python/ndb/transactions https://cloud.google.com/ap...
Implement the Python class `TaskQueueMixin` described below. Class description: TaskQueueMixin Method signatures and docstrings: - def add_task(queue_name='default', **kwargs): Enqueue a task as part of a Datastore transaction https://cloud.google.com/appengine/docs/python/ndb/transactions https://cloud.google.com/ap...
0afd1360f5a102335c55afaf138e0ecb96644128
<|skeleton|> class TaskQueueMixin: """TaskQueueMixin""" def add_task(queue_name='default', **kwargs): """Enqueue a task as part of a Datastore transaction https://cloud.google.com/appengine/docs/python/ndb/transactions https://cloud.google.com/appengine/docs/python/taskqueue/queues https://cloud.google...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskQueueMixin: """TaskQueueMixin""" def add_task(queue_name='default', **kwargs): """Enqueue a task as part of a Datastore transaction https://cloud.google.com/appengine/docs/python/ndb/transactions https://cloud.google.com/appengine/docs/python/taskqueue/queues https://cloud.google.com/appengin...
the_stack_v2_python_sparse
apollo/common/mixins/task_queue.py
aukbit/apollo
train
0
6c430eafa9e0a5e6493c7a0c725e43cfb199fed9
[ "if G.Env.save_transformed_metrics:\n self.evaluate('holdout', self.data_holdout.target.T.run, self.data_holdout.prediction.T.run)\nelse:\n self.evaluate('holdout', self.data_holdout.target.fold, self.data_holdout.prediction.run)\nsuper().on_run_end()", "if G.Env.save_transformed_metrics:\n self.evaluate...
<|body_start_0|> if G.Env.save_transformed_metrics: self.evaluate('holdout', self.data_holdout.target.T.run, self.data_holdout.prediction.T.run) else: self.evaluate('holdout', self.data_holdout.target.fold, self.data_holdout.prediction.run) super().on_run_end() <|end_body...
EvaluatorHoldout
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluatorHoldout: def on_run_end(self): """Evaluate holdout predictions for the run""" <|body_0|> def on_fold_end(self): """Evaluate (run-averaged) holdout predictions for the fold""" <|body_1|> def on_rep_end(self): """Evaluate (run-averaged) ho...
stack_v2_sparse_classes_36k_train_012120
5,856
permissive
[ { "docstring": "Evaluate holdout predictions for the run", "name": "on_run_end", "signature": "def on_run_end(self)" }, { "docstring": "Evaluate (run-averaged) holdout predictions for the fold", "name": "on_fold_end", "signature": "def on_fold_end(self)" }, { "docstring": "Evalua...
4
stack_v2_sparse_classes_30k_train_000024
Implement the Python class `EvaluatorHoldout` described below. Class description: Implement the EvaluatorHoldout class. Method signatures and docstrings: - def on_run_end(self): Evaluate holdout predictions for the run - def on_fold_end(self): Evaluate (run-averaged) holdout predictions for the fold - def on_rep_end(...
Implement the Python class `EvaluatorHoldout` described below. Class description: Implement the EvaluatorHoldout class. Method signatures and docstrings: - def on_run_end(self): Evaluate holdout predictions for the run - def on_fold_end(self): Evaluate (run-averaged) holdout predictions for the fold - def on_rep_end(...
3709d5e97dd23efa0df1b79982ae029789e1af57
<|skeleton|> class EvaluatorHoldout: def on_run_end(self): """Evaluate holdout predictions for the run""" <|body_0|> def on_fold_end(self): """Evaluate (run-averaged) holdout predictions for the fold""" <|body_1|> def on_rep_end(self): """Evaluate (run-averaged) ho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EvaluatorHoldout: def on_run_end(self): """Evaluate holdout predictions for the run""" if G.Env.save_transformed_metrics: self.evaluate('holdout', self.data_holdout.target.T.run, self.data_holdout.prediction.T.run) else: self.evaluate('holdout', self.data_holdou...
the_stack_v2_python_sparse
hyperparameter_hunter/callbacks/evaluators.py
shaoeric/hyperparameter_hunter
train
0
2347fde8cd85e21dc9f8ed72dd04e736f400ba85
[ "Frame.__init__(self, master)\nself.pack()\nself.createArtistWidgets()", "tag_name = Frame(self)\nartist_name = Frame(self)\nsong_name = Frame(self)\nalbum_name = Frame(self)\nself.labeltag = Label(tag_name, text='Update Song Artist')\nself.labelSong = Label(song_name, text='Song Name')\nself.labelAlbum = Label(a...
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createArtistWidgets() <|end_body_0|> <|body_start_1|> tag_name = Frame(self) artist_name = Frame(self) song_name = Frame(self) album_name = Frame(self) self.labeltag = Label(tag_name, text='Up...
Application main window class.
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createArtistWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_36k_train_012121
2,506
no_license
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createArtistWidgets", "signature": "def createArtistWidgets(self)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_val_000415
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createArtistWidgets(self): Add all the widgets to the main frame. - def handle(self): Hand...
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createArtistWidgets(self): Add all the widgets to the main frame. - def handle(self): Hand...
2dba11861f91e4bdc1ef28279132a6d8dd4ccf54
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createArtistWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createArtistWidgets() def createArtistWidgets(self): """Add all the widgets to t...
the_stack_v2_python_sparse
Mux_Gui/Update_Artist_Of_Song_Gui.py
rduvalwa5/Mux
train
0
719d78b5fc72a0524b9c6c21fc50e2df08176e42
[ "super().__init__(objective=objective)\nself.penalty_objective = penalty_objective\nself.regularization_parameter = regularization_parameter\nself.expand_dim = expand_dim", "obj = super().forward(samples=samples, X=X)\npenalty_obj = self.penalty_objective(X)\nif self.expand_dim is not None:\n penalty_obj = pen...
<|body_start_0|> super().__init__(objective=objective) self.penalty_objective = penalty_objective self.regularization_parameter = regularization_parameter self.expand_dim = expand_dim <|end_body_0|> <|body_start_1|> obj = super().forward(samples=samples, X=X) penalty_obj...
Penalized MC objective. Allows to construct a penaltized MC-objective by adding a penalty term to the original objective. mc_acq(X) = objective(X) + penalty_objective(X) Note: PenalizedMCObjective allows adding penalty at the MCObjective level, different from the AcquisitionFunction level in PenalizedAcquisitionFunctio...
PenalizedMCObjective
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PenalizedMCObjective: """Penalized MC objective. Allows to construct a penaltized MC-objective by adding a penalty term to the original objective. mc_acq(X) = objective(X) + penalty_objective(X) Note: PenalizedMCObjective allows adding penalty at the MCObjective level, different from the Acquisit...
stack_v2_sparse_classes_36k_train_012122
14,396
permissive
[ { "docstring": "Penalized MC objective. Args: objective: A callable `f(samples, X)` mapping a `sample_shape x batch-shape x q x m`-dim Tensor `samples` and an optional `batch-shape x q x d`-dim Tensor `X` to a `sample_shape x batch-shape x q`-dim Tensor of objective values. penalty_objective: A torch.nn.Module ...
2
null
Implement the Python class `PenalizedMCObjective` described below. Class description: Penalized MC objective. Allows to construct a penaltized MC-objective by adding a penalty term to the original objective. mc_acq(X) = objective(X) + penalty_objective(X) Note: PenalizedMCObjective allows adding penalty at the MCObjec...
Implement the Python class `PenalizedMCObjective` described below. Class description: Penalized MC objective. Allows to construct a penaltized MC-objective by adding a penalty term to the original objective. mc_acq(X) = objective(X) + penalty_objective(X) Note: PenalizedMCObjective allows adding penalty at the MCObjec...
4cc5ed59b2e8a9c780f786830c548e05cc74d53c
<|skeleton|> class PenalizedMCObjective: """Penalized MC objective. Allows to construct a penaltized MC-objective by adding a penalty term to the original objective. mc_acq(X) = objective(X) + penalty_objective(X) Note: PenalizedMCObjective allows adding penalty at the MCObjective level, different from the Acquisit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PenalizedMCObjective: """Penalized MC objective. Allows to construct a penaltized MC-objective by adding a penalty term to the original objective. mc_acq(X) = objective(X) + penalty_objective(X) Note: PenalizedMCObjective allows adding penalty at the MCObjective level, different from the AcquisitionFunction l...
the_stack_v2_python_sparse
botorch/acquisition/penalized.py
pytorch/botorch
train
2,891
7d0ae7d93e5380e1380bc54c0889f08eacc8c1a0
[ "super(DuelingHead, self).__init__()\nself.A = [fc_block(hidden_dim, hidden_dim, activation=activation, norm_type=norm_type) for _ in range(a_layer_num)]\nself.V = [fc_block(hidden_dim, hidden_dim, activation=activation, norm_type=norm_type) for _ in range(v_layer_num)]\nself.A += fc_block(hidden_dim, action_dim, a...
<|body_start_0|> super(DuelingHead, self).__init__() self.A = [fc_block(hidden_dim, hidden_dim, activation=activation, norm_type=norm_type) for _ in range(a_layer_num)] self.V = [fc_block(hidden_dim, hidden_dim, activation=activation, norm_type=norm_type) for _ in range(v_layer_num)] sel...
Overview: The Dueling head used in models. Notes: Dueling head is one of the three most major improvements in DQN algorithm. The paper introducing \\ this improvement `Dueling Network Architectures for Deep Reinforcement Learning` was published \\ by Google in 2016. You can view the original paper on <https://arxiv.org...
DuelingHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DuelingHead: """Overview: The Dueling head used in models. Notes: Dueling head is one of the three most major improvements in DQN algorithm. The paper introducing \\ this improvement `Dueling Network Architectures for Deep Reinforcement Learning` was published \\ by Google in 2016. You can view t...
stack_v2_sparse_classes_36k_train_012123
2,805
permissive
[ { "docstring": "Overview: Init the DuelingHead according to arguments. Arguments: - hidden_dim (:obj:`int`): the hidden_dim used before connected to DuelingHead - action_dim (:obj:`int`): the num of actions - a_layer_num (:obj:`int`): the num of fc_block used in the network to compute action output - v_layer_nu...
2
stack_v2_sparse_classes_30k_train_003151
Implement the Python class `DuelingHead` described below. Class description: Overview: The Dueling head used in models. Notes: Dueling head is one of the three most major improvements in DQN algorithm. The paper introducing \\ this improvement `Dueling Network Architectures for Deep Reinforcement Learning` was publish...
Implement the Python class `DuelingHead` described below. Class description: Overview: The Dueling head used in models. Notes: Dueling head is one of the three most major improvements in DQN algorithm. The paper introducing \\ this improvement `Dueling Network Architectures for Deep Reinforcement Learning` was publish...
09d507c412235a2f0cf9c0b3485ec9ed15fb6421
<|skeleton|> class DuelingHead: """Overview: The Dueling head used in models. Notes: Dueling head is one of the three most major improvements in DQN algorithm. The paper introducing \\ this improvement `Dueling Network Architectures for Deep Reinforcement Learning` was published \\ by Google in 2016. You can view t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DuelingHead: """Overview: The Dueling head used in models. Notes: Dueling head is one of the three most major improvements in DQN algorithm. The paper introducing \\ this improvement `Dueling Network Architectures for Deep Reinforcement Learning` was published \\ by Google in 2016. You can view the original p...
the_stack_v2_python_sparse
ctools/model/common_arch/dueling.py
LFhase/DI-star
train
1
e265c15f3fc0929d1ddcb36f9d7abd77afe2e6a8
[ "self.parallel_trap_list = parallel_trap_list\nself.parallel_ccd = parallel_ccd\nself.serial_trap_list = serial_trap_list\nself.serial_ccd = serial_ccd", "parallel_traps = self.parallel_trap_list or []\nserial_traps = self.serial_trap_list or []\nreturn [trap for trap in parallel_traps] + [trap for trap in serial...
<|body_start_0|> self.parallel_trap_list = parallel_trap_list self.parallel_ccd = parallel_ccd self.serial_trap_list = serial_trap_list self.serial_ccd = serial_ccd <|end_body_0|> <|body_start_1|> parallel_traps = self.parallel_trap_list or [] serial_traps = self.serial_...
CTI2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CTI2D: def __init__(self, parallel_trap_list: Optional[List[TrapInstantCapture]]=None, parallel_ccd: Optional[CCDPhase]=None, serial_trap_list: Optional[List[TrapInstantCapture]]=None, serial_ccd: Optional[CCDPhase]=None): """An object which determines the behaviour of CTI during 2D para...
stack_v2_sparse_classes_36k_train_012124
3,711
permissive
[ { "docstring": "An object which determines the behaviour of CTI during 2D parallel and serial clocking. This includes the traps that capture and trail electrons and the CCD volume filling behaviour. Parameters ---------- parallel_trap_list The traps on the dataset that capture and release electrons during paral...
2
stack_v2_sparse_classes_30k_train_006266
Implement the Python class `CTI2D` described below. Class description: Implement the CTI2D class. Method signatures and docstrings: - def __init__(self, parallel_trap_list: Optional[List[TrapInstantCapture]]=None, parallel_ccd: Optional[CCDPhase]=None, serial_trap_list: Optional[List[TrapInstantCapture]]=None, serial...
Implement the Python class `CTI2D` described below. Class description: Implement the CTI2D class. Method signatures and docstrings: - def __init__(self, parallel_trap_list: Optional[List[TrapInstantCapture]]=None, parallel_ccd: Optional[CCDPhase]=None, serial_trap_list: Optional[List[TrapInstantCapture]]=None, serial...
32e9ec7194776e5f60329e674942bc19f8626b04
<|skeleton|> class CTI2D: def __init__(self, parallel_trap_list: Optional[List[TrapInstantCapture]]=None, parallel_ccd: Optional[CCDPhase]=None, serial_trap_list: Optional[List[TrapInstantCapture]]=None, serial_ccd: Optional[CCDPhase]=None): """An object which determines the behaviour of CTI during 2D para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CTI2D: def __init__(self, parallel_trap_list: Optional[List[TrapInstantCapture]]=None, parallel_ccd: Optional[CCDPhase]=None, serial_trap_list: Optional[List[TrapInstantCapture]]=None, serial_ccd: Optional[CCDPhase]=None): """An object which determines the behaviour of CTI during 2D parallel and seria...
the_stack_v2_python_sparse
autocti/model/model_util.py
Jammy2211/PyAutoCTI
train
6
712b4ac36d64d1707b48f7d7bb9b81ed49c7cfe4
[ "casts = super(DateTime, self)._input_casts\ncasts[datetime] = self._datetime_cast\nreturn casts", "initial_date = datetime(year=2010, month=1, day=1, hour=0, minute=0, second=0)\nseconds = int((value - initial_date).total_seconds())\nself._value = int(seconds)", "try:\n mat = re.match('(\\\\d{4})\\\\-(\\\\d...
<|body_start_0|> casts = super(DateTime, self)._input_casts casts[datetime] = self._datetime_cast return casts <|end_body_0|> <|body_start_1|> initial_date = datetime(year=2010, month=1, day=1, hour=0, minute=0, second=0) seconds = int((value - initial_date).total_seconds()) ...
Date-Time field which accepts datetime input and string time inputs
DateTime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateTime: """Date-Time field which accepts datetime input and string time inputs""" def _input_casts(self): """Add datetime cast in input casts :return: (input format: cast function) dict""" <|body_0|> def _datetime_cast(self, value): """Cast datetime value :para...
stack_v2_sparse_classes_36k_train_012125
1,227
no_license
[ { "docstring": "Add datetime cast in input casts :return: (input format: cast function) dict", "name": "_input_casts", "signature": "def _input_casts(self)" }, { "docstring": "Cast datetime value :param value: datetime value", "name": "_datetime_cast", "signature": "def _datetime_cast(se...
3
stack_v2_sparse_classes_30k_train_016891
Implement the Python class `DateTime` described below. Class description: Date-Time field which accepts datetime input and string time inputs Method signatures and docstrings: - def _input_casts(self): Add datetime cast in input casts :return: (input format: cast function) dict - def _datetime_cast(self, value): Cast...
Implement the Python class `DateTime` described below. Class description: Date-Time field which accepts datetime input and string time inputs Method signatures and docstrings: - def _input_casts(self): Add datetime cast in input casts :return: (input format: cast function) dict - def _datetime_cast(self, value): Cast...
d553dfb2e58a17366c13e57c4c1b16a387111df7
<|skeleton|> class DateTime: """Date-Time field which accepts datetime input and string time inputs""" def _input_casts(self): """Add datetime cast in input casts :return: (input format: cast function) dict""" <|body_0|> def _datetime_cast(self, value): """Cast datetime value :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DateTime: """Date-Time field which accepts datetime input and string time inputs""" def _input_casts(self): """Add datetime cast in input casts :return: (input format: cast function) dict""" casts = super(DateTime, self)._input_casts casts[datetime] = self._datetime_cast r...
the_stack_v2_python_sparse
egts/egts_types/date_time_field.py
dkraminov/egts-python
train
0
7f111884c18c209de8947fa0f594c7adaea431a9
[ "self.timeout = timeout\nself.Url = 'http://epsg.io/'\nself.proxyUrl = ''\nif (isinstance(proxyHost, unicode) or isinstance(proxyHost, str)) & proxyHost.startswith('http://'):\n self.proxyUrl = 'http://'\n if proxyUser and proxyPass:\n self.proxyUrl += proxyUser + ':' + proxyPass + '@'\n self.proxyU...
<|body_start_0|> self.timeout = timeout self.Url = 'http://epsg.io/' self.proxyUrl = '' if (isinstance(proxyHost, unicode) or isinstance(proxyHost, str)) & proxyHost.startswith('http://'): self.proxyUrl = 'http://' if proxyUser and proxyPass: self....
srsLookUp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class srsLookUp: def __init__(self, timeout=5, proxyHost='', port='', proxyUser=None, proxyPass=None): """find SRS params using http://epsg.io/""" <|body_0|> def wkid2proj4(self, wkid, format='proj4'): """:param wkid: the espg or other well known id, like 4326 for wgs84 :p...
stack_v2_sparse_classes_36k_train_012126
1,757
permissive
[ { "docstring": "find SRS params using http://epsg.io/", "name": "__init__", "signature": "def __init__(self, timeout=5, proxyHost='', port='', proxyUser=None, proxyPass=None)" }, { "docstring": ":param wkid: the espg or other well known id, like 4326 for wgs84 :param format: *format*: The crs fo...
2
stack_v2_sparse_classes_30k_train_020132
Implement the Python class `srsLookUp` described below. Class description: Implement the srsLookUp class. Method signatures and docstrings: - def __init__(self, timeout=5, proxyHost='', port='', proxyUser=None, proxyPass=None): find SRS params using http://epsg.io/ - def wkid2proj4(self, wkid, format='proj4'): :param...
Implement the Python class `srsLookUp` described below. Class description: Implement the srsLookUp class. Method signatures and docstrings: - def __init__(self, timeout=5, proxyHost='', port='', proxyUser=None, proxyPass=None): find SRS params using http://epsg.io/ - def wkid2proj4(self, wkid, format='proj4'): :param...
d0d2e4da7cb9d6f08ef82b6c6f94d3340b96f9ba
<|skeleton|> class srsLookUp: def __init__(self, timeout=5, proxyHost='', port='', proxyUser=None, proxyPass=None): """find SRS params using http://epsg.io/""" <|body_0|> def wkid2proj4(self, wkid, format='proj4'): """:param wkid: the espg or other well known id, like 4326 for wgs84 :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class srsLookUp: def __init__(self, timeout=5, proxyHost='', port='', proxyUser=None, proxyPass=None): """find SRS params using http://epsg.io/""" self.timeout = timeout self.Url = 'http://epsg.io/' self.proxyUrl = '' if (isinstance(proxyHost, unicode) or isinstance(proxyHost...
the_stack_v2_python_sparse
mxdParser/_srsLookUp.py
julor/arcgis2qgs
train
0
7f5ff152339ebf040aef35c46e7757df84eda353
[ "service = self.context['compute'].images\nrequests = [(service, messages.ComputeImagesListRequest(filter=lister.ConstructNameFilterExpression(['^{0}-v[0-9]+.*'.format(alias.name_prefix)]), maxResults=constants.MAX_RESULTS_PER_PAGE, project=alias.project)), (service, messages.ComputeImagesListRequest(filter=lister....
<|body_start_0|> service = self.context['compute'].images requests = [(service, messages.ComputeImagesListRequest(filter=lister.ConstructNameFilterExpression(['^{0}-v[0-9]+.*'.format(alias.name_prefix)]), maxResults=constants.MAX_RESULTS_PER_PAGE, project=alias.project)), (service, messages.ComputeImage...
Mixin class for expanding image aliases.
ImageExpander
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageExpander: """Mixin class for expanding image aliases.""" def GetMatchingImages(self, image, alias): """Yields images from a public image project and the user's project.""" <|body_0|> def ExpandImageFlag(self, args): """Returns a full URI for the given value ...
stack_v2_sparse_classes_36k_train_012127
6,858
permissive
[ { "docstring": "Yields images from a public image project and the user's project.", "name": "GetMatchingImages", "signature": "def GetMatchingImages(self, image, alias)" }, { "docstring": "Returns a full URI for the given value of --image.", "name": "ExpandImageFlag", "signature": "def E...
2
stack_v2_sparse_classes_30k_train_004270
Implement the Python class `ImageExpander` described below. Class description: Mixin class for expanding image aliases. Method signatures and docstrings: - def GetMatchingImages(self, image, alias): Yields images from a public image project and the user's project. - def ExpandImageFlag(self, args): Returns a full URI...
Implement the Python class `ImageExpander` described below. Class description: Mixin class for expanding image aliases. Method signatures and docstrings: - def GetMatchingImages(self, image, alias): Yields images from a public image project and the user's project. - def ExpandImageFlag(self, args): Returns a full URI...
90d87b2adb1eab7f218b075886aa620d8d6eeedb
<|skeleton|> class ImageExpander: """Mixin class for expanding image aliases.""" def GetMatchingImages(self, image, alias): """Yields images from a public image project and the user's project.""" <|body_0|> def ExpandImageFlag(self, args): """Returns a full URI for the given value ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageExpander: """Mixin class for expanding image aliases.""" def GetMatchingImages(self, image, alias): """Yields images from a public image project and the user's project.""" service = self.context['compute'].images requests = [(service, messages.ComputeImagesListRequest(filter=...
the_stack_v2_python_sparse
old/google-cloud-sdk/lib/googlecloudsdk/compute/lib/image_utils.py
altock/dev
train
0
38ca684ab7d1ead8234b107f0511de0ee76ac58b
[ "self.name = name\nself.mva_number = mva_number\nself.company_phone = company_phone\nself.company_email = company_email\nself.company_url = company_url\nself.contact = contact\nself.address = address\nself.dealer = dealer\nself.settings = settings\nself.country = country\nself.additional_properties = additional_pro...
<|body_start_0|> self.name = name self.mva_number = mva_number self.company_phone = company_phone self.company_email = company_email self.company_url = company_url self.contact = contact self.address = address self.dealer = dealer self.settings = s...
Implementation of the 'CreateAccountRequest' model. TODO: type model description here. Attributes: name (string): Name of the account owner (company) mva_number (string): Mva / Organization number company_phone (string): TODO: type description here. company_email (string): TODO: type description here. company_url (stri...
CreateAccountRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateAccountRequest: """Implementation of the 'CreateAccountRequest' model. TODO: type model description here. Attributes: name (string): Name of the account owner (company) mva_number (string): Mva / Organization number company_phone (string): TODO: type description here. company_email (string)...
stack_v2_sparse_classes_36k_train_012128
4,517
permissive
[ { "docstring": "Constructor for the CreateAccountRequest class", "name": "__init__", "signature": "def __init__(self, name=None, mva_number=None, company_phone=None, company_email=None, company_url=None, contact=None, address=None, dealer=None, settings=None, country=None, additional_properties={})" }...
2
null
Implement the Python class `CreateAccountRequest` described below. Class description: Implementation of the 'CreateAccountRequest' model. TODO: type model description here. Attributes: name (string): Name of the account owner (company) mva_number (string): Mva / Organization number company_phone (string): TODO: type d...
Implement the Python class `CreateAccountRequest` described below. Class description: Implementation of the 'CreateAccountRequest' model. TODO: type model description here. Attributes: name (string): Name of the account owner (company) mva_number (string): Mva / Organization number company_phone (string): TODO: type d...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class CreateAccountRequest: """Implementation of the 'CreateAccountRequest' model. TODO: type model description here. Attributes: name (string): Name of the account owner (company) mva_number (string): Mva / Organization number company_phone (string): TODO: type description here. company_email (string)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateAccountRequest: """Implementation of the 'CreateAccountRequest' model. TODO: type model description here. Attributes: name (string): Name of the account owner (company) mva_number (string): Mva / Organization number company_phone (string): TODO: type description here. company_email (string): TODO: type ...
the_stack_v2_python_sparse
idfy_rest_client/models/create_account_request.py
dealflowteam/Idfy
train
0
844039f1b19601baeb8cba086dfc36abf999429a
[ "if not page_url or not html_cont:\n return\nsoup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')\nnew_urls = self._get_new_urls(page_url, soup)\nnew_data = self._get_new_data(page_url, soup)\nreturn (new_urls, new_data)", "new_urls = set()\nlinks = soup.find_all('a', href=re.compile('/view/\\...
<|body_start_0|> if not page_url or not html_cont: return soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8') new_urls = self._get_new_urls(page_url, soup) new_data = self._get_new_data(page_url, soup) return (new_urls, new_data) <|end_body_0|> <|bo...
html 解析器
HtmlParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HtmlParser: """html 解析器""" def parser(self, page_url, html_cont): """用于解析网页内容,抽取 URL 和数据 :param page_url: 下载页面的 URL :param html_cont: 下载的网页内容 :return:""" <|body_0|> def _get_new_urls(self, page_url, soup: BeautifulSoup): """抽取新的 url 集合 :param page_url: 下载页面的 URL ...
stack_v2_sparse_classes_36k_train_012129
1,975
no_license
[ { "docstring": "用于解析网页内容,抽取 URL 和数据 :param page_url: 下载页面的 URL :param html_cont: 下载的网页内容 :return:", "name": "parser", "signature": "def parser(self, page_url, html_cont)" }, { "docstring": "抽取新的 url 集合 :param page_url: 下载页面的 URL :param soup: soup :return: 返回新的 URL 集合", "name": "_get_new_urls...
3
stack_v2_sparse_classes_30k_train_014769
Implement the Python class `HtmlParser` described below. Class description: html 解析器 Method signatures and docstrings: - def parser(self, page_url, html_cont): 用于解析网页内容,抽取 URL 和数据 :param page_url: 下载页面的 URL :param html_cont: 下载的网页内容 :return: - def _get_new_urls(self, page_url, soup: BeautifulSoup): 抽取新的 url 集合 :param...
Implement the Python class `HtmlParser` described below. Class description: html 解析器 Method signatures and docstrings: - def parser(self, page_url, html_cont): 用于解析网页内容,抽取 URL 和数据 :param page_url: 下载页面的 URL :param html_cont: 下载的网页内容 :return: - def _get_new_urls(self, page_url, soup: BeautifulSoup): 抽取新的 url 集合 :param...
21c3b190329e4f3571747c2feba8fad268592c0d
<|skeleton|> class HtmlParser: """html 解析器""" def parser(self, page_url, html_cont): """用于解析网页内容,抽取 URL 和数据 :param page_url: 下载页面的 URL :param html_cont: 下载的网页内容 :return:""" <|body_0|> def _get_new_urls(self, page_url, soup: BeautifulSoup): """抽取新的 url 集合 :param page_url: 下载页面的 URL ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HtmlParser: """html 解析器""" def parser(self, page_url, html_cont): """用于解析网页内容,抽取 URL 和数据 :param page_url: 下载页面的 URL :param html_cont: 下载的网页内容 :return:""" if not page_url or not html_cont: return soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8') ...
the_stack_v2_python_sparse
day03_base_spider/HtmlParser.py
zhayangtao/python-reptile
train
0
6c332649851f1ee551eedb5b8daac3639cb1395b
[ "super().__init__(coordinator, description)\nself._serial_number = serial_number\nself._attr_unique_id = f'{serial_number}_{description.key}'\nencharge_inventory = self.data.encharge_inventory\nassert encharge_inventory is not None\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, serial_number)}, manufact...
<|body_start_0|> super().__init__(coordinator, description) self._serial_number = serial_number self._attr_unique_id = f'{serial_number}_{description.key}' encharge_inventory = self.data.encharge_inventory assert encharge_inventory is not None self._attr_device_info = Dev...
Defines an Encharge binary_sensor entity.
EnvoyEnchargeBinarySensorEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvoyEnchargeBinarySensorEntity: """Defines an Encharge binary_sensor entity.""" def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EnvoyEnchargeBinarySensorEntityDescription, serial_number: str) -> None: """Init the Encharge base entity.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_012130
5,991
permissive
[ { "docstring": "Init the Encharge base entity.", "name": "__init__", "signature": "def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EnvoyEnchargeBinarySensorEntityDescription, serial_number: str) -> None" }, { "docstring": "Return the state of the Encharge binary_sensor.", ...
2
null
Implement the Python class `EnvoyEnchargeBinarySensorEntity` described below. Class description: Defines an Encharge binary_sensor entity. Method signatures and docstrings: - def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EnvoyEnchargeBinarySensorEntityDescription, serial_number: str) -> None:...
Implement the Python class `EnvoyEnchargeBinarySensorEntity` described below. Class description: Defines an Encharge binary_sensor entity. Method signatures and docstrings: - def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EnvoyEnchargeBinarySensorEntityDescription, serial_number: str) -> None:...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class EnvoyEnchargeBinarySensorEntity: """Defines an Encharge binary_sensor entity.""" def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EnvoyEnchargeBinarySensorEntityDescription, serial_number: str) -> None: """Init the Encharge base entity.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvoyEnchargeBinarySensorEntity: """Defines an Encharge binary_sensor entity.""" def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EnvoyEnchargeBinarySensorEntityDescription, serial_number: str) -> None: """Init the Encharge base entity.""" super().__init__(coordinato...
the_stack_v2_python_sparse
homeassistant/components/enphase_envoy/binary_sensor.py
home-assistant/core
train
35,501
1875a85d9c666a213aee953439fe52d961adcdf5
[ "if root.left:\n self.helper(result, root.left)\nif root.right:\n self.helper(result, root.right)\nresult.append(root.val)", "result = []\nif not root:\n return result\nself.helper(result, root)\nreturn result" ]
<|body_start_0|> if root.left: self.helper(result, root.left) if root.right: self.helper(result, root.right) result.append(root.val) <|end_body_0|> <|body_start_1|> result = [] if not root: return result self.helper(result, root) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def helper(self, result: List[int], root: TreeNode): """帮助方法 Args: result: 结果集 root: 根节点""" <|body_0|> def post_order_traversal(self, root: TreeNode) -> List[int]: """后序遍历 Args: res: 链表 root: 根节点""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012131
1,876
permissive
[ { "docstring": "帮助方法 Args: result: 结果集 root: 根节点", "name": "helper", "signature": "def helper(self, result: List[int], root: TreeNode)" }, { "docstring": "后序遍历 Args: res: 链表 root: 根节点", "name": "post_order_traversal", "signature": "def post_order_traversal(self, root: TreeNode) -> List[i...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, result: List[int], root: TreeNode): 帮助方法 Args: result: 结果集 root: 根节点 - def post_order_traversal(self, root: TreeNode) -> List[int]: 后序遍历 Args: res: 链表 root: 根节点
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, result: List[int], root: TreeNode): 帮助方法 Args: result: 结果集 root: 根节点 - def post_order_traversal(self, root: TreeNode) -> List[int]: 后序遍历 Args: res: 链表 root: 根节点 ...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def helper(self, result: List[int], root: TreeNode): """帮助方法 Args: result: 结果集 root: 根节点""" <|body_0|> def post_order_traversal(self, root: TreeNode) -> List[int]: """后序遍历 Args: res: 链表 root: 根节点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def helper(self, result: List[int], root: TreeNode): """帮助方法 Args: result: 结果集 root: 根节点""" if root.left: self.helper(result, root.left) if root.right: self.helper(result, root.right) result.append(root.val) def post_order_traversal(self, ...
the_stack_v2_python_sparse
src/leetcodepython/tree/postorder_traversal_145.py
zhangyu345293721/leetcode
train
101
1b209fe72f984ff382d8da3ac02bcd9d6173e0b1
[ "if isinstance(value, list):\n return [item['id'] for item in value]\nelse:\n raise ValueError('Unable to deserialize list reference: %s' % value)", "if isinstance(value, list):\n return [{'id': item} for item in value]\nelse:\n raise ValueError('Unable to serialize list reference: %s' % value)" ]
<|body_start_0|> if isinstance(value, list): return [item['id'] for item in value] else: raise ValueError('Unable to deserialize list reference: %s' % value) <|end_body_0|> <|body_start_1|> if isinstance(value, list): return [{'id': item} for item in value] ...
A formatter used to serialize/deserialize list reference [{"id": "any-id"}] <-> ["any-id"], for example.
ListRef
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListRef: """A formatter used to serialize/deserialize list reference [{"id": "any-id"}] <-> ["any-id"], for example.""" def deserialize(cls, value): """Convert a list primitive to list reference""" <|body_0|> def serialize(cls, value): """Convert list reference t...
stack_v2_sparse_classes_36k_train_012132
3,502
permissive
[ { "docstring": "Convert a list primitive to list reference", "name": "deserialize", "signature": "def deserialize(cls, value)" }, { "docstring": "Convert list reference to list primitive", "name": "serialize", "signature": "def serialize(cls, value)" } ]
2
null
Implement the Python class `ListRef` described below. Class description: A formatter used to serialize/deserialize list reference [{"id": "any-id"}] <-> ["any-id"], for example. Method signatures and docstrings: - def deserialize(cls, value): Convert a list primitive to list reference - def serialize(cls, value): Con...
Implement the Python class `ListRef` described below. Class description: A formatter used to serialize/deserialize list reference [{"id": "any-id"}] <-> ["any-id"], for example. Method signatures and docstrings: - def deserialize(cls, value): Convert a list primitive to list reference - def serialize(cls, value): Con...
60d75438d71ffb7998f5dc407ffa890cc98d3171
<|skeleton|> class ListRef: """A formatter used to serialize/deserialize list reference [{"id": "any-id"}] <-> ["any-id"], for example.""" def deserialize(cls, value): """Convert a list primitive to list reference""" <|body_0|> def serialize(cls, value): """Convert list reference t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListRef: """A formatter used to serialize/deserialize list reference [{"id": "any-id"}] <-> ["any-id"], for example.""" def deserialize(cls, value): """Convert a list primitive to list reference""" if isinstance(value, list): return [item['id'] for item in value] else:...
the_stack_v2_python_sparse
openstack/format.py
huaweicloudsdk/sdk-python
train
20
09449c57a820da4e7c8a60100819edd0528199c5
[ "self.args.findspec.iterator.number = self.MAX_FILES_TO_CHECK\nif self.args.findspec.path_glob:\n self.args.findspec.path_regex = self.args.findspec.path_glob.AsRegEx()\nself.CallClient(server_stubs.Find, self.args.findspec, next_state=self.StoreResults.__name__)", "if not responses.success:\n raise IOError...
<|body_start_0|> self.args.findspec.iterator.number = self.MAX_FILES_TO_CHECK if self.args.findspec.path_glob: self.args.findspec.path_regex = self.args.findspec.path_glob.AsRegEx() self.CallClient(server_stubs.Find, self.args.findspec, next_state=self.StoreResults.__name__) <|end_bo...
Find files on the client. The logic is: - Find files under "Path" - Filter for files with os.path.basename matching "Path Regular Expression" - Filter for files with sizes between min and max limits - Filter for files that contain "Data Regular Expression" in the first 1MB of file data - Return a StatEntry rdfvalue for...
FindFiles
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindFiles: """Find files on the client. The logic is: - Find files under "Path" - Filter for files with os.path.basename matching "Path Regular Expression" - Filter for files with sizes between min and max limits - Filter for files that contain "Data Regular Expression" in the first 1MB of file d...
stack_v2_sparse_classes_36k_train_012133
3,095
permissive
[ { "docstring": "Issue the find request to the client.", "name": "Start", "signature": "def Start(self)" }, { "docstring": "Stores the results returned from the client.", "name": "StoreResults", "signature": "def StoreResults(self, responses)" } ]
2
null
Implement the Python class `FindFiles` described below. Class description: Find files on the client. The logic is: - Find files under "Path" - Filter for files with os.path.basename matching "Path Regular Expression" - Filter for files with sizes between min and max limits - Filter for files that contain "Data Regular...
Implement the Python class `FindFiles` described below. Class description: Find files on the client. The logic is: - Find files under "Path" - Filter for files with os.path.basename matching "Path Regular Expression" - Filter for files with sizes between min and max limits - Filter for files that contain "Data Regular...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class FindFiles: """Find files on the client. The logic is: - Find files under "Path" - Filter for files with os.path.basename matching "Path Regular Expression" - Filter for files with sizes between min and max limits - Filter for files that contain "Data Regular Expression" in the first 1MB of file d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindFiles: """Find files on the client. The logic is: - Find files under "Path" - Filter for files with os.path.basename matching "Path Regular Expression" - Filter for files with sizes between min and max limits - Filter for files that contain "Data Regular Expression" in the first 1MB of file data - Return ...
the_stack_v2_python_sparse
grr/server/grr_response_server/flows/general/find.py
google/grr
train
4,683
0e734b47810b86e5da76e1dab6298abe0c24b0ab
[ "curr = head\nwhile True:\n if curr.child:\n curr = self.flatten_util(curr, curr.child)\n if curr.next:\n curr = curr.next\n else:\n break\ncurr.next = parent.next\nif parent.next:\n parent.next.prev = curr\nparent.next = head\nhead.prev = parent\nparent.child = None\nreturn head", ...
<|body_start_0|> curr = head while True: if curr.child: curr = self.flatten_util(curr, curr.child) if curr.next: curr = curr.next else: break curr.next = parent.next if parent.next: parent.nex...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten_util(self, parent, head): """:type parent: Node :type head: Node :rtype: Node""" <|body_0|> def flatten(self, head): """:type head: Node :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|> curr = head while Tru...
stack_v2_sparse_classes_36k_train_012134
1,054
no_license
[ { "docstring": ":type parent: Node :type head: Node :rtype: Node", "name": "flatten_util", "signature": "def flatten_util(self, parent, head)" }, { "docstring": ":type head: Node :rtype: Node", "name": "flatten", "signature": "def flatten(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_019311
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten_util(self, parent, head): :type parent: Node :type head: Node :rtype: Node - def flatten(self, head): :type head: Node :rtype: Node
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten_util(self, parent, head): :type parent: Node :type head: Node :rtype: Node - def flatten(self, head): :type head: Node :rtype: Node <|skeleton|> class Solution: ...
959abf6f95b75540d19c699ada0253e047f9ec6f
<|skeleton|> class Solution: def flatten_util(self, parent, head): """:type parent: Node :type head: Node :rtype: Node""" <|body_0|> def flatten(self, head): """:type head: Node :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten_util(self, parent, head): """:type parent: Node :type head: Node :rtype: Node""" curr = head while True: if curr.child: curr = self.flatten_util(curr, curr.child) if curr.next: curr = curr.next el...
the_stack_v2_python_sparse
leet-flatten-multilinked-doubly-list/main.py
zohairajmal/competitive-programming-problems
train
0
6061407931ff3a37c9a11e4ce1f5e1dca0bb1096
[ "super(DessedDNNEncoder, self).__init__()\nself.in_channels: int = in_channels\nself.cnn_channels: int = cnn_channels\nself.dnn = DepthWiseSeparableDNN(cnn_channels=cnn_channels, cnn_dropout=0.2, inner_kernel_size=inner_kernel_size, inner_padding=inner_padding)\nself.fc_audioset = Linear(last_dim, last_dim, bias=Tr...
<|body_start_0|> super(DessedDNNEncoder, self).__init__() self.in_channels: int = in_channels self.cnn_channels: int = cnn_channels self.dnn = DepthWiseSeparableDNN(cnn_channels=cnn_channels, cnn_dropout=0.2, inner_kernel_size=inner_kernel_size, inner_padding=inner_padding) self....
DessedDNNEncoder
[ "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DessedDNNEncoder: def __init__(self, in_channels: int, cnn_channels: int, inner_kernel_size: int, inner_padding: int, last_dim: int) -> None: """DessedDNNEncoder module. :param in_channels: Input channels. :type in_channels: int :param cnn_channels: Amount of output CNN channels. :type c...
stack_v2_sparse_classes_36k_train_012135
2,163
permissive
[ { "docstring": "DessedDNNEncoder module. :param in_channels: Input channels. :type in_channels: int :param cnn_channels: Amount of output CNN channels. :type cnn_channels: int :param inner_kernel_size: Kernel shape/size of the second convolution for DWS-DNN. :type inner_kernel_size: int :param inner_padding: In...
2
stack_v2_sparse_classes_30k_train_002364
Implement the Python class `DessedDNNEncoder` described below. Class description: Implement the DessedDNNEncoder class. Method signatures and docstrings: - def __init__(self, in_channels: int, cnn_channels: int, inner_kernel_size: int, inner_padding: int, last_dim: int) -> None: DessedDNNEncoder module. :param in_cha...
Implement the Python class `DessedDNNEncoder` described below. Class description: Implement the DessedDNNEncoder class. Method signatures and docstrings: - def __init__(self, in_channels: int, cnn_channels: int, inner_kernel_size: int, inner_padding: int, last_dim: int) -> None: DessedDNNEncoder module. :param in_cha...
c78458ac0887851a743b7f47101b0fff97724b4f
<|skeleton|> class DessedDNNEncoder: def __init__(self, in_channels: int, cnn_channels: int, inner_kernel_size: int, inner_padding: int, last_dim: int) -> None: """DessedDNNEncoder module. :param in_channels: Input channels. :type in_channels: int :param cnn_channels: Amount of output CNN channels. :type c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DessedDNNEncoder: def __init__(self, in_channels: int, cnn_channels: int, inner_kernel_size: int, inner_padding: int, last_dim: int) -> None: """DessedDNNEncoder module. :param in_channels: Input channels. :type in_channels: int :param cnn_channels: Amount of output CNN channels. :type cnn_channels: i...
the_stack_v2_python_sparse
modules/dessed_dnn_encoder.py
audio-captioning/wavetransformer
train
0
155a160a413c20fa2e8e58094b2d5329899945fb
[ "self.rawdata = {}\nf = open(filename, 'r')\nheader = f.readline().strip().split(',')\nfor line in f:\n items = line.strip().split(',')\n date = re.match('(\\\\d\\\\d\\\\d\\\\d)(\\\\d\\\\d)(\\\\d\\\\d)', items[header.index('DATE')])\n year = int(date.group(1))\n month = int(date.group(2))\n day = int...
<|body_start_0|> self.rawdata = {} f = open(filename, 'r') header = f.readline().strip().split(',') for line in f: items = line.strip().split(',') date = re.match('(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)', items[header.index('DATE')]) year = int(date.group(1)) ...
The collection of temperature records loaded from given csv file
Temperature
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Temperature: """The collection of temperature records loaded from given csv file""" def __init__(self, filename): """Initialize a Temperature instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)"...
stack_v2_sparse_classes_36k_train_012136
15,625
no_license
[ { "docstring": "Initialize a Temperature instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Get the daily temperatures f...
3
stack_v2_sparse_classes_30k_train_016179
Implement the Python class `Temperature` described below. Class description: The collection of temperature records loaded from given csv file Method signatures and docstrings: - def __init__(self, filename): Initialize a Temperature instance, which stores the temperature records loaded from a given csv file specified...
Implement the Python class `Temperature` described below. Class description: The collection of temperature records loaded from given csv file Method signatures and docstrings: - def __init__(self, filename): Initialize a Temperature instance, which stores the temperature records loaded from a given csv file specified...
c1e18b39ecc6635c96a9f99709697e06f36e9762
<|skeleton|> class Temperature: """The collection of temperature records loaded from given csv file""" def __init__(self, filename): """Initialize a Temperature instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Temperature: """The collection of temperature records loaded from given csv file""" def __init__(self, filename): """Initialize a Temperature instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)""" se...
the_stack_v2_python_sparse
6.0002PSET/2_ps5/ps5.py
elahea2020/6.00
train
0
3d8dfa00c3baea651281aaf933d336355769cf1a
[ "n = len(heights)\nright = [1] * n\nleft = [1] * n\nfor i in range(n - 2, -1, -1):\n if heights[i] > heights[i + 1]:\n continue\n else:\n j = i + 1\n while j < n and heights[i] <= heights[j]:\n j += right[j]\n right[i] = j - i\nfor i in range(1, n):\n if heights[i] < ...
<|body_start_0|> n = len(heights) right = [1] * n left = [1] * n for i in range(n - 2, -1, -1): if heights[i] > heights[i + 1]: continue else: j = i + 1 while j < n and heights[i] <= heights[j]: j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(heights...
stack_v2_sparse_classes_36k_train_012137
1,278
no_license
[ { "docstring": ":type heights: List[int] :rtype: int", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights)" }, { "docstring": ":type heights: List[int] :rtype: int", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int <|skeleton|> class ...
6fd7b1bea597867889b7a4ababfb54fa649a717c
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" n = len(heights) right = [1] * n left = [1] * n for i in range(n - 2, -1, -1): if heights[i] > heights[i + 1]: continue else: ...
the_stack_v2_python_sparse
python/51-100/84. Largest Rectangle in Histogram.py
CrazyCoder4Carrot/leetcode
train
3
19790ca512da97ff895ec9509e019ea3bc47844d
[ "comp = GPSPhonePage(self.driver)\nlp = ListViewPhonePage(self.driver)\nname = 'GPS定位类型'\ncompname = 'GPS定位_名称'\nlp.open_fisrt_doc()\ntarget_element = comp.getcomp(compname)\ncomp.scroll_to_target_element(target_element)\ntype = target_element.get_attribute('moduletype')\nself.assertEqual(type, 'weixingpsfield', ms...
<|body_start_0|> comp = GPSPhonePage(self.driver) lp = ListViewPhonePage(self.driver) name = 'GPS定位类型' compname = 'GPS定位_名称' lp.open_fisrt_doc() target_element = comp.getcomp(compname) comp.scroll_to_target_element(target_element) type = target_element.get...
GPS定位控件测试
GPSPhoneTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GPSPhoneTest: """GPS定位控件测试""" def test_type_case(self): """GPS定位类型""" <|body_0|> def test_desription_case(self): """描述""" <|body_1|> def test_show_when_hide_case(self): """隐藏时显示值""" <|body_2|> def init(self): """所有测试""" ...
stack_v2_sparse_classes_36k_train_012138
2,178
no_license
[ { "docstring": "GPS定位类型", "name": "test_type_case", "signature": "def test_type_case(self)" }, { "docstring": "描述", "name": "test_desription_case", "signature": "def test_desription_case(self)" }, { "docstring": "隐藏时显示值", "name": "test_show_when_hide_case", "signature": "...
4
null
Implement the Python class `GPSPhoneTest` described below. Class description: GPS定位控件测试 Method signatures and docstrings: - def test_type_case(self): GPS定位类型 - def test_desription_case(self): 描述 - def test_show_when_hide_case(self): 隐藏时显示值 - def init(self): 所有测试
Implement the Python class `GPSPhoneTest` described below. Class description: GPS定位控件测试 Method signatures and docstrings: - def test_type_case(self): GPS定位类型 - def test_desription_case(self): 描述 - def test_show_when_hide_case(self): 隐藏时显示值 - def init(self): 所有测试 <|skeleton|> class GPSPhoneTest: """GPS定位控件测试""" ...
78768989a79a14013b983024cf6e4838d51ed595
<|skeleton|> class GPSPhoneTest: """GPS定位控件测试""" def test_type_case(self): """GPS定位类型""" <|body_0|> def test_desription_case(self): """描述""" <|body_1|> def test_show_when_hide_case(self): """隐藏时显示值""" <|body_2|> def init(self): """所有测试""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GPSPhoneTest: """GPS定位控件测试""" def test_type_case(self): """GPS定位类型""" comp = GPSPhonePage(self.driver) lp = ListViewPhonePage(self.driver) name = 'GPS定位类型' compname = 'GPS定位_名称' lp.open_fisrt_doc() target_element = comp.getcomp(compname) com...
the_stack_v2_python_sparse
test_case/running/phone/form/test_gps.py
pylk/pythonSelenium
train
0
596bc8597536b9a9f1e62cedb9af4b39ee6b70e8
[ "dp = [amount + 1] * (amount + 1)\ndp[0] = 0\nfor i in range(amount):\n for j in range(len(coins)):\n if i + coins[j] > amount:\n continue\n dp[i + coins[j]] = min(dp[i] + 1, dp[i + coins[j]])\nreturn dp[-1] if dp[-1] <= amount else -1", "level = 0\nqueue = [amount]\ncoins = sorted(coi...
<|body_start_0|> dp = [amount + 1] * (amount + 1) dp[0] = 0 for i in range(amount): for j in range(len(coins)): if i + coins[j] > amount: continue dp[i + coins[j]] = min(dp[i] + 1, dp[i + coins[j]]) return dp[-1] if dp[-1] <...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int :BFS solution""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_012139
2,496
permissive
[ { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": ":type coins: List[int] :type amount: int :rtype: int :BFS solution", "name": "coinChange2", "signature": "def coinChange2(sel...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:...
aec1ddd0c51b619c1bae1e05f940d9ed587aa82f
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int :BFS solution""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" dp = [amount + 1] * (amount + 1) dp[0] = 0 for i in range(amount): for j in range(len(coins)): if i + coins[j] > amount: con...
the_stack_v2_python_sparse
Python/leetcode/coinChange.py
darrencheng0817/AlgorithmLearning
train
2
466171e0da9874e9635228007ce5ab28b604010e
[ "self.np_shape = params['shape'][::-1]\nself.np_dtype = params['dtype']\nself.seed = params['seed']\nself.rng = np.random.default_rng(self.seed)", "probabilities = [1.0 - settings.FLIP_PROBABILITY, settings.FLIP_PROBABILITY]\na = self.rng.choice([0, 1], p=probabilities, size=self.np_shape)\na = np.array(a, dtype=...
<|body_start_0|> self.np_shape = params['shape'][::-1] self.np_dtype = params['dtype'] self.seed = params['seed'] self.rng = np.random.default_rng(self.seed) <|end_body_0|> <|body_start_1|> probabilities = [1.0 - settings.FLIP_PROBABILITY, settings.FLIP_PROBABILITY] a = ...
Class defining the random flip implementation.
RandomFlipFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomFlipFunction: """Class defining the random flip implementation.""" def __init__(self, params): """:params params: dictionary of params conatining shape: output shape of this class. dtype: output dtype of this class. seed: seed to be used for randomization.""" <|body_0|>...
stack_v2_sparse_classes_36k_train_012140
7,328
no_license
[ { "docstring": ":params params: dictionary of params conatining shape: output shape of this class. dtype: output dtype of this class. seed: seed to be used for randomization.", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": ":returns : random flip values calculat...
2
null
Implement the Python class `RandomFlipFunction` described below. Class description: Class defining the random flip implementation. Method signatures and docstrings: - def __init__(self, params): :params params: dictionary of params conatining shape: output shape of this class. dtype: output dtype of this class. seed:...
Implement the Python class `RandomFlipFunction` described below. Class description: Class defining the random flip implementation. Method signatures and docstrings: - def __init__(self, params): :params params: dictionary of params conatining shape: output shape of this class. dtype: output dtype of this class. seed:...
3ca77c4a5fb62c60372e8a2839b1fccc3c4e4212
<|skeleton|> class RandomFlipFunction: """Class defining the random flip implementation.""" def __init__(self, params): """:params params: dictionary of params conatining shape: output shape of this class. dtype: output dtype of this class. seed: seed to be used for randomization.""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomFlipFunction: """Class defining the random flip implementation.""" def __init__(self, params): """:params params: dictionary of params conatining shape: output shape of this class. dtype: output dtype of this class. seed: seed to be used for randomization.""" self.np_shape = params[...
the_stack_v2_python_sparse
TensorFlow/computer_vision/common/resnet_media_pipe.py
HabanaAI/Model-References
train
108
e492a409b226a8754f0fd898e3ec2bcea3d174a1
[ "userp = request.user\nserializer = EditProfile(instance=userp, data=request.data)\nif serializer.is_valid():\n print('serializer.data:', serializer.validated_data)\n serializer.save()\n return Response({'message': 'edit profile successfully!'}, status=status.HTTP_200_OK)\nelse:\n return Response(serial...
<|body_start_0|> userp = request.user serializer = EditProfile(instance=userp, data=request.data) if serializer.is_valid(): print('serializer.data:', serializer.validated_data) serializer.save() return Response({'message': 'edit profile successfully!'}, status...
EditProfileItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditProfileItem: def put(self, request): """edit profile""" <|body_0|> def get(self, request): """get users list:""" <|body_1|> <|end_skeleton|> <|body_start_0|> userp = request.user serializer = EditProfile(instance=userp, data=request.data...
stack_v2_sparse_classes_36k_train_012141
10,046
no_license
[ { "docstring": "edit profile", "name": "put", "signature": "def put(self, request)" }, { "docstring": "get users list:", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_002978
Implement the Python class `EditProfileItem` described below. Class description: Implement the EditProfileItem class. Method signatures and docstrings: - def put(self, request): edit profile - def get(self, request): get users list:
Implement the Python class `EditProfileItem` described below. Class description: Implement the EditProfileItem class. Method signatures and docstrings: - def put(self, request): edit profile - def get(self, request): get users list: <|skeleton|> class EditProfileItem: def put(self, request): """edit pro...
ee8b9d7d754849e2b2b9d86750099563fbdfc806
<|skeleton|> class EditProfileItem: def put(self, request): """edit profile""" <|body_0|> def get(self, request): """get users list:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EditProfileItem: def put(self, request): """edit profile""" userp = request.user serializer = EditProfile(instance=userp, data=request.data) if serializer.is_valid(): print('serializer.data:', serializer.validated_data) serializer.save() retu...
the_stack_v2_python_sparse
HW2/chat_project/users1/views.py
rezvan-hb/django
train
0
56e60fca5935ad62b797c8de1cf0bf50e3dff4b8
[ "super(TransformerEncoder, self).__init__()\nself.layers = nn.ModuleList([self.SubLayer(**kargs) for _ in range(num_layers)])\nself.norm = nn.LayerNorm(kargs['model_size'], eps=1e-06)", "output = x\nif seq_mask is None:\n atte_mask_out = None\nelse:\n atte_mask_out = (seq_mask == 0)[:, None, :]\n seq_mas...
<|body_start_0|> super(TransformerEncoder, self).__init__() self.layers = nn.ModuleList([self.SubLayer(**kargs) for _ in range(num_layers)]) self.norm = nn.LayerNorm(kargs['model_size'], eps=1e-06) <|end_body_0|> <|body_start_1|> output = x if seq_mask is None: atte_...
transformer的encoder模块,不包含embedding层
TransformerEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoder: """transformer的encoder模块,不包含embedding层""" def __init__(self, num_layers, **kargs): """:param int num_layers: transformer的层数 :param int model_size: 输入维度的大小。同时也是输出维度的大小。 :param int inner_size: FFN层的hidden大小 :param int key_size: 每个head的维度大小。 :param int value_size: 每个...
stack_v2_sparse_classes_36k_train_012142
3,009
permissive
[ { "docstring": ":param int num_layers: transformer的层数 :param int model_size: 输入维度的大小。同时也是输出维度的大小。 :param int inner_size: FFN层的hidden大小 :param int key_size: 每个head的维度大小。 :param int value_size: 每个head中value的维度。 :param int num_head: head的数量。 :param float dropout: dropout概率. Default: 0.1", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_007444
Implement the Python class `TransformerEncoder` described below. Class description: transformer的encoder模块,不包含embedding层 Method signatures and docstrings: - def __init__(self, num_layers, **kargs): :param int num_layers: transformer的层数 :param int model_size: 输入维度的大小。同时也是输出维度的大小。 :param int inner_size: FFN层的hidden大小 :p...
Implement the Python class `TransformerEncoder` described below. Class description: transformer的encoder模块,不包含embedding层 Method signatures and docstrings: - def __init__(self, num_layers, **kargs): :param int num_layers: transformer的层数 :param int model_size: 输入维度的大小。同时也是输出维度的大小。 :param int inner_size: FFN层的hidden大小 :p...
dffc7a06cdbff2671a3ca73d2398159d91a4a7db
<|skeleton|> class TransformerEncoder: """transformer的encoder模块,不包含embedding层""" def __init__(self, num_layers, **kargs): """:param int num_layers: transformer的层数 :param int model_size: 输入维度的大小。同时也是输出维度的大小。 :param int inner_size: FFN层的hidden大小 :param int key_size: 每个head的维度大小。 :param int value_size: 每个...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerEncoder: """transformer的encoder模块,不包含embedding层""" def __init__(self, num_layers, **kargs): """:param int num_layers: transformer的层数 :param int model_size: 输入维度的大小。同时也是输出维度的大小。 :param int inner_size: FFN层的hidden大小 :param int key_size: 每个head的维度大小。 :param int value_size: 每个head中value的维度...
the_stack_v2_python_sparse
phenobert/utils/fastNLP/modules/encoder/transformer.py
TianlabTech/PhenoBERT
train
2
4d9839bde36fff5c4027e394a82c5f4b1e52fdba
[ "def backTrack(res, nums, tmp, start):\n if len(tmp) > 0:\n t = tmp.copy()\n res.append(t)\n for i in range(start, len(nums)):\n tmp.append(nums[i])\n backTrack(res, nums, tmp, i + 1)\n tmp.pop()\nt = [[]]\nres = [[]]\ntmp = []\ndic = {}\nnums.sort()\nbackTrack(t, nums, tmp,...
<|body_start_0|> def backTrack(res, nums, tmp, start): if len(tmp) > 0: t = tmp.copy() res.append(t) for i in range(start, len(nums)): tmp.append(nums[i]) backTrack(res, nums, tmp, i + 1) tmp.pop() t ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup0(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def backTrack(...
stack_v2_sparse_classes_36k_train_012143
1,933
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup", "signature": "def subsetsWithDup(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup0", "signature": "def subsetsWithDup0(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_009135
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup0(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup0(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup0(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" def backTrack(res, nums, tmp, start): if len(tmp) > 0: t = tmp.copy() res.append(t) for i in range(start, len(nums)): tmp.append...
the_stack_v2_python_sparse
PythonCode/src/0090_Subsets_II.py
oneyuan/CodeforFun
train
0
15df0facc0acfb61e4cda22bcff81496bf47557b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ApplicationTemplate()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'categories': lambda n: setattr(self, 'categories', n.get_collection_of_primitive_values(str)), 'description':...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ApplicationTemplate() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], None]] = {'categories': lambda n: se...
ApplicationTemplate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationTemplate: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ApplicationTemplate: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob...
stack_v2_sparse_classes_36k_train_012144
4,422
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ApplicationTemplate", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
null
Implement the Python class `ApplicationTemplate` described below. Class description: Implement the ApplicationTemplate class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ApplicationTemplate: Creates a new instance of the appropriate class based on d...
Implement the Python class `ApplicationTemplate` described below. Class description: Implement the ApplicationTemplate class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ApplicationTemplate: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ApplicationTemplate: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ApplicationTemplate: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplicationTemplate: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ApplicationTemplate: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ...
the_stack_v2_python_sparse
msgraph/generated/models/application_template.py
microsoftgraph/msgraph-sdk-python
train
135
ccfbaee071c177ed75f739e748ea65bcc7d53700
[ "if len(word) == k:\n return True\nif row < 0 or row >= row_max or col < 0 or (col >= col_max):\n return False\nif board[row][col] != word[k]:\n return False\nletter = board[row][col]\nboard[row][col] = None\nfor i, j in [[0, 1], [1, 0], [0, -1], [-1, 0]]:\n if self.recur(board, word, row_max, col_max, ...
<|body_start_0|> if len(word) == k: return True if row < 0 or row >= row_max or col < 0 or (col >= col_max): return False if board[row][col] != word[k]: return False letter = board[row][col] board[row][col] = None for i, j in [[0, 1], [...
solution
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """solution""" def recur(self, board: List[List[str]], word: str, row_max: int, col_max: int, row: int, col: int, k: int) -> bool: """recur Parameters ---------- board : List[List[str]] characters board word : str word row_max : int number of rows col_max : int number of co...
stack_v2_sparse_classes_36k_train_012145
2,889
no_license
[ { "docstring": "recur Parameters ---------- board : List[List[str]] characters board word : str word row_max : int number of rows col_max : int number of columns row : int current row col : int current column k : int index of letter in word Returns ------- bool result", "name": "recur", "signature": "de...
2
stack_v2_sparse_classes_30k_train_004092
Implement the Python class `Solution` described below. Class description: solution Method signatures and docstrings: - def recur(self, board: List[List[str]], word: str, row_max: int, col_max: int, row: int, col: int, k: int) -> bool: recur Parameters ---------- board : List[List[str]] characters board word : str wor...
Implement the Python class `Solution` described below. Class description: solution Method signatures and docstrings: - def recur(self, board: List[List[str]], word: str, row_max: int, col_max: int, row: int, col: int, k: int) -> bool: recur Parameters ---------- board : List[List[str]] characters board word : str wor...
86766a73a617086784ad777906a2782e39fe262e
<|skeleton|> class Solution: """solution""" def recur(self, board: List[List[str]], word: str, row_max: int, col_max: int, row: int, col: int, k: int) -> bool: """recur Parameters ---------- board : List[List[str]] characters board word : str word row_max : int number of rows col_max : int number of co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """solution""" def recur(self, board: List[List[str]], word: str, row_max: int, col_max: int, row: int, col: int, k: int) -> bool: """recur Parameters ---------- board : List[List[str]] characters board word : str word row_max : int number of rows col_max : int number of columns row : i...
the_stack_v2_python_sparse
src/medium/word_search.py
albul-k/leetcode
train
0
e1618cadfd51887f36816ee4dfeabc54fffd3178
[ "dummy, self.fset = _readFunction(filename, func_name, 0)\nself.x = self.fset.x\nself.y = self.fset.y\nself.length = len(self.x)", "if x <= 0:\n return self.y[0]\nif x >= 1:\n return self.y[self.length - 1]\nindex = 0\nfor i, this in enumerate(self.x):\n if x > this:\n index = i\n else:\n ...
<|body_start_0|> dummy, self.fset = _readFunction(filename, func_name, 0) self.x = self.fset.x self.y = self.fset.y self.length = len(self.x) <|end_body_0|> <|body_start_1|> if x <= 0: return self.y[0] if x >= 1: return self.y[self.length - 1] ...
Read a L-studio functions.fset file, extract a func_name and returns interpolated values. :Example: Starting from a file like:: funcgalleryver 1 1 items: 2 fver 1 1 name: _fruit_mass samples: 100 flip: off points: 4 0.000000 0.000000 0.586364 0.000000 0.586364 0.250000 1.000000 0.250000 fver 1 1 name: _leaf_area sample...
ReadFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadFunction: """Read a L-studio functions.fset file, extract a func_name and returns interpolated values. :Example: Starting from a file like:: funcgalleryver 1 1 items: 2 fver 1 1 name: _fruit_mass samples: 100 flip: off points: 4 0.000000 0.000000 0.586364 0.000000 0.586364 0.250000 1.000000 0...
stack_v2_sparse_classes_36k_train_012146
5,835
no_license
[ { "docstring": ":param filename: the filename with the extension :param func_name: the function name to extract", "name": "__init__", "signature": "def __init__(self, filename, func_name)" }, { "docstring": "returns the y values corresponding to x Use scipy and its simplest 1D interpolation meth...
2
stack_v2_sparse_classes_30k_val_000577
Implement the Python class `ReadFunction` described below. Class description: Read a L-studio functions.fset file, extract a func_name and returns interpolated values. :Example: Starting from a file like:: funcgalleryver 1 1 items: 2 fver 1 1 name: _fruit_mass samples: 100 flip: off points: 4 0.000000 0.000000 0.58636...
Implement the Python class `ReadFunction` described below. Class description: Read a L-studio functions.fset file, extract a func_name and returns interpolated values. :Example: Starting from a file like:: funcgalleryver 1 1 items: 2 fver 1 1 name: _fruit_mass samples: 100 flip: off points: 4 0.000000 0.000000 0.58636...
090370f08271455f6c1b89592a0b7eb18212a6c9
<|skeleton|> class ReadFunction: """Read a L-studio functions.fset file, extract a func_name and returns interpolated values. :Example: Starting from a file like:: funcgalleryver 1 1 items: 2 fver 1 1 name: _fruit_mass samples: 100 flip: off points: 4 0.000000 0.000000 0.586364 0.000000 0.586364 0.250000 1.000000 0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadFunction: """Read a L-studio functions.fset file, extract a func_name and returns interpolated values. :Example: Starting from a file like:: funcgalleryver 1 1 items: 2 fver 1 1 name: _fruit_mass samples: 100 flip: off points: 4 0.000000 0.000000 0.586364 0.000000 0.586364 0.250000 1.000000 0.250000 fver ...
the_stack_v2_python_sparse
src/stocatree/tools/read_function.py
junqi108/MAppleT
train
0
70a7f1a0602d48a5278caf03dbcb2a215bd1d01b
[ "self.morpho = Morpho.load(dictMorpho)\nif self.morpho is None:\n raise LemmatizerException('Chybný DICT.')\nself.tokenizer = self.morpho.newTokenizer()\nif self.tokenizer is None:\n raise LemmatizerException('Není definovaný tokenizer pro dodaný model.')\nself.forms = Forms()\nself.tokens = TokenRanges()\nse...
<|body_start_0|> self.morpho = Morpho.load(dictMorpho) if self.morpho is None: raise LemmatizerException('Chybný DICT.') self.tokenizer = self.morpho.newTokenizer() if self.tokenizer is None: raise LemmatizerException('Není definovaný tokenizer pro dodaný model.')...
Třída pro lemmatizaci slov a extrakci vybraných slovních druhů. Používá nástroj morphodita. Značky slovních druhů: N - 1 A - 2 P - 3 C - 4 V - 5 D - 6 R - 7 J - 8 T - 9 I - 10 Z - Symboly X - Neznámé
Lemmatizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lemmatizer: """Třída pro lemmatizaci slov a extrakci vybraných slovních druhů. Používá nástroj morphodita. Značky slovních druhů: N - 1 A - 2 P - 3 C - 4 V - 5 D - 6 R - 7 J - 8 T - 9 I - 10 Z - Symboly X - Neznámé""" def __init__(self, dictMorpho): """Konstrukce objektu. :param dict...
stack_v2_sparse_classes_36k_train_012147
35,729
no_license
[ { "docstring": "Konstrukce objektu. :param dictMorpho: Cesta k souboru pro dictMorpho morphodity. :raises LemmatizerException: Když není definovaný tokenizer pro dodaný model. Nebo nevalidní slovník.", "name": "__init__", "signature": "def __init__(self, dictMorpho)" }, { "docstring": "Vrací lem...
5
stack_v2_sparse_classes_30k_train_006353
Implement the Python class `Lemmatizer` described below. Class description: Třída pro lemmatizaci slov a extrakci vybraných slovních druhů. Používá nástroj morphodita. Značky slovních druhů: N - 1 A - 2 P - 3 C - 4 V - 5 D - 6 R - 7 J - 8 T - 9 I - 10 Z - Symboly X - Neznámé Method signatures and docstrings: - def __...
Implement the Python class `Lemmatizer` described below. Class description: Třída pro lemmatizaci slov a extrakci vybraných slovních druhů. Používá nástroj morphodita. Značky slovních druhů: N - 1 A - 2 P - 3 C - 4 V - 5 D - 6 R - 7 J - 8 T - 9 I - 10 Z - Symboly X - Neznámé Method signatures and docstrings: - def __...
4e5395875d60ed3b138922d1100f6a4e05ac60e7
<|skeleton|> class Lemmatizer: """Třída pro lemmatizaci slov a extrakci vybraných slovních druhů. Používá nástroj morphodita. Značky slovních druhů: N - 1 A - 2 P - 3 C - 4 V - 5 D - 6 R - 7 J - 8 T - 9 I - 10 Z - Symboly X - Neznámé""" def __init__(self, dictMorpho): """Konstrukce objektu. :param dict...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Lemmatizer: """Třída pro lemmatizaci slov a extrakci vybraných slovních druhů. Používá nástroj morphodita. Značky slovních druhů: N - 1 A - 2 P - 3 C - 4 V - 5 D - 6 R - 7 J - 8 T - 9 I - 10 Z - Symboly X - Neznámé""" def __init__(self, dictMorpho): """Konstrukce objektu. :param dictMorpho: Cesta...
the_stack_v2_python_sparse
CPKclassifierPack/preprocessing/Preprocessing.py
KNOT-FIT-BUT/CPKclassifier
train
1
4dc032b772ae863399a6b8ff20a932cdbf18783a
[ "args = self.parser.parse_args()\ndata = self.build_data(args=args, collection='asset_site')\nreturn data", "args = self.parse_args(add_site_fields)\nsite = args.pop('site')\nscope_id = args.pop('scope_id')\nurl = utils.normal_url(site).strip('/')\nif not url:\n return utils.build_ret(ErrorMsg.DomainInvalid, {...
<|body_start_0|> args = self.parser.parse_args() data = self.build_data(args=args, collection='asset_site') return data <|end_body_0|> <|body_start_1|> args = self.parse_args(add_site_fields) site = args.pop('site') scope_id = args.pop('scope_id') url = utils.nor...
ARLAssetSite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ARLAssetSite: def get(self): """资产站点信息查询""" <|body_0|> def post(self): """添加站点到资产组中""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = self.parser.parse_args() data = self.build_data(args=args, collection='asset_site') return dat...
stack_v2_sparse_classes_36k_train_012148
8,529
no_license
[ { "docstring": "资产站点信息查询", "name": "get", "signature": "def get(self)" }, { "docstring": "添加站点到资产组中", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_019469
Implement the Python class `ARLAssetSite` described below. Class description: Implement the ARLAssetSite class. Method signatures and docstrings: - def get(self): 资产站点信息查询 - def post(self): 添加站点到资产组中
Implement the Python class `ARLAssetSite` described below. Class description: Implement the ARLAssetSite class. Method signatures and docstrings: - def get(self): 资产站点信息查询 - def post(self): 添加站点到资产组中 <|skeleton|> class ARLAssetSite: def get(self): """资产站点信息查询""" <|body_0|> def post(self): ...
5ca64806252b9e7e6d2b31a6bfaeecbfdc4baf06
<|skeleton|> class ARLAssetSite: def get(self): """资产站点信息查询""" <|body_0|> def post(self): """添加站点到资产组中""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ARLAssetSite: def get(self): """资产站点信息查询""" args = self.parser.parse_args() data = self.build_data(args=args, collection='asset_site') return data def post(self): """添加站点到资产组中""" args = self.parse_args(add_site_fields) site = args.pop('site') ...
the_stack_v2_python_sparse
app/routes/assetSite.py
QmF0c3UK/ARL
train
0
0ff5024261af037006235a72cc02bc4e6e1c8a84
[ "result_set = np.array([])\ndistinct_documents = list(set([(x['year'], x['document_name']) for x in dataset]))\nfor year, document in distinct_documents:\n items = [x['data'] for x in dataset if x['year'] == year and x['document_name'] == document]\n topic_ids = [x['topic_id'] for x in items[0]]\n weights ...
<|body_start_0|> result_set = np.array([]) distinct_documents = list(set([(x['year'], x['document_name']) for x in dataset])) for year, document in distinct_documents: items = [x['data'] for x in dataset if x['year'] == year and x['document_name'] == document] topic_ids =...
Reduces a composition file by adding all items, i.e. splitted documents or rows in the file, that belongs to the same document into a single items.
CompositionDocumentReducer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompositionDocumentReducer: """Reduces a composition file by adding all items, i.e. splitted documents or rows in the file, that belongs to the same document into a single items.""" def compute(self, dataset, threshold=0.0): """Compute a new composition data set by an addative reduce...
stack_v2_sparse_classes_36k_train_012149
13,916
no_license
[ { "docstring": "Compute a new composition data set by an addative reduce of all items that belongs to the same document", "name": "compute", "signature": "def compute(self, dataset, threshold=0.0)" }, { "docstring": "Writes dataset into a semicolon separated UTF-8 encoded text file using regiona...
2
stack_v2_sparse_classes_30k_train_002328
Implement the Python class `CompositionDocumentReducer` described below. Class description: Reduces a composition file by adding all items, i.e. splitted documents or rows in the file, that belongs to the same document into a single items. Method signatures and docstrings: - def compute(self, dataset, threshold=0.0):...
Implement the Python class `CompositionDocumentReducer` described below. Class description: Reduces a composition file by adding all items, i.e. splitted documents or rows in the file, that belongs to the same document into a single items. Method signatures and docstrings: - def compute(self, dataset, threshold=0.0):...
32fc444ed11649a948a7bf59653ec792396f06e3
<|skeleton|> class CompositionDocumentReducer: """Reduces a composition file by adding all items, i.e. splitted documents or rows in the file, that belongs to the same document into a single items.""" def compute(self, dataset, threshold=0.0): """Compute a new composition data set by an addative reduce...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompositionDocumentReducer: """Reduces a composition file by adding all items, i.e. splitted documents or rows in the file, that belongs to the same document into a single items.""" def compute(self, dataset, threshold=0.0): """Compute a new composition data set by an addative reduce of all items...
the_stack_v2_python_sparse
pending_deletes/topic_modelling/topic_co_occurrence.py
humlab/text_analytic_tools
train
2
9b17a340886e5d9b2c7586617e54a61bbf434be3
[ "request_new = clone_request(request, 'GET')\ndata = QueryDict('', mutable=True)\nparams = dict(request.GET.items())\nif 'u_id' in params:\n data['user_id'] = params['u_id']\nif 'p_id' in params:\n data['booking_ref'] = params.get('p_id')\nif 'pagination' in params:\n data['page_size'] = params['pagination...
<|body_start_0|> request_new = clone_request(request, 'GET') data = QueryDict('', mutable=True) params = dict(request.GET.items()) if 'u_id' in params: data['user_id'] = params['u_id'] if 'p_id' in params: data['booking_ref'] = params.get('p_id') i...
My Bookings Backward compatibility viewset. * Requires token for verification of the user.
MyBookingsBackwardViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyBookingsBackwardViewSet: """My Bookings Backward compatibility viewset. * Requires token for verification of the user.""" def clone_search_booking_request(self, request): """Clone request searchbookingv4.""" <|body_0|> def list(self, request, *args, **kwargs): ...
stack_v2_sparse_classes_36k_train_012150
19,225
no_license
[ { "docstring": "Clone request searchbookingv4.", "name": "clone_search_booking_request", "signature": "def clone_search_booking_request(self, request)" }, { "docstring": "Search booking v4. Args: request: version: *args: **kwargs: Returns:", "name": "list", "signature": "def list(self, r...
2
stack_v2_sparse_classes_30k_train_002875
Implement the Python class `MyBookingsBackwardViewSet` described below. Class description: My Bookings Backward compatibility viewset. * Requires token for verification of the user. Method signatures and docstrings: - def clone_search_booking_request(self, request): Clone request searchbookingv4. - def list(self, req...
Implement the Python class `MyBookingsBackwardViewSet` described below. Class description: My Bookings Backward compatibility viewset. * Requires token for verification of the user. Method signatures and docstrings: - def clone_search_booking_request(self, request): Clone request searchbookingv4. - def list(self, req...
26ca47c726f2c38211247a41d294e38a67cecb7f
<|skeleton|> class MyBookingsBackwardViewSet: """My Bookings Backward compatibility viewset. * Requires token for verification of the user.""" def clone_search_booking_request(self, request): """Clone request searchbookingv4.""" <|body_0|> def list(self, request, *args, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyBookingsBackwardViewSet: """My Bookings Backward compatibility viewset. * Requires token for verification of the user.""" def clone_search_booking_request(self, request): """Clone request searchbookingv4.""" request_new = clone_request(request, 'GET') data = QueryDict('', mutabl...
the_stack_v2_python_sparse
depot/apps/apis/my_bookings/views.py
rsenwar/depot
train
0
e28d554447a8898c872e589129b2ca698eae1bf8
[ "n = len(nums)\nif n <= 0:\n return 0\nnCurSum, nGreatestSum = (0, float('-inf'))\nfor i in range(n):\n if nCurSum <= 0:\n nCurSum = nums[i]\n else:\n nCurSum += nums[i]\n if nCurSum > nGreatestSum:\n nGreatestSum = nCurSum\nreturn nGreatestSum", "n = len(nums)\nif n <= 0:\n re...
<|body_start_0|> n = len(nums) if n <= 0: return 0 nCurSum, nGreatestSum = (0, float('-inf')) for i in range(n): if nCurSum <= 0: nCurSum = nums[i] else: nCurSum += nums[i] if nCurSum > nGreatestSum: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums: List[int]) -> int: """分析规律:贪心""" <|body_0|> def maxSubArray1(self, nums: List[int]) -> int: """状态转移方程:dp[i] 的值代表 nums 前 i 个数字的最大子数组和 if nums[i] > nums[i-1], dp[i] = max(dp[i], dp[j] + 1)""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_012151
2,099
permissive
[ { "docstring": "分析规律:贪心", "name": "maxSubArray", "signature": "def maxSubArray(self, nums: List[int]) -> int" }, { "docstring": "状态转移方程:dp[i] 的值代表 nums 前 i 个数字的最大子数组和 if nums[i] > nums[i-1], dp[i] = max(dp[i], dp[j] + 1)", "name": "maxSubArray1", "signature": "def maxSubArray1(self, nums...
2
stack_v2_sparse_classes_30k_train_002828
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: List[int]) -> int: 分析规律:贪心 - def maxSubArray1(self, nums: List[int]) -> int: 状态转移方程:dp[i] 的值代表 nums 前 i 个数字的最大子数组和 if nums[i] > nums[i-1], dp[i] = max...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: List[int]) -> int: 分析规律:贪心 - def maxSubArray1(self, nums: List[int]) -> int: 状态转移方程:dp[i] 的值代表 nums 前 i 个数字的最大子数组和 if nums[i] > nums[i-1], dp[i] = max...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def maxSubArray(self, nums: List[int]) -> int: """分析规律:贪心""" <|body_0|> def maxSubArray1(self, nums: List[int]) -> int: """状态转移方程:dp[i] 的值代表 nums 前 i 个数字的最大子数组和 if nums[i] > nums[i-1], dp[i] = max(dp[i], dp[j] + 1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums: List[int]) -> int: """分析规律:贪心""" n = len(nums) if n <= 0: return 0 nCurSum, nGreatestSum = (0, float('-inf')) for i in range(n): if nCurSum <= 0: nCurSum = nums[i] else: ...
the_stack_v2_python_sparse
lcof/42-lian-xu-zi-shu-zu-de-zui-da-he-lcof.py
yuenliou/leetcode
train
0
608e07310af9aa3571de4855f3142bdc8424630a
[ "tm = TransactionManager()\ntm.retry_attempt_count = 1\nself.request.update(request=self.make_faux_request(tm=tm))\nwith tm:\n return self.run(*args, **kwargs)", "if self.request.is_eager:\n return self.exec_eager(*args, **kwargs)\nrequest = self.get_request()\ntask = self\ntry:\n\n @retryable(tm=request...
<|body_start_0|> tm = TransactionManager() tm.retry_attempt_count = 1 self.request.update(request=self.make_faux_request(tm=tm)) with tm: return self.run(*args, **kwargs) <|end_body_0|> <|body_start_1|> if self.request.is_eager: return self.exec_eager(*ar...
Celery task that commits all the work at the end of the task using transaction manager commit. A base class to be used with :py:meth:`celery.Celery.task` function decorator. Automatically commits all the work at the end of the task. In the case of transaction conflict, the task will rerun based on :func:`pyramid_tm.tm_...
RetryableTransactionTask
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetryableTransactionTask: """Celery task that commits all the work at the end of the task using transaction manager commit. A base class to be used with :py:meth:`celery.Celery.task` function decorator. Automatically commits all the work at the end of the task. In the case of transaction conflict...
stack_v2_sparse_classes_36k_train_012152
11,925
permissive
[ { "docstring": "Run transaction aware task in eager mode.", "name": "exec_eager", "signature": "def exec_eager(self, *args, **kwargs)" }, { "docstring": "Call Celery task and insert request argument.", "name": "__call__", "signature": "def __call__(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_001671
Implement the Python class `RetryableTransactionTask` described below. Class description: Celery task that commits all the work at the end of the task using transaction manager commit. A base class to be used with :py:meth:`celery.Celery.task` function decorator. Automatically commits all the work at the end of the ta...
Implement the Python class `RetryableTransactionTask` described below. Class description: Celery task that commits all the work at the end of the task using transaction manager commit. A base class to be used with :py:meth:`celery.Celery.task` function decorator. Automatically commits all the work at the end of the ta...
a57de54fb8a3fae859f24f373f0292e1e4b3c344
<|skeleton|> class RetryableTransactionTask: """Celery task that commits all the work at the end of the task using transaction manager commit. A base class to be used with :py:meth:`celery.Celery.task` function decorator. Automatically commits all the work at the end of the task. In the case of transaction conflict...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetryableTransactionTask: """Celery task that commits all the work at the end of the task using transaction manager commit. A base class to be used with :py:meth:`celery.Celery.task` function decorator. Automatically commits all the work at the end of the task. In the case of transaction conflict, the task wi...
the_stack_v2_python_sparse
websauna/system/task/tasks.py
websauna/websauna
train
294
bb2df406d51564812edf99357cb4881afb6069a8
[ "if request.user.is_authenticated():\n return True\nreturn False", "if request.user.is_authenticated():\n if request.user.is_staff:\n return True\n return account.username == request.user.username\nreturn False" ]
<|body_start_0|> if request.user.is_authenticated(): return True return False <|end_body_0|> <|body_start_1|> if request.user.is_authenticated(): if request.user.is_staff: return True return account.username == request.user.username re...
Returns true if the request.user is owner of the account or Admin
IsAdminOrAccountOwner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsAdminOrAccountOwner: """Returns true if the request.user is owner of the account or Admin""" def has_permission(self, request, view): """Returns true or false if the user has the permission :param view: View set :return: Boolean with the user permission""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_012153
1,273
no_license
[ { "docstring": "Returns true or false if the user has the permission :param view: View set :return: Boolean with the user permission", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Returns `True` if permission is granted, `False` otherwise.",...
2
stack_v2_sparse_classes_30k_train_008093
Implement the Python class `IsAdminOrAccountOwner` described below. Class description: Returns true if the request.user is owner of the account or Admin Method signatures and docstrings: - def has_permission(self, request, view): Returns true or false if the user has the permission :param view: View set :return: Bool...
Implement the Python class `IsAdminOrAccountOwner` described below. Class description: Returns true if the request.user is owner of the account or Admin Method signatures and docstrings: - def has_permission(self, request, view): Returns true or false if the user has the permission :param view: View set :return: Bool...
9635d7ac37da6b705f6c95803d98956cfbd30ec4
<|skeleton|> class IsAdminOrAccountOwner: """Returns true if the request.user is owner of the account or Admin""" def has_permission(self, request, view): """Returns true or false if the user has the permission :param view: View set :return: Boolean with the user permission""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsAdminOrAccountOwner: """Returns true if the request.user is owner of the account or Admin""" def has_permission(self, request, view): """Returns true or false if the user has the permission :param view: View set :return: Boolean with the user permission""" if request.user.is_authenticat...
the_stack_v2_python_sparse
trashradar-api/accounts/permissions.py
kahihia/trashradar-api
train
0
700c101752261ad9721382912025c6a0f2508678
[ "time_elements_structure = self._GetValueFromStructure(structure, 'date_time')\nevent_data = SnortFastAlertEventData()\nevent_data.classification = self._GetValueFromStructure(structure, 'classification')\nevent_data.destination_ip = self._GetValueFromStructure(structure, 'destination_ip_address')\nevent_data.desti...
<|body_start_0|> time_elements_structure = self._GetValueFromStructure(structure, 'date_time') event_data = SnortFastAlertEventData() event_data.classification = self._GetValueFromStructure(structure, 'classification') event_data.destination_ip = self._GetValueFromStructure(structure, 'd...
Text parser plugin for Snort3/Suricata fast-log alert log files.
SnortFastLogTextPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnortFastLogTextPlugin: """Text parser plugin for Snort3/Suricata fast-log alert log files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components,...
stack_v2_sparse_classes_36k_train_012154
9,211
permissive
[ { "docstring": "Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. key (str): name of the parsed structure. structure (pyparsing.ParseResults): tokens from a parsed log line. Raises: ParseError: if the stru...
3
null
Implement the Python class `SnortFastLogTextPlugin` described below. Class description: Text parser plugin for Snort3/Suricata fast-log alert log files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, key, structure): Parses a pyparsing structure. Args: parser_mediator (ParserMediator): me...
Implement the Python class `SnortFastLogTextPlugin` described below. Class description: Text parser plugin for Snort3/Suricata fast-log alert log files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, key, structure): Parses a pyparsing structure. Args: parser_mediator (ParserMediator): me...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class SnortFastLogTextPlugin: """Text parser plugin for Snort3/Suricata fast-log alert log files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnortFastLogTextPlugin: """Text parser plugin for Snort3/Suricata fast-log alert log files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as stor...
the_stack_v2_python_sparse
plaso/parsers/text_plugins/snort_fastlog.py
log2timeline/plaso
train
1,506
d1334990644b30156a64546b7518735edc7f1f4d
[ "tree = copy(obj.__dict__)\nif tree['coordinates'].ndim <= 2:\n tree['coordinates'] = tree['coordinates'].data\nreturn tree", "from weldx.constants import Q_\nif tag == 'asdf://weldx.bam.de/weldx/tags/core/geometry/spatial_data-0.1.0':\n node['coordinates'] = Q_(node['coordinates'], 'mm')\nreturn SpatialDat...
<|body_start_0|> tree = copy(obj.__dict__) if tree['coordinates'].ndim <= 2: tree['coordinates'] = tree['coordinates'].data return tree <|end_body_0|> <|body_start_1|> from weldx.constants import Q_ if tag == 'asdf://weldx.bam.de/weldx/tags/core/geometry/spatial_data...
Converter for SpatialData.
SpatialDataConverter
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialDataConverter: """Converter for SpatialData.""" def to_yaml_tree(self, obj: SpatialData, tag: str, ctx) -> dict: """Serialize into tree.""" <|body_0|> def from_yaml_tree(self, node: dict, tag: str, ctx) -> SpatialData: """Reconstruct from yaml node.""" ...
stack_v2_sparse_classes_36k_train_012155
990
permissive
[ { "docstring": "Serialize into tree.", "name": "to_yaml_tree", "signature": "def to_yaml_tree(self, obj: SpatialData, tag: str, ctx) -> dict" }, { "docstring": "Reconstruct from yaml node.", "name": "from_yaml_tree", "signature": "def from_yaml_tree(self, node: dict, tag: str, ctx) -> Sp...
2
null
Implement the Python class `SpatialDataConverter` described below. Class description: Converter for SpatialData. Method signatures and docstrings: - def to_yaml_tree(self, obj: SpatialData, tag: str, ctx) -> dict: Serialize into tree. - def from_yaml_tree(self, node: dict, tag: str, ctx) -> SpatialData: Reconstruct f...
Implement the Python class `SpatialDataConverter` described below. Class description: Converter for SpatialData. Method signatures and docstrings: - def to_yaml_tree(self, obj: SpatialData, tag: str, ctx) -> dict: Serialize into tree. - def from_yaml_tree(self, node: dict, tag: str, ctx) -> SpatialData: Reconstruct f...
7bc16a196ee669822f3663f3c7a08f6bbd0c76d5
<|skeleton|> class SpatialDataConverter: """Converter for SpatialData.""" def to_yaml_tree(self, obj: SpatialData, tag: str, ctx) -> dict: """Serialize into tree.""" <|body_0|> def from_yaml_tree(self, node: dict, tag: str, ctx) -> SpatialData: """Reconstruct from yaml node.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpatialDataConverter: """Converter for SpatialData.""" def to_yaml_tree(self, obj: SpatialData, tag: str, ctx) -> dict: """Serialize into tree.""" tree = copy(obj.__dict__) if tree['coordinates'].ndim <= 2: tree['coordinates'] = tree['coordinates'].data return ...
the_stack_v2_python_sparse
weldx/tags/core/geometry/spatial_data.py
BAMWelDX/weldx
train
20
cd380f18c7d47aab90558f7754cf8554445a534b
[ "super(RND, self).__init__(state_size, action_size, eta)\nself.hidden_dim = hidden_dim\nself.state_rep_size = state_rep_size\nself.learning_rate = learning_rate\nself.predictor_dev = 'cpu'\nself.target_dev = 'cpu'\nself.predictor_model = RNDNetwork(state_size, action_size, hidden_dim, state_rep_size)\nself.target_m...
<|body_start_0|> super(RND, self).__init__(state_size, action_size, eta) self.hidden_dim = hidden_dim self.state_rep_size = state_rep_size self.learning_rate = learning_rate self.predictor_dev = 'cpu' self.target_dev = 'cpu' self.predictor_model = RNDNetwork(state...
Random Network Distillation (RND) class Paper: Burda, Y., Edwards, H., Storkey, A., & Klimov, O. (2018). Exploration by random network distillation. arXiv preprint arXiv:1810.12894. Link: https://arxiv.org/abs/1810.12894
RND
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RND: """Random Network Distillation (RND) class Paper: Burda, Y., Edwards, H., Storkey, A., & Klimov, O. (2018). Exploration by random network distillation. arXiv preprint arXiv:1810.12894. Link: https://arxiv.org/abs/1810.12894""" def __init__(self, state_size, action_size, hidden_dim=128, ...
stack_v2_sparse_classes_36k_train_012156
3,425
no_license
[ { "docstring": "Initialise parameters for MARL training :param state_size: dimension of state input :param action_size: dimension of action input :param hidden_dim: hidden dimension of networks :param state_rep_size: dimension of state representation in network :param learning_rate: learning rate for ICM parame...
3
stack_v2_sparse_classes_30k_train_013191
Implement the Python class `RND` described below. Class description: Random Network Distillation (RND) class Paper: Burda, Y., Edwards, H., Storkey, A., & Klimov, O. (2018). Exploration by random network distillation. arXiv preprint arXiv:1810.12894. Link: https://arxiv.org/abs/1810.12894 Method signatures and docstr...
Implement the Python class `RND` described below. Class description: Random Network Distillation (RND) class Paper: Burda, Y., Edwards, H., Storkey, A., & Klimov, O. (2018). Exploration by random network distillation. arXiv preprint arXiv:1810.12894. Link: https://arxiv.org/abs/1810.12894 Method signatures and docstr...
2afa0a9d83bd66a151c1a19242c5ef22cf4eb1f6
<|skeleton|> class RND: """Random Network Distillation (RND) class Paper: Burda, Y., Edwards, H., Storkey, A., & Klimov, O. (2018). Exploration by random network distillation. arXiv preprint arXiv:1810.12894. Link: https://arxiv.org/abs/1810.12894""" def __init__(self, state_size, action_size, hidden_dim=128, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RND: """Random Network Distillation (RND) class Paper: Burda, Y., Edwards, H., Storkey, A., & Klimov, O. (2018). Exploration by random network distillation. arXiv preprint arXiv:1810.12894. Link: https://arxiv.org/abs/1810.12894""" def __init__(self, state_size, action_size, hidden_dim=128, state_rep_siz...
the_stack_v2_python_sparse
intrinsic_rewards/rnd/rnd.py
Jarvis-K/MSc_Curiosity_MARL
train
0
510a03632a8c6eafebd6b14c8786f73655d6f77f
[ "super(MaskedMSELoss, self).__init__()\nif reduction != 'mean':\n NotImplementedError\nself.reduction = reduction", "assert x.shape == target.shape == mask.shape\nsquared_error = (torch.flatten(x) - torch.flatten(target)) ** 2.0 * torch.flatten(mask)\nif self.reduction == 'mean':\n result = torch.sum(square...
<|body_start_0|> super(MaskedMSELoss, self).__init__() if reduction != 'mean': NotImplementedError self.reduction = reduction <|end_body_0|> <|body_start_1|> assert x.shape == target.shape == mask.shape squared_error = (torch.flatten(x) - torch.flatten(target)) ** 2....
Masked MSE Loss module Arguments: torch {torch.nn.modules.loss._Loss} -- inherits from _Loss
MaskedMSELoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskedMSELoss: """Masked MSE Loss module Arguments: torch {torch.nn.modules.loss._Loss} -- inherits from _Loss""" def __init__(self, reduction: str='mean'): """Constructor Arguments: reduction (string, optional) -- how MSE should be reduced. Defaults to 'mean'.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_012157
2,211
permissive
[ { "docstring": "Constructor Arguments: reduction (string, optional) -- how MSE should be reduced. Defaults to 'mean'.", "name": "__init__", "signature": "def __init__(self, reduction: str='mean')" }, { "docstring": "Foreward pass Args: x (torch.Tensor): input tensor (output from neural network) ...
2
stack_v2_sparse_classes_30k_train_018271
Implement the Python class `MaskedMSELoss` described below. Class description: Masked MSE Loss module Arguments: torch {torch.nn.modules.loss._Loss} -- inherits from _Loss Method signatures and docstrings: - def __init__(self, reduction: str='mean'): Constructor Arguments: reduction (string, optional) -- how MSE shou...
Implement the Python class `MaskedMSELoss` described below. Class description: Masked MSE Loss module Arguments: torch {torch.nn.modules.loss._Loss} -- inherits from _Loss Method signatures and docstrings: - def __init__(self, reduction: str='mean'): Constructor Arguments: reduction (string, optional) -- how MSE shou...
5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3
<|skeleton|> class MaskedMSELoss: """Masked MSE Loss module Arguments: torch {torch.nn.modules.loss._Loss} -- inherits from _Loss""" def __init__(self, reduction: str='mean'): """Constructor Arguments: reduction (string, optional) -- how MSE should be reduced. Defaults to 'mean'.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskedMSELoss: """Masked MSE Loss module Arguments: torch {torch.nn.modules.loss._Loss} -- inherits from _Loss""" def __init__(self, reduction: str='mean'): """Constructor Arguments: reduction (string, optional) -- how MSE should be reduced. Defaults to 'mean'.""" super(MaskedMSELoss, sel...
the_stack_v2_python_sparse
src/models/anomalia/losses.py
maurony/ts-vrae
train
1
13c2070910709952904bde6c9c10bcc81d0ec81d
[ "self._mass_slice_list = []\nfor i in range(len(mass_map_list)):\n self._mass_slice_list.append(MassSlice(mass_map_list[i], grid_spacing_list[i], redshift_list[i]))\nself._mass_map_list = mass_map_list\nself._grid_spacing_list = grid_spacing_list\nself._redshift_list = redshift_list", "lens_model = LensModel(l...
<|body_start_0|> self._mass_slice_list = [] for i in range(len(mass_map_list)): self._mass_slice_list.append(MassSlice(mass_map_list[i], grid_spacing_list[i], redshift_list[i])) self._mass_map_list = mass_map_list self._grid_spacing_list = grid_spacing_list self._reds...
class to perform multi-plane ray-tracing from convergence maps at different redshifts From the convergence maps the deflection angles and lensing potential are computed (from different settings) and then an interpolated grid of all those quantities generate an instance of the lenstronomy LensModel multi-plane instance....
LightCone
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LightCone: """class to perform multi-plane ray-tracing from convergence maps at different redshifts From the convergence maps the deflection angles and lensing potential are computed (from different settings) and then an interpolated grid of all those quantities generate an instance of the lenstr...
stack_v2_sparse_classes_36k_train_012158
5,293
permissive
[ { "docstring": ":param mass_map_list: 2d numpy array of mass map (in units physical Solar masses enclosed in each pixel/gird point of the map) :param grid_spacing_list: list of grid spacing of the individual mass maps in units of physical Mpc :param redshift_list: list of redshifts of the mass maps", "name"...
2
stack_v2_sparse_classes_30k_train_020837
Implement the Python class `LightCone` described below. Class description: class to perform multi-plane ray-tracing from convergence maps at different redshifts From the convergence maps the deflection angles and lensing potential are computed (from different settings) and then an interpolated grid of all those quanti...
Implement the Python class `LightCone` described below. Class description: class to perform multi-plane ray-tracing from convergence maps at different redshifts From the convergence maps the deflection angles and lensing potential are computed (from different settings) and then an interpolated grid of all those quanti...
73c9645f26f6983fe7961104075ebe8bf7a4b54c
<|skeleton|> class LightCone: """class to perform multi-plane ray-tracing from convergence maps at different redshifts From the convergence maps the deflection angles and lensing potential are computed (from different settings) and then an interpolated grid of all those quantities generate an instance of the lenstr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LightCone: """class to perform multi-plane ray-tracing from convergence maps at different redshifts From the convergence maps the deflection angles and lensing potential are computed (from different settings) and then an interpolated grid of all those quantities generate an instance of the lenstronomy LensMod...
the_stack_v2_python_sparse
lenstronomy/LensModel/LightConeSim/light_cone.py
lenstronomy/lenstronomy
train
41
483140f5d0b3338d66a8d055fbab662f812b53d1
[ "self.confirmed = confirmed\nself.synchronous = synchronous\nself.actions = actions", "if dictionary is None:\n return None\nactions = None\nif dictionary.get('actions') != None:\n actions = list()\n for structure in dictionary.get('actions'):\n actions.append(meraki_sdk.models.action_model.Action...
<|body_start_0|> self.confirmed = confirmed self.synchronous = synchronous self.actions = actions <|end_body_0|> <|body_start_1|> if dictionary is None: return None actions = None if dictionary.get('actions') != None: actions = list() ...
Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset once it is true. Defaults to false. synchronous (bool): Set to...
CreateOrganizationActionBatchModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateOrganizationActionBatchModel: """Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset ...
stack_v2_sparse_classes_36k_train_012159
2,674
permissive
[ { "docstring": "Constructor for the CreateOrganizationActionBatchModel class", "name": "__init__", "signature": "def __init__(self, actions=None, confirmed=None, synchronous=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary ...
2
stack_v2_sparse_classes_30k_train_005815
Implement the Python class `CreateOrganizationActionBatchModel` described below. Class description: Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before ex...
Implement the Python class `CreateOrganizationActionBatchModel` described below. Class description: Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before ex...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class CreateOrganizationActionBatchModel: """Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateOrganizationActionBatchModel: """Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset once it is tr...
the_stack_v2_python_sparse
meraki_sdk/models/create_organization_action_batch_model.py
RaulCatalano/meraki-python-sdk
train
1
ebdb42da6564b6d827b1d617299e402fc85111c1
[ "log_object_input_state(self, locals())\nself.image_pointer = image_name\nself.mask_name = mask_name\nself.label_name = label_name\nself.metadata_pointers = metadata_names\nself.pred_name = pred_name\nself.matching_function = FuseUtilsImageProcessing.match_img_to_input", "image = FuseUtilsHierarchicalDict.get(sam...
<|body_start_0|> log_object_input_state(self, locals()) self.image_pointer = image_name self.mask_name = mask_name self.label_name = label_name self.metadata_pointers = metadata_names self.pred_name = pred_name self.matching_function = FuseUtilsImageProcessing.mat...
Visualizer for data including single 2D image with optional mask
FuseVisualizerDefault
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuseVisualizerDefault: """Visualizer for data including single 2D image with optional mask""" def __init__(self, image_name: str, mask_name: Optional[str]=None, label_name: Optional[str]=None, metadata_names: Iterable[str]=tuple(), pred_name: Optional[str]=None): """:param image_name...
stack_v2_sparse_classes_36k_train_012160
7,546
permissive
[ { "docstring": ":param image_name: hierarchical key name of the image in batch_dict :param mask_name: hierarchical key name of the mask (gt map) in batch_dict. Optional, won't be displayed if not specified. :param label_name: hierarchical key name of the to a global label in batch_dict. Optional, won't be displ...
4
stack_v2_sparse_classes_30k_train_011377
Implement the Python class `FuseVisualizerDefault` described below. Class description: Visualizer for data including single 2D image with optional mask Method signatures and docstrings: - def __init__(self, image_name: str, mask_name: Optional[str]=None, label_name: Optional[str]=None, metadata_names: Iterable[str]=t...
Implement the Python class `FuseVisualizerDefault` described below. Class description: Visualizer for data including single 2D image with optional mask Method signatures and docstrings: - def __init__(self, image_name: str, mask_name: Optional[str]=None, label_name: Optional[str]=None, metadata_names: Iterable[str]=t...
acbfd4975f18cd4361d31697faf2f82036399865
<|skeleton|> class FuseVisualizerDefault: """Visualizer for data including single 2D image with optional mask""" def __init__(self, image_name: str, mask_name: Optional[str]=None, label_name: Optional[str]=None, metadata_names: Iterable[str]=tuple(), pred_name: Optional[str]=None): """:param image_name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FuseVisualizerDefault: """Visualizer for data including single 2D image with optional mask""" def __init__(self, image_name: str, mask_name: Optional[str]=None, label_name: Optional[str]=None, metadata_names: Iterable[str]=tuple(), pred_name: Optional[str]=None): """:param image_name: hierarchica...
the_stack_v2_python_sparse
fuse/data/visualizer/visualizer_default.py
rosenzvi/fuse-med-ml
train
0
07d568d5e587a2dd2964e0f5136993d1f8d8aa8d
[ "if xml_path == None:\n script_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n xml_path = script_path + '/../robot_description/' + self.default_xml_file\nMjRobot.__init__(self, xml_path, object_names=object_names, render=render, g_comp=g_comp, tool_mass=tool_mass, tool_mass_...
<|body_start_0|> if xml_path == None: script_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) xml_path = script_path + '/../robot_description/' + self.default_xml_file MjRobot.__init__(self, xml_path, object_names=object_names, render=render, g_com...
The 4 DoF, 80V Barret WAM robot
MjWam4
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MjWam4: """The 4 DoF, 80V Barret WAM robot""" def __init__(self, xml_path=None, object_names=[], render=True, g_comp=False, tool_mass=0, tool_mass_site=None): """The 4 DoF, 80V Barret WAM robot xml_path: to change the robots environment or end effector, provide a modified version of ...
stack_v2_sparse_classes_36k_train_012161
22,293
no_license
[ { "docstring": "The 4 DoF, 80V Barret WAM robot xml_path: to change the robots environment or end effector, provide a modified version of the default xml description file object_names: states of the listed objects are included in recordings render: whether or not to render the simulation g_comp: whether or not ...
2
stack_v2_sparse_classes_30k_train_004125
Implement the Python class `MjWam4` described below. Class description: The 4 DoF, 80V Barret WAM robot Method signatures and docstrings: - def __init__(self, xml_path=None, object_names=[], render=True, g_comp=False, tool_mass=0, tool_mass_site=None): The 4 DoF, 80V Barret WAM robot xml_path: to change the robots en...
Implement the Python class `MjWam4` described below. Class description: The 4 DoF, 80V Barret WAM robot Method signatures and docstrings: - def __init__(self, xml_path=None, object_names=[], render=True, g_comp=False, tool_mass=0, tool_mass_site=None): The 4 DoF, 80V Barret WAM robot xml_path: to change the robots en...
dd7c19b347e8167f9f5e1cd4ae32fbec194dc046
<|skeleton|> class MjWam4: """The 4 DoF, 80V Barret WAM robot""" def __init__(self, xml_path=None, object_names=[], render=True, g_comp=False, tool_mass=0, tool_mass_site=None): """The 4 DoF, 80V Barret WAM robot xml_path: to change the robots environment or end effector, provide a modified version of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MjWam4: """The 4 DoF, 80V Barret WAM robot""" def __init__(self, xml_path=None, object_names=[], render=True, g_comp=False, tool_mass=0, tool_mass_site=None): """The 4 DoF, 80V Barret WAM robot xml_path: to change the robots environment or end effector, provide a modified version of the default x...
the_stack_v2_python_sparse
mujoco_robots/robots.py
kploeger/mujoco_robots
train
0
3c84ca4fa420335d54a90e4f610938c8eb382f5a
[ "self.filename = filename\nself.step = depend_value(name='step', value=step)\nself.stride = stride\nself.overwrite = overwrite\nself._storing = False\nself._continued = False", "self.simul = simul\nimport ipi.inputs.simulation as isimulation\nself.status = isimulation.InputSimulation()\nself.status.store(simul)",...
<|body_start_0|> self.filename = filename self.step = depend_value(name='step', value=step) self.stride = stride self.overwrite = overwrite self._storing = False self._continued = False <|end_body_0|> <|body_start_1|> self.simul = simul import ipi.inputs....
Class dealing with outputting checkpoints. Saves the complete status of the simulation at regular intervals. Attributes: filename: The (base) name of the file to output to. step: the number of times a checkpoint has been written out. stride: The number of steps that should be taken between outputting the data to file. ...
CheckpointOutput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckpointOutput: """Class dealing with outputting checkpoints. Saves the complete status of the simulation at regular intervals. Attributes: filename: The (base) name of the file to output to. step: the number of times a checkpoint has been written out. stride: The number of steps that should be...
stack_v2_sparse_classes_36k_train_012162
22,634
no_license
[ { "docstring": "Initializes a checkpoint output proxy. Args: filename: A string giving the name of the file to be output to. stride: An integer giving how many steps should be taken between outputting the data to file. overwrite: If True, the checkpoint file is overwritten at each output. If False, will output ...
4
stack_v2_sparse_classes_30k_train_010113
Implement the Python class `CheckpointOutput` described below. Class description: Class dealing with outputting checkpoints. Saves the complete status of the simulation at regular intervals. Attributes: filename: The (base) name of the file to output to. step: the number of times a checkpoint has been written out. str...
Implement the Python class `CheckpointOutput` described below. Class description: Class dealing with outputting checkpoints. Saves the complete status of the simulation at regular intervals. Attributes: filename: The (base) name of the file to output to. step: the number of times a checkpoint has been written out. str...
57f255266d4668bafef0881d1e7cbf8a27270ddd
<|skeleton|> class CheckpointOutput: """Class dealing with outputting checkpoints. Saves the complete status of the simulation at regular intervals. Attributes: filename: The (base) name of the file to output to. step: the number of times a checkpoint has been written out. stride: The number of steps that should be...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckpointOutput: """Class dealing with outputting checkpoints. Saves the complete status of the simulation at regular intervals. Attributes: filename: The (base) name of the file to output to. step: the number of times a checkpoint has been written out. stride: The number of steps that should be taken betwee...
the_stack_v2_python_sparse
ipi/engine/outputs.py
i-pi/i-pi
train
170
90f428307e171c6d8fd2dd07b7e3f5e62735fd0c
[ "super(TeardownSession, self).__init__(*args, **kwargs)\nself.tools = tools\nreturn", "for tool in self.tools:\n tool.run()\nreturn" ]
<|body_start_0|> super(TeardownSession, self).__init__(*args, **kwargs) self.tools = tools return <|end_body_0|> <|body_start_1|> for tool in self.tools: tool.run() return <|end_body_1|>
The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.
TeardownSession
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeardownSession: """The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.""" def __init__(self, tools, *ar...
stack_v2_sparse_classes_36k_train_012163
780
permissive
[ { "docstring": ":param: - `tools`: a list of tools to run", "name": "__init__", "signature": "def __init__(self, tools, *args, **kwargs)" }, { "docstring": "Calls the run() method for each tool in `tools`", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_016065
Implement the Python class `TeardownSession` described below. Class description: The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm...
Implement the Python class `TeardownSession` described below. Class description: The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class TeardownSession: """The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.""" def __init__(self, tools, *ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeardownSession: """The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.""" def __init__(self, tools, *args, **kwargs)...
the_stack_v2_python_sparse
apetools/proletarians/teardown.py
russell-n/oldape
train
0
5c82cb99e568a7365b0748d3930c8d7e30083d7d
[ "if not A:\n return []\nresult = list(A[0])\nfor colum in A[1:]:\n current = []\n for c in colum:\n if c in result:\n current.append(c)\n result.remove(c)\n result = current\nreturn result", "if not A:\n return []\ndata = {}\nfor d in A[0]:\n data[d] = data.get(d, 0)...
<|body_start_0|> if not A: return [] result = list(A[0]) for colum in A[1:]: current = [] for c in colum: if c in result: current.append(c) result.remove(c) result = current return res...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not A: return [] resu...
stack_v2_sparse_classes_36k_train_012164
1,982
permissive
[ { "docstring": ":type A: List[str] :rtype: List[str]", "name": "_commonChars", "signature": "def _commonChars(self, A)" }, { "docstring": ":type A: List[str] :rtype: List[str]", "name": "commonChars", "signature": "def commonChars(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars(self, A): :type A: List[str] :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars(self, A): :type A: List[str] :rtype: List[str] <|skeleton|> class Solution: def _commonCha...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _commonChars(self, A): """:type A: List[str] :rtype: List[str]""" if not A: return [] result = list(A[0]) for colum in A[1:]: current = [] for c in colum: if c in result: current.append(c) ...
the_stack_v2_python_sparse
1002.find-common-characters.py
windard/leeeeee
train
0
e3e896be8568f3821d24c9de516942636c08ed72
[ "self.tokenizer = spm.SentencePieceProcessor()\nself.tokenizer.Load(model)\nself.specials = specials\nself.lower = lower\nself.vocab_size = self.tokenizer.get_piece_size()\nself.pre_id = []\nself.post_id = []\nif prepend_bos:\n self.pre_id.append(self.tokenizer.piece_to_id(self.specials.BOS.value))\nif append_eo...
<|body_start_0|> self.tokenizer = spm.SentencePieceProcessor() self.tokenizer.Load(model) self.specials = specials self.lower = lower self.vocab_size = self.tokenizer.get_piece_size() self.pre_id = [] self.post_id = [] if prepend_bos: self.pre_...
SentencepieceTokenizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentencepieceTokenizer: def __init__(self, lower: bool=True, model: Optional[Any]=None, prepend_bos: bool=False, append_eos: bool=False, specials: Optional[SPECIAL_TOKENS]=SPECIAL_TOKENS): """Tokenize sentence using pretrained sentencepiece model Args: lower (bool): Lowercase string. Def...
stack_v2_sparse_classes_36k_train_012165
8,041
permissive
[ { "docstring": "Tokenize sentence using pretrained sentencepiece model Args: lower (bool): Lowercase string. Defaults to True. model (Optional[Any]): Sentencepiece model. Defaults to None. prepend_bos (bool): Prepend BOS for seq2seq. Defaults to False. append_eos (bool): Append EOS for seq2seq. Defaults to Fals...
2
stack_v2_sparse_classes_30k_train_001696
Implement the Python class `SentencepieceTokenizer` described below. Class description: Implement the SentencepieceTokenizer class. Method signatures and docstrings: - def __init__(self, lower: bool=True, model: Optional[Any]=None, prepend_bos: bool=False, append_eos: bool=False, specials: Optional[SPECIAL_TOKENS]=SP...
Implement the Python class `SentencepieceTokenizer` described below. Class description: Implement the SentencepieceTokenizer class. Method signatures and docstrings: - def __init__(self, lower: bool=True, model: Optional[Any]=None, prepend_bos: bool=False, append_eos: bool=False, specials: Optional[SPECIAL_TOKENS]=SP...
e4987310ed277abdec19462bdd749e2e7a000bec
<|skeleton|> class SentencepieceTokenizer: def __init__(self, lower: bool=True, model: Optional[Any]=None, prepend_bos: bool=False, append_eos: bool=False, specials: Optional[SPECIAL_TOKENS]=SPECIAL_TOKENS): """Tokenize sentence using pretrained sentencepiece model Args: lower (bool): Lowercase string. Def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SentencepieceTokenizer: def __init__(self, lower: bool=True, model: Optional[Any]=None, prepend_bos: bool=False, append_eos: bool=False, specials: Optional[SPECIAL_TOKENS]=SPECIAL_TOKENS): """Tokenize sentence using pretrained sentencepiece model Args: lower (bool): Lowercase string. Defaults to True....
the_stack_v2_python_sparse
slp/data/transforms.py
georgepar/slp
train
26
2db669b00646c72ca4c963caeed9bcb3d7e9453b
[ "super(DiscordIO, self).__init__()\nconfig = ClientConfig()\nconfig.token = token\nclient = Client(config)\nself.text = self.__class__.__name__\ntry:\n self.message = client.api.channels_messages_create(channel_id, self.text)\nexcept Exception as e:\n tqdm_auto.write(str(e))", "if not s:\n s = '...'\ns =...
<|body_start_0|> super(DiscordIO, self).__init__() config = ClientConfig() config.token = token client = Client(config) self.text = self.__class__.__name__ try: self.message = client.api.channels_messages_create(channel_id, self.text) except Exception ...
Non-blocking file-like IO using a Discord Bot.
DiscordIO
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscordIO: """Non-blocking file-like IO using a Discord Bot.""" def __init__(self, token, channel_id): """Creates a new message in the given `channel_id`.""" <|body_0|> def write(self, s): """Replaces internal `message`'s text with `s`.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_012166
3,930
permissive
[ { "docstring": "Creates a new message in the given `channel_id`.", "name": "__init__", "signature": "def __init__(self, token, channel_id)" }, { "docstring": "Replaces internal `message`'s text with `s`.", "name": "write", "signature": "def write(self, s)" } ]
2
null
Implement the Python class `DiscordIO` described below. Class description: Non-blocking file-like IO using a Discord Bot. Method signatures and docstrings: - def __init__(self, token, channel_id): Creates a new message in the given `channel_id`. - def write(self, s): Replaces internal `message`'s text with `s`.
Implement the Python class `DiscordIO` described below. Class description: Non-blocking file-like IO using a Discord Bot. Method signatures and docstrings: - def __init__(self, token, channel_id): Creates a new message in the given `channel_id`. - def write(self, s): Replaces internal `message`'s text with `s`. <|sk...
39efe4007fba2b12b75c72f7795827a1f74d640b
<|skeleton|> class DiscordIO: """Non-blocking file-like IO using a Discord Bot.""" def __init__(self, token, channel_id): """Creates a new message in the given `channel_id`.""" <|body_0|> def write(self, s): """Replaces internal `message`'s text with `s`.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiscordIO: """Non-blocking file-like IO using a Discord Bot.""" def __init__(self, token, channel_id): """Creates a new message in the given `channel_id`.""" super(DiscordIO, self).__init__() config = ClientConfig() config.token = token client = Client(config) ...
the_stack_v2_python_sparse
venv/Lib/site-packages/tqdm/contrib/discord.py
tpike3/SugarScape
train
11
d180b69ceeaf6dab9f0709052c4d95ecabaee491
[ "out, stack = ([], [])\nnode = root\nwhile True:\n while node:\n out.append(node.val)\n stack.append(node)\n node = node.left\n if not stack:\n break\n node = stack.pop()\n node = node.right\nreturn out", "out = []\nif root:\n out.append(root.val)\n out += self.traver...
<|body_start_0|> out, stack = ([], []) node = root while True: while node: out.append(node.val) stack.append(node) node = node.left if not stack: break node = stack.pop() node = node.r...
TreeTraversalPreOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeTraversalPreOrder: def traverse_iterative(root: TreeNode) -> []: """Iterative tree traversal pre order""" <|body_0|> def traverse_recursive(self, root: TreeNode) -> []: """Recursive tree traversal in order""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_012167
1,013
no_license
[ { "docstring": "Iterative tree traversal pre order", "name": "traverse_iterative", "signature": "def traverse_iterative(root: TreeNode) -> []" }, { "docstring": "Recursive tree traversal in order", "name": "traverse_recursive", "signature": "def traverse_recursive(self, root: TreeNode) -...
2
null
Implement the Python class `TreeTraversalPreOrder` described below. Class description: Implement the TreeTraversalPreOrder class. Method signatures and docstrings: - def traverse_iterative(root: TreeNode) -> []: Iterative tree traversal pre order - def traverse_recursive(self, root: TreeNode) -> []: Recursive tree tr...
Implement the Python class `TreeTraversalPreOrder` described below. Class description: Implement the TreeTraversalPreOrder class. Method signatures and docstrings: - def traverse_iterative(root: TreeNode) -> []: Iterative tree traversal pre order - def traverse_recursive(self, root: TreeNode) -> []: Recursive tree tr...
8ae84f276cd07ffdb9b742569a5e32809ecc6b29
<|skeleton|> class TreeTraversalPreOrder: def traverse_iterative(root: TreeNode) -> []: """Iterative tree traversal pre order""" <|body_0|> def traverse_recursive(self, root: TreeNode) -> []: """Recursive tree traversal in order""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeTraversalPreOrder: def traverse_iterative(root: TreeNode) -> []: """Iterative tree traversal pre order""" out, stack = ([], []) node = root while True: while node: out.append(node.val) stack.append(node) node = nod...
the_stack_v2_python_sparse
pyquiz/leetcode/TreeTraversalPreOrder.py
DmitryPukhov/pyquiz
train
0
8581c655dd3288aa0856a774e6a1d8fa676580eb
[ "levels = []\nif not root:\n return levels\n\ndef helper(node, level):\n if len(levels) == level:\n '\\n level层从0开始计数,而levels存储每一层的结点值,因此这里很巧妙的处理是依据当前\\n levels中元素的个数判断是否需要添加新的一层;比如个数为0,表示正处理第0层,个数为3\\n 表示正处理第3层。\\n '\n leve...
<|body_start_0|> levels = [] if not root: return levels def helper(node, level): if len(levels) == level: '\n level层从0开始计数,而levels存储每一层的结点值,因此这里很巧妙的处理是依据当前\n levels中元素的个数判断是否需要添加新的一层;比如个数为0,表示正处理第0层,个数为3\n ...
给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ]
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ]""" def level_order(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def level_order2(self, root): ...
stack_v2_sparse_classes_36k_train_012168
2,621
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "level_order", "signature": "def level_order(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "level_order2", "signature": "def level_order2(self, root)" }, { "docstring":...
3
null
Implement the Python class `Solution` described below. Class description: 给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ] Method signatures and docstrings: - def level_order(self, root): :type root: TreeNode :rtype: List[List[int]] - def ...
Implement the Python class `Solution` described below. Class description: 给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ] Method signatures and docstrings: - def level_order(self, root): :type root: TreeNode :rtype: List[List[int]] - def ...
2c534185854c1a6f5ffdb2698f9db9989f30a25b
<|skeleton|> class Solution: """给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ]""" def level_order(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def level_order2(self, root): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ]""" def level_order(self, root): """:type root: TreeNode :rtype: List[List[int]]""" levels = [] if not root: return levels ...
the_stack_v2_python_sparse
Week 03/id_668/leetcode_102_668.py
Carryours/algorithm004-03
train
2
4b612ccddcca123d374e51540159ac2215f18f3c
[ "users = User.query.all()\nusers_list = []\nfor user in users:\n users_list.append(user.__jsonapi__())\nreturn {'data': users_list}", "current_identity = import_user()\ndata = request.get_json()['data']\nif User.query.filter_by(username=data['attributes']['username']).first():\n api.abort(code=409, message=...
<|body_start_0|> users = User.query.all() users_list = [] for user in users: users_list.append(user.__jsonapi__()) return {'data': users_list} <|end_body_0|> <|body_start_1|> current_identity = import_user() data = request.get_json()['data'] if User.q...
UsersList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersList: def get(self): """Get users list""" <|body_0|> def post(self): """Create user""" <|body_1|> <|end_skeleton|> <|body_start_0|> users = User.query.all() users_list = [] for user in users: users_list.append(user._...
stack_v2_sparse_classes_36k_train_012169
46,738
permissive
[ { "docstring": "Get users list", "name": "get", "signature": "def get(self)" }, { "docstring": "Create user", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003695
Implement the Python class `UsersList` described below. Class description: Implement the UsersList class. Method signatures and docstrings: - def get(self): Get users list - def post(self): Create user
Implement the Python class `UsersList` described below. Class description: Implement the UsersList class. Method signatures and docstrings: - def get(self): Get users list - def post(self): Create user <|skeleton|> class UsersList: def get(self): """Get users list""" <|body_0|> def post(sel...
3439a2dd0bd527c5d604801fec3a5aac904a72e2
<|skeleton|> class UsersList: def get(self): """Get users list""" <|body_0|> def post(self): """Create user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UsersList: def get(self): """Get users list""" users = User.query.all() users_list = [] for user in users: users_list.append(user.__jsonapi__()) return {'data': users_list} def post(self): """Create user""" current_identity = import_user...
the_stack_v2_python_sparse
app/views.py
taidos/lxc-rest
train
0
20b554cca70f0aef733c2ca504c28fcb2d2d4894
[ "for b in self.badAlignmentBlockStarts:\n mafFile = testFile(b)\n self.assertRaises(mafval.MissingAlignmentBlockLineError, mafval.validateMaf, mafFile, options)\n removeTempDir()", "for b in self.badAlignmentBlockKeyValuePairs:\n mafFile = testFile(b)\n self.assertRaises(mafval.AlignmentBlockLineKe...
<|body_start_0|> for b in self.badAlignmentBlockStarts: mafFile = testFile(b) self.assertRaises(mafval.MissingAlignmentBlockLineError, mafval.validateMaf, mafFile, options) removeTempDir() <|end_body_0|> <|body_start_1|> for b in self.badAlignmentBlockKeyValuePairs: ...
AlignmentBlockLinesChecks
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlignmentBlockLinesChecks: def testAlignmentBlockLineExistence(self): """mafValidator should fail when a sequence block starts without an '^a' line""" <|body_0|> def testAlignmentBlockLineKeyValuePairs(self): """mafValidator should fail when an alignment block has ma...
stack_v2_sparse_classes_36k_train_012170
41,963
permissive
[ { "docstring": "mafValidator should fail when a sequence block starts without an '^a' line", "name": "testAlignmentBlockLineExistence", "signature": "def testAlignmentBlockLineExistence(self)" }, { "docstring": "mafValidator should fail when an alignment block has mal-formed key-value pairs", ...
2
stack_v2_sparse_classes_30k_train_013136
Implement the Python class `AlignmentBlockLinesChecks` described below. Class description: Implement the AlignmentBlockLinesChecks class. Method signatures and docstrings: - def testAlignmentBlockLineExistence(self): mafValidator should fail when a sequence block starts without an '^a' line - def testAlignmentBlockLi...
Implement the Python class `AlignmentBlockLinesChecks` described below. Class description: Implement the AlignmentBlockLinesChecks class. Method signatures and docstrings: - def testAlignmentBlockLineExistence(self): mafValidator should fail when a sequence block starts without an '^a' line - def testAlignmentBlockLi...
601832a780f328d48893474f0f4934dcbf9df73c
<|skeleton|> class AlignmentBlockLinesChecks: def testAlignmentBlockLineExistence(self): """mafValidator should fail when a sequence block starts without an '^a' line""" <|body_0|> def testAlignmentBlockLineKeyValuePairs(self): """mafValidator should fail when an alignment block has ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlignmentBlockLinesChecks: def testAlignmentBlockLineExistence(self): """mafValidator should fail when a sequence block starts without an '^a' line""" for b in self.badAlignmentBlockStarts: mafFile = testFile(b) self.assertRaises(mafval.MissingAlignmentBlockLineError, m...
the_stack_v2_python_sparse
mafValidator/src/test.mafValidator.py
sorrywm/mafTools
train
0
f6afe33cb8f3ccd53ae3834e85182ab42c25fa6e
[ "gr = Group.objects.get_or_404(id=id)\ns = Student.objects.get_or_404(id=sid)\nif gr.project.campus.id != s.campus.id:\n abort(400, error='Not authorized')\nif s in gr.students:\n abort(400, error='Student already exist')\ngr.students.append(s)\ngr.save()\nreturn ('Student successfully added', 204)", "gr = ...
<|body_start_0|> gr = Group.objects.get_or_404(id=id) s = Student.objects.get_or_404(id=sid) if gr.project.campus.id != s.campus.id: abort(400, error='Not authorized') if s in gr.students: abort(400, error='Student already exist') gr.students.append(s) ...
GroupItemStudent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupItemStudent: def post(self, id, sid): """Add student""" <|body_0|> def delete(self, id, sid): """Remove student""" <|body_1|> <|end_skeleton|> <|body_start_0|> gr = Group.objects.get_or_404(id=id) s = Student.objects.get_or_404(id=sid) ...
stack_v2_sparse_classes_36k_train_012171
4,822
no_license
[ { "docstring": "Add student", "name": "post", "signature": "def post(self, id, sid)" }, { "docstring": "Remove student", "name": "delete", "signature": "def delete(self, id, sid)" } ]
2
stack_v2_sparse_classes_30k_train_000590
Implement the Python class `GroupItemStudent` described below. Class description: Implement the GroupItemStudent class. Method signatures and docstrings: - def post(self, id, sid): Add student - def delete(self, id, sid): Remove student
Implement the Python class `GroupItemStudent` described below. Class description: Implement the GroupItemStudent class. Method signatures and docstrings: - def post(self, id, sid): Add student - def delete(self, id, sid): Remove student <|skeleton|> class GroupItemStudent: def post(self, id, sid): """Ad...
f053f0f357b29a6649df41e4ff06a688090ed043
<|skeleton|> class GroupItemStudent: def post(self, id, sid): """Add student""" <|body_0|> def delete(self, id, sid): """Remove student""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupItemStudent: def post(self, id, sid): """Add student""" gr = Group.objects.get_or_404(id=id) s = Student.objects.get_or_404(id=sid) if gr.project.campus.id != s.campus.id: abort(400, error='Not authorized') if s in gr.students: abort(400, er...
the_stack_v2_python_sparse
app/admin/endpoints/groups.py
averdier/epsi_my_learning_chain_admin
train
0
c94a2880a63fbaf3791d26f5efd26b8bc47132d7
[ "self.kvallist = []\nsuper(ConfListKey, self).__init__(keyword, keyvalue, comment)\nvlist = self.keyvalue.split()\nfor value in vlist:\n self.kvallist.append(float(value))", "if index > len(self.kvallist) - 1:\n err_msg = 'Index: ' + str(index) + ' does not exist!'\n raise aXeError(err_msg)\nreturn self....
<|body_start_0|> self.kvallist = [] super(ConfListKey, self).__init__(keyword, keyvalue, comment) vlist = self.keyvalue.split() for value in vlist: self.kvallist.append(float(value)) <|end_body_0|> <|body_start_1|> if index > len(self.kvallist) - 1: err_m...
Class for a keyword list The keyword list class is a subclass derived from the keyword class. In the keyword list class has as an additional attribute the keyvalues transformed to a list of floats.
ConfListKey
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfListKey: """Class for a keyword list The keyword list class is a subclass derived from the keyword class. In the keyword list class has as an additional attribute the keyvalues transformed to a list of floats.""" def __init__(self, keyword, keyvalue, comment=None): """Constructor...
stack_v2_sparse_classes_36k_train_012172
48,172
permissive
[ { "docstring": "Constructor for the keyword list class Initializer for the keyword list class. The keyword instance is created using all input values. @param keyword: the keword name @type keyword: string @param keyvalue: the keyword values @type keyvalue: string @param comment: the keyword comment @type commen...
4
null
Implement the Python class `ConfListKey` described below. Class description: Class for a keyword list The keyword list class is a subclass derived from the keyword class. In the keyword list class has as an additional attribute the keyvalues transformed to a list of floats. Method signatures and docstrings: - def __i...
Implement the Python class `ConfListKey` described below. Class description: Class for a keyword list The keyword list class is a subclass derived from the keyword class. In the keyword list class has as an additional attribute the keyvalues transformed to a list of floats. Method signatures and docstrings: - def __i...
043c173fd5497c18c2b1bfe8bcff65180bca3996
<|skeleton|> class ConfListKey: """Class for a keyword list The keyword list class is a subclass derived from the keyword class. In the keyword list class has as an additional attribute the keyvalues transformed to a list of floats.""" def __init__(self, keyword, keyvalue, comment=None): """Constructor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfListKey: """Class for a keyword list The keyword list class is a subclass derived from the keyword class. In the keyword list class has as an additional attribute the keyvalues transformed to a list of floats.""" def __init__(self, keyword, keyvalue, comment=None): """Constructor for the keyw...
the_stack_v2_python_sparse
stsdas/pkg/analysis/slitless/axe/axesrc/configfile.py
spacetelescope/stsdas_stripped
train
1
a3473ba61beccbfb158e8b2d1a69589222fdcb20
[ "res = set()\nB = set()\nfor a in A:\n B = {b | a for b in B} | {a}\n res |= B\nreturn len(res)", "max_a = max(A)\nmask = 1\nwhile mask <= max_a:\n mask <<= 1\nmask -= 1\nres = set()\nfor i, a in enumerate(A):\n res.add(a)\n j = i - 1\n cur = a\n while j >= 0 and cur < mask:\n cur |= A...
<|body_start_0|> res = set() B = set() for a in A: B = {b | a for b in B} | {a} res |= B return len(res) <|end_body_0|> <|body_start_1|> max_a = max(A) mask = 1 while mask <= max_a: mask <<= 1 mask -= 1 res = se...
[898. 子数组按位或操作](https://leetcode-cn.com/problems/bitwise-ors-of-subarrays/)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """[898. 子数组按位或操作](https://leetcode-cn.com/problems/bitwise-ors-of-subarrays/)""" def subarrayBitwiseORs(self, A: List[int]) -> int: """思路: 2个set存""" <|body_0|> def subarrayBitwiseORs2(self, A: List[int]) -> int: """思路: 位运算剪枝来代替两个set轮流io""" <|bo...
stack_v2_sparse_classes_36k_train_012173
1,297
no_license
[ { "docstring": "思路: 2个set存", "name": "subarrayBitwiseORs", "signature": "def subarrayBitwiseORs(self, A: List[int]) -> int" }, { "docstring": "思路: 位运算剪枝来代替两个set轮流io", "name": "subarrayBitwiseORs2", "signature": "def subarrayBitwiseORs2(self, A: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_004773
Implement the Python class `Solution` described below. Class description: [898. 子数组按位或操作](https://leetcode-cn.com/problems/bitwise-ors-of-subarrays/) Method signatures and docstrings: - def subarrayBitwiseORs(self, A: List[int]) -> int: 思路: 2个set存 - def subarrayBitwiseORs2(self, A: List[int]) -> int: 思路: 位运算剪枝来代替两个se...
Implement the Python class `Solution` described below. Class description: [898. 子数组按位或操作](https://leetcode-cn.com/problems/bitwise-ors-of-subarrays/) Method signatures and docstrings: - def subarrayBitwiseORs(self, A: List[int]) -> int: 思路: 2个set存 - def subarrayBitwiseORs2(self, A: List[int]) -> int: 思路: 位运算剪枝来代替两个se...
dbe8eb449e5b112a71bc1cd4eabfd138304de4a3
<|skeleton|> class Solution: """[898. 子数组按位或操作](https://leetcode-cn.com/problems/bitwise-ors-of-subarrays/)""" def subarrayBitwiseORs(self, A: List[int]) -> int: """思路: 2个set存""" <|body_0|> def subarrayBitwiseORs2(self, A: List[int]) -> int: """思路: 位运算剪枝来代替两个set轮流io""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """[898. 子数组按位或操作](https://leetcode-cn.com/problems/bitwise-ors-of-subarrays/)""" def subarrayBitwiseORs(self, A: List[int]) -> int: """思路: 2个set存""" res = set() B = set() for a in A: B = {b | a for b in B} | {a} res |= B return le...
the_stack_v2_python_sparse
leetcode/601-900/898.py
Rivarrl/leetcode_python
train
3
9f6bd885b1f72e95c0c6abaf23878d839c9f0516
[ "if component_type is None or not isinstance(component_container, ComponentContainer) or (not hasattr(component_container, 'has_component')):\n return False\nreturn component_container.has_component(component_type)", "if component_type is None or not isinstance(component_container, ComponentContainer) or (not ...
<|body_start_0|> if component_type is None or not isinstance(component_container, ComponentContainer) or (not hasattr(component_container, 'has_component')): return False return component_container.has_component(component_type) <|end_body_0|> <|body_start_1|> if component_type is No...
Utilities for handling components of component containers.
CommonComponentUtils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonComponentUtils: """Utilities for handling components of component containers.""" def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool: """has_component(component_container, component_type) Determine if a ComponentContainer has ...
stack_v2_sparse_classes_36k_train_012174
3,633
permissive
[ { "docstring": "has_component(component_container, component_type) Determine if a ComponentContainer has a component of the specified type. :param component_container: The ComponentContainer to check. :type component_container: ComponentContainer :param component_type: The type of component to locate. :type com...
3
null
Implement the Python class `CommonComponentUtils` described below. Class description: Utilities for handling components of component containers. Method signatures and docstrings: - def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool: has_component(component_containe...
Implement the Python class `CommonComponentUtils` described below. Class description: Utilities for handling components of component containers. Method signatures and docstrings: - def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool: has_component(component_containe...
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
<|skeleton|> class CommonComponentUtils: """Utilities for handling components of component containers.""" def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool: """has_component(component_container, component_type) Determine if a ComponentContainer has ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonComponentUtils: """Utilities for handling components of component containers.""" def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool: """has_component(component_container, component_type) Determine if a ComponentContainer has a component o...
the_stack_v2_python_sparse
src/sims4communitylib/utils/common_component_utils.py
velocist/TS4CheatsInfo
train
1
c76ce85112c52bafde6e529ee6819b36ee420489
[ "self.text_predicate = text_predicate\nself.content = content\nself.skipping = bool(start)\nself.start: Optional[str] = None\nif start is not None and self.skipping:\n self.start = start.replace('_', ' ')\nself.site = site or pywikibot.Site()\nif not namespaces:\n self.namespaces = self.site.namespaces\nelse:...
<|body_start_0|> self.text_predicate = text_predicate self.content = content self.skipping = bool(start) self.start: Optional[str] = None if start is not None and self.skipping: self.start = start.replace('_', ' ') self.site = site or pywikibot.Site() ...
Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a callable with entry.text as parameter and boolea...
XMLDumpPageGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLDumpPageGenerator: """Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a ...
stack_v2_sparse_classes_36k_train_012175
43,909
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, filename: str, start: Optional[str]=None, namespaces: Union[None, NAMESPACE_OR_STR_TYPE, Sequence[NAMESPACE_OR_STR_TYPE]]=None, site: OPT_SITE_TYPE=None, text_predicate: Optional[Callable[[str], bool]]=None, content=Fals...
2
null
Implement the Python class `XMLDumpPageGenerator` described below. Class description: Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for ...
Implement the Python class `XMLDumpPageGenerator` described below. Class description: Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for ...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class XMLDumpPageGenerator: """Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLDumpPageGenerator: """Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a callable with...
the_stack_v2_python_sparse
pywikibot/pagegenerators/_generators.py
wikimedia/pywikibot
train
432
95d1af9bb9a34775ea089799b14cf80864985e86
[ "super(TypeShareCoder, self).__init__(structure, conf)\nself.taskindices = {t: i for i, t in enumerate(structure.tasks.keys())}\nself.typeindices = dict()\nindex = len(structure.tasks)\nfor argtype in structure.types:\n self.typeindices[argtype] = {t: i + index for i, t in enumerate(structure.types[argtype].opti...
<|body_start_0|> super(TypeShareCoder, self).__init__(structure, conf) self.taskindices = {t: i for i, t in enumerate(structure.tasks.keys())} self.typeindices = dict() index = len(structure.tasks) for argtype in structure.types: self.typeindices[argtype] = {t: i + in...
a Coder that shares the places for args with the same type
TypeShareCoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeShareCoder: """a Coder that shares the places for args with the same type""" def __init__(self, structure, conf): """Coder constructor Args: structure: a Structure object""" <|body_0|> def encode(self, task): """encode the task representation into a vector Ar...
stack_v2_sparse_classes_36k_train_012176
3,430
no_license
[ { "docstring": "Coder constructor Args: structure: a Structure object", "name": "__init__", "signature": "def __init__(self, structure, conf)" }, { "docstring": "encode the task representation into a vector Args: task: the task reresentation as a Task object Returns: the encoded task representat...
3
stack_v2_sparse_classes_30k_train_007445
Implement the Python class `TypeShareCoder` described below. Class description: a Coder that shares the places for args with the same type Method signatures and docstrings: - def __init__(self, structure, conf): Coder constructor Args: structure: a Structure object - def encode(self, task): encode the task representa...
Implement the Python class `TypeShareCoder` described below. Class description: a Coder that shares the places for args with the same type Method signatures and docstrings: - def __init__(self, structure, conf): Coder constructor Args: structure: a Structure object - def encode(self, task): encode the task representa...
fcbe609505f86f142cc6e78686e5c25b0e58e178
<|skeleton|> class TypeShareCoder: """a Coder that shares the places for args with the same type""" def __init__(self, structure, conf): """Coder constructor Args: structure: a Structure object""" <|body_0|> def encode(self, task): """encode the task representation into a vector Ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TypeShareCoder: """a Coder that shares the places for args with the same type""" def __init__(self, structure, conf): """Coder constructor Args: structure: a Structure object""" super(TypeShareCoder, self).__init__(structure, conf) self.taskindices = {t: i for i, t in enumerate(st...
the_stack_v2_python_sparse
assist/tasks/typeshare_coder.py
GillesDepypere/assist
train
1
d60f2023b2cac48bf29ceb23acb8fd621716fba2
[ "self.logfile_dir = logfile_dir\nself.logfile_name = logfile_name\nself.logfile_path = os.path.join(self.logfile_dir, self.logfile_name)\nself.screen_msg = screen_msg\nself.write_msg(msg='--NEW LOG STARTING FROM THIS LINE--', mode='w')", "indent_tabs = ''.join(['\\t'] * msg_level)\ndecorated_msg = '{} {} {}-MSG {...
<|body_start_0|> self.logfile_dir = logfile_dir self.logfile_name = logfile_name self.logfile_path = os.path.join(self.logfile_dir, self.logfile_name) self.screen_msg = screen_msg self.write_msg(msg='--NEW LOG STARTING FROM THIS LINE--', mode='w') <|end_body_0|> <|body_start_1|>...
Logfile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logfile: def __init__(self, logfile_dir='./', logfile_name='plom.log', screen_msg=True): """Initializing the logfile - logfile_dir: default is the same path of the PLoM package - logfile_name: default is the "plom.log" - screen_msg: default is to show message on screen""" <|body_...
stack_v2_sparse_classes_36k_train_012177
11,187
no_license
[ { "docstring": "Initializing the logfile - logfile_dir: default is the same path of the PLoM package - logfile_name: default is the \"plom.log\" - screen_msg: default is to show message on screen", "name": "__init__", "signature": "def __init__(self, logfile_dir='./', logfile_name='plom.log', screen_msg...
3
null
Implement the Python class `Logfile` described below. Class description: Implement the Logfile class. Method signatures and docstrings: - def __init__(self, logfile_dir='./', logfile_name='plom.log', screen_msg=True): Initializing the logfile - logfile_dir: default is the same path of the PLoM package - logfile_name:...
Implement the Python class `Logfile` described below. Class description: Implement the Logfile class. Method signatures and docstrings: - def __init__(self, logfile_dir='./', logfile_name='plom.log', screen_msg=True): Initializing the logfile - logfile_dir: default is the same path of the PLoM package - logfile_name:...
9c051b36e3c62b63795ae0ce072f80a02e342c34
<|skeleton|> class Logfile: def __init__(self, logfile_dir='./', logfile_name='plom.log', screen_msg=True): """Initializing the logfile - logfile_dir: default is the same path of the PLoM package - logfile_name: default is the "plom.log" - screen_msg: default is to show message on screen""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logfile: def __init__(self, logfile_dir='./', logfile_name='plom.log', screen_msg=True): """Initializing the logfile - logfile_dir: default is the same path of the PLoM package - logfile_name: default is the "plom.log" - screen_msg: default is to show message on screen""" self.logfile_dir = lo...
the_stack_v2_python_sparse
modules/performUQ/SimCenterUQ/PLoM/general.py
NHERI-SimCenter/SimCenterBackendApplications
train
5
c0b809a7c247a1f39c762fc62e0d4f045f528300
[ "super(GroupEmbedding, self).__init__()\nself.user_embedding = nn.Embedding(user_num + 1, embedding_size)\nself.item_embedding = nn.Embedding(item_num + 1, embedding_size)\nself.user_attention = nn.Sequential(nn.Linear(embedding_size, embedding_size), nn.ReLU(), nn.Linear(embedding_size, 1))\nself.user_softmax = nn...
<|body_start_0|> super(GroupEmbedding, self).__init__() self.user_embedding = nn.Embedding(user_num + 1, embedding_size) self.item_embedding = nn.Embedding(item_num + 1, embedding_size) self.user_attention = nn.Sequential(nn.Linear(embedding_size, embedding_size), nn.ReLU(), nn.Linear(em...
Embedding Network
GroupEmbedding
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupEmbedding: """Embedding Network""" def __init__(self, embedding_size: int, user_num: int, item_num: int): """Initialize Embedding :param embedding_size: embedding size :param user_num: number of users :param item_num: number of items""" <|body_0|> def forward(self, ...
stack_v2_sparse_classes_36k_train_012178
4,654
permissive
[ { "docstring": "Initialize Embedding :param embedding_size: embedding size :param user_num: number of users :param item_num: number of items", "name": "__init__", "signature": "def __init__(self, embedding_size: int, user_num: int, item_num: int)" }, { "docstring": "Forward :param group_members:...
2
null
Implement the Python class `GroupEmbedding` described below. Class description: Embedding Network Method signatures and docstrings: - def __init__(self, embedding_size: int, user_num: int, item_num: int): Initialize Embedding :param embedding_size: embedding size :param user_num: number of users :param item_num: numb...
Implement the Python class `GroupEmbedding` described below. Class description: Embedding Network Method signatures and docstrings: - def __init__(self, embedding_size: int, user_num: int, item_num: int): Initialize Embedding :param embedding_size: embedding size :param user_num: number of users :param item_num: numb...
3bf673bb7980a2ba972241b0ba4bae7ca3af1870
<|skeleton|> class GroupEmbedding: """Embedding Network""" def __init__(self, embedding_size: int, user_num: int, item_num: int): """Initialize Embedding :param embedding_size: embedding size :param user_num: number of users :param item_num: number of items""" <|body_0|> def forward(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupEmbedding: """Embedding Network""" def __init__(self, embedding_size: int, user_num: int, item_num: int): """Initialize Embedding :param embedding_size: embedding size :param user_num: number of users :param item_num: number of items""" super(GroupEmbedding, self).__init__() ...
the_stack_v2_python_sparse
recohut/models/embedding.py
recohut/recohut
train
2
90b61c67022ddea582804ac8952d825dac68f539
[ "need_params = ['device_id', 'device_owner', 'tenant_id', 'network_id']\nfilters, kwargs = rest_utils.parse_filters_kwargs(request, need_params)\nif not kwargs.get('tenant_id'):\n kwargs.update({'tenant_id': request.user.tenant_id})\nnetwork_list = api.neutron.network_list_for_tenant(request, kwargs.get('tenant_...
<|body_start_0|> need_params = ['device_id', 'device_owner', 'tenant_id', 'network_id'] filters, kwargs = rest_utils.parse_filters_kwargs(request, need_params) if not kwargs.get('tenant_id'): kwargs.update({'tenant_id': request.user.tenant_id}) network_list = api.neutron.netw...
API for Neutron Ports http://developer.openstack.org/api-ref-networking-v2.html#ports
Ports
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ports: """API for Neutron Ports http://developer.openstack.org/api-ref-networking-v2.html#ports""" def get(self, request): """Get a list of unused free ports The listing result is an object with property "items". Each item is a port.""" <|body_0|> def post(self, request)...
stack_v2_sparse_classes_36k_train_012179
30,067
permissive
[ { "docstring": "Get a list of unused free ports The listing result is an object with property \"items\". Each item is a port.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create a port on a specified network. :param network_id: network id a subnet is created on :para...
2
null
Implement the Python class `Ports` described below. Class description: API for Neutron Ports http://developer.openstack.org/api-ref-networking-v2.html#ports Method signatures and docstrings: - def get(self, request): Get a list of unused free ports The listing result is an object with property "items". Each item is a...
Implement the Python class `Ports` described below. Class description: API for Neutron Ports http://developer.openstack.org/api-ref-networking-v2.html#ports Method signatures and docstrings: - def get(self, request): Get a list of unused free ports The listing result is an object with property "items". Each item is a...
9524f1952461c83db485d5d1702c350b158d7ce0
<|skeleton|> class Ports: """API for Neutron Ports http://developer.openstack.org/api-ref-networking-v2.html#ports""" def get(self, request): """Get a list of unused free ports The listing result is an object with property "items". Each item is a port.""" <|body_0|> def post(self, request)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ports: """API for Neutron Ports http://developer.openstack.org/api-ref-networking-v2.html#ports""" def get(self, request): """Get a list of unused free ports The listing result is an object with property "items". Each item is a port.""" need_params = ['device_id', 'device_owner', 'tenant_...
the_stack_v2_python_sparse
easystack_dashboard/api/rest/neutron.py
oksbsb/horizon-acc
train
0
69117973a07607d24177ed33d7a8ba403a976538
[ "control_palette = control_instance.path.palette()\ncontrol_value = control_instance.path.value()\ncolor = QtCore.Qt.white\nred = QtGui.QColor(255, 220, 220)\nyellow = QtGui.QColor(255, 255, 200)\nis_valid = False\nif control_value is traits.Undefined:\n is_valid = True\n if not control_instance.optional:\n ...
<|body_start_0|> control_palette = control_instance.path.palette() control_value = control_instance.path.value() color = QtCore.Qt.white red = QtGui.QColor(255, 220, 220) yellow = QtGui.QColor(255, 255, 200) is_valid = False if control_value is traits.Undefined: ...
Control to enter a directory.
DirectoryControlWidget
[ "CECILL-B" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectoryControlWidget: """Control to enter a directory.""" def is_valid(control_instance, *args, **kwargs): """Method to check if the new control value is correct. If the new entered value is not correct, the backroung control color will be red. Parameters ---------- control_instanc...
stack_v2_sparse_classes_36k_train_012180
3,756
permissive
[ { "docstring": "Method to check if the new control value is correct. If the new entered value is not correct, the backroung control color will be red. Parameters ---------- control_instance: QWidget (mandatory) the control widget we want to validate Returns ------- out: bool True if the control value is a file,...
2
null
Implement the Python class `DirectoryControlWidget` described below. Class description: Control to enter a directory. Method signatures and docstrings: - def is_valid(control_instance, *args, **kwargs): Method to check if the new control value is correct. If the new entered value is not correct, the backroung control...
Implement the Python class `DirectoryControlWidget` described below. Class description: Control to enter a directory. Method signatures and docstrings: - def is_valid(control_instance, *args, **kwargs): Method to check if the new control value is correct. If the new entered value is not correct, the backroung control...
779e254098b183eb312eb589268c474dd65c5679
<|skeleton|> class DirectoryControlWidget: """Control to enter a directory.""" def is_valid(control_instance, *args, **kwargs): """Method to check if the new control value is correct. If the new entered value is not correct, the backroung control color will be red. Parameters ---------- control_instanc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DirectoryControlWidget: """Control to enter a directory.""" def is_valid(control_instance, *args, **kwargs): """Method to check if the new control value is correct. If the new entered value is not correct, the backroung control color will be red. Parameters ---------- control_instance: QWidget (m...
the_stack_v2_python_sparse
python/soma/qt_gui/controls/Directory.py
populse/soma-base
train
0
6b1140cf106a575116f8049bf87304e977d93aa1
[ "super(Ps, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)\nself.current_ret = list()\nself.options = options\nself._headers = None\nself._header_pos = None\nself.ret_required = False\nself._converter_helper = ConverterHelper.get_converter_helper()", "if is_full_li...
<|body_start_0|> super(Ps, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.current_ret = list() self.options = options self._headers = None self._header_pos = None self.ret_required = False self._converter_help...
Unix command ps.
Ps
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ps: """Unix command ps.""" def __init__(self, connection=None, options='', prompt=None, newline_chars=None, runner=None): """Represents Unix command ps. :param connection: moler connection to device, terminal where command is executed :param options: ps command options as string :par...
stack_v2_sparse_classes_36k_train_012181
15,745
permissive
[ { "docstring": "Represents Unix command ps. :param connection: moler connection to device, terminal where command is executed :param options: ps command options as string :param prompt: prompt (on system where command runs). :param newline_chars: characters to split lines :param runner: Runner to run command", ...
5
null
Implement the Python class `Ps` described below. Class description: Unix command ps. Method signatures and docstrings: - def __init__(self, connection=None, options='', prompt=None, newline_chars=None, runner=None): Represents Unix command ps. :param connection: moler connection to device, terminal where command is e...
Implement the Python class `Ps` described below. Class description: Unix command ps. Method signatures and docstrings: - def __init__(self, connection=None, options='', prompt=None, newline_chars=None, runner=None): Represents Unix command ps. :param connection: moler connection to device, terminal where command is e...
5a7bb06807b6e0124c77040367d0c20f42849a4c
<|skeleton|> class Ps: """Unix command ps.""" def __init__(self, connection=None, options='', prompt=None, newline_chars=None, runner=None): """Represents Unix command ps. :param connection: moler connection to device, terminal where command is executed :param options: ps command options as string :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ps: """Unix command ps.""" def __init__(self, connection=None, options='', prompt=None, newline_chars=None, runner=None): """Represents Unix command ps. :param connection: moler connection to device, terminal where command is executed :param options: ps command options as string :param prompt: pr...
the_stack_v2_python_sparse
moler/cmd/unix/ps.py
nokia/moler
train
60
ed54f595f72848358d573f25fc017e83ead55810
[ "super(Reader, self).__init__(auto_prefix=False)\nself.encoder = Albert(batch_size)\nparam_dict = load_checkpoint(encoder_ck_file)\nnot_load_params, _ = load_param_into_net(self.encoder, param_dict)\nprint(f'reader albert not loaded params: {not_load_params}')\nself.downstream = Reader_Downstream()\nparam_dict = lo...
<|body_start_0|> super(Reader, self).__init__(auto_prefix=False) self.encoder = Albert(batch_size) param_dict = load_checkpoint(encoder_ck_file) not_load_params, _ = load_param_into_net(self.encoder, param_dict) print(f'reader albert not loaded params: {not_load_params}') ...
Reader model
Reader
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: """Reader model""" def __init__(self, batch_size, encoder_ck_file, downstream_ck_file): """init function""" <|body_0|> def construct(self, input_ids, attn_mask, token_type_ids, context_mask, square_mask, packing_mask, cache_mask, para_start_mapping, sent_end_mapp...
stack_v2_sparse_classes_36k_train_012182
3,103
permissive
[ { "docstring": "init function", "name": "__init__", "signature": "def __init__(self, batch_size, encoder_ck_file, downstream_ck_file)" }, { "docstring": "construct function", "name": "construct", "signature": "def construct(self, input_ids, attn_mask, token_type_ids, context_mask, square...
2
null
Implement the Python class `Reader` described below. Class description: Reader model Method signatures and docstrings: - def __init__(self, batch_size, encoder_ck_file, downstream_ck_file): init function - def construct(self, input_ids, attn_mask, token_type_ids, context_mask, square_mask, packing_mask, cache_mask, p...
Implement the Python class `Reader` described below. Class description: Reader model Method signatures and docstrings: - def __init__(self, batch_size, encoder_ck_file, downstream_ck_file): init function - def construct(self, input_ids, attn_mask, token_type_ids, context_mask, square_mask, packing_mask, cache_mask, p...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class Reader: """Reader model""" def __init__(self, batch_size, encoder_ck_file, downstream_ck_file): """init function""" <|body_0|> def construct(self, input_ids, attn_mask, token_type_ids, context_mask, square_mask, packing_mask, cache_mask, para_start_mapping, sent_end_mapp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reader: """Reader model""" def __init__(self, batch_size, encoder_ck_file, downstream_ck_file): """init function""" super(Reader, self).__init__(auto_prefix=False) self.encoder = Albert(batch_size) param_dict = load_checkpoint(encoder_ck_file) not_load_params, _ = ...
the_stack_v2_python_sparse
research/nlp/tprr/src/reader.py
mindspore-ai/models
train
301
6da4fd9d59bed10ad4639d3c464deb47a3e7d103
[ "torch_and_transformers_import.check()\nsuper().__init__()\nself.top_p = top_p\nself.score_field = score_field\nself.strict = strict\nself.devices, _ = initialize_device_settings(devices=devices, use_cuda=use_gpu, multi_gpu=True)\nself.cross_encoder = CrossEncoder(model_name_or_path, device=str(self.devices[0]))", ...
<|body_start_0|> torch_and_transformers_import.check() super().__init__() self.top_p = top_p self.score_field = score_field self.strict = strict self.devices, _ = initialize_device_settings(devices=devices, use_cuda=use_gpu, multi_gpu=True) self.cross_encoder = Cr...
Filters documents based on the cumulative probability of the similarity scores between the query and the documents using top p sampling. Top p sampling selects a subset of the most relevant data points from a larger set of data. The technique involves calculating the cumulative probability of the scores of each data po...
TopPSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopPSampler: """Filters documents based on the cumulative probability of the similarity scores between the query and the documents using top p sampling. Top p sampling selects a subset of the most relevant data points from a larger set of data. The technique involves calculating the cumulative pr...
stack_v2_sparse_classes_36k_train_012183
7,453
permissive
[ { "docstring": "Initialize a TopPSampler. :param model_name_or_path: Path to a pretrained sentence-transformers model. :param top_p: Cumulative probability threshold for filtering the documents (usually between 0.9 and 0.99). :param strict: If `top_p` is set to a low value and sampler returned no documents, the...
3
null
Implement the Python class `TopPSampler` described below. Class description: Filters documents based on the cumulative probability of the similarity scores between the query and the documents using top p sampling. Top p sampling selects a subset of the most relevant data points from a larger set of data. The technique...
Implement the Python class `TopPSampler` described below. Class description: Filters documents based on the cumulative probability of the similarity scores between the query and the documents using top p sampling. Top p sampling selects a subset of the most relevant data points from a larger set of data. The technique...
5f1256ac7e5734c2ea481e72cb7e02c34baf8c43
<|skeleton|> class TopPSampler: """Filters documents based on the cumulative probability of the similarity scores between the query and the documents using top p sampling. Top p sampling selects a subset of the most relevant data points from a larger set of data. The technique involves calculating the cumulative pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopPSampler: """Filters documents based on the cumulative probability of the similarity scores between the query and the documents using top p sampling. Top p sampling selects a subset of the most relevant data points from a larger set of data. The technique involves calculating the cumulative probability of ...
the_stack_v2_python_sparse
haystack/nodes/sampler/top_p_sampler.py
deepset-ai/haystack
train
10,599
1a4fcfbc2af81d0722cb695cfefe25bddde9d8ad
[ "super(HistoryChangesetMiddleware, self).process_request(request)\nif request.META.get('REQUEST_METHOD') in ('GET', 'HEAD'):\n return\nrequest.changeset = None\nrequest.close_changeset = False\nrequest.delay_cache = False\nchangeset_id = request.GET.get('use_changeset')\nif changeset_id:\n changeset = Changes...
<|body_start_0|> super(HistoryChangesetMiddleware, self).process_request(request) if request.META.get('REQUEST_METHOD') in ('GET', 'HEAD'): return request.changeset = None request.close_changeset = False request.delay_cache = False changeset_id = request.GET.g...
Add a changeset to the HistoricalRecords request.
HistoryChangesetMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistoryChangesetMiddleware: """Add a changeset to the HistoricalRecords request.""" def process_request(self, request): """Load requested changeset or prepare auto-changeset.""" <|body_0|> def bad_request(self, request, message): """Reject invalid request changes...
stack_v2_sparse_classes_36k_train_012184
7,986
no_license
[ { "docstring": "Load requested changeset or prepare auto-changeset.", "name": "process_request", "signature": "def process_request(self, request)" }, { "docstring": "Reject invalid request changeset.", "name": "bad_request", "signature": "def bad_request(self, request, message)" }, {...
3
stack_v2_sparse_classes_30k_train_011278
Implement the Python class `HistoryChangesetMiddleware` described below. Class description: Add a changeset to the HistoricalRecords request. Method signatures and docstrings: - def process_request(self, request): Load requested changeset or prepare auto-changeset. - def bad_request(self, request, message): Reject in...
Implement the Python class `HistoryChangesetMiddleware` described below. Class description: Add a changeset to the HistoricalRecords request. Method signatures and docstrings: - def process_request(self, request): Load requested changeset or prepare auto-changeset. - def bad_request(self, request, message): Reject in...
bc092964153b03381aaff74a4d80f43a2b2dec19
<|skeleton|> class HistoryChangesetMiddleware: """Add a changeset to the HistoricalRecords request.""" def process_request(self, request): """Load requested changeset or prepare auto-changeset.""" <|body_0|> def bad_request(self, request, message): """Reject invalid request changes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HistoryChangesetMiddleware: """Add a changeset to the HistoricalRecords request.""" def process_request(self, request): """Load requested changeset or prepare auto-changeset.""" super(HistoryChangesetMiddleware, self).process_request(request) if request.META.get('REQUEST_METHOD') ...
the_stack_v2_python_sparse
browsercompat/webplatformcompat/history.py
WeilerWebServices/MDN-Web-Docs
train
1
55e1abb258743c4cc50fdf4aa1c4549d94582153
[ "self.model = GMF(config['model'])\nself.loss = torch.nn.BCELoss()\nsuper(GMFEngine, self).__init__(config)", "assert hasattr(self, 'model'), 'Please specify the exact model !'\nusers, items, ratings = (users.to(self.device), items.to(self.device), ratings.to(self.device))\nself.optimizer.zero_grad()\nratings_pre...
<|body_start_0|> self.model = GMF(config['model']) self.loss = torch.nn.BCELoss() super(GMFEngine, self).__init__(config) <|end_body_0|> <|body_start_1|> assert hasattr(self, 'model'), 'Please specify the exact model !' users, items, ratings = (users.to(self.device), items.to(se...
Engine for training & evaluating GMF model.
GMFEngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GMFEngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize GMFEngine Class.""" <|body_0|> def train_single_batch(self, users, items, ratings): """Train the model in a single batch. Args: batch_data (list): batch users, ...
stack_v2_sparse_classes_36k_train_012185
3,601
permissive
[ { "docstring": "Initialize GMFEngine Class.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Train the model in a single batch. Args: batch_data (list): batch users, positive items and negative items. Return: loss (float): batch loss.", "name": "train_single...
3
null
Implement the Python class `GMFEngine` described below. Class description: Engine for training & evaluating GMF model. Method signatures and docstrings: - def __init__(self, config): Initialize GMFEngine Class. - def train_single_batch(self, users, items, ratings): Train the model in a single batch. Args: batch_data ...
Implement the Python class `GMFEngine` described below. Class description: Engine for training & evaluating GMF model. Method signatures and docstrings: - def __init__(self, config): Initialize GMFEngine Class. - def train_single_batch(self, users, items, ratings): Train the model in a single batch. Args: batch_data ...
625189d5e1002a3edc27c3e3ce075fddf7ae1c92
<|skeleton|> class GMFEngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize GMFEngine Class.""" <|body_0|> def train_single_batch(self, users, items, ratings): """Train the model in a single batch. Args: batch_data (list): batch users, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GMFEngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize GMFEngine Class.""" self.model = GMF(config['model']) self.loss = torch.nn.BCELoss() super(GMFEngine, self).__init__(config) def train_single_batch(self, users, item...
the_stack_v2_python_sparse
beta_rec/models/gmf.py
beta-team/beta-recsys
train
156
096b5e42b97daf89bae0e208beb0761f65d9d88f
[ "if not nums:\n return 0\nans = 0\nfor idx, i in enumerate(nums):\n if i == k:\n ans = max(ans, 1)\n for idy, j in enumerate(nums[idx + 1:]):\n i += j\n if i == k:\n ans = max(ans, idy + 2)\nreturn ans", "prefix = 0\nindex = dict()\nans = 0\nfor idx, i in enumerate(nums):\...
<|body_start_0|> if not nums: return 0 ans = 0 for idx, i in enumerate(nums): if i == k: ans = max(ans, 1) for idy, j in enumerate(nums[idx + 1:]): i += j if i == k: ans = max(ans, idy + 2) ...
@param nums: an array @param k: a target value @return: the maximum length of a subarray that sums to k
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """@param nums: an array @param k: a target value @return: the maximum length of a subarray that sums to k""" def maxSubArrayLen1(self, nums, k): """时间复杂度: O(n ^ 2) 超时""" <|body_0|> def maxSubArrayLen2(self, nums, target): """前缀和: sum[i], sum[j] j > i i...
stack_v2_sparse_classes_36k_train_012186
2,212
no_license
[ { "docstring": "时间复杂度: O(n ^ 2) 超时", "name": "maxSubArrayLen1", "signature": "def maxSubArrayLen1(self, nums, k)" }, { "docstring": "前缀和: sum[i], sum[j] j > i if: sum[i] + k = sum[j] then: k = sum[j] - sum[i] 因此每次计算完前缀和后, 只需要判断: 前缀和 - target 是否在dict中, 如果在, 则nums[i + 1: j]即为所求", "name": "maxS...
2
stack_v2_sparse_classes_30k_train_011417
Implement the Python class `Solution` described below. Class description: @param nums: an array @param k: a target value @return: the maximum length of a subarray that sums to k Method signatures and docstrings: - def maxSubArrayLen1(self, nums, k): 时间复杂度: O(n ^ 2) 超时 - def maxSubArrayLen2(self, nums, target): 前缀和: s...
Implement the Python class `Solution` described below. Class description: @param nums: an array @param k: a target value @return: the maximum length of a subarray that sums to k Method signatures and docstrings: - def maxSubArrayLen1(self, nums, k): 时间复杂度: O(n ^ 2) 超时 - def maxSubArrayLen2(self, nums, target): 前缀和: s...
c34757e66163e3be7b18d23c150c463e39c98442
<|skeleton|> class Solution: """@param nums: an array @param k: a target value @return: the maximum length of a subarray that sums to k""" def maxSubArrayLen1(self, nums, k): """时间复杂度: O(n ^ 2) 超时""" <|body_0|> def maxSubArrayLen2(self, nums, target): """前缀和: sum[i], sum[j] j > i i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """@param nums: an array @param k: a target value @return: the maximum length of a subarray that sums to k""" def maxSubArrayLen1(self, nums, k): """时间复杂度: O(n ^ 2) 超时""" if not nums: return 0 ans = 0 for idx, i in enumerate(nums): if i ==...
the_stack_v2_python_sparse
lintcode/maximum-size-subarray-sum-equals-k.py
liujunsheng0/notes
train
6
7d41496af057639223b02066655f2eabbec5c8e5
[ "post_key = ndb.Key(urlsafe=post_id)\npost = post_key.get()\nself.render('blog/post_delete.html', post=post)", "post_key = ndb.Key(urlsafe=post_id)\npost = post_key.get()\npost.key.delete()\nself.redirect('/blog/delete/post/success')" ]
<|body_start_0|> post_key = ndb.Key(urlsafe=post_id) post = post_key.get() self.render('blog/post_delete.html', post=post) <|end_body_0|> <|body_start_1|> post_key = ndb.Key(urlsafe=post_id) post = post_key.get() post.key.delete() self.redirect('/blog/delete/post...
PostDeleteHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostDeleteHandler: def get(self, post_id, *args, **kwargs): """Show user confirmation on post to delete""" <|body_0|> def post(self, post_id): """Delete post if post exist and user own post""" <|body_1|> <|end_skeleton|> <|body_start_0|> post_key = ...
stack_v2_sparse_classes_36k_train_012187
829
no_license
[ { "docstring": "Show user confirmation on post to delete", "name": "get", "signature": "def get(self, post_id, *args, **kwargs)" }, { "docstring": "Delete post if post exist and user own post", "name": "post", "signature": "def post(self, post_id)" } ]
2
stack_v2_sparse_classes_30k_train_003861
Implement the Python class `PostDeleteHandler` described below. Class description: Implement the PostDeleteHandler class. Method signatures and docstrings: - def get(self, post_id, *args, **kwargs): Show user confirmation on post to delete - def post(self, post_id): Delete post if post exist and user own post
Implement the Python class `PostDeleteHandler` described below. Class description: Implement the PostDeleteHandler class. Method signatures and docstrings: - def get(self, post_id, *args, **kwargs): Show user confirmation on post to delete - def post(self, post_id): Delete post if post exist and user own post <|skel...
53f3094549bac448fd8f6088142b03e6e374cc02
<|skeleton|> class PostDeleteHandler: def get(self, post_id, *args, **kwargs): """Show user confirmation on post to delete""" <|body_0|> def post(self, post_id): """Delete post if post exist and user own post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostDeleteHandler: def get(self, post_id, *args, **kwargs): """Show user confirmation on post to delete""" post_key = ndb.Key(urlsafe=post_id) post = post_key.get() self.render('blog/post_delete.html', post=post) def post(self, post_id): """Delete post if post exis...
the_stack_v2_python_sparse
app/post_delete_handler.py
thangthin/project-blog
train
0
ff890c55a8e0f80916b893ac39c98080cf131e61
[ "super().__init__()\nextra_keys = kwargs.keys()\nfor extra_key in extra_keys:\n if extra_key not in ['sensitivity_map_model', 'model_name']:\n raise ValueError(f'{type(self).__name__} got key `{extra_key}` which is not supported.')\nself.unet: nn.Module\nif normalized:\n self.unet = NormUnetModel2d(in_...
<|body_start_0|> super().__init__() extra_keys = kwargs.keys() for extra_key in extra_keys: if extra_key not in ['sensitivity_map_model', 'model_name']: raise ValueError(f'{type(self).__name__} got key `{extra_key}` which is not supported.') self.unet: nn.Modu...
PyTorch implementation of a U-Net model for MRI Reconstruction.
Unet2d
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Unet2d: """PyTorch implementation of a U-Net model for MRI Reconstruction.""" def __init__(self, forward_operator: Callable, backward_operator: Callable, num_filters: int, num_pool_layers: int, dropout_probability: float, skip_connection: bool=False, normalized: bool=False, image_initializat...
stack_v2_sparse_classes_36k_train_012188
15,262
permissive
[ { "docstring": "Inits :class:`Unet2d`. Parameters ---------- forward_operator: Callable Forward Operator. backward_operator: Callable Backward Operator. num_filters: int Number of first layer filters. num_pool_layers: int Number of pooling layers. dropout_probability: float Dropout probability. skip_connection:...
3
stack_v2_sparse_classes_30k_train_014525
Implement the Python class `Unet2d` described below. Class description: PyTorch implementation of a U-Net model for MRI Reconstruction. Method signatures and docstrings: - def __init__(self, forward_operator: Callable, backward_operator: Callable, num_filters: int, num_pool_layers: int, dropout_probability: float, sk...
Implement the Python class `Unet2d` described below. Class description: PyTorch implementation of a U-Net model for MRI Reconstruction. Method signatures and docstrings: - def __init__(self, forward_operator: Callable, backward_operator: Callable, num_filters: int, num_pool_layers: int, dropout_probability: float, sk...
2a4c29342bc52a404aae097bc2654fb4323e1ac8
<|skeleton|> class Unet2d: """PyTorch implementation of a U-Net model for MRI Reconstruction.""" def __init__(self, forward_operator: Callable, backward_operator: Callable, num_filters: int, num_pool_layers: int, dropout_probability: float, skip_connection: bool=False, normalized: bool=False, image_initializat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Unet2d: """PyTorch implementation of a U-Net model for MRI Reconstruction.""" def __init__(self, forward_operator: Callable, backward_operator: Callable, num_filters: int, num_pool_layers: int, dropout_probability: float, skip_connection: bool=False, normalized: bool=False, image_initialization: str='zer...
the_stack_v2_python_sparse
direct/nn/unet/unet_2d.py
NKI-AI/direct
train
151
8a1b9a85e32578f46b349476c1bd8d93f734abfc
[ "self.trialSet = trialSet\nself.easyOris = []\nself.hardOris = []\nself.numEasy = 30\nself.numHard = 20\nself.trialBuffer = []\nself.trialBufferPos = 0\nself.trialsByOrientation = {}\nfor t in trialSet:\n ori = t.sMinusOrientation\n if not ori in self.trialsByOrientation.keys():\n self.trialsByOrientat...
<|body_start_0|> self.trialSet = trialSet self.easyOris = [] self.hardOris = [] self.numEasy = 30 self.numHard = 20 self.trialBuffer = [] self.trialBufferPos = 0 self.trialsByOrientation = {} for t in trialSet: ori = t.sMinusOrientation...
SequencerInterval
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SequencerInterval: def __init__(self, trialSet): """Sets up initial block and resets sequence. Creates a dictionary of trials arranged by their orientation. Args: trialSet: [list] Initial set of trials""" <|body_0|> def makeTrialBuffer(self): """Returns: [list] upcom...
stack_v2_sparse_classes_36k_train_012189
2,387
no_license
[ { "docstring": "Sets up initial block and resets sequence. Creates a dictionary of trials arranged by their orientation. Args: trialSet: [list] Initial set of trials", "name": "__init__", "signature": "def __init__(self, trialSet)" }, { "docstring": "Returns: [list] upcoming trials arranged by e...
3
null
Implement the Python class `SequencerInterval` described below. Class description: Implement the SequencerInterval class. Method signatures and docstrings: - def __init__(self, trialSet): Sets up initial block and resets sequence. Creates a dictionary of trials arranged by their orientation. Args: trialSet: [list] In...
Implement the Python class `SequencerInterval` described below. Class description: Implement the SequencerInterval class. Method signatures and docstrings: - def __init__(self, trialSet): Sets up initial block and resets sequence. Creates a dictionary of trials arranged by their orientation. Args: trialSet: [list] In...
30b10c2d3f17909b437cd57b0325d8b4ba6929b8
<|skeleton|> class SequencerInterval: def __init__(self, trialSet): """Sets up initial block and resets sequence. Creates a dictionary of trials arranged by their orientation. Args: trialSet: [list] Initial set of trials""" <|body_0|> def makeTrialBuffer(self): """Returns: [list] upcom...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SequencerInterval: def __init__(self, trialSet): """Sets up initial block and resets sequence. Creates a dictionary of trials arranged by their orientation. Args: trialSet: [list] Initial set of trials""" self.trialSet = trialSet self.easyOris = [] self.hardOris = [] se...
the_stack_v2_python_sparse
ShrewDriver/sequencer/interval.py
msarvestani/shrewdriver
train
2
5b0d7616769a182b6ec79855e3584b130c5c06c8
[ "self.conn = conn\nself._tables = {}\nself._rows = []\nself._global_errors = []\nself._global_warnings = []\nself._load_tables(self.conn)", "for table, create_table in conn.tables().items():\n try:\n reader = Reader()\n reader.parse(create_table)\n except ValueError as e:\n print('Error...
<|body_start_0|> self.conn = conn self._tables = {} self._rows = [] self._global_errors = [] self._global_warnings = [] self._load_tables(self.conn) <|end_body_0|> <|body_start_1|> for table, create_table in conn.tables().items(): try: ...
Database
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: def __init__(self, conn): """Constructor. Accepts a mygrations db wrapper :param conn: mygrations db wrapper :type conn: mygrations.drivers.mysqldb.mysqldb""" <|body_0|> def _load_tables(self, conn): """Reads a database from the MySQL connection. Accepts a ...
stack_v2_sparse_classes_36k_train_012190
3,339
permissive
[ { "docstring": "Constructor. Accepts a mygrations db wrapper :param conn: mygrations db wrapper :type conn: mygrations.drivers.mysqldb.mysqldb", "name": "__init__", "signature": "def __init__(self, conn)" }, { "docstring": "Reads a database from the MySQL connection. Accepts a mygrations db wrap...
3
null
Implement the Python class `Database` described below. Class description: Implement the Database class. Method signatures and docstrings: - def __init__(self, conn): Constructor. Accepts a mygrations db wrapper :param conn: mygrations db wrapper :type conn: mygrations.drivers.mysqldb.mysqldb - def _load_tables(self, ...
Implement the Python class `Database` described below. Class description: Implement the Database class. Method signatures and docstrings: - def __init__(self, conn): Constructor. Accepts a mygrations db wrapper :param conn: mygrations db wrapper :type conn: mygrations.drivers.mysqldb.mysqldb - def _load_tables(self, ...
07dd733f3ee9e6e5b37afce7e16de3dcd93be6e1
<|skeleton|> class Database: def __init__(self, conn): """Constructor. Accepts a mygrations db wrapper :param conn: mygrations db wrapper :type conn: mygrations.drivers.mysqldb.mysqldb""" <|body_0|> def _load_tables(self, conn): """Reads a database from the MySQL connection. Accepts a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Database: def __init__(self, conn): """Constructor. Accepts a mygrations db wrapper :param conn: mygrations db wrapper :type conn: mygrations.drivers.mysqldb.mysqldb""" self.conn = conn self._tables = {} self._rows = [] self._global_errors = [] self._global_warn...
the_stack_v2_python_sparse
mygrations/formats/mysql/db_reader/database.py
cmancone/mygrations
train
12
6942a8c54638f3694df7675f120ba6496a69563e
[ "self.context_factor = context_factor\nself.test_factor = test_factor\nself._start_time = start_time\nself._end_time = end_time\nself._reb_type = reb_type\nself._context_num = context_num\nself._factor_groupnum = factor_groupnum\nself.show_progress = show_progress\nself._ind_cls = ind_cls", "contextualfactor_test...
<|body_start_0|> self.context_factor = context_factor self.test_factor = test_factor self._start_time = start_time self._end_time = end_time self._reb_type = reb_type self._context_num = context_num self._factor_groupnum = factor_groupnum self.show_progres...
使用条件因子对横截面股票划分分组,然后在每个分组内部进行对测试因子进行分组测试,从而查看测试因子 的表现是否受条件因子影响
ConditionalTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionalTest: """使用条件因子对横截面股票划分分组,然后在每个分组内部进行对测试因子进行分组测试,从而查看测试因子 的表现是否受条件因子影响""" def __init__(self, context_factor, test_factor, start_time, end_time, reb_type=MONTHLY, context_num=5, factor_groupnum=5, ind_cls='ZX_IND', show_progress=True): """Parameter --------- contex_factor: ...
stack_v2_sparse_classes_36k_train_012191
8,630
no_license
[ { "docstring": "Parameter --------- contex_factor: str 条件因子,要求能在fmaneger.get_factor_dict()返回的结果中找到 test_factor: str 测试因子,要求能在fmaneger.get_factor_dict()返回的结果中找到 start_time: datetime like 测试的开始时间 end_time: datetime like 测试的结束时间 reb_type: str, default MONTHLY 换仓频率,目前只支持月度(MONTHLY)和周度(WEEKLY) context_num: int, defa...
6
stack_v2_sparse_classes_30k_train_013503
Implement the Python class `ConditionalTest` described below. Class description: 使用条件因子对横截面股票划分分组,然后在每个分组内部进行对测试因子进行分组测试,从而查看测试因子 的表现是否受条件因子影响 Method signatures and docstrings: - def __init__(self, context_factor, test_factor, start_time, end_time, reb_type=MONTHLY, context_num=5, factor_groupnum=5, ind_cls='ZX_IND',...
Implement the Python class `ConditionalTest` described below. Class description: 使用条件因子对横截面股票划分分组,然后在每个分组内部进行对测试因子进行分组测试,从而查看测试因子 的表现是否受条件因子影响 Method signatures and docstrings: - def __init__(self, context_factor, test_factor, start_time, end_time, reb_type=MONTHLY, context_num=5, factor_groupnum=5, ind_cls='ZX_IND',...
4080154dbf05781f3b48f551ee830d9f66687f87
<|skeleton|> class ConditionalTest: """使用条件因子对横截面股票划分分组,然后在每个分组内部进行对测试因子进行分组测试,从而查看测试因子 的表现是否受条件因子影响""" def __init__(self, context_factor, test_factor, start_time, end_time, reb_type=MONTHLY, context_num=5, factor_groupnum=5, ind_cls='ZX_IND', show_progress=True): """Parameter --------- contex_factor: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConditionalTest: """使用条件因子对横截面股票划分分组,然后在每个分组内部进行对测试因子进行分组测试,从而查看测试因子 的表现是否受条件因子影响""" def __init__(self, context_factor, test_factor, start_time, end_time, reb_type=MONTHLY, context_num=5, factor_groupnum=5, ind_cls='ZX_IND', show_progress=True): """Parameter --------- contex_factor: str 条件因子,要求能在...
the_stack_v2_python_sparse
factortest/grouptest/conditionaltest.py
rlcjj/GeneralLib
train
0
82b7a1472da221a53d8a2485753057f9610a160d
[ "self.name = _id\nself.host_type = 'rack'\nself.status = 'enabled'\nself.memberships = {}\nself.vCPUs = 0\nself.original_vCPUs = 0\nself.avail_vCPUs = 0\nself.mem_cap = 0\nself.original_mem_cap = 0\nself.avail_mem_cap = 0\nself.local_disk_cap = 0\nself.original_local_disk_cap = 0\nself.avail_local_disk_cap = 0\nsel...
<|body_start_0|> self.name = _id self.host_type = 'rack' self.status = 'enabled' self.memberships = {} self.vCPUs = 0 self.original_vCPUs = 0 self.avail_vCPUs = 0 self.mem_cap = 0 self.original_mem_cap = 0 self.avail_mem_cap = 0 sel...
Class for Host Group Object. This Class represents a group of hosts. If a single host is a single server then host group is a rack or cluster of servers. This class contains all memberships and resources for the group of hosts.
HostGroup
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostGroup: """Class for Host Group Object. This Class represents a group of hosts. If a single host is a single server then host group is a rack or cluster of servers. This class contains all memberships and resources for the group of hosts.""" def __init__(self, _id): """Init for Ho...
stack_v2_sparse_classes_36k_train_012192
21,975
permissive
[ { "docstring": "Init for Host Group Class.", "name": "__init__", "signature": "def __init__(self, _id)" }, { "docstring": "Init all host group resources to 0.", "name": "init_resources", "signature": "def init_resources(self)" }, { "docstring": "Init Host Group memberships.", ...
6
stack_v2_sparse_classes_30k_train_001953
Implement the Python class `HostGroup` described below. Class description: Class for Host Group Object. This Class represents a group of hosts. If a single host is a single server then host group is a rack or cluster of servers. This class contains all memberships and resources for the group of hosts. Method signatur...
Implement the Python class `HostGroup` described below. Class description: Class for Host Group Object. This Class represents a group of hosts. If a single host is a single server then host group is a rack or cluster of servers. This class contains all memberships and resources for the group of hosts. Method signatur...
ea89fbfbbb488938ac322e2a9bb7f8f448a7cd76
<|skeleton|> class HostGroup: """Class for Host Group Object. This Class represents a group of hosts. If a single host is a single server then host group is a rack or cluster of servers. This class contains all memberships and resources for the group of hosts.""" def __init__(self, _id): """Init for Ho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HostGroup: """Class for Host Group Object. This Class represents a group of hosts. If a single host is a single server then host group is a rack or cluster of servers. This class contains all memberships and resources for the group of hosts.""" def __init__(self, _id): """Init for Host Group Clas...
the_stack_v2_python_sparse
valet/engine/resource_manager/resource_base.py
att-comdev/valet
train
5
d0189637af948eb9b79f3259caf5bcc55a3bde60
[ "super().__init__(image=Chef.image, x=games.screen.width / 2, y=y, dx=speed)\nself.odds_change = odds_change\nself.time_til_drop = 0", "if self.left < 0 or self.right > games.screen.width:\n self.dx = -self.dx\nelif random.randrange(self.odds_change) == 0:\n self.dx = -self.dx\nself.check_drop()", "if sel...
<|body_start_0|> super().__init__(image=Chef.image, x=games.screen.width / 2, y=y, dx=speed) self.odds_change = odds_change self.time_til_drop = 0 <|end_body_0|> <|body_start_1|> if self.left < 0 or self.right > games.screen.width: self.dx = -self.dx elif random.rand...
Chef whom throw pizza move left - right
Chef
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chef: """Chef whom throw pizza move left - right""" def __init__(self, y=55, speed=2, odds_change=200): """init object Chef""" <|body_0|> def update(self): """Defined got change course""" <|body_1|> def check_drop(self): """Reduce interval ex...
stack_v2_sparse_classes_36k_train_012193
6,619
no_license
[ { "docstring": "init object Chef", "name": "__init__", "signature": "def __init__(self, y=55, speed=2, odds_change=200)" }, { "docstring": "Defined got change course", "name": "update", "signature": "def update(self)" }, { "docstring": "Reduce interval expectation on one or drop ...
3
null
Implement the Python class `Chef` described below. Class description: Chef whom throw pizza move left - right Method signatures and docstrings: - def __init__(self, y=55, speed=2, odds_change=200): init object Chef - def update(self): Defined got change course - def check_drop(self): Reduce interval expectation on on...
Implement the Python class `Chef` described below. Class description: Chef whom throw pizza move left - right Method signatures and docstrings: - def __init__(self, y=55, speed=2, odds_change=200): init object Chef - def update(self): Defined got change course - def check_drop(self): Reduce interval expectation on on...
501aed406bc88e0baebd402e18851f1f2f8ac9da
<|skeleton|> class Chef: """Chef whom throw pizza move left - right""" def __init__(self, y=55, speed=2, odds_change=200): """init object Chef""" <|body_0|> def update(self): """Defined got change course""" <|body_1|> def check_drop(self): """Reduce interval ex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chef: """Chef whom throw pizza move left - right""" def __init__(self, y=55, speed=2, odds_change=200): """init object Chef""" super().__init__(image=Chef.image, x=games.screen.width / 2, y=y, dx=speed) self.odds_change = odds_change self.time_til_drop = 0 def update(...
the_stack_v2_python_sparse
_Chapter_11_PYGAME_LIVEWIRES/panic_in_pizzeria.py
MrVeshij/Michael-Dawson
train
1
5c464826b023af7d5d6f3ce7f6a2ffc6e913b977
[ "self.login('Edith')\nself.browser.get(self.live_server_url + reverse('polls:home'))\ncreate_poll_link = wait_for(lambda: self.browser.find_element_by_link_text('Create a poll'))\ncreate_poll_link.click()\nquestion_box = wait_for(lambda: self.browser.find_element_by_name('question_text'))\nchoice_1_box = wait_for(l...
<|body_start_0|> self.login('Edith') self.browser.get(self.live_server_url + reverse('polls:home')) create_poll_link = wait_for(lambda: self.browser.find_element_by_link_text('Create a poll')) create_poll_link.click() question_box = wait_for(lambda: self.browser.find_element_by_n...
Tests for polls.
PollTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PollTest: """Tests for polls.""" def test_can_create_poll(self): """Tests that user can create polls.""" <|body_0|> def test_can_vote_on_poll(self): """Tests that user can vote on the poll.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.lo...
stack_v2_sparse_classes_36k_train_012194
3,674
no_license
[ { "docstring": "Tests that user can create polls.", "name": "test_can_create_poll", "signature": "def test_can_create_poll(self)" }, { "docstring": "Tests that user can vote on the poll.", "name": "test_can_vote_on_poll", "signature": "def test_can_vote_on_poll(self)" } ]
2
stack_v2_sparse_classes_30k_train_001408
Implement the Python class `PollTest` described below. Class description: Tests for polls. Method signatures and docstrings: - def test_can_create_poll(self): Tests that user can create polls. - def test_can_vote_on_poll(self): Tests that user can vote on the poll.
Implement the Python class `PollTest` described below. Class description: Tests for polls. Method signatures and docstrings: - def test_can_create_poll(self): Tests that user can create polls. - def test_can_vote_on_poll(self): Tests that user can vote on the poll. <|skeleton|> class PollTest: """Tests for polls...
5370e31e1b6a39604b1cae8ce3bafec3f4ec8842
<|skeleton|> class PollTest: """Tests for polls.""" def test_can_create_poll(self): """Tests that user can create polls.""" <|body_0|> def test_can_vote_on_poll(self): """Tests that user can vote on the poll.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PollTest: """Tests for polls.""" def test_can_create_poll(self): """Tests that user can create polls.""" self.login('Edith') self.browser.get(self.live_server_url + reverse('polls:home')) create_poll_link = wait_for(lambda: self.browser.find_element_by_link_text('Create a ...
the_stack_v2_python_sparse
functional_tests/test_polls.py
shivams906/bootcamp-clone
train
0
546da4336aab8bb0e83a3be2303b77c6baa21bcd
[ "try:\n self.init_rotation = init_rotation\n super().__init__(task_list, qubits=qubits, sweep_points=sweep_points, nr_seqs=nr_seqs, cycles=cycles, init_rotation=init_rotation, **kw)\nexcept Exception as x:\n self.exception = x\n traceback.print_exc()", "pulse_op_codes_list = []\ntl = [self.preprocesse...
<|body_start_0|> try: self.init_rotation = init_rotation super().__init__(task_list, qubits=qubits, sweep_points=sweep_points, nr_seqs=nr_seqs, cycles=cycles, init_rotation=init_rotation, **kw) except Exception as x: self.exception = x traceback.print_exc(...
Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.
SingleQubitXEB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleQubitXEB: """Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.""" def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rotation=None, **kw): """Init of the SingleQubitXEB class. The e...
stack_v2_sparse_classes_36k_train_012195
38,263
permissive
[ { "docstring": "Init of the SingleQubitXEB class. The experiment consists of applying [[Ry - Rz(theta)] * nr_cycles for nr_cycles in cycles] nr_seqs times, with random values of theta each time. Args: nr_seqs (int): the number of times to apply a random iteration of a sequence consisting of nr_cycles cycles. If...
2
stack_v2_sparse_classes_30k_val_000202
Implement the Python class `SingleQubitXEB` described below. Class description: Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel. Method signatures and docstrings: - def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rota...
Implement the Python class `SingleQubitXEB` described below. Class description: Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel. Method signatures and docstrings: - def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rota...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class SingleQubitXEB: """Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.""" def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rotation=None, **kw): """Init of the SingleQubitXEB class. The e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleQubitXEB: """Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.""" def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rotation=None, **kw): """Init of the SingleQubitXEB class. The experiment con...
the_stack_v2_python_sparse
pycqed/measurement/benchmarking/randomized_benchmarking.py
QudevETH/PycQED_py3
train
8
8bf71c8b933406fbd71b0667c2a22f60091e7b49
[ "if self.action in ['create']:\n permission_classes = [PortToPlaylistExists]\nelif self.action in ['destroy']:\n permission_classes = [UserIsAuthenticated & IsPortabilityRequestOwner]\nelif self.action in ['retrieve']:\n permission_classes = [UserIsAuthenticated & (IsPortabilityRequestOwner | IsPlaylistOwn...
<|body_start_0|> if self.action in ['create']: permission_classes = [PortToPlaylistExists] elif self.action in ['destroy']: permission_classes = [UserIsAuthenticated & IsPortabilityRequestOwner] elif self.action in ['retrieve']: permission_classes = [UserIsAut...
Viewset for the API of the portability request object.
PortabilityResourceViewSet
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortabilityResourceViewSet: """Viewset for the API of the portability request object.""" def get_permissions(self): """Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI.""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_012196
6,199
permissive
[ { "docstring": "Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Return the queryset according to the action.", "na...
5
stack_v2_sparse_classes_30k_train_016051
Implement the Python class `PortabilityResourceViewSet` described below. Class description: Viewset for the API of the portability request object. Method signatures and docstrings: - def get_permissions(self): Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create`...
Implement the Python class `PortabilityResourceViewSet` described below. Class description: Viewset for the API of the portability request object. Method signatures and docstrings: - def get_permissions(self): Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create`...
f767f1bdc12c9712f26ea17cb8b19f536389f0ed
<|skeleton|> class PortabilityResourceViewSet: """Viewset for the API of the portability request object.""" def get_permissions(self): """Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI.""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PortabilityResourceViewSet: """Viewset for the API of the portability request object.""" def get_permissions(self): """Manage permissions for built-in DRF methods. Default to the ViewSet's default permissions. Only the `create` view is available from LTI.""" if self.action in ['create']: ...
the_stack_v2_python_sparse
src/backend/marsha/core/api/portability_request.py
openfun/marsha
train
92
80f5566eda0af69ba59e0b760e7ea436917dfb7b
[ "self.client_id = client_id\nself.enabled = enabled\nself.client_name = client_name\nself.account_id = account_id\nself.created = APIHelper.RFC3339DateTime(created) if created else None\nself.last_changed = APIHelper.RFC3339DateTime(last_changed) if last_changed else None\nself.additional_properties = additional_pr...
<|body_start_0|> self.client_id = client_id self.enabled = enabled self.client_name = client_name self.account_id = account_id self.created = APIHelper.RFC3339DateTime(created) if created else None self.last_changed = APIHelper.RFC3339DateTime(last_changed) if last_change...
Implementation of the 'OauthClientListItemResponse' model. TODO: type model description here. Attributes: client_id (string): TODO: type description here. enabled (bool): TODO: type description here. client_name (string): TODO: type description here. account_id (uuid|string): TODO: type description here. created (datet...
OauthClientListItemResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OauthClientListItemResponse: """Implementation of the 'OauthClientListItemResponse' model. TODO: type model description here. Attributes: client_id (string): TODO: type description here. enabled (bool): TODO: type description here. client_name (string): TODO: type description here. account_id (uu...
stack_v2_sparse_classes_36k_train_012197
3,433
permissive
[ { "docstring": "Constructor for the OauthClientListItemResponse class", "name": "__init__", "signature": "def __init__(self, client_id=None, enabled=None, client_name=None, account_id=None, created=None, last_changed=None, additional_properties={})" }, { "docstring": "Creates an instance of this...
2
stack_v2_sparse_classes_30k_train_014063
Implement the Python class `OauthClientListItemResponse` described below. Class description: Implementation of the 'OauthClientListItemResponse' model. TODO: type model description here. Attributes: client_id (string): TODO: type description here. enabled (bool): TODO: type description here. client_name (string): TODO...
Implement the Python class `OauthClientListItemResponse` described below. Class description: Implementation of the 'OauthClientListItemResponse' model. TODO: type model description here. Attributes: client_id (string): TODO: type description here. enabled (bool): TODO: type description here. client_name (string): TODO...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class OauthClientListItemResponse: """Implementation of the 'OauthClientListItemResponse' model. TODO: type model description here. Attributes: client_id (string): TODO: type description here. enabled (bool): TODO: type description here. client_name (string): TODO: type description here. account_id (uu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OauthClientListItemResponse: """Implementation of the 'OauthClientListItemResponse' model. TODO: type model description here. Attributes: client_id (string): TODO: type description here. enabled (bool): TODO: type description here. client_name (string): TODO: type description here. account_id (uuid|string): T...
the_stack_v2_python_sparse
idfy_rest_client/models/oauth_client_list_item_response.py
dealflowteam/Idfy
train
0
8a2bad26db356a136f93881bd8ccbe7413d7b4f2
[ "self._session = session_obj\nself._ctx_ks = KeyStore(self._session)\nself._ctx_key = KeyObject(self._ctx_ks)\nself.key_obj_mode = apis.kKeyObject_Mode_Persistent", "if file_name[-4:] != '.pem' and file_name[-4:] != '.der':\n log.error('Unsupported file type. File type should be in pem or der format')\n ret...
<|body_start_0|> self._session = session_obj self._ctx_ks = KeyStore(self._session) self._ctx_key = KeyObject(self._ctx_ks) self.key_obj_mode = apis.kKeyObject_Mode_Persistent <|end_body_0|> <|body_start_1|> if file_name[-4:] != '.pem' and file_name[-4:] != '.der': l...
Generate key pair/public key of ecc/rsa
Generate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generate: """Generate key pair/public key of ecc/rsa""" def __init__(self, session_obj): """Constructor :param session_obj: Instance of session""" <|body_0|> def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format=''): """Generate ecc public...
stack_v2_sparse_classes_36k_train_012198
4,479
permissive
[ { "docstring": "Constructor :param session_obj: Instance of session", "name": "__init__", "signature": "def __init__(self, session_obj)" }, { "docstring": "Generate ecc public key :param key_id: Key index :param curve_type: ECC curve type :param file_name: File name to store public key :param po...
6
null
Implement the Python class `Generate` described below. Class description: Generate key pair/public key of ecc/rsa Method signatures and docstrings: - def __init__(self, session_obj): Constructor :param session_obj: Instance of session - def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format='')...
Implement the Python class `Generate` described below. Class description: Generate key pair/public key of ecc/rsa Method signatures and docstrings: - def __init__(self, session_obj): Constructor :param session_obj: Instance of session - def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format='')...
ab42459602787e9a557c3a00df40b20a52879fc7
<|skeleton|> class Generate: """Generate key pair/public key of ecc/rsa""" def __init__(self, session_obj): """Constructor :param session_obj: Instance of session""" <|body_0|> def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format=''): """Generate ecc public...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generate: """Generate key pair/public key of ecc/rsa""" def __init__(self, session_obj): """Constructor :param session_obj: Instance of session""" self._session = session_obj self._ctx_ks = KeyStore(self._session) self._ctx_key = KeyObject(self._ctx_ks) self.key_ob...
the_stack_v2_python_sparse
src/salt/base/state/secure_element/se05x_sss/sss/genkey.py
autopi-io/autopi-core
train
141
0f9c22d0619771241895bda5077b516105d52d89
[ "self.X = X\nself.M = np.shape(X)[0]\nself.N = np.shape(X)[1]", "x = np.zeros([self.M, self.N], dtype=np.complex)\nfor m in range(self.M):\n for n in range(self.N):\n for i in range(self.M):\n for j in range(self.N):\n x[m, n] = x[m, n] + self.X[i, j] / np.sqrt(self.M * self.N)...
<|body_start_0|> self.X = X self.M = np.shape(X)[0] self.N = np.shape(X)[1] <|end_body_0|> <|body_start_1|> x = np.zeros([self.M, self.N], dtype=np.complex) for m in range(self.M): for n in range(self.N): for i in range(self.M): fo...
2-D iDFT
iDFT_2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iDFT_2D: """2-D iDFT""" def __init__(self, X): """Input DFT X""" <|body_0|> def solve1(self): """\\\\\\ METHOD: Compute the iDFT of X with N^2 coefficients""" <|body_1|> def solve2(self): """\\\\\\ METHOD: Compute the iDFT of X with N^2/2 coe...
stack_v2_sparse_classes_36k_train_012199
4,947
no_license
[ { "docstring": "Input DFT X", "name": "__init__", "signature": "def __init__(self, X)" }, { "docstring": "\\\\\\\\\\\\ METHOD: Compute the iDFT of X with N^2 coefficients", "name": "solve1", "signature": "def solve1(self)" }, { "docstring": "\\\\\\\\\\\\ METHOD: Compute the iDFT ...
3
stack_v2_sparse_classes_30k_train_001250
Implement the Python class `iDFT_2D` described below. Class description: 2-D iDFT Method signatures and docstrings: - def __init__(self, X): Input DFT X - def solve1(self): \\\\\\ METHOD: Compute the iDFT of X with N^2 coefficients - def solve2(self): \\\\\\ METHOD: Compute the iDFT of X with N^2/2 coefficients
Implement the Python class `iDFT_2D` described below. Class description: 2-D iDFT Method signatures and docstrings: - def __init__(self, X): Input DFT X - def solve1(self): \\\\\\ METHOD: Compute the iDFT of X with N^2 coefficients - def solve2(self): \\\\\\ METHOD: Compute the iDFT of X with N^2/2 coefficients <|sk...
b72322cfc6d81c996117cea2160ee312da62d3ed
<|skeleton|> class iDFT_2D: """2-D iDFT""" def __init__(self, X): """Input DFT X""" <|body_0|> def solve1(self): """\\\\\\ METHOD: Compute the iDFT of X with N^2 coefficients""" <|body_1|> def solve2(self): """\\\\\\ METHOD: Compute the iDFT of X with N^2/2 coe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iDFT_2D: """2-D iDFT""" def __init__(self, X): """Input DFT X""" self.X = X self.M = np.shape(X)[0] self.N = np.shape(X)[1] def solve1(self): """\\\\\\ METHOD: Compute the iDFT of X with N^2 coefficients""" x = np.zeros([self.M, self.N], dtype=np.compl...
the_stack_v2_python_sparse
2D Signal Processing and Image De-noising/discrete_signal.py
FG-14/Signals-and-Information-Processing-DSP-
train
0