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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0ff5024261af037006235a72cc02bc4e6e1c8a84 | [
"topic_ids = [x for x, y in dataset[0]['data']]\nmatrix = np.array([[0.0 for x in topic_ids] for y in topic_ids])\nfor document in dataset:\n weights = np.array(document['data']['weight'])\n for topic_index, wc in enumerate(weights):\n if wc > threshold:\n matrix[topic_index] += np.array([wc... | <|body_start_0|>
topic_ids = [x for x, y in dataset[0]['data']]
matrix = np.array([[0.0 for x in topic_ids] for y in topic_ids])
for document in dataset:
weights = np.array(document['data']['weight'])
for topic_index, wc in enumerate(weights):
if wc > thre... | Requirements: Rangordna samförekommande topics a. Använd Composition-fil b. Identifiera ett eller flera topics (Topic1) att undersöka dessa samförekomster med c. Multiplicera vikten för Topic1 med alla Topic2 (dvs en för varje textfil/rad) – den sammanlagda vikten utgör Topic1s samförekomst med Topic2. Sen utförs samma... | CoOccurrenceCalculator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoOccurrenceCalculator:
"""Requirements: Rangordna samförekommande topics a. Använd Composition-fil b. Identifiera ett eller flera topics (Topic1) att undersöka dessa samförekomster med c. Multiplicera vikten för Topic1 med alla Topic2 (dvs en för varje textfil/rad) – den sammanlagda vikten utgör... | stack_v2_sparse_classes_36k_train_029200 | 13,916 | no_license | [
{
"docstring": "Computes co-occurrences for all topics in the entire dataset The resulting matrix is an n by n sized matrix where n is the number of topics Position (i,j) in the matrix is the addative co-occurance weight for the entire dataset Weight below a certain threshold are ignored (adjusted to 0) Thresho... | 3 | stack_v2_sparse_classes_30k_test_000242 | Implement the Python class `CoOccurrenceCalculator` described below.
Class description:
Requirements: Rangordna samförekommande topics a. Använd Composition-fil b. Identifiera ett eller flera topics (Topic1) att undersöka dessa samförekomster med c. Multiplicera vikten för Topic1 med alla Topic2 (dvs en för varje text... | Implement the Python class `CoOccurrenceCalculator` described below.
Class description:
Requirements: Rangordna samförekommande topics a. Använd Composition-fil b. Identifiera ett eller flera topics (Topic1) att undersöka dessa samförekomster med c. Multiplicera vikten för Topic1 med alla Topic2 (dvs en för varje text... | 32fc444ed11649a948a7bf59653ec792396f06e3 | <|skeleton|>
class CoOccurrenceCalculator:
"""Requirements: Rangordna samförekommande topics a. Använd Composition-fil b. Identifiera ett eller flera topics (Topic1) att undersöka dessa samförekomster med c. Multiplicera vikten för Topic1 med alla Topic2 (dvs en för varje textfil/rad) – den sammanlagda vikten utgör... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CoOccurrenceCalculator:
"""Requirements: Rangordna samförekommande topics a. Använd Composition-fil b. Identifiera ett eller flera topics (Topic1) att undersöka dessa samförekomster med c. Multiplicera vikten för Topic1 med alla Topic2 (dvs en för varje textfil/rad) – den sammanlagda vikten utgör Topic1s samf... | the_stack_v2_python_sparse | pending_deletes/topic_modelling/topic_co_occurrence.py | humlab/text_analytic_tools | train | 2 |
2a1bd85ddbec4a0d1e6790296011f560ed5e2b25 | [
"self.capacity = capacity\nself.data = {}\nself.counter = {}",
"if key not in self.data:\n return -1\ncount = self.data[key]['used']\nself.data[key]['used'] += 1\nif count + 1 not in self.counter:\n self.counter[count + 1] = []\nself.counter[count].remove(key)\nself.counter[count + 1].append(key)\nreturn se... | <|body_start_0|>
self.capacity = capacity
self.data = {}
self.counter = {}
<|end_body_0|>
<|body_start_1|>
if key not in self.data:
return -1
count = self.data[key]['used']
self.data[key]['used'] += 1
if count + 1 not in self.counter:
self... | LFUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_029201 | 2,769 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | null | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | 9687f8e743a8b6396fff192f22b5256d1025f86b | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.data = {}
self.counter = {}
def get(self, key):
""":type key: int :rtype: int"""
if key not in self.data:
return -1
count = self.data[key]['u... | the_stack_v2_python_sparse | 2017/design/LFU_Cache.py | buhuipao/LeetCode | train | 5 | |
83c03f4527a2df4c5994f985d6e2c750d72e59d9 | [
"self.client = texttospeech.TextToSpeechClient(credentials=credentials)\nself.ws_path = ws_path\nself.temp_path = ''",
"gender_nb = 'B'\ngender = texttospeech.SsmlVoiceGender.MALE\nif voice_gender == 1:\n gender = texttospeech.SsmlVoiceGender.FEMALE\n gender_nb = 'A'\nif voice_quality == 'w':\n name = la... | <|body_start_0|>
self.client = texttospeech.TextToSpeechClient(credentials=credentials)
self.ws_path = ws_path
self.temp_path = ''
<|end_body_0|>
<|body_start_1|>
gender_nb = 'B'
gender = texttospeech.SsmlVoiceGender.MALE
if voice_gender == 1:
gender = textto... | Class to interface with Google Translate’s text-to-speech API | GoogleTTS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleTTS:
"""Class to interface with Google Translate’s text-to-speech API"""
def __init__(self, ws_path='/home/flavien/Documents/TTS/audio_files/', credentials=service_account.Credentials.from_service_account_file('inmoovkey.json')):
"""Instantiates a client with the following para... | stack_v2_sparse_classes_36k_train_029202 | 19,139 | no_license | [
{
"docstring": "Instantiates a client with the following parameters: - ws_path: path of the workspace directory (ex: /home/user/...) - credentials: credentials to use the google api",
"name": "__init__",
"signature": "def __init__(self, ws_path='/home/flavien/Documents/TTS/audio_files/', credentials=ser... | 3 | stack_v2_sparse_classes_30k_train_009930 | Implement the Python class `GoogleTTS` described below.
Class description:
Class to interface with Google Translate’s text-to-speech API
Method signatures and docstrings:
- def __init__(self, ws_path='/home/flavien/Documents/TTS/audio_files/', credentials=service_account.Credentials.from_service_account_file('inmoovk... | Implement the Python class `GoogleTTS` described below.
Class description:
Class to interface with Google Translate’s text-to-speech API
Method signatures and docstrings:
- def __init__(self, ws_path='/home/flavien/Documents/TTS/audio_files/', credentials=service_account.Credentials.from_service_account_file('inmoovk... | d1ba87ff5b0f2b58c98f02519073b335cdc55c58 | <|skeleton|>
class GoogleTTS:
"""Class to interface with Google Translate’s text-to-speech API"""
def __init__(self, ws_path='/home/flavien/Documents/TTS/audio_files/', credentials=service_account.Credentials.from_service_account_file('inmoovkey.json')):
"""Instantiates a client with the following para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GoogleTTS:
"""Class to interface with Google Translate’s text-to-speech API"""
def __init__(self, ws_path='/home/flavien/Documents/TTS/audio_files/', credentials=service_account.Credentials.from_service_account_file('inmoovkey.json')):
"""Instantiates a client with the following parameters: - ws_... | the_stack_v2_python_sparse | AI/Google_voice/STT-TTS/gstt.py | cemot/DaVinciBot-InMoov-2020-2021 | train | 0 |
3b29838a84dd7a58ad4eff9f29b9e99e1358b71f | [
"super().__init__()\ninitialize(self, init_type)\nif nonlinear_activation:\n nonlinear_activation = nonlinear_activation.lower()\nself.discriminators = nn.LayerList()\nfor _ in range(scales):\n self.discriminators.append(MelGANDiscriminator(in_channels=in_channels, out_channels=out_channels, kernel_sizes=kern... | <|body_start_0|>
super().__init__()
initialize(self, init_type)
if nonlinear_activation:
nonlinear_activation = nonlinear_activation.lower()
self.discriminators = nn.LayerList()
for _ in range(scales):
self.discriminators.append(MelGANDiscriminator(in_chan... | MelGAN multi-scale discriminator module. | MelGANMultiScaleDiscriminator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MelGANMultiScaleDiscriminator:
"""MelGAN multi-scale discriminator module."""
def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1D', downsample_pooling_params: Dict[str, Any]={'kernel_size': 4, 'stride': 2, 'padding': 1, 'exclusive': T... | stack_v2_sparse_classes_36k_train_029203 | 20,745 | permissive | [
{
"docstring": "Initilize MelGAN multi-scale discriminator module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. scales (int): Number of multi-scales. downsample_pooling (str): Pooling module name for downsampling of the inputs. downsample_pooling_params (dict... | 5 | null | Implement the Python class `MelGANMultiScaleDiscriminator` described below.
Class description:
MelGAN multi-scale discriminator module.
Method signatures and docstrings:
- def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1D', downsample_pooling_params: Dict[st... | Implement the Python class `MelGANMultiScaleDiscriminator` described below.
Class description:
MelGAN multi-scale discriminator module.
Method signatures and docstrings:
- def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1D', downsample_pooling_params: Dict[st... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class MelGANMultiScaleDiscriminator:
"""MelGAN multi-scale discriminator module."""
def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1D', downsample_pooling_params: Dict[str, Any]={'kernel_size': 4, 'stride': 2, 'padding': 1, 'exclusive': T... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MelGANMultiScaleDiscriminator:
"""MelGAN multi-scale discriminator module."""
def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1D', downsample_pooling_params: Dict[str, Any]={'kernel_size': 4, 'stride': 2, 'padding': 1, 'exclusive': True}, kernel_... | the_stack_v2_python_sparse | paddlespeech/t2s/models/melgan/melgan.py | anniyanvr/DeepSpeech-1 | train | 0 |
9111add6773948963b06d0706c956d2b5d5334ea | [
"max_so_far = -2 ** 32 - 1\nmax_ending_here = 0\nfor i in range(0, len(nums)):\n max_ending_here = max_ending_here + nums[i]\n if max_so_far < max_ending_here:\n max_so_far = max_ending_here\n if max_ending_here < 0:\n max_ending_here = 0\nreturn max_so_far",
"curr_max = nums[0]\nmax_so_far... | <|body_start_0|>
max_so_far = -2 ** 32 - 1
max_ending_here = 0
for i in range(0, len(nums)):
max_ending_here = max_ending_here + nums[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if max_ending_here < 0:
max_e... | @ Linkedin, Bloomberg, Microsoft Array, DP, Divide and Conquer Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. Kadane's algorithm: Initialize: max_so... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""@ Linkedin, Bloomberg, Microsoft Array, DP, Divide and Conquer Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. Ka... | stack_v2_sparse_classes_36k_train_029204 | 1,508 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray_kadane",
"signature": "def maxSubArray_kadane(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray_dp",
"signature": "def maxSubArray_dp(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
@ Linkedin, Bloomberg, Microsoft Array, DP, Divide and Conquer Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray... | Implement the Python class `Solution` described below.
Class description:
@ Linkedin, Bloomberg, Microsoft Array, DP, Divide and Conquer Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray... | cbe6a7e7f05eccb4f9c5fce8651c0d87e5168516 | <|skeleton|>
class Solution:
"""@ Linkedin, Bloomberg, Microsoft Array, DP, Divide and Conquer Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. Ka... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""@ Linkedin, Bloomberg, Microsoft Array, DP, Divide and Conquer Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. Kadane's algori... | the_stack_v2_python_sparse | src/dp/leetcode53.py | apepkuss/Cracking-Leetcode-in-Python | train | 2 |
c2ff7c786abff1a430e6673878044248aa199908 | [
"cnt = 0\n\ndef rec(node, acc):\n nonlocal cnt\n if not node:\n return\n if 0 not in acc:\n acc[0] = 0\n acc[0] += 1\n cnt += acc.get(targetSum - node.val, 0)\n rec(node.left, {k + node.val: v for k, v in acc.items()})\n rec(node.right, {k + node.val: v for k, v in acc.items()})\n... | <|body_start_0|>
cnt = 0
def rec(node, acc):
nonlocal cnt
if not node:
return
if 0 not in acc:
acc[0] = 0
acc[0] += 1
cnt += acc.get(targetSum - node.val, 0)
rec(node.left, {k + node.val: v for k, v ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum(self, root: TreeNode, targetSum: int) -> int:
"""07/28/2020 00:27"""
<|body_0|>
def pathSum(self, root: TreeNode, targetSum: int) -> int:
"""07/28/2020 00:34 Time complexity: O(n) Space complexity: O(n)"""
<|body_1|>
def pathSum(sel... | stack_v2_sparse_classes_36k_train_029205 | 3,314 | no_license | [
{
"docstring": "07/28/2020 00:27",
"name": "pathSum",
"signature": "def pathSum(self, root: TreeNode, targetSum: int) -> int"
},
{
"docstring": "07/28/2020 00:34 Time complexity: O(n) Space complexity: O(n)",
"name": "pathSum",
"signature": "def pathSum(self, root: TreeNode, targetSum: i... | 3 | stack_v2_sparse_classes_30k_train_021607 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:27
- def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:34 Time complexity: O(n) Spac... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:27
- def pathSum(self, root: TreeNode, targetSum: int) -> int: 07/28/2020 00:34 Time complexity: O(n) Spac... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def pathSum(self, root: TreeNode, targetSum: int) -> int:
"""07/28/2020 00:27"""
<|body_0|>
def pathSum(self, root: TreeNode, targetSum: int) -> int:
"""07/28/2020 00:34 Time complexity: O(n) Space complexity: O(n)"""
<|body_1|>
def pathSum(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def pathSum(self, root: TreeNode, targetSum: int) -> int:
"""07/28/2020 00:27"""
cnt = 0
def rec(node, acc):
nonlocal cnt
if not node:
return
if 0 not in acc:
acc[0] = 0
acc[0] += 1
c... | the_stack_v2_python_sparse | leetcode/solved/437_Path_Sum_III/solution.py | sungminoh/algorithms | train | 0 | |
1651389292bc1c63e38585a5e8361a7fb6ed7744 | [
"assert len(data.shape) == 2, 'input data should be two-dimensional, with first dimension units and second dimension time'\nself.data = data.astype('float32')\nself.model = model\nself.n_jobs = n_jobs\nself.fit_hrf = fit_hrf\nself.__dict__.update(kwargs)\nself.n_units = self.data.shape[0]\nself.n_timepoints = self.... | <|body_start_0|>
assert len(data.shape) == 2, 'input data should be two-dimensional, with first dimension units and second dimension time'
self.data = data.astype('float32')
self.model = model
self.n_jobs = n_jobs
self.fit_hrf = fit_hrf
self.__dict__.update(kwargs)
... | Fitter Superclass for classes that implement the different fitting methods, for a given model. It contains 2D-data and leverages a Model object. data should be two-dimensional so that all bookkeeping with regard to voxels, electrodes, etc is done by the user. Generally, a Fitter class should implement both a `grid_fit`... | Fitter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fitter:
"""Fitter Superclass for classes that implement the different fitting methods, for a given model. It contains 2D-data and leverages a Model object. data should be two-dimensional so that all bookkeeping with regard to voxels, electrodes, etc is done by the user. Generally, a Fitter class ... | stack_v2_sparse_classes_36k_train_029206 | 32,962 | no_license | [
{
"docstring": "__init__ sets up data and model Parameters ---------- data : numpy.ndarray, 2D input data. First dimension units, Second dimension time model : prfpy.Model Model object that provides the grid and iterative search predictions. n_jobs : int, optional number of jobs to use in parallelization (itera... | 3 | stack_v2_sparse_classes_30k_train_018240 | Implement the Python class `Fitter` described below.
Class description:
Fitter Superclass for classes that implement the different fitting methods, for a given model. It contains 2D-data and leverages a Model object. data should be two-dimensional so that all bookkeeping with regard to voxels, electrodes, etc is done ... | Implement the Python class `Fitter` described below.
Class description:
Fitter Superclass for classes that implement the different fitting methods, for a given model. It contains 2D-data and leverages a Model object. data should be two-dimensional so that all bookkeeping with regard to voxels, electrodes, etc is done ... | f8eda6b3d741e5e12e4192c2ff7d100b5bb3f5d1 | <|skeleton|>
class Fitter:
"""Fitter Superclass for classes that implement the different fitting methods, for a given model. It contains 2D-data and leverages a Model object. data should be two-dimensional so that all bookkeeping with regard to voxels, electrodes, etc is done by the user. Generally, a Fitter class ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fitter:
"""Fitter Superclass for classes that implement the different fitting methods, for a given model. It contains 2D-data and leverages a Model object. data should be two-dimensional so that all bookkeeping with regard to voxels, electrodes, etc is done by the user. Generally, a Fitter class should implem... | the_stack_v2_python_sparse | mri_analysis/model/prfpy/fit.py | mszinte/pRFgazeMod | train | 0 |
d4d7d6219289c858ddda8c518c329c01eb9a2a22 | [
"BaseWorkerThread.__init__(self)\nself.forbiddenStatus = ['aborted', 'aborted-completed', 'force-complete', 'completed']\nself.queue = queue\nself.config = config\nself.reqmgr2Svc = ReqMgr(self.config.General.ReqMgr2ServiceURL)\nmyThread = threading.currentThread()\ndaoFactory = DAOFactory(package='WMCore.WMBS', lo... | <|body_start_0|>
BaseWorkerThread.__init__(self)
self.forbiddenStatus = ['aborted', 'aborted-completed', 'force-complete', 'completed']
self.queue = queue
self.config = config
self.reqmgr2Svc = ReqMgr(self.config.General.ReqMgr2ServiceURL)
myThread = threading.currentThre... | Cleans expired items, updates element status. | WorkQueueManagerCleaner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkQueueManagerCleaner:
"""Cleans expired items, updates element status."""
def __init__(self, queue, config):
"""Initialise class members"""
<|body_0|>
def setup(self, parameters):
"""Called at startup - introduce random delay to avoid workers all starting at o... | stack_v2_sparse_classes_36k_train_029207 | 2,649 | permissive | [
{
"docstring": "Initialise class members",
"name": "__init__",
"signature": "def __init__(self, queue, config)"
},
{
"docstring": "Called at startup - introduce random delay to avoid workers all starting at once",
"name": "setup",
"signature": "def setup(self, parameters)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_005795 | Implement the Python class `WorkQueueManagerCleaner` described below.
Class description:
Cleans expired items, updates element status.
Method signatures and docstrings:
- def __init__(self, queue, config): Initialise class members
- def setup(self, parameters): Called at startup - introduce random delay to avoid work... | Implement the Python class `WorkQueueManagerCleaner` described below.
Class description:
Cleans expired items, updates element status.
Method signatures and docstrings:
- def __init__(self, queue, config): Initialise class members
- def setup(self, parameters): Called at startup - introduce random delay to avoid work... | de110ccf6fc63ef5589b4e871ef4d51d5bce7a25 | <|skeleton|>
class WorkQueueManagerCleaner:
"""Cleans expired items, updates element status."""
def __init__(self, queue, config):
"""Initialise class members"""
<|body_0|>
def setup(self, parameters):
"""Called at startup - introduce random delay to avoid workers all starting at o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkQueueManagerCleaner:
"""Cleans expired items, updates element status."""
def __init__(self, queue, config):
"""Initialise class members"""
BaseWorkerThread.__init__(self)
self.forbiddenStatus = ['aborted', 'aborted-completed', 'force-complete', 'completed']
self.queue ... | the_stack_v2_python_sparse | src/python/WMComponent/WorkQueueManager/WorkQueueManagerCleaner.py | vkuznet/WMCore | train | 0 |
dccee75890cce38d8b94c56ce0baf766415aca64 | [
"self.buffer_max = buffer_max\nself.reg = reg\nself.buff_opt = None\nself.seed = 10\nsuper().__init__(*args, **kwargs)",
"print('Eigen Start Method')\nx = eigengap_init(array, k=self.k, b_max=self.buffer_max, warm_start_row_factor=self.init_row_sampling_factor, tol=self.scoring_tol, seed=seed, log=0)\nm, n = x.sh... | <|body_start_0|>
self.buffer_max = buffer_max
self.reg = reg
self.buff_opt = None
self.seed = 10
super().__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
print('Eigen Start Method')
x = eigengap_init(array, k=self.k, b_max=self.buffer_max, warm_start_row... | PowerMethodEigenStart | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PowerMethodEigenStart:
def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None:
"""Only difference is :param buffer_max: :param reg:"""
<|body_0|>
def __start(self, array: ArrayType, seed: int) -> ArrayType:
""":param array: :retu... | stack_v2_sparse_classes_36k_train_029208 | 8,055 | permissive | [
{
"docstring": "Only difference is :param buffer_max: :param reg:",
"name": "__init__",
"signature": "def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None"
},
{
"docstring": ":param array: :return:",
"name": "__start",
"signature": "def __start(sel... | 6 | stack_v2_sparse_classes_30k_train_001076 | Implement the Python class `PowerMethodEigenStart` described below.
Class description:
Implement the PowerMethodEigenStart class.
Method signatures and docstrings:
- def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None: Only difference is :param buffer_max: :param reg:
- def __... | Implement the Python class `PowerMethodEigenStart` described below.
Class description:
Implement the PowerMethodEigenStart class.
Method signatures and docstrings:
- def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None: Only difference is :param buffer_max: :param reg:
- def __... | 962e91463f4889bb1e67a3fbfc54128c1b3a3735 | <|skeleton|>
class PowerMethodEigenStart:
def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None:
"""Only difference is :param buffer_max: :param reg:"""
<|body_0|>
def __start(self, array: ArrayType, seed: int) -> ArrayType:
""":param array: :retu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PowerMethodEigenStart:
def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None:
"""Only difference is :param buffer_max: :param reg:"""
self.buffer_max = buffer_max
self.reg = reg
self.buff_opt = None
self.seed = 10
super()._... | the_stack_v2_python_sparse | lmdec/decomp/legacy/power_method.py | TNonet/lmdec_research | train | 0 | |
12f6d297a51620e72d78390169a7d4db9818e091 | [
"self.robot = robot\nself.us = ev3.UltrasonicSensor('in3')\nself.us.mode = 'US-DIST-CM'\nself.state = 'seeking'\nself.robot.forward(0.3)",
"if self.state == 'seeking' and self.us.distance_centimeters <= 10:\n self.state = 'found'\n self.robot.stop()\nelif self.state == 'found' and self.us.distance_centimete... | <|body_start_0|>
self.robot = robot
self.us = ev3.UltrasonicSensor('in3')
self.us.mode = 'US-DIST-CM'
self.state = 'seeking'
self.robot.forward(0.3)
<|end_body_0|>
<|body_start_1|>
if self.state == 'seeking' and self.us.distance_centimeters <= 10:
self.state ... | This behavior should move forward at a fixed, not-too-fast speed if no object is close enough in front of it. When an object is detected, it should stop moving. | Timid | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Timid:
"""This behavior should move forward at a fixed, not-too-fast speed if no object is close enough in front of it. When an object is detected, it should stop moving."""
def __init__(self, robot=None):
"""Set up motors/robot and sensors here, set state to 'seeking' and forward sp... | stack_v2_sparse_classes_36k_train_029209 | 6,005 | no_license | [
{
"docstring": "Set up motors/robot and sensors here, set state to 'seeking' and forward speed to nonzero",
"name": "__init__",
"signature": "def __init__(self, robot=None)"
},
{
"docstring": "Updates the FSM by reading sensor data, then choosing based on the state",
"name": "run",
"sign... | 2 | stack_v2_sparse_classes_30k_train_001179 | Implement the Python class `Timid` described below.
Class description:
This behavior should move forward at a fixed, not-too-fast speed if no object is close enough in front of it. When an object is detected, it should stop moving.
Method signatures and docstrings:
- def __init__(self, robot=None): Set up motors/robo... | Implement the Python class `Timid` described below.
Class description:
This behavior should move forward at a fixed, not-too-fast speed if no object is close enough in front of it. When an object is detected, it should stop moving.
Method signatures and docstrings:
- def __init__(self, robot=None): Set up motors/robo... | 59bd3e0825e8009ba60ad629962944f135e79c88 | <|skeleton|>
class Timid:
"""This behavior should move forward at a fixed, not-too-fast speed if no object is close enough in front of it. When an object is detected, it should stop moving."""
def __init__(self, robot=None):
"""Set up motors/robot and sensors here, set state to 'seeking' and forward sp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Timid:
"""This behavior should move forward at a fixed, not-too-fast speed if no object is close enough in front of it. When an object is detected, it should stop moving."""
def __init__(self, robot=None):
"""Set up motors/robot and sensors here, set state to 'seeking' and forward speed to nonzer... | the_stack_v2_python_sparse | fsmCodeA.py | dletk/COMP380-Spring-2018 | train | 0 |
c9465e488bac63ddb11ed7ce749a2a6ce1765a04 | [
"self.K = K\nself.D = D\nif type(exp_list) is not list:\n self.exp_list = [exp_list for i in range(K)]\nelse:\n self.exp_list = exp_list\nreturn",
"self.GMM_model = GMM(X, self.K)\nself.GMM_model.fit(tol=0.001)\nself.MoE_list = []\nfor i in range(self.K):\n indices = self.GMM_model.get_cluster_indices(y,... | <|body_start_0|>
self.K = K
self.D = D
if type(exp_list) is not list:
self.exp_list = [exp_list for i in range(K)]
else:
self.exp_list = exp_list
return
<|end_body_0|>
<|body_start_1|>
self.GMM_model = GMM(X, self.K)
self.GMM_model.fit(tol... | This class is to fit a cluster model over data given. After that, for each cluster, a MoE model is fitted for each cluster. It has methods for make predictions and test validation error. | cluster_fit | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class cluster_fit:
"""This class is to fit a cluster model over data given. After that, for each cluster, a MoE model is fitted for each cluster. It has methods for make predictions and test validation error."""
def __init__(self, K, L, exp_list):
"""Initialize the class with L clusters in... | stack_v2_sparse_classes_36k_train_029210 | 1,937 | permissive | [
{
"docstring": "Initialize the class with L clusters in a space with K features. The MoE model has a number of experts given in exp_list. Input: D dimensionality of space K number of clusters exp_list ()/[] list of L number of experts for each cluster model (if a number it's the same for every cluster) Output:"... | 2 | stack_v2_sparse_classes_30k_train_015062 | Implement the Python class `cluster_fit` described below.
Class description:
This class is to fit a cluster model over data given. After that, for each cluster, a MoE model is fitted for each cluster. It has methods for make predictions and test validation error.
Method signatures and docstrings:
- def __init__(self,... | Implement the Python class `cluster_fit` described below.
Class description:
This class is to fit a cluster model over data given. After that, for each cluster, a MoE model is fitted for each cluster. It has methods for make predictions and test validation error.
Method signatures and docstrings:
- def __init__(self,... | a786e9ce5845ba1f82980c5265307914c3c26e68 | <|skeleton|>
class cluster_fit:
"""This class is to fit a cluster model over data given. After that, for each cluster, a MoE model is fitted for each cluster. It has methods for make predictions and test validation error."""
def __init__(self, K, L, exp_list):
"""Initialize the class with L clusters in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class cluster_fit:
"""This class is to fit a cluster model over data given. After that, for each cluster, a MoE model is fitted for each cluster. It has methods for make predictions and test validation error."""
def __init__(self, K, L, exp_list):
"""Initialize the class with L clusters in a space with... | the_stack_v2_python_sparse | dev/tries_checks/tries/cluster_fit.py | stefanoschmidt1995/MLGW | train | 12 |
ffe3db0b06fd9f1f54b0ef0c693bcac6692a4521 | [
"super(knem, self).__init__(**kwargs)\nself.__ospackages = kwargs.pop('ospackages', ['ca-certificates', 'git'])\nself.__prefix = kwargs.pop('prefix', '/usr/local/knem')\nself.__repository = kwargs.pop('repository', 'https://gitlab.inria.fr/knem/knem.git')\nself.__version = kwargs.pop('version', '1.1.4')\nself.envir... | <|body_start_0|>
super(knem, self).__init__(**kwargs)
self.__ospackages = kwargs.pop('ospackages', ['ca-certificates', 'git'])
self.__prefix = kwargs.pop('prefix', '/usr/local/knem')
self.__repository = kwargs.pop('repository', 'https://gitlab.inria.fr/knem/knem.git')
self.__vers... | The `knem` building block install the headers from the [KNEM](http://knem.gforge.inria.fr) component. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. environment: Boolean flag to specify whether the environment (`CPATH`) should be modified to include knem. T... | knem | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class knem:
"""The `knem` building block install the headers from the [KNEM](http://knem.gforge.inria.fr) component. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. environment: Boolean flag to specify whether the environment (`CPATH`) shoul... | stack_v2_sparse_classes_36k_train_029211 | 3,751 | permissive | [
{
"docstring": "Initialize building block",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Generate the set of instructions to install the runtime specific components from a build in a previous stage. # Examples ```python k = knem(...) Stage0 += k Stage1 += k.... | 2 | null | Implement the Python class `knem` described below.
Class description:
The `knem` building block install the headers from the [KNEM](http://knem.gforge.inria.fr) component. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. environment: Boolean flag to specify ... | Implement the Python class `knem` described below.
Class description:
The `knem` building block install the headers from the [KNEM](http://knem.gforge.inria.fr) component. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. environment: Boolean flag to specify ... | 60fd2a51c171258a6b3f93c2523101cb7018ba1b | <|skeleton|>
class knem:
"""The `knem` building block install the headers from the [KNEM](http://knem.gforge.inria.fr) component. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. environment: Boolean flag to specify whether the environment (`CPATH`) shoul... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class knem:
"""The `knem` building block install the headers from the [KNEM](http://knem.gforge.inria.fr) component. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. environment: Boolean flag to specify whether the environment (`CPATH`) should be modified... | the_stack_v2_python_sparse | hpccm/building_blocks/knem.py | NVIDIA/hpc-container-maker | train | 419 |
fe0994f1d2bfb444bbdfc8aba8201e31f8f7a469 | [
"filename = Core.Config.Get('PLUGIN_REPORT_REGISTER')\nself.core = Core\nself.filesize = 0\nself.num_plugins = 0\nif os.path.exists(filename):\n self.filesize = os.path.getsize(filename)\n with open(filename) as f:\n lines = f.read().splitlines()\n self.num_plugins = len(lines)\ntry:\n start_time... | <|body_start_0|>
filename = Core.Config.Get('PLUGIN_REPORT_REGISTER')
self.core = Core
self.filesize = 0
self.num_plugins = 0
if os.path.exists(filename):
self.filesize = os.path.getsize(filename)
with open(filename) as f:
lines = f.read().... | reporting_process | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class reporting_process:
def start(self, Core, reporting_time, queue):
"""This function after each 1 second checks if the owtf execution is completed if yes it calls generate_reports if not then after every reporting_time second it calls generate_reports"""
<|body_0|>
def generate... | stack_v2_sparse_classes_36k_train_029212 | 5,607 | no_license | [
{
"docstring": "This function after each 1 second checks if the owtf execution is completed if yes it calls generate_reports if not then after every reporting_time second it calls generate_reports",
"name": "start",
"signature": "def start(self, Core, reporting_time, queue)"
},
{
"docstring": "T... | 3 | null | Implement the Python class `reporting_process` described below.
Class description:
Implement the reporting_process class.
Method signatures and docstrings:
- def start(self, Core, reporting_time, queue): This function after each 1 second checks if the owtf execution is completed if yes it calls generate_reports if no... | Implement the Python class `reporting_process` described below.
Class description:
Implement the reporting_process class.
Method signatures and docstrings:
- def start(self, Core, reporting_time, queue): This function after each 1 second checks if the owtf execution is completed if yes it calls generate_reports if no... | 4d90bdc260edd226385e736831abcd450b9f107b | <|skeleton|>
class reporting_process:
def start(self, Core, reporting_time, queue):
"""This function after each 1 second checks if the owtf execution is completed if yes it calls generate_reports if not then after every reporting_time second it calls generate_reports"""
<|body_0|>
def generate... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class reporting_process:
def start(self, Core, reporting_time, queue):
"""This function after each 1 second checks if the owtf execution is completed if yes it calls generate_reports if not then after every reporting_time second it calls generate_reports"""
filename = Core.Config.Get('PLUGIN_REPORT_... | the_stack_v2_python_sparse | framework/report/reporting_process.py | assem-ch/owtf | train | 9 | |
fbe3d1726946ca9eb2071d349791665075ea0d1b | [
"self.tape = StringIO(buf)\nself.valid_bits = 0\nself.register = 0\nself.bpw = None\nself.bth = None",
"self.bpw = 3\nself.bth = 2\nlast = 0\nout = []\nfor _ in range(length):\n while True:\n wrd = self.get_bits()\n if wrd != 1 << self.bpw - 1:\n break\n self.shift_up()\n if ... | <|body_start_0|>
self.tape = StringIO(buf)
self.valid_bits = 0
self.register = 0
self.bpw = None
self.bth = None
<|end_body_0|>
<|body_start_1|>
self.bpw = 3
self.bth = 2
last = 0
out = []
for _ in range(length):
while True:
... | Delta compression decoder (stolen from icecube.daq.slchit in pDAQ's PyDOM) | delta_codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class delta_codec:
"""Delta compression decoder (stolen from icecube.daq.slchit in pDAQ's PyDOM)"""
def __init__(self, buf):
"""Load the buffer and prepare to decode"""
<|body_0|>
def decode(self, length):
"""Decode the specified number of bytes"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_029213 | 39,508 | no_license | [
{
"docstring": "Load the buffer and prepare to decode",
"name": "__init__",
"signature": "def __init__(self, buf)"
},
{
"docstring": "Decode the specified number of bytes",
"name": "decode",
"signature": "def decode(self, length)"
},
{
"docstring": "Decode the next byte",
"na... | 5 | null | Implement the Python class `delta_codec` described below.
Class description:
Delta compression decoder (stolen from icecube.daq.slchit in pDAQ's PyDOM)
Method signatures and docstrings:
- def __init__(self, buf): Load the buffer and prepare to decode
- def decode(self, length): Decode the specified number of bytes
- ... | Implement the Python class `delta_codec` described below.
Class description:
Delta compression decoder (stolen from icecube.daq.slchit in pDAQ's PyDOM)
Method signatures and docstrings:
- def __init__(self, buf): Load the buffer and prepare to decode
- def decode(self, length): Decode the specified number of bytes
- ... | 718189be62907a6a8031980fe0c41fa7e06b898d | <|skeleton|>
class delta_codec:
"""Delta compression decoder (stolen from icecube.daq.slchit in pDAQ's PyDOM)"""
def __init__(self, buf):
"""Load the buffer and prepare to decode"""
<|body_0|>
def decode(self, length):
"""Decode the specified number of bytes"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class delta_codec:
"""Delta compression decoder (stolen from icecube.daq.slchit in pDAQ's PyDOM)"""
def __init__(self, buf):
"""Load the buffer and prepare to decode"""
self.tape = StringIO(buf)
self.valid_bits = 0
self.register = 0
self.bpw = None
self.bth = Non... | the_stack_v2_python_sparse | payload.py | dglo/dash | train | 0 |
698d324d08b6e4ab0e89c3983a84acd4847209a2 | [
"TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)\nself.data = []\nself.regime = None\nif self.wmo[:2] != 'CD':\n LOG.warning('Product %s skipped due to wrong header', self.get_product_id())\n return\nsections = self.find_sections()\nfor section in sections:\n self.compute_diction(sec... | <|body_start_0|>
TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)
self.data = []
self.regime = None
if self.wmo[:2] != 'CD':
LOG.warning('Product %s skipped due to wrong header', self.get_product_id())
return
sections = self.find_sect... | Represents a CLI Daily Climate Report Product | CLIProduct | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CLIProduct:
"""Represents a CLI Daily Climate Report Product"""
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None):
"""constructor"""
<|body_0|>
def find_sections(self):
"""Some trickery to figure out if we have multiple reports Returns... | stack_v2_sparse_classes_36k_train_029214 | 24,500 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None)"
},
{
"docstring": "Some trickery to figure out if we have multiple reports Returns: list of text sections",
"name": "find_sections",
"signature":... | 6 | stack_v2_sparse_classes_30k_train_010307 | Implement the Python class `CLIProduct` described below.
Class description:
Represents a CLI Daily Climate Report Product
Method signatures and docstrings:
- def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): constructor
- def find_sections(self): Some trickery to figure out if we have mul... | Implement the Python class `CLIProduct` described below.
Class description:
Represents a CLI Daily Climate Report Product
Method signatures and docstrings:
- def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): constructor
- def find_sections(self): Some trickery to figure out if we have mul... | 460f44394be05e1b655111595a3d7de3f7e47757 | <|skeleton|>
class CLIProduct:
"""Represents a CLI Daily Climate Report Product"""
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None):
"""constructor"""
<|body_0|>
def find_sections(self):
"""Some trickery to figure out if we have multiple reports Returns... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CLIProduct:
"""Represents a CLI Daily Climate Report Product"""
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None):
"""constructor"""
TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)
self.data = []
self.regime = None
... | the_stack_v2_python_sparse | src/pyiem/nws/products/cli.py | akrherz/pyIEM | train | 38 |
0f3038d8accb2cbe0d5630cf0cf41a917b903dba | [
"import collections\ndicts = collections.Counter(s)\nmark = [0] * 26\nprint(dicts)\nresult = []\nfor char in s:\n while result and ord(result[-1]) > ord(char) and (dicts[result[-1]] > 0) and (mark[ord(char) - ord('a')] == 0):\n a = result.pop()\n mark[ord(a) - ord('a')] = 0\n dicts[char] -= 1\n ... | <|body_start_0|>
import collections
dicts = collections.Counter(s)
mark = [0] * 26
print(dicts)
result = []
for char in s:
while result and ord(result[-1]) > ord(char) and (dicts[result[-1]] > 0) and (mark[ord(char) - ord('a')] == 0):
a = resul... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str 73ms"""
<|body_0|>
def removeDuplicateLettersOld(self, s):
""":type s: str :rtype: str 49ms"""
<|body_1|>
def removeDuplicateLetters_1(self, s):
""":type s: str :rtype: st... | stack_v2_sparse_classes_36k_train_029215 | 2,912 | no_license | [
{
"docstring": ":type s: str :rtype: str 73ms",
"name": "removeDuplicateLetters",
"signature": "def removeDuplicateLetters(self, s)"
},
{
"docstring": ":type s: str :rtype: str 49ms",
"name": "removeDuplicateLettersOld",
"signature": "def removeDuplicateLettersOld(self, s)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_014749 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicateLetters(self, s): :type s: str :rtype: str 73ms
- def removeDuplicateLettersOld(self, s): :type s: str :rtype: str 49ms
- def removeDuplicateLetters_1(self, s)... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicateLetters(self, s): :type s: str :rtype: str 73ms
- def removeDuplicateLettersOld(self, s): :type s: str :rtype: str 49ms
- def removeDuplicateLetters_1(self, s)... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str 73ms"""
<|body_0|>
def removeDuplicateLettersOld(self, s):
""":type s: str :rtype: str 49ms"""
<|body_1|>
def removeDuplicateLetters_1(self, s):
""":type s: str :rtype: st... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str 73ms"""
import collections
dicts = collections.Counter(s)
mark = [0] * 26
print(dicts)
result = []
for char in s:
while result and ord(result[-1]) > ord(char) and (dic... | the_stack_v2_python_sparse | RemoveDuplicateLetters_HARD_316.py | 953250587/leetcode-python | train | 2 | |
80bb998c8202fde111c8654035f600e86b966492 | [
"iso8601_string = self._GetJSONValue(json_dict, name)\nif not iso8601_string:\n return None\nif name == 'FinishedAt' and iso8601_string == '0001-01-01T00:00:00Z':\n return None\ntry:\n date_time = dfdatetime_time_elements.TimeElementsInMicroseconds()\n date_time.CopyFromStringISO8601(iso8601_string)\nex... | <|body_start_0|>
iso8601_string = self._GetJSONValue(json_dict, name)
if not iso8601_string:
return None
if name == 'FinishedAt' and iso8601_string == '0001-01-01T00:00:00Z':
return None
try:
date_time = dfdatetime_time_elements.TimeElementsInMicroseco... | JSON-L parser plugin for Docker container configuration files. This parser handles per Docker container configuration files stored in: DOCKER_DIR/containers/<container_identifier>/config.json | DockerContainerConfigurationJSONLPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DockerContainerConfigurationJSONLPlugin:
"""JSON-L parser plugin for Docker container configuration files. This parser handles per Docker container configuration files stored in: DOCKER_DIR/containers/<container_identifier>/config.json"""
def _ParseISO8601DateTimeString(self, parser_mediator... | stack_v2_sparse_classes_36k_train_029216 | 4,653 | permissive | [
{
"docstring": "Parses an ISO8601 date and time string. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. json_dict (dict): JSON dictionary. name (str): name of the value to retrieve. Returns: dfdatetime.TimeElementsInMicroseconds: dat... | 3 | stack_v2_sparse_classes_30k_train_012570 | Implement the Python class `DockerContainerConfigurationJSONLPlugin` described below.
Class description:
JSON-L parser plugin for Docker container configuration files. This parser handles per Docker container configuration files stored in: DOCKER_DIR/containers/<container_identifier>/config.json
Method signatures and... | Implement the Python class `DockerContainerConfigurationJSONLPlugin` described below.
Class description:
JSON-L parser plugin for Docker container configuration files. This parser handles per Docker container configuration files stored in: DOCKER_DIR/containers/<container_identifier>/config.json
Method signatures and... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class DockerContainerConfigurationJSONLPlugin:
"""JSON-L parser plugin for Docker container configuration files. This parser handles per Docker container configuration files stored in: DOCKER_DIR/containers/<container_identifier>/config.json"""
def _ParseISO8601DateTimeString(self, parser_mediator... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DockerContainerConfigurationJSONLPlugin:
"""JSON-L parser plugin for Docker container configuration files. This parser handles per Docker container configuration files stored in: DOCKER_DIR/containers/<container_identifier>/config.json"""
def _ParseISO8601DateTimeString(self, parser_mediator, json_dict, ... | the_stack_v2_python_sparse | plaso/parsers/jsonl_plugins/docker_container_config.py | log2timeline/plaso | train | 1,506 |
047aa05754a2fc2abd934b0f6106f9ad15564229 | [
"super(VideoDecoderSim, self).__init__()\nself.env = env\nself.target_fps = target_fps\nself._semaphore = simpy.Resource(env, capacity=capacity)\nself.current_path = None\nself.current_frame_id = None\nself.video_frames = None\nself.h = self.w = None\nlogger.info('Created VideoDecoderSim at {} FPS'.format(self.targ... | <|body_start_0|>
super(VideoDecoderSim, self).__init__()
self.env = env
self.target_fps = target_fps
self._semaphore = simpy.Resource(env, capacity=capacity)
self.current_path = None
self.current_frame_id = None
self.video_frames = None
self.h = self.w = N... | VideoDecoderSim | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VideoDecoderSim:
def __init__(self, env, target_fps, capacity=1):
"""A "stateful" decoder that only works for one video at a time. Keep tracks of the "current" frame and can skip frames forward."""
<|body_0|>
def decode_frame(self, path, frame_id):
"""Assume the clie... | stack_v2_sparse_classes_36k_train_029217 | 3,686 | no_license | [
{
"docstring": "A \"stateful\" decoder that only works for one video at a time. Keep tracks of the \"current\" frame and can skip frames forward.",
"name": "__init__",
"signature": "def __init__(self, env, target_fps, capacity=1)"
},
{
"docstring": "Assume the client is sending increasing frame_... | 2 | null | Implement the Python class `VideoDecoderSim` described below.
Class description:
Implement the VideoDecoderSim class.
Method signatures and docstrings:
- def __init__(self, env, target_fps, capacity=1): A "stateful" decoder that only works for one video at a time. Keep tracks of the "current" frame and can skip frame... | Implement the Python class `VideoDecoderSim` described below.
Class description:
Implement the VideoDecoderSim class.
Method signatures and docstrings:
- def __init__(self, env, target_fps, capacity=1): A "stateful" decoder that only works for one video at a time. Keep tracks of the "current" frame and can skip frame... | 9888df367706113a1fac4346666fdfa10bdb8f7e | <|skeleton|>
class VideoDecoderSim:
def __init__(self, env, target_fps, capacity=1):
"""A "stateful" decoder that only works for one video at a time. Keep tracks of the "current" frame and can skip frames forward."""
<|body_0|>
def decode_frame(self, path, frame_id):
"""Assume the clie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VideoDecoderSim:
def __init__(self, env, target_fps, capacity=1):
"""A "stateful" decoder that only works for one video at a time. Keep tracks of the "current" frame and can skip frames forward."""
super(VideoDecoderSim, self).__init__()
self.env = env
self.target_fps = target_... | the_stack_v2_python_sparse | s3dexp/sim/decoder.py | fzqneo/smartssd-image | train | 0 | |
5143240a3b20845e1c9e9dbf67558ed5152dbdda | [
"if not prices:\n return 0\nl = len(prices)\nif k > l / 2:\n return self.maxProfitGreedy(prices)\ndp = [[[0, 0] for _ in range(k + 1)] for _ in range(2)]\ndp[0] = [[0, -prices[0]] for _ in range(k + 1)]\nfor i in range(1, l):\n for j in range(k):\n x, x0 = (i % 2, (i - 1) % 2)\n dp[x][j][0] =... | <|body_start_0|>
if not prices:
return 0
l = len(prices)
if k > l / 2:
return self.maxProfitGreedy(prices)
dp = [[[0, 0] for _ in range(k + 1)] for _ in range(2)]
dp[0] = [[0, -prices[0]] for _ in range(k + 1)]
for i in range(1, l):
for... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfitGreedy(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not prices:
... | stack_v2_sparse_classes_36k_train_029218 | 1,547 | no_license | [
{
"docstring": ":type k: int :type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, k, prices)"
},
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfitGreedy",
"signature": "def maxProfitGreedy(self, prices)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxProfitGreedy(self, prices): :type prices: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxProfitGreedy(self, prices): :type prices: List[int] :rtype: int
<|skeleton|>
class Solu... | fabe435f366477ec3526add84accec0b4ac38919 | <|skeleton|>
class Solution:
def maxProfit(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfitGreedy(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
if not prices:
return 0
l = len(prices)
if k > l / 2:
return self.maxProfitGreedy(prices)
dp = [[[0, 0] for _ in range(k + 1)] for _ in range(2)]
... | the_stack_v2_python_sparse | algorithm/leetcode/188_best-time-to-buy-and-sell-stock-iv.py | icejoywoo/toys | train | 1 | |
bba43291ba6b87fafbaa6da4ee8b4258f5b06f75 | [
"super().__init__()\nself.forward_operator = forward_operator\nself.backward_operator = backward_operator\nself._coil_dim = 1\nself._spatial_dims = (2, 3)",
"input_image = input_image.permute(0, 2, 3, 1)\nif loglikelihood_scaling is not None:\n loglikelihood_scaling = loglikelihood_scaling\nelse:\n loglikel... | <|body_start_0|>
super().__init__()
self.forward_operator = forward_operator
self.backward_operator = backward_operator
self._coil_dim = 1
self._spatial_dims = (2, 3)
<|end_body_0|>
<|body_start_1|>
input_image = input_image.permute(0, 2, 3, 1)
if loglikelihood_s... | Defines the MRI loglikelihood assuming one noise vector for the complex images for all coils: .. math:: \\frac{1}{\\sigma^2} \\sum_{i}^{N_c} {S}_i^{\\text{H}} \\mathcal{F}^{-1} P^{*} (P \\mathcal{F} S_i x_{\\tau} - y_{\\tau}) for each time step :math:`\\tau`. | MRILogLikelihood | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MRILogLikelihood:
"""Defines the MRI loglikelihood assuming one noise vector for the complex images for all coils: .. math:: \\frac{1}{\\sigma^2} \\sum_{i}^{N_c} {S}_i^{\\text{H}} \\mathcal{F}^{-1} P^{*} (P \\mathcal{F} S_i x_{\\tau} - y_{\\tau}) for each time step :math:`\\tau`."""
def __in... | stack_v2_sparse_classes_36k_train_029219 | 18,290 | permissive | [
{
"docstring": "Inits :class:`MRILogLikelihood`. Parameters ---------- forward_operator: Callable Forward Operator. backward_operator: Callable Backward Operator.",
"name": "__init__",
"signature": "def __init__(self, forward_operator: Callable, backward_operator: Callable)"
},
{
"docstring": "P... | 2 | stack_v2_sparse_classes_30k_train_014103 | Implement the Python class `MRILogLikelihood` described below.
Class description:
Defines the MRI loglikelihood assuming one noise vector for the complex images for all coils: .. math:: \\frac{1}{\\sigma^2} \\sum_{i}^{N_c} {S}_i^{\\text{H}} \\mathcal{F}^{-1} P^{*} (P \\mathcal{F} S_i x_{\\tau} - y_{\\tau}) for each ti... | Implement the Python class `MRILogLikelihood` described below.
Class description:
Defines the MRI loglikelihood assuming one noise vector for the complex images for all coils: .. math:: \\frac{1}{\\sigma^2} \\sum_{i}^{N_c} {S}_i^{\\text{H}} \\mathcal{F}^{-1} P^{*} (P \\mathcal{F} S_i x_{\\tau} - y_{\\tau}) for each ti... | 2a4c29342bc52a404aae097bc2654fb4323e1ac8 | <|skeleton|>
class MRILogLikelihood:
"""Defines the MRI loglikelihood assuming one noise vector for the complex images for all coils: .. math:: \\frac{1}{\\sigma^2} \\sum_{i}^{N_c} {S}_i^{\\text{H}} \\mathcal{F}^{-1} P^{*} (P \\mathcal{F} S_i x_{\\tau} - y_{\\tau}) for each time step :math:`\\tau`."""
def __in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MRILogLikelihood:
"""Defines the MRI loglikelihood assuming one noise vector for the complex images for all coils: .. math:: \\frac{1}{\\sigma^2} \\sum_{i}^{N_c} {S}_i^{\\text{H}} \\mathcal{F}^{-1} P^{*} (P \\mathcal{F} S_i x_{\\tau} - y_{\\tau}) for each time step :math:`\\tau`."""
def __init__(self, fo... | the_stack_v2_python_sparse | direct/nn/rim/rim.py | NKI-AI/direct | train | 151 |
7ff0ab2c46433254fa5e411b7e0fa40882686e3e | [
"reader = csv.reader(data)\nnext(reader)\nenum = collections.OrderedDict()\nfor item in reader:\n cmmd = item[0].strip('+')\n feat = item[1] or None\n desc = re.sub('{.*}', '', item[2]).strip() or None\n kind = ' | '.join((KIND[s] for s in item[3].split('/') if s in KIND)) or None\n conf = CONF.get(i... | <|body_start_0|>
reader = csv.reader(data)
next(reader)
enum = collections.OrderedDict()
for item in reader:
cmmd = item[0].strip('+')
feat = item[1] or None
desc = re.sub('{.*}', '', item[2]).strip() or None
kind = ' | '.join((KIND[s] for ... | FTP Command | Command | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""FTP Command"""
def process(self, data: 'list[str]') -> 'list[str]':
"""Process CSV data. Args: data: CSV data. Returns: Enumeration fields."""
<|body_0|>
def context(self, data: 'list[str]') -> 'str':
"""Generate constant context. Args: data: CSV data... | stack_v2_sparse_classes_36k_train_029220 | 6,978 | permissive | [
{
"docstring": "Process CSV data. Args: data: CSV data. Returns: Enumeration fields.",
"name": "process",
"signature": "def process(self, data: 'list[str]') -> 'list[str]'"
},
{
"docstring": "Generate constant context. Args: data: CSV data. Returns: Constant context.",
"name": "context",
... | 2 | stack_v2_sparse_classes_30k_train_001035 | Implement the Python class `Command` described below.
Class description:
FTP Command
Method signatures and docstrings:
- def process(self, data: 'list[str]') -> 'list[str]': Process CSV data. Args: data: CSV data. Returns: Enumeration fields.
- def context(self, data: 'list[str]') -> 'str': Generate constant context.... | Implement the Python class `Command` described below.
Class description:
FTP Command
Method signatures and docstrings:
- def process(self, data: 'list[str]') -> 'list[str]': Process CSV data. Args: data: CSV data. Returns: Enumeration fields.
- def context(self, data: 'list[str]') -> 'str': Generate constant context.... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class Command:
"""FTP Command"""
def process(self, data: 'list[str]') -> 'list[str]':
"""Process CSV data. Args: data: CSV data. Returns: Enumeration fields."""
<|body_0|>
def context(self, data: 'list[str]') -> 'str':
"""Generate constant context. Args: data: CSV data... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Command:
"""FTP Command"""
def process(self, data: 'list[str]') -> 'list[str]':
"""Process CSV data. Args: data: CSV data. Returns: Enumeration fields."""
reader = csv.reader(data)
next(reader)
enum = collections.OrderedDict()
for item in reader:
cmmd =... | the_stack_v2_python_sparse | pcapkit/vendor/ftp/command.py | JarryShaw/PyPCAPKit | train | 204 |
fa3e6118e72ddd0ba60b2666a00127b077c3e9cd | [
"batch, length, dim = key.size()\nassert length <= wkv_kernel.context_size, f'Cannot process key of length {length} while context_size is ({wkv_kernel.context_size}). Limit should be increased.'\nassert batch * dim % min(dim, 32) == 0, f'batch size ({batch}) by dimension ({dim}) should be a multiple of {min(dim, 32... | <|body_start_0|>
batch, length, dim = key.size()
assert length <= wkv_kernel.context_size, f'Cannot process key of length {length} while context_size is ({wkv_kernel.context_size}). Limit should be increased.'
assert batch * dim % min(dim, 32) == 0, f'batch size ({batch}) by dimension ({dim}) sh... | WKVLinearAttention function definition. | WKVLinearAttention | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WKVLinearAttention:
"""WKVLinearAttention function definition."""
def forward(ctx, time_decay: torch.Tensor, time_first: torch.Tensor, key: torch.Tensor, value: torch.tensor) -> torch.Tensor:
"""WKVLinearAttention function forward pass. Args: time_decay: Channel-wise time decay vecto... | stack_v2_sparse_classes_36k_train_029221 | 11,396 | permissive | [
{
"docstring": "WKVLinearAttention function forward pass. Args: time_decay: Channel-wise time decay vector. (D_att) time_first: Channel-wise time first vector. (D_att) key: Key tensor. (B, U, D_att) value: Value tensor. (B, U, D_att) Returns: out: Weighted Key-Value tensor. (B, U, D_att)",
"name": "forward"... | 2 | null | Implement the Python class `WKVLinearAttention` described below.
Class description:
WKVLinearAttention function definition.
Method signatures and docstrings:
- def forward(ctx, time_decay: torch.Tensor, time_first: torch.Tensor, key: torch.Tensor, value: torch.tensor) -> torch.Tensor: WKVLinearAttention function forw... | Implement the Python class `WKVLinearAttention` described below.
Class description:
WKVLinearAttention function definition.
Method signatures and docstrings:
- def forward(ctx, time_decay: torch.Tensor, time_first: torch.Tensor, key: torch.Tensor, value: torch.tensor) -> torch.Tensor: WKVLinearAttention function forw... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class WKVLinearAttention:
"""WKVLinearAttention function definition."""
def forward(ctx, time_decay: torch.Tensor, time_first: torch.Tensor, key: torch.Tensor, value: torch.tensor) -> torch.Tensor:
"""WKVLinearAttention function forward pass. Args: time_decay: Channel-wise time decay vecto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WKVLinearAttention:
"""WKVLinearAttention function definition."""
def forward(ctx, time_decay: torch.Tensor, time_first: torch.Tensor, key: torch.Tensor, value: torch.tensor) -> torch.Tensor:
"""WKVLinearAttention function forward pass. Args: time_decay: Channel-wise time decay vector. (D_att) ti... | the_stack_v2_python_sparse | espnet2/asr_transducer/decoder/modules/rwkv/attention.py | espnet/espnet | train | 7,242 |
f1c0ad746fccb04199952c4bee8fde4fafa792a4 | [
"self.err = None\nself.out = None\nself.outFile = f'{path.dirname(argv[0])}/.outLogger.txt'\nself.errFile = f'{path.dirname(argv[0])}/.errLogger.txt'",
"if not path.exists(self.outFile):\n open(self.outFile, 'w+').close()\nif not path.exists(self.errFile):\n open(self.errFile, 'w+').close()\ncurrentTime = d... | <|body_start_0|>
self.err = None
self.out = None
self.outFile = f'{path.dirname(argv[0])}/.outLogger.txt'
self.errFile = f'{path.dirname(argv[0])}/.errLogger.txt'
<|end_body_0|>
<|body_start_1|>
if not path.exists(self.outFile):
open(self.outFile, 'w+').close()
... | A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save the for stderr for this program. ... | logger | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class logger:
"""A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save... | stack_v2_sparse_classes_36k_train_029222 | 2,097 | permissive | [
{
"docstring": "The constructor for the logger class, sets up the needed variables.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Start redirecting all stdout and stderr to logger files for each.",
"name": "open",
"signature": "def open(self)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_000579 | Implement the Python class `logger` described below.
Class description:
A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. err... | Implement the Python class `logger` described below.
Class description:
A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. err... | e65f5aa64919649690059da37f7bd608b823ca6a | <|skeleton|>
class logger:
"""A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class logger:
"""A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save the for stde... | the_stack_v2_python_sparse | logger/loggerClass.py | GingerNinja2962/wtc-lms-GUI | train | 2 |
454383a4bfdd6c9891e8f6068757f54657e817cf | [
"self.facility = self.request.user.profile.instrument.facility\nself.instrument = self.request.user.profile.instrument\nself.catalog = Catalog(facility=self.facility.name, technique=self.instrument.technique, instrument=self.instrument.catalog_name, request=self.request)\nreturn super(CatalogMixin, self).dispatch(r... | <|body_start_0|>
self.facility = self.request.user.profile.instrument.facility
self.instrument = self.request.user.profile.instrument
self.catalog = Catalog(facility=self.facility.name, technique=self.instrument.technique, instrument=self.instrument.catalog_name, request=self.request)
re... | Context enhancer for the Catalog | CatalogMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CatalogMixin:
"""Context enhancer for the Catalog"""
def dispatch(self, request, *args, **kwargs):
"""First method being called Usefull for debug and set member variables"""
<|body_0|>
def get_template_names(self):
"""Let's override this function. Returns a list ... | stack_v2_sparse_classes_36k_train_029223 | 9,842 | no_license | [
{
"docstring": "First method being called Usefull for debug and set member variables",
"name": "dispatch",
"signature": "def dispatch(self, request, *args, **kwargs)"
},
{
"docstring": "Let's override this function. Returns a list of priority templates to render. From specific to general. facili... | 2 | stack_v2_sparse_classes_30k_train_017911 | Implement the Python class `CatalogMixin` described below.
Class description:
Context enhancer for the Catalog
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): First method being called Usefull for debug and set member variables
- def get_template_names(self): Let's override this func... | Implement the Python class `CatalogMixin` described below.
Class description:
Context enhancer for the Catalog
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): First method being called Usefull for debug and set member variables
- def get_template_names(self): Let's override this func... | 507ff81617abf583edd4ef4858985daefc0afcbe | <|skeleton|>
class CatalogMixin:
"""Context enhancer for the Catalog"""
def dispatch(self, request, *args, **kwargs):
"""First method being called Usefull for debug and set member variables"""
<|body_0|>
def get_template_names(self):
"""Let's override this function. Returns a list ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CatalogMixin:
"""Context enhancer for the Catalog"""
def dispatch(self, request, *args, **kwargs):
"""First method being called Usefull for debug and set member variables"""
self.facility = self.request.user.profile.instrument.facility
self.instrument = self.request.user.profile.i... | the_stack_v2_python_sparse | src/server/apps/catalog/views.py | bidochon/WebReduction | train | 0 |
98060b4873157f332869b13137b4263e473d0e4e | [
"self.logger = logger\nself._loop = loop\nself._in_path = in_path\nself._out_path = out_path\nself._pipe = None\nself.last_exception: Optional[Exception] = None",
"if self._loop is None:\n self._loop = asyncio.get_event_loop()\nself._pipe = PosixNamedPipeProtocol(self._in_path, self._out_path, logger=self.logg... | <|body_start_0|>
self.logger = logger
self._loop = loop
self._in_path = in_path
self._out_path = out_path
self._pipe = None
self.last_exception: Optional[Exception] = None
<|end_body_0|>
<|body_start_1|>
if self._loop is None:
self._loop = asyncio.get... | Interprocess communication channel client using Posix named pipes. | PosixNamedPipeChannelClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PosixNamedPipeChannelClient:
"""Interprocess communication channel client using Posix named pipes."""
def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None:
"""Initialize a posix named pipe communicatio... | stack_v2_sparse_classes_36k_train_029224 | 23,051 | permissive | [
{
"docstring": "Initialize a posix named pipe communication channel client. :param in_path: rendezvous point for incoming data :param out_path: rendezvous point for outgoing data :param logger: the logger :param loop: the event loop",
"name": "__init__",
"signature": "def __init__(self, in_path: str, ou... | 5 | null | Implement the Python class `PosixNamedPipeChannelClient` described below.
Class description:
Interprocess communication channel client using Posix named pipes.
Method signatures and docstrings:
- def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=... | Implement the Python class `PosixNamedPipeChannelClient` described below.
Class description:
Interprocess communication channel client using Posix named pipes.
Method signatures and docstrings:
- def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=... | bec49adaeba661d8d0f03ac9935dc89f39d95a0d | <|skeleton|>
class PosixNamedPipeChannelClient:
"""Interprocess communication channel client using Posix named pipes."""
def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None:
"""Initialize a posix named pipe communicatio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PosixNamedPipeChannelClient:
"""Interprocess communication channel client using Posix named pipes."""
def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None:
"""Initialize a posix named pipe communication channel cli... | the_stack_v2_python_sparse | aea/helpers/pipe.py | fetchai/agents-aea | train | 192 |
30dc421b2c9a6259ad94cd434a40969e96d7e9d4 | [
"super(Link, self).__init__(parent)\npen = QtGui.QPen()\npen.setWidth(2)\npen.setBrush(RED_2)\npen.setCapStyle(QtCore.Qt.RoundCap)\npen.setJoinStyle(QtCore.Qt.RoundJoin)\nself.setPen(pen)\npath = QtGui.QPainterPath()\npath.moveTo(src_position.x(), src_position.y())\npath.cubicTo(src_position.x() + 100, src_position... | <|body_start_0|>
super(Link, self).__init__(parent)
pen = QtGui.QPen()
pen.setWidth(2)
pen.setBrush(RED_2)
pen.setCapStyle(QtCore.Qt.RoundCap)
pen.setJoinStyle(QtCore.Qt.RoundJoin)
self.setPen(pen)
path = QtGui.QPainterPath()
path.moveTo(src_positi... | A link between boxes. | Link | [
"LicenseRef-scancode-cecill-b-en"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Link:
"""A link between boxes."""
def __init__(self, src_position, dest_position, parent=None):
"""Initilaize the Link class. Parameters ---------- src_position: QPointF (mandatory) the source control glyph position. dest_position: QPointF (mandatory) the destination control glyph po... | stack_v2_sparse_classes_36k_train_029225 | 30,653 | permissive | [
{
"docstring": "Initilaize the Link class. Parameters ---------- src_position: QPointF (mandatory) the source control glyph position. dest_position: QPointF (mandatory) the destination control glyph position.",
"name": "__init__",
"signature": "def __init__(self, src_position, dest_position, parent=None... | 2 | null | Implement the Python class `Link` described below.
Class description:
A link between boxes.
Method signatures and docstrings:
- def __init__(self, src_position, dest_position, parent=None): Initilaize the Link class. Parameters ---------- src_position: QPointF (mandatory) the source control glyph position. dest_posit... | Implement the Python class `Link` described below.
Class description:
A link between boxes.
Method signatures and docstrings:
- def __init__(self, src_position, dest_position, parent=None): Initilaize the Link class. Parameters ---------- src_position: QPointF (mandatory) the source control glyph position. dest_posit... | 7a807ed690929563ce36086eaf0998d0e8856aea | <|skeleton|>
class Link:
"""A link between boxes."""
def __init__(self, src_position, dest_position, parent=None):
"""Initilaize the Link class. Parameters ---------- src_position: QPointF (mandatory) the source control glyph position. dest_position: QPointF (mandatory) the destination control glyph po... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Link:
"""A link between boxes."""
def __init__(self, src_position, dest_position, parent=None):
"""Initilaize the Link class. Parameters ---------- src_position: QPointF (mandatory) the source control glyph position. dest_position: QPointF (mandatory) the destination control glyph position."""
... | the_stack_v2_python_sparse | pynet/plotting/network.py | Duplums/pynet | train | 0 |
b67b9cdf635244fde63b4941e2483f4e17343034 | [
"if not root:\n return 0\nqueue, depth = ([], 1)\nqueue.append(root)\nwhile queue:\n size = len(queue)\n for _ in range(size):\n node = queue.pop(0)\n if not node.children and (not queue):\n return depth\n for child in node.children:\n queue.append(child)\n dep... | <|body_start_0|>
if not root:
return 0
queue, depth = ([], 1)
queue.append(root)
while queue:
size = len(queue)
for _ in range(size):
node = queue.pop(0)
if not node.children and (not queue):
return d... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth(self, root: 'Node') -> int:
"""BFS"""
<|body_0|>
def maxDepth_1(self, root: 'Node') -> int:
"""DFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return 0
queue, depth = ([], 1)
queue.... | stack_v2_sparse_classes_36k_train_029226 | 1,389 | no_license | [
{
"docstring": "BFS",
"name": "maxDepth",
"signature": "def maxDepth(self, root: 'Node') -> int"
},
{
"docstring": "DFS",
"name": "maxDepth_1",
"signature": "def maxDepth_1(self, root: 'Node') -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root: 'Node') -> int: BFS
- def maxDepth_1(self, root: 'Node') -> int: DFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root: 'Node') -> int: BFS
- def maxDepth_1(self, root: 'Node') -> int: DFS
<|skeleton|>
class Solution:
def maxDepth(self, root: 'Node') -> int:
... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def maxDepth(self, root: 'Node') -> int:
"""BFS"""
<|body_0|>
def maxDepth_1(self, root: 'Node') -> int:
"""DFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDepth(self, root: 'Node') -> int:
"""BFS"""
if not root:
return 0
queue, depth = ([], 1)
queue.append(root)
while queue:
size = len(queue)
for _ in range(size):
node = queue.pop(0)
if n... | the_stack_v2_python_sparse | algorithm/leetcode/bfs/03-N叉树的最大深度.py | lxconfig/UbuntuCode_bak | train | 0 | |
49fe47121f028e4be1a53c90180b0968181bd78a | [
"self.p0 = 0\nself.p1 = 0\nself.st = 0\nself.minVectors = 5\nself.maxCorners = 750\nself.mask_no_sun = self.__getMask(mask)\nself.color = np.random.randint(0, 255, (self.maxCorners, 3))\nself.feature_params = dict(minDistance=20, blockSize=30)\nself.qualityLevel = 0.07\nself.lk_params = dict(winSize=(50, 50), maxLe... | <|body_start_0|>
self.p0 = 0
self.p1 = 0
self.st = 0
self.minVectors = 5
self.maxCorners = 750
self.mask_no_sun = self.__getMask(mask)
self.color = np.random.randint(0, 255, (self.maxCorners, 3))
self.feature_params = dict(minDistance=20, blockSize=30)
... | optflow | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class optflow:
def __init__(self, mask):
"""The initialisation of the optical flow algorithm. Here settings are made."""
<|body_0|>
def __getMask(self, mask):
"""Use image mask as basis for optical flow masking"""
<|body_1|>
def getCorners(self, img, fmask='')... | stack_v2_sparse_classes_36k_train_029227 | 8,562 | permissive | [
{
"docstring": "The initialisation of the optical flow algorithm. Here settings are made.",
"name": "__init__",
"signature": "def __init__(self, mask)"
},
{
"docstring": "Use image mask as basis for optical flow masking",
"name": "__getMask",
"signature": "def __getMask(self, mask)"
},... | 5 | stack_v2_sparse_classes_30k_train_011259 | Implement the Python class `optflow` described below.
Class description:
Implement the optflow class.
Method signatures and docstrings:
- def __init__(self, mask): The initialisation of the optical flow algorithm. Here settings are made.
- def __getMask(self, mask): Use image mask as basis for optical flow masking
- ... | Implement the Python class `optflow` described below.
Class description:
Implement the optflow class.
Method signatures and docstrings:
- def __init__(self, mask): The initialisation of the optical flow algorithm. Here settings are made.
- def __getMask(self, mask): Use image mask as basis for optical flow masking
- ... | 78a0a35139f51f56a8c32d75908d0203dfb19eea | <|skeleton|>
class optflow:
def __init__(self, mask):
"""The initialisation of the optical flow algorithm. Here settings are made."""
<|body_0|>
def __getMask(self, mask):
"""Use image mask as basis for optical flow masking"""
<|body_1|>
def getCorners(self, img, fmask='')... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class optflow:
def __init__(self, mask):
"""The initialisation of the optical flow algorithm. Here settings are made."""
self.p0 = 0
self.p1 = 0
self.st = 0
self.minVectors = 5
self.maxCorners = 750
self.mask_no_sun = self.__getMask(mask)
self.color = ... | the_stack_v2_python_sparse | skysol/lib/optical_flow.py | shishir36/SkySol | train | 0 | |
3fcc0b2735541cbdcfcf84c9e944b05d218b696c | [
"genus = Integer(genus)\nif not genus >= 0:\n raise ValueError('genus must be positive')\nself._genus = genus\nnintervals = Integer(nintervals)\nif not nintervals > 1:\n raise ValueError('number of intervals must be at least 2')\nself._nintervals = nintervals\nif marked_separatrix is None:\n marked_separat... | <|body_start_0|>
genus = Integer(genus)
if not genus >= 0:
raise ValueError('genus must be positive')
self._genus = genus
nintervals = Integer(nintervals)
if not nintervals > 1:
raise ValueError('number of intervals must be at least 2')
self._ninte... | Abelian strata of prescribed genus and number of intervals. INPUT: - ``genus`` - integer: the genus of the surfaces - ``nintervals`` - integer: the number of intervals - ``marked_separatrix`` - 'no', 'in' or 'out' | AbelianStrata_gd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbelianStrata_gd:
"""Abelian strata of prescribed genus and number of intervals. INPUT: - ``genus`` - integer: the genus of the surfaces - ``nintervals`` - integer: the number of intervals - ``marked_separatrix`` - 'no', 'in' or 'out'"""
def __init__(self, genus=None, nintervals=None, marked... | stack_v2_sparse_classes_36k_train_029228 | 49,724 | no_license | [
{
"docstring": "TESTS:: sage: s = AbelianStrata(genus=4,nintervals=10) sage: s == loads(dumps(s)) True sage: AbelianStrata(genus=-1) Traceback (most recent call last): ... ValueError: genus must be positive sage: AbelianStrata(genus=1, nintervals=1) Traceback (most recent call last): ... ValueError: number of i... | 3 | null | Implement the Python class `AbelianStrata_gd` described below.
Class description:
Abelian strata of prescribed genus and number of intervals. INPUT: - ``genus`` - integer: the genus of the surfaces - ``nintervals`` - integer: the number of intervals - ``marked_separatrix`` - 'no', 'in' or 'out'
Method signatures and ... | Implement the Python class `AbelianStrata_gd` described below.
Class description:
Abelian strata of prescribed genus and number of intervals. INPUT: - ``genus`` - integer: the genus of the surfaces - ``nintervals`` - integer: the number of intervals - ``marked_separatrix`` - 'no', 'in' or 'out'
Method signatures and ... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class AbelianStrata_gd:
"""Abelian strata of prescribed genus and number of intervals. INPUT: - ``genus`` - integer: the genus of the surfaces - ``nintervals`` - integer: the number of intervals - ``marked_separatrix`` - 'no', 'in' or 'out'"""
def __init__(self, genus=None, nintervals=None, marked... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AbelianStrata_gd:
"""Abelian strata of prescribed genus and number of intervals. INPUT: - ``genus`` - integer: the genus of the surfaces - ``nintervals`` - integer: the number of intervals - ``marked_separatrix`` - 'no', 'in' or 'out'"""
def __init__(self, genus=None, nintervals=None, marked_separatrix=N... | the_stack_v2_python_sparse | sage/src/sage/dynamics/flat_surfaces/strata.py | bopopescu/geosci | train | 0 |
4e839ba3808743ba8c8785079521bbfa02a0e34f | [
"data = {}\nid = request.GET.get('id', None)\nindicator_factor_id = request.GET.get('indicator_factor_id', None)\nif id is not None:\n data['id'] = id\nif indicator_factor_id is not None:\n data['indicator_factor_id'] = indicator_factor_id\nbasis_templates = BasisTemplate.objects.filter(**data)\nserializer = ... | <|body_start_0|>
data = {}
id = request.GET.get('id', None)
indicator_factor_id = request.GET.get('indicator_factor_id', None)
if id is not None:
data['id'] = id
if indicator_factor_id is not None:
data['indicator_factor_id'] = indicator_factor_id
... | 评价依据模版view | BasisTemplates | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasisTemplates:
"""评价依据模版view"""
def get(self, request):
"""查询评价依据模版"""
<|body_0|>
def put(self, request):
"""修改评价依据模版"""
<|body_1|>
def post(self, request):
"""增加评价依据模版"""
<|body_2|>
def delete(self, request):
"""删除评价依据模... | stack_v2_sparse_classes_36k_train_029229 | 15,061 | permissive | [
{
"docstring": "查询评价依据模版",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "修改评价依据模版",
"name": "put",
"signature": "def put(self, request)"
},
{
"docstring": "增加评价依据模版",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring"... | 4 | stack_v2_sparse_classes_30k_train_008574 | Implement the Python class `BasisTemplates` described below.
Class description:
评价依据模版view
Method signatures and docstrings:
- def get(self, request): 查询评价依据模版
- def put(self, request): 修改评价依据模版
- def post(self, request): 增加评价依据模版
- def delete(self, request): 删除评价依据模版 | Implement the Python class `BasisTemplates` described below.
Class description:
评价依据模版view
Method signatures and docstrings:
- def get(self, request): 查询评价依据模版
- def put(self, request): 修改评价依据模版
- def post(self, request): 增加评价依据模版
- def delete(self, request): 删除评价依据模版
<|skeleton|>
class BasisTemplates:
"""评价依据模版... | 7aaa1be773718de1beb3ce0080edca7c4114b7ad | <|skeleton|>
class BasisTemplates:
"""评价依据模版view"""
def get(self, request):
"""查询评价依据模版"""
<|body_0|>
def put(self, request):
"""修改评价依据模版"""
<|body_1|>
def post(self, request):
"""增加评价依据模版"""
<|body_2|>
def delete(self, request):
"""删除评价依据模... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasisTemplates:
"""评价依据模版view"""
def get(self, request):
"""查询评价依据模版"""
data = {}
id = request.GET.get('id', None)
indicator_factor_id = request.GET.get('indicator_factor_id', None)
if id is not None:
data['id'] = id
if indicator_factor_id is no... | the_stack_v2_python_sparse | plan/views.py | MIXISAMA/MIS-backend | train | 0 |
b42b247717a1e8269b2c66a0e45bc6e38f37392b | [
"updated = Path('fangraphs/updated.txt')\nif not (updated.exists() and updated.is_file()):\n LOGGER.info('last update file does not exist, creating it now')\n f = updated.open('w+', encoding='UTF-8')\n f.close()\nreturn updated",
"f = FangraphsMetrics.last_update_file()\ntext = f.read_text(encoding='UTF-... | <|body_start_0|>
updated = Path('fangraphs/updated.txt')
if not (updated.exists() and updated.is_file()):
LOGGER.info('last update file does not exist, creating it now')
f = updated.open('w+', encoding='UTF-8')
f.close()
return updated
<|end_body_0|>
<|body_s... | FangraphsMetrics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FangraphsMetrics:
def last_update_file():
"""The Path to the file that stores the last-updated times for the Fangraphs projections. Each line in this file is a time that the projections were updated, in standard format (as seen when printing a datetime object) :return Path: the path to t... | stack_v2_sparse_classes_36k_train_029230 | 1,692 | no_license | [
{
"docstring": "The Path to the file that stores the last-updated times for the Fangraphs projections. Each line in this file is a time that the projections were updated, in standard format (as seen when printing a datetime object) :return Path: the path to the last-updated metrics file",
"name": "last_upda... | 3 | null | Implement the Python class `FangraphsMetrics` described below.
Class description:
Implement the FangraphsMetrics class.
Method signatures and docstrings:
- def last_update_file(): The Path to the file that stores the last-updated times for the Fangraphs projections. Each line in this file is a time that the projectio... | Implement the Python class `FangraphsMetrics` described below.
Class description:
Implement the FangraphsMetrics class.
Method signatures and docstrings:
- def last_update_file(): The Path to the file that stores the last-updated times for the Fangraphs projections. Each line in this file is a time that the projectio... | 97456b315824f50b56efd1ab697e6c676f57443c | <|skeleton|>
class FangraphsMetrics:
def last_update_file():
"""The Path to the file that stores the last-updated times for the Fangraphs projections. Each line in this file is a time that the projections were updated, in standard format (as seen when printing a datetime object) :return Path: the path to t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FangraphsMetrics:
def last_update_file():
"""The Path to the file that stores the last-updated times for the Fangraphs projections. Each line in this file is a time that the projections were updated, in standard format (as seen when printing a datetime object) :return Path: the path to the last-update... | the_stack_v2_python_sparse | fangraphs/metrics.py | zwalsh/fantasy-baseball | train | 2 | |
2056a904b6abb09fab0199dd06001d5b73294760 | [
"time_dict = {u'开始日期': u'2019-12-16', u'结束日期': u'2020-12-30'}\nself.open_role_list()\nself.click_button_for_one(u'展开')\nrole_name = self.get_table_cell_text(1, 2)\ncreate_person = self.get_table_cell_text(1, 6)\ninfo_dict = {u'请输入创建人': create_person}\nchoose_dict = {u'请选择用户角色': role_name, u'请选择角色状态': u'启用'}\nself.s... | <|body_start_0|>
time_dict = {u'开始日期': u'2019-12-16', u'结束日期': u'2020-12-30'}
self.open_role_list()
self.click_button_for_one(u'展开')
role_name = self.get_table_cell_text(1, 2)
create_person = self.get_table_cell_text(1, 6)
info_dict = {u'请输入创建人': create_person}
ch... | 角色管理-角色列表测试 | RoleListTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleListTest:
"""角色管理-角色列表测试"""
def test_role_manage_search(self):
"""角色管理查询"""
<|body_0|>
def test_role_manage_add(self):
"""角色管理新增"""
<|body_1|>
def test_role_status_start(self):
"""角色状态-启用-冻结"""
<|body_2|>
def test_role_status... | stack_v2_sparse_classes_36k_train_029231 | 8,001 | no_license | [
{
"docstring": "角色管理查询",
"name": "test_role_manage_search",
"signature": "def test_role_manage_search(self)"
},
{
"docstring": "角色管理新增",
"name": "test_role_manage_add",
"signature": "def test_role_manage_add(self)"
},
{
"docstring": "角色状态-启用-冻结",
"name": "test_role_status_sta... | 6 | null | Implement the Python class `RoleListTest` described below.
Class description:
角色管理-角色列表测试
Method signatures and docstrings:
- def test_role_manage_search(self): 角色管理查询
- def test_role_manage_add(self): 角色管理新增
- def test_role_status_start(self): 角色状态-启用-冻结
- def test_role_status_cancel(self): 角色状态注销
- def test_role_pe... | Implement the Python class `RoleListTest` described below.
Class description:
角色管理-角色列表测试
Method signatures and docstrings:
- def test_role_manage_search(self): 角色管理查询
- def test_role_manage_add(self): 角色管理新增
- def test_role_status_start(self): 角色状态-启用-冻结
- def test_role_status_cancel(self): 角色状态注销
- def test_role_pe... | dcae68955b2857bbfe411145432865c57561c9ef | <|skeleton|>
class RoleListTest:
"""角色管理-角色列表测试"""
def test_role_manage_search(self):
"""角色管理查询"""
<|body_0|>
def test_role_manage_add(self):
"""角色管理新增"""
<|body_1|>
def test_role_status_start(self):
"""角色状态-启用-冻结"""
<|body_2|>
def test_role_status... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoleListTest:
"""角色管理-角色列表测试"""
def test_role_manage_search(self):
"""角色管理查询"""
time_dict = {u'开始日期': u'2019-12-16', u'结束日期': u'2020-12-30'}
self.open_role_list()
self.click_button_for_one(u'展开')
role_name = self.get_table_cell_text(1, 2)
create_person = se... | the_stack_v2_python_sparse | genlot_vlt2/cases/BusinessOperation/permission_maintain/role_manage_test.py | bbwdi/auto | train | 1 |
7dc602b5f98ff2eb74207f5c637ee40fc5787616 | [
"super(W2VCharLSTM, self).__init__()\nself.word_hidden_dim = word_hidden_dim\nself.char_hidden_dim = char_hidden_dim\nself.char_embedding_dim = char_embedding_dim\nself.w2v_model = ner_data_obj.w2v_model\nself.char_embeddings = nn.Embedding(len(ner_data_obj.char_set), char_embedding_dim)\nself.word_lstm = nn.LSTM(s... | <|body_start_0|>
super(W2VCharLSTM, self).__init__()
self.word_hidden_dim = word_hidden_dim
self.char_hidden_dim = char_hidden_dim
self.char_embedding_dim = char_embedding_dim
self.w2v_model = ner_data_obj.w2v_model
self.char_embeddings = nn.Embedding(len(ner_data_obj.cha... | W2VCharLSTM | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class W2VCharLSTM:
def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj):
"""Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality o... | stack_v2_sparse_classes_36k_train_029232 | 15,011 | permissive | [
{
"docstring": "Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality of the hidden2tag linear layer. char_hidden_dim (int, required): Dimensionality of the hidden layer in the char L... | 4 | stack_v2_sparse_classes_30k_train_016315 | Implement the Python class `W2VCharLSTM` described below.
Class description:
Implement the W2VCharLSTM class.
Method signatures and docstrings:
- def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj): Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int... | Implement the Python class `W2VCharLSTM` described below.
Class description:
Implement the W2VCharLSTM class.
Method signatures and docstrings:
- def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj): Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int... | 55b5b329395da79047e9083232101d15af9f2c49 | <|skeleton|>
class W2VCharLSTM:
def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj):
"""Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class W2VCharLSTM:
def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj):
"""Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality of the hidden2t... | the_stack_v2_python_sparse | NER/arch_blocks.py | rnaimehaom/UW-Molecular-Data-Mining | train | 0 | |
2316e308729ea728882c3d29a2257666cf8bd79e | [
"logger.info('Kallisto Indexer')\nTool.__init__(self)\nif configuration is None:\n configuration = {}\nself.configuration.update(configuration)",
"command_line = 'kallisto index -i ' + cdna_idx_file + ' ' + cdna_file_loc\nlogger.info('command : ' + command_line)\ntry:\n args = shlex.split(command_line)\n ... | <|body_start_0|>
logger.info('Kallisto Indexer')
Tool.__init__(self)
if configuration is None:
configuration = {}
self.configuration.update(configuration)
<|end_body_0|>
<|body_start_1|>
command_line = 'kallisto index -i ' + cdna_idx_file + ' ' + cdna_file_loc
... | Tool for running indexers over a genome FASTA file | kallistoIndexerTool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class kallistoIndexerTool:
"""Tool for running indexers over a genome FASTA file"""
def __init__(self, configuration=None):
"""Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be c... | stack_v2_sparse_classes_36k_train_029233 | 4,323 | permissive | [
{
"docstring": "Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool.",
"name": "__init__",
"signature": "def __init__(self, configuration=None)"
},... | 3 | stack_v2_sparse_classes_30k_val_000006 | Implement the Python class `kallistoIndexerTool` described below.
Class description:
Tool for running indexers over a genome FASTA file
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary contai... | Implement the Python class `kallistoIndexerTool` described below.
Class description:
Tool for running indexers over a genome FASTA file
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary contai... | 50c7115c0c1a6af48dc34f275e469d1b9eb02999 | <|skeleton|>
class kallistoIndexerTool:
"""Tool for running indexers over a genome FASTA file"""
def __init__(self, configuration=None):
"""Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class kallistoIndexerTool:
"""Tool for running indexers over a genome FASTA file"""
def __init__(self, configuration=None):
"""Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, w... | the_stack_v2_python_sparse | tool/kallisto_indexer.py | Multiscale-Genomics/mg-process-fastq | train | 2 |
0a46b07d6f1f6dc98c41ac3e0368bc092a5178fb | [
"nums = sorted(nums)\nans = []\ni = 0\nwhile i < len(nums) - 1:\n if nums[i] == nums[i + 1]:\n ans.append(nums[i])\n i += 2\n else:\n i += 1\nreturn ans",
"ans = []\nelem2count = {}\nfor num in nums:\n elem2count[num] = elem2count.get(num, 0) + 1\n if elem2count[num] == 2:\n ... | <|body_start_0|>
nums = sorted(nums)
ans = []
i = 0
while i < len(nums) - 1:
if nums[i] == nums[i + 1]:
ans.append(nums[i])
i += 2
else:
i += 1
return ans
<|end_body_0|>
<|body_start_1|>
ans = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDuplicates(self, nums):
"""Sort the array then linear scan. Time: O(NlogN) :type nums: List[int] :rtype: List[int]"""
<|body_0|>
def findDuplicates2(self, nums):
"""Map element to its count and pick those with count of 2. Time: O(N) Space: O(N) :typ... | stack_v2_sparse_classes_36k_train_029234 | 1,942 | no_license | [
{
"docstring": "Sort the array then linear scan. Time: O(NlogN) :type nums: List[int] :rtype: List[int]",
"name": "findDuplicates",
"signature": "def findDuplicates(self, nums)"
},
{
"docstring": "Map element to its count and pick those with count of 2. Time: O(N) Space: O(N) :type nums: List[in... | 3 | stack_v2_sparse_classes_30k_train_009619 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicates(self, nums): Sort the array then linear scan. Time: O(NlogN) :type nums: List[int] :rtype: List[int]
- def findDuplicates2(self, nums): Map element to its coun... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicates(self, nums): Sort the array then linear scan. Time: O(NlogN) :type nums: List[int] :rtype: List[int]
- def findDuplicates2(self, nums): Map element to its coun... | 143aa25f92f3827aa379f29c67a9b7ec3757fef9 | <|skeleton|>
class Solution:
def findDuplicates(self, nums):
"""Sort the array then linear scan. Time: O(NlogN) :type nums: List[int] :rtype: List[int]"""
<|body_0|>
def findDuplicates2(self, nums):
"""Map element to its count and pick those with count of 2. Time: O(N) Space: O(N) :typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findDuplicates(self, nums):
"""Sort the array then linear scan. Time: O(NlogN) :type nums: List[int] :rtype: List[int]"""
nums = sorted(nums)
ans = []
i = 0
while i < len(nums) - 1:
if nums[i] == nums[i + 1]:
ans.append(nums[i])... | the_stack_v2_python_sparse | py/leetcode_py/442.py | imsure/tech-interview-prep | train | 0 | |
0587f85731d6d9508413d738d15ba4be2b5b63e0 | [
"self.memo = collections.defaultdict(list)\nfor d in dictionary:\n if len(d) > 2:\n first = d[0]\n last = d[-1]\n num = len(d) - 2\n temp = first + str(num) + last\n if d not in self.memo[temp]:\n self.memo[temp].append(d)\n elif d not in self.memo[d]:\n se... | <|body_start_0|>
self.memo = collections.defaultdict(list)
for d in dictionary:
if len(d) > 2:
first = d[0]
last = d[-1]
num = len(d) - 2
temp = first + str(num) + last
if d not in self.memo[temp]:
... | ValidWordAbbr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
""":type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
""":type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.memo = collections.defaultdict(list)
f... | stack_v2_sparse_classes_36k_train_029235 | 1,166 | no_license | [
{
"docstring": ":type dictionary: List[str]",
"name": "__init__",
"signature": "def __init__(self, dictionary)"
},
{
"docstring": ":type word: str :rtype: bool",
"name": "isUnique",
"signature": "def isUnique(self, word)"
}
] | 2 | null | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): :type dictionary: List[str]
- def isUnique(self, word): :type word: str :rtype: bool | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): :type dictionary: List[str]
- def isUnique(self, word): :type word: str :rtype: bool
<|skeleton|>
class ValidWordAbbr:
def __init_... | d2e0fb4a55003d5c230fb8b2e13ac8b224b47a75 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
""":type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
""":type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidWordAbbr:
def __init__(self, dictionary):
""":type dictionary: List[str]"""
self.memo = collections.defaultdict(list)
for d in dictionary:
if len(d) > 2:
first = d[0]
last = d[-1]
num = len(d) - 2
temp = f... | the_stack_v2_python_sparse | 288-ValidWordAbbr.py | sunshinewxz/leetcode | train | 0 | |
5fe5ef359fc4a781858d7704b6f540e129da78f2 | [
"super().__init__()\nself.analysis = analysis\nself.model = model\nself.perturbation_model = perturbation_model\npaths = search.paths\nself.search = search.copy_with_paths(DirectoryPaths(name=paths.name + '[base]', path_prefix=paths.path_prefix))\nself.perturbed_search = search.copy_with_paths(DirectoryPaths(name=p... | <|body_start_0|>
super().__init__()
self.analysis = analysis
self.model = model
self.perturbation_model = perturbation_model
paths = search.paths
self.search = search.copy_with_paths(DirectoryPaths(name=paths.name + '[base]', path_prefix=paths.path_prefix))
self.p... | Job | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Job:
def __init__(self, analysis: Analysis, model: AbstractPriorModel, perturbation_model: AbstractPriorModel, search: NonLinearSearch):
"""Job to run non-linear searches comparing how well a model and a model with a perturbation fit the image. Parameters ---------- model A base model th... | stack_v2_sparse_classes_36k_train_029236 | 10,356 | permissive | [
{
"docstring": "Job to run non-linear searches comparing how well a model and a model with a perturbation fit the image. Parameters ---------- model A base model that fits the image without a perturbation perturbation_model A model of the perturbation which has been added to the underlying image analysis A clas... | 2 | stack_v2_sparse_classes_30k_train_015270 | Implement the Python class `Job` described below.
Class description:
Implement the Job class.
Method signatures and docstrings:
- def __init__(self, analysis: Analysis, model: AbstractPriorModel, perturbation_model: AbstractPriorModel, search: NonLinearSearch): Job to run non-linear searches comparing how well a mode... | Implement the Python class `Job` described below.
Class description:
Implement the Job class.
Method signatures and docstrings:
- def __init__(self, analysis: Analysis, model: AbstractPriorModel, perturbation_model: AbstractPriorModel, search: NonLinearSearch): Job to run non-linear searches comparing how well a mode... | 324007a6bbda32baf94f09918e0aef04fda0c7d0 | <|skeleton|>
class Job:
def __init__(self, analysis: Analysis, model: AbstractPriorModel, perturbation_model: AbstractPriorModel, search: NonLinearSearch):
"""Job to run non-linear searches comparing how well a model and a model with a perturbation fit the image. Parameters ---------- model A base model th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Job:
def __init__(self, analysis: Analysis, model: AbstractPriorModel, perturbation_model: AbstractPriorModel, search: NonLinearSearch):
"""Job to run non-linear searches comparing how well a model and a model with a perturbation fit the image. Parameters ---------- model A base model that fits the im... | the_stack_v2_python_sparse | autofit/non_linear/grid/sensitivity.py | philastrophist/PyAutoFit | train | 0 | |
5f84111f025ba8bf5a03552c32dc3d212c083361 | [
"self.url = kwargs.pop('url', DEFAULT_URL)\nself.method = kwargs.pop('method', DEFAULT_METHOD)\nself.body = kwargs.pop('body', DEFAULT_BODY)\nself.outputs = kwargs.pop('outputs', DEFAULT_OUTPUTS)\nself.decimals = kwargs.pop('decimals', DEFAULT_DECIMALS)\nself.use_http_server = kwargs.pop('use_http_server', DEFAULT_... | <|body_start_0|>
self.url = kwargs.pop('url', DEFAULT_URL)
self.method = kwargs.pop('method', DEFAULT_METHOD)
self.body = kwargs.pop('body', DEFAULT_BODY)
self.outputs = kwargs.pop('outputs', DEFAULT_OUTPUTS)
self.decimals = kwargs.pop('decimals', DEFAULT_DECIMALS)
self.u... | This class models the AdvancedDataRequest skill. | AdvancedDataRequestModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdvancedDataRequestModel:
"""This class models the AdvancedDataRequest skill."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize dialogues. :param kwargs: keyword arguments"""
<|body_0|>
def _validate_config(self) -> None:
"""Ensure the configuration set... | stack_v2_sparse_classes_36k_train_029237 | 3,195 | permissive | [
{
"docstring": "Initialize dialogues. :param kwargs: keyword arguments",
"name": "__init__",
"signature": "def __init__(self, **kwargs: Any) -> None"
},
{
"docstring": "Ensure the configuration settings are all valid.",
"name": "_validate_config",
"signature": "def _validate_config(self)... | 2 | null | Implement the Python class `AdvancedDataRequestModel` described below.
Class description:
This class models the AdvancedDataRequest skill.
Method signatures and docstrings:
- def __init__(self, **kwargs: Any) -> None: Initialize dialogues. :param kwargs: keyword arguments
- def _validate_config(self) -> None: Ensure ... | Implement the Python class `AdvancedDataRequestModel` described below.
Class description:
This class models the AdvancedDataRequest skill.
Method signatures and docstrings:
- def __init__(self, **kwargs: Any) -> None: Initialize dialogues. :param kwargs: keyword arguments
- def _validate_config(self) -> None: Ensure ... | bec49adaeba661d8d0f03ac9935dc89f39d95a0d | <|skeleton|>
class AdvancedDataRequestModel:
"""This class models the AdvancedDataRequest skill."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize dialogues. :param kwargs: keyword arguments"""
<|body_0|>
def _validate_config(self) -> None:
"""Ensure the configuration set... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdvancedDataRequestModel:
"""This class models the AdvancedDataRequest skill."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize dialogues. :param kwargs: keyword arguments"""
self.url = kwargs.pop('url', DEFAULT_URL)
self.method = kwargs.pop('method', DEFAULT_METHOD)
... | the_stack_v2_python_sparse | packages/fetchai/skills/advanced_data_request/models.py | fetchai/agents-aea | train | 192 |
a1de288b022ee14afe31d8e2879742af9fbc6dbd | [
"self.validate_parameters(orgnumber=orgnumber)\n_query_builder = Configuration.get_base_uri()\n_query_builder += '/information/signroles/rights'\n_query_parameters = {'orgnumber': orgnumber, 'countrycode': countrycode}\n_query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_parameters, C... | <|body_start_0|>
self.validate_parameters(orgnumber=orgnumber)
_query_builder = Configuration.get_base_uri()
_query_builder += '/information/signroles/rights'
_query_parameters = {'orgnumber': orgnumber, 'countrycode': countrycode}
_query_builder = APIHelper.append_url_with_query... | A Controller to access Endpoints in the idfy_rest_client API. | SignatureRolesCheckController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SignatureRolesCheckController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def get_rights(self, orgnumber, countrycode=None):
"""Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization.... | stack_v2_sparse_classes_36k_train_029238 | 6,412 | permissive | [
{
"docstring": "Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization. You will receive lists with names and date of birth for the persons allowed for signing / prokura. Args: orgnumber (string): TODO: type description here. Example: c... | 2 | stack_v2_sparse_classes_30k_train_016128 | Implement the Python class `SignatureRolesCheckController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def get_rights(self, orgnumber, countrycode=None): Does a GET request to /information/signroles/rights. Check which person(s)... | Implement the Python class `SignatureRolesCheckController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def get_rights(self, orgnumber, countrycode=None): Does a GET request to /information/signroles/rights. Check which person(s)... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class SignatureRolesCheckController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def get_rights(self, orgnumber, countrycode=None):
"""Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SignatureRolesCheckController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def get_rights(self, orgnumber, countrycode=None):
"""Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization. You will rec... | the_stack_v2_python_sparse | idfy_rest_client/controllers/signature_roles_check_controller.py | dealflowteam/Idfy | train | 0 |
e3224eec60d4161ee553dc6a6a8d5e4399bd5740 | [
"merge_lang_files(['de'])\ndest_file = path.join(ROOT, 'locale', 'de', 'firefox', 'fx.lang')\nwrite_mock.assert_called_once_with(dest_file, [u'Find out if your device is supported »'])",
"_append_to_lang_file('dude.lang', ['The Dude abides, man.'])\nmock_write = open_mock.return_value.__enter__.return_value... | <|body_start_0|>
merge_lang_files(['de'])
dest_file = path.join(ROOT, 'locale', 'de', 'firefox', 'fx.lang')
write_mock.assert_called_once_with(dest_file, [u'Find out if your device is supported »'])
<|end_body_0|>
<|body_start_1|>
_append_to_lang_file('dude.lang', ['The Dude abide... | Testl10nMerge | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Testl10nMerge:
def test_merge_lang_files(self, write_mock):
"""`merge_lang_files()` should see all strings, not skip the untranslated. Bug 861168."""
<|body_0|>
def test_append_to_lang_file(self, open_mock):
"""`_append_to_lang_file()` should append any new messages ... | stack_v2_sparse_classes_36k_train_029239 | 14,956 | no_license | [
{
"docstring": "`merge_lang_files()` should see all strings, not skip the untranslated. Bug 861168.",
"name": "test_merge_lang_files",
"signature": "def test_merge_lang_files(self, write_mock)"
},
{
"docstring": "`_append_to_lang_file()` should append any new messages to a lang file.",
"name... | 3 | null | Implement the Python class `Testl10nMerge` described below.
Class description:
Implement the Testl10nMerge class.
Method signatures and docstrings:
- def test_merge_lang_files(self, write_mock): `merge_lang_files()` should see all strings, not skip the untranslated. Bug 861168.
- def test_append_to_lang_file(self, op... | Implement the Python class `Testl10nMerge` described below.
Class description:
Implement the Testl10nMerge class.
Method signatures and docstrings:
- def test_merge_lang_files(self, write_mock): `merge_lang_files()` should see all strings, not skip the untranslated. Bug 861168.
- def test_append_to_lang_file(self, op... | 5fa3a818c3d41bd9c3eb25122e1d376c8910269c | <|skeleton|>
class Testl10nMerge:
def test_merge_lang_files(self, write_mock):
"""`merge_lang_files()` should see all strings, not skip the untranslated. Bug 861168."""
<|body_0|>
def test_append_to_lang_file(self, open_mock):
"""`_append_to_lang_file()` should append any new messages ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Testl10nMerge:
def test_merge_lang_files(self, write_mock):
"""`merge_lang_files()` should see all strings, not skip the untranslated. Bug 861168."""
merge_lang_files(['de'])
dest_file = path.join(ROOT, 'locale', 'de', 'firefox', 'fx.lang')
write_mock.assert_called_once_with(de... | the_stack_v2_python_sparse | ExtractFeatures/Data/thesantosh/test_commands.py | vivekaxl/LexisNexis | train | 9 | |
c00fe289eb2b02751a4404bf79361e1a4a5837bc | [
"try:\n sport = self.kwargs['sport']\nexcept KeyError:\n sport = 'nba'\nsite_sport_manager = sports.classes.SiteSportManager()\ninjury_serializer_class = site_sport_manager.get_tsxplayer_serializer_class(sport)\nreturn injury_serializer_class",
"sport = self.kwargs['sport']\nsite_sport_manager = sports.clas... | <|body_start_0|>
try:
sport = self.kwargs['sport']
except KeyError:
sport = 'nba'
site_sport_manager = sports.classes.SiteSportManager()
injury_serializer_class = site_sport_manager.get_tsxplayer_serializer_class(sport)
return injury_serializer_class
<|end... | gets the news for the sport | TsxPlayerNewsAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TsxPlayerNewsAPIView:
"""gets the news for the sport"""
def get_serializer_class(self):
"""override for having to set the self.serializer_class"""
<|body_0|>
def get_queryset(self):
"""Return a QuerySet from the LobbyContest model."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_029240 | 26,966 | no_license | [
{
"docstring": "override for having to set the self.serializer_class",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "Return a QuerySet from the LobbyContest model.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
}
] | 2 | null | Implement the Python class `TsxPlayerNewsAPIView` described below.
Class description:
gets the news for the sport
Method signatures and docstrings:
- def get_serializer_class(self): override for having to set the self.serializer_class
- def get_queryset(self): Return a QuerySet from the LobbyContest model. | Implement the Python class `TsxPlayerNewsAPIView` described below.
Class description:
gets the news for the sport
Method signatures and docstrings:
- def get_serializer_class(self): override for having to set the self.serializer_class
- def get_queryset(self): Return a QuerySet from the LobbyContest model.
<|skeleto... | 4796fa9d88b56f80def011e2b043ce595bfce8c4 | <|skeleton|>
class TsxPlayerNewsAPIView:
"""gets the news for the sport"""
def get_serializer_class(self):
"""override for having to set the self.serializer_class"""
<|body_0|>
def get_queryset(self):
"""Return a QuerySet from the LobbyContest model."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TsxPlayerNewsAPIView:
"""gets the news for the sport"""
def get_serializer_class(self):
"""override for having to set the self.serializer_class"""
try:
sport = self.kwargs['sport']
except KeyError:
sport = 'nba'
site_sport_manager = sports.classes.S... | the_stack_v2_python_sparse | sports/views.py | nakamotohideyoshi/draftboard-web | train | 0 |
020cd56919ca9b89d12dd56b05add8f5ef7ebd93 | [
"self.capabilities = capabilities\nself.concurrency = concurrency\nself.host_type = host_type\nself.hosts = hosts\nself.local_mount_dir = local_mount_dir\nself.mount_view = mount_view\nself.mounts = mounts\nself.preferred_control_nodes = preferred_control_nodes\nself.restore_args = restore_args\nself.restore_job_ar... | <|body_start_0|>
self.capabilities = capabilities
self.concurrency = concurrency
self.host_type = host_type
self.hosts = hosts
self.local_mount_dir = local_mount_dir
self.mount_view = mount_view
self.mounts = mounts
self.preferred_control_nodes = preferred... | Implementation of the 'UdaRecoverJobParams' model. TODO: type description here. Attributes: capabilities (UdaSourceCapabilities): Types of backups supported. concurrency (int): Number of parallel streams to use for the restore. host_type (int): The agent host environment type. hosts (list of string): List of hosts form... | UdaRecoverJobParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UdaRecoverJobParams:
"""Implementation of the 'UdaRecoverJobParams' model. TODO: type description here. Attributes: capabilities (UdaSourceCapabilities): Types of backups supported. concurrency (int): Number of parallel streams to use for the restore. host_type (int): The agent host environment t... | stack_v2_sparse_classes_36k_train_029241 | 7,887 | permissive | [
{
"docstring": "Constructor for the UdaRecoverJobParams class",
"name": "__init__",
"signature": "def __init__(self, capabilities=None, concurrency=None, host_type=None, hosts=None, local_mount_dir=None, mount_view=None, mounts=None, preferred_control_nodes=None, restore_args=None, restore_job_arguments... | 2 | null | Implement the Python class `UdaRecoverJobParams` described below.
Class description:
Implementation of the 'UdaRecoverJobParams' model. TODO: type description here. Attributes: capabilities (UdaSourceCapabilities): Types of backups supported. concurrency (int): Number of parallel streams to use for the restore. host_t... | Implement the Python class `UdaRecoverJobParams` described below.
Class description:
Implementation of the 'UdaRecoverJobParams' model. TODO: type description here. Attributes: capabilities (UdaSourceCapabilities): Types of backups supported. concurrency (int): Number of parallel streams to use for the restore. host_t... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class UdaRecoverJobParams:
"""Implementation of the 'UdaRecoverJobParams' model. TODO: type description here. Attributes: capabilities (UdaSourceCapabilities): Types of backups supported. concurrency (int): Number of parallel streams to use for the restore. host_type (int): The agent host environment t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UdaRecoverJobParams:
"""Implementation of the 'UdaRecoverJobParams' model. TODO: type description here. Attributes: capabilities (UdaSourceCapabilities): Types of backups supported. concurrency (int): Number of parallel streams to use for the restore. host_type (int): The agent host environment type. hosts (l... | the_stack_v2_python_sparse | cohesity_management_sdk/models/uda_recover_job_params.py | cohesity/management-sdk-python | train | 24 |
df2e47737ffcbf896fbc09c58a98daca8d385aba | [
"service_name = self.get_argument('service_name')\nlogger.info('Got a lookup request for service {0}'.format(service_name))\nif service_name in registry:\n service = registry[service_name]\n self.write(json.dumps({'data': {'name': service.name, 'url': service.url, 'port': service.port}}))\n self.set_header... | <|body_start_0|>
service_name = self.get_argument('service_name')
logger.info('Got a lookup request for service {0}'.format(service_name))
if service_name in registry:
service = registry[service_name]
self.write(json.dumps({'data': {'name': service.name, 'url': service.ur... | RegistryHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistryHandler:
def get(self):
"""get will be used by microservice clients/consumers to get the URL and port of a microservice :return:"""
<|body_0|>
def post(self):
"""post will be used by microservices to register themselves :return:"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_029242 | 5,135 | no_license | [
{
"docstring": "get will be used by microservice clients/consumers to get the URL and port of a microservice :return:",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "post will be used by microservices to register themselves :return:",
"name": "post",
"signature": "def po... | 2 | stack_v2_sparse_classes_30k_train_021662 | Implement the Python class `RegistryHandler` described below.
Class description:
Implement the RegistryHandler class.
Method signatures and docstrings:
- def get(self): get will be used by microservice clients/consumers to get the URL and port of a microservice :return:
- def post(self): post will be used by microser... | Implement the Python class `RegistryHandler` described below.
Class description:
Implement the RegistryHandler class.
Method signatures and docstrings:
- def get(self): get will be used by microservice clients/consumers to get the URL and port of a microservice :return:
- def post(self): post will be used by microser... | 9342a314bb7806ff32706b0f3016411244db57bc | <|skeleton|>
class RegistryHandler:
def get(self):
"""get will be used by microservice clients/consumers to get the URL and port of a microservice :return:"""
<|body_0|>
def post(self):
"""post will be used by microservices to register themselves :return:"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegistryHandler:
def get(self):
"""get will be used by microservice clients/consumers to get the URL and port of a microservice :return:"""
service_name = self.get_argument('service_name')
logger.info('Got a lookup request for service {0}'.format(service_name))
if service_name ... | the_stack_v2_python_sparse | microservices/registry/handlers.py | SKisContent/JobFun | train | 10 | |
c3a09f99551e0b28b1e2513b50f46aad1fb3c893 | [
"self.min = min\nself.max = max\nif message is not None:\n self.too_long = message\n self.too_short = message\n self.not_in_range = message",
"value = str(value)\nlength = len(value)\nparams = dict(min=self.min, max=self.max)\nif self.min and self.max is None:\n if length < self.min:\n return E... | <|body_start_0|>
self.min = min
self.max = max
if message is not None:
self.too_long = message
self.too_short = message
self.not_in_range = message
<|end_body_0|>
<|body_start_1|>
value = str(value)
length = len(value)
params = dict(mi... | Length validator Validates an input for being proper length. You can check for minimum length, maximum length or both. | Length | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Length:
"""Length validator Validates an input for being proper length. You can check for minimum length, maximum length or both."""
def __init__(self, min=None, max=None, message=None):
"""Initialize validator Accepts minimum and maximum length to check against. Allows only single v... | stack_v2_sparse_classes_36k_train_029243 | 2,111 | permissive | [
{
"docstring": "Initialize validator Accepts minimum and maximum length to check against. Allows only single value to be provided. :param min: int or None, minimum length :param max: int or None, maximum length :param message: str, custom error message :return: None",
"name": "__init__",
"signature": "d... | 2 | null | Implement the Python class `Length` described below.
Class description:
Length validator Validates an input for being proper length. You can check for minimum length, maximum length or both.
Method signatures and docstrings:
- def __init__(self, min=None, max=None, message=None): Initialize validator Accepts minimum ... | Implement the Python class `Length` described below.
Class description:
Length validator Validates an input for being proper length. You can check for minimum length, maximum length or both.
Method signatures and docstrings:
- def __init__(self, min=None, max=None, message=None): Initialize validator Accepts minimum ... | c598d1af5df40fae65cf3878b8f67accbcd059b7 | <|skeleton|>
class Length:
"""Length validator Validates an input for being proper length. You can check for minimum length, maximum length or both."""
def __init__(self, min=None, max=None, message=None):
"""Initialize validator Accepts minimum and maximum length to check against. Allows only single v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Length:
"""Length validator Validates an input for being proper length. You can check for minimum length, maximum length or both."""
def __init__(self, min=None, max=None, message=None):
"""Initialize validator Accepts minimum and maximum length to check against. Allows only single value to be pr... | the_stack_v2_python_sparse | shiftschema/validators/length.py | projectshift/shift-schema | train | 2 |
f35806f2c0b2e4f5d17dfaf7537ca3bee241235d | [
"KratosMultiphysics.Process.__init__(self)\ndefault_parameters = KratosMultiphysics.Parameters('{\\n \"help\" : \"This class integrates element sensitivities within domains defined by sub model parts\",\\n \"element_sensitivity_variables\" : [],\\n \"m... | <|body_start_0|>
KratosMultiphysics.Process.__init__(self)
default_parameters = KratosMultiphysics.Parameters('{\n "help" : "This class integrates element sensitivities within domains defined by sub model parts",\n "element_sensitivity_variables" : []... | This class integrates scalar element sensitivities (material and cross-section properties like CROSS_AREA or YOUNGS_MODULUS) within defined domains. The integration domains are defined by sub model parts of the sensitivity model part. | ElementSensitivityDomainIntegrationProcess | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElementSensitivityDomainIntegrationProcess:
"""This class integrates scalar element sensitivities (material and cross-section properties like CROSS_AREA or YOUNGS_MODULUS) within defined domains. The integration domains are defined by sub model parts of the sensitivity model part."""
def __i... | stack_v2_sparse_classes_36k_train_029244 | 5,560 | permissive | [
{
"docstring": "The default constructor of the class Keyword arguments: self -- It signifies an instance of a class. model -- the model contaning the model_parts parameter -- Kratos parameters containing process settings.",
"name": "__init__",
"signature": "def __init__(self, model, parameter)"
},
{... | 4 | null | Implement the Python class `ElementSensitivityDomainIntegrationProcess` described below.
Class description:
This class integrates scalar element sensitivities (material and cross-section properties like CROSS_AREA or YOUNGS_MODULUS) within defined domains. The integration domains are defined by sub model parts of the ... | Implement the Python class `ElementSensitivityDomainIntegrationProcess` described below.
Class description:
This class integrates scalar element sensitivities (material and cross-section properties like CROSS_AREA or YOUNGS_MODULUS) within defined domains. The integration domains are defined by sub model parts of the ... | 366949ec4e3651702edc6ac3061d2988f10dd271 | <|skeleton|>
class ElementSensitivityDomainIntegrationProcess:
"""This class integrates scalar element sensitivities (material and cross-section properties like CROSS_AREA or YOUNGS_MODULUS) within defined domains. The integration domains are defined by sub model parts of the sensitivity model part."""
def __i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElementSensitivityDomainIntegrationProcess:
"""This class integrates scalar element sensitivities (material and cross-section properties like CROSS_AREA or YOUNGS_MODULUS) within defined domains. The integration domains are defined by sub model parts of the sensitivity model part."""
def __init__(self, m... | the_stack_v2_python_sparse | applications/StructuralMechanicsApplication/python_scripts/element_sensitivity_domain_integration_process.py | KratosMultiphysics/Kratos | train | 994 |
1789a05bc8ec67b32174dec1ae7eb7e8d4ee355c | [
"title1 = CategoryFactory(name='title1', slug='title1-slug', is_static_url=True)\ntitle2 = CategoryFactory(name='title2', slug='title2-slug')\ntitle3 = CategoryFactory(name='title3')\ntitle1slug = CategoryFactory(name='title1-slug')\nassert title1.slug == 'title1-slug'\nassert title2.slug == 'title2'\nassert title3... | <|body_start_0|>
title1 = CategoryFactory(name='title1', slug='title1-slug', is_static_url=True)
title2 = CategoryFactory(name='title2', slug='title2-slug')
title3 = CategoryFactory(name='title3')
title1slug = CategoryFactory(name='title1-slug')
assert title1.slug == 'title1-slug... | TestSlugFunctions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSlugFunctions:
def test_category_slug(self):
"""Test Category slug creation"""
<|body_0|>
def test_static_slug(self):
"""Test Static slug creation"""
<|body_1|>
def test_content_slug(self):
"""Test Content slug creation"""
<|body_2|>
... | stack_v2_sparse_classes_36k_train_029245 | 7,123 | no_license | [
{
"docstring": "Test Category slug creation",
"name": "test_category_slug",
"signature": "def test_category_slug(self)"
},
{
"docstring": "Test Static slug creation",
"name": "test_static_slug",
"signature": "def test_static_slug(self)"
},
{
"docstring": "Test Content slug creati... | 3 | stack_v2_sparse_classes_30k_train_003156 | Implement the Python class `TestSlugFunctions` described below.
Class description:
Implement the TestSlugFunctions class.
Method signatures and docstrings:
- def test_category_slug(self): Test Category slug creation
- def test_static_slug(self): Test Static slug creation
- def test_content_slug(self): Test Content sl... | Implement the Python class `TestSlugFunctions` described below.
Class description:
Implement the TestSlugFunctions class.
Method signatures and docstrings:
- def test_category_slug(self): Test Category slug creation
- def test_static_slug(self): Test Static slug creation
- def test_content_slug(self): Test Content sl... | 9fe00a6ff548a8330f0b2af29aac7dc0b7a4aba6 | <|skeleton|>
class TestSlugFunctions:
def test_category_slug(self):
"""Test Category slug creation"""
<|body_0|>
def test_static_slug(self):
"""Test Static slug creation"""
<|body_1|>
def test_content_slug(self):
"""Test Content slug creation"""
<|body_2|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSlugFunctions:
def test_category_slug(self):
"""Test Category slug creation"""
title1 = CategoryFactory(name='title1', slug='title1-slug', is_static_url=True)
title2 = CategoryFactory(name='title2', slug='title2-slug')
title3 = CategoryFactory(name='title3')
title1s... | the_stack_v2_python_sparse | panel/tests.py | tugcanolgun/Blog | train | 0 | |
4e65b7df786f7d89afec558983b215ba03fdaa62 | [
"Boundary.__init__(self)\nif domain is None:\n msg = 'Domain must be specified for this type boundary'\n raise Exception(msg)\nif function is None:\n msg = 'Function must be specified for this type boundary'\n raise Exception(msg)\nself.domain = domain\nself.function = function\nself.default_boundary = ... | <|body_start_0|>
Boundary.__init__(self)
if domain is None:
msg = 'Domain must be specified for this type boundary'
raise Exception(msg)
if function is None:
msg = 'Function must be specified for this type boundary'
raise Exception(msg)
sel... | Bounday condition object that returns transmissive normal momentum and sets stage Returns the same normal momentum as that present in neighbour volume edge. Zero out the tangential momentum. Sets stage by specifying a function f of time which may either be a vector function or a scalar function | Transmissive_n_momentum_zero_t_momentum_set_stage_boundary | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transmissive_n_momentum_zero_t_momentum_set_stage_boundary:
"""Bounday condition object that returns transmissive normal momentum and sets stage Returns the same normal momentum as that present in neighbour volume edge. Zero out the tangential momentum. Sets stage by specifying a function f of ti... | stack_v2_sparse_classes_36k_train_029246 | 39,969 | permissive | [
{
"docstring": "Create boundary condition object. :param domain: domain on which to apply BC :param function: function to set stage :param float default_boundary: Example: Set all the tagged boundaries to use the BC >>> domain = anuga.rectangular_cross_domain(10, 10) >>> def waveform(t): >>> return sea_level + ... | 4 | null | Implement the Python class `Transmissive_n_momentum_zero_t_momentum_set_stage_boundary` described below.
Class description:
Bounday condition object that returns transmissive normal momentum and sets stage Returns the same normal momentum as that present in neighbour volume edge. Zero out the tangential momentum. Sets... | Implement the Python class `Transmissive_n_momentum_zero_t_momentum_set_stage_boundary` described below.
Class description:
Bounday condition object that returns transmissive normal momentum and sets stage Returns the same normal momentum as that present in neighbour volume edge. Zero out the tangential momentum. Sets... | 6d6d8e22b7e15b601f960c198b521bc20682477c | <|skeleton|>
class Transmissive_n_momentum_zero_t_momentum_set_stage_boundary:
"""Bounday condition object that returns transmissive normal momentum and sets stage Returns the same normal momentum as that present in neighbour volume edge. Zero out the tangential momentum. Sets stage by specifying a function f of ti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Transmissive_n_momentum_zero_t_momentum_set_stage_boundary:
"""Bounday condition object that returns transmissive normal momentum and sets stage Returns the same normal momentum as that present in neighbour volume edge. Zero out the tangential momentum. Sets stage by specifying a function f of time which may ... | the_stack_v2_python_sparse | anuga/shallow_water/boundaries.py | stoiver/anuga_core | train | 4 |
aa4e0ed283b2ab95869e00b7cb907fea8d5e91e8 | [
"self.log_name = log_name\nif not credentials:\n credentials = aws_credentials()\nself.client = boto3.client('cloudwatch', region_name=credentials['AWS_DEFAULT_REGION'], aws_secret_access_key=credentials['AWS_SECRET_ACCESS_KEY'], aws_access_key_id=credentials['AWS_ACCESS_KEY_ID'])",
"assert isinstance(log, dic... | <|body_start_0|>
self.log_name = log_name
if not credentials:
credentials = aws_credentials()
self.client = boto3.client('cloudwatch', region_name=credentials['AWS_DEFAULT_REGION'], aws_secret_access_key=credentials['AWS_SECRET_ACCESS_KEY'], aws_access_key_id=credentials['AWS_ACCESS_... | monitor time elapsed of each operator using AWS CloudWatch. | CloudWatch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CloudWatch:
"""monitor time elapsed of each operator using AWS CloudWatch."""
def __init__(self, log_name: str, credentials: dict=None):
"""Parameters ---------- log_name: the name of the log. credentials: aws credential. If it is None, we'll try to construct it automatically."""
... | stack_v2_sparse_classes_36k_train_029247 | 2,110 | permissive | [
{
"docstring": "Parameters ---------- log_name: the name of the log. credentials: aws credential. If it is None, we'll try to construct it automatically.",
"name": "__init__",
"signature": "def __init__(self, log_name: str, credentials: dict=None)"
},
{
"docstring": "Parameters ----------- log: ... | 2 | null | Implement the Python class `CloudWatch` described below.
Class description:
monitor time elapsed of each operator using AWS CloudWatch.
Method signatures and docstrings:
- def __init__(self, log_name: str, credentials: dict=None): Parameters ---------- log_name: the name of the log. credentials: aws credential. If it... | Implement the Python class `CloudWatch` described below.
Class description:
monitor time elapsed of each operator using AWS CloudWatch.
Method signatures and docstrings:
- def __init__(self, log_name: str, credentials: dict=None): Parameters ---------- log_name: the name of the log. credentials: aws credential. If it... | 4b1b6cc7844f8bf453ae0ba3b618106163fa9bcf | <|skeleton|>
class CloudWatch:
"""monitor time elapsed of each operator using AWS CloudWatch."""
def __init__(self, log_name: str, credentials: dict=None):
"""Parameters ---------- log_name: the name of the log. credentials: aws credential. If it is None, we'll try to construct it automatically."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CloudWatch:
"""monitor time elapsed of each operator using AWS CloudWatch."""
def __init__(self, log_name: str, credentials: dict=None):
"""Parameters ---------- log_name: the name of the log. credentials: aws credential. If it is None, we'll try to construct it automatically."""
self.log... | the_stack_v2_python_sparse | chunkflow/plugins/aws/cloud_watch.py | seung-lab/chunkflow | train | 47 |
74aba9ca6c5f41bdb71dd4d585e1d49fec4bf5a0 | [
"self.background = background\nself.dragonfly = dragonfly\nself.target_list = target_list\nself.width = width\nself.height = height\nself.index = 0\nself.run_id = run_id",
"if self.background:\n canvas = self.background.grab(self.height, self.width)\nelse:\n canvas = np.empty((self.height, self.width, 3), n... | <|body_start_0|>
self.background = background
self.dragonfly = dragonfly
self.target_list = target_list
self.width = width
self.height = height
self.index = 0
self.run_id = run_id
<|end_body_0|>
<|body_start_1|>
if self.background:
canvas = se... | This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting from 0 | AnimationWindow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnimationWindow:
"""This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting... | stack_v2_sparse_classes_36k_train_029248 | 3,008 | no_license | [
{
"docstring": "Constructor Args: target_list (List[Target]): list of targets to draw width (int): width of the drawing canvas height (int): height of the drawing canvas background (Optional[Background]): add a background to the canvas",
"name": "__init__",
"signature": "def __init__(self, run_id, targe... | 2 | null | Implement the Python class `AnimationWindow` described below.
Class description:
This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas inde... | Implement the Python class `AnimationWindow` described below.
Class description:
This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas inde... | ce01f6f8638f29abb3d017e0bf367f52e86c1299 | <|skeleton|>
class AnimationWindow:
"""This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnimationWindow:
"""This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting from 0"""
... | the_stack_v2_python_sparse | Environment/AnimationWindow.py | yoryos/dragonfly | train | 1 |
3df943272013090dd37cb4d7f1647f908f5045d5 | [
"try:\n container = open('Settings.txt', 'r')\n content = container.readlines()\n container.close()\nexcept IOError:\n container.close()\nlang = content[1].split(':')\nlang = lang[1].strip()\ntry:\n container = open(lang + '.txt', 'r')\n self.content = container.readlines()\n container.close()\... | <|body_start_0|>
try:
container = open('Settings.txt', 'r')
content = container.readlines()
container.close()
except IOError:
container.close()
lang = content[1].split(':')
lang = lang[1].strip()
try:
container = open(la... | gets a raw text from language file in __init__, work on it in get_text_dict method | Options | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Options:
"""gets a raw text from language file in __init__, work on it in get_text_dict method"""
def __init__(self):
"""read one of the language files, it depends on currently set language (2nd line in Settings.text)"""
<|body_0|>
def get_text_dict(self, module_text):
... | stack_v2_sparse_classes_36k_train_029249 | 2,308 | permissive | [
{
"docstring": "read one of the language files, it depends on currently set language (2nd line in Settings.text)",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "refines language text file: takes text for module that is needed then returns dictionary with key being widg... | 2 | stack_v2_sparse_classes_30k_train_005004 | Implement the Python class `Options` described below.
Class description:
gets a raw text from language file in __init__, work on it in get_text_dict method
Method signatures and docstrings:
- def __init__(self): read one of the language files, it depends on currently set language (2nd line in Settings.text)
- def get... | Implement the Python class `Options` described below.
Class description:
gets a raw text from language file in __init__, work on it in get_text_dict method
Method signatures and docstrings:
- def __init__(self): read one of the language files, it depends on currently set language (2nd line in Settings.text)
- def get... | acc5f87984a92fd4cec7fb9d71a0138ab2d3d13d | <|skeleton|>
class Options:
"""gets a raw text from language file in __init__, work on it in get_text_dict method"""
def __init__(self):
"""read one of the language files, it depends on currently set language (2nd line in Settings.text)"""
<|body_0|>
def get_text_dict(self, module_text):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Options:
"""gets a raw text from language file in __init__, work on it in get_text_dict method"""
def __init__(self):
"""read one of the language files, it depends on currently set language (2nd line in Settings.text)"""
try:
container = open('Settings.txt', 'r')
c... | the_stack_v2_python_sparse | set_options.py | SlaveForGluten/Goatbook | train | 1 |
d7ca41dbde3d5c48f00922289e978103a289daa8 | [
"ns = []\nif inc_soap:\n ns += [at_soap['n_sparse'] for at_soap in self.soap.values()]\nif inc_two_body:\n ns += [params['n_sparse'] for params in self.pairwise.values()]\nreturn ns",
"for pair in combinations_with_replacement(set(atom_symbols), r=2):\n s_a, s_b = pair\n if s_a == s_b and atom_symbols... | <|body_start_0|>
ns = []
if inc_soap:
ns += [at_soap['n_sparse'] for at_soap in self.soap.values()]
if inc_two_body:
ns += [params['n_sparse'] for params in self.pairwise.values()]
return ns
<|end_body_0|>
<|body_start_1|>
for pair in combinations_with_re... | Parameters | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parameters:
def n_sparses(self, inc_soap=True, inc_two_body=True):
"""Return a list of all the n_sparse parameters used to generate a GAP :param inc_soap: (bool) :param inc_two_body: (bool) :return: (list(int))"""
<|body_0|>
def _set_pairs(self, atom_symbols):
"""Set... | stack_v2_sparse_classes_36k_train_029250 | 14,506 | permissive | [
{
"docstring": "Return a list of all the n_sparse parameters used to generate a GAP :param inc_soap: (bool) :param inc_two_body: (bool) :return: (list(int))",
"name": "n_sparses",
"signature": "def n_sparses(self, inc_soap=True, inc_two_body=True)"
},
{
"docstring": "Set the two-body pair parame... | 4 | stack_v2_sparse_classes_30k_train_010713 | Implement the Python class `Parameters` described below.
Class description:
Implement the Parameters class.
Method signatures and docstrings:
- def n_sparses(self, inc_soap=True, inc_two_body=True): Return a list of all the n_sparse parameters used to generate a GAP :param inc_soap: (bool) :param inc_two_body: (bool)... | Implement the Python class `Parameters` described below.
Class description:
Implement the Parameters class.
Method signatures and docstrings:
- def n_sparses(self, inc_soap=True, inc_two_body=True): Return a list of all the n_sparse parameters used to generate a GAP :param inc_soap: (bool) :param inc_two_body: (bool)... | 864574abe20cc6072376e7c36ffb2ee1635e74e3 | <|skeleton|>
class Parameters:
def n_sparses(self, inc_soap=True, inc_two_body=True):
"""Return a list of all the n_sparse parameters used to generate a GAP :param inc_soap: (bool) :param inc_two_body: (bool) :return: (list(int))"""
<|body_0|>
def _set_pairs(self, atom_symbols):
"""Set... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parameters:
def n_sparses(self, inc_soap=True, inc_two_body=True):
"""Return a list of all the n_sparse parameters used to generate a GAP :param inc_soap: (bool) :param inc_two_body: (bool) :return: (list(int))"""
ns = []
if inc_soap:
ns += [at_soap['n_sparse'] for at_soap ... | the_stack_v2_python_sparse | gaptrain/gap.py | Leticia-maria/gap-train | train | 0 | |
019acd180f9ea97c0406f9698e498a47565b3660 | [
"super().__init__()\nself.orig_obs_space = obs_space\nself.embedding_size = self.orig_obs_space['doc']['0'].shape[0]\nself.num_candidates = len(self.orig_obs_space['doc'])\nassert self.orig_obs_space['user'].shape[0] == self.embedding_size\nself.q_nets = nn.ModuleList()\nfor i in range(self.num_candidates):\n la... | <|body_start_0|>
super().__init__()
self.orig_obs_space = obs_space
self.embedding_size = self.orig_obs_space['doc']['0'].shape[0]
self.num_candidates = len(self.orig_obs_space['doc'])
assert self.orig_obs_space['user'].shape[0] == self.embedding_size
self.q_nets = nn.Mod... | QValueModel | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QValueModel:
def __init__(self, obs_space: gym.spaces.Space, fcnet_hiddens_per_candidate=(256, 32)):
"""Initializes a QValueModel instance. Each document candidate receives one full Q-value stack, defined by `fcnet_hiddens_per_candidate`. The input to each of these Q-value stacks is alwa... | stack_v2_sparse_classes_36k_train_029251 | 6,840 | permissive | [
{
"docstring": "Initializes a QValueModel instance. Each document candidate receives one full Q-value stack, defined by `fcnet_hiddens_per_candidate`. The input to each of these Q-value stacks is always {[user] concat [document[i]] for i in document_candidates}. Extra model kwargs: fcnet_hiddens_per_candidate: ... | 2 | stack_v2_sparse_classes_30k_val_000567 | Implement the Python class `QValueModel` described below.
Class description:
Implement the QValueModel class.
Method signatures and docstrings:
- def __init__(self, obs_space: gym.spaces.Space, fcnet_hiddens_per_candidate=(256, 32)): Initializes a QValueModel instance. Each document candidate receives one full Q-valu... | Implement the Python class `QValueModel` described below.
Class description:
Implement the QValueModel class.
Method signatures and docstrings:
- def __init__(self, obs_space: gym.spaces.Space, fcnet_hiddens_per_candidate=(256, 32)): Initializes a QValueModel instance. Each document candidate receives one full Q-valu... | edba68c3e7cf255d1d6479329f305adb7fa4c3ed | <|skeleton|>
class QValueModel:
def __init__(self, obs_space: gym.spaces.Space, fcnet_hiddens_per_candidate=(256, 32)):
"""Initializes a QValueModel instance. Each document candidate receives one full Q-value stack, defined by `fcnet_hiddens_per_candidate`. The input to each of these Q-value stacks is alwa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QValueModel:
def __init__(self, obs_space: gym.spaces.Space, fcnet_hiddens_per_candidate=(256, 32)):
"""Initializes a QValueModel instance. Each document candidate receives one full Q-value stack, defined by `fcnet_hiddens_per_candidate`. The input to each of these Q-value stacks is always {[user] con... | the_stack_v2_python_sparse | rllib/algorithms/slateq/slateq_torch_model.py | ray-project/ray | train | 29,482 | |
7a48f2e81000823a73420506304b4e821720f5db | [
"json_response = {}\nif not server_id:\n servers = Server.get_by_user_id(request.user.id)\n json_response['response'] = [server.to_dict() for server in servers]\n return JsonResponse(json_response, status=200)\nserver = Server.get_by_id(server_id)\nif not server:\n json_response['error'] = 'Server with ... | <|body_start_0|>
json_response = {}
if not server_id:
servers = Server.get_by_user_id(request.user.id)
json_response['response'] = [server.to_dict() for server in servers]
return JsonResponse(json_response, status=200)
server = Server.get_by_id(server_id)
... | Server view handles GET, POST, PUT, DELETE requests. | ServerView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServerView:
"""Server view handles GET, POST, PUT, DELETE requests."""
def get(self, request, server_id=None):
"""Handles GET request. If server_id is None, return all servers in response, otherwise server with given id. If server with specified id was not found return error. :param ... | stack_v2_sparse_classes_36k_train_029252 | 4,797 | no_license | [
{
"docstring": "Handles GET request. If server_id is None, return all servers in response, otherwise server with given id. If server with specified id was not found return error. :param server_id: int - server id :return: JsonResponse: { response: <list of servers>/<servers> or error: <error message> }",
"n... | 4 | stack_v2_sparse_classes_30k_train_019811 | Implement the Python class `ServerView` described below.
Class description:
Server view handles GET, POST, PUT, DELETE requests.
Method signatures and docstrings:
- def get(self, request, server_id=None): Handles GET request. If server_id is None, return all servers in response, otherwise server with given id. If ser... | Implement the Python class `ServerView` described below.
Class description:
Server view handles GET, POST, PUT, DELETE requests.
Method signatures and docstrings:
- def get(self, request, server_id=None): Handles GET request. If server_id is None, return all servers in response, otherwise server with given id. If ser... | 83f5acb57862c1766748e7bed92335a3e9c71957 | <|skeleton|>
class ServerView:
"""Server view handles GET, POST, PUT, DELETE requests."""
def get(self, request, server_id=None):
"""Handles GET request. If server_id is None, return all servers in response, otherwise server with given id. If server with specified id was not found return error. :param ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ServerView:
"""Server view handles GET, POST, PUT, DELETE requests."""
def get(self, request, server_id=None):
"""Handles GET request. If server_id is None, return all servers in response, otherwise server with given id. If server with specified id was not found return error. :param server_id: in... | the_stack_v2_python_sparse | moninag/server/views.py | Lv-219-Python/MoniNag | train | 4 |
5db23eaa1b0877bb3f8a64464088b32f5883fe49 | [
"lis = []\n\ndef trav(root):\n if root.right:\n trav(root.right)\n lis.append(root.val)\n if root.left:\n trav(root.left)\ntrav(root)\nreturn min((bigger - big for bigger, big in zip(lis, lis[1:])))",
"cur = pre = residual = None\n\ndef trav(root):\n nonlocal cur, pre, residual\n if r... | <|body_start_0|>
lis = []
def trav(root):
if root.right:
trav(root.right)
lis.append(root.val)
if root.left:
trav(root.left)
trav(root)
return min((bigger - big for bigger, big in zip(lis, lis[1:])))
<|end_body_0|>
<|b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getMinimumDifference(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def getMinimumDifference(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
lis = []
def trav(ro... | stack_v2_sparse_classes_36k_train_029253 | 2,046 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "getMinimumDifference",
"signature": "def getMinimumDifference(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "getMinimumDifference",
"signature": "def getMinimumDifference(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012538 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getMinimumDifference(self, root): :type root: TreeNode :rtype: int
- def getMinimumDifference(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getMinimumDifference(self, root): :type root: TreeNode :rtype: int
- def getMinimumDifference(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
... | 9f2fca7fc3926a5c18c95bb49dcecfc7900b681c | <|skeleton|>
class Solution:
def getMinimumDifference(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def getMinimumDifference(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getMinimumDifference(self, root):
""":type root: TreeNode :rtype: int"""
lis = []
def trav(root):
if root.right:
trav(root.right)
lis.append(root.val)
if root.left:
trav(root.left)
trav(root)
... | the_stack_v2_python_sparse | 530. Minimum Absolute Difference in BST.py | WindChimeRan/leetcode-codewars | train | 0 | |
3ab1701fd6f8559c521bb5f64414a8f7983d38a5 | [
"if N == 1:\n return 0\nelse:\n return self.encode(self.kthGrammar(N - 1, math.ceil(K / 2)), K)",
"res = []\nif num == 0:\n res = [0, 1]\nelse:\n res = [1, 0]\nif K % 2 == 0:\n return res[-1]\nelse:\n return res[0]"
] | <|body_start_0|>
if N == 1:
return 0
else:
return self.encode(self.kthGrammar(N - 1, math.ceil(K / 2)), K)
<|end_body_0|>
<|body_start_1|>
res = []
if num == 0:
res = [0, 1]
else:
res = [1, 0]
if K % 2 == 0:
ret... | Solution1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution1:
def kthGrammar(self, N: int, K: int) -> int:
"""base case: recursive case: :param N: :param K: :return:"""
<|body_0|>
def encode(self, num, K):
""":param num: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if N == 1:
... | stack_v2_sparse_classes_36k_train_029254 | 1,728 | no_license | [
{
"docstring": "base case: recursive case: :param N: :param K: :return:",
"name": "kthGrammar",
"signature": "def kthGrammar(self, N: int, K: int) -> int"
},
{
"docstring": ":param num: :return:",
"name": "encode",
"signature": "def encode(self, num, K)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005868 | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def kthGrammar(self, N: int, K: int) -> int: base case: recursive case: :param N: :param K: :return:
- def encode(self, num, K): :param num: :return: | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def kthGrammar(self, N: int, K: int) -> int: base case: recursive case: :param N: :param K: :return:
- def encode(self, num, K): :param num: :return:
<|skeleton|>
class Soluti... | 84bd4a00160e6b2a723a57e149474c6bb38bcce2 | <|skeleton|>
class Solution1:
def kthGrammar(self, N: int, K: int) -> int:
"""base case: recursive case: :param N: :param K: :return:"""
<|body_0|>
def encode(self, num, K):
""":param num: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution1:
def kthGrammar(self, N: int, K: int) -> int:
"""base case: recursive case: :param N: :param K: :return:"""
if N == 1:
return 0
else:
return self.encode(self.kthGrammar(N - 1, math.ceil(K / 2)), K)
def encode(self, num, K):
""":param num: ... | the_stack_v2_python_sparse | recursion/k_gramma.py | yanghongkai/yhkleetcode | train | 0 | |
7e3b9d1b8d1c5a8e50ac01d602dc62352c28de9d | [
"self.client.force_login(self.team2_admin)\nresponse = self.client.get(self.detail_url)\nself.assertContains(response, 'Details for Context: %s' % self.team2_context3, status_code=200)\nself.assertContains(response, self.team2_context3.description)",
"self.client.force_login(self.team2_member)\nresponse = self.cl... | <|body_start_0|>
self.client.force_login(self.team2_admin)
response = self.client.get(self.detail_url)
self.assertContains(response, 'Details for Context: %s' % self.team2_context3, status_code=200)
self.assertContains(response, self.team2_context3.description)
<|end_body_0|>
<|body_sta... | Test ContextDetailView | ContextDetailViewTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContextDetailViewTest:
"""Test ContextDetailView"""
def test_context_detail_admin(self):
"""Assert that context details is shown to an admin"""
<|body_0|>
def test_context_detail_member(self):
"""Assert that context details is shown to a regular member"""
... | stack_v2_sparse_classes_36k_train_029255 | 9,319 | permissive | [
{
"docstring": "Assert that context details is shown to an admin",
"name": "test_context_detail_admin",
"signature": "def test_context_detail_admin(self)"
},
{
"docstring": "Assert that context details is shown to a regular member",
"name": "test_context_detail_member",
"signature": "def... | 3 | stack_v2_sparse_classes_30k_train_000876 | Implement the Python class `ContextDetailViewTest` described below.
Class description:
Test ContextDetailView
Method signatures and docstrings:
- def test_context_detail_admin(self): Assert that context details is shown to an admin
- def test_context_detail_member(self): Assert that context details is shown to a regu... | Implement the Python class `ContextDetailViewTest` described below.
Class description:
Test ContextDetailView
Method signatures and docstrings:
- def test_context_detail_admin(self): Assert that context details is shown to an admin
- def test_context_detail_member(self): Assert that context details is shown to a regu... | b3a61462d46d33de25fb96c029b2bd822001b669 | <|skeleton|>
class ContextDetailViewTest:
"""Test ContextDetailView"""
def test_context_detail_admin(self):
"""Assert that context details is shown to an admin"""
<|body_0|>
def test_context_detail_member(self):
"""Assert that context details is shown to a regular member"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContextDetailViewTest:
"""Test ContextDetailView"""
def test_context_detail_admin(self):
"""Assert that context details is shown to an admin"""
self.client.force_login(self.team2_admin)
response = self.client.get(self.detail_url)
self.assertContains(response, 'Details for ... | the_stack_v2_python_sparse | src/context/tests.py | tykling/socialrating | train | 3 |
114a26f379a54a0ca74551d5906e6c0040134bfb | [
"super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nself.reduction = reduction\nself.down_sample_layers = nn.ModuleList([ConvBlock(in_chans, chans, drop_prob, attention=False, attention_type=attention_type... | <|body_start_0|>
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
self.reduction = reduction
self.down_sample_layers = nn.ModuleList([ConvBlock(in_ch... | PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015. | CSEUnetModelTakeLatentDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CSEUnetModelTakeLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventi... | stack_v2_sparse_classes_36k_train_029256 | 10,589 | no_license | [
{
"docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ... | 2 | stack_v2_sparse_classes_30k_val_000531 | Implement the Python class `CSEUnetModelTakeLatentDecoder` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image com... | Implement the Python class `CSEUnetModelTakeLatentDecoder` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image com... | 219652c8a08c4f2f682acd9f95a4e1b3fd36b70b | <|skeleton|>
class CSEUnetModelTakeLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CSEUnetModelTakeLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234... | the_stack_v2_python_sparse | lemawarersn_unet_conv_redundancy_removed_relu/chattn.py | Bala93/Holistic-MRI-Reconstruction | train | 1 |
4b2f5be965fb5274f9efeeaa05979c7e39fea8ca | [
"user_id = params.get('user_id')\nlog.debug(f'Checking if user ({user_id}) is permitted to change their nickname.')\ndata = self.db.get(self.prison_table, user_id) or {}\nif data and data.get('end_timestamp'):\n log.trace('User exists in the prison_table.')\n end_time = data.get('end_timestamp')\n if is_ex... | <|body_start_0|>
user_id = params.get('user_id')
log.debug(f'Checking if user ({user_id}) is permitted to change their nickname.')
data = self.db.get(self.prison_table, user_id) or {}
if data and data.get('end_timestamp'):
log.trace('User exists in the prison_table.')
... | SuperstarifyView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuperstarifyView:
def get(self, params=None):
"""Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has exp... | stack_v2_sparse_classes_36k_train_029257 | 5,973 | permissive | [
{
"docstring": "Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has expired, return nothing. Data must be provided as params. AP... | 3 | stack_v2_sparse_classes_30k_train_016322 | Implement the Python class `SuperstarifyView` described below.
Class description:
Implement the SuperstarifyView class.
Method signatures and docstrings:
- def get(self, params=None): Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored... | Implement the Python class `SuperstarifyView` described below.
Class description:
Implement the SuperstarifyView class.
Method signatures and docstrings:
- def get(self, params=None): Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored... | bc87a43b3fc1ff3424b1c9603b0a35b28f2c3896 | <|skeleton|>
class SuperstarifyView:
def get(self, params=None):
"""Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has exp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SuperstarifyView:
def get(self, params=None):
"""Check if the user is currently in superstar-prison. If user is currently servin' his sentence in the big house, return the name stored in the forced_nick column of prison_table. If user cannot be found in prison, or if his sentence has expired, return n... | the_stack_v2_python_sparse | pysite/views/api/bot/superstarify.py | landizz/site | train | 0 | |
1815982d0186448f180ba822ba9165008417fb3d | [
"if 'L' not in problem_params:\n problem_params['L'] = 1.0\nessential_keys = ['nvars', 'c', 'freq', 'nu', 'L']\nfor key in essential_keys:\n if key not in problem_params:\n msg = 'need %s to instantiate problem, only got %s' % (key, str(problem_params.keys()))\n raise ParameterError(msg)\nif pro... | <|body_start_0|>
if 'L' not in problem_params:
problem_params['L'] = 1.0
essential_keys = ['nvars', 'c', 'freq', 'nu', 'L']
for key in essential_keys:
if key not in problem_params:
msg = 'need %s to instantiate problem, only got %s' % (key, str(problem_par... | Example implementing the unforced 1D advection diffusion equation with periodic BC in [-L/2, L/2] in spectral space, IMEX time-stepping Attributes: xvalues: grid points in space ddx: spectral operator for gradient lap: spectral operator for Laplacian rfft_object: planned real-valued FFT for forward transformation irfft... | advectiondiffusion1d_imex | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class advectiondiffusion1d_imex:
"""Example implementing the unforced 1D advection diffusion equation with periodic BC in [-L/2, L/2] in spectral space, IMEX time-stepping Attributes: xvalues: grid points in space ddx: spectral operator for gradient lap: spectral operator for Laplacian rfft_object: pla... | stack_v2_sparse_classes_36k_train_029258 | 6,717 | permissive | [
{
"docstring": "Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed to parent class) dtype_f: mesh data type with implicit and explicit component (will be passed to parent class)",
"name": "__init__",
"signature": "def __init__(se... | 4 | stack_v2_sparse_classes_30k_train_002235 | Implement the Python class `advectiondiffusion1d_imex` described below.
Class description:
Example implementing the unforced 1D advection diffusion equation with periodic BC in [-L/2, L/2] in spectral space, IMEX time-stepping Attributes: xvalues: grid points in space ddx: spectral operator for gradient lap: spectral ... | Implement the Python class `advectiondiffusion1d_imex` described below.
Class description:
Example implementing the unforced 1D advection diffusion equation with periodic BC in [-L/2, L/2] in spectral space, IMEX time-stepping Attributes: xvalues: grid points in space ddx: spectral operator for gradient lap: spectral ... | de2cd523411276083355389d7e7993106cedf93d | <|skeleton|>
class advectiondiffusion1d_imex:
"""Example implementing the unforced 1D advection diffusion equation with periodic BC in [-L/2, L/2] in spectral space, IMEX time-stepping Attributes: xvalues: grid points in space ddx: spectral operator for gradient lap: spectral operator for Laplacian rfft_object: pla... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class advectiondiffusion1d_imex:
"""Example implementing the unforced 1D advection diffusion equation with periodic BC in [-L/2, L/2] in spectral space, IMEX time-stepping Attributes: xvalues: grid points in space ddx: spectral operator for gradient lap: spectral operator for Laplacian rfft_object: planned real-val... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/AdvectionDiffusionEquation_1D_FFT.py | ruthschoebel/pySDC | train | 0 |
3f653dea88b242fd4a91a7d1cdea9d28510515cd | [
"cur = node1.next\nnode2.next = node1.next\nnode1.next = node3\nnode4.next = node1\nreturn (node2, cur, node1, node3)",
"if head is None or head.next is None:\n return head\ndummy = ListNode(-sys.maxsize)\ndummy.next = head\nprev = dummy\ncur = head\nwhile cur and cur.next:\n if cur.next.val >= cur.val:\n ... | <|body_start_0|>
cur = node1.next
node2.next = node1.next
node1.next = node3
node4.next = node1
return (node2, cur, node1, node3)
<|end_body_0|>
<|body_start_1|>
if head is None or head.next is None:
return head
dummy = ListNode(-sys.maxsize)
... | This is a solution | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""This is a solution"""
def insert(self, node1: ListNode, node2: ListNode, node3: ListNode, node4: ListNode):
"""node4 -> node3 -> ... -> node2 -> node1 what this function does: insert node1 in between node4 and node3 this will actually affect the nodes address in the scop... | stack_v2_sparse_classes_36k_train_029259 | 5,019 | permissive | [
{
"docstring": "node4 -> node3 -> ... -> node2 -> node1 what this function does: insert node1 in between node4 and node3 this will actually affect the nodes address in the scope out of this function",
"name": "insert",
"signature": "def insert(self, node1: ListNode, node2: ListNode, node3: ListNode, nod... | 2 | null | Implement the Python class `Solution` described below.
Class description:
This is a solution
Method signatures and docstrings:
- def insert(self, node1: ListNode, node2: ListNode, node3: ListNode, node4: ListNode): node4 -> node3 -> ... -> node2 -> node1 what this function does: insert node1 in between node4 and node... | Implement the Python class `Solution` described below.
Class description:
This is a solution
Method signatures and docstrings:
- def insert(self, node1: ListNode, node2: ListNode, node3: ListNode, node4: ListNode): node4 -> node3 -> ... -> node2 -> node1 what this function does: insert node1 in between node4 and node... | 1ed22267156fb968671731c2e983b0e65f670750 | <|skeleton|>
class Solution:
"""This is a solution"""
def insert(self, node1: ListNode, node2: ListNode, node3: ListNode, node4: ListNode):
"""node4 -> node3 -> ... -> node2 -> node1 what this function does: insert node1 in between node4 and node3 this will actually affect the nodes address in the scop... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""This is a solution"""
def insert(self, node1: ListNode, node2: ListNode, node3: ListNode, node4: ListNode):
"""node4 -> node3 -> ... -> node2 -> node1 what this function does: insert node1 in between node4 and node3 this will actually affect the nodes address in the scope out of this... | the_stack_v2_python_sparse | leetcode/147.py | pingrunhuang/CodeChallenge | train | 0 |
29667247d22dc35991c80e31164ebd04f75b36f4 | [
"pil_format = self.pil_format(**kwargs)\nfor av_frame in av_frame_seq:\n plane = av_frame.planes[0]\n image = Image.frombuffer(pil_format, (av_frame.width, av_frame.height), plane, 'raw', pil_format, 0, 1)\n yield image",
"av_format = self.av_format(**kwargs)\nif pil_format is None:\n pil_format = AV2... | <|body_start_0|>
pil_format = self.pil_format(**kwargs)
for av_frame in av_frame_seq:
plane = av_frame.planes[0]
image = Image.frombuffer(pil_format, (av_frame.width, av_frame.height), plane, 'raw', pil_format, 0, 1)
yield image
<|end_body_0|>
<|body_start_1|>
... | ... | ImageBased | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageBased:
"""..."""
def frame_images(self, av_frame_seq, **kwargs):
""":type av_frame_seq: collections.Iterable :param av_frame_seq: :return:"""
<|body_0|>
def pil_format(self, pil_format=None, **kwargs):
""":param pil_format: :param kwargs: :return:"""
... | stack_v2_sparse_classes_36k_train_029260 | 1,907 | permissive | [
{
"docstring": ":type av_frame_seq: collections.Iterable :param av_frame_seq: :return:",
"name": "frame_images",
"signature": "def frame_images(self, av_frame_seq, **kwargs)"
},
{
"docstring": ":param pil_format: :param kwargs: :return:",
"name": "pil_format",
"signature": "def pil_forma... | 4 | stack_v2_sparse_classes_30k_train_001731 | Implement the Python class `ImageBased` described below.
Class description:
...
Method signatures and docstrings:
- def frame_images(self, av_frame_seq, **kwargs): :type av_frame_seq: collections.Iterable :param av_frame_seq: :return:
- def pil_format(self, pil_format=None, **kwargs): :param pil_format: :param kwargs... | Implement the Python class `ImageBased` described below.
Class description:
...
Method signatures and docstrings:
- def frame_images(self, av_frame_seq, **kwargs): :type av_frame_seq: collections.Iterable :param av_frame_seq: :return:
- def pil_format(self, pil_format=None, **kwargs): :param pil_format: :param kwargs... | 617ff45c9c3c96bbd9a975aef15f1b2697282b9c | <|skeleton|>
class ImageBased:
"""..."""
def frame_images(self, av_frame_seq, **kwargs):
""":type av_frame_seq: collections.Iterable :param av_frame_seq: :return:"""
<|body_0|>
def pil_format(self, pil_format=None, **kwargs):
""":param pil_format: :param kwargs: :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageBased:
"""..."""
def frame_images(self, av_frame_seq, **kwargs):
""":type av_frame_seq: collections.Iterable :param av_frame_seq: :return:"""
pil_format = self.pil_format(**kwargs)
for av_frame in av_frame_seq:
plane = av_frame.planes[0]
image = Image.... | the_stack_v2_python_sparse | shot_detector/features/extractors/image_based.py | w495/python-video-shot-detector | train | 20 |
6282cf24458897954dc7428dc0083cf2541e03a1 | [
"super(DollarVolumeSymbolHandler, self).__init__(portfolio_handlers)\nself.n = n\nself.symbols = symbols",
"bars = gets.prices(date, symbols=self.symbols)\ndv = bars.ix['adj_price_close', -1, :] * bars.ix['adj_volume', -1, :]\nrank = dv.sort_values(ascending=False).dropna()\nreturn self.append_positions(list(rank... | <|body_start_0|>
super(DollarVolumeSymbolHandler, self).__init__(portfolio_handlers)
self.n = n
self.symbols = symbols
<|end_body_0|>
<|body_start_1|>
bars = gets.prices(date, symbols=self.symbols)
dv = bars.ix['adj_price_close', -1, :] * bars.ix['adj_volume', -1, :]
ran... | Dollar Volume Symbol Handler Class The dollar volume symbol handler selects assets by ranking stocks according to the total dollar volume transacted during the previous trading session. The symbol handler ignores the S&P 100 and S&P 500 indices which have huge volume. | DollarVolumeSymbolHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DollarVolumeSymbolHandler:
"""Dollar Volume Symbol Handler Class The dollar volume symbol handler selects assets by ranking stocks according to the total dollar volume transacted during the previous trading session. The symbol handler ignores the S&P 100 and S&P 500 indices which have huge volume... | stack_v2_sparse_classes_36k_train_029261 | 1,639 | permissive | [
{
"docstring": "Initialize parameters of the dollar volume symbol handler object. Parameters ---------- n: Integer. The number of assets to take from the ranking according to dollar volume; i.e. the top stocks according to dollar volume during the previous trading session. symbols (optional): List of strings. A... | 2 | null | Implement the Python class `DollarVolumeSymbolHandler` described below.
Class description:
Dollar Volume Symbol Handler Class The dollar volume symbol handler selects assets by ranking stocks according to the total dollar volume transacted during the previous trading session. The symbol handler ignores the S&P 100 and... | Implement the Python class `DollarVolumeSymbolHandler` described below.
Class description:
Dollar Volume Symbol Handler Class The dollar volume symbol handler selects assets by ranking stocks according to the total dollar volume transacted during the previous trading session. The symbol handler ignores the S&P 100 and... | e2e9d638c68947d24f1260d35a3527dd84c2523f | <|skeleton|>
class DollarVolumeSymbolHandler:
"""Dollar Volume Symbol Handler Class The dollar volume symbol handler selects assets by ranking stocks according to the total dollar volume transacted during the previous trading session. The symbol handler ignores the S&P 100 and S&P 500 indices which have huge volume... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DollarVolumeSymbolHandler:
"""Dollar Volume Symbol Handler Class The dollar volume symbol handler selects assets by ranking stocks according to the total dollar volume transacted during the previous trading session. The symbol handler ignores the S&P 100 and S&P 500 indices which have huge volume."""
def... | the_stack_v2_python_sparse | odin/handlers/symbol_handler/dollar_volume_symbol_handler.py | stjordanis/Odin | train | 0 |
f94beec175e7323586a11181ebf87bae546827af | [
"result = []\nrem_dict = dict()\ni = 0\nwhile True:\n if rem == 0:\n return ''.join(map(str, result))\n if rem in rem_dict:\n j = rem_dict[rem]\n nonrepeat = ''.join(map(str, result[:j]))\n cycle = ''.join(map(str, result[j:]))\n return nonrepeat + '(' + cycle + ')'\n rem... | <|body_start_0|>
result = []
rem_dict = dict()
i = 0
while True:
if rem == 0:
return ''.join(map(str, result))
if rem in rem_dict:
j = rem_dict[rem]
nonrepeat = ''.join(map(str, result[:j]))
cycle = '... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def fractional(self, rem, den):
"""Helper function for fraction_to_decimal, returns fractional part."""
<|body_0|>
def fraction_to_decimal(self, num, den):
"""Converts fraction to decimal, takes into account repeating part."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_029262 | 2,542 | no_license | [
{
"docstring": "Helper function for fraction_to_decimal, returns fractional part.",
"name": "fractional",
"signature": "def fractional(self, rem, den)"
},
{
"docstring": "Converts fraction to decimal, takes into account repeating part.",
"name": "fraction_to_decimal",
"signature": "def f... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fractional(self, rem, den): Helper function for fraction_to_decimal, returns fractional part.
- def fraction_to_decimal(self, num, den): Converts fraction to decimal, takes i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fractional(self, rem, den): Helper function for fraction_to_decimal, returns fractional part.
- def fraction_to_decimal(self, num, den): Converts fraction to decimal, takes i... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def fractional(self, rem, den):
"""Helper function for fraction_to_decimal, returns fractional part."""
<|body_0|>
def fraction_to_decimal(self, num, den):
"""Converts fraction to decimal, takes into account repeating part."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def fractional(self, rem, den):
"""Helper function for fraction_to_decimal, returns fractional part."""
result = []
rem_dict = dict()
i = 0
while True:
if rem == 0:
return ''.join(map(str, result))
if rem in rem_dict:
... | the_stack_v2_python_sparse | Hashing/fraction.py | vladn90/Algorithms | train | 0 | |
ed3091495a7141b0b1d508ed327682dab0545ff8 | [
"query = TypeHealthTopic.get_query(info=info)\nquery = query.join(ModelHealthTopic.body_parts)\nquery = query.filter(ModelBodyPart.name == body_part_name)\nquery = apply_requested_fields(info=info, query=query, orm_class=ModelHealthTopic)\nobjs = query.all()\nreturn objs",
"query = TypeHealthTopic.get_query(info=... | <|body_start_0|>
query = TypeHealthTopic.get_query(info=info)
query = query.join(ModelHealthTopic.body_parts)
query = query.filter(ModelBodyPart.name == body_part_name)
query = apply_requested_fields(info=info, query=query, orm_class=ModelHealthTopic)
objs = query.all()
r... | TypeHealthTopics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TypeHealthTopics:
def resolve_by_body_part_name(args: dict, info: graphene.ResolveInfo, body_part_name: str) -> List[ModelHealthTopic]:
"""Retrieves `ModelHealthTopic` record objects through their body-part name. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The... | stack_v2_sparse_classes_36k_train_029263 | 7,716 | no_license | [
{
"docstring": "Retrieves `ModelHealthTopic` record objects through their body-part name. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The resolver info. body_part_name (str): The name of the body-part to retrieve health-topics for. Returns: List[ModelHealthTopic]: The retrieved `Mode... | 2 | null | Implement the Python class `TypeHealthTopics` described below.
Class description:
Implement the TypeHealthTopics class.
Method signatures and docstrings:
- def resolve_by_body_part_name(args: dict, info: graphene.ResolveInfo, body_part_name: str) -> List[ModelHealthTopic]: Retrieves `ModelHealthTopic` record objects ... | Implement the Python class `TypeHealthTopics` described below.
Class description:
Implement the TypeHealthTopics class.
Method signatures and docstrings:
- def resolve_by_body_part_name(args: dict, info: graphene.ResolveInfo, body_part_name: str) -> List[ModelHealthTopic]: Retrieves `ModelHealthTopic` record objects ... | 275d0f5f437e09cb477600f48080d921301238e6 | <|skeleton|>
class TypeHealthTopics:
def resolve_by_body_part_name(args: dict, info: graphene.ResolveInfo, body_part_name: str) -> List[ModelHealthTopic]:
"""Retrieves `ModelHealthTopic` record objects through their body-part name. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TypeHealthTopics:
def resolve_by_body_part_name(args: dict, info: graphene.ResolveInfo, body_part_name: str) -> List[ModelHealthTopic]:
"""Retrieves `ModelHealthTopic` record objects through their body-part name. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The resolver info... | the_stack_v2_python_sparse | ffgraphql/types/health_topics.py | bearnd/fightfor-graphql | train | 0 | |
2a96946ba686a7a1d5903a949c583e63a1ad9946 | [
"self.device = device\nself.max_length = max_length\nself.config = AutoConfig.from_pretrained(model_name_or_path, cache_dir=cache_dir)\nself.tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, cache_dir=cache_dir)\nself.model = AutoModelForSeq2SeqLM.from_pretrained(model_name_or_path, config=self.config, ... | <|body_start_0|>
self.device = device
self.max_length = max_length
self.config = AutoConfig.from_pretrained(model_name_or_path, cache_dir=cache_dir)
self.tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, cache_dir=cache_dir)
self.model = AutoModelForSeq2SeqLM.from_pre... | UniEvaluator | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UniEvaluator:
def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None):
"""Set up model"""
<|body_0|>
def score(self, inputs, task, category, dim, batch_size=8):
"""Get scores for the given samples. final_score = postive_score / (posti... | stack_v2_sparse_classes_36k_train_029264 | 4,582 | permissive | [
{
"docstring": "Set up model",
"name": "__init__",
"signature": "def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None)"
},
{
"docstring": "Get scores for the given samples. final_score = postive_score / (postive_score + negative_score)",
"name": "score",
... | 2 | stack_v2_sparse_classes_30k_train_004410 | Implement the Python class `UniEvaluator` described below.
Class description:
Implement the UniEvaluator class.
Method signatures and docstrings:
- def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up model
- def score(self, inputs, task, category, dim, batch_size=8): Get s... | Implement the Python class `UniEvaluator` described below.
Class description:
Implement the UniEvaluator class.
Method signatures and docstrings:
- def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up model
- def score(self, inputs, task, category, dim, batch_size=8): Get s... | c7b60f75470f067d1342705708810a660eabd684 | <|skeleton|>
class UniEvaluator:
def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None):
"""Set up model"""
<|body_0|>
def score(self, inputs, task, category, dim, batch_size=8):
"""Get scores for the given samples. final_score = postive_score / (posti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UniEvaluator:
def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None):
"""Set up model"""
self.device = device
self.max_length = max_length
self.config = AutoConfig.from_pretrained(model_name_or_path, cache_dir=cache_dir)
self.tokenizer ... | the_stack_v2_python_sparse | applications/Chat/evaluate/unieval/scorer.py | hpcaitech/ColossalAI | train | 32,044 | |
1552058a422fc9bce65570bbf0469dc7c96cdb92 | [
"queue = None\nsession = get_current_session()\napp = ReEngageShopify.get_by_url(session.get('shop'))\nqueue = get_list_item(app.queues, 0)\nqueue_uuid = self.request.get('queue_uuid', '')\nif queue_uuid:\n queue = ReEngageQueue.get(queue_uuid)\npage = self.render_page('reengage/queue.html', {'debug': USING_DEV_... | <|body_start_0|>
queue = None
session = get_current_session()
app = ReEngageShopify.get_by_url(session.get('shop'))
queue = get_list_item(app.queues, 0)
queue_uuid = self.request.get('queue_uuid', '')
if queue_uuid:
queue = ReEngageQueue.get(queue_uuid)
... | A resource for accessing queues using HTML | ReEngageQueueHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReEngageQueueHandler:
"""A resource for accessing queues using HTML"""
def get(self):
"""Get all queued elements for a shop"""
<|body_0|>
def post(self):
"""Create a new post element in the queue"""
<|body_1|>
def delete(self):
"""Delete all ... | stack_v2_sparse_classes_36k_train_029265 | 12,697 | no_license | [
{
"docstring": "Get all queued elements for a shop",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create a new post element in the queue",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Delete all post elements in this queue",
"name": "dele... | 3 | null | Implement the Python class `ReEngageQueueHandler` described below.
Class description:
A resource for accessing queues using HTML
Method signatures and docstrings:
- def get(self): Get all queued elements for a shop
- def post(self): Create a new post element in the queue
- def delete(self): Delete all post elements i... | Implement the Python class `ReEngageQueueHandler` described below.
Class description:
A resource for accessing queues using HTML
Method signatures and docstrings:
- def get(self): Get all queued elements for a shop
- def post(self): Create a new post element in the queue
- def delete(self): Delete all post elements i... | d1e046d5b7bf1ba0febb337a31ec04f5888fb341 | <|skeleton|>
class ReEngageQueueHandler:
"""A resource for accessing queues using HTML"""
def get(self):
"""Get all queued elements for a shop"""
<|body_0|>
def post(self):
"""Create a new post element in the queue"""
<|body_1|>
def delete(self):
"""Delete all ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReEngageQueueHandler:
"""A resource for accessing queues using HTML"""
def get(self):
"""Get all queued elements for a shop"""
queue = None
session = get_current_session()
app = ReEngageShopify.get_by_url(session.get('shop'))
queue = get_list_item(app.queues, 0)
... | the_stack_v2_python_sparse | apps/reengage/resources.py | bbarclay/Willet-Referrals | train | 0 |
a24809c2fe0981201799eae2a2863213dc390f60 | [
"for p in TmsData.employee():\n assert isinstance(p, EmployModel)\n try:\n startjob = datetime.strptime(p.startjob, '%Y/%m/%d').date()\n total_year = getyearspan(date.today(), startjob)\n except ValueError:\n total_year = 0\n try:\n startmokie = datetime.strptime(p.startmokie... | <|body_start_0|>
for p in TmsData.employee():
assert isinstance(p, EmployModel)
try:
startjob = datetime.strptime(p.startjob, '%Y/%m/%d').date()
total_year = getyearspan(date.today(), startjob)
except ValueError:
total_year = 0
... | 年假规则: =================== 可用年假(available_al)= min(20, 法定年假+公司年假) 法定年假(legal_al) = 根据工作年限(total_year)进行判断 1. 工作年限 <1 , 0 天 2. 1<= 工作年限 <10 , 7 天 3. 10<=工作年限 <20 , 10 天 4. 工作年限>=20 , 15 天 公司年假(comp_al) = 摩奇工作年限 | Leave | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Leave:
"""年假规则: =================== 可用年假(available_al)= min(20, 法定年假+公司年假) 法定年假(legal_al) = 根据工作年限(total_year)进行判断 1. 工作年限 <1 , 0 天 2. 1<= 工作年限 <10 , 7 天 3. 10<=工作年限 <20 , 10 天 4. 工作年限>=20 , 15 天 公司年假(comp_al) = 摩奇工作年限"""
def gen_leavetb(self):
"""生成假期表"""
<|body_0|>
def... | stack_v2_sparse_classes_36k_train_029266 | 2,842 | no_license | [
{
"docstring": "生成假期表",
"name": "gen_leavetb",
"signature": "def gen_leavetb(self)"
},
{
"docstring": "计算法定年假",
"name": "get_legal_al",
"signature": "def get_legal_al(self, total_year)"
}
] | 2 | null | Implement the Python class `Leave` described below.
Class description:
年假规则: =================== 可用年假(available_al)= min(20, 法定年假+公司年假) 法定年假(legal_al) = 根据工作年限(total_year)进行判断 1. 工作年限 <1 , 0 天 2. 1<= 工作年限 <10 , 7 天 3. 10<=工作年限 <20 , 10 天 4. 工作年限>=20 , 15 天 公司年假(comp_al) = 摩奇工作年限
Method signatures and docstrings:
- de... | Implement the Python class `Leave` described below.
Class description:
年假规则: =================== 可用年假(available_al)= min(20, 法定年假+公司年假) 法定年假(legal_al) = 根据工作年限(total_year)进行判断 1. 工作年限 <1 , 0 天 2. 1<= 工作年限 <10 , 7 天 3. 10<=工作年限 <20 , 10 天 4. 工作年限>=20 , 15 天 公司年假(comp_al) = 摩奇工作年限
Method signatures and docstrings:
- de... | ecf743e027e9f15925e43f05c0b8a86bb88946db | <|skeleton|>
class Leave:
"""年假规则: =================== 可用年假(available_al)= min(20, 法定年假+公司年假) 法定年假(legal_al) = 根据工作年限(total_year)进行判断 1. 工作年限 <1 , 0 天 2. 1<= 工作年限 <10 , 7 天 3. 10<=工作年限 <20 , 10 天 4. 工作年限>=20 , 15 天 公司年假(comp_al) = 摩奇工作年限"""
def gen_leavetb(self):
"""生成假期表"""
<|body_0|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Leave:
"""年假规则: =================== 可用年假(available_al)= min(20, 法定年假+公司年假) 法定年假(legal_al) = 根据工作年限(total_year)进行判断 1. 工作年限 <1 , 0 天 2. 1<= 工作年限 <10 , 7 天 3. 10<=工作年限 <20 , 10 天 4. 工作年限>=20 , 15 天 公司年假(comp_al) = 摩奇工作年限"""
def gen_leavetb(self):
"""生成假期表"""
for p in TmsData.employee():
... | the_stack_v2_python_sparse | work/attend_excel/old/leave.py | coblan/py2 | train | 0 |
9408a845744a6aee42996211d96a781aa228a71d | [
"self.args = arg_cls.parse()\nself.register_func = register_func\nself.mode = TaskMode(mode)\nfrom torch import distributed\nself.is_distributed = False\nif distributed.is_available():\n if len(self.args.use_gpus) > 1:\n if not self.args.use_data_parallel:\n self.is_distributed = True\ntask_dic... | <|body_start_0|>
self.args = arg_cls.parse()
self.register_func = register_func
self.mode = TaskMode(mode)
from torch import distributed
self.is_distributed = False
if distributed.is_available():
if len(self.args.use_gpus) > 1:
if not self.args... | Launcher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Launcher:
def __init__(self, arg_cls: Type[MainArg], register_func: Callable, mode):
"""Base class of launchers for building and running a task properly :param arg_cls: :param register_func: Callable to setup `settings.space.Spaces`, used before building the task :param mode: TaskMode"""... | stack_v2_sparse_classes_36k_train_029267 | 6,217 | no_license | [
{
"docstring": "Base class of launchers for building and running a task properly :param arg_cls: :param register_func: Callable to setup `settings.space.Spaces`, used before building the task :param mode: TaskMode",
"name": "__init__",
"signature": "def __init__(self, arg_cls: Type[MainArg], register_fu... | 3 | stack_v2_sparse_classes_30k_train_016294 | Implement the Python class `Launcher` described below.
Class description:
Implement the Launcher class.
Method signatures and docstrings:
- def __init__(self, arg_cls: Type[MainArg], register_func: Callable, mode): Base class of launchers for building and running a task properly :param arg_cls: :param register_func: ... | Implement the Python class `Launcher` described below.
Class description:
Implement the Launcher class.
Method signatures and docstrings:
- def __init__(self, arg_cls: Type[MainArg], register_func: Callable, mode): Base class of launchers for building and running a task properly :param arg_cls: :param register_func: ... | c9c2e32b484687ef5b110af3dd39f86ecfcb5337 | <|skeleton|>
class Launcher:
def __init__(self, arg_cls: Type[MainArg], register_func: Callable, mode):
"""Base class of launchers for building and running a task properly :param arg_cls: :param register_func: Callable to setup `settings.space.Spaces`, used before building the task :param mode: TaskMode"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Launcher:
def __init__(self, arg_cls: Type[MainArg], register_func: Callable, mode):
"""Base class of launchers for building and running a task properly :param arg_cls: :param register_func: Callable to setup `settings.space.Spaces`, used before building the task :param mode: TaskMode"""
self.... | the_stack_v2_python_sparse | src/pytorch_helper/launcher/launcher.py | Aaronswei/BEVNet | train | 0 | |
1c7b05ca8457dc2da93f2d69002f43eb0931cfcc | [
"if not ENABLE_TESTER:\n logger.info('禁止代理测试,退出')\n return\ntest_url = 'https://kyfw.12306.cn/otn/leftTicket/init?linktypeid=dc&fs=%E6%88%90%E9%83%BD,CDW&ts=%E5%8C%97%E4%BA%AC,BJP&date={}&flag=N,N,Y'.format(generate_tomorrow_date())\ntest = Test(test_url)\nloop = 0\nwhile True:\n logger.info('第{}次代理检测开始...... | <|body_start_0|>
if not ENABLE_TESTER:
logger.info('禁止代理测试,退出')
return
test_url = 'https://kyfw.12306.cn/otn/leftTicket/init?linktypeid=dc&fs=%E6%88%90%E9%83%BD,CDW&ts=%E5%8C%97%E4%BA%AC,BJP&date={}&flag=N,N,Y'.format(generate_tomorrow_date())
test = Test(test_url)
... | 代理池启动类 | StartProxyPool | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StartProxyPool:
"""代理池启动类"""
def run_tester(self, cycle=CYCLE_TESTER):
"""开始测试 :param cycle: 间隔时间 :return:"""
<|body_0|>
def run_getter(self, cycle=CYCLE_GETTER):
"""运行代理获取 :param cycle: :return:"""
<|body_1|>
def run_server(self):
"""开启web服务... | stack_v2_sparse_classes_36k_train_029268 | 3,162 | no_license | [
{
"docstring": "开始测试 :param cycle: 间隔时间 :return:",
"name": "run_tester",
"signature": "def run_tester(self, cycle=CYCLE_TESTER)"
},
{
"docstring": "运行代理获取 :param cycle: :return:",
"name": "run_getter",
"signature": "def run_getter(self, cycle=CYCLE_GETTER)"
},
{
"docstring": "开启w... | 4 | stack_v2_sparse_classes_30k_train_016034 | Implement the Python class `StartProxyPool` described below.
Class description:
代理池启动类
Method signatures and docstrings:
- def run_tester(self, cycle=CYCLE_TESTER): 开始测试 :param cycle: 间隔时间 :return:
- def run_getter(self, cycle=CYCLE_GETTER): 运行代理获取 :param cycle: :return:
- def run_server(self): 开启web服务 :return:
- def... | Implement the Python class `StartProxyPool` described below.
Class description:
代理池启动类
Method signatures and docstrings:
- def run_tester(self, cycle=CYCLE_TESTER): 开始测试 :param cycle: 间隔时间 :return:
- def run_getter(self, cycle=CYCLE_GETTER): 运行代理获取 :param cycle: :return:
- def run_server(self): 开启web服务 :return:
- def... | 6f138a7a4eaaa0892986be07232d68defeafaeb6 | <|skeleton|>
class StartProxyPool:
"""代理池启动类"""
def run_tester(self, cycle=CYCLE_TESTER):
"""开始测试 :param cycle: 间隔时间 :return:"""
<|body_0|>
def run_getter(self, cycle=CYCLE_GETTER):
"""运行代理获取 :param cycle: :return:"""
<|body_1|>
def run_server(self):
"""开启web服务... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StartProxyPool:
"""代理池启动类"""
def run_tester(self, cycle=CYCLE_TESTER):
"""开始测试 :param cycle: 间隔时间 :return:"""
if not ENABLE_TESTER:
logger.info('禁止代理测试,退出')
return
test_url = 'https://kyfw.12306.cn/otn/leftTicket/init?linktypeid=dc&fs=%E6%88%90%E9%83%BD,CDW... | the_stack_v2_python_sparse | ProxyPool/run.py | zeze-ya/12306Train_Info_Spider | train | 1 |
036ced2c0800b972a8e3c10523501538ff1f5496 | [
"if not name in self:\n self[name] = instance\nelse:\n raise RepeatError('The repeat name \"%s\" already exists! ' % name + 'If you are creating a new repeat, please use a different ' + 'name. If you are updating the repeat, please use ' + 'repeat.find(\"%s\").' % name)",
"try:\n del self[name]\nexcept K... | <|body_start_0|>
if not name in self:
self[name] = instance
else:
raise RepeatError('The repeat name "%s" already exists! ' % name + 'If you are creating a new repeat, please use a different ' + 'name. If you are updating the repeat, please use ' + 'repeat.find("%s").' % name)
<|... | Dictionary object that contains all repeat instances. The keys of the dictionary are the repeat names and the Repeat() instances are the values of the keys. | RepeatContainer | [
"Artistic-1.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RepeatContainer:
"""Dictionary object that contains all repeat instances. The keys of the dictionary are the repeat names and the Repeat() instances are the values of the keys."""
def add(self, name, instance):
"""Adds a repeat instance by name to the dictionary."""
<|body_0|... | stack_v2_sparse_classes_36k_train_029269 | 14,534 | permissive | [
{
"docstring": "Adds a repeat instance by name to the dictionary.",
"name": "add",
"signature": "def add(self, name, instance)"
},
{
"docstring": "Deletes a repeat instance by name from the container.",
"name": "delete",
"signature": "def delete(self, name)"
}
] | 2 | null | Implement the Python class `RepeatContainer` described below.
Class description:
Dictionary object that contains all repeat instances. The keys of the dictionary are the repeat names and the Repeat() instances are the values of the keys.
Method signatures and docstrings:
- def add(self, name, instance): Adds a repeat... | Implement the Python class `RepeatContainer` described below.
Class description:
Dictionary object that contains all repeat instances. The keys of the dictionary are the repeat names and the Repeat() instances are the values of the keys.
Method signatures and docstrings:
- def add(self, name, instance): Adds a repeat... | ebf4624626266f552189a32612b8d09cd5b4c5a3 | <|skeleton|>
class RepeatContainer:
"""Dictionary object that contains all repeat instances. The keys of the dictionary are the repeat names and the Repeat() instances are the values of the keys."""
def add(self, name, instance):
"""Adds a repeat instance by name to the dictionary."""
<|body_0|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RepeatContainer:
"""Dictionary object that contains all repeat instances. The keys of the dictionary are the repeat names and the Repeat() instances are the values of the keys."""
def add(self, name, instance):
"""Adds a repeat instance by name to the dictionary."""
if not name in self:
... | the_stack_v2_python_sparse | cstrike/addons/eventscripts/gungame51/core/repeat/repeat.py | GunGame-Dev-Team/GunGame51 | train | 0 |
2534acf354ab5ebfb8a9caac733a8fb79eca3fa5 | [
"self.hashmap = {}\nfor i in range(len(words)):\n if words[i] not in self.hashmap:\n self.hashmap[words[i]] = []\n self.hashmap[words[i]].append(i)",
"pos1 = self.hashmap[word1]\npos2 = self.hashmap[word2]\ni = 0\nj = 0\ndis = sys.maxint\nwhile i < len(pos1) and j < len(pos2):\n diff = pos1[i] - p... | <|body_start_0|>
self.hashmap = {}
for i in range(len(words)):
if words[i] not in self.hashmap:
self.hashmap[words[i]] = []
self.hashmap[words[i]].append(i)
<|end_body_0|>
<|body_start_1|>
pos1 = self.hashmap[word1]
pos2 = self.hashmap[word2]
... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.hashmap = {}
for i in ra... | stack_v2_sparse_classes_36k_train_029270 | 4,963 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004003 | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance:
... | 4b3944ae13ccf20e9df252f3c434f6600878293c | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
self.hashmap = {}
for i in range(len(words)):
if words[i] not in self.hashmap:
self.hashmap[words[i]] = []
self.hashmap[words[i]].append(i)
def shortest(self, word1, word2... | the_stack_v2_python_sparse | shortest_word_distance_i_ii_iii.py | jingjinghaha/LeetCode | train | 0 | |
e21be80cf04e9ace8d262e9acf0e57f2ba72f4fd | [
"try:\n from pymc.model import Model\n model = Model.get_context()\nexcept TypeError:\n raise TypeError(\"No model on context stack, which is needed to instantiate distributions. Add variable inside a 'with model:' block, or use the '.dist' syntax for a standalone distribution.\")\nif 'testval' in kwargs:\... | <|body_start_0|>
try:
from pymc.model import Model
model = Model.get_context()
except TypeError:
raise TypeError("No model on context stack, which is needed to instantiate distributions. Add variable inside a 'with model:' block, or use the '.dist' syntax for a standa... | Statistical distribution | Distribution | [
"Apache-2.0",
"AFL-2.1",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Distribution:
"""Statistical distribution"""
def __new__(cls, name: str, *args, rng=None, dims: Optional[Dims]=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs) -> TensorVariable:
"""Adds a tensor variable corresponding to a PyMC distribution to the curre... | stack_v2_sparse_classes_36k_train_029271 | 46,281 | permissive | [
{
"docstring": "Adds a tensor variable corresponding to a PyMC distribution to the current model. Note that all remaining kwargs must be compatible with ``.dist()`` Parameters ---------- cls : type A PyMC distribution. name : str Name for the new model variable. rng : optional Random number generator to use wit... | 2 | stack_v2_sparse_classes_30k_train_003540 | Implement the Python class `Distribution` described below.
Class description:
Statistical distribution
Method signatures and docstrings:
- def __new__(cls, name: str, *args, rng=None, dims: Optional[Dims]=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs) -> TensorVariable: Adds a tensor v... | Implement the Python class `Distribution` described below.
Class description:
Statistical distribution
Method signatures and docstrings:
- def __new__(cls, name: str, *args, rng=None, dims: Optional[Dims]=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs) -> TensorVariable: Adds a tensor v... | ddd1d4bf05a72895c67265f541585ae02bd338a3 | <|skeleton|>
class Distribution:
"""Statistical distribution"""
def __new__(cls, name: str, *args, rng=None, dims: Optional[Dims]=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs) -> TensorVariable:
"""Adds a tensor variable corresponding to a PyMC distribution to the curre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Distribution:
"""Statistical distribution"""
def __new__(cls, name: str, *args, rng=None, dims: Optional[Dims]=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs) -> TensorVariable:
"""Adds a tensor variable corresponding to a PyMC distribution to the current model. Not... | the_stack_v2_python_sparse | pymc/distributions/distribution.py | pymc-devs/pymc | train | 1,046 |
88597ecab3622e17f809b0f2e7c1a6f00c6a8022 | [
"self.issuer_name = issuer_name\nself.subject_name = subject_name\nself.valid_from_date = APIHelper.RFC3339DateTime(valid_from_date) if valid_from_date else None\nself.valid_to_date = APIHelper.RFC3339DateTime(valid_to_date) if valid_to_date else None\nself.version_number = version_number\nself.serial_number = seri... | <|body_start_0|>
self.issuer_name = issuer_name
self.subject_name = subject_name
self.valid_from_date = APIHelper.RFC3339DateTime(valid_from_date) if valid_from_date else None
self.valid_to_date = APIHelper.RFC3339DateTime(valid_to_date) if valid_to_date else None
self.version_nu... | Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO: type description here. version_number ... | Certificate | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Certificate:
"""Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO:... | stack_v2_sparse_classes_36k_train_029272 | 8,051 | permissive | [
{
"docstring": "Constructor for the Certificate class",
"name": "__init__",
"signature": "def __init__(self, issuer_name=None, subject_name=None, valid_from_date=None, valid_to_date=None, version_number=None, serial_number=None, key_algorithm=None, key_size=None, unique_id=None, originator=None, bank_na... | 2 | stack_v2_sparse_classes_30k_train_014897 | Implement the Python class `Certificate` described below.
Class description:
Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type descriptio... | Implement the Python class `Certificate` described below.
Class description:
Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type descriptio... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Certificate:
"""Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Certificate:
"""Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO: type descrip... | the_stack_v2_python_sparse | idfy_rest_client/models/certificate.py | dealflowteam/Idfy | train | 0 |
c45493bda1bccf04b4e6a9d4b3e96b093b7eddb9 | [
"if isinstance(part, Permutation) and part.parent() is P:\n elt = part\n part = elt.cycle_type()\nelse:\n elt = P.element_in_conjugacy_classes(part)\nSymmetricGroupConjugacyClassMixin.__init__(self, range(1, P.n + 1), part)\nConjugacyClass.__init__(self, P, elt)",
"if self._set:\n for x in self._set:\... | <|body_start_0|>
if isinstance(part, Permutation) and part.parent() is P:
elt = part
part = elt.cycle_type()
else:
elt = P.element_in_conjugacy_classes(part)
SymmetricGroupConjugacyClassMixin.__init__(self, range(1, P.n + 1), part)
ConjugacyClass.__ini... | A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P`` | PermutationsConjugacyClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PermutationsConjugacyClass:
"""A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``"""
def __init__(self, P, part):
"""Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5... | stack_v2_sparse_classes_36k_train_029273 | 10,400 | no_license | [
{
"docstring": "Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5, 3]) sage: C = G.conjugacy_class(g) sage: TestSuite(C).run() sage: C = G.conjugacy_class(Partition([3,2])) sage: TestSuite(C).run()",
"name": "__init__",
"signature": "def __init__(self, P, part)"
},
{
... | 3 | null | Implement the Python class `PermutationsConjugacyClass` described below.
Class description:
A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``
Method signatures and docstrings:
- def __init__(self, P, part): Initialize ``self``. EXA... | Implement the Python class `PermutationsConjugacyClass` described below.
Class description:
A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``
Method signatures and docstrings:
- def __init__(self, P, part): Initialize ``self``. EXA... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class PermutationsConjugacyClass:
"""A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``"""
def __init__(self, P, part):
"""Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PermutationsConjugacyClass:
"""A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``"""
def __init__(self, P, part):
"""Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5, 3]) sage: C... | the_stack_v2_python_sparse | sage/src/sage/groups/perm_gps/symgp_conjugacy_class.py | bopopescu/geosci | train | 0 |
5a63eb6abb4d161f5769fd78e873a495c24e8159 | [
"kwargs_options = {'lens_model_list': profile_list}\nself.model = SinglePlane(profile_list)\nself.cosmo = Cosmo(kwargs_cosmo)\nself._interp_grid_num = kwargs_numerics.get('interpol_grid_num', 1000)\nself._max_interpolate = kwargs_numerics.get('max_integrate', 100)\nself._min_interpolate = kwargs_numerics.get('min_i... | <|body_start_0|>
kwargs_options = {'lens_model_list': profile_list}
self.model = SinglePlane(profile_list)
self.cosmo = Cosmo(kwargs_cosmo)
self._interp_grid_num = kwargs_numerics.get('interpol_grid_num', 1000)
self._max_interpolate = kwargs_numerics.get('max_integrate', 100)
... | mass profile class | MassProfile | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MassProfile:
"""mass profile class"""
def __init__(self, profile_list, kwargs_cosmo={'D_d': 1000, 'D_s': 2000, 'D_ds': 500}, kwargs_numerics={}):
""":param profile_list:"""
<|body_0|>
def mass_3d_interp(self, r, kwargs, new_compute=False):
""":param r: in arc sec... | stack_v2_sparse_classes_36k_train_029274 | 2,303 | permissive | [
{
"docstring": ":param profile_list:",
"name": "__init__",
"signature": "def __init__(self, profile_list, kwargs_cosmo={'D_d': 1000, 'D_s': 2000, 'D_ds': 500}, kwargs_numerics={})"
},
{
"docstring": ":param r: in arc seconds :param kwargs: lens model parameters in arc seconds :return: mass enclo... | 3 | stack_v2_sparse_classes_30k_train_004829 | Implement the Python class `MassProfile` described below.
Class description:
mass profile class
Method signatures and docstrings:
- def __init__(self, profile_list, kwargs_cosmo={'D_d': 1000, 'D_s': 2000, 'D_ds': 500}, kwargs_numerics={}): :param profile_list:
- def mass_3d_interp(self, r, kwargs, new_compute=False):... | Implement the Python class `MassProfile` described below.
Class description:
mass profile class
Method signatures and docstrings:
- def __init__(self, profile_list, kwargs_cosmo={'D_d': 1000, 'D_s': 2000, 'D_ds': 500}, kwargs_numerics={}): :param profile_list:
- def mass_3d_interp(self, r, kwargs, new_compute=False):... | dcdfc61ce5351ac94565228c822f1c94392c1ad6 | <|skeleton|>
class MassProfile:
"""mass profile class"""
def __init__(self, profile_list, kwargs_cosmo={'D_d': 1000, 'D_s': 2000, 'D_ds': 500}, kwargs_numerics={}):
""":param profile_list:"""
<|body_0|>
def mass_3d_interp(self, r, kwargs, new_compute=False):
""":param r: in arc sec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MassProfile:
"""mass profile class"""
def __init__(self, profile_list, kwargs_cosmo={'D_d': 1000, 'D_s': 2000, 'D_ds': 500}, kwargs_numerics={}):
""":param profile_list:"""
kwargs_options = {'lens_model_list': profile_list}
self.model = SinglePlane(profile_list)
self.cosmo... | the_stack_v2_python_sparse | lenstronomy/GalKin/mass_profile.py | guoxiaowhu/lenstronomy | train | 1 |
c9b0b92f98ed1ac2144e9a76fc40dd338b2f5284 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Shared Criterion service. Service to manage shared criteria. | SharedCriterionServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SharedCriterionServiceServicer:
"""Proto file describing the Shared Criterion service. Service to manage shared criteria."""
def GetSharedCriterion(self, request, context):
"""Returns the requested shared criterion in full detail."""
<|body_0|>
def MutateSharedCriteria(s... | stack_v2_sparse_classes_36k_train_029275 | 3,500 | permissive | [
{
"docstring": "Returns the requested shared criterion in full detail.",
"name": "GetSharedCriterion",
"signature": "def GetSharedCriterion(self, request, context)"
},
{
"docstring": "Creates or removes shared criteria. Operation statuses are returned.",
"name": "MutateSharedCriteria",
"... | 2 | stack_v2_sparse_classes_30k_train_009138 | Implement the Python class `SharedCriterionServiceServicer` described below.
Class description:
Proto file describing the Shared Criterion service. Service to manage shared criteria.
Method signatures and docstrings:
- def GetSharedCriterion(self, request, context): Returns the requested shared criterion in full deta... | Implement the Python class `SharedCriterionServiceServicer` described below.
Class description:
Proto file describing the Shared Criterion service. Service to manage shared criteria.
Method signatures and docstrings:
- def GetSharedCriterion(self, request, context): Returns the requested shared criterion in full deta... | 0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a | <|skeleton|>
class SharedCriterionServiceServicer:
"""Proto file describing the Shared Criterion service. Service to manage shared criteria."""
def GetSharedCriterion(self, request, context):
"""Returns the requested shared criterion in full detail."""
<|body_0|>
def MutateSharedCriteria(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SharedCriterionServiceServicer:
"""Proto file describing the Shared Criterion service. Service to manage shared criteria."""
def GetSharedCriterion(self, request, context):
"""Returns the requested shared criterion in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
... | the_stack_v2_python_sparse | google/ads/google_ads/v2/proto/services/shared_criterion_service_pb2_grpc.py | juanmacugat/google-ads-python | train | 1 |
294d42ce23b723b711cfcff4b228dc1fb90f2d6d | [
"super(ConvNetScatter, self).__init__()\nself.output_size = dict_args['output_size']\nself.bn_momentum = dict_args['bn_momentum']\nself.layer1 = nn.Conv2d(in_channels=1, out_channels=128, kernel_size=(1, 11), stride=(1, 1), padding=(0, 5), bias=False)\nself.pool1 = nn.MaxPool2d(kernel_size=(441, 1))\nself.batchnorm... | <|body_start_0|>
super(ConvNetScatter, self).__init__()
self.output_size = dict_args['output_size']
self.bn_momentum = dict_args['bn_momentum']
self.layer1 = nn.Conv2d(in_channels=1, out_channels=128, kernel_size=(1, 11), stride=(1, 1), padding=(0, 5), bias=False)
self.pool1 = nn... | ConvNet used on data prepared with scattering transform. | ConvNetScatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvNetScatter:
"""ConvNet used on data prepared with scattering transform."""
def __init__(self, dict_args):
"""Initialize ConvNetScatter. Args dict_args: dictionary containing the following keys: output_size: the output size of the network. Corresponds to the embedding dimension of... | stack_v2_sparse_classes_36k_train_029276 | 3,931 | no_license | [
{
"docstring": "Initialize ConvNetScatter. Args dict_args: dictionary containing the following keys: output_size: the output size of the network. Corresponds to the embedding dimension of the feature vectors for both users and songs. bn_momentum: momentum for batch normalization.",
"name": "__init__",
"... | 2 | stack_v2_sparse_classes_30k_train_016758 | Implement the Python class `ConvNetScatter` described below.
Class description:
ConvNet used on data prepared with scattering transform.
Method signatures and docstrings:
- def __init__(self, dict_args): Initialize ConvNetScatter. Args dict_args: dictionary containing the following keys: output_size: the output size ... | Implement the Python class `ConvNetScatter` described below.
Class description:
ConvNet used on data prepared with scattering transform.
Method signatures and docstrings:
- def __init__(self, dict_args): Initialize ConvNetScatter. Args dict_args: dictionary containing the following keys: output_size: the output size ... | 55a62c62d26534f3f1a0d7d529cc79d4796680a1 | <|skeleton|>
class ConvNetScatter:
"""ConvNet used on data prepared with scattering transform."""
def __init__(self, dict_args):
"""Initialize ConvNetScatter. Args dict_args: dictionary containing the following keys: output_size: the output size of the network. Corresponds to the embedding dimension of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvNetScatter:
"""ConvNet used on data prepared with scattering transform."""
def __init__(self, dict_args):
"""Initialize ConvNetScatter. Args dict_args: dictionary containing the following keys: output_size: the output size of the network. Corresponds to the embedding dimension of the feature ... | the_stack_v2_python_sparse | dc/dcue/audiomodels/convscat2d.py | yamato2199/DeepContentRecommenders | train | 1 |
75772a0ce689e28f494ed9caa33d43ade6411f11 | [
"self.settings = settings\nself.results = ResultSet()\nself.seq = SequenceNumber()\nself.exp_durations = collections.deque(maxlen=30)\nself.n_success = 0\nself.n_fail = 0\nself.summary_freq = summary_freq\nself._stop = False\nif self.settings.PARALLEL_EXECUTION:\n self.pool = mp.Pool(settings.N_PROCESSES)",
"l... | <|body_start_0|>
self.settings = settings
self.results = ResultSet()
self.seq = SequenceNumber()
self.exp_durations = collections.deque(maxlen=30)
self.n_success = 0
self.n_fail = 0
self.summary_freq = summary_freq
self._stop = False
if self.settin... | Orchestrator. It is responsible for orchestrating the execution of all experiments and aggregate results. | Orchestrator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Orchestrator:
"""Orchestrator. It is responsible for orchestrating the execution of all experiments and aggregate results."""
def __init__(self, settings, summary_freq=4):
"""Constructor Parameters ---------- settings : Settings The settings of the simulator summary_freq : int Freque... | stack_v2_sparse_classes_36k_train_029277 | 12,065 | permissive | [
{
"docstring": "Constructor Parameters ---------- settings : Settings The settings of the simulator summary_freq : int Frequency (in number of experiment) at which summary messages are displayed",
"name": "__init__",
"signature": "def __init__(self, settings, summary_freq=4)"
},
{
"docstring": "... | 4 | stack_v2_sparse_classes_30k_train_015877 | Implement the Python class `Orchestrator` described below.
Class description:
Orchestrator. It is responsible for orchestrating the execution of all experiments and aggregate results.
Method signatures and docstrings:
- def __init__(self, settings, summary_freq=4): Constructor Parameters ---------- settings : Setting... | Implement the Python class `Orchestrator` described below.
Class description:
Orchestrator. It is responsible for orchestrating the execution of all experiments and aggregate results.
Method signatures and docstrings:
- def __init__(self, settings, summary_freq=4): Constructor Parameters ---------- settings : Setting... | b7bb9f9b8d0f27b4b01469dcba9cfc0c4949d64b | <|skeleton|>
class Orchestrator:
"""Orchestrator. It is responsible for orchestrating the execution of all experiments and aggregate results."""
def __init__(self, settings, summary_freq=4):
"""Constructor Parameters ---------- settings : Settings The settings of the simulator summary_freq : int Freque... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Orchestrator:
"""Orchestrator. It is responsible for orchestrating the execution of all experiments and aggregate results."""
def __init__(self, settings, summary_freq=4):
"""Constructor Parameters ---------- settings : Settings The settings of the simulator summary_freq : int Frequency (in numbe... | the_stack_v2_python_sparse | icarus/orchestration.py | oascigil/IcarusEdgeSim | train | 7 |
9e851ef5e878531e822063c971e1ab23977008ff | [
"if fullname in _PRECISION_DICT:\n return _hook\nreturn None",
"ret = [(PRI_MED, file.fullname, -1)]\nif file.fullname == 'numpy':\n _override_imports(file, 'numpy._typing._extended_precision', imports=[(v, v) for v in _EXTENDED_PRECISION_LIST])\nelif file.fullname == 'numpy.ctypeslib':\n _override_impor... | <|body_start_0|>
if fullname in _PRECISION_DICT:
return _hook
return None
<|end_body_0|>
<|body_start_1|>
ret = [(PRI_MED, file.fullname, -1)]
if file.fullname == 'numpy':
_override_imports(file, 'numpy._typing._extended_precision', imports=[(v, v) for v in _EXTE... | A mypy plugin for handling versus numpy-specific typing tasks. | _NumpyPlugin | [
"Zlib",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _NumpyPlugin:
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc:
"""Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdoubl... | stack_v2_sparse_classes_36k_train_029278 | 6,376 | permissive | [
{
"docstring": "Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`.",
"name": "get_type_analyze_hook",
"signature": "def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc"
},
{
"docstring": "Handle all... | 2 | stack_v2_sparse_classes_30k_train_013252 | Implement the Python class `_NumpyPlugin` described below.
Class description:
A mypy plugin for handling versus numpy-specific typing tasks.
Method signatures and docstrings:
- def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc: Set the precision of platform-specific `numpy.number` subclasses. For exa... | Implement the Python class `_NumpyPlugin` described below.
Class description:
A mypy plugin for handling versus numpy-specific typing tasks.
Method signatures and docstrings:
- def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc: Set the precision of platform-specific `numpy.number` subclasses. For exa... | dc2ff125493777a1084044e6cd6857a42ee323d4 | <|skeleton|>
class _NumpyPlugin:
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc:
"""Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdoubl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _NumpyPlugin:
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc:
"""Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`."""
... | the_stack_v2_python_sparse | numpy/typing/mypy_plugin.py | numpy/numpy | train | 25,725 |
fa301fa0fb17209ed56fab2450a499942fd6eb41 | [
"self.control = QtGui.QCalendarWidget()\nif not self.factory.allow_future:\n self.control.setMaximumDate(QtCore.QDate.currentDate())\nself.control.clicked.connect(self.update_object)",
"value = self.value\nif value:\n q_date = QtCore.QDate(value.year, value.month, value.day)\n self.control.setSelectedDat... | <|body_start_0|>
self.control = QtGui.QCalendarWidget()
if not self.factory.allow_future:
self.control.setMaximumDate(QtCore.QDate.currentDate())
self.control.clicked.connect(self.update_object)
<|end_body_0|>
<|body_start_1|>
value = self.value
if value:
... | Custom Traits UI date editor that wraps QCalendarWidget. | CustomEditor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomEditor:
"""Custom Traits UI date editor that wraps QCalendarWidget."""
def init(self, parent):
"""Finishes initializing the editor by creating the underlying toolkit widget."""
<|body_0|>
def update_editor(self):
"""Updates the editor when the object trait ... | stack_v2_sparse_classes_36k_train_029279 | 6,787 | no_license | [
{
"docstring": "Finishes initializing the editor by creating the underlying toolkit widget.",
"name": "init",
"signature": "def init(self, parent)"
},
{
"docstring": "Updates the editor when the object trait changes externally to the editor.",
"name": "update_editor",
"signature": "def u... | 3 | null | Implement the Python class `CustomEditor` described below.
Class description:
Custom Traits UI date editor that wraps QCalendarWidget.
Method signatures and docstrings:
- def init(self, parent): Finishes initializing the editor by creating the underlying toolkit widget.
- def update_editor(self): Updates the editor w... | Implement the Python class `CustomEditor` described below.
Class description:
Custom Traits UI date editor that wraps QCalendarWidget.
Method signatures and docstrings:
- def init(self, parent): Finishes initializing the editor by creating the underlying toolkit widget.
- def update_editor(self): Updates the editor w... | b5059e7f121e4abb6888893f91f95dd79aed9ca4 | <|skeleton|>
class CustomEditor:
"""Custom Traits UI date editor that wraps QCalendarWidget."""
def init(self, parent):
"""Finishes initializing the editor by creating the underlying toolkit widget."""
<|body_0|>
def update_editor(self):
"""Updates the editor when the object trait ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomEditor:
"""Custom Traits UI date editor that wraps QCalendarWidget."""
def init(self, parent):
"""Finishes initializing the editor by creating the underlying toolkit widget."""
self.control = QtGui.QCalendarWidget()
if not self.factory.allow_future:
self.control.... | the_stack_v2_python_sparse | venv/Lib/site-packages/traitsui/qt4/date_editor.py | GenomePhD/Bio1-HIV | train | 0 |
be1739099bff7d7a5fb7a95f013e453d0c705d3f | [
"n = len(nums)\nif n < 2:\n return n\ndp = [1 for _ in range(n)]\nfor i in range(1, n):\n for j in range(i):\n if j < i and nums[j] < nums[i]:\n dp[i] = max(dp[j] + 1, dp[i])\nres = max(dp)\nreturn res",
"n = len(nums)\nif n < 2:\n return n\ncell = []\nfor num in nums:\n if not cell ... | <|body_start_0|>
n = len(nums)
if n < 2:
return n
dp = [1 for _ in range(n)]
for i in range(1, n):
for j in range(i):
if j < i and nums[j] < nums[i]:
dp[i] = max(dp[j] + 1, dp[i])
res = max(dp)
return res
<|end_b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
"""固定i 看[0,i]区间 如果nums[i]>nums[j],dp[i] = max(dp[i], dp[i] + 1) 取最大 :param nums: list :return: int"""
<|body_0|>
def lengthOfLIS_v2(self, nums):
"""利用贪心算法+二分查找 整体思路, 创建一个cell的列表,用于保存最长上升子序列 遍历数组 如果当前元素大于最后一个位置的元素,则插入cell 否则,利用二分... | stack_v2_sparse_classes_36k_train_029280 | 2,782 | no_license | [
{
"docstring": "固定i 看[0,i]区间 如果nums[i]>nums[j],dp[i] = max(dp[i], dp[i] + 1) 取最大 :param nums: list :return: int",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums)"
},
{
"docstring": "利用贪心算法+二分查找 整体思路, 创建一个cell的列表,用于保存最长上升子序列 遍历数组 如果当前元素大于最后一个位置的元素,则插入cell 否则,利用二分查找,将当前元素插入cell中,大... | 2 | stack_v2_sparse_classes_30k_val_000156 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums): 固定i 看[0,i]区间 如果nums[i]>nums[j],dp[i] = max(dp[i], dp[i] + 1) 取最大 :param nums: list :return: int
- def lengthOfLIS_v2(self, nums): 利用贪心算法+二分查找 整体思路, 创... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums): 固定i 看[0,i]区间 如果nums[i]>nums[j],dp[i] = max(dp[i], dp[i] + 1) 取最大 :param nums: list :return: int
- def lengthOfLIS_v2(self, nums): 利用贪心算法+二分查找 整体思路, 创... | f1bbd6b3197cd9ac4f0d35a37539c11b02272065 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
"""固定i 看[0,i]区间 如果nums[i]>nums[j],dp[i] = max(dp[i], dp[i] + 1) 取最大 :param nums: list :return: int"""
<|body_0|>
def lengthOfLIS_v2(self, nums):
"""利用贪心算法+二分查找 整体思路, 创建一个cell的列表,用于保存最长上升子序列 遍历数组 如果当前元素大于最后一个位置的元素,则插入cell 否则,利用二分... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS(self, nums):
"""固定i 看[0,i]区间 如果nums[i]>nums[j],dp[i] = max(dp[i], dp[i] + 1) 取最大 :param nums: list :return: int"""
n = len(nums)
if n < 2:
return n
dp = [1 for _ in range(n)]
for i in range(1, n):
for j in range(i):
... | the_stack_v2_python_sparse | leetcode/动态规划/300. 最长上升子序列/lengthOfLIS.py | guohaoyuan/algorithms-for-work | train | 2 | |
7dc0c34e77219355e4df243a2e90735d469c3c04 | [
"mediawiki_index_url = str(mediawiki_index_url or config['MEDIAWIKI_INDEX_URL'])\nif access_token and access_secret:\n session = OAuth1Session(client_key=consumer_token, client_secret=consumer_secret, resource_owner_key=access_token, resource_owner_secret=access_secret)\n super().__init__(session=session, tok... | <|body_start_0|>
mediawiki_index_url = str(mediawiki_index_url or config['MEDIAWIKI_INDEX_URL'])
if access_token and access_secret:
session = OAuth1Session(client_key=consumer_token, client_secret=consumer_secret, resource_owner_key=access_token, resource_owner_secret=access_secret)
... | OAuth1 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OAuth1:
def __init__(self, consumer_token: Optional[str]=None, consumer_secret: Optional[str]=None, access_token: Optional[str]=None, access_secret: Optional[str]=None, callback_url: str='oob', mediawiki_api_url: Optional[str]=None, mediawiki_index_url: Optional[str]=None, token_renew_period: in... | stack_v2_sparse_classes_36k_train_029281 | 13,808 | permissive | [
{
"docstring": "This class is used to interact with the OAuth1 API. :param consumer_token: The consumer token :param consumer_secret: The consumer secret :param access_token: The access token (optional ) :param access_secret: The access secret (optional) :param callback_url: The callback URL used to finalize th... | 2 | stack_v2_sparse_classes_30k_train_015591 | Implement the Python class `OAuth1` described below.
Class description:
Implement the OAuth1 class.
Method signatures and docstrings:
- def __init__(self, consumer_token: Optional[str]=None, consumer_secret: Optional[str]=None, access_token: Optional[str]=None, access_secret: Optional[str]=None, callback_url: str='oo... | Implement the Python class `OAuth1` described below.
Class description:
Implement the OAuth1 class.
Method signatures and docstrings:
- def __init__(self, consumer_token: Optional[str]=None, consumer_secret: Optional[str]=None, access_token: Optional[str]=None, access_secret: Optional[str]=None, callback_url: str='oo... | bec2cb079cf61edf8248120054e673a00e50f457 | <|skeleton|>
class OAuth1:
def __init__(self, consumer_token: Optional[str]=None, consumer_secret: Optional[str]=None, access_token: Optional[str]=None, access_secret: Optional[str]=None, callback_url: str='oob', mediawiki_api_url: Optional[str]=None, mediawiki_index_url: Optional[str]=None, token_renew_period: in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OAuth1:
def __init__(self, consumer_token: Optional[str]=None, consumer_secret: Optional[str]=None, access_token: Optional[str]=None, access_secret: Optional[str]=None, callback_url: str='oob', mediawiki_api_url: Optional[str]=None, mediawiki_index_url: Optional[str]=None, token_renew_period: int=1800, user_a... | the_stack_v2_python_sparse | wikibaseintegrator/wbi_login.py | LeMyst/WikibaseIntegrator | train | 56 | |
dfda78681fe7f41c8f6aecdce8fffbffdbf9448f | [
"self.model = model\nself.feature_names = feature_names\nself.feature_types = feature_types",
"if name is None:\n name = gen_name_from_class(self)\ny = clean_dimensions(y, 'y')\nif y.ndim != 1:\n raise ValueError('y must be 1 dimensional')\nX, n_samples = preclean_X(X, self.feature_names, self.feature_types... | <|body_start_0|>
self.model = model
self.feature_names = feature_names
self.feature_types = feature_types
<|end_body_0|>
<|body_start_1|>
if name is None:
name = gen_name_from_class(self)
y = clean_dimensions(y, 'y')
if y.ndim != 1:
raise ValueErr... | Produces variety of regression metrics (including RMSE, R^2, etc). | RegressionPerf | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegressionPerf:
"""Produces variety of regression metrics (including RMSE, R^2, etc)."""
def __init__(self, model, feature_names=None, feature_types=None):
"""Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regres... | stack_v2_sparse_classes_36k_train_029282 | 5,223 | permissive | [
{
"docstring": "Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature_names: List of feature names. feature_types: List of feature types.",
"name": "__init__",
"signature": "def __init__(self, model, feature_names=None,... | 2 | stack_v2_sparse_classes_30k_train_011668 | Implement the Python class `RegressionPerf` described below.
Class description:
Produces variety of regression metrics (including RMSE, R^2, etc).
Method signatures and docstrings:
- def __init__(self, model, feature_names=None, feature_types=None): Initializes class. Args: model: model or prediction function of mode... | Implement the Python class `RegressionPerf` described below.
Class description:
Produces variety of regression metrics (including RMSE, R^2, etc).
Method signatures and docstrings:
- def __init__(self, model, feature_names=None, feature_types=None): Initializes class. Args: model: model or prediction function of mode... | e6f38ea195aecbbd9d28c7183a83c65ada16e1ae | <|skeleton|>
class RegressionPerf:
"""Produces variety of regression metrics (including RMSE, R^2, etc)."""
def __init__(self, model, feature_names=None, feature_types=None):
"""Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regres... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegressionPerf:
"""Produces variety of regression metrics (including RMSE, R^2, etc)."""
def __init__(self, model, feature_names=None, feature_types=None):
"""Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature... | the_stack_v2_python_sparse | python/interpret-core/interpret/perf/_regression.py | interpretml/interpret | train | 3,731 |
b6f108f4282d5ad06959fbd37199846101714d23 | [
"if isinstance(image, Image):\n image = image.id\n_ = command\n_ = stdout\n_ = stderr\n_ = remove\n_ = kwargs\nraise NotImplementedError",
"if isinstance(image, Image):\n image = image.id\n_ = kwargs\n_ = command\nraise NotImplementedError",
"container_id = urllib.parse.quote_plus(container_id)\nresponse ... | <|body_start_0|>
if isinstance(image, Image):
image = image.id
_ = command
_ = stdout
_ = stderr
_ = remove
_ = kwargs
raise NotImplementedError
<|end_body_0|>
<|body_start_1|>
if isinstance(image, Image):
image = image.id
... | Specialized Manager for Container resources. Attributes: resource: Container subclass of PodmanResource, factory method will create these. | ContainersManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainersManager:
"""Specialized Manager for Container resources. Attributes: resource: Container subclass of PodmanResource, factory method will create these."""
def run(self, image: Union[str, Image], command: Union[str, List[str]]=None, stdout=True, stderr=False, remove: bool=False, **kw... | stack_v2_sparse_classes_36k_train_029283 | 18,303 | permissive | [
{
"docstring": "Run container. By default, run() will wait for the container to finish and return its logs. If detach=True, run() will start the container and return a Container object rather than logs. Args: image: Image to run. command: Command to run in the container. stdout: Include stdout. Default: True. s... | 5 | stack_v2_sparse_classes_30k_train_013114 | Implement the Python class `ContainersManager` described below.
Class description:
Specialized Manager for Container resources. Attributes: resource: Container subclass of PodmanResource, factory method will create these.
Method signatures and docstrings:
- def run(self, image: Union[str, Image], command: Union[str, ... | Implement the Python class `ContainersManager` described below.
Class description:
Specialized Manager for Container resources. Attributes: resource: Container subclass of PodmanResource, factory method will create these.
Method signatures and docstrings:
- def run(self, image: Union[str, Image], command: Union[str, ... | 2788e93ec49f95461d639c1e8c86fc8857fa2a85 | <|skeleton|>
class ContainersManager:
"""Specialized Manager for Container resources. Attributes: resource: Container subclass of PodmanResource, factory method will create these."""
def run(self, image: Union[str, Image], command: Union[str, List[str]]=None, stdout=True, stderr=False, remove: bool=False, **kw... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContainersManager:
"""Specialized Manager for Container resources. Attributes: resource: Container subclass of PodmanResource, factory method will create these."""
def run(self, image: Union[str, Image], command: Union[str, List[str]]=None, stdout=True, stderr=False, remove: bool=False, **kwargs) -> Unio... | the_stack_v2_python_sparse | podman/domain/containers_manager.py | P-a-t-r-i-c-k/podman-py | train | 0 |
91241417e91b8a06b56036d2f108d1473c1acd95 | [
"super().__init__(fmc, **kwargs)\nlogging.debug('In __init__() for DNSServerGroups class.')\nself.parse_kwargs(**kwargs)\nself.type = 'DNSServerGroupObject'",
"logging.debug('In servers() for DNSServerGroups class.')\nif action == 'add':\n for name_server in name_servers:\n if 'dnsservers' in self.__dic... | <|body_start_0|>
super().__init__(fmc, **kwargs)
logging.debug('In __init__() for DNSServerGroups class.')
self.parse_kwargs(**kwargs)
self.type = 'DNSServerGroupObject'
<|end_body_0|>
<|body_start_1|>
logging.debug('In servers() for DNSServerGroups class.')
if action ==... | The DNSServerGroups Object in the FMC. | DNSServerGroups | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DNSServerGroups:
"""The DNSServerGroups Object in the FMC."""
def __init__(self, fmc, **kwargs):
"""Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantia... | stack_v2_sparse_classes_36k_train_029284 | 2,479 | permissive | [
{
"docstring": "Initialize DNSServerGroups object. Set self.type to \"DNSServerGroupObject\" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return: None",
"name": "__init__",
"signature": "def __init__(self, fmc, **kwargs)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_021097 | Implement the Python class `DNSServerGroups` described below.
Class description:
The DNSServerGroups Object in the FMC.
Method signatures and docstrings:
- def __init__(self, fmc, **kwargs): Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC objec... | Implement the Python class `DNSServerGroups` described below.
Class description:
The DNSServerGroups Object in the FMC.
Method signatures and docstrings:
- def __init__(self, fmc, **kwargs): Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC objec... | fd924de96e200ca8e0d5088b27a5abaf6f915bc6 | <|skeleton|>
class DNSServerGroups:
"""The DNSServerGroups Object in the FMC."""
def __init__(self, fmc, **kwargs):
"""Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantia... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DNSServerGroups:
"""The DNSServerGroups Object in the FMC."""
def __init__(self, fmc, **kwargs):
"""Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return... | the_stack_v2_python_sparse | fmcapi/api_objects/object_services/dnsservergroups.py | banzigaga/fmcapi | train | 1 |
f573312c2415968fb8c67a3b5f979d0913775d68 | [
"if request.path.startswith(htk_setting('HTK_PATH_ADMIN')) or request.path.startswith(htk_setting('HTK_PATH_ADMINTOOLS')):\n pass\nelse:\n user_id = request.COOKIES.get('emulate_user_id')\n username = request.COOKIES.get('emulate_user_username')\n request_emulate_user(request, user_id=user_id, username=... | <|body_start_0|>
if request.path.startswith(htk_setting('HTK_PATH_ADMIN')) or request.path.startswith(htk_setting('HTK_PATH_ADMINTOOLS')):
pass
else:
user_id = request.COOKIES.get('emulate_user_id')
username = request.COOKIES.get('emulate_user_username')
r... | HtkEmulateUserMiddleware | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HtkEmulateUserMiddleware:
def process_request(self, request):
"""Replace the authenticated `request.user` if properly emulating"""
<|body_0|>
def process_response(self, request, response):
"""Delete user emulation cookies if they should not be set"""
<|body_1... | stack_v2_sparse_classes_36k_train_029285 | 1,446 | permissive | [
{
"docstring": "Replace the authenticated `request.user` if properly emulating",
"name": "process_request",
"signature": "def process_request(self, request)"
},
{
"docstring": "Delete user emulation cookies if they should not be set",
"name": "process_response",
"signature": "def process... | 2 | null | Implement the Python class `HtkEmulateUserMiddleware` described below.
Class description:
Implement the HtkEmulateUserMiddleware class.
Method signatures and docstrings:
- def process_request(self, request): Replace the authenticated `request.user` if properly emulating
- def process_response(self, request, response)... | Implement the Python class `HtkEmulateUserMiddleware` described below.
Class description:
Implement the HtkEmulateUserMiddleware class.
Method signatures and docstrings:
- def process_request(self, request): Replace the authenticated `request.user` if properly emulating
- def process_response(self, request, response)... | 935c4913e33d959f8c29583825f72b238f85b380 | <|skeleton|>
class HtkEmulateUserMiddleware:
def process_request(self, request):
"""Replace the authenticated `request.user` if properly emulating"""
<|body_0|>
def process_response(self, request, response):
"""Delete user emulation cookies if they should not be set"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HtkEmulateUserMiddleware:
def process_request(self, request):
"""Replace the authenticated `request.user` if properly emulating"""
if request.path.startswith(htk_setting('HTK_PATH_ADMIN')) or request.path.startswith(htk_setting('HTK_PATH_ADMINTOOLS')):
pass
else:
... | the_stack_v2_python_sparse | admintools/middleware.py | hacktoolkit/django-htk | train | 210 | |
b53e4603b387644eeccbed8a999ac75b4d1f426b | [
"assert da.getDim() == 1\nself.da = da\nself.factor = factor\nself.dx = dx\nself.prob = prob\nself.localX = da.createLocalVec()\nself.xs, self.xe = self.da.getRanges()[0]\nself.mx = self.da.getSizes()[0]\nself.row = PETSc.Mat.Stencil()\nself.col = PETSc.Mat.Stencil()",
"self.da.globalToLocal(X, self.localX)\nx = ... | <|body_start_0|>
assert da.getDim() == 1
self.da = da
self.factor = factor
self.dx = dx
self.prob = prob
self.localX = da.createLocalVec()
self.xs, self.xe = self.da.getRanges()[0]
self.mx = self.da.getSizes()[0]
self.row = PETSc.Mat.Stencil()
... | Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES | Fisher_full | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, prob, factor, dx):
"""Initialization routine Args: da: DMDA object prob: problem instance factor: temporal factor (dt*Qd) dx: grid spacing in x direction"... | stack_v2_sparse_classes_36k_train_029286 | 16,584 | permissive | [
{
"docstring": "Initialization routine Args: da: DMDA object prob: problem instance factor: temporal factor (dt*Qd) dx: grid spacing in x direction",
"name": "__init__",
"signature": "def __init__(self, da, prob, factor, dx)"
},
{
"docstring": "Function to evaluate the residual for the Newton so... | 3 | null | Implement the Python class `Fisher_full` described below.
Class description:
Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES
Method signatures and docstrings:
- def __init__(self, da, prob, factor, dx): Initialization routine Args: da: DMDA object prob: problem instance factor:... | Implement the Python class `Fisher_full` described below.
Class description:
Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES
Method signatures and docstrings:
- def __init__(self, da, prob, factor, dx): Initialization routine Args: da: DMDA object prob: problem instance factor:... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, prob, factor, dx):
"""Initialization routine Args: da: DMDA object prob: problem instance factor: temporal factor (dt*Qd) dx: grid spacing in x direction"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, prob, factor, dx):
"""Initialization routine Args: da: DMDA object prob: problem instance factor: temporal factor (dt*Qd) dx: grid spacing in x direction"""
as... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py | Parallel-in-Time/pySDC | train | 30 |
da3739dc5652d4ebc8050fd2d13a625e0f2b1fa7 | [
"self.database_options = database_options\nself.mtype = mtype\nself.view_options = view_options",
"if dictionary is None:\n return None\ndatabase_options = cohesity_management_sdk.models.restore_exchange_params_database_options.RestoreExchangeParams_DatabaseOptions.from_dictionary(dictionary.get('databaseOptio... | <|body_start_0|>
self.database_options = database_options
self.mtype = mtype
self.view_options = view_options
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
database_options = cohesity_management_sdk.models.restore_exchange_params_database_options... | Implementation of the 'RestoreExchangeParams' model. TODO: type description here. Attributes: database_options (RestoreExchangeParams_DatabaseOptions): Only applicable when ExchangeRestoreType.Type = kDatabase. mtype (int): Restore type. view_options (RestoreExchangeParams_ViewOptions): Only applicable when ExchangeRes... | RestoreExchangeParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreExchangeParams:
"""Implementation of the 'RestoreExchangeParams' model. TODO: type description here. Attributes: database_options (RestoreExchangeParams_DatabaseOptions): Only applicable when ExchangeRestoreType.Type = kDatabase. mtype (int): Restore type. view_options (RestoreExchangePara... | stack_v2_sparse_classes_36k_train_029287 | 2,439 | permissive | [
{
"docstring": "Constructor for the RestoreExchangeParams class",
"name": "__init__",
"signature": "def __init__(self, database_options=None, mtype=None, view_options=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe... | 2 | null | Implement the Python class `RestoreExchangeParams` described below.
Class description:
Implementation of the 'RestoreExchangeParams' model. TODO: type description here. Attributes: database_options (RestoreExchangeParams_DatabaseOptions): Only applicable when ExchangeRestoreType.Type = kDatabase. mtype (int): Restore ... | Implement the Python class `RestoreExchangeParams` described below.
Class description:
Implementation of the 'RestoreExchangeParams' model. TODO: type description here. Attributes: database_options (RestoreExchangeParams_DatabaseOptions): Only applicable when ExchangeRestoreType.Type = kDatabase. mtype (int): Restore ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreExchangeParams:
"""Implementation of the 'RestoreExchangeParams' model. TODO: type description here. Attributes: database_options (RestoreExchangeParams_DatabaseOptions): Only applicable when ExchangeRestoreType.Type = kDatabase. mtype (int): Restore type. view_options (RestoreExchangePara... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestoreExchangeParams:
"""Implementation of the 'RestoreExchangeParams' model. TODO: type description here. Attributes: database_options (RestoreExchangeParams_DatabaseOptions): Only applicable when ExchangeRestoreType.Type = kDatabase. mtype (int): Restore type. view_options (RestoreExchangeParams_ViewOption... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_exchange_params.py | cohesity/management-sdk-python | train | 24 |
09ba53f682c7305bb59b5a0126a072d5a207ae3f | [
"from klusta import kwik\nBaseIO.__init__(self)\nself.filename = os.path.abspath(filename)\nmodel = kwik.KwikModel(self.filename)\nself.models = [kwik.KwikModel(self.filename, channel_group=grp) for grp in model.channel_groups]",
"assert not lazy, 'Do not support lazy'\nblk = Block()\nseg = Segment(file_origin=se... | <|body_start_0|>
from klusta import kwik
BaseIO.__init__(self)
self.filename = os.path.abspath(filename)
model = kwik.KwikModel(self.filename)
self.models = [kwik.KwikModel(self.filename, channel_group=grp) for grp in model.channel_groups]
<|end_body_0|>
<|body_start_1|>
... | Class for "reading" experimental data from a .kwik file. Generates a :class:`Segment` with a :class:`AnalogSignal` | KwikIO | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KwikIO:
"""Class for "reading" experimental data from a .kwik file. Generates a :class:`Segment` with a :class:`AnalogSignal`"""
def __init__(self, filename):
"""Arguments: filename : the filename"""
<|body_0|>
def read_block(self, lazy=False, get_waveforms=True, cluster... | stack_v2_sparse_classes_36k_train_029288 | 6,507 | permissive | [
{
"docstring": "Arguments: filename : the filename",
"name": "__init__",
"signature": "def __init__(self, filename)"
},
{
"docstring": "Reads a block with segments and groups Parameters ---------- get_waveforms: bool, default = False Wether or not to get the waveforms get_raw_data: bool, default... | 4 | stack_v2_sparse_classes_30k_train_008944 | Implement the Python class `KwikIO` described below.
Class description:
Class for "reading" experimental data from a .kwik file. Generates a :class:`Segment` with a :class:`AnalogSignal`
Method signatures and docstrings:
- def __init__(self, filename): Arguments: filename : the filename
- def read_block(self, lazy=Fa... | Implement the Python class `KwikIO` described below.
Class description:
Class for "reading" experimental data from a .kwik file. Generates a :class:`Segment` with a :class:`AnalogSignal`
Method signatures and docstrings:
- def __init__(self, filename): Arguments: filename : the filename
- def read_block(self, lazy=Fa... | 354c8d9d5fbc4daad3547773d2f281f8c163d208 | <|skeleton|>
class KwikIO:
"""Class for "reading" experimental data from a .kwik file. Generates a :class:`Segment` with a :class:`AnalogSignal`"""
def __init__(self, filename):
"""Arguments: filename : the filename"""
<|body_0|>
def read_block(self, lazy=False, get_waveforms=True, cluster... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KwikIO:
"""Class for "reading" experimental data from a .kwik file. Generates a :class:`Segment` with a :class:`AnalogSignal`"""
def __init__(self, filename):
"""Arguments: filename : the filename"""
from klusta import kwik
BaseIO.__init__(self)
self.filename = os.path.abs... | the_stack_v2_python_sparse | neo/io/kwikio.py | NeuralEnsemble/python-neo | train | 265 |
6e58175cfb6dd4d7f5b943d06c5242ddd6aa6911 | [
"self.Whf = np.random.normal(size=(h + i, h))\nself.Whb = np.random.normal(size=(h + i, h))\nself.Wy = np.random.normal(size=(h + h, o))\nself.bhf = np.zeros(shape=(1, h))\nself.bhb = np.zeros(shape=(1, h))\nself.by = np.zeros(shape=(1, o))",
"x = np.concatenate((h_prev, x_t), axis=1)\nh_t = np.tanh(np.dot(x, sel... | <|body_start_0|>
self.Whf = np.random.normal(size=(h + i, h))
self.Whb = np.random.normal(size=(h + i, h))
self.Wy = np.random.normal(size=(h + h, o))
self.bhf = np.zeros(shape=(1, h))
self.bhb = np.zeros(shape=(1, h))
self.by = np.zeros(shape=(1, o))
<|end_body_0|>
<|bo... | class BidirectionalCell that represents a bidirectional cell of an RNN | BidirectionalCell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BidirectionalCell:
"""class BidirectionalCell that represents a bidirectional cell of an RNN"""
def __init__(self, i, h, o):
"""Constructor i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs Creates the public insta... | stack_v2_sparse_classes_36k_train_029289 | 2,433 | no_license | [
{
"docstring": "Constructor i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs Creates the public instance attributes Whf, Whb, Wy, bhf, bhb, by that represent the weights and biases of the cell Whf and bhfare for the hidden states in the forw... | 3 | stack_v2_sparse_classes_30k_train_019452 | Implement the Python class `BidirectionalCell` described below.
Class description:
class BidirectionalCell that represents a bidirectional cell of an RNN
Method signatures and docstrings:
- def __init__(self, i, h, o): Constructor i is the dimensionality of the data h is the dimensionality of the hidden states o is t... | Implement the Python class `BidirectionalCell` described below.
Class description:
class BidirectionalCell that represents a bidirectional cell of an RNN
Method signatures and docstrings:
- def __init__(self, i, h, o): Constructor i is the dimensionality of the data h is the dimensionality of the hidden states o is t... | bb980395b146c9f4e0d4e9766c4a36f67de70d2e | <|skeleton|>
class BidirectionalCell:
"""class BidirectionalCell that represents a bidirectional cell of an RNN"""
def __init__(self, i, h, o):
"""Constructor i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs Creates the public insta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BidirectionalCell:
"""class BidirectionalCell that represents a bidirectional cell of an RNN"""
def __init__(self, i, h, o):
"""Constructor i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs Creates the public instance attribute... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/6-bi_backward.py | AndrewKalil/holbertonschool-machine_learning | train | 0 |
fe8e6a6d823b146b7f34c142ac111e843834682c | [
"PlotFrame.__init__(self, parent, id, title, scale, size, show_menu_icons=False)\nself.parent = parent\nself.data = image\nself.file_name = title\nmenu = wx.Menu()\nid = wx.NewId()\nitem = wx.MenuItem(menu, id, '&Convert to Data')\nmenu.AppendItem(item)\nwx.EVT_MENU(self, id, self.on_set_data)\nself.menu_bar.Append... | <|body_start_0|>
PlotFrame.__init__(self, parent, id, title, scale, size, show_menu_icons=False)
self.parent = parent
self.data = image
self.file_name = title
menu = wx.Menu()
id = wx.NewId()
item = wx.MenuItem(menu, id, '&Convert to Data')
menu.AppendItem... | Frame for simple plot | ImageFrame | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageFrame:
"""Frame for simple plot"""
def __init__(self, parent, id, title, image=None, scale='log_{10}', size=wx.Size(550, 470)):
"""comment :Param data: image array got from imread() of matplotlib [narray] :param parent: parent panel/container"""
<|body_0|>
def on_se... | stack_v2_sparse_classes_36k_train_029290 | 16,472 | permissive | [
{
"docstring": "comment :Param data: image array got from imread() of matplotlib [narray] :param parent: parent panel/container",
"name": "__init__",
"signature": "def __init__(self, parent, id, title, image=None, scale='log_{10}', size=wx.Size(550, 470))"
},
{
"docstring": "Rescale the x y rang... | 3 | stack_v2_sparse_classes_30k_train_019068 | Implement the Python class `ImageFrame` described below.
Class description:
Frame for simple plot
Method signatures and docstrings:
- def __init__(self, parent, id, title, image=None, scale='log_{10}', size=wx.Size(550, 470)): comment :Param data: image array got from imread() of matplotlib [narray] :param parent: pa... | Implement the Python class `ImageFrame` described below.
Class description:
Frame for simple plot
Method signatures and docstrings:
- def __init__(self, parent, id, title, image=None, scale='log_{10}', size=wx.Size(550, 470)): comment :Param data: image array got from imread() of matplotlib [narray] :param parent: pa... | 8ef18fd8c6abb0608ce9b53187e53d00d3e4e9ae | <|skeleton|>
class ImageFrame:
"""Frame for simple plot"""
def __init__(self, parent, id, title, image=None, scale='log_{10}', size=wx.Size(550, 470)):
"""comment :Param data: image array got from imread() of matplotlib [narray] :param parent: parent panel/container"""
<|body_0|>
def on_se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageFrame:
"""Frame for simple plot"""
def __init__(self, parent, id, title, image=None, scale='log_{10}', size=wx.Size(550, 470)):
"""comment :Param data: image array got from imread() of matplotlib [narray] :param parent: parent panel/container"""
PlotFrame.__init__(self, parent, id, t... | the_stack_v2_python_sparse | jhub37_mantid_baseline/sasview-5.0.3/src/sas/sasgui/perspectives/calculator/image_viewer.py | moving-northwards/Docker | train | 0 |
082c18a8f304b3fcf36d7e8cf2dd1223f9440544 | [
"cnt = collections.Counter(words)\nseen = set()\nword_set = set(words)\nret = 0\nfor word in word_set:\n if word in seen:\n continue\n word2 = word[::-1]\n seen.add(word)\n if word == word2:\n l = cnt[word] // 2\n ret += l * 4\n elif word2 in word_set:\n seen.add(word2)\n ... | <|body_start_0|>
cnt = collections.Counter(words)
seen = set()
word_set = set(words)
ret = 0
for word in word_set:
if word in seen:
continue
word2 = word[::-1]
seen.add(word)
if word == word2:
l = cnt... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome(self, words: List[str]) -> int:
"""2022/11/3 Runtime: 1657 ms, faster than 81.22% Memory Usage: 38.3 MB, less than 86.56% 1 <= words.length <= 10^5 words[i].length == 2 words[i] consists of lowercase English letters."""
<|body_0|>
def longestP... | stack_v2_sparse_classes_36k_train_029291 | 2,842 | permissive | [
{
"docstring": "2022/11/3 Runtime: 1657 ms, faster than 81.22% Memory Usage: 38.3 MB, less than 86.56% 1 <= words.length <= 10^5 words[i].length == 2 words[i] consists of lowercase English letters.",
"name": "longestPalindrome",
"signature": "def longestPalindrome(self, words: List[str]) -> int"
},
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, words: List[str]) -> int: 2022/11/3 Runtime: 1657 ms, faster than 81.22% Memory Usage: 38.3 MB, less than 86.56% 1 <= words.length <= 10^5 words[i].le... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, words: List[str]) -> int: 2022/11/3 Runtime: 1657 ms, faster than 81.22% Memory Usage: 38.3 MB, less than 86.56% 1 <= words.length <= 10^5 words[i].le... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def longestPalindrome(self, words: List[str]) -> int:
"""2022/11/3 Runtime: 1657 ms, faster than 81.22% Memory Usage: 38.3 MB, less than 86.56% 1 <= words.length <= 10^5 words[i].length == 2 words[i] consists of lowercase English letters."""
<|body_0|>
def longestP... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def longestPalindrome(self, words: List[str]) -> int:
"""2022/11/3 Runtime: 1657 ms, faster than 81.22% Memory Usage: 38.3 MB, less than 86.56% 1 <= words.length <= 10^5 words[i].length == 2 words[i] consists of lowercase English letters."""
cnt = collections.Counter(words)
s... | the_stack_v2_python_sparse | src/2131-LongestPalindromeByConcatenatingTwoLetterWords.py | Jiezhi/myleetcode | train | 1 | |
247cd6ad5582de9e5bb3beffebee50f5eb828674 | [
"super(PAN, self).__init__()\nchannels_blocks = []\nfor i, block in enumerate(blocks):\n channels_blocks.append(list(list(block.children())[2].children())[4].weight.shape[0])\nself.fpa = FPA(channels=channels_blocks[0])\nself.gau_block1 = GAU(channels_blocks[0], channels_blocks[1], upsample=False)\nself.gau_bloc... | <|body_start_0|>
super(PAN, self).__init__()
channels_blocks = []
for i, block in enumerate(blocks):
channels_blocks.append(list(list(block.children())[2].children())[4].weight.shape[0])
self.fpa = FPA(channels=channels_blocks[0])
self.gau_block1 = GAU(channels_blocks... | PAN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PAN:
def __init__(self, blocks=[]):
""":param blocks: Blocks of the network with reverse sequential."""
<|body_0|>
def forward(self, fms=[]):
""":param fms: Feature maps of forward propagation in the network with reverse sequential. shape:[b, c, h, w] :return: fm_hig... | stack_v2_sparse_classes_36k_train_029292 | 9,063 | permissive | [
{
"docstring": ":param blocks: Blocks of the network with reverse sequential.",
"name": "__init__",
"signature": "def __init__(self, blocks=[])"
},
{
"docstring": ":param fms: Feature maps of forward propagation in the network with reverse sequential. shape:[b, c, h, w] :return: fm_high. [b, 256... | 2 | stack_v2_sparse_classes_30k_test_000485 | Implement the Python class `PAN` described below.
Class description:
Implement the PAN class.
Method signatures and docstrings:
- def __init__(self, blocks=[]): :param blocks: Blocks of the network with reverse sequential.
- def forward(self, fms=[]): :param fms: Feature maps of forward propagation in the network wit... | Implement the Python class `PAN` described below.
Class description:
Implement the PAN class.
Method signatures and docstrings:
- def __init__(self, blocks=[]): :param blocks: Blocks of the network with reverse sequential.
- def forward(self, fms=[]): :param fms: Feature maps of forward propagation in the network wit... | fc93419b5edb917100450f45254d68ad372c15b5 | <|skeleton|>
class PAN:
def __init__(self, blocks=[]):
""":param blocks: Blocks of the network with reverse sequential."""
<|body_0|>
def forward(self, fms=[]):
""":param fms: Feature maps of forward propagation in the network with reverse sequential. shape:[b, c, h, w] :return: fm_hig... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PAN:
def __init__(self, blocks=[]):
""":param blocks: Blocks of the network with reverse sequential."""
super(PAN, self).__init__()
channels_blocks = []
for i, block in enumerate(blocks):
channels_blocks.append(list(list(block.children())[2].children())[4].weight.sh... | the_stack_v2_python_sparse | 2021届毕设-语义分割-CascadePSP/models/pan/network.py | lqwrl542293/JL-Yang_CV | train | 14 | |
aafce838ba92b450cd7b77838ede92f2db75fa4a | [
"def is_leaf(node):\n return node.left is None and node.right is None\n\ndef toggle(s, v):\n if v in s:\n s.remove(v)\n else:\n s.add(v)\n\ndef dfs(node, odd):\n if is_leaf(node):\n toggle(odd, node.val)\n ret = 1 if len(odd) <= 1 else 0\n toggle(odd, node.val)\n ... | <|body_start_0|>
def is_leaf(node):
return node.left is None and node.right is None
def toggle(s, v):
if v in s:
s.remove(v)
else:
s.add(v)
def dfs(node, odd):
if is_leaf(node):
toggle(odd, node.val... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pseudoPalindromicPaths(self, root: TreeNode) -> int:
"""04/18/2021 13:37"""
<|body_0|>
def pseudoPalindromicPaths(self, root: Optional[TreeNode]) -> int:
"""10/03/2022 22:09"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def is_leaf(n... | stack_v2_sparse_classes_36k_train_029293 | 3,482 | no_license | [
{
"docstring": "04/18/2021 13:37",
"name": "pseudoPalindromicPaths",
"signature": "def pseudoPalindromicPaths(self, root: TreeNode) -> int"
},
{
"docstring": "10/03/2022 22:09",
"name": "pseudoPalindromicPaths",
"signature": "def pseudoPalindromicPaths(self, root: Optional[TreeNode]) -> ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pseudoPalindromicPaths(self, root: TreeNode) -> int: 04/18/2021 13:37
- def pseudoPalindromicPaths(self, root: Optional[TreeNode]) -> int: 10/03/2022 22:09 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pseudoPalindromicPaths(self, root: TreeNode) -> int: 04/18/2021 13:37
- def pseudoPalindromicPaths(self, root: Optional[TreeNode]) -> int: 10/03/2022 22:09
<|skeleton|>
clas... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def pseudoPalindromicPaths(self, root: TreeNode) -> int:
"""04/18/2021 13:37"""
<|body_0|>
def pseudoPalindromicPaths(self, root: Optional[TreeNode]) -> int:
"""10/03/2022 22:09"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def pseudoPalindromicPaths(self, root: TreeNode) -> int:
"""04/18/2021 13:37"""
def is_leaf(node):
return node.left is None and node.right is None
def toggle(s, v):
if v in s:
s.remove(v)
else:
s.add(v)
... | the_stack_v2_python_sparse | leetcode/solved/1568_Pseudo-Palindromic_Paths_in_a_Binary_Tree/solution.py | sungminoh/algorithms | train | 0 | |
7d11ffbca1b56700327d9bf296d078a445458f85 | [
"data = get_fetch_result_row_by_id(pk)\nif not data:\n raise NotFound\nresult = marshal(data, fields_item_fetch_result, envelope=structure_key_item)\nreturn jsonify(result)",
"result = delete_fetch_result(pk)\nif result:\n success_msg = SUCCESS_MSG.copy()\n return make_response(jsonify(success_msg), 204)... | <|body_start_0|>
data = get_fetch_result_row_by_id(pk)
if not data:
raise NotFound
result = marshal(data, fields_item_fetch_result, envelope=structure_key_item)
return jsonify(result)
<|end_body_0|>
<|body_start_1|>
result = delete_fetch_result(pk)
if result:... | FetchResultResource | FetchResultResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FetchResultResource:
"""FetchResultResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/news/fetch_result/1 :param pk: :return:"""
<|body_0|>
def delete(self, pk):
"""Example: curl http://0.0.0.0:5000/news/fetch_result/1 -X DELETE :param pk: :retur... | stack_v2_sparse_classes_36k_train_029294 | 11,580 | permissive | [
{
"docstring": "Example: curl http://0.0.0.0:5000/news/fetch_result/1 :param pk: :return:",
"name": "get",
"signature": "def get(self, pk)"
},
{
"docstring": "Example: curl http://0.0.0.0:5000/news/fetch_result/1 -X DELETE :param pk: :return:",
"name": "delete",
"signature": "def delete(... | 3 | stack_v2_sparse_classes_30k_train_009126 | Implement the Python class `FetchResultResource` described below.
Class description:
FetchResultResource
Method signatures and docstrings:
- def get(self, pk): Example: curl http://0.0.0.0:5000/news/fetch_result/1 :param pk: :return:
- def delete(self, pk): Example: curl http://0.0.0.0:5000/news/fetch_result/1 -X DEL... | Implement the Python class `FetchResultResource` described below.
Class description:
FetchResultResource
Method signatures and docstrings:
- def get(self, pk): Example: curl http://0.0.0.0:5000/news/fetch_result/1 :param pk: :return:
- def delete(self, pk): Example: curl http://0.0.0.0:5000/news/fetch_result/1 -X DEL... | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | <|skeleton|>
class FetchResultResource:
"""FetchResultResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/news/fetch_result/1 :param pk: :return:"""
<|body_0|>
def delete(self, pk):
"""Example: curl http://0.0.0.0:5000/news/fetch_result/1 -X DELETE :param pk: :retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FetchResultResource:
"""FetchResultResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/news/fetch_result/1 :param pk: :return:"""
data = get_fetch_result_row_by_id(pk)
if not data:
raise NotFound
result = marshal(data, fields_item_fetch_result, ... | the_stack_v2_python_sparse | web_api/news/resources/fetch_result.py | zhanghe06/flask_restful | train | 2 |
34725e46b81bebc569953c20c9ab09eedc7576e0 | [
"self.name = name\nself.subnet = subnet\nself.appliance_ip = appliance_ip\nself.vpn_nat_subnet = vpn_nat_subnet\nself.dhcp_handling = dhcp_handling\nself.dhcp_relay_server_ips = dhcp_relay_server_ips\nself.dhcp_lease_time = dhcp_lease_time\nself.dhcp_boot_options_enabled = dhcp_boot_options_enabled\nself.dhcp_boot_... | <|body_start_0|>
self.name = name
self.subnet = subnet
self.appliance_ip = appliance_ip
self.vpn_nat_subnet = vpn_nat_subnet
self.dhcp_handling = dhcp_handling
self.dhcp_relay_server_ips = dhcp_relay_server_ips
self.dhcp_lease_time = dhcp_lease_time
self.d... | Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The translated VPN subnet if VPN and VPN subnet translatio... | UpdateNetworkVlanModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateNetworkVlanModel:
"""Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The tran... | stack_v2_sparse_classes_36k_train_029295 | 7,095 | permissive | [
{
"docstring": "Constructor for the UpdateNetworkVlanModel class",
"name": "__init__",
"signature": "def __init__(self, name=None, subnet=None, appliance_ip=None, vpn_nat_subnet=None, dhcp_handling=None, dhcp_relay_server_ips=None, dhcp_lease_time=None, dhcp_boot_options_enabled=None, dhcp_boot_next_ser... | 2 | stack_v2_sparse_classes_30k_train_016354 | Implement the Python class `UpdateNetworkVlanModel` described below.
Class description:
Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the... | Implement the Python class `UpdateNetworkVlanModel` described below.
Class description:
Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class UpdateNetworkVlanModel:
"""Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The tran... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateNetworkVlanModel:
"""Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The translated VPN su... | the_stack_v2_python_sparse | meraki_sdk/models/update_network_vlan_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
302c9e6b630d32c466166bb1e2c60c770e23c46c | [
"try:\n self.teaClassPractice = []\n self.sqlhandler = None\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n self.practiceId = self.get_argument('practiceId')\n self.StuId = self.get_argument('stuId')\n self.stuAnser = None\n if self.getAnswer():\n print(s... | <|body_start_0|>
try:
self.teaClassPractice = []
self.sqlhandler = None
if not utils.isUIDValid(self):
self.write('no uid')
return
self.practiceId = self.get_argument('practiceId')
self.StuId = self.get_argument('stuId')... | TeaGetStuPracticeAnswerListRequestHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeaGetStuPracticeAnswerListRequestHandler:
def get(self):
"""获取练习题答案,返回给老师客户端"""
<|body_0|>
def getAnswer(self):
"""查询学生练习答案"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
self.teaClassPractice = []
self.sqlhandler = No... | stack_v2_sparse_classes_36k_train_029296 | 2,169 | no_license | [
{
"docstring": "获取练习题答案,返回给老师客户端",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "查询学生练习答案",
"name": "getAnswer",
"signature": "def getAnswer(self)"
}
] | 2 | null | Implement the Python class `TeaGetStuPracticeAnswerListRequestHandler` described below.
Class description:
Implement the TeaGetStuPracticeAnswerListRequestHandler class.
Method signatures and docstrings:
- def get(self): 获取练习题答案,返回给老师客户端
- def getAnswer(self): 查询学生练习答案 | Implement the Python class `TeaGetStuPracticeAnswerListRequestHandler` described below.
Class description:
Implement the TeaGetStuPracticeAnswerListRequestHandler class.
Method signatures and docstrings:
- def get(self): 获取练习题答案,返回给老师客户端
- def getAnswer(self): 查询学生练习答案
<|skeleton|>
class TeaGetStuPracticeAnswerListR... | b28eb4163b02bd0a931653b94851592f2654b199 | <|skeleton|>
class TeaGetStuPracticeAnswerListRequestHandler:
def get(self):
"""获取练习题答案,返回给老师客户端"""
<|body_0|>
def getAnswer(self):
"""查询学生练习答案"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeaGetStuPracticeAnswerListRequestHandler:
def get(self):
"""获取练习题答案,返回给老师客户端"""
try:
self.teaClassPractice = []
self.sqlhandler = None
if not utils.isUIDValid(self):
self.write('no uid')
return
self.practiceId = s... | the_stack_v2_python_sparse | server/teacher/TeaGetStuPracticeAnswerListRequestHandler.py | lyh-ADT/edu-app | train | 1 | |
305bfa2f1c1e52d2756dfc6d3efe1d9ab79228cf | [
"if rowIndex == 0:\n return [1]\nif rowIndex == 1:\n return [1, 1]\nres = [1] * (rowIndex + 1)\nfor i in range(1, rowIndex):\n res[i] = self.getRow(rowIndex - 1)[i - 1] + self.getRow(rowIndex - 1)[i]\nreturn res",
"if rowIndex == 0:\n return [1]\nif rowIndex == 1:\n return [1, 1]\nres = [[1] * x fo... | <|body_start_0|>
if rowIndex == 0:
return [1]
if rowIndex == 1:
return [1, 1]
res = [1] * (rowIndex + 1)
for i in range(1, rowIndex):
res[i] = self.getRow(rowIndex - 1)[i - 1] + self.getRow(rowIndex - 1)[i]
return res
<|end_body_0|>
<|body_sta... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getRow(self, rowIndex):
"""递归 :param rowIndex: :return:"""
<|body_0|>
def getRow2(self, rowIndex):
"""非递归 打印出所有结果 :param rowIndex: :return:"""
<|body_1|>
def getRow3(self, rowIndex):
"""杨辉三角的数学性质:第n行的m个数可表示为 C(n-1,m-1),即为从n-1个不同元素中取... | stack_v2_sparse_classes_36k_train_029297 | 1,689 | no_license | [
{
"docstring": "递归 :param rowIndex: :return:",
"name": "getRow",
"signature": "def getRow(self, rowIndex)"
},
{
"docstring": "非递归 打印出所有结果 :param rowIndex: :return:",
"name": "getRow2",
"signature": "def getRow2(self, rowIndex)"
},
{
"docstring": "杨辉三角的数学性质:第n行的m个数可表示为 C(n-1,m-1),... | 3 | stack_v2_sparse_classes_30k_train_013916 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getRow(self, rowIndex): 递归 :param rowIndex: :return:
- def getRow2(self, rowIndex): 非递归 打印出所有结果 :param rowIndex: :return:
- def getRow3(self, rowIndex): 杨辉三角的数学性质:第n行的m个数可表示为... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getRow(self, rowIndex): 递归 :param rowIndex: :return:
- def getRow2(self, rowIndex): 非递归 打印出所有结果 :param rowIndex: :return:
- def getRow3(self, rowIndex): 杨辉三角的数学性质:第n行的m个数可表示为... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def getRow(self, rowIndex):
"""递归 :param rowIndex: :return:"""
<|body_0|>
def getRow2(self, rowIndex):
"""非递归 打印出所有结果 :param rowIndex: :return:"""
<|body_1|>
def getRow3(self, rowIndex):
"""杨辉三角的数学性质:第n行的m个数可表示为 C(n-1,m-1),即为从n-1个不同元素中取... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getRow(self, rowIndex):
"""递归 :param rowIndex: :return:"""
if rowIndex == 0:
return [1]
if rowIndex == 1:
return [1, 1]
res = [1] * (rowIndex + 1)
for i in range(1, rowIndex):
res[i] = self.getRow(rowIndex - 1)[i - 1] + ... | the_stack_v2_python_sparse | 119_杨辉三角 II.py | lovehhf/LeetCode | train | 0 | |
b8e6aaeb20d50a4216913d6592c3b612ef703f91 | [
"params = base.get_params(('event', 'name', 'type', 'unit', 'interval', 'values', 'limit'), locals(), serialize_param)\nrequest = http.Request('GET', 'events/properties/', params)\nreturn (request, parsers.parse_json)",
"params = base.get_params(('event', 'limit'), locals(), serialize_param)\nrequest = http.Reque... | <|body_start_0|>
params = base.get_params(('event', 'name', 'type', 'unit', 'interval', 'values', 'limit'), locals(), serialize_param)
request = http.Request('GET', 'events/properties/', params)
return (request, parsers.parse_json)
<|end_body_0|>
<|body_start_1|>
params = base.get_param... | Properties | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Properties:
def get(self, event, name, type, unit, interval, values=None, limit=None):
"""Fetch data of a single event."""
<|body_0|>
def top(self, event, limit=None):
"""Fetch top property names for an event."""
<|body_1|>
def values(self, event, name, ... | stack_v2_sparse_classes_36k_train_029298 | 7,208 | permissive | [
{
"docstring": "Fetch data of a single event.",
"name": "get",
"signature": "def get(self, event, name, type, unit, interval, values=None, limit=None)"
},
{
"docstring": "Fetch top property names for an event.",
"name": "top",
"signature": "def top(self, event, limit=None)"
},
{
... | 3 | null | Implement the Python class `Properties` described below.
Class description:
Implement the Properties class.
Method signatures and docstrings:
- def get(self, event, name, type, unit, interval, values=None, limit=None): Fetch data of a single event.
- def top(self, event, limit=None): Fetch top property names for an e... | Implement the Python class `Properties` described below.
Class description:
Implement the Properties class.
Method signatures and docstrings:
- def get(self, event, name, type, unit, interval, values=None, limit=None): Fetch data of a single event.
- def top(self, event, limit=None): Fetch top property names for an e... | 25caa745a104c8dc209584fa359294c65dbf88bb | <|skeleton|>
class Properties:
def get(self, event, name, type, unit, interval, values=None, limit=None):
"""Fetch data of a single event."""
<|body_0|>
def top(self, event, limit=None):
"""Fetch top property names for an event."""
<|body_1|>
def values(self, event, name, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Properties:
def get(self, event, name, type, unit, interval, values=None, limit=None):
"""Fetch data of a single event."""
params = base.get_params(('event', 'name', 'type', 'unit', 'interval', 'values', 'limit'), locals(), serialize_param)
request = http.Request('GET', 'events/propert... | the_stack_v2_python_sparse | libsaas/services/mixpanel/resources.py | piplcom/libsaas | train | 1 | |
2953ae5b0bbe5f945e449c9d8a7f13ed0af700b5 | [
"ending = filename.split('.')[-1]\nif ending not in cls.labels:\n ending = cls.associated_types[ending]\ncls.labels[ending].save(filename, data, **kwargs)",
"ending = filename.split('.')[-1]\nif ending not in cls.labels:\n ending = cls.associated_types[ending]\nreturn cls.labels[ending].load(filename, as_ty... | <|body_start_0|>
ending = filename.split('.')[-1]
if ending not in cls.labels:
ending = cls.associated_types[ending]
cls.labels[ending].save(filename, data, **kwargs)
<|end_body_0|>
<|body_start_1|>
ending = filename.split('.')[-1]
if ending not in cls.labels:
... | FileHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileHandler:
def save(cls, filename, data, **kwargs):
"""Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes."""
<|body_0|>
def load(cls, filename, as_type='dtype'):
"""Parameters: filename (str) as_type (... | stack_v2_sparse_classes_36k_train_029299 | 4,939 | permissive | [
{
"docstring": "Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes.",
"name": "save",
"signature": "def save(cls, filename, data, **kwargs)"
},
{
"docstring": "Parameters: filename (str) as_type (str): Identifier in which format the ... | 2 | stack_v2_sparse_classes_30k_train_007630 | Implement the Python class `FileHandler` described below.
Class description:
Implement the FileHandler class.
Method signatures and docstrings:
- def save(cls, filename, data, **kwargs): Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes.
- def load(cls, ... | Implement the Python class `FileHandler` described below.
Class description:
Implement the FileHandler class.
Method signatures and docstrings:
- def save(cls, filename, data, **kwargs): Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes.
- def load(cls, ... | 29f37740bacc9a77b94daf6fbae769c003ee9349 | <|skeleton|>
class FileHandler:
def save(cls, filename, data, **kwargs):
"""Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes."""
<|body_0|>
def load(cls, filename, as_type='dtype'):
"""Parameters: filename (str) as_type (... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileHandler:
def save(cls, filename, data, **kwargs):
"""Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes."""
ending = filename.split('.')[-1]
if ending not in cls.labels:
ending = cls.associated_types[ending]... | the_stack_v2_python_sparse | profit/util/file_handler.py | redmod-team/profit | train | 19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.