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
7ee1314c5b7a024d8d711f298c47a22e3eebe767
[ "inst = None\nif verbose:\n print('notification factory datafile %s dbtype %s verbose %s' % (db_dict, db_type, verbose))\nif db_type == 'csv':\n inst = CsvProgramsTable(db_dict, db_type, verbose)\nelif db_type == 'mysql':\n inst = MySQLProgramsTable(db_dict, db_type, verbose)\nelse:\n ValueError('Invali...
<|body_start_0|> inst = None if verbose: print('notification factory datafile %s dbtype %s verbose %s' % (db_dict, db_type, verbose)) if db_type == 'csv': inst = CsvProgramsTable(db_dict, db_type, verbose) elif db_type == 'mysql': inst = MySQLProgramsT...
Abstract class for ProgramsTable This table contains a single entry, the last time a scan was executed.
ProgramsTable
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgramsTable: """Abstract class for ProgramsTable This table contains a single entry, the last time a scan was executed.""" def factory(cls, db_dict, db_type, verbose): """Factory method to select subclass based on database type. Currently the types sql and csv are supported. Return...
stack_v2_sparse_classes_36k_train_015900
9,672
permissive
[ { "docstring": "Factory method to select subclass based on database type. Currently the types sql and csv are supported. Returns instance object of the defined type.", "name": "factory", "signature": "def factory(cls, db_dict, db_type, verbose)" }, { "docstring": "Return record for current progr...
3
null
Implement the Python class `ProgramsTable` described below. Class description: Abstract class for ProgramsTable This table contains a single entry, the last time a scan was executed. Method signatures and docstrings: - def factory(cls, db_dict, db_type, verbose): Factory method to select subclass based on database ty...
Implement the Python class `ProgramsTable` described below. Class description: Abstract class for ProgramsTable This table contains a single entry, the last time a scan was executed. Method signatures and docstrings: - def factory(cls, db_dict, db_type, verbose): Factory method to select subclass based on database ty...
9c60b3489f02592bd9099b8719ca23ae43a9eaa5
<|skeleton|> class ProgramsTable: """Abstract class for ProgramsTable This table contains a single entry, the last time a scan was executed.""" def factory(cls, db_dict, db_type, verbose): """Factory method to select subclass based on database type. Currently the types sql and csv are supported. Return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProgramsTable: """Abstract class for ProgramsTable This table contains a single entry, the last time a scan was executed.""" def factory(cls, db_dict, db_type, verbose): """Factory method to select subclass based on database type. Currently the types sql and csv are supported. Returns instance ob...
the_stack_v2_python_sparse
smipyping/_programstable.py
KSchopmeyer/smipyping
train
0
d09a86b38265ffea2ea112ca6ebfaac712f1710e
[ "init_parameters = {'resnet18': [BasicBlock, [2, 2, 2, 2]], 'resnet34': [BasicBlock, [3, 4, 6, 3]], 'resnet50': [Bottleneck, [3, 4, 6, 3]]}[name]\nsuper().__init__(*init_parameters)\nif weights is not None and pretrained:\n raise Exception('Use only one method to load pre-trained weights. Two were given!')\nif p...
<|body_start_0|> init_parameters = {'resnet18': [BasicBlock, [2, 2, 2, 2]], 'resnet34': [BasicBlock, [3, 4, 6, 3]], 'resnet50': [Bottleneck, [3, 4, 6, 3]]}[name] super().__init__(*init_parameters) if weights is not None and pretrained: raise Exception('Use only one method to load pre...
2D ResNet backbone
BackboneResnet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackboneResnet: """2D ResNet backbone""" def __init__(self, *, pretrained: bool=False, weights: Optional[Union[WeightsEnum, dict]]=None, in_channels: int=3, name: str='resnet18', pool: Optional[str]=None) -> None: """Create 2D Resnet :param pretrained: reload imagenet weights :param ...
stack_v2_sparse_classes_36k_train_015901
4,229
permissive
[ { "docstring": "Create 2D Resnet :param pretrained: reload imagenet weights :param in_channels: Number of input channels :param name: model name. Currently support 'resnet18' and 'resnet50' :param pool: whether to use global average pooling to reduce the spacial dimensions after the convolutional layers can be ...
2
stack_v2_sparse_classes_30k_train_019860
Implement the Python class `BackboneResnet` described below. Class description: 2D ResNet backbone Method signatures and docstrings: - def __init__(self, *, pretrained: bool=False, weights: Optional[Union[WeightsEnum, dict]]=None, in_channels: int=3, name: str='resnet18', pool: Optional[str]=None) -> None: Create 2D ...
Implement the Python class `BackboneResnet` described below. Class description: 2D ResNet backbone Method signatures and docstrings: - def __init__(self, *, pretrained: bool=False, weights: Optional[Union[WeightsEnum, dict]]=None, in_channels: int=3, name: str='resnet18', pool: Optional[str]=None) -> None: Create 2D ...
8f22cd46c836245b9394b73ce2957afc03706bfc
<|skeleton|> class BackboneResnet: """2D ResNet backbone""" def __init__(self, *, pretrained: bool=False, weights: Optional[Union[WeightsEnum, dict]]=None, in_channels: int=3, name: str='resnet18', pool: Optional[str]=None) -> None: """Create 2D Resnet :param pretrained: reload imagenet weights :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackboneResnet: """2D ResNet backbone""" def __init__(self, *, pretrained: bool=False, weights: Optional[Union[WeightsEnum, dict]]=None, in_channels: int=3, name: str='resnet18', pool: Optional[str]=None) -> None: """Create 2D Resnet :param pretrained: reload imagenet weights :param in_channels: ...
the_stack_v2_python_sparse
fuse/dl/models/backbones/backbone_resnet.py
BiomedSciAI/fuse-med-ml
train
45
b4561dbdba21826420772d8d8607c2246d166925
[ "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\ncheckpoint_path = 'VQMIVC-pretrained models/checkpoints/useCSMITrue_useCPMITrue_usePSMITrue_useAmpTrue/VQMIVC-model.ckpt-500.pt'\nmel_stats = np.load('./mel_stats/stats.npy')\nencoder = Encoder(in_channels=80, channels=512, n_embeddings=512, z_...
<|body_start_0|> device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') checkpoint_path = 'VQMIVC-pretrained models/checkpoints/useCSMITrue_useCPMITrue_usePSMITrue_useAmpTrue/VQMIVC-model.ckpt-500.pt' mel_stats = np.load('./mel_stats/stats.npy') encoder = Encoder(in_channe...
Predictor
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predictor: def setup(self): """Load models""" <|body_0|> def predict(self, input_source: Path=Input(description='Source voice wav path'), input_reference: Path=Input(description='Reference voice wav path')) -> Path: """Compute prediction""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_015902
4,930
permissive
[ { "docstring": "Load models", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Compute prediction", "name": "predict", "signature": "def predict(self, input_source: Path=Input(description='Source voice wav path'), input_reference: Path=Input(description='Reference voice...
2
null
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def setup(self): Load models - def predict(self, input_source: Path=Input(description='Source voice wav path'), input_reference: Path=Input(description='Reference voice wav pat...
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def setup(self): Load models - def predict(self, input_source: Path=Input(description='Source voice wav path'), input_reference: Path=Input(description='Reference voice wav pat...
9d643e88946fc4a24f2d4d073c08b05ea693f4c5
<|skeleton|> class Predictor: def setup(self): """Load models""" <|body_0|> def predict(self, input_source: Path=Input(description='Source voice wav path'), input_reference: Path=Input(description='Reference voice wav path')) -> Path: """Compute prediction""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Predictor: def setup(self): """Load models""" device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') checkpoint_path = 'VQMIVC-pretrained models/checkpoints/useCSMITrue_useCPMITrue_usePSMITrue_useAmpTrue/VQMIVC-model.ckpt-500.pt' mel_stats = np.load('./mel_stats/...
the_stack_v2_python_sparse
speech/speech_synthesis/vqmivc/pytorch/predict.py
Deep-Spark/DeepSparkHub
train
7
c9be786a7bc279628ab12e1d941a4a802ac30cf5
[ "try:\n coconut_id = coconut.__class__.__name__ + '_' + str(coconut.weight)\n if isinstance(coconut, Coconut):\n if coconut_id in self.coconut_counts:\n self.coconut_counts[coconut_id] += number\n else:\n self.coconut_counts[coconut_id] = number\n else:\n raise At...
<|body_start_0|> try: coconut_id = coconut.__class__.__name__ + '_' + str(coconut.weight) if isinstance(coconut, Coconut): if coconut_id in self.coconut_counts: self.coconut_counts[coconut_id] += number else: self.co...
Inventory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inventory: def add_coconut(self, coconut=None, number=0): """Add n coconuts to inventory""" <|body_0|> def remove_coconut(self, coconut=None, number=0): """Remove n coconuts from inventory""" <|body_1|> def display_inventory(self): """Display inv...
stack_v2_sparse_classes_36k_train_015903
3,825
no_license
[ { "docstring": "Add n coconuts to inventory", "name": "add_coconut", "signature": "def add_coconut(self, coconut=None, number=0)" }, { "docstring": "Remove n coconuts from inventory", "name": "remove_coconut", "signature": "def remove_coconut(self, coconut=None, number=0)" }, { "...
3
null
Implement the Python class `Inventory` described below. Class description: Implement the Inventory class. Method signatures and docstrings: - def add_coconut(self, coconut=None, number=0): Add n coconuts to inventory - def remove_coconut(self, coconut=None, number=0): Remove n coconuts from inventory - def display_in...
Implement the Python class `Inventory` described below. Class description: Implement the Inventory class. Method signatures and docstrings: - def add_coconut(self, coconut=None, number=0): Add n coconuts to inventory - def remove_coconut(self, coconut=None, number=0): Remove n coconuts from inventory - def display_in...
f51c1d2d9557c95e869cbce5bff7158f5aa90192
<|skeleton|> class Inventory: def add_coconut(self, coconut=None, number=0): """Add n coconuts to inventory""" <|body_0|> def remove_coconut(self, coconut=None, number=0): """Remove n coconuts from inventory""" <|body_1|> def display_inventory(self): """Display inv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Inventory: def add_coconut(self, coconut=None, number=0): """Add n coconuts to inventory""" try: coconut_id = coconut.__class__.__name__ + '_' + str(coconut.weight) if isinstance(coconut, Coconut): if coconut_id in self.coconut_counts: ...
the_stack_v2_python_sparse
Python 03: The Python Environment/Lesson 02: Converting Data into Structured Objects/coconuts.py
MTset/Python-Programming-Coursework
train
0
f0984e01d50f2417468bdd963cff481d203e30da
[ "num = input(f'Guess a number between {START} and {END}:')\nif not num:\n raise ValueError('Please enter a number')\nelse:\n try:\n num = int(num)\n except ValueError:\n raise ValueError('Should be a number')\n if not START <= num <= END:\n raise ValueError('Number not in range')\n ...
<|body_start_0|> num = input(f'Guess a number between {START} and {END}:') if not num: raise ValueError('Please enter a number') else: try: num = int(num) except ValueError: raise ValueError('Should be a number') if ...
Number guess class, make it callable to initiate game
Game
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """Number guess class, make it callable to initiate game""" def guess(self): """Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good...
stack_v2_sparse_classes_36k_train_015904
2,696
no_license
[ { "docstring": "Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good, return the int", "name": "guess", "signature": "def guess(self)" }, { "docstring...
3
null
Implement the Python class `Game` described below. Class description: Number guess class, make it callable to initiate game Method signatures and docstrings: - def guess(self): Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a nu...
Implement the Python class `Game` described below. Class description: Number guess class, make it callable to initiate game Method signatures and docstrings: - def guess(self): Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a nu...
a1eb0a5553e50e88d3568a36b275138d84d9fb46
<|skeleton|> class Game: """Number guess class, make it callable to initiate game""" def guess(self): """Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Game: """Number guess class, make it callable to initiate game""" def guess(self): """Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good, return the ...
the_stack_v2_python_sparse
code_challenges/42/guess.py
dcribb19/bitesofpy
train
1
056d54aefb2e6238870471c752200c3aa21632e0
[ "super(nsight_systems, self).__init__(**kwargs)\nself.__arch_label = ''\nself.__cli = kwargs.get('cli', True)\nself.__distro_label = ''\nself.__ospackages = kwargs.get('ospackages', [])\nself.__version = kwargs.get('version', '2022.5.1')\nself.__cpu_arch()\nself.__distro()\nself.__instructions()", "self += commen...
<|body_start_0|> super(nsight_systems, self).__init__(**kwargs) self.__arch_label = '' self.__cli = kwargs.get('cli', True) self.__distro_label = '' self.__ospackages = kwargs.get('ospackages', []) self.__version = kwargs.get('version', '2022.5.1') self.__cpu_arch...
The `nsight_systems` building block downloads and installs the [NVIDIA Nsight Systems profiler]](https://developer.nvidia.com/nsight-systems). # Parameters cli: Boolean flag to specify whether the command line only (CLI) package should be installed. The default is True. version: The version of Nsight Systems to install...
nsight_systems
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class nsight_systems: """The `nsight_systems` building block downloads and installs the [NVIDIA Nsight Systems profiler]](https://developer.nvidia.com/nsight-systems). # Parameters cli: Boolean flag to specify whether the command line only (CLI) package should be installed. The default is True. version...
stack_v2_sparse_classes_36k_train_015905
5,498
permissive
[ { "docstring": "Initialize building block", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Fill in container instructions", "name": "__instructions", "signature": "def __instructions(self)" }, { "docstring": "Based on the CPU architecture, set ...
4
stack_v2_sparse_classes_30k_test_000527
Implement the Python class `nsight_systems` described below. Class description: The `nsight_systems` building block downloads and installs the [NVIDIA Nsight Systems profiler]](https://developer.nvidia.com/nsight-systems). # Parameters cli: Boolean flag to specify whether the command line only (CLI) package should be ...
Implement the Python class `nsight_systems` described below. Class description: The `nsight_systems` building block downloads and installs the [NVIDIA Nsight Systems profiler]](https://developer.nvidia.com/nsight-systems). # Parameters cli: Boolean flag to specify whether the command line only (CLI) package should be ...
60fd2a51c171258a6b3f93c2523101cb7018ba1b
<|skeleton|> class nsight_systems: """The `nsight_systems` building block downloads and installs the [NVIDIA Nsight Systems profiler]](https://developer.nvidia.com/nsight-systems). # Parameters cli: Boolean flag to specify whether the command line only (CLI) package should be installed. The default is True. version...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class nsight_systems: """The `nsight_systems` building block downloads and installs the [NVIDIA Nsight Systems profiler]](https://developer.nvidia.com/nsight-systems). # Parameters cli: Boolean flag to specify whether the command line only (CLI) package should be installed. The default is True. version: The version...
the_stack_v2_python_sparse
hpccm/building_blocks/nsight_systems.py
NVIDIA/hpc-container-maker
train
419
cc91dcfe018f9c70e8dc56a0976872594bc5960f
[ "need, have = ([0] * 128, [0] * 128)\nfor ch in t:\n need[ord(ch)] += 1\nl, r, start = (0, 0, 0)\nmin_len, count = (float('inf'), 0)\nwhile r < len(s):\n s_r = ord(s[r])\n if need[s_r] == 0:\n r += 1\n continue\n if have[s_r] < need[s_r]:\n count += 1\n have[s_r] += 1\n r += 1...
<|body_start_0|> need, have = ([0] * 128, [0] * 128) for ch in t: need[ord(ch)] += 1 l, r, start = (0, 0, 0) min_len, count = (float('inf'), 0) while r < len(s): s_r = ord(s[r]) if need[s_r] == 0: r += 1 continue...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minWindow(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_0|> def minWindow(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> need, have = ([0] * 128, [0] * 128) ...
stack_v2_sparse_classes_36k_train_015906
6,972
no_license
[ { "docstring": ":type s: str :type t: str :rtype: str", "name": "minWindow", "signature": "def minWindow(self, s, t)" }, { "docstring": ":type s: str :type t: str :rtype: str", "name": "minWindow", "signature": "def minWindow(self, s, t)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindow(self, s, t): :type s: str :type t: str :rtype: str - def minWindow(self, s, t): :type s: str :type t: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindow(self, s, t): :type s: str :type t: str :rtype: str - def minWindow(self, s, t): :type s: str :type t: str :rtype: str <|skeleton|> class Solution: def minWind...
860590239da0618c52967a55eda8d6bbe00bfa96
<|skeleton|> class Solution: def minWindow(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_0|> def minWindow(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minWindow(self, s, t): """:type s: str :type t: str :rtype: str""" need, have = ([0] * 128, [0] * 128) for ch in t: need[ord(ch)] += 1 l, r, start = (0, 0, 0) min_len, count = (float('inf'), 0) while r < len(s): s_r = ord(s[...
the_stack_v2_python_sparse
LeetCode/p0076/I/minimum-window-substring.py
Ynjxsjmh/PracticeMakesPerfect
train
0
a75efe7a24a32985f3352c4f13126d07660fea28
[ "start = 0\nstop = 0\nlength = len(nums)\nif length == 1:\n return sum(nums)\nlargest_sum = nums[0]\nfor i in range(0, length):\n max_sum = nums[0]\n for j in range(i, length):\n ij_sum = sum(nums[i:j + 1])\n if ij_sum > max_sum:\n stop = j\n max_sum = ij_sum\n if max...
<|body_start_0|> start = 0 stop = 0 length = len(nums) if length == 1: return sum(nums) largest_sum = nums[0] for i in range(0, length): max_sum = nums[0] for j in range(i, length): ij_sum = sum(nums[i:j + 1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray2(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_0|> def maxSubArray(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> start = 0 ...
stack_v2_sparse_classes_36k_train_015907
1,598
no_license
[ { "docstring": "计算列表中连续子数组的最大和 :param nums: list[int] :return: int", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums)" }, { "docstring": "计算列表中连续子数组的最大和 :param nums: list[int] :return: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_016438
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray2(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int - def maxSubArray(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray2(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int - def maxSubArray(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int <|skeleton|> c...
c756fe54e8e17e9ba0bfdab5fccc24ac89263d90
<|skeleton|> class Solution: def maxSubArray2(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_0|> def maxSubArray(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray2(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" start = 0 stop = 0 length = len(nums) if length == 1: return sum(nums) largest_sum = nums[0] for i in range(0, length): max_sum = num...
the_stack_v2_python_sparse
easy/maximum_subarray.py
EarthChen/LeetCode_Record
train
0
8c049533bec51ebc22327011bee3c0a481d681cd
[ "self._list = []\nif text:\n self.append(*text)", "for val in text:\n if isinstance(val, PStyle):\n self._list.append(val)\n continue\n if isinstance(val, PText):\n self.append(*val._list)\n continue\n if not isinstance(val, str):\n raise ValueError(f'expected string...
<|body_start_0|> self._list = [] if text: self.append(*text) <|end_body_0|> <|body_start_1|> for val in text: if isinstance(val, PStyle): self._list.append(val) continue if isinstance(val, PText): self.append(*v...
Paragraph text class.
PText
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PText: """Paragraph text class.""" def __init__(self, *text: Union[str, PStyle]): """Init Paragraph text.""" <|body_0|> def append(self, *text: Union[str, PStyle]) -> None: """Parse values and append.""" <|body_1|> def apply_to(self, para: SlidePlace...
stack_v2_sparse_classes_36k_train_015908
7,778
permissive
[ { "docstring": "Init Paragraph text.", "name": "__init__", "signature": "def __init__(self, *text: Union[str, PStyle])" }, { "docstring": "Parse values and append.", "name": "append", "signature": "def append(self, *text: Union[str, PStyle]) -> None" }, { "docstring": "Apply to."...
3
stack_v2_sparse_classes_30k_train_019507
Implement the Python class `PText` described below. Class description: Paragraph text class. Method signatures and docstrings: - def __init__(self, *text: Union[str, PStyle]): Init Paragraph text. - def append(self, *text: Union[str, PStyle]) -> None: Parse values and append. - def apply_to(self, para: SlidePlacehold...
Implement the Python class `PText` described below. Class description: Paragraph text class. Method signatures and docstrings: - def __init__(self, *text: Union[str, PStyle]): Init Paragraph text. - def append(self, *text: Union[str, PStyle]) -> None: Parse values and append. - def apply_to(self, para: SlidePlacehold...
1d7a566597fef48d6b6a5fa6f95f7caf9429fa2c
<|skeleton|> class PText: """Paragraph text class.""" def __init__(self, *text: Union[str, PStyle]): """Init Paragraph text.""" <|body_0|> def append(self, *text: Union[str, PStyle]) -> None: """Parse values and append.""" <|body_1|> def apply_to(self, para: SlidePlace...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PText: """Paragraph text class.""" def __init__(self, *text: Union[str, PStyle]): """Init Paragraph text.""" self._list = [] if text: self.append(*text) def append(self, *text: Union[str, PStyle]) -> None: """Parse values and append.""" for val in ...
the_stack_v2_python_sparse
dataplaybook/tasks/io_pptx.py
kellerza/data-playbook
train
3
de091695b92521c227725d4da5e9e8ae45dac4b2
[ "if str(self.referred_y1) == '1':\n self.referred_y1 = YES\nif str(self.referred_y1) == '2':\n self.referred_y1 = NO", "if not self.citizen:\n try:\n clinic_eligibility = ClinicEligibility.objects.get(household_member=household_member)\n self.citizen = clinic_eligibility.citizen\n except...
<|body_start_0|> if str(self.referred_y1) == '1': self.referred_y1 = YES if str(self.referred_y1) == '2': self.referred_y1 = NO <|end_body_0|> <|body_start_1|> if not self.citizen: try: clinic_eligibility = ClinicEligibility.objects.get(househ...
SubjectDataFixMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubjectDataFixMixin: def fix_referred_yesno(self): """Fixes values that are incorrect due to a previous source code bug (Data Fix #1096).""" <|body_0|> def fix_clinic_citizen(self, household_member): """Gets citizen from Eligibility until Consent is fixed (Bug #1094)...
stack_v2_sparse_classes_36k_train_015909
3,100
no_license
[ { "docstring": "Fixes values that are incorrect due to a previous source code bug (Data Fix #1096).", "name": "fix_referred_yesno", "signature": "def fix_referred_yesno(self)" }, { "docstring": "Gets citizen from Eligibility until Consent is fixed (Bug #1094).", "name": "fix_clinic_citizen",...
4
null
Implement the Python class `SubjectDataFixMixin` described below. Class description: Implement the SubjectDataFixMixin class. Method signatures and docstrings: - def fix_referred_yesno(self): Fixes values that are incorrect due to a previous source code bug (Data Fix #1096). - def fix_clinic_citizen(self, household_m...
Implement the Python class `SubjectDataFixMixin` described below. Class description: Implement the SubjectDataFixMixin class. Method signatures and docstrings: - def fix_referred_yesno(self): Fixes values that are incorrect due to a previous source code bug (Data Fix #1096). - def fix_clinic_citizen(self, household_m...
fe3363c93d599bfe5d1f32997f79790400871315
<|skeleton|> class SubjectDataFixMixin: def fix_referred_yesno(self): """Fixes values that are incorrect due to a previous source code bug (Data Fix #1096).""" <|body_0|> def fix_clinic_citizen(self, household_member): """Gets citizen from Eligibility until Consent is fixed (Bug #1094)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubjectDataFixMixin: def fix_referred_yesno(self): """Fixes values that are incorrect due to a previous source code bug (Data Fix #1096).""" if str(self.referred_y1) == '1': self.referred_y1 = YES if str(self.referred_y1) == '2': self.referred_y1 = NO def f...
the_stack_v2_python_sparse
bhp066/apps/bcpp_export/mixins/subject_data_fix_mixin.py
botswana-combination-prevention-project/bcpp-v1
train
0
ff1891d3ef03d1f3af9ec220a2364f76c460886d
[ "self.debug = Debug('ResourceMgr', debug)\nself.positions = positions\nself.capital = capital", "if self.positions - pos < 0 or self.capital - cap < 0:\n return False\nreturn True", "self.debug.dbg('alloc: left positions %s, cap %s; alloc pos %s, cap %s' % (self.positions, self.capital, pos, cap))\nif not se...
<|body_start_0|> self.debug = Debug('ResourceMgr', debug) self.positions = positions self.capital = capital <|end_body_0|> <|body_start_1|> if self.positions - pos < 0 or self.capital - cap < 0: return False return True <|end_body_1|> <|body_start_2|> self.d...
ResourceMgr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceMgr: def __init__(self, positions, capital, debug=False): """资源管理器,资金、总持仓位 :param positions: 仓数 :param capital: 资金 :param debug: 打印debug信息 :return: None""" <|body_0|> def test(self, pos, cap): """测试资源是否足够 :param pos: 仓数 :param cap: 资金 :return: 允许则Ture,否则为Fals...
stack_v2_sparse_classes_36k_train_015910
17,038
no_license
[ { "docstring": "资源管理器,资金、总持仓位 :param positions: 仓数 :param capital: 资金 :param debug: 打印debug信息 :return: None", "name": "__init__", "signature": "def __init__(self, positions, capital, debug=False)" }, { "docstring": "测试资源是否足够 :param pos: 仓数 :param cap: 资金 :return: 允许则Ture,否则为False", "name": "...
4
null
Implement the Python class `ResourceMgr` described below. Class description: Implement the ResourceMgr class. Method signatures and docstrings: - def __init__(self, positions, capital, debug=False): 资源管理器,资金、总持仓位 :param positions: 仓数 :param capital: 资金 :param debug: 打印debug信息 :return: None - def test(self, pos, cap):...
Implement the Python class `ResourceMgr` described below. Class description: Implement the ResourceMgr class. Method signatures and docstrings: - def __init__(self, positions, capital, debug=False): 资源管理器,资金、总持仓位 :param positions: 仓数 :param capital: 资金 :param debug: 打印debug信息 :return: None - def test(self, pos, cap):...
541ec028f649d92a180c30bbecef53a54c610f7c
<|skeleton|> class ResourceMgr: def __init__(self, positions, capital, debug=False): """资源管理器,资金、总持仓位 :param positions: 仓数 :param capital: 资金 :param debug: 打印debug信息 :return: None""" <|body_0|> def test(self, pos, cap): """测试资源是否足够 :param pos: 仓数 :param cap: 资金 :return: 允许则Ture,否则为Fals...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResourceMgr: def __init__(self, positions, capital, debug=False): """资源管理器,资金、总持仓位 :param positions: 仓数 :param capital: 资金 :param debug: 打印debug信息 :return: None""" self.debug = Debug('ResourceMgr', debug) self.positions = positions self.capital = capital def test(self, pos...
the_stack_v2_python_sparse
core/emulation.py
zrroyo/winning
train
0
1a470c887a6d950c6d978d5e8f77e7cbe1f982a8
[ "tmp = i.have()\nfor k, v in tmp.has().items():\n v.name = k\nreturn tmp", "t, b4 = (0, Uber())\nkeep = []\nstate = i.state()\nfor k, a in state.items():\n b4[k] = a.init\nkeys = sorted(state.keys(), key=lambda z: state[z].rank())\nkeep = [['t'] + keys, [0] + b4.asList(keys)]\nwhile t < tmax:\n now = b4....
<|body_start_0|> tmp = i.have() for k, v in tmp.has().items(): v.name = k return tmp <|end_body_0|> <|body_start_1|> t, b4 = (0, Uber()) keep = [] state = i.state() for k, a in state.items(): b4[k] = a.init keys = sorted(state.keys...
Model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: def state(i): """To create a state vector, we create one slot for each name in 'have'.""" <|body_0|> def run(i, dt=1, tmax=30): """For time up to 'tmax', increment 't' by 'dt' and 'step' the model.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_015911
918
no_license
[ { "docstring": "To create a state vector, we create one slot for each name in 'have'.", "name": "state", "signature": "def state(i)" }, { "docstring": "For time up to 'tmax', increment 't' by 'dt' and 'step' the model.", "name": "run", "signature": "def run(i, dt=1, tmax=30)" } ]
2
null
Implement the Python class `Model` described below. Class description: Implement the Model class. Method signatures and docstrings: - def state(i): To create a state vector, we create one slot for each name in 'have'. - def run(i, dt=1, tmax=30): For time up to 'tmax', increment 't' by 'dt' and 'step' the model.
Implement the Python class `Model` described below. Class description: Implement the Model class. Method signatures and docstrings: - def state(i): To create a state vector, we create one slot for each name in 'have'. - def run(i, dt=1, tmax=30): For time up to 'tmax', increment 't' by 'dt' and 'step' the model. <|s...
00a65c6ff75e833ebe8a168114e92f9ced531d5f
<|skeleton|> class Model: def state(i): """To create a state vector, we create one slot for each name in 'have'.""" <|body_0|> def run(i, dt=1, tmax=30): """For time up to 'tmax', increment 't' by 'dt' and 'step' the model.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: def state(i): """To create a state vector, we create one slot for each name in 'have'.""" tmp = i.have() for k, v in tmp.has().items(): v.name = k return tmp def run(i, dt=1, tmax=30): """For time up to 'tmax', increment 't' by 'dt' and 'step' th...
the_stack_v2_python_sparse
project/srcCode/oldie/Model.py
akondrahman/59115ASE
train
2
72ad7cf5fbeff16c97799df0a5dfcdee1df433d0
[ "if isinstance(key, int):\n return Packet(key)\nif key not in Packet._member_map_:\n extend_enum(Packet, key, default)\nreturn Packet[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nextend_enum(cls, 'Unassigned_%d' % value...
<|body_start_0|> if isinstance(key, int): return Packet(key) if key not in Packet._member_map_: extend_enum(Packet, key, default) return Packet[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 255): raise ValueErro...
[Packet] IPX Packet Types
Packet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Packet: """[Packet] IPX Packet Types""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <|body_start_0|> i...
stack_v2_sparse_classes_36k_train_015912
1,240
permissive
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
null
Implement the Python class `Packet` described below. Class description: [Packet] IPX Packet Types Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `Packet` described below. Class description: [Packet] IPX Packet Types Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class Packet: """[Packet] IP...
90cd07d67df28d5c5ab0585bc60f467a78d9db33
<|skeleton|> class Packet: """[Packet] IPX Packet Types""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Packet: """[Packet] IPX Packet Types""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Packet(key) if key not in Packet._member_map_: extend_enum(Packet, key, default) return Packet[key] def...
the_stack_v2_python_sparse
pcapkit/const/ipx/packet.py
stjordanis/PyPCAPKit
train
0
812496bf433164a1884cb31f3017717d8c94a4c6
[ "if context is None:\n context = {}\nres = {}\nfor stock_picking in self.browse(cr, uid, ids, context=context):\n res[stock_picking.id] = False\n if stock_picking.sale_id and stock_picking.sale_id.purchase_order_id:\n res[stock_picking.id] = True\nreturn res", "picking_id = ids and ids[0] or False...
<|body_start_0|> if context is None: context = {} res = {} for stock_picking in self.browse(cr, uid, ids, context=context): res[stock_picking.id] = False if stock_picking.sale_id and stock_picking.sale_id.purchase_order_id: res[stock_picking.id...
stock_picking_out
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking_out: def _get_is_edi(self, cr, uid, ids, name, args, context=None): """This method will return if the picking is or not an edi picking""" <|body_0|> def action_process(self, cr, uid, ids, context=None): """Inherit the action process method. If this pick...
stack_v2_sparse_classes_36k_train_015913
19,840
no_license
[ { "docstring": "This method will return if the picking is or not an edi picking", "name": "_get_is_edi", "signature": "def _get_is_edi(self, cr, uid, ids, name, args, context=None)" }, { "docstring": "Inherit the action process method. If this picking is an edi and the related purchase is not ap...
2
stack_v2_sparse_classes_30k_train_005441
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def _get_is_edi(self, cr, uid, ids, name, args, context=None): This method will return if the picking is or not an edi picking - def action_process(self, cr, ui...
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def _get_is_edi(self, cr, uid, ids, name, args, context=None): This method will return if the picking is or not an edi picking - def action_process(self, cr, ui...
3e35f7ba7246c54e5a5b31921b28aa5f1ab24999
<|skeleton|> class stock_picking_out: def _get_is_edi(self, cr, uid, ids, name, args, context=None): """This method will return if the picking is or not an edi picking""" <|body_0|> def action_process(self, cr, uid, ids, context=None): """Inherit the action process method. If this pick...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stock_picking_out: def _get_is_edi(self, cr, uid, ids, name, args, context=None): """This method will return if the picking is or not an edi picking""" if context is None: context = {} res = {} for stock_picking in self.browse(cr, uid, ids, context=context): ...
the_stack_v2_python_sparse
intercompany_warehouse/stock.py
mgielissen/julius-openobject-addons
train
1
b39c5e6d3f0a30cb5d5c9348c1c341344b9e76de
[ "self.assertEqual('', Solution().prefix_of_two('', 'abcd'))\nself.assertEqual('abc', Solution().prefix_of_two('abcd', 'abcefl'))\nself.assertEqual('abc', Solution().prefix_of_two('abc', 'abc'))", "self.assertEqual('', Solution().longest_common_prefix([]))\nself.assertEqual('abcd', Solution().longest_common_prefix...
<|body_start_0|> self.assertEqual('', Solution().prefix_of_two('', 'abcd')) self.assertEqual('abc', Solution().prefix_of_two('abcd', 'abcefl')) self.assertEqual('abc', Solution().prefix_of_two('abc', 'abc')) <|end_body_0|> <|body_start_1|> self.assertEqual('', Solution().longest_common_...
Tests for Leetcode problem 14: Longest Common Prefix.
ProblemTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProblemTest: """Tests for Leetcode problem 14: Longest Common Prefix.""" def test_prefix_of_two(self): """Test the prefix_of_two method.""" <|body_0|> def test_solution(self): """Test the full solution.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_015914
2,028
no_license
[ { "docstring": "Test the prefix_of_two method.", "name": "test_prefix_of_two", "signature": "def test_prefix_of_two(self)" }, { "docstring": "Test the full solution.", "name": "test_solution", "signature": "def test_solution(self)" } ]
2
stack_v2_sparse_classes_30k_val_000809
Implement the Python class `ProblemTest` described below. Class description: Tests for Leetcode problem 14: Longest Common Prefix. Method signatures and docstrings: - def test_prefix_of_two(self): Test the prefix_of_two method. - def test_solution(self): Test the full solution.
Implement the Python class `ProblemTest` described below. Class description: Tests for Leetcode problem 14: Longest Common Prefix. Method signatures and docstrings: - def test_prefix_of_two(self): Test the prefix_of_two method. - def test_solution(self): Test the full solution. <|skeleton|> class ProblemTest: ""...
e11bfc454789e716055b80873af0817ec8588aea
<|skeleton|> class ProblemTest: """Tests for Leetcode problem 14: Longest Common Prefix.""" def test_prefix_of_two(self): """Test the prefix_of_two method.""" <|body_0|> def test_solution(self): """Test the full solution.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProblemTest: """Tests for Leetcode problem 14: Longest Common Prefix.""" def test_prefix_of_two(self): """Test the prefix_of_two method.""" self.assertEqual('', Solution().prefix_of_two('', 'abcd')) self.assertEqual('abc', Solution().prefix_of_two('abcd', 'abcefl')) self.a...
the_stack_v2_python_sparse
p14/problem14.py
stanl3y/leetcode
train
0
972a8971c70b19e856bc81b7b24a0d70a6743b6b
[ "super(TemporalConvNet, self).__init__()\nself.C = C\nself.mask_nonlinear = mask_nonlinear\nlayer_norm = ChannelwiseLayerNorm(N)\nbottleneck_conv1x1 = nn.Conv1d(N, B, 1, bias=False)\nrepeats = []\nfor r in range(R):\n blocks = []\n for x in range(X):\n dilation = 2 ** x\n padding = (P - 1) * dil...
<|body_start_0|> super(TemporalConvNet, self).__init__() self.C = C self.mask_nonlinear = mask_nonlinear layer_norm = ChannelwiseLayerNorm(N) bottleneck_conv1x1 = nn.Conv1d(N, B, 1, bias=False) repeats = [] for r in range(R): blocks = [] fo...
TemporalConvNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemporalConvNet: def __init__(self, N, B, H, P, X, R, C, norm_type='gLN', causal=False, mask_nonlinear='relu'): """Args: N: Number of filters in autoencoder B: Number of channels in bottleneck 1 × 1-conv block H: Number of channels in convolutional blocks P: Kernel size in convolutional ...
stack_v2_sparse_classes_36k_train_015915
15,161
no_license
[ { "docstring": "Args: N: Number of filters in autoencoder B: Number of channels in bottleneck 1 × 1-conv block H: Number of channels in convolutional blocks P: Kernel size in convolutional blocks X: Number of convolutional blocks in each repeat R: Number of repeats C: Number of speakers norm_type: BN, gLN, cLN ...
2
stack_v2_sparse_classes_30k_train_011675
Implement the Python class `TemporalConvNet` described below. Class description: Implement the TemporalConvNet class. Method signatures and docstrings: - def __init__(self, N, B, H, P, X, R, C, norm_type='gLN', causal=False, mask_nonlinear='relu'): Args: N: Number of filters in autoencoder B: Number of channels in bo...
Implement the Python class `TemporalConvNet` described below. Class description: Implement the TemporalConvNet class. Method signatures and docstrings: - def __init__(self, N, B, H, P, X, R, C, norm_type='gLN', causal=False, mask_nonlinear='relu'): Args: N: Number of filters in autoencoder B: Number of channels in bo...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class TemporalConvNet: def __init__(self, N, B, H, P, X, R, C, norm_type='gLN', causal=False, mask_nonlinear='relu'): """Args: N: Number of filters in autoencoder B: Number of channels in bottleneck 1 × 1-conv block H: Number of channels in convolutional blocks P: Kernel size in convolutional ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemporalConvNet: def __init__(self, N, B, H, P, X, R, C, norm_type='gLN', causal=False, mask_nonlinear='relu'): """Args: N: Number of filters in autoencoder B: Number of channels in bottleneck 1 × 1-conv block H: Number of channels in convolutional blocks P: Kernel size in convolutional blocks X: Numb...
the_stack_v2_python_sparse
generated/test_kaituoxu_Conv_TasNet.py
jansel/pytorch-jit-paritybench
train
35
a3b3576a1e27809659f961f12c69e71b3e21bbb3
[ "self.help_tab = help_tab\nself.get_help_subtab = get_help_subtab\nself.community_subtab = community_subtab\nself.cases_subtab = cases_subtab\nself.data_protection_requests_subtab = data_protection_requests_subtab\nself.get_help_subtab_knowledge_base_search = get_help_subtab_knowledge_base_search\nself.universal_se...
<|body_start_0|> self.help_tab = help_tab self.get_help_subtab = get_help_subtab self.community_subtab = community_subtab self.cases_subtab = cases_subtab self.data_protection_requests_subtab = data_protection_requests_subtab self.get_help_subtab_knowledge_base_search = g...
Implementation of the 'HelpSettings1' model. Settings for describing the modifications to various Help page features. Each property in this object accepts one of 'default or inherit' (do not modify functionality), 'hide' (remove the section from Dashboard), or 'show' (always show the section on Dashboard). Some propert...
HelpSettings1Model
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HelpSettings1Model: """Implementation of the 'HelpSettings1' model. Settings for describing the modifications to various Help page features. Each property in this object accepts one of 'default or inherit' (do not modify functionality), 'hide' (remove the section from Dashboard), or 'show' (alway...
stack_v2_sparse_classes_36k_train_015916
9,420
permissive
[ { "docstring": "Constructor for the HelpSettings1Model class", "name": "__init__", "signature": "def __init__(self, help_tab=None, get_help_subtab=None, community_subtab=None, cases_subtab=None, data_protection_requests_subtab=None, get_help_subtab_knowledge_base_search=None, universal_search_knowledge_...
2
null
Implement the Python class `HelpSettings1Model` described below. Class description: Implementation of the 'HelpSettings1' model. Settings for describing the modifications to various Help page features. Each property in this object accepts one of 'default or inherit' (do not modify functionality), 'hide' (remove the se...
Implement the Python class `HelpSettings1Model` described below. Class description: Implementation of the 'HelpSettings1' model. Settings for describing the modifications to various Help page features. Each property in this object accepts one of 'default or inherit' (do not modify functionality), 'hide' (remove the se...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class HelpSettings1Model: """Implementation of the 'HelpSettings1' model. Settings for describing the modifications to various Help page features. Each property in this object accepts one of 'default or inherit' (do not modify functionality), 'hide' (remove the section from Dashboard), or 'show' (alway...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HelpSettings1Model: """Implementation of the 'HelpSettings1' model. Settings for describing the modifications to various Help page features. Each property in this object accepts one of 'default or inherit' (do not modify functionality), 'hide' (remove the section from Dashboard), or 'show' (always show the se...
the_stack_v2_python_sparse
meraki_sdk/models/help_settings_1_model.py
RaulCatalano/meraki-python-sdk
train
1
45468e7a7f60f0a25a453b7be12ab91a254defda
[ "Button.__init__(self, 1, file, (0, 0), resize=size)\nself.pic = pygame.Surface(self.image.get_size())\nself.pic.blit(self.image, (0, 0))\nself.shades = {}\nself.initialize_shade('blue', (0, 0, 255), 150)\nself.initialize_shade('red', (255, 0, 0), 150)", "self.shades[shade_name] = [0, pygame.Surface(self.image.ge...
<|body_start_0|> Button.__init__(self, 1, file, (0, 0), resize=size) self.pic = pygame.Surface(self.image.get_size()) self.pic.blit(self.image, (0, 0)) self.shades = {} self.initialize_shade('blue', (0, 0, 255), 150) self.initialize_shade('red', (255, 0, 0), 150) <|end_bo...
Tile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tile: def __init__(self, file, size): """This will load an image and resize it as specified. The class comes with shading features and can be used as a parent class for board game like tiles that need additional attributes. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
stack_v2_sparse_classes_36k_train_015917
35,070
no_license
[ { "docstring": "This will load an image and resize it as specified. The class comes with shading features and can be used as a parent class for board game like tiles that need additional attributes. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Inputs: file - This is a string of the p...
3
stack_v2_sparse_classes_30k_train_000882
Implement the Python class `Tile` described below. Class description: Implement the Tile class. Method signatures and docstrings: - def __init__(self, file, size): This will load an image and resize it as specified. The class comes with shading features and can be used as a parent class for board game like tiles that...
Implement the Python class `Tile` described below. Class description: Implement the Tile class. Method signatures and docstrings: - def __init__(self, file, size): This will load an image and resize it as specified. The class comes with shading features and can be used as a parent class for board game like tiles that...
3eae1428fdd30fddc66669d40b8bb0a715d5595a
<|skeleton|> class Tile: def __init__(self, file, size): """This will load an image and resize it as specified. The class comes with shading features and can be used as a parent class for board game like tiles that need additional attributes. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tile: def __init__(self, file, size): """This will load an image and resize it as specified. The class comes with shading features and can be used as a parent class for board game like tiles that need additional attributes. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Input...
the_stack_v2_python_sparse
Games/Torric's Quest/pygametools.py
jbm950/personal_projects
train
0
b09ae5239bae200fa6bfa9c44b3e63183a47b9ed
[ "import datetime, time\nfrom omega_model import code_version\nself.logfilename = o2_options.logfilename\nself.verbose = verbose\nself.start_time = time.time()\nwith open(self.logfilename, 'w') as log:\n log.write('OMEGA %s batch started at %s %s\\n\\n' % (code_version, datetime.date.today(), time.strftime('%H:%M...
<|body_start_0|> import datetime, time from omega_model import code_version self.logfilename = o2_options.logfilename self.verbose = verbose self.start_time = time.time() with open(self.logfilename, 'w') as log: log.write('OMEGA %s batch started at %s %s\n\n' ...
Handles logfile creation at the batch level.
OMEGABatchLog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OMEGABatchLog: """Handles logfile creation at the batch level.""" def __init__(self, o2_options, verbose=True): """Create OMEGABatchLog object Args: o2_options (OMEGABatchOptions): provides the logfile name verbose (bool): if True enables optional output to console as well as logfile...
stack_v2_sparse_classes_36k_train_015918
5,083
no_license
[ { "docstring": "Create OMEGABatchLog object Args: o2_options (OMEGABatchOptions): provides the logfile name verbose (bool): if True enables optional output to console as well as logfile", "name": "__init__", "signature": "def __init__(self, o2_options, verbose=True)" }, { "docstring": "Write a m...
3
null
Implement the Python class `OMEGABatchLog` described below. Class description: Handles logfile creation at the batch level. Method signatures and docstrings: - def __init__(self, o2_options, verbose=True): Create OMEGABatchLog object Args: o2_options (OMEGABatchOptions): provides the logfile name verbose (bool): if T...
Implement the Python class `OMEGABatchLog` described below. Class description: Handles logfile creation at the batch level. Method signatures and docstrings: - def __init__(self, o2_options, verbose=True): Create OMEGABatchLog object Args: o2_options (OMEGABatchOptions): provides the logfile name verbose (bool): if T...
afe912c57383b9de90ef30820f7977c3367a30c4
<|skeleton|> class OMEGABatchLog: """Handles logfile creation at the batch level.""" def __init__(self, o2_options, verbose=True): """Create OMEGABatchLog object Args: o2_options (OMEGABatchOptions): provides the logfile name verbose (bool): if True enables optional output to console as well as logfile...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OMEGABatchLog: """Handles logfile creation at the batch level.""" def __init__(self, o2_options, verbose=True): """Create OMEGABatchLog object Args: o2_options (OMEGABatchOptions): provides the logfile name verbose (bool): if True enables optional output to console as well as logfile""" i...
the_stack_v2_python_sparse
omega_model/common/omega_log.py
USEPA/EPA_OMEGA_Model
train
17
fd8c34f609363a555db9d7d6a84b88c6e4b6c466
[ "@lru_cache(None)\ndef dfs(curSum: int, visited: int) -> bool:\n if curSum >= target:\n return True\n for select in range(1, upper + 1):\n if visited >> select & 1:\n continue\n if curSum + select >= target or not dfs(curSum + select, visited | 1 << select):\n return...
<|body_start_0|> @lru_cache(None) def dfs(curSum: int, visited: int) -> bool: if curSum >= target: return True for select in range(1, upper + 1): if visited >> select & 1: continue if curSum + select >= target or...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canIWin(self, upper: int, target: int) -> bool: """2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)""" <|body_0|> def canIWin2(self, upper: int, target: int) -> bool: """2^n*n 会慢一些""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_015919
1,839
no_license
[ { "docstring": "2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)", "name": "canIWin", "signature": "def canIWin(self, upper: int, target: int) -> bool" }, { "docstring": "2^n*n 会慢一些", "name": "canIWin2", "signature": "def canIWin2(self, upper: int, target: int) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_001665
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canIWin(self, upper: int, target: int) -> bool: 2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n) - def canIWin2(self, upper: int, target: int) -> bool: 2^n*n 会慢一些
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canIWin(self, upper: int, target: int) -> bool: 2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n) - def canIWin2(self, upper: int, target: int) -> bool: 2^n*n 会慢一些...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def canIWin(self, upper: int, target: int) -> bool: """2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)""" <|body_0|> def canIWin2(self, upper: int, target: int) -> bool: """2^n*n 会慢一些""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canIWin(self, upper: int, target: int) -> bool: """2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)""" @lru_cache(None) def dfs(curSum: int, visited: int) -> bool: if curSum >= target: return True for select in range(1, ...
the_stack_v2_python_sparse
11_动态规划/dp分类/状压dp/visited上携带参数/464. 我能赢吗.py
981377660LMT/algorithm-study
train
225
f43fa7b07d6773d00f3ba857a01420cf8f1b46f4
[ "start_first = self.marker_start_use_first\nend_first = self.marker_end_use_first\nif self._identical_start_end_markers or self.result_type == 'raw' or start_first & ~end_first or ~start_first & end_first:\n return super().transform(df)\nself._validate_input(df)\nif start_first & end_first:\n return self._fir...
<|body_start_0|> start_first = self.marker_start_use_first end_first = self.marker_end_use_first if self._identical_start_end_markers or self.result_type == 'raw' or start_first & ~end_first or ~start_first & end_first: return super().transform(df) self._validate_input(df) ...
Extends generic solution and provides faster implementations for last start / last end and first start / first end which do not require proprocessing of the marker column. The DAGs of these implementations have 2-3 steps less.
VectorizedCumSumAdjusted
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VectorizedCumSumAdjusted: """Extends generic solution and provides faster implementations for last start / last end and first start / first end which do not require proprocessing of the marker column. The DAGs of these implementations have 2-3 steps less.""" def transform(self, df: DataFrame...
stack_v2_sparse_classes_36k_train_015920
20,582
permissive
[ { "docstring": "Extract interval ids from given dataframe. Parameters ---------- df: pyspark.sql.Dataframe Returns ------- result: pyspark.sql.Dataframe Same columns as original dataframe plus the new interval id column.", "name": "transform", "signature": "def transform(self, df: DataFrame) -> DataFram...
4
stack_v2_sparse_classes_30k_train_007421
Implement the Python class `VectorizedCumSumAdjusted` described below. Class description: Extends generic solution and provides faster implementations for last start / last end and first start / first end which do not require proprocessing of the marker column. The DAGs of these implementations have 2-3 steps less. M...
Implement the Python class `VectorizedCumSumAdjusted` described below. Class description: Extends generic solution and provides faster implementations for last start / last end and first start / first end which do not require proprocessing of the marker column. The DAGs of these implementations have 2-3 steps less. M...
8561f5f267303e664487ae67095085fcea4308c9
<|skeleton|> class VectorizedCumSumAdjusted: """Extends generic solution and provides faster implementations for last start / last end and first start / first end which do not require proprocessing of the marker column. The DAGs of these implementations have 2-3 steps less.""" def transform(self, df: DataFrame...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VectorizedCumSumAdjusted: """Extends generic solution and provides faster implementations for last start / last end and first start / first end which do not require proprocessing of the marker column. The DAGs of these implementations have 2-3 steps less.""" def transform(self, df: DataFrame) -> DataFram...
the_stack_v2_python_sparse
src/pywrangler/pyspark/wranglers/interval_identifier.py
mansenfranzen/pywrangler
train
15
71a38762bd4415f29a7bab2ea5df45fcfd2b2736
[ "query = 'franklin_r'\nafter, classic_name = catch_underscore_syntax(query)\nself.assertEqual(after, 'franklin, r', 'The underscore should be replaced with `, `.')\nself.assertTrue(classic_name, 'Should be identified as classic')", "query = 'not_aname'\nafter, classic_name = catch_underscore_syntax(query)\nself.a...
<|body_start_0|> query = 'franklin_r' after, classic_name = catch_underscore_syntax(query) self.assertEqual(after, 'franklin, r', 'The underscore should be replaced with `, `.') self.assertTrue(classic_name, 'Should be identified as classic') <|end_body_0|> <|body_start_1|> quer...
Test :func:`.catch_underscore_syntax`.
TestUnderscoreHandling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUnderscoreHandling: """Test :func:`.catch_underscore_syntax`.""" def test_underscore_is_rewritten(self): """User searches for an author name with `surname_f` format.""" <|body_0|> def test_false_positive(self): """The underscore is followed by more than one c...
stack_v2_sparse_classes_36k_train_015921
3,341
permissive
[ { "docstring": "User searches for an author name with `surname_f` format.", "name": "test_underscore_is_rewritten", "signature": "def test_underscore_is_rewritten(self)" }, { "docstring": "The underscore is followed by more than one character.", "name": "test_false_positive", "signature"...
4
stack_v2_sparse_classes_30k_test_000514
Implement the Python class `TestUnderscoreHandling` described below. Class description: Test :func:`.catch_underscore_syntax`. Method signatures and docstrings: - def test_underscore_is_rewritten(self): User searches for an author name with `surname_f` format. - def test_false_positive(self): The underscore is follow...
Implement the Python class `TestUnderscoreHandling` described below. Class description: Test :func:`.catch_underscore_syntax`. Method signatures and docstrings: - def test_underscore_is_rewritten(self): User searches for an author name with `surname_f` format. - def test_false_positive(self): The underscore is follow...
e48f74bb2a858ae7bcf19d68f80cb6dcaa1f4761
<|skeleton|> class TestUnderscoreHandling: """Test :func:`.catch_underscore_syntax`.""" def test_underscore_is_rewritten(self): """User searches for an author name with `surname_f` format.""" <|body_0|> def test_false_positive(self): """The underscore is followed by more than one c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestUnderscoreHandling: """Test :func:`.catch_underscore_syntax`.""" def test_underscore_is_rewritten(self): """User searches for an author name with `surname_f` format.""" query = 'franklin_r' after, classic_name = catch_underscore_syntax(query) self.assertEqual(after, 'f...
the_stack_v2_python_sparse
search/controllers/tests.py
arXiv/arxiv-search
train
54
39d775df3979e725b7c6fc398e87994fa7f684d2
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widget()", "self.init_lbl = Label(self, text='')\nself.init_lbl.grid(row=0, column=0, columnspan=2, sticky=W)\nself.pw_lbl = Label(self, text='Enter the password: ')\nself.pw_lbl.grid(row=1, column=0, sticky=W)\nself.pw_ent = Entry(self)\nself.p...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widget() <|end_body_0|> <|body_start_1|> self.init_lbl = Label(self, text='') self.init_lbl.grid(row=0, column=0, columnspan=2, sticky=W) self.pw_lbl = Label(self, text='Enter the password...
GUI app that counts button clicks
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """GUI app that counts button clicks""" def __init__(self, master): """Frame initiation""" <|body_0|> def create_widget(self): """Creates a button and text frame""" <|body_1|> def check_secret(self): """Check if secret is the sam...
stack_v2_sparse_classes_36k_train_015922
1,457
no_license
[ { "docstring": "Frame initiation", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Creates a button and text frame", "name": "create_widget", "signature": "def create_widget(self)" }, { "docstring": "Check if secret is the same as entered password...
3
null
Implement the Python class `Application` described below. Class description: GUI app that counts button clicks Method signatures and docstrings: - def __init__(self, master): Frame initiation - def create_widget(self): Creates a button and text frame - def check_secret(self): Check if secret is the same as entered pa...
Implement the Python class `Application` described below. Class description: GUI app that counts button clicks Method signatures and docstrings: - def __init__(self, master): Frame initiation - def create_widget(self): Creates a button and text frame - def check_secret(self): Check if secret is the same as entered pa...
19343c985f368770dc01ce415506506d62a23285
<|skeleton|> class Application: """GUI app that counts button clicks""" def __init__(self, master): """Frame initiation""" <|body_0|> def create_widget(self): """Creates a button and text frame""" <|body_1|> def check_secret(self): """Check if secret is the sam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """GUI app that counts button clicks""" def __init__(self, master): """Frame initiation""" super(Application, self).__init__(master) self.grid() self.create_widget() def create_widget(self): """Creates a button and text frame""" self.init_...
the_stack_v2_python_sparse
gui/password_checker.py
gofr1/python-learning
train
0
211ee0ce1ab31abfd625e1e603f21f2bf180e5a5
[ "JobRunner.__init__(self)\nself.setParam('batchqueue', 'workday', 'Batch queue')\nfor k in params.keys():\n self.setParam(k, params[k])\nself.checkParams()", "condorScript = condorScriptTemplate % jobConfig\nprint(condorScript)\nscript = open('condorSubmit.sub', 'w')\nscript.write(condorScript)\nscript.close()...
<|body_start_0|> JobRunner.__init__(self) self.setParam('batchqueue', 'workday', 'Batch queue') for k in params.keys(): self.setParam(k, params[k]) self.checkParams() <|end_body_0|> <|body_start_1|> condorScript = condorScriptTemplate % jobConfig print(condor...
HTCondorJobRunner - run jobs using the HTCondor batch system
HTCondorJobRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTCondorJobRunner: """HTCondorJobRunner - run jobs using the HTCondor batch system""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" <|body_0|> def submitJob(self, jobConfig): """Submit a JobRunner job as a LSF ba...
stack_v2_sparse_classes_36k_train_015923
1,782
permissive
[ { "docstring": "Constructor (takes any number of parameters as an argument).", "name": "__init__", "signature": "def __init__(self, **params)" }, { "docstring": "Submit a JobRunner job as a LSF batch job.", "name": "submitJob", "signature": "def submitJob(self, jobConfig)" } ]
2
stack_v2_sparse_classes_30k_train_008329
Implement the Python class `HTCondorJobRunner` described below. Class description: HTCondorJobRunner - run jobs using the HTCondor batch system Method signatures and docstrings: - def __init__(self, **params): Constructor (takes any number of parameters as an argument). - def submitJob(self, jobConfig): Submit a JobR...
Implement the Python class `HTCondorJobRunner` described below. Class description: HTCondorJobRunner - run jobs using the HTCondor batch system Method signatures and docstrings: - def __init__(self, **params): Constructor (takes any number of parameters as an argument). - def submitJob(self, jobConfig): Submit a JobR...
354f92551294f7be678aebcd7b9d67d2c4448176
<|skeleton|> class HTCondorJobRunner: """HTCondorJobRunner - run jobs using the HTCondor batch system""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" <|body_0|> def submitJob(self, jobConfig): """Submit a JobRunner job as a LSF ba...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTCondorJobRunner: """HTCondorJobRunner - run jobs using the HTCondor batch system""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" JobRunner.__init__(self) self.setParam('batchqueue', 'workday', 'Batch queue') for k in pa...
the_stack_v2_python_sparse
InnerDetector/InDetExample/InDetBeamSpotExample/python/HTCondorJobRunner.py
strigazi/athena
train
0
85221b433b9f5739be9f5e6bb8dc0afaf11a5100
[ "super().__init__(coordinator)\nself._sensor_name_prefix = sensor_name_prefix\nself.entity_description = description\nself._attr_name = f'{sensor_name_prefix} {description.name_suffix}'.strip()\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, coordinator.config_entry.entry_id)}, manufacturer='Glances', na...
<|body_start_0|> super().__init__(coordinator) self._sensor_name_prefix = sensor_name_prefix self.entity_description = description self._attr_name = f'{sensor_name_prefix} {description.name_suffix}'.strip() self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, coordinator.con...
Implementation of a Glances sensor.
GlancesSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlancesSensor: """Implementation of a Glances sensor.""" def __init__(self, coordinator: GlancesDataUpdateCoordinator, name: str | None, sensor_name_prefix: str, description: GlancesSensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def available(s...
stack_v2_sparse_classes_36k_train_015924
12,329
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: GlancesDataUpdateCoordinator, name: str | None, sensor_name_prefix: str, description: GlancesSensorEntityDescription) -> None" }, { "docstring": "Set sensor unavailable when native value is...
3
null
Implement the Python class `GlancesSensor` described below. Class description: Implementation of a Glances sensor. Method signatures and docstrings: - def __init__(self, coordinator: GlancesDataUpdateCoordinator, name: str | None, sensor_name_prefix: str, description: GlancesSensorEntityDescription) -> None: Initiali...
Implement the Python class `GlancesSensor` described below. Class description: Implementation of a Glances sensor. Method signatures and docstrings: - def __init__(self, coordinator: GlancesDataUpdateCoordinator, name: str | None, sensor_name_prefix: str, description: GlancesSensorEntityDescription) -> None: Initiali...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class GlancesSensor: """Implementation of a Glances sensor.""" def __init__(self, coordinator: GlancesDataUpdateCoordinator, name: str | None, sensor_name_prefix: str, description: GlancesSensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def available(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlancesSensor: """Implementation of a Glances sensor.""" def __init__(self, coordinator: GlancesDataUpdateCoordinator, name: str | None, sensor_name_prefix: str, description: GlancesSensorEntityDescription) -> None: """Initialize the sensor.""" super().__init__(coordinator) self._...
the_stack_v2_python_sparse
homeassistant/components/glances/sensor.py
home-assistant/core
train
35,501
25aaabb5c9d55c509aadc67c8e11edd70bc8126d
[ "intervals.sort(key=lambda x: (x[0], -x[1]))\ncount = 0\nprev_end = 0\nfor _, end in intervals:\n if end > prev_end:\n count += 1\n prev_end = end\nprint(count)\nreturn count", "intervals.sort(key=lambda x: (x[0], -x[1]))\na = len(intervals)\nc = 0\ntmp = intervals[0]\nfor j in range(a - 1):\n ...
<|body_start_0|> intervals.sort(key=lambda x: (x[0], -x[1])) count = 0 prev_end = 0 for _, end in intervals: if end > prev_end: count += 1 prev_end = end print(count) return count <|end_body_0|> <|body_start_1|> interva...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeCoveredIntervals(self, intervals): """首先将所有元素先按照第一个元素排列,如果第一个元素相同,则按照第二个元素倒序排列。 排列后的列表,如果第二个元素无法大于前面存在的第二个元素,则舍弃 :param intervals: :return:""" <|body_0|> def removeCoveredIntervals1(self, intervals): """前面和后面是包含与被包含关系 :param intervals: :return:"""...
stack_v2_sparse_classes_36k_train_015925
3,241
no_license
[ { "docstring": "首先将所有元素先按照第一个元素排列,如果第一个元素相同,则按照第二个元素倒序排列。 排列后的列表,如果第二个元素无法大于前面存在的第二个元素,则舍弃 :param intervals: :return:", "name": "removeCoveredIntervals", "signature": "def removeCoveredIntervals(self, intervals)" }, { "docstring": "前面和后面是包含与被包含关系 :param intervals: :return:", "name": "removeC...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeCoveredIntervals(self, intervals): 首先将所有元素先按照第一个元素排列,如果第一个元素相同,则按照第二个元素倒序排列。 排列后的列表,如果第二个元素无法大于前面存在的第二个元素,则舍弃 :param intervals: :return: - def removeCoveredIntervals1(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeCoveredIntervals(self, intervals): 首先将所有元素先按照第一个元素排列,如果第一个元素相同,则按照第二个元素倒序排列。 排列后的列表,如果第二个元素无法大于前面存在的第二个元素,则舍弃 :param intervals: :return: - def removeCoveredIntervals1(s...
4a27fdd976268bf4daf8eee447efd754f1e0bb02
<|skeleton|> class Solution: def removeCoveredIntervals(self, intervals): """首先将所有元素先按照第一个元素排列,如果第一个元素相同,则按照第二个元素倒序排列。 排列后的列表,如果第二个元素无法大于前面存在的第二个元素,则舍弃 :param intervals: :return:""" <|body_0|> def removeCoveredIntervals1(self, intervals): """前面和后面是包含与被包含关系 :param intervals: :return:"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeCoveredIntervals(self, intervals): """首先将所有元素先按照第一个元素排列,如果第一个元素相同,则按照第二个元素倒序排列。 排列后的列表,如果第二个元素无法大于前面存在的第二个元素,则舍弃 :param intervals: :return:""" intervals.sort(key=lambda x: (x[0], -x[1])) count = 0 prev_end = 0 for _, end in intervals: if ...
the_stack_v2_python_sparse
remove-covered-intervals.py
Angel888/suanfa
train
0
86ef541f9a10d722d5ba349005aaccf431cbcedd
[ "descriptions = ru.as_list(descriptions)\nfor td in descriptions:\n td.raptor_id = self.uid\nreturn self._tmgr.submit_workers(descriptions)", "descriptions = ru.as_list(descriptions)\nfor td in descriptions:\n td.raptor_id = self.uid\nreturn self._tmgr.submit_tasks(descriptions)", "if not self._pilot:\n ...
<|body_start_0|> descriptions = ru.as_list(descriptions) for td in descriptions: td.raptor_id = self.uid return self._tmgr.submit_workers(descriptions) <|end_body_0|> <|body_start_1|> descriptions = ru.as_list(descriptions) for td in descriptions: td.rapt...
RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptors excel at high throughput executi...
Raptor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Raptor: """RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptor...
stack_v2_sparse_classes_36k_train_015926
4,123
permissive
[ { "docstring": "Submit a set of workers for this `Raptor` instance. Args: descriptions (List[TaskDescription]): ;aunch a raptor worker for each provided description. Returns: List[Tasks]: a list of `rp.Task` instances, one for each created worker task The method will return immediately without waiting for actua...
3
null
Implement the Python class `Raptor` described below. Class description: RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those w...
Implement the Python class `Raptor` described below. Class description: RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those w...
13852db38c96216d62130e370c1385336723b167
<|skeleton|> class Raptor: """RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Raptor: """RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptors excel at hi...
the_stack_v2_python_sparse
src/radical/pilot/raptor_tasks.py
radical-cybertools/radical.pilot
train
58
4a84eb3aa952bf8953b0759c21ebec5cd268da9f
[ "super().__init__(app, pipeline, id=id, config=config)\nself.Loop = app.Loop\nself.Pipeline = pipeline\nself.Queue = asyncio.Queue()\nself.Connection = pipeline.locate_connection(app, connection)\nself.Filename = self.Config.get('filename', None)\nself.RemotePath = self.Config['remote_path']\nself._conn_future = No...
<|body_start_0|> super().__init__(app, pipeline, id=id, config=config) self.Loop = app.Loop self.Pipeline = pipeline self.Queue = asyncio.Queue() self.Connection = pipeline.locate_connection(app, connection) self.Filename = self.Config.get('filename', None) self.R...
Description: |
FTPSource
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FTPSource: """Description: |""" def __init__(self, app, pipeline, connection, id=None, config=None): """Description: **Parameters** app : Application Name of the Application pipeline : connection : id : ID, default = None config : JSON, default = None""" <|body_0|> async...
stack_v2_sparse_classes_36k_train_015927
2,392
permissive
[ { "docstring": "Description: **Parameters** app : Application Name of the Application pipeline : connection : id : ID, default = None config : JSON, default = None", "name": "__init__", "signature": "def __init__(self, app, pipeline, connection, id=None, config=None)" }, { "docstring": "Descript...
4
stack_v2_sparse_classes_30k_train_000996
Implement the Python class `FTPSource` described below. Class description: Description: | Method signatures and docstrings: - def __init__(self, app, pipeline, connection, id=None, config=None): Description: **Parameters** app : Application Name of the Application pipeline : connection : id : ID, default = None confi...
Implement the Python class `FTPSource` described below. Class description: Description: | Method signatures and docstrings: - def __init__(self, app, pipeline, connection, id=None, config=None): Description: **Parameters** app : Application Name of the Application pipeline : connection : id : ID, default = None confi...
11ee3689d0ff6e9b662deeb3fc5e18bb0aabc8f2
<|skeleton|> class FTPSource: """Description: |""" def __init__(self, app, pipeline, connection, id=None, config=None): """Description: **Parameters** app : Application Name of the Application pipeline : connection : id : ID, default = None config : JSON, default = None""" <|body_0|> async...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FTPSource: """Description: |""" def __init__(self, app, pipeline, connection, id=None, config=None): """Description: **Parameters** app : Application Name of the Application pipeline : connection : id : ID, default = None config : JSON, default = None""" super().__init__(app, pipeline, id...
the_stack_v2_python_sparse
bspump/ftp/source.py
LibertyAces/BitSwanPump
train
24
8d925ff65c9e354626b7254abc7ba6086cd9b61f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserSecurityState()", "from .email_role import EmailRole\nfrom .logon_type import LogonType\nfrom .user_account_security_type import UserAccountSecurityType\nfrom .email_role import EmailRole\nfrom .logon_type import LogonType\nfrom .u...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserSecurityState() <|end_body_0|> <|body_start_1|> from .email_role import EmailRole from .logon_type import LogonType from .user_account_security_type import UserAccountSecurit...
UserSecurityState
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSecurityState: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_36k_train_015928
6,982
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserSecurityState", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
stack_v2_sparse_classes_30k_test_000792
Implement the Python class `UserSecurityState` described below. Class description: Implement the UserSecurityState class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `UserSecurityState` described below. Class description: Implement the UserSecurityState class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserSecurityState: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserSecurityState: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: User...
the_stack_v2_python_sparse
msgraph/generated/models/user_security_state.py
microsoftgraph/msgraph-sdk-python
train
135
827e513f1feabd9e407948c1e3d04dc55405f898
[ "current_app.logger.info('<Comment.post.request')\nrequest_json = request.get_json()\ntry:\n valid_format, errors = schema_utils.validate(request_json, 'comment')\n if valid_format:\n comment = request_json.get('comment')\n else:\n valid_format, errors = schema_utils.validate(request_json, 'c...
<|body_start_0|> current_app.logger.info('<Comment.post.request') request_json = request.get_json() try: valid_format, errors = schema_utils.validate(request_json, 'comment') if valid_format: comment = request_json.get('comment') else: ...
Endpoint resource to create/get comments for routing slips.
RoutingSlipComment
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoutingSlipComment: """Endpoint resource to create/get comments for routing slips.""" def post(routing_slip_number: str): """Create comment for a slip.""" <|body_0|> def get(routing_slip_number: str): """Get comments for a slip.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_015929
10,127
permissive
[ { "docstring": "Create comment for a slip.", "name": "post", "signature": "def post(routing_slip_number: str)" }, { "docstring": "Get comments for a slip.", "name": "get", "signature": "def get(routing_slip_number: str)" } ]
2
null
Implement the Python class `RoutingSlipComment` described below. Class description: Endpoint resource to create/get comments for routing slips. Method signatures and docstrings: - def post(routing_slip_number: str): Create comment for a slip. - def get(routing_slip_number: str): Get comments for a slip.
Implement the Python class `RoutingSlipComment` described below. Class description: Endpoint resource to create/get comments for routing slips. Method signatures and docstrings: - def post(routing_slip_number: str): Create comment for a slip. - def get(routing_slip_number: str): Get comments for a slip. <|skeleton|>...
0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1
<|skeleton|> class RoutingSlipComment: """Endpoint resource to create/get comments for routing slips.""" def post(routing_slip_number: str): """Create comment for a slip.""" <|body_0|> def get(routing_slip_number: str): """Get comments for a slip.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoutingSlipComment: """Endpoint resource to create/get comments for routing slips.""" def post(routing_slip_number: str): """Create comment for a slip.""" current_app.logger.info('<Comment.post.request') request_json = request.get_json() try: valid_format, erro...
the_stack_v2_python_sparse
pay-api/src/pay_api/resources/fas/routing_slip.py
bcgov/sbc-pay
train
6
80ccc84f6d1146b4b5ba7fbb438cce168e7655f0
[ "self._grid = grid\nself._phi = phi\nself._gamma = gamma\nself._west_bc = west_bc\nself._east_bc = east_bc", "flux_w = -self._gamma * self._grid.Aw * (self._phi[1:-1] - self._phi[0:-2]) / self._grid.dx_WP\nflux_e = -self._gamma * self._grid.Ae * (self._phi[2:] - self._phi[1:-1]) / self._grid.dx_PE\ncoeffW = -self...
<|body_start_0|> self._grid = grid self._phi = phi self._gamma = gamma self._west_bc = west_bc self._east_bc = east_bc <|end_body_0|> <|body_start_1|> flux_w = -self._gamma * self._grid.Aw * (self._phi[1:-1] - self._phi[0:-2]) / self._grid.dx_WP flux_e = -self._g...
Class defining a diffusion model
DiffusionModel
[ "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain", "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiffusionModel: """Class defining a diffusion model""" def __init__(self, grid, phi, gamma, west_bc, east_bc): """Constructor""" <|body_0|> def add(self, coeffs): """Function to add diffusion terms to coefficient arrays""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_015930
1,488
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, grid, phi, gamma, west_bc, east_bc)" }, { "docstring": "Function to add diffusion terms to coefficient arrays", "name": "add", "signature": "def add(self, coeffs)" } ]
2
null
Implement the Python class `DiffusionModel` described below. Class description: Class defining a diffusion model Method signatures and docstrings: - def __init__(self, grid, phi, gamma, west_bc, east_bc): Constructor - def add(self, coeffs): Function to add diffusion terms to coefficient arrays
Implement the Python class `DiffusionModel` described below. Class description: Class defining a diffusion model Method signatures and docstrings: - def __init__(self, grid, phi, gamma, west_bc, east_bc): Constructor - def add(self, coeffs): Function to add diffusion terms to coefficient arrays <|skeleton|> class Di...
5e9a0e03aa7ddf5e5ddf89943ccc68d94b539e95
<|skeleton|> class DiffusionModel: """Class defining a diffusion model""" def __init__(self, grid, phi, gamma, west_bc, east_bc): """Constructor""" <|body_0|> def add(self, coeffs): """Function to add diffusion terms to coefficient arrays""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiffusionModel: """Class defining a diffusion model""" def __init__(self, grid, phi, gamma, west_bc, east_bc): """Constructor""" self._grid = grid self._phi = phi self._gamma = gamma self._west_bc = west_bc self._east_bc = east_bc def add(self, coeffs)...
the_stack_v2_python_sparse
Advanced_Computational_Fluid_Dynamics_MME_9710_DeGroot/Lessons/Lesson5/Models.py
burakbayramli/books
train
223
165b0552992e20f7e01bb466f25863cace0f9c7e
[ "q = [root]\nres = []\nwhile q:\n l = len(q)\n for i in range(l):\n tmp = q.pop(0)\n if tmp != None:\n res.append(str(tmp.val))\n q.append(tmp.left)\n q.append(tmp.right)\n else:\n res.append('null')\nreturn ','.join(res)", "res = data.split('...
<|body_start_0|> q = [root] res = [] while q: l = len(q) for i in range(l): tmp = q.pop(0) if tmp != None: res.append(str(tmp.val)) q.append(tmp.left) q.append(tmp.right) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_015931
1,638
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
b68ea41688e9e305635c63fdc43402e2b6fe6524
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = [root] res = [] while q: l = len(q) for i in range(l): tmp = q.pop(0) if tmp != None: res....
the_stack_v2_python_sparse
图解算法数据结构/搜索与回溯算法/37.序列化二叉树.py
Hegemony/Python-Practice
train
0
b8314c876129b1e808f0275672eb8d49bfd1e38d
[ "connection = connections[using or 'default']\nwith transaction.atomic():\n with connection.schema_editor() as schema_editor:\n for partition in self.creations:\n partition.create(self.config.model, cast('PostgresSchemaEditor', schema_editor), comment=AUTO_PARTITIONED_COMMENT)\n for part...
<|body_start_0|> connection = connections[using or 'default'] with transaction.atomic(): with connection.schema_editor() as schema_editor: for partition in self.creations: partition.create(self.config.model, cast('PostgresSchemaEditor', schema_editor), com...
Describes the partitions that are going to be created/deleted for a particular partitioning config. A "partitioning config" applies to one model.
PostgresModelPartitioningPlan
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostgresModelPartitioningPlan: """Describes the partitions that are going to be created/deleted for a particular partitioning config. A "partitioning config" applies to one model.""" def apply(self, using: Optional[str]) -> None: """Applies this partitioning plan by creating and dele...
stack_v2_sparse_classes_36k_train_015932
3,768
permissive
[ { "docstring": "Applies this partitioning plan by creating and deleting the planned partitions. Applying the plan runs in a transaction. Arguments: using: Optional name of the database connection to use.", "name": "apply", "signature": "def apply(self, using: Optional[str]) -> None" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_014228
Implement the Python class `PostgresModelPartitioningPlan` described below. Class description: Describes the partitions that are going to be created/deleted for a particular partitioning config. A "partitioning config" applies to one model. Method signatures and docstrings: - def apply(self, using: Optional[str]) -> ...
Implement the Python class `PostgresModelPartitioningPlan` described below. Class description: Describes the partitions that are going to be created/deleted for a particular partitioning config. A "partitioning config" applies to one model. Method signatures and docstrings: - def apply(self, using: Optional[str]) -> ...
e5503cb3f3c1b7959bd55253d3a79296f4c8f0ef
<|skeleton|> class PostgresModelPartitioningPlan: """Describes the partitions that are going to be created/deleted for a particular partitioning config. A "partitioning config" applies to one model.""" def apply(self, using: Optional[str]) -> None: """Applies this partitioning plan by creating and dele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostgresModelPartitioningPlan: """Describes the partitions that are going to be created/deleted for a particular partitioning config. A "partitioning config" applies to one model.""" def apply(self, using: Optional[str]) -> None: """Applies this partitioning plan by creating and deleting the plan...
the_stack_v2_python_sparse
psqlextra/partitioning/plan.py
SectorLabs/django-postgres-extra
train
645
590db7f9da4282bb880a6961f50e693765711a47
[ "self.neighbour_selection_method = neighbour_selection_method\nself.threshold_coord = DimCoord\nself.units = None", "enforce_coordinate_ordering(spot_cube, ['spot_index', self.threshold_coord.name()])\nn_sites = len(spot_cube.coord('spot_index').points)\nn_thresholds = len(self.threshold_coord.points)\nthresholds...
<|body_start_0|> self.neighbour_selection_method = neighbour_selection_method self.threshold_coord = DimCoord self.units = None <|end_body_0|> <|body_start_1|> enforce_coordinate_ordering(spot_cube, ['spot_index', self.threshold_coord.name()]) n_sites = len(spot_cube.coord('spot...
Class to adjust spot extracted "height above ground level" forecasts to account for differences between site height and orography grid square height. The spot forecast contains information representative of the associated grid point and as such this needs to be adjusted to reflect the true site altitude. For realizatio...
SpotHeightAdjustment
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpotHeightAdjustment: """Class to adjust spot extracted "height above ground level" forecasts to account for differences between site height and orography grid square height. The spot forecast contains information representative of the associated grid point and as such this needs to be adjusted t...
stack_v2_sparse_classes_36k_train_015933
9,898
permissive
[ { "docstring": "Args: neighbour_selection_method: The neighbour cube may contain one or several sets of grid coordinates that match a spot site. These are determined by the neighbour finding method employed. This keyword is used to extract the desired set of coordinates from the neighbour cube.", "name": "_...
3
null
Implement the Python class `SpotHeightAdjustment` described below. Class description: Class to adjust spot extracted "height above ground level" forecasts to account for differences between site height and orography grid square height. The spot forecast contains information representative of the associated grid point ...
Implement the Python class `SpotHeightAdjustment` described below. Class description: Class to adjust spot extracted "height above ground level" forecasts to account for differences between site height and orography grid square height. The spot forecast contains information representative of the associated grid point ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class SpotHeightAdjustment: """Class to adjust spot extracted "height above ground level" forecasts to account for differences between site height and orography grid square height. The spot forecast contains information representative of the associated grid point and as such this needs to be adjusted t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpotHeightAdjustment: """Class to adjust spot extracted "height above ground level" forecasts to account for differences between site height and orography grid square height. The spot forecast contains information representative of the associated grid point and as such this needs to be adjusted to reflect the...
the_stack_v2_python_sparse
improver/spotdata/height_adjustment.py
metoppv/improver
train
101
531894a09a993d408684dbefca29573369e9f5cc
[ "t = minutesToTest // minutesToDie + 1\ni = 0\nc = 1\nwhile c < buckets:\n c *= t\n i += 1\nreturn i", "l = math.log(buckets) / math.log(minutesToTest // minutesToDie + 1)\nif l > int(l):\n l += 1\nreturn int(l)", "@lru_cache(None)\ndef max_buckets(pigs, steps):\n if steps == 1:\n return 2 **...
<|body_start_0|> t = minutesToTest // minutesToDie + 1 i = 0 c = 1 while c < buckets: c *= t i += 1 return i <|end_body_0|> <|body_start_1|> l = math.log(buckets) / math.log(minutesToTest // minutesToDie + 1) if l > int(l): l +...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int: """10/24/2020 20:58 Each pig can find from steps+1 groups Time Complexity: O(log(buckets)) Space Complexity: O(1)""" <|body_0|> def poorPigs(self, buckets: int, minutesToDie: int, minut...
stack_v2_sparse_classes_36k_train_015934
3,637
no_license
[ { "docstring": "10/24/2020 20:58 Each pig can find from steps+1 groups Time Complexity: O(log(buckets)) Space Complexity: O(1)", "name": "poorPigs", "signature": "def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int" }, { "docstring": "10/24/2020 20:59 Each pig can find...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int: 10/24/2020 20:58 Each pig can find from steps+1 groups Time Complexity: O(log(buckets)) Space Comp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int: 10/24/2020 20:58 Each pig can find from steps+1 groups Time Complexity: O(log(buckets)) Space Comp...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int: """10/24/2020 20:58 Each pig can find from steps+1 groups Time Complexity: O(log(buckets)) Space Complexity: O(1)""" <|body_0|> def poorPigs(self, buckets: int, minutesToDie: int, minut...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int: """10/24/2020 20:58 Each pig can find from steps+1 groups Time Complexity: O(log(buckets)) Space Complexity: O(1)""" t = minutesToTest // minutesToDie + 1 i = 0 c = 1 while c < buc...
the_stack_v2_python_sparse
leetcode/solved/458_Poor_Pigs/solution.py
sungminoh/algorithms
train
0
25e009475d7ba1a7967f88e1c95959f141b40bcd
[ "Process.__init__(self)\nself.engine = engine\nself.updaters = {}", "logging.info(u'Starting observer')\ntry:\n self.engine.set('observer.counter', 0)\n while self.engine.get('general.switch', 'on') == 'on':\n if not self.engine.fan:\n break\n if self.engine.fan.empty():\n ...
<|body_start_0|> Process.__init__(self) self.engine = engine self.updaters = {} <|end_body_0|> <|body_start_1|> logging.info(u'Starting observer') try: self.engine.set('observer.counter', 0) while self.engine.get('general.switch', 'on') == 'on': ...
Dispatches inbound records to downwards updaters
Observer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Observer: """Dispatches inbound records to downwards updaters""" def __init__(self, engine=None): """Dispatches inbound records to downwards updaters :param engine: the overarching engine :type engine: Engine""" <|body_0|> def run(self): """Continuously handle in...
stack_v2_sparse_classes_36k_train_015935
4,987
permissive
[ { "docstring": "Dispatches inbound records to downwards updaters :param engine: the overarching engine :type engine: Engine", "name": "__init__", "signature": "def __init__(self, engine=None)" }, { "docstring": "Continuously handle inbound records and commands This function is looping on items r...
3
null
Implement the Python class `Observer` described below. Class description: Dispatches inbound records to downwards updaters Method signatures and docstrings: - def __init__(self, engine=None): Dispatches inbound records to downwards updaters :param engine: the overarching engine :type engine: Engine - def run(self): C...
Implement the Python class `Observer` described below. Class description: Dispatches inbound records to downwards updaters Method signatures and docstrings: - def __init__(self, engine=None): Dispatches inbound records to downwards updaters :param engine: the overarching engine :type engine: Engine - def run(self): C...
daf64fbab4085d1591bf9a1aecd06b4fc615d132
<|skeleton|> class Observer: """Dispatches inbound records to downwards updaters""" def __init__(self, engine=None): """Dispatches inbound records to downwards updaters :param engine: the overarching engine :type engine: Engine""" <|body_0|> def run(self): """Continuously handle in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Observer: """Dispatches inbound records to downwards updaters""" def __init__(self, engine=None): """Dispatches inbound records to downwards updaters :param engine: the overarching engine :type engine: Engine""" Process.__init__(self) self.engine = engine self.updaters = {...
the_stack_v2_python_sparse
shellbot/observer.py
romainkotarba/shellbot
train
0
e6d556866429c2b69668e852169dace2e23259b8
[ "if get_size:\n log.info('%s: %s - %s', name, X.shape, self._size(X))\nelse:\n log.info('%s: %s', name, X.shape)", "s = 1\nfor v in X.shape[1:]:\n s = s * v\nreturn s" ]
<|body_start_0|> if get_size: log.info('%s: %s - %s', name, X.shape, self._size(X)) else: log.info('%s: %s', name, X.shape) <|end_body_0|> <|body_start_1|> s = 1 for v in X.shape[1:]: s = s * v return s <|end_body_1|>
Mixin class for autoencoders.
MixinAE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixinAE: """Mixin class for autoencoders.""" def _info(self, name, X, get_size=True): """Log the shape information about the current tensor. Parameters ---------- name: str Id of the step. X: torch.Tensor The tensor to analyse. get_size: bool If `True` the total number of parameters ...
stack_v2_sparse_classes_36k_train_015936
11,241
permissive
[ { "docstring": "Log the shape information about the current tensor. Parameters ---------- name: str Id of the step. X: torch.Tensor The tensor to analyse. get_size: bool If `True` the total number of parameters will be computed.", "name": "_info", "signature": "def _info(self, name, X, get_size=True)" ...
2
stack_v2_sparse_classes_30k_train_001759
Implement the Python class `MixinAE` described below. Class description: Mixin class for autoencoders. Method signatures and docstrings: - def _info(self, name, X, get_size=True): Log the shape information about the current tensor. Parameters ---------- name: str Id of the step. X: torch.Tensor The tensor to analyse....
Implement the Python class `MixinAE` described below. Class description: Mixin class for autoencoders. Method signatures and docstrings: - def _info(self, name, X, get_size=True): Log the shape information about the current tensor. Parameters ---------- name: str Id of the step. X: torch.Tensor The tensor to analyse....
01b4a45e3d7361d71f1a4bfee19ccb4e7d1fef3c
<|skeleton|> class MixinAE: """Mixin class for autoencoders.""" def _info(self, name, X, get_size=True): """Log the shape information about the current tensor. Parameters ---------- name: str Id of the step. X: torch.Tensor The tensor to analyse. get_size: bool If `True` the total number of parameters ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MixinAE: """Mixin class for autoencoders.""" def _info(self, name, X, get_size=True): """Log the shape information about the current tensor. Parameters ---------- name: str Id of the step. X: torch.Tensor The tensor to analyse. get_size: bool If `True` the total number of parameters will be compu...
the_stack_v2_python_sparse
AutoEncoders.py
AliceAdenis/paintautoencs
train
0
93c07b2ef8d12b654c74bd63ad323806cc2f7274
[ "super(QLearningPolicy, self).__init__()\nself.extractor = Conv1dExtractor(conv_params=conv_params, add_BN=add_BN, output_dim=output_dim, share_params=True)\nself.value_net = nn.Linear(output_dim[-1], action_dim)\nself.optimizer = torch.optim.Adam(self.parameters(), lr=learning_rate, eps=1e-05)", "latent_vf, _ = ...
<|body_start_0|> super(QLearningPolicy, self).__init__() self.extractor = Conv1dExtractor(conv_params=conv_params, add_BN=add_BN, output_dim=output_dim, share_params=True) self.value_net = nn.Linear(output_dim[-1], action_dim) self.optimizer = torch.optim.Adam(self.parameters(), lr=learn...
QLearningPolicy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QLearningPolicy: def __init__(self, conv_params: list, add_BN: bool, output_dim: list, action_dim: int, learning_rate: Union[int, float]): """:param conv_params: type of item in iteration must be dict object, and dict keys are Conv layer param names, key values are allowed param values :...
stack_v2_sparse_classes_36k_train_015937
25,538
no_license
[ { "docstring": ":param conv_params: type of item in iteration must be dict object, and dict keys are Conv layer param names, key values are allowed param values :param add_BN: :param output_dim: type of item in iteration must be int object :param action_dim: :param learning_rate: :return:", "name": "__init_...
2
stack_v2_sparse_classes_30k_train_007336
Implement the Python class `QLearningPolicy` described below. Class description: Implement the QLearningPolicy class. Method signatures and docstrings: - def __init__(self, conv_params: list, add_BN: bool, output_dim: list, action_dim: int, learning_rate: Union[int, float]): :param conv_params: type of item in iterat...
Implement the Python class `QLearningPolicy` described below. Class description: Implement the QLearningPolicy class. Method signatures and docstrings: - def __init__(self, conv_params: list, add_BN: bool, output_dim: list, action_dim: int, learning_rate: Union[int, float]): :param conv_params: type of item in iterat...
606a4820b4597949967de4363a13657b58c2ef12
<|skeleton|> class QLearningPolicy: def __init__(self, conv_params: list, add_BN: bool, output_dim: list, action_dim: int, learning_rate: Union[int, float]): """:param conv_params: type of item in iteration must be dict object, and dict keys are Conv layer param names, key values are allowed param values :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QLearningPolicy: def __init__(self, conv_params: list, add_BN: bool, output_dim: list, action_dim: int, learning_rate: Union[int, float]): """:param conv_params: type of item in iteration must be dict object, and dict keys are Conv layer param names, key values are allowed param values :param add_BN: ...
the_stack_v2_python_sparse
ITSC_project/multi_agent_dispatching/common_utils/policies.py
eecqupt/mobile_crowd_sensing
train
0
6100f1a09996674b67a958a7026ada368ae699fb
[ "nn.Module.__init__(self)\nself.nu = nu\nself.eps = eps\nself.soft_boundary = soft_boundary", "dist, idx = torch.min(torch.sum((c.unsqueeze(0) - input.unsqueeze(1)) ** 2, dim=2), dim=1)\nif self.soft_boundary:\n scores = dist - torch.stack([R[i] ** 2 for i in idx], dim=0)\n loss = torch.mean(R ** 2) + 1 / s...
<|body_start_0|> nn.Module.__init__(self) self.nu = nu self.eps = eps self.soft_boundary = soft_boundary <|end_body_0|> <|body_start_1|> dist, idx = torch.min(torch.sum((c.unsqueeze(0) - input.unsqueeze(1)) ** 2, dim=2), dim=1) if self.soft_boundary: scores =...
Implementation of the DMSVDD loss proposed by Ghafoori et al. (2020).
DMSVDDLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DMSVDDLoss: """Implementation of the DMSVDD loss proposed by Ghafoori et al. (2020).""" def __init__(self, nu, eps=1e-06, soft_boundary=False): """Constructor of the DMSVDD loss. ---------- INPUT |---- nu (float) a priory fraction of outliers. |---- eps (float) epsilon to ensure nume...
stack_v2_sparse_classes_36k_train_015938
18,386
permissive
[ { "docstring": "Constructor of the DMSVDD loss. ---------- INPUT |---- nu (float) a priory fraction of outliers. |---- eps (float) epsilon to ensure numerical stability in the | inverse distance. |---- soft_boundary (bool) whether to use a soft boundary OUTPUT |---- None", "name": "__init__", "signature...
2
stack_v2_sparse_classes_30k_train_006000
Implement the Python class `DMSVDDLoss` described below. Class description: Implementation of the DMSVDD loss proposed by Ghafoori et al. (2020). Method signatures and docstrings: - def __init__(self, nu, eps=1e-06, soft_boundary=False): Constructor of the DMSVDD loss. ---------- INPUT |---- nu (float) a priory fract...
Implement the Python class `DMSVDDLoss` described below. Class description: Implementation of the DMSVDD loss proposed by Ghafoori et al. (2020). Method signatures and docstrings: - def __init__(self, nu, eps=1e-06, soft_boundary=False): Constructor of the DMSVDD loss. ---------- INPUT |---- nu (float) a priory fract...
850b6195d6290a50eee865b4d5a66f5db5260e8f
<|skeleton|> class DMSVDDLoss: """Implementation of the DMSVDD loss proposed by Ghafoori et al. (2020).""" def __init__(self, nu, eps=1e-06, soft_boundary=False): """Constructor of the DMSVDD loss. ---------- INPUT |---- nu (float) a priory fraction of outliers. |---- eps (float) epsilon to ensure nume...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DMSVDDLoss: """Implementation of the DMSVDD loss proposed by Ghafoori et al. (2020).""" def __init__(self, nu, eps=1e-06, soft_boundary=False): """Constructor of the DMSVDD loss. ---------- INPUT |---- nu (float) a priory fraction of outliers. |---- eps (float) epsilon to ensure numerical stabili...
the_stack_v2_python_sparse
Code/src/models/optim/CustomLosses.py
antoine-spahr/X-ray-Anomaly-Detection
train
3
2c3e15131d0fddb7764d02213f2e87be4c270b7b
[ "res = []\nuf = UnionFind(n)\nfor user1, user2 in requests:\n root1, root2 = (uf.find(user1), uf.find(user2))\n if root1 == root2:\n res.append(True)\n else:\n for user3, user4 in restrictions:\n root3, root4 = (uf.find(user3), uf.find(user4))\n if root1 == root3 and roo...
<|body_start_0|> res = [] uf = UnionFind(n) for user1, user2 in requests: root1, root2 = (uf.find(user1), uf.find(user2)) if root1 == root2: res.append(True) else: for user3, user4 in restrictions: root3, roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: """并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)""" <|body_0|> def friendRequests2(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List...
stack_v2_sparse_classes_36k_train_015939
3,693
no_license
[ { "docstring": "并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)", "name": "friendRequests", "signature": "def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]" }, { "docstring": "可撤销并查集", "name": "friendRequests2", "signature": "def friendRe...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: 并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2) - def friendRequests2(self, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: 并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2) - def friendRequests2(self, n...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: """并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)""" <|body_0|> def friendRequests2(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: """并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)""" res = [] uf = UnionFind(n) for user1, user2 in requests: root1, root2 = (uf.find(user1), uf.find(user...
the_stack_v2_python_sparse
14_并查集/经典题/2076. 处理含限制条件的好友请求.py
981377660LMT/algorithm-study
train
225
c6c2d01db5c4093f6b325c8dd9fd8c5501ba34dc
[ "fetch_full_feed = is_incremental_feed = False\nwith pytest.raises(DemistoException) as e:\n assert_incremental_feed_params(fetch_full_feed, is_incremental_feed)\n assert \"'Full Feed Fetch' cannot be disabled when 'Incremental Feed' is disabled.\" in str(e)", "fetch_full_feed = is_incremental_feed = True\n...
<|body_start_0|> fetch_full_feed = is_incremental_feed = False with pytest.raises(DemistoException) as e: assert_incremental_feed_params(fetch_full_feed, is_incremental_feed) assert "'Full Feed Fetch' cannot be disabled when 'Incremental Feed' is disabled." in str(e) <|end_body_0...
Scenario: Test assert_incremental_feed_params raises appropriate errors
TestAssertIncrementalFeedParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAssertIncrementalFeedParams: """Scenario: Test assert_incremental_feed_params raises appropriate errors""" def test_both_params_are_false(self): """Scenario: Both params are False Given: - fetch_full_feed is false - feedIncremental is false When: - calling assert_incremental_feed...
stack_v2_sparse_classes_36k_train_015940
9,956
permissive
[ { "docstring": "Scenario: Both params are False Given: - fetch_full_feed is false - feedIncremental is false When: - calling assert_incremental_feed_params Then: - raise appropriate error", "name": "test_both_params_are_false", "signature": "def test_both_params_are_false(self)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_val_000589
Implement the Python class `TestAssertIncrementalFeedParams` described below. Class description: Scenario: Test assert_incremental_feed_params raises appropriate errors Method signatures and docstrings: - def test_both_params_are_false(self): Scenario: Both params are False Given: - fetch_full_feed is false - feedInc...
Implement the Python class `TestAssertIncrementalFeedParams` described below. Class description: Scenario: Test assert_incremental_feed_params raises appropriate errors Method signatures and docstrings: - def test_both_params_are_false(self): Scenario: Both params are False Given: - fetch_full_feed is false - feedInc...
01b57f8c658c2faed047313d3034e8052ffa83ce
<|skeleton|> class TestAssertIncrementalFeedParams: """Scenario: Test assert_incremental_feed_params raises appropriate errors""" def test_both_params_are_false(self): """Scenario: Both params are False Given: - fetch_full_feed is false - feedIncremental is false When: - calling assert_incremental_feed...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAssertIncrementalFeedParams: """Scenario: Test assert_incremental_feed_params raises appropriate errors""" def test_both_params_are_false(self): """Scenario: Both params are False Given: - fetch_full_feed is false - feedIncremental is false When: - calling assert_incremental_feed_params Then:...
the_stack_v2_python_sparse
Packs/FeedTAXII/Integrations/FeedTAXII2/FeedTAXII2_test.py
adambaumeister/content
train
2
d62d6cb9002f9965104b47d55f890ea879f64883
[ "if head is None or head.next is None:\n return head\nself.recursion_reverse_list(head)\nreturn self.tail", "if current_node.next.next is None:\n self.tail = current_node.next\nelse:\n self.recursion_reverse_list(current_node.next)\ncurrent_node.next.next = current_node\ncurrent_node.next = None" ]
<|body_start_0|> if head is None or head.next is None: return head self.recursion_reverse_list(head) return self.tail <|end_body_0|> <|body_start_1|> if current_node.next.next is None: self.tail = current_node.next else: self.recursion_reverse...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def recursion_reverse_list(self, current_node): """:type current_node: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head is None or head.nex...
stack_v2_sparse_classes_36k_train_015941
2,001
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type current_node: ListNode", "name": "recursion_reverse_list", "signature": "def recursion_reverse_list(self, current_node)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def recursion_reverse_list(self, current_node): :type current_node: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def recursion_reverse_list(self, current_node): :type current_node: ListNode <|skeleton|> class Solution: ...
1c8f2c096241e5b27d63ef3cbf5d41c08f2e12e7
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def recursion_reverse_list(self, current_node): """:type current_node: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" if head is None or head.next is None: return head self.recursion_reverse_list(head) return self.tail def recursion_reverse_list(self, current_node): """:type current_node...
the_stack_v2_python_sparse
算法/链表/反转链表.py
Pengsicong/learn_python
train
1
4b0587f4d4fa067a590dc79ee2796214fa1a7d37
[ "if isinstance(test, TestModule):\n log.debug('isolating sys.modules changes in %s', test)\n self._mods = sys.modules.copy()", "if isinstance(test, TestModule):\n to_del = [m for m in sys.modules.keys() if m not in self._mods]\n if to_del:\n log.debug('removing sys modules entries: %s', to_del)...
<|body_start_0|> if isinstance(test, TestModule): log.debug('isolating sys.modules changes in %s', test) self._mods = sys.modules.copy() <|end_body_0|> <|body_start_1|> if isinstance(test, TestModule): to_del = [m for m in sys.modules.keys() if m not in self._mods] ...
Activate the isolation plugin to isolate changes to external modules to a single test module or package. The isolation plugin resets the contents of sys.modules after each test module or package runs to its state before the test. PLEASE NOTE that this plugin may not be used with the coverage plugin.
IsolationPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsolationPlugin: """Activate the isolation plugin to isolate changes to external modules to a single test module or package. The isolation plugin resets the contents of sys.modules after each test module or package runs to its state before the test. PLEASE NOTE that this plugin may not be used wi...
stack_v2_sparse_classes_36k_train_015942
2,101
no_license
[ { "docstring": "Save the state of sys.modules if we're starting a test module", "name": "startTest", "signature": "def startTest(self, test)" }, { "docstring": "Restore the saved state of sys.modules if we're ending a test module", "name": "stopTest", "signature": "def stopTest(self, tes...
2
null
Implement the Python class `IsolationPlugin` described below. Class description: Activate the isolation plugin to isolate changes to external modules to a single test module or package. The isolation plugin resets the contents of sys.modules after each test module or package runs to its state before the test. PLEASE N...
Implement the Python class `IsolationPlugin` described below. Class description: Activate the isolation plugin to isolate changes to external modules to a single test module or package. The isolation plugin resets the contents of sys.modules after each test module or package runs to its state before the test. PLEASE N...
ca228848364edb204b15a7411fd6192379781c78
<|skeleton|> class IsolationPlugin: """Activate the isolation plugin to isolate changes to external modules to a single test module or package. The isolation plugin resets the contents of sys.modules after each test module or package runs to its state before the test. PLEASE NOTE that this plugin may not be used wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsolationPlugin: """Activate the isolation plugin to isolate changes to external modules to a single test module or package. The isolation plugin resets the contents of sys.modules after each test module or package runs to its state before the test. PLEASE NOTE that this plugin may not be used with the covera...
the_stack_v2_python_sparse
working-env/lib/python2.5/nose-0.9.3-py2.5.egg/nose/plugins/isolate.py
thraxil/gtreed
train
1
f68e8d93df133ee99060ab7960a68a1e4c1364f4
[ "matches = []\nfirst_key = keys[0]\nsecond_key = keys[1]\nif isinstance(second_key, (six.string_types, int)):\n if isinstance(map_name, six.string_types):\n mapping = mappings.get(map_name)\n if mapping:\n if isinstance(first_key, (six.string_types, int)):\n if isinstance(...
<|body_start_0|> matches = [] first_key = keys[0] second_key = keys[1] if isinstance(second_key, (six.string_types, int)): if isinstance(map_name, six.string_types): mapping = mappings.get(map_name) if mapping: if isinstance...
Check if FindInMap values are correct
FindInMapKeys
[ "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindInMapKeys: """Check if FindInMap values are correct""" def check_keys(self, map_name, keys, mappings, tree): """Check the validity of the first key""" <|body_0|> def match(self, cfn): """Check CloudFormation GetAtt""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_015943
3,107
permissive
[ { "docstring": "Check the validity of the first key", "name": "check_keys", "signature": "def check_keys(self, map_name, keys, mappings, tree)" }, { "docstring": "Check CloudFormation GetAtt", "name": "match", "signature": "def match(self, cfn)" } ]
2
stack_v2_sparse_classes_30k_train_008468
Implement the Python class `FindInMapKeys` described below. Class description: Check if FindInMap values are correct Method signatures and docstrings: - def check_keys(self, map_name, keys, mappings, tree): Check the validity of the first key - def match(self, cfn): Check CloudFormation GetAtt
Implement the Python class `FindInMapKeys` described below. Class description: Check if FindInMap values are correct Method signatures and docstrings: - def check_keys(self, map_name, keys, mappings, tree): Check the validity of the first key - def match(self, cfn): Check CloudFormation GetAtt <|skeleton|> class Fin...
5176573c2f4cb7313998b4bc0bcb0716b58ea380
<|skeleton|> class FindInMapKeys: """Check if FindInMap values are correct""" def check_keys(self, map_name, keys, mappings, tree): """Check the validity of the first key""" <|body_0|> def match(self, cfn): """Check CloudFormation GetAtt""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindInMapKeys: """Check if FindInMap values are correct""" def check_keys(self, map_name, keys, mappings, tree): """Check the validity of the first key""" matches = [] first_key = keys[0] second_key = keys[1] if isinstance(second_key, (six.string_types, int)): ...
the_stack_v2_python_sparse
src/cfnlint/rules/functions/FindInMapKeys.py
rene84/cfn-python-lint
train
1
13ccc774972bd4d141b0d2bb571ff646bd1372f8
[ "dummy = ListNode(None)\ncurr = dummy\ncurr1, curr2 = (head1, head2)\nwhile curr1 and curr2:\n if curr1.val < curr2.val:\n curr.next = curr1\n curr1 = curr1.next\n else:\n curr.next = curr2\n curr2 = curr2.next\n curr = curr.next\nif curr1:\n curr.next = curr1\nelif curr2:\n ...
<|body_start_0|> dummy = ListNode(None) curr = dummy curr1, curr2 = (head1, head2) while curr1 and curr2: if curr1.val < curr2.val: curr.next = curr1 curr1 = curr1.next else: curr.next = curr2 curr2 =...
SolutionRecursive
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionRecursive: def merge(self, head1, head2): """Merges two sorted linked lists into one sorted linked list. Time complexity: O(max(n, m)). Space complexity: O(1), n, m are lengths of the linked lists.""" <|body_0|> def sortList(self, head): """Recursive Merge So...
stack_v2_sparse_classes_36k_train_015944
5,124
no_license
[ { "docstring": "Merges two sorted linked lists into one sorted linked list. Time complexity: O(max(n, m)). Space complexity: O(1), n, m are lengths of the linked lists.", "name": "merge", "signature": "def merge(self, head1, head2)" }, { "docstring": "Recursive Merge Sort algorithm for linked li...
2
null
Implement the Python class `SolutionRecursive` described below. Class description: Implement the SolutionRecursive class. Method signatures and docstrings: - def merge(self, head1, head2): Merges two sorted linked lists into one sorted linked list. Time complexity: O(max(n, m)). Space complexity: O(1), n, m are lengt...
Implement the Python class `SolutionRecursive` described below. Class description: Implement the SolutionRecursive class. Method signatures and docstrings: - def merge(self, head1, head2): Merges two sorted linked lists into one sorted linked list. Time complexity: O(max(n, m)). Space complexity: O(1), n, m are lengt...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class SolutionRecursive: def merge(self, head1, head2): """Merges two sorted linked lists into one sorted linked list. Time complexity: O(max(n, m)). Space complexity: O(1), n, m are lengths of the linked lists.""" <|body_0|> def sortList(self, head): """Recursive Merge So...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolutionRecursive: def merge(self, head1, head2): """Merges two sorted linked lists into one sorted linked list. Time complexity: O(max(n, m)). Space complexity: O(1), n, m are lengths of the linked lists.""" dummy = ListNode(None) curr = dummy curr1, curr2 = (head1, head2) ...
the_stack_v2_python_sparse
Linked_Lists/sort_list.py
vladn90/Algorithms
train
0
bebe5e2754eb3c08b50c2f8d580eed14687c725a
[ "TagsLU.CheckPrereq(self)\nfor tag in self.op.tags:\n objects.TaggableObject.ValidateTag(tag)\ndel_tags = frozenset(self.op.tags)\ncur_tags = self.target.GetTags()\ndiff_tags = del_tags - cur_tags\nif diff_tags:\n diff_names = (\"'%s'\" % i for i in sorted(diff_tags))\n raise errors.OpPrereqError('Tag(s) %...
<|body_start_0|> TagsLU.CheckPrereq(self) for tag in self.op.tags: objects.TaggableObject.ValidateTag(tag) del_tags = frozenset(self.op.tags) cur_tags = self.target.GetTags() diff_tags = del_tags - cur_tags if diff_tags: diff_names = ("'%s'" % i fo...
Delete a list of tags from a given object.
LUTagsDel
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LUTagsDel: """Delete a list of tags from a given object.""" def CheckPrereq(self): """Check prerequisites. This checks that we have the given tag.""" <|body_0|> def Exec(self, feedback_fn): """Remove the tag from the object.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_015945
7,102
permissive
[ { "docstring": "Check prerequisites. This checks that we have the given tag.", "name": "CheckPrereq", "signature": "def CheckPrereq(self)" }, { "docstring": "Remove the tag from the object.", "name": "Exec", "signature": "def Exec(self, feedback_fn)" } ]
2
null
Implement the Python class `LUTagsDel` described below. Class description: Delete a list of tags from a given object. Method signatures and docstrings: - def CheckPrereq(self): Check prerequisites. This checks that we have the given tag. - def Exec(self, feedback_fn): Remove the tag from the object.
Implement the Python class `LUTagsDel` described below. Class description: Delete a list of tags from a given object. Method signatures and docstrings: - def CheckPrereq(self): Check prerequisites. This checks that we have the given tag. - def Exec(self, feedback_fn): Remove the tag from the object. <|skeleton|> cla...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class LUTagsDel: """Delete a list of tags from a given object.""" def CheckPrereq(self): """Check prerequisites. This checks that we have the given tag.""" <|body_0|> def Exec(self, feedback_fn): """Remove the tag from the object.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LUTagsDel: """Delete a list of tags from a given object.""" def CheckPrereq(self): """Check prerequisites. This checks that we have the given tag.""" TagsLU.CheckPrereq(self) for tag in self.op.tags: objects.TaggableObject.ValidateTag(tag) del_tags = frozenset(...
the_stack_v2_python_sparse
lib/cmdlib/tags.py
ganeti/ganeti
train
465
a848caf1cf3c55cb5533b0948e4a2ab447d032e9
[ "super(StringPreference, self).__init__(*args, **kwargs)\nif self.default in ('', ' ', None):\n self.default = str(uuid.uuid4())", "try:\n uuid.UUID(value, version=4)\nexcept Exception as e:\n raise ValidationError(str(e))" ]
<|body_start_0|> super(StringPreference, self).__init__(*args, **kwargs) if self.default in ('', ' ', None): self.default = str(uuid.uuid4()) <|end_body_0|> <|body_start_1|> try: uuid.UUID(value, version=4) except Exception as e: raise ValidationError...
Dynamic Preference for Orchestrator ID
OrchestratorID
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrchestratorID: """Dynamic Preference for Orchestrator ID""" def __init__(self, *args, **kwargs): """Initialize the ID of the orchestrator :param args: positional args :param kwargs: key/value args""" <|body_0|> def validate(self, value): """Validate the ID when ...
stack_v2_sparse_classes_36k_train_015946
3,757
permissive
[ { "docstring": "Initialize the ID of the orchestrator :param args: positional args :param kwargs: key/value args", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Validate the ID when updated :param value: new value to validate :return: None/exception", ...
2
stack_v2_sparse_classes_30k_train_000698
Implement the Python class `OrchestratorID` described below. Class description: Dynamic Preference for Orchestrator ID Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the ID of the orchestrator :param args: positional args :param kwargs: key/value args - def validate(self, value): ...
Implement the Python class `OrchestratorID` described below. Class description: Dynamic Preference for Orchestrator ID Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the ID of the orchestrator :param args: positional args :param kwargs: key/value args - def validate(self, value): ...
85102bb41aa0d558a3fa088e4fd6f51613599ad0
<|skeleton|> class OrchestratorID: """Dynamic Preference for Orchestrator ID""" def __init__(self, *args, **kwargs): """Initialize the ID of the orchestrator :param args: positional args :param kwargs: key/value args""" <|body_0|> def validate(self, value): """Validate the ID when ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrchestratorID: """Dynamic Preference for Orchestrator ID""" def __init__(self, *args, **kwargs): """Initialize the ID of the orchestrator :param args: positional args :param kwargs: key/value args""" super(StringPreference, self).__init__(*args, **kwargs) if self.default in ('', ...
the_stack_v2_python_sparse
orchestrator/core/orc_server/orchestrator/preferences_registry.py
g2-inc/openc2-oif-orchestrator
train
1
eca57b80ccc11698f5b1d8d335263cb647758501
[ "with response_context() as response_mock:\n data = JsonApiRequest.json_or_error(response_mock)\n self.assertEqual(data, {'spam': True})", "response_mock = Mock()\nresponse_mock.url = 'http://nowhere.example.com'\nresponse_mock.status_code = 404\nresponse_mock.text = 'Where?'\nwith self.assertRaisesMessage(...
<|body_start_0|> with response_context() as response_mock: data = JsonApiRequest.json_or_error(response_mock) self.assertEqual(data, {'spam': True}) <|end_body_0|> <|body_start_1|> response_mock = Mock() response_mock.url = 'http://nowhere.example.com' response_m...
JsonApiRequestTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonApiRequestTest: def test_json_or_error_returns(self): """JsonApiRequest.json_or_error should return a status code and JSON on success""" <|body_0|> def test_json_or_error_raises_404(self): """JsonApiRequest.json_or_error should raise an error on HTTP status 404""...
stack_v2_sparse_classes_36k_train_015947
18,511
no_license
[ { "docstring": "JsonApiRequest.json_or_error should return a status code and JSON on success", "name": "test_json_or_error_returns", "signature": "def test_json_or_error_returns(self)" }, { "docstring": "JsonApiRequest.json_or_error should raise an error on HTTP status 404", "name": "test_js...
6
stack_v2_sparse_classes_30k_train_008458
Implement the Python class `JsonApiRequestTest` described below. Class description: Implement the JsonApiRequestTest class. Method signatures and docstrings: - def test_json_or_error_returns(self): JsonApiRequest.json_or_error should return a status code and JSON on success - def test_json_or_error_raises_404(self): ...
Implement the Python class `JsonApiRequestTest` described below. Class description: Implement the JsonApiRequestTest class. Method signatures and docstrings: - def test_json_or_error_returns(self): JsonApiRequest.json_or_error should return a status code and JSON on success - def test_json_or_error_raises_404(self): ...
6d3eb1a0e70cc2a59a82ec5bba12170387803150
<|skeleton|> class JsonApiRequestTest: def test_json_or_error_returns(self): """JsonApiRequest.json_or_error should return a status code and JSON on success""" <|body_0|> def test_json_or_error_raises_404(self): """JsonApiRequest.json_or_error should raise an error on HTTP status 404""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JsonApiRequestTest: def test_json_or_error_returns(self): """JsonApiRequest.json_or_error should return a status code and JSON on success""" with response_context() as response_mock: data = JsonApiRequest.json_or_error(response_mock) self.assertEqual(data, {'spam': True...
the_stack_v2_python_sparse
custom/dhis2/tests.py
saketkanth/commcare-hq
train
0
0bd1808eecfc0c246b65e26d8ac90132f0da6860
[ "_property = mall_models.ProductModelProperty.objects.create(owner=request.manager, name='')\nresponse = create_response(200)\nresponse.data = _property.id\nreturn response.get_response()", "id = request.POST['id']\nfield = request.POST['field']\nif 'name' == field:\n name = request.POST['name']\n mall_mode...
<|body_start_0|> _property = mall_models.ProductModelProperty.objects.create(owner=request.manager, name='') response = create_response(200) response.data = _property.id return response.get_response() <|end_body_0|> <|body_start_1|> id = request.POST['id'] field = reques...
ModelProperty
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelProperty: def api_put(request): """创建一个空的规格属性 Return json: data: %d""" <|body_0|> def api_post(request): """更新规格属性. Args: id: 规格id filed: 指定更新规格的哪个属性: name or type name -> 新的规格名, type -> 新的规格类型. text或image""" <|body_1|> def api_delete(request): ...
stack_v2_sparse_classes_36k_train_015948
9,873
no_license
[ { "docstring": "创建一个空的规格属性 Return json: data: %d", "name": "api_put", "signature": "def api_put(request)" }, { "docstring": "更新规格属性. Args: id: 规格id filed: 指定更新规格的哪个属性: name or type name -> 新的规格名, type -> 新的规格类型. text或image", "name": "api_post", "signature": "def api_post(request)" }, ...
3
null
Implement the Python class `ModelProperty` described below. Class description: Implement the ModelProperty class. Method signatures and docstrings: - def api_put(request): 创建一个空的规格属性 Return json: data: %d - def api_post(request): 更新规格属性. Args: id: 规格id filed: 指定更新规格的哪个属性: name or type name -> 新的规格名, type -> 新的规格类型. t...
Implement the Python class `ModelProperty` described below. Class description: Implement the ModelProperty class. Method signatures and docstrings: - def api_put(request): 创建一个空的规格属性 Return json: data: %d - def api_post(request): 更新规格属性. Args: id: 规格id filed: 指定更新规格的哪个属性: name or type name -> 新的规格名, type -> 新的规格类型. t...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class ModelProperty: def api_put(request): """创建一个空的规格属性 Return json: data: %d""" <|body_0|> def api_post(request): """更新规格属性. Args: id: 规格id filed: 指定更新规格的哪个属性: name or type name -> 新的规格名, type -> 新的规格类型. text或image""" <|body_1|> def api_delete(request): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelProperty: def api_put(request): """创建一个空的规格属性 Return json: data: %d""" _property = mall_models.ProductModelProperty.objects.create(owner=request.manager, name='') response = create_response(200) response.data = _property.id return response.get_response() def a...
the_stack_v2_python_sparse
weapp/mall/product/model_property.py
chengdg/weizoom
train
1
bf26b307433240ed9f99d67d57d073525ea1a309
[ "try:\n replaced = re.sub('{{(.*?)}}', lambda m: variables.get(m.group(1), ''), source)\nexcept TypeError:\n replaced = source\nreturn replaced", "if cell.cell_type == 'markdown':\n if hasattr(cell['metadata'], 'variables'):\n variables = cell['metadata']['variables']\n if len(variables) > ...
<|body_start_0|> try: replaced = re.sub('{{(.*?)}}', lambda m: variables.get(m.group(1), ''), source) except TypeError: replaced = source return replaced <|end_body_0|> <|body_start_1|> if cell.cell_type == 'markdown': if hasattr(cell['metadata'], 'va...
:mod:`nbconvert` Preprocessor for the python-markdown nbextension. This :class:`~nbconvert.preprocessors.Preprocessor` replaces kernel code in markdown cells with the results stored in the cell metadata.
PyMarkdownPreprocessor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyMarkdownPreprocessor: """:mod:`nbconvert` Preprocessor for the python-markdown nbextension. This :class:`~nbconvert.preprocessors.Preprocessor` replaces kernel code in markdown cells with the results stored in the cell metadata.""" def replace_variables(self, source, variables): ""...
stack_v2_sparse_classes_36k_train_015949
1,564
permissive
[ { "docstring": "Replace {{variablename}} with stored value", "name": "replace_variables", "signature": "def replace_variables(self, source, variables)" }, { "docstring": "Preprocess cell Parameters ---------- cell : NotebookNode cell Notebook cell being processed resources : dictionary Additiona...
2
null
Implement the Python class `PyMarkdownPreprocessor` described below. Class description: :mod:`nbconvert` Preprocessor for the python-markdown nbextension. This :class:`~nbconvert.preprocessors.Preprocessor` replaces kernel code in markdown cells with the results stored in the cell metadata. Method signatures and docs...
Implement the Python class `PyMarkdownPreprocessor` described below. Class description: :mod:`nbconvert` Preprocessor for the python-markdown nbextension. This :class:`~nbconvert.preprocessors.Preprocessor` replaces kernel code in markdown cells with the results stored in the cell metadata. Method signatures and docs...
1ad7ec05fb1e3676ac879585296c513c3ee50ef9
<|skeleton|> class PyMarkdownPreprocessor: """:mod:`nbconvert` Preprocessor for the python-markdown nbextension. This :class:`~nbconvert.preprocessors.Preprocessor` replaces kernel code in markdown cells with the results stored in the cell metadata.""" def replace_variables(self, source, variables): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PyMarkdownPreprocessor: """:mod:`nbconvert` Preprocessor for the python-markdown nbextension. This :class:`~nbconvert.preprocessors.Preprocessor` replaces kernel code in markdown cells with the results stored in the cell metadata.""" def replace_variables(self, source, variables): """Replace {{va...
the_stack_v2_python_sparse
Library/lib/python3.7/site-packages/jupyter_contrib_nbextensions-0.5.1-py3.7.egg/jupyter_contrib_nbextensions/nbconvert_support/pre_pymarkdown.py
holzschu/Carnets
train
541
ca5905c2ec73a0eb1cffa3490cfee19a1eab7d57
[ "super().__init__(name)\nself._expected_string = expected_string\nself._operator = OperatorUtils.get_operator(operator)\nself._operator_str = operator\nself.fmt_metric = '{name}: {value} (expected string: {expected} // operator used: {operator})'", "value = None\nif len(metric.value) > 0:\n value = metric.valu...
<|body_start_0|> super().__init__(name) self._expected_string = expected_string self._operator = OperatorUtils.get_operator(operator) self._operator_str = operator self.fmt_metric = '{name}: {value} (expected string: {expected} // operator used: {operator})' <|end_body_0|> <|bod...
StringValueFromJSON context class
StringValueFromJSON
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringValueFromJSON: """StringValueFromJSON context class""" def __init__(self, name, expected_string='', operator='=='): """Init method used by subclass :param name: Context name :param expected_string: Expected string return by JSON path :param operator: Operator to compare probe v...
stack_v2_sparse_classes_36k_train_015950
2,540
no_license
[ { "docstring": "Init method used by subclass :param name: Context name :param expected_string: Expected string return by JSON path :param operator: Operator to compare probe value with expected string :type name: str :type expected_string: str :type operator: str", "name": "__init__", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_018425
Implement the Python class `StringValueFromJSON` described below. Class description: StringValueFromJSON context class Method signatures and docstrings: - def __init__(self, name, expected_string='', operator='=='): Init method used by subclass :param name: Context name :param expected_string: Expected string return ...
Implement the Python class `StringValueFromJSON` described below. Class description: StringValueFromJSON context class Method signatures and docstrings: - def __init__(self, name, expected_string='', operator='=='): Init method used by subclass :param name: Context name :param expected_string: Expected string return ...
947199bf8525f64d2765f3b4e4e0e59bc56b5208
<|skeleton|> class StringValueFromJSON: """StringValueFromJSON context class""" def __init__(self, name, expected_string='', operator='=='): """Init method used by subclass :param name: Context name :param expected_string: Expected string return by JSON path :param operator: Operator to compare probe v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StringValueFromJSON: """StringValueFromJSON context class""" def __init__(self, name, expected_string='', operator='=='): """Init method used by subclass :param name: Context name :param expected_string: Expected string return by JSON path :param operator: Operator to compare probe value with exp...
the_stack_v2_python_sparse
temelio_monitoring/context/json/string_value_from_json.py
Temelio/monitoring-lib-python
train
0
678d9c341fa97a9cd0067c7aa01075801c911d59
[ "try:\n parameter = app.parameter_api.getParameter(name)\n response = {'globalparameter': parameter.getCleanDict()}\nexcept Exception as ex:\n self.getLogger().error('%s' % ex)\n self.handleException(ex)\n response = self.errorResponse(str(ex))\nreturn self.formatResponse(response)", "self.getLogge...
<|body_start_0|> try: parameter = app.parameter_api.getParameter(name) response = {'globalparameter': parameter.getCleanDict()} except Exception as ex: self.getLogger().error('%s' % ex) self.handleException(ex) response = self.errorResponse(str...
Admin parameter controller class.
ParameterController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterController: """Admin parameter controller class.""" def getParameter(self, name): """Return info for the specified parameter.""" <|body_0|> def getParameterList(self): """Return all known parameters.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_015951
2,432
permissive
[ { "docstring": "Return info for the specified parameter.", "name": "getParameter", "signature": "def getParameter(self, name)" }, { "docstring": "Return all known parameters.", "name": "getParameterList", "signature": "def getParameterList(self)" } ]
2
null
Implement the Python class `ParameterController` described below. Class description: Admin parameter controller class. Method signatures and docstrings: - def getParameter(self, name): Return info for the specified parameter. - def getParameterList(self): Return all known parameters.
Implement the Python class `ParameterController` described below. Class description: Admin parameter controller class. Method signatures and docstrings: - def getParameter(self, name): Return info for the specified parameter. - def getParameterList(self): Return all known parameters. <|skeleton|> class ParameterCont...
a115b651be648e39442922ab9ed5bc264886d696
<|skeleton|> class ParameterController: """Admin parameter controller class.""" def getParameter(self, name): """Return info for the specified parameter.""" <|body_0|> def getParameterList(self): """Return all known parameters.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParameterController: """Admin parameter controller class.""" def getParameter(self, name): """Return info for the specified parameter.""" try: parameter = app.parameter_api.getParameter(name) response = {'globalparameter': parameter.getCleanDict()} except E...
the_stack_v2_python_sparse
src/installer/src/tortuga/web_service/controllers/parameterController.py
ilumb/tortuga
train
0
7016f37fc8cbdbe310a908bb35438fbe09f11e22
[ "self.students = []\nself.grades = {}\nself.isSorted = True", "if student in self.students:\n raise ValueError('Dupulicate student')\nself.students.append(student)\nself.grades[student.getIdNum()] = []\nself.isSorted = False", "try:\n self.grades[student.getIdNum()].append(grade)\nexcept:\n raise Value...
<|body_start_0|> self.students = [] self.grades = {} self.isSorted = True <|end_body_0|> <|body_start_1|> if student in self.students: raise ValueError('Dupulicate student') self.students.append(student) self.grades[student.getIdNum()] = [] self.isSor...
list(講義登録学生), dict(個人番号:成績リスト)
Grades
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grades: """list(講義登録学生), dict(個人番号:成績リスト)""" def __init__(self): """空の成績ブックを生成する""" <|body_0|> def addStudent(self, student): """studentをStudent型とする studentを成績ブックへ追加する""" <|body_1|> def addGrade(self, student, grade): """float grade, gradeをst...
stack_v2_sparse_classes_36k_train_015952
14,110
no_license
[ { "docstring": "空の成績ブックを生成する", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "studentをStudent型とする studentを成績ブックへ追加する", "name": "addStudent", "signature": "def addStudent(self, student)" }, { "docstring": "float grade, gradeをstudentの成績リストへ追加", "name":...
5
null
Implement the Python class `Grades` described below. Class description: list(講義登録学生), dict(個人番号:成績リスト) Method signatures and docstrings: - def __init__(self): 空の成績ブックを生成する - def addStudent(self, student): studentをStudent型とする studentを成績ブックへ追加する - def addGrade(self, student, grade): float grade, gradeをstudentの成績リストへ追加 ...
Implement the Python class `Grades` described below. Class description: list(講義登録学生), dict(個人番号:成績リスト) Method signatures and docstrings: - def __init__(self): 空の成績ブックを生成する - def addStudent(self, student): studentをStudent型とする studentを成績ブックへ追加する - def addGrade(self, student, grade): float grade, gradeをstudentの成績リストへ追加 ...
7d2ffea15532e35ea64597b3d6f53752a1d4322e
<|skeleton|> class Grades: """list(講義登録学生), dict(個人番号:成績リスト)""" def __init__(self): """空の成績ブックを生成する""" <|body_0|> def addStudent(self, student): """studentをStudent型とする studentを成績ブックへ追加する""" <|body_1|> def addGrade(self, student, grade): """float grade, gradeをst...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Grades: """list(講義登録学生), dict(個人番号:成績リスト)""" def __init__(self): """空の成績ブックを生成する""" self.students = [] self.grades = {} self.isSorted = True def addStudent(self, student): """studentをStudent型とする studentを成績ブックへ追加する""" if student in self.students: ...
the_stack_v2_python_sparse
Basic_python/MIT_DS/mit08.py
jusui/Data_Science
train
0
ee2aed7b3678c8c22b05c04c50adf7571f4228b0
[ "super(QueryPluginConfiguration, self).__init__(*args, **kwargs)\nself._query_configuration = None\nself._adapter is None\nreturn", "if self._adapter is None:\n config = ConfigParser()\n section = 'query'\n config.add_section(section)\n self._adapter = ConfigurationAdapter(config)\nreturn self._adapte...
<|body_start_0|> super(QueryPluginConfiguration, self).__init__(*args, **kwargs) self._query_configuration = None self._adapter is None return <|end_body_0|> <|body_start_1|> if self._adapter is None: config = ConfigParser() section = 'query' ...
A configuration for the queries
QueryPluginConfiguration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryPluginConfiguration: """A configuration for the queries""" def __init__(self, *args, **kwargs): """Constructor to set up the sub-configuration""" <|body_0|> def adapter(self): """Mapping config obj to the Configuration Adapter""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_015953
18,096
no_license
[ { "docstring": "Constructor to set up the sub-configuration", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Mapping config obj to the Configuration Adapter", "name": "adapter", "signature": "def adapter(self)" }, { "docstring": "The cam...
4
stack_v2_sparse_classes_30k_train_012508
Implement the Python class `QueryPluginConfiguration` described below. Class description: A configuration for the queries Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor to set up the sub-configuration - def adapter(self): Mapping config obj to the Configuration Adapter - def quer...
Implement the Python class `QueryPluginConfiguration` described below. Class description: A configuration for the queries Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor to set up the sub-configuration - def adapter(self): Mapping config obj to the Configuration Adapter - def quer...
cd735b8c0fec06f7f9083714900ff88395c9443f
<|skeleton|> class QueryPluginConfiguration: """A configuration for the queries""" def __init__(self, *args, **kwargs): """Constructor to set up the sub-configuration""" <|body_0|> def adapter(self): """Mapping config obj to the Configuration Adapter""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryPluginConfiguration: """A configuration for the queries""" def __init__(self, *args, **kwargs): """Constructor to set up the sub-configuration""" super(QueryPluginConfiguration, self).__init__(*args, **kwargs) self._query_configuration = None self._adapter is None ...
the_stack_v2_python_sparse
cameraobscura/plugins/rvrplugin.py
russell-n/cameraobscura
train
0
243c36b0cd2c6dd52cd1c66eb07a159d6d03f122
[ "ObjectManager.__init__(self)\nself.getters.update({'name': 'get_general', 'organizations': 'get_many_to_many', 'users': 'get_many_to_many', 'user_org_roles': 'get_many_to_one'})\nself.setters.update({'name': 'set_general', 'organizations': 'set_many', 'users': 'set_many'})\nself.my_django_model = facade.models.Org...
<|body_start_0|> ObjectManager.__init__(self) self.getters.update({'name': 'get_general', 'organizations': 'get_many_to_many', 'users': 'get_many_to_many', 'user_org_roles': 'get_many_to_one'}) self.setters.update({'name': 'set_general', 'organizations': 'set_many', 'users': 'set_many'}) ...
Manage roles that users can have in organizations in the Power Reg system
OrgRoleManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrgRoleManager: """Manage roles that users can have in organizations in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, name): """Create a new OrgRole @param name name of the OrgRole @return a reference to the...
stack_v2_sparse_classes_36k_train_015954
1,345
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a new OrgRole @param name name of the OrgRole @return a reference to the newly created OrgRole", "name": "create", "signature": "def create(self, auth_token, name)" } ]
2
null
Implement the Python class `OrgRoleManager` described below. Class description: Manage roles that users can have in organizations in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, name): Create a new OrgRole @param name name of the OrgRole @retu...
Implement the Python class `OrgRoleManager` described below. Class description: Manage roles that users can have in organizations in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, name): Create a new OrgRole @param name name of the OrgRole @retu...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class OrgRoleManager: """Manage roles that users can have in organizations in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, name): """Create a new OrgRole @param name name of the OrgRole @return a reference to the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrgRoleManager: """Manage roles that users can have in organizations in the Power Reg system""" def __init__(self): """constructor""" ObjectManager.__init__(self) self.getters.update({'name': 'get_general', 'organizations': 'get_many_to_many', 'users': 'get_many_to_many', 'user_or...
the_stack_v2_python_sparse
pr_services/user_system/organization_role_manager.py
ninemoreminutes/openassign-server
train
0
86273031169944482e047629a0d5af19181fc7ed
[ "data_loaders = GeometricDatasetLoaders.from_dataset(self.dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers)\nself.model.train()\nself.model.to(device)\nmetrics = self._new_metrics()\nself.callbacks['progress'].start_epoch()\nfor batch_idx, data in enumerate(data_loaders.train):\n data.to(dev...
<|body_start_0|> data_loaders = GeometricDatasetLoaders.from_dataset(self.dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers) self.model.train() self.model.to(device) metrics = self._new_metrics() self.callbacks['progress'].start_epoch() for batch_idx, ...
SupervisedTrainingRun
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupervisedTrainingRun: def train_one_epoch(self, device, batch_size, num_workers=0): """Trains for a single epoch. This takes care of callbacks, training steps, checkpointing, etc. Parameters ---------- device : str Device to run with (cuda or cpu) batch_size : int Batch size for trainin...
stack_v2_sparse_classes_36k_train_015955
9,034
permissive
[ { "docstring": "Trains for a single epoch. This takes care of callbacks, training steps, checkpointing, etc. Parameters ---------- device : str Device to run with (cuda or cpu) batch_size : int Batch size for training num_workers : int Number of workers; see pytorch dataloader doc", "name": "train_one_epoch...
2
stack_v2_sparse_classes_30k_train_006531
Implement the Python class `SupervisedTrainingRun` described below. Class description: Implement the SupervisedTrainingRun class. Method signatures and docstrings: - def train_one_epoch(self, device, batch_size, num_workers=0): Trains for a single epoch. This takes care of callbacks, training steps, checkpointing, et...
Implement the Python class `SupervisedTrainingRun` described below. Class description: Implement the SupervisedTrainingRun class. Method signatures and docstrings: - def train_one_epoch(self, device, batch_size, num_workers=0): Trains for a single epoch. This takes care of callbacks, training steps, checkpointing, et...
6446f05609f53788b012df3d57e7e7ef567db3a5
<|skeleton|> class SupervisedTrainingRun: def train_one_epoch(self, device, batch_size, num_workers=0): """Trains for a single epoch. This takes care of callbacks, training steps, checkpointing, etc. Parameters ---------- device : str Device to run with (cuda or cpu) batch_size : int Batch size for trainin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupervisedTrainingRun: def train_one_epoch(self, device, batch_size, num_workers=0): """Trains for a single epoch. This takes care of callbacks, training steps, checkpointing, etc. Parameters ---------- device : str Device to run with (cuda or cpu) batch_size : int Batch size for training num_workers ...
the_stack_v2_python_sparse
gnn_acopf/training/training_run.py
fgerzer/gnn_acopf
train
2
4465bedab331f4fc1378cddb2d4933ed199d76f4
[ "super(UpsampleBLock, self).__init__()\nself.conv = nn.Conv2d(in_channels, in_channels * up_scale ** 2, kernel_size=3, padding=1)\nself.pixel_shuffle = nn.PixelShuffle(up_scale)\nself.prelu = nn.PReLU()", "x = self.conv(x)\nx = self.pixel_shuffle(x)\nx = self.prelu(x)\nreturn x" ]
<|body_start_0|> super(UpsampleBLock, self).__init__() self.conv = nn.Conv2d(in_channels, in_channels * up_scale ** 2, kernel_size=3, padding=1) self.pixel_shuffle = nn.PixelShuffle(up_scale) self.prelu = nn.PReLU() <|end_body_0|> <|body_start_1|> x = self.conv(x) x = se...
Upsample block as implemented in SRGAN.
UpsampleBLock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpsampleBLock: """Upsample block as implemented in SRGAN.""" def __init__(self, in_channels, up_scale): """Initialize Upsample block.""" <|body_0|> def forward(self, x): """Forward propagation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> sup...
stack_v2_sparse_classes_36k_train_015956
22,492
no_license
[ { "docstring": "Initialize Upsample block.", "name": "__init__", "signature": "def __init__(self, in_channels, up_scale)" }, { "docstring": "Forward propagation.", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_007361
Implement the Python class `UpsampleBLock` described below. Class description: Upsample block as implemented in SRGAN. Method signatures and docstrings: - def __init__(self, in_channels, up_scale): Initialize Upsample block. - def forward(self, x): Forward propagation.
Implement the Python class `UpsampleBLock` described below. Class description: Upsample block as implemented in SRGAN. Method signatures and docstrings: - def __init__(self, in_channels, up_scale): Initialize Upsample block. - def forward(self, x): Forward propagation. <|skeleton|> class UpsampleBLock: """Upsamp...
70d344d80425e7bbcc7984737dbe50a6638293c9
<|skeleton|> class UpsampleBLock: """Upsample block as implemented in SRGAN.""" def __init__(self, in_channels, up_scale): """Initialize Upsample block.""" <|body_0|> def forward(self, x): """Forward propagation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpsampleBLock: """Upsample block as implemented in SRGAN.""" def __init__(self, in_channels, up_scale): """Initialize Upsample block.""" super(UpsampleBLock, self).__init__() self.conv = nn.Conv2d(in_channels, in_channels * up_scale ** 2, kernel_size=3, padding=1) self.pix...
the_stack_v2_python_sparse
TeleGAN/model.py
ails-lab/teleGAN
train
1
d0f7ca20a7c3b2a626b99eb78da818fef4330d7b
[ "super().__init__(questionnaire, username, instagram_posts)\nself.biography = biography\nself.followers_count = followers_count\nself.following_count = following_count\nself.is_private = is_private\nself.posts_count = posts_count", "binary_bdi = self.questionnaire.get_binary_bdi()\ninstagram_user_data = dict(foll...
<|body_start_0|> super().__init__(questionnaire, username, instagram_posts) self.biography = biography self.followers_count = followers_count self.following_count = following_count self.is_private = is_private self.posts_count = posts_count <|end_body_0|> <|body_start_1|...
Instagram's profile information data model, with the biodemographic information
InstagramUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstagramUser: """Instagram's profile information data model, with the biodemographic information""" def __init__(self, biography, followers_count, following_count, is_private, posts_count, questionnaire, username, instagram_posts): """Params: questionnaire -- It contains the answer ...
stack_v2_sparse_classes_36k_train_015957
7,597
no_license
[ { "docstring": "Params: questionnaire -- It contains the answer to the questionnaire from this InstagramUser, which is a Questionnaire object.", "name": "__init__", "signature": "def __init__(self, biography, followers_count, following_count, is_private, posts_count, questionnaire, username, instagram_p...
2
stack_v2_sparse_classes_30k_train_001644
Implement the Python class `InstagramUser` described below. Class description: Instagram's profile information data model, with the biodemographic information Method signatures and docstrings: - def __init__(self, biography, followers_count, following_count, is_private, posts_count, questionnaire, username, instagram...
Implement the Python class `InstagramUser` described below. Class description: Instagram's profile information data model, with the biodemographic information Method signatures and docstrings: - def __init__(self, biography, followers_count, following_count, is_private, posts_count, questionnaire, username, instagram...
8cbb27f1118277c1898180d837ca9462c05320e4
<|skeleton|> class InstagramUser: """Instagram's profile information data model, with the biodemographic information""" def __init__(self, biography, followers_count, following_count, is_private, posts_count, questionnaire, username, instagram_posts): """Params: questionnaire -- It contains the answer ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstagramUser: """Instagram's profile information data model, with the biodemographic information""" def __init__(self, biography, followers_count, following_count, is_private, posts_count, questionnaire, username, instagram_posts): """Params: questionnaire -- It contains the answer to the questi...
the_stack_v2_python_sparse
readorsee/data/models.py
paulomann/ReadAndSee
train
5
be88eef7e0e1f083d5236f7cf3158ab70e7b536d
[ "res_list = []\nif root is None:\n return res_list\nqueue = [root]\nwhile queue:\n node_list = []\n res = []\n for node in queue:\n if node.left is not None:\n node_list.append(node.left)\n if node.right is not None:\n node_list.append(node.right)\n res.append(...
<|body_start_0|> res_list = [] if root is None: return res_list queue = [root] while queue: node_list = [] res = [] for node in queue: if node.left is not None: node_list.append(node.left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root): """二叉树层次遍历 :type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def minMutation(self, start, end, bank): """:type start: str :type end: str :type bank: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_015958
1,993
no_license
[ { "docstring": "二叉树层次遍历 :type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder", "signature": "def levelOrder(self, root)" }, { "docstring": ":type start: str :type end: str :type bank: List[str] :rtype: int", "name": "minMutation", "signature": "def minMutation(self, start, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): 二叉树层次遍历 :type root: TreeNode :rtype: List[List[int]] - def minMutation(self, start, end, bank): :type start: str :type end: str :type bank: List[str] ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): 二叉树层次遍历 :type root: TreeNode :rtype: List[List[int]] - def minMutation(self, start, end, bank): :type start: str :type end: str :type bank: List[str] ...
3b13b36f37eb364410b3b5b4f10a1808d8b1111e
<|skeleton|> class Solution: def levelOrder(self, root): """二叉树层次遍历 :type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def minMutation(self, start, end, bank): """:type start: str :type end: str :type bank: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root): """二叉树层次遍历 :type root: TreeNode :rtype: List[List[int]]""" res_list = [] if root is None: return res_list queue = [root] while queue: node_list = [] res = [] for node in queue: ...
the_stack_v2_python_sparse
practice/20171123.py
yanggelinux/algorithm-data-structure
train
0
a260e3812ae7da77973c93fb8b612373603a5b8a
[ "self.test_check_available = {}\nself.test_check_status = {}\nself.test_check_response_code = {}\nfor metric in self.metrics:\n metric.clear_overrides()", "for metric in self.metrics:\n if metric.name == metric_name:\n return metric\nraise NameError('No metric named \"{0}\"!'.format(metric_name))", ...
<|body_start_0|> self.test_check_available = {} self.test_check_status = {} self.test_check_response_code = {} for metric in self.metrics: metric.clear_overrides() <|end_body_0|> <|body_start_1|> for metric in self.metrics: if metric.name == metric_name: ...
Data model for a MaaS check type (e.g., remote.ping).
CheckType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckType: """Data model for a MaaS check type (e.g., remote.ping).""" def clear_overrides(self): """Clears the overrides for test-checks and metrics.""" <|body_0|> def get_metric_by_name(self, metric_name): """Gets the metric on this check type. This method is u...
stack_v2_sparse_classes_36k_train_015959
37,899
permissive
[ { "docstring": "Clears the overrides for test-checks and metrics.", "name": "clear_overrides", "signature": "def clear_overrides(self)" }, { "docstring": "Gets the metric on this check type. This method is useful for setting and clearing overrides on the test metrics.", "name": "get_metric_b...
3
stack_v2_sparse_classes_30k_train_009074
Implement the Python class `CheckType` described below. Class description: Data model for a MaaS check type (e.g., remote.ping). Method signatures and docstrings: - def clear_overrides(self): Clears the overrides for test-checks and metrics. - def get_metric_by_name(self, metric_name): Gets the metric on this check t...
Implement the Python class `CheckType` described below. Class description: Data model for a MaaS check type (e.g., remote.ping). Method signatures and docstrings: - def clear_overrides(self): Clears the overrides for test-checks and metrics. - def get_metric_by_name(self, metric_name): Gets the metric on this check t...
8e7eeed84ec5ae97863f9330023298845623c639
<|skeleton|> class CheckType: """Data model for a MaaS check type (e.g., remote.ping).""" def clear_overrides(self): """Clears the overrides for test-checks and metrics.""" <|body_0|> def get_metric_by_name(self, metric_name): """Gets the metric on this check type. This method is u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckType: """Data model for a MaaS check type (e.g., remote.ping).""" def clear_overrides(self): """Clears the overrides for test-checks and metrics.""" self.test_check_available = {} self.test_check_status = {} self.test_check_response_code = {} for metric in sel...
the_stack_v2_python_sparse
mimic/model/maas_objects.py
ranjithpeddi/mimic
train
1
40cc79d0cf885c18d130278a6e19a12215aadc9d
[ "create_message(settings.RECIPIENTS, settings.STARTTIME, settings.DAYCOUNT)\nexpectedCount = len(settings.RECIPIENTS) * settings.DAYCOUNT\ncurs.execute('SELECT COUNT(*) FROM message')\nobserved = curs.fetchone()[0]\nself.assertEqual(expectedCount, observed, 'Unexpected number of messages created')", "daycounts = ...
<|body_start_0|> create_message(settings.RECIPIENTS, settings.STARTTIME, settings.DAYCOUNT) expectedCount = len(settings.RECIPIENTS) * settings.DAYCOUNT curs.execute('SELECT COUNT(*) FROM message') observed = curs.fetchone()[0] self.assertEqual(expectedCount, observed, 'Unexpecte...
TestEmail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEmail: def test_create(self): """Test message creation logic""" <|body_0|> def test_profile(self): """Profiles email creation and storage as a function of day count""" <|body_1|> <|end_skeleton|> <|body_start_0|> create_message(settings.RECIPIEN...
stack_v2_sparse_classes_36k_train_015960
1,832
no_license
[ { "docstring": "Test message creation logic", "name": "test_create", "signature": "def test_create(self)" }, { "docstring": "Profiles email creation and storage as a function of day count", "name": "test_profile", "signature": "def test_profile(self)" } ]
2
stack_v2_sparse_classes_30k_train_006759
Implement the Python class `TestEmail` described below. Class description: Implement the TestEmail class. Method signatures and docstrings: - def test_create(self): Test message creation logic - def test_profile(self): Profiles email creation and storage as a function of day count
Implement the Python class `TestEmail` described below. Class description: Implement the TestEmail class. Method signatures and docstrings: - def test_create(self): Test message creation logic - def test_profile(self): Profiles email creation and storage as a function of day count <|skeleton|> class TestEmail: ...
b5041e71badd1ca2c013828e3b2910fb02e9728f
<|skeleton|> class TestEmail: def test_create(self): """Test message creation logic""" <|body_0|> def test_profile(self): """Profiles email creation and storage as a function of day count""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestEmail: def test_create(self): """Test message creation logic""" create_message(settings.RECIPIENTS, settings.STARTTIME, settings.DAYCOUNT) expectedCount = len(settings.RECIPIENTS) * settings.DAYCOUNT curs.execute('SELECT COUNT(*) FROM message') observed = curs.fetch...
the_stack_v2_python_sparse
python_2/homework/EmailSearch_Homework/src/test_emailcreatestore.py
patrickbeeson/python-classes
train
0
d9d46d26c56a62517ded068c5d9a7c342d449a8a
[ "self.times = times\nself.leader = []\ncounts = defaultdict(int)\nmax_count = 0\nfor person, time in zip(persons, times):\n counts[person] += 1\n if counts[person] > max_count:\n max_count += 1\n leaders = [person]\n elif counts[person] == max_count:\n leaders.append(person)\n self....
<|body_start_0|> self.times = times self.leader = [] counts = defaultdict(int) max_count = 0 for person, time in zip(persons, times): counts[person] += 1 if counts[person] > max_count: max_count += 1 leaders = [person] ...
TopVotedCandidate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.times = times self.leade...
stack_v2_sparse_classes_36k_train_015961
2,171
no_license
[ { "docstring": ":type persons: List[int] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, persons, times)" }, { "docstring": ":type t: int :rtype: int", "name": "q", "signature": "def q(self, t)" } ]
2
null
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int <|skeleton|> class TopVotedCandi...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" self.times = times self.leader = [] counts = defaultdict(int) max_count = 0 for person, time in zip(persons, times): counts[person] += 1 ...
the_stack_v2_python_sparse
python_1_to_1000/911_Online_Election.py
jakehoare/leetcode
train
58
587611b083f61ade751c2f59c94930cf4ff4bc72
[ "self.sum_array = []\nsize = len(nums)\nif size > 0:\n self.sum_array.append(nums[0])\n for i in range(1, size):\n self.sum_array.append(nums[i] + self.sum_array[i - 1])\nprint(self.sum_array)", "if i == 0:\n return self.sum_array[j]\nelse:\n return self.sum_array[j] - self.sum_array[i - 1]" ]
<|body_start_0|> self.sum_array = [] size = len(nums) if size > 0: self.sum_array.append(nums[0]) for i in range(1, size): self.sum_array.append(nums[i] + self.sum_array[i - 1]) print(self.sum_array) <|end_body_0|> <|body_start_1|> if i ==...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sum_array = [] size = len(nums) if siz...
stack_v2_sparse_classes_36k_train_015962
730
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_train_012069
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
c5a165d14c56f7ce29b923933d2bda4576eab8a2
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.sum_array = [] size = len(nums) if size > 0: self.sum_array.append(nums[0]) for i in range(1, size): self.sum_array.append(nums[i] + self.sum_array[i - 1]) print...
the_stack_v2_python_sparse
LeetCode/Dynamic Programming/Range_Sum_Query-Immutable_303.py
unterumarmung/practice
train
3
57fc989759ace50a652736d8baa6b2121d64dd5d
[ "m = len(matrix)\nn = len(matrix[0])\nif m == 0 or n == 0:\n return matrix\nres = []\nfor i in range(m):\n tmp = []\n for j in range(i + 1):\n tmp.append(matrix[i - j][j])\n if i % 2 == 0:\n res += tmp\n else:\n res += tmp[::-1]", "if not matrix:\n return []\nm = len(matrix)...
<|body_start_0|> m = len(matrix) n = len(matrix[0]) if m == 0 or n == 0: return matrix res = [] for i in range(m): tmp = [] for j in range(i + 1): tmp.append(matrix[i - j][j]) if i % 2 == 0: res += tm...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDiagonalOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_0|> def findDiagonalOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_1|> def findDiagonalOrder(self, matrix): ...
stack_v2_sparse_classes_36k_train_015963
2,124
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: List[int]", "name": "findDiagonalOrder", "signature": "def findDiagonalOrder(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: List[int]", "name": "findDiagonalOrder", "signature": "def findDiagonalOrder(self, ma...
3
stack_v2_sparse_classes_30k_train_014933
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDiagonalOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def findDiagonalOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDiagonalOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def findDiagonalOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def ...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def findDiagonalOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_0|> def findDiagonalOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_1|> def findDiagonalOrder(self, matrix): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDiagonalOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" m = len(matrix) n = len(matrix[0]) if m == 0 or n == 0: return matrix res = [] for i in range(m): tmp = [] for j in range(i +...
the_stack_v2_python_sparse
0498_Diagonal_Traverse.py
bingli8802/leetcode
train
0
a53b851c71f2701570b04278c4125d898602d0d6
[ "kwargs['nargs'] = -1\ndefault = kwargs.pop('default', tuple())\nsuper().__init__(*args, **kwargs)\nself.default = default", "if not value:\n value = self.default\nelse:\n value = [self._parse_arg_str(i) for i in value]\nreturn super().process_value(ctx, value)", "parsed = ast.literal_eval(args)\nif not i...
<|body_start_0|> kwargs['nargs'] = -1 default = kwargs.pop('default', tuple()) super().__init__(*args, **kwargs) self.default = default <|end_body_0|> <|body_start_1|> if not value: value = self.default else: value = [self._parse_arg_str(i) for i ...
Multiple arguments with default value.
DefaultArgumentsMultiple
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultArgumentsMultiple: """Multiple arguments with default value.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Create MultipleArguments instance.""" <|body_0|> def full_process_value(self, ctx: Context, value: Any) -> Any: """Given a value and c...
stack_v2_sparse_classes_36k_train_015964
10,471
permissive
[ { "docstring": "Create MultipleArguments instance.", "name": "__init__", "signature": "def __init__(self, *args: Any, **kwargs: Any) -> None" }, { "docstring": "Given a value and context this runs the logic to convert the value as necessary. :param ctx: command context :param value: value for op...
3
stack_v2_sparse_classes_30k_train_013207
Implement the Python class `DefaultArgumentsMultiple` described below. Class description: Multiple arguments with default value. Method signatures and docstrings: - def __init__(self, *args: Any, **kwargs: Any) -> None: Create MultipleArguments instance. - def full_process_value(self, ctx: Context, value: Any) -> Any...
Implement the Python class `DefaultArgumentsMultiple` described below. Class description: Multiple arguments with default value. Method signatures and docstrings: - def __init__(self, *args: Any, **kwargs: Any) -> None: Create MultipleArguments instance. - def full_process_value(self, ctx: Context, value: Any) -> Any...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class DefaultArgumentsMultiple: """Multiple arguments with default value.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Create MultipleArguments instance.""" <|body_0|> def full_process_value(self, ctx: Context, value: Any) -> Any: """Given a value and c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultArgumentsMultiple: """Multiple arguments with default value.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Create MultipleArguments instance.""" kwargs['nargs'] = -1 default = kwargs.pop('default', tuple()) super().__init__(*args, **kwargs) se...
the_stack_v2_python_sparse
benchmark/framework/cli.py
fetchai/agents-aea
train
192
08de3526ea79539fce720dde3fe7c09374fb47b4
[ "if len(self.required_tasks) == 0:\n return True\ntask_query = self.storage_socket.get_procedures(id=list(self.required_tasks.values()), include=['status', 'error'])\nstatus_values = set((x['status'] for x in task_query['data']))\nif status_values == {'COMPLETE'}:\n return True\nelif 'ERROR' in status_values:...
<|body_start_0|> if len(self.required_tasks) == 0: return True task_query = self.storage_socket.get_procedures(id=list(self.required_tasks.values()), include=['status', 'error']) status_values = set((x['status'] for x in task_query['data'])) if status_values == {'COMPLETE'}: ...
TaskManager
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskManager: def done(self) -> bool: """Check if requested tasks are complete.""" <|body_0|> def get_tasks(self) -> Dict[str, Any]: """Pulls currently held tasks.""" <|body_1|> def submit_tasks(self, procedure_type: str, tasks: Dict[str, Any]) -> bool: ...
stack_v2_sparse_classes_36k_train_015965
6,231
permissive
[ { "docstring": "Check if requested tasks are complete.", "name": "done", "signature": "def done(self) -> bool" }, { "docstring": "Pulls currently held tasks.", "name": "get_tasks", "signature": "def get_tasks(self) -> Dict[str, Any]" }, { "docstring": "Submits new tasks to the qu...
3
stack_v2_sparse_classes_30k_train_000436
Implement the Python class `TaskManager` described below. Class description: Implement the TaskManager class. Method signatures and docstrings: - def done(self) -> bool: Check if requested tasks are complete. - def get_tasks(self) -> Dict[str, Any]: Pulls currently held tasks. - def submit_tasks(self, procedure_type:...
Implement the Python class `TaskManager` described below. Class description: Implement the TaskManager class. Method signatures and docstrings: - def done(self) -> bool: Check if requested tasks are complete. - def get_tasks(self) -> Dict[str, Any]: Pulls currently held tasks. - def submit_tasks(self, procedure_type:...
e48ac2fd5e0bfde56ada9520db64bcc2cb8d8c0d
<|skeleton|> class TaskManager: def done(self) -> bool: """Check if requested tasks are complete.""" <|body_0|> def get_tasks(self) -> Dict[str, Any]: """Pulls currently held tasks.""" <|body_1|> def submit_tasks(self, procedure_type: str, tasks: Dict[str, Any]) -> bool: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskManager: def done(self) -> bool: """Check if requested tasks are complete.""" if len(self.required_tasks) == 0: return True task_query = self.storage_socket.get_procedures(id=list(self.required_tasks.values()), include=['status', 'error']) status_values = set((x...
the_stack_v2_python_sparse
qcfractal/services/service_util.py
ahurta92/QCFractal
train
0
b920e04ee4cfe2bc277b29b2fa943eb69d822706
[ "results = {'Cruise': [], 'Station': [], 'Niskin #': [], 'Case ID': [], 'Sample': [], 'Salinity': [], 'Unit': []}\nwith open(filepath) as f:\n data = f.readlines()\nfor n, line in enumerate(data):\n if n == 0:\n header = line.replace('\"', '').split(',')\n cruise = header[0]\n station = i...
<|body_start_0|> results = {'Cruise': [], 'Station': [], 'Niskin #': [], 'Case ID': [], 'Sample': [], 'Salinity': [], 'Unit': []} with open(filepath) as f: data = f.readlines() for n, line in enumerate(data): if n == 0: header = line.replace('"', '').split...
Salinity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Salinity: def parse_SAL(self, filepath): """Reprocess .SAL files into the standardized format. Parameters ---------- filepath: (str) The full path to the .SAL file to be reprocessed. Returns ------- results: (pandas.DataFrame) A dataframe saved to filepath as a csv file.""" <|bod...
stack_v2_sparse_classes_36k_train_015966
9,604
no_license
[ { "docstring": "Reprocess .SAL files into the standardized format. Parameters ---------- filepath: (str) The full path to the .SAL file to be reprocessed. Returns ------- results: (pandas.DataFrame) A dataframe saved to filepath as a csv file.", "name": "parse_SAL", "signature": "def parse_SAL(self, fil...
2
stack_v2_sparse_classes_30k_train_016252
Implement the Python class `Salinity` described below. Class description: Implement the Salinity class. Method signatures and docstrings: - def parse_SAL(self, filepath): Reprocess .SAL files into the standardized format. Parameters ---------- filepath: (str) The full path to the .SAL file to be reprocessed. Returns ...
Implement the Python class `Salinity` described below. Class description: Implement the Salinity class. Method signatures and docstrings: - def parse_SAL(self, filepath): Reprocess .SAL files into the standardized format. Parameters ---------- filepath: (str) The full path to the .SAL file to be reprocessed. Returns ...
b612f2d10053e1be7d748647f2cb990c4f62b611
<|skeleton|> class Salinity: def parse_SAL(self, filepath): """Reprocess .SAL files into the standardized format. Parameters ---------- filepath: (str) The full path to the .SAL file to be reprocessed. Returns ------- results: (pandas.DataFrame) A dataframe saved to filepath as a csv file.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Salinity: def parse_SAL(self, filepath): """Reprocess .SAL files into the standardized format. Parameters ---------- filepath: (str) The full path to the .SAL file to be reprocessed. Returns ------- results: (pandas.DataFrame) A dataframe saved to filepath as a csv file.""" results = {'Cruise'...
the_stack_v2_python_sparse
Ship_data/scripts/bottle_utils.py
reedan88/QAQC_Sandbox
train
0
617aa8871204ba4a55c61329c68013d4a031d674
[ "d = {}\nfor i, n in enumerate(nums):\n l = target - n\n if l in d:\n return [d[l], i]\n else:\n d[n] = i", "search_mode = False\nans = []\nres = 0\nfor i, n in enumerate(nums):\n if not search_mode:\n if target - n in nums[i + 1:]:\n ans += [i]\n search_mode...
<|body_start_0|> d = {} for i, n in enumerate(nums): l = target - n if l in d: return [d[l], i] else: d[n] = i <|end_body_0|> <|body_start_1|> search_mode = False ans = [] res = 0 for i, n in enumerate(n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSumOld(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_015967
1,491
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSumOld", "signature": "def twoSumOld(self, nums, target)"...
2
stack_v2_sparse_classes_30k_train_000634
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSumOld(self, nums, target): :type nums: List[int] :type target: int :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSumOld(self, nums, target): :type nums: List[int] :type target: int :rtype: Lis...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSumOld(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" d = {} for i, n in enumerate(nums): l = target - n if l in d: return [d[l], i] else: d[n] = i def twoSumOld...
the_stack_v2_python_sparse
top_interview_questions/easy_collection/array/two_sum.py
hwc1824/LeetCodeSolution
train
0
7ad354bca79c604fc83cc7415ae82bba35cc6c51
[ "course = self.test_settings['test_course']\nself.search_for_course(type=course['type'], school=course['school'], term=course['term'], year=course['year'], search_term=course['cid'])\nself.assertTrue(self.search_page.is_course_displayed(cid=course['cid']))", "course = self.test_settings['test_course_with_registra...
<|body_start_0|> course = self.test_settings['test_course'] self.search_for_course(type=course['type'], school=course['school'], term=course['term'], year=course['year'], search_term=course['cid']) self.assertTrue(self.search_page.is_course_displayed(cid=course['cid'])) <|end_body_0|> <|body_st...
CourseSearchTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseSearchTests: def test_course_search(self): """verify the course search functionality""" <|body_0|> def test_course_code_when_registrar_code_display_is_null(self): """Test when course has a registrar_code_display that is null in db. Expected result: Course Code ...
stack_v2_sparse_classes_36k_train_015968
2,347
no_license
[ { "docstring": "verify the course search functionality", "name": "test_course_search", "signature": "def test_course_search(self)" }, { "docstring": "Test when course has a registrar_code_display that is null in db. Expected result: Course Code will display the registrar_code :return:", "nam...
3
null
Implement the Python class `CourseSearchTests` described below. Class description: Implement the CourseSearchTests class. Method signatures and docstrings: - def test_course_search(self): verify the course search functionality - def test_course_code_when_registrar_code_display_is_null(self): Test when course has a re...
Implement the Python class `CourseSearchTests` described below. Class description: Implement the CourseSearchTests class. Method signatures and docstrings: - def test_course_search(self): verify the course search functionality - def test_course_code_when_registrar_code_display_is_null(self): Test when course has a re...
c00f9af5bbe344d0cbf71bcdfe2c3af85ae4be4a
<|skeleton|> class CourseSearchTests: def test_course_search(self): """verify the course search functionality""" <|body_0|> def test_course_code_when_registrar_code_display_is_null(self): """Test when course has a registrar_code_display that is null in db. Expected result: Course Code ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CourseSearchTests: def test_course_search(self): """verify the course search functionality""" course = self.test_settings['test_course'] self.search_for_course(type=course['type'], school=course['school'], term=course['term'], year=course['year'], search_term=course['cid']) sel...
the_stack_v2_python_sparse
selenium_tests/course_info/course_info_search_tests.py
Harvard-University-iCommons/canvas_account_admin_tools
train
4
7abd5325ab616249898840bc6e1f053de09a5e7f
[ "if six.PY2:\n values = [tensor_shape.Dimension(x) for x in (3, 7, 11, None)]\n for x in values:\n for y in values:\n self.assertEqual((x / y).value, (x // y).value)", "if six.PY2:\n two = tensor_shape.Dimension(2)\n message = \"unsupported operand type\\\\(s\\\\) for /: 'int' and 'D...
<|body_start_0|> if six.PY2: values = [tensor_shape.Dimension(x) for x in (3, 7, 11, None)] for x in values: for y in values: self.assertEqual((x / y).value, (x // y).value) <|end_body_0|> <|body_start_1|> if six.PY2: two = tensor_...
DimensionDivTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DimensionDivTest: def testDivSucceeds(self): """Without from __future__ import division, __div__ should work.""" <|body_0|> def testRDivFail(self): """Without from __future__ import division, __rdiv__ is used.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_015969
1,941
permissive
[ { "docstring": "Without from __future__ import division, __div__ should work.", "name": "testDivSucceeds", "signature": "def testDivSucceeds(self)" }, { "docstring": "Without from __future__ import division, __rdiv__ is used.", "name": "testRDivFail", "signature": "def testRDivFail(self)...
2
stack_v2_sparse_classes_30k_val_000106
Implement the Python class `DimensionDivTest` described below. Class description: Implement the DimensionDivTest class. Method signatures and docstrings: - def testDivSucceeds(self): Without from __future__ import division, __div__ should work. - def testRDivFail(self): Without from __future__ import division, __rdiv...
Implement the Python class `DimensionDivTest` described below. Class description: Implement the DimensionDivTest class. Method signatures and docstrings: - def testDivSucceeds(self): Without from __future__ import division, __div__ should work. - def testRDivFail(self): Without from __future__ import division, __rdiv...
7cbba04a2ee16d21309eefad5be6585183a2d5a9
<|skeleton|> class DimensionDivTest: def testDivSucceeds(self): """Without from __future__ import division, __div__ should work.""" <|body_0|> def testRDivFail(self): """Without from __future__ import division, __rdiv__ is used.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DimensionDivTest: def testDivSucceeds(self): """Without from __future__ import division, __div__ should work.""" if six.PY2: values = [tensor_shape.Dimension(x) for x in (3, 7, 11, None)] for x in values: for y in values: self.assertE...
the_stack_v2_python_sparse
tensorflow/python/framework/tensor_shape_div_test.py
NVIDIA/tensorflow
train
763
1ca4406cb1e89827421dbbc75cb67129c45a324b
[ "self.tableids = tableids\nself.coordinates = simplejson.loads(coordinates)[0]\nlogging.info(self.coordinates)", "table = dict(algorithm='FilterFeatureCollection', collection=dict(table_id=self.tableids[0]), filters=[dict(boundary=self.coordinates)])\nlogging.info(table)\nquery = dict(table=simplejson.dumps(table...
<|body_start_0|> self.tableids = tableids self.coordinates = simplejson.loads(coordinates)[0] logging.info(self.coordinates) <|end_body_0|> <|body_start_1|> table = dict(algorithm='FilterFeatureCollection', collection=dict(table_id=self.tableids[0]), filters=[dict(boundary=self.coordina...
This class encapsulates a /value request to Earth Engine for species names. When executed, this request returns stats for a single polygon on one or many Google Fusion Tables.
SpeciesNamesListRequest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpeciesNamesListRequest: """This class encapsulates a /value request to Earth Engine for species names. When executed, this request returns stats for a single polygon on one or many Google Fusion Tables.""" def __init__(self, tableids, coordinates): """Creates a new StatsRequest obje...
stack_v2_sparse_classes_36k_train_015970
13,900
permissive
[ { "docstring": "Creates a new StatsRequest object. Args: tableids - The list of Fusion Table table ids. coordinates - The list of coordinates representing the polygon. lat - The center latitude of the polygon. lng - The center longitude of the polygon.", "name": "__init__", "signature": "def __init__(se...
2
null
Implement the Python class `SpeciesNamesListRequest` described below. Class description: This class encapsulates a /value request to Earth Engine for species names. When executed, this request returns stats for a single polygon on one or many Google Fusion Tables. Method signatures and docstrings: - def __init__(self...
Implement the Python class `SpeciesNamesListRequest` described below. Class description: This class encapsulates a /value request to Earth Engine for species names. When executed, this request returns stats for a single polygon on one or many Google Fusion Tables. Method signatures and docstrings: - def __init__(self...
e3c50ee4ec8364c61cfff3ea68ece1098674f4d6
<|skeleton|> class SpeciesNamesListRequest: """This class encapsulates a /value request to Earth Engine for species names. When executed, this request returns stats for a single polygon on one or many Google Fusion Tables.""" def __init__(self, tableids, coordinates): """Creates a new StatsRequest obje...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpeciesNamesListRequest: """This class encapsulates a /value request to Earth Engine for species names. When executed, this request returns stats for a single polygon on one or many Google Fusion Tables.""" def __init__(self, tableids, coordinates): """Creates a new StatsRequest object. Args: tab...
the_stack_v2_python_sparse
earthengine/frontend.py
MapofLife/MOL
train
19
8535e207d8a745ff711e3b082babaeb50b338612
[ "self.input_shape = input_shape\nself.inputs = [keras.layers.Input(shape=input_shape, name=f'input_{i + 1}') for i in range(observables)]\nself.encoder_outputs = None\nself.rnn = None\nself.model = None\nself.output_dim = output_dim\nself.rnn_layers = rnn_layers\nself.rnn_units = rnn_units\nself.use_gpu = use_gpu",...
<|body_start_0|> self.input_shape = input_shape self.inputs = [keras.layers.Input(shape=input_shape, name=f'input_{i + 1}') for i in range(observables)] self.encoder_outputs = None self.rnn = None self.model = None self.output_dim = output_dim self.rnn_layers = rn...
A recurrent neural network with convolutional (DenseNet) encoding
CRNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CRNN: """A recurrent neural network with convolutional (DenseNet) encoding""" def __init__(self, input_shape=(100, 128, 128, 1), output_dim=26, observables=1, rnn_layers=1, rnn_units=100, use_gpu=True): """:param input_shape: shape of input tensor. :param output_dim: int, number of o...
stack_v2_sparse_classes_36k_train_015971
3,428
no_license
[ { "docstring": ":param input_shape: shape of input tensor. :param output_dim: int, number of output units. :param observables: int, number of observables. :param rnn_layers: int, number of RNN layers :param rnn_units: int, number of units in RNN :param use_gpu: bool, use GPU.", "name": "__init__", "sign...
3
stack_v2_sparse_classes_30k_train_013062
Implement the Python class `CRNN` described below. Class description: A recurrent neural network with convolutional (DenseNet) encoding Method signatures and docstrings: - def __init__(self, input_shape=(100, 128, 128, 1), output_dim=26, observables=1, rnn_layers=1, rnn_units=100, use_gpu=True): :param input_shape: s...
Implement the Python class `CRNN` described below. Class description: A recurrent neural network with convolutional (DenseNet) encoding Method signatures and docstrings: - def __init__(self, input_shape=(100, 128, 128, 1), output_dim=26, observables=1, rnn_layers=1, rnn_units=100, use_gpu=True): :param input_shape: s...
e92589aefb162e5526047348c93360dd1b45531c
<|skeleton|> class CRNN: """A recurrent neural network with convolutional (DenseNet) encoding""" def __init__(self, input_shape=(100, 128, 128, 1), output_dim=26, observables=1, rnn_layers=1, rnn_units=100, use_gpu=True): """:param input_shape: shape of input tensor. :param output_dim: int, number of o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CRNN: """A recurrent neural network with convolutional (DenseNet) encoding""" def __init__(self, input_shape=(100, 128, 128, 1), output_dim=26, observables=1, rnn_layers=1, rnn_units=100, use_gpu=True): """:param input_shape: shape of input tensor. :param output_dim: int, number of output units. ...
the_stack_v2_python_sparse
reacdiff/models/crnn.py
cgrambow/reacdiff
train
1
5442e00d2741a6ba9b246fa03ac09f742ba16aba
[ "self.scale = scale\nself.bias = bias\nself.rgb = rgb", "if image.shape[0] != requiredHeight or image.shape[1] != requiredWidth:\n image = cv2.resize(image, (requiredWidth, requiredHeight))\nif self.rgb:\n if image.shape[2] == 4:\n transform = cv2.COLOR_BGRA2RGBA\n else:\n transform = cv2.C...
<|body_start_0|> self.scale = scale self.bias = bias self.rgb = rgb <|end_body_0|> <|body_start_1|> if image.shape[0] != requiredHeight or image.shape[1] != requiredWidth: image = cv2.resize(image, (requiredWidth, requiredHeight)) if self.rgb: if image.sh...
Preprocessor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preprocessor: def __init__(self, scale=None, bias=None, rgb=None): """Create a preprocessing object to handle image transformations required for network to run scale : float Scale factor applied to image after conversion to float bias : 3-element np.array Bias applied to image after scal...
stack_v2_sparse_classes_36k_train_015972
8,219
permissive
[ { "docstring": "Create a preprocessing object to handle image transformations required for network to run scale : float Scale factor applied to image after conversion to float bias : 3-element np.array Bias applied to image after scaling rgb : bool Set to true to convert 3 channel data to RGB (from BGR)", "...
2
null
Implement the Python class `Preprocessor` described below. Class description: Implement the Preprocessor class. Method signatures and docstrings: - def __init__(self, scale=None, bias=None, rgb=None): Create a preprocessing object to handle image transformations required for network to run scale : float Scale factor ...
Implement the Python class `Preprocessor` described below. Class description: Implement the Preprocessor class. Method signatures and docstrings: - def __init__(self, scale=None, bias=None, rgb=None): Create a preprocessing object to handle image transformations required for network to run scale : float Scale factor ...
fae655f396380dbe74413812a41b734e267faffe
<|skeleton|> class Preprocessor: def __init__(self, scale=None, bias=None, rgb=None): """Create a preprocessing object to handle image transformations required for network to run scale : float Scale factor applied to image after conversion to float bias : 3-element np.array Bias applied to image after scal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Preprocessor: def __init__(self, scale=None, bias=None, rgb=None): """Create a preprocessing object to handle image transformations required for network to run scale : float Scale factor applied to image after conversion to float bias : 3-element np.array Bias applied to image after scaling rgb : bool...
the_stack_v2_python_sparse
deploy_python/openem/models.py
openem-team/openem
train
11
0fc86e0b465f9446232dc0db35dce33eb5626057
[ "sc.logger.info('拍摄-拍摄页放弃')\nfun_name = 'test_cancel_shot'\nsc.logger.info('点击创作中心主按钮')\nsc.first_step(self.c_btn)\nsc.logger.info('点击“拍摄”按钮')\nsc.driver.find_element_by_id('com.quvideo.xiaoying:id/icon2').click()\nel_cp = WebDriverWait(sc.driver, 10, 1).until(lambda x: x.find_element_by_id('com.quvideo.xiaoying:id...
<|body_start_0|> sc.logger.info('拍摄-拍摄页放弃') fun_name = 'test_cancel_shot' sc.logger.info('点击创作中心主按钮') sc.first_step(self.c_btn) sc.logger.info('点击“拍摄”按钮') sc.driver.find_element_by_id('com.quvideo.xiaoying:id/icon2').click() el_cp = WebDriverWait(sc.driver, 10, 1)...
camera取消操作相关的测试类.
TestCameraCancel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCameraCancel: """camera取消操作相关的测试类.""" def test_cancel_shot(self): """拍摄-拍摄页放弃.""" <|body_0|> def test_cancel_save(self): """拍摄-拍摄页保存.""" <|body_1|> def test_cancel_preview(self): """拍摄-预览页放弃.""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_015973
5,465
no_license
[ { "docstring": "拍摄-拍摄页放弃.", "name": "test_cancel_shot", "signature": "def test_cancel_shot(self)" }, { "docstring": "拍摄-拍摄页保存.", "name": "test_cancel_save", "signature": "def test_cancel_save(self)" }, { "docstring": "拍摄-预览页放弃.", "name": "test_cancel_preview", "signature"...
3
null
Implement the Python class `TestCameraCancel` described below. Class description: camera取消操作相关的测试类. Method signatures and docstrings: - def test_cancel_shot(self): 拍摄-拍摄页放弃. - def test_cancel_save(self): 拍摄-拍摄页保存. - def test_cancel_preview(self): 拍摄-预览页放弃.
Implement the Python class `TestCameraCancel` described below. Class description: camera取消操作相关的测试类. Method signatures and docstrings: - def test_cancel_shot(self): 拍摄-拍摄页放弃. - def test_cancel_save(self): 拍摄-拍摄页保存. - def test_cancel_preview(self): 拍摄-预览页放弃. <|skeleton|> class TestCameraCancel: """camera取消操作相关的测试类...
0003b68fc8e26a96ee1661c1eb1f26f96810e909
<|skeleton|> class TestCameraCancel: """camera取消操作相关的测试类.""" def test_cancel_shot(self): """拍摄-拍摄页放弃.""" <|body_0|> def test_cancel_save(self): """拍摄-拍摄页保存.""" <|body_1|> def test_cancel_preview(self): """拍摄-预览页放弃.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCameraCancel: """camera取消操作相关的测试类.""" def test_cancel_shot(self): """拍摄-拍摄页放弃.""" sc.logger.info('拍摄-拍摄页放弃') fun_name = 'test_cancel_shot' sc.logger.info('点击创作中心主按钮') sc.first_step(self.c_btn) sc.logger.info('点击“拍摄”按钮') sc.driver.find_element_by...
the_stack_v2_python_sparse
Android/VivaVideo/test_creations/test_camera/test_cancel.py
Lemonzhulixin/UItest
train
5
dc31babbf9be1b75cc8b3de77a77242c0080223d
[ "from numpy import ascontiguousarray\nself.shape = obj.shape\nself.dtype = obj.dtype.descr if obj.dtype.fields else obj.dtype.str\nself.pickled = False\nif sum(obj.shape) == 0:\n self.pickled = True\nelif obj.dtype == 'O':\n self.pickled = True\nelif obj.dtype.fields and any((dt == 'O' for dt, sz in obj.dtype...
<|body_start_0|> from numpy import ascontiguousarray self.shape = obj.shape self.dtype = obj.dtype.descr if obj.dtype.fields else obj.dtype.str self.pickled = False if sum(obj.shape) == 0: self.pickled = True elif obj.dtype == 'O': self.pickled = T...
A canned numpy array.
CannedArray
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CannedArray: """A canned numpy array.""" def __init__(self, obj): """Initialize the can.""" <|body_0|> def get_object(self, g=None): """Get the object.""" <|body_1|> <|end_skeleton|> <|body_start_0|> from numpy import ascontiguousarray s...
stack_v2_sparse_classes_36k_train_015974
13,378
permissive
[ { "docstring": "Initialize the can.", "name": "__init__", "signature": "def __init__(self, obj)" }, { "docstring": "Get the object.", "name": "get_object", "signature": "def get_object(self, g=None)" } ]
2
null
Implement the Python class `CannedArray` described below. Class description: A canned numpy array. Method signatures and docstrings: - def __init__(self, obj): Initialize the can. - def get_object(self, g=None): Get the object.
Implement the Python class `CannedArray` described below. Class description: A canned numpy array. Method signatures and docstrings: - def __init__(self, obj): Initialize the can. - def get_object(self, g=None): Get the object. <|skeleton|> class CannedArray: """A canned numpy array.""" def __init__(self, o...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class CannedArray: """A canned numpy array.""" def __init__(self, obj): """Initialize the can.""" <|body_0|> def get_object(self, g=None): """Get the object.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CannedArray: """A canned numpy array.""" def __init__(self, obj): """Initialize the can.""" from numpy import ascontiguousarray self.shape = obj.shape self.dtype = obj.dtype.descr if obj.dtype.fields else obj.dtype.str self.pickled = False if sum(obj.shape)...
the_stack_v2_python_sparse
contrib/python/ipykernel/py3/ipykernel/pickleutil.py
catboost/catboost
train
8,012
ccdc4a3b0ba5286393458b078f76bd7f954a9ce3
[ "url = 'updates/cluster'\npostdata = {}\nif updateReason:\n postdata['reason'] = updateReason\nif len(opts) > 0:\n postdata['opts'] = json.dumps(opts)\ntry:\n self.post(url, postdata)\nexcept TortugaException:\n raise\nexcept Exception as ex:\n raise TortugaException(exception=ex)", "url = 'updates...
<|body_start_0|> url = 'updates/cluster' postdata = {} if updateReason: postdata['reason'] = updateReason if len(opts) > 0: postdata['opts'] = json.dumps(opts) try: self.post(url, postdata) except TortugaException: raise ...
Cluster sync WS API class
SyncWsApi
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncWsApi: """Cluster sync WS API class""" def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}): """Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException""" <|body_0|> def getUpdateStatus(self): """Re...
stack_v2_sparse_classes_36k_train_015975
2,010
permissive
[ { "docstring": "Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException", "name": "scheduleClusterUpdate", "signature": "def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={})" }, { "docstring": "Return cluster update status Returns: Boo...
2
stack_v2_sparse_classes_30k_train_021216
Implement the Python class `SyncWsApi` described below. Class description: Cluster sync WS API class Method signatures and docstrings: - def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}): Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException - def getU...
Implement the Python class `SyncWsApi` described below. Class description: Cluster sync WS API class Method signatures and docstrings: - def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}): Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException - def getU...
56d808d7836cd15d6c6748cbf704cdea4407fef6
<|skeleton|> class SyncWsApi: """Cluster sync WS API class""" def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}): """Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException""" <|body_0|> def getUpdateStatus(self): """Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyncWsApi: """Cluster sync WS API class""" def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}): """Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException""" url = 'updates/cluster' postdata = {} if updateReason...
the_stack_v2_python_sparse
src/core/src/tortuga/wsapi/syncWsApi.py
UnivaCorporation/tortuga
train
33
c4e8bae8807ba7bfac772ef53d28505a0f56941d
[ "if root:\n self.m[depth] = self.m.get(depth, []) + [root.val]\n self.max_depth = max(self.max_depth, depth)\n self.traversal(root.left, depth + 1)\n self.traversal(root.right, depth + 1)", "self.m = {}\nself.max_depth = 0\nself.traversal(root, 0)\nret = []\nif not root:\n return ret\nfor i in rang...
<|body_start_0|> if root: self.m[depth] = self.m.get(depth, []) + [root.val] self.max_depth = max(self.max_depth, depth) self.traversal(root.left, depth + 1) self.traversal(root.right, depth + 1) <|end_body_0|> <|body_start_1|> self.m = {} self.ma...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def traversal(self, root, depth): """:type root: TreeNode :type depth: int :rtype: void""" <|body_0|> def levelOrder1(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> def levelOrder(self, root, depth=0, m=[]): ...
stack_v2_sparse_classes_36k_train_015976
1,508
no_license
[ { "docstring": ":type root: TreeNode :type depth: int :rtype: void", "name": "traversal", "signature": "def traversal(self, root, depth)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder1", "signature": "def levelOrder1(self, root)" }, { "docs...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def traversal(self, root, depth): :type root: TreeNode :type depth: int :rtype: void - def levelOrder1(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrder(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def traversal(self, root, depth): :type root: TreeNode :type depth: int :rtype: void - def levelOrder1(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrder(...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def traversal(self, root, depth): """:type root: TreeNode :type depth: int :rtype: void""" <|body_0|> def levelOrder1(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> def levelOrder(self, root, depth=0, m=[]): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def traversal(self, root, depth): """:type root: TreeNode :type depth: int :rtype: void""" if root: self.m[depth] = self.m.get(depth, []) + [root.val] self.max_depth = max(self.max_depth, depth) self.traversal(root.left, depth + 1) self...
the_stack_v2_python_sparse
python/leetcode/102_Binary_Tree_Level_Order_Traversal.py
bobcaoge/my-code
train
0
14d17d6a2ffa10a70eef465f3a0027e703359b52
[ "student = self.personalize_page_and_get_enrolled()\nif not student:\n return\nself.template_value['student'] = student\nself.template_value['navbar'] = {}\nself.template_value['student_unenroll_xsrf_token'] = XsrfTokenManager.create_xsrf_token('student-unenroll')\nself.render('unenroll_confirmation_check.html')...
<|body_start_0|> student = self.personalize_page_and_get_enrolled() if not student: return self.template_value['student'] = student self.template_value['navbar'] = {} self.template_value['student_unenroll_xsrf_token'] = XsrfTokenManager.create_xsrf_token('student-unen...
Handler for students to unenroll themselves.
StudentUnenrollHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudentUnenrollHandler: """Handler for students to unenroll themselves.""" def get(self): """Handles GET requests.""" <|body_0|> def post(self): """Handles POST requests.""" <|body_1|> <|end_skeleton|> <|body_start_0|> student = self.personalize...
stack_v2_sparse_classes_36k_train_015977
24,555
permissive
[ { "docstring": "Handles GET requests.", "name": "get", "signature": "def get(self)" }, { "docstring": "Handles POST requests.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_001811
Implement the Python class `StudentUnenrollHandler` described below. Class description: Handler for students to unenroll themselves. Method signatures and docstrings: - def get(self): Handles GET requests. - def post(self): Handles POST requests.
Implement the Python class `StudentUnenrollHandler` described below. Class description: Handler for students to unenroll themselves. Method signatures and docstrings: - def get(self): Handles GET requests. - def post(self): Handles POST requests. <|skeleton|> class StudentUnenrollHandler: """Handler for students...
1bd1eeb41ad77f31c95897916efdb4a5a9cef2a8
<|skeleton|> class StudentUnenrollHandler: """Handler for students to unenroll themselves.""" def get(self): """Handles GET requests.""" <|body_0|> def post(self): """Handles POST requests.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudentUnenrollHandler: """Handler for students to unenroll themselves.""" def get(self): """Handles GET requests.""" student = self.personalize_page_and_get_enrolled() if not student: return self.template_value['student'] = student self.template_value[...
the_stack_v2_python_sparse
coursebuilder/controllers/utils.py
xaferima/Malware-MetasploitLab
train
1
5d148267feda7ced61fd42724430edf36f69c76b
[ "config = casper_formatters.FormatterConfig.from_dict({'presets': ['punc']})\ninput_str, output_str = casper_formatters.augment_exemplars(_EXAMPLES[0], [_EXAMPLES[1], _EXAMPLES[3]], 'top', config)\nexpected_input_str = '{} @@ {} ## {} @@ {} ## {}'.format(_EXAMPLES[0]['input_str'], _EXAMPLES[1]['input_str'], _EXAMPL...
<|body_start_0|> config = casper_formatters.FormatterConfig.from_dict({'presets': ['punc']}) input_str, output_str = casper_formatters.augment_exemplars(_EXAMPLES[0], [_EXAMPLES[1], _EXAMPLES[3]], 'top', config) expected_input_str = '{} @@ {} ## {} @@ {} ## {}'.format(_EXAMPLES[0]['input_str'], ...
FormattersTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormattersTest: def test_punc_prompt_formatter(self): """Tests the punc prompt format.""" <|body_0|> def test_punc_inv_prompt_formatter(self): """Tests the punc prompt format with original input at the end.""" <|body_1|> def test_verbal_prompt_formatter(...
stack_v2_sparse_classes_36k_train_015978
7,201
permissive
[ { "docstring": "Tests the punc prompt format.", "name": "test_punc_prompt_formatter", "signature": "def test_punc_prompt_formatter(self)" }, { "docstring": "Tests the punc prompt format with original input at the end.", "name": "test_punc_inv_prompt_formatter", "signature": "def test_pun...
4
null
Implement the Python class `FormattersTest` described below. Class description: Implement the FormattersTest class. Method signatures and docstrings: - def test_punc_prompt_formatter(self): Tests the punc prompt format. - def test_punc_inv_prompt_formatter(self): Tests the punc prompt format with original input at th...
Implement the Python class `FormattersTest` described below. Class description: Implement the FormattersTest class. Method signatures and docstrings: - def test_punc_prompt_formatter(self): Tests the punc prompt format. - def test_punc_inv_prompt_formatter(self): Tests the punc prompt format with original input at th...
ac9447064195e06de48cc91ff642f7fffa28ffe8
<|skeleton|> class FormattersTest: def test_punc_prompt_formatter(self): """Tests the punc prompt format.""" <|body_0|> def test_punc_inv_prompt_formatter(self): """Tests the punc prompt format with original input at the end.""" <|body_1|> def test_verbal_prompt_formatter(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormattersTest: def test_punc_prompt_formatter(self): """Tests the punc prompt format.""" config = casper_formatters.FormatterConfig.from_dict({'presets': ['punc']}) input_str, output_str = casper_formatters.augment_exemplars(_EXAMPLES[0], [_EXAMPLES[1], _EXAMPLES[3]], 'top', config) ...
the_stack_v2_python_sparse
language/casper/augment/casper_formatters_test.py
google-research/language
train
1,567
e9313b3a10b4b607d77d4a726a3210c85c080256
[ "self.name = name\nself.timeline_files = timeline_files\nself.timeline_props = timeline_props\nself.timeframe = timestep * frequency * 1e-06\nself.residues = []\nself.parse_tml()", "for resi in self.residues:\n if residue.resid == resi.resid and residue.segname == resi.segname:\n return True\nreturn Fal...
<|body_start_0|> self.name = name self.timeline_files = timeline_files self.timeline_props = timeline_props self.timeframe = timestep * frequency * 1e-06 self.residues = [] self.parse_tml() <|end_body_0|> <|body_start_1|> for resi in self.residues: if...
TimelineSegment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimelineSegment: def __init__(self, timeline_files, timeline_props, timestep, frequency, name): """:param timeline_files: tml files :param timeline_props: tml files properties :param timestep: md timestep :param frequency: md trajectory save frequency""" <|body_0|> def __con...
stack_v2_sparse_classes_36k_train_015979
5,752
no_license
[ { "docstring": ":param timeline_files: tml files :param timeline_props: tml files properties :param timestep: md timestep :param frequency: md trajectory save frequency", "name": "__init__", "signature": "def __init__(self, timeline_files, timeline_props, timestep, frequency, name)" }, { "docstr...
6
stack_v2_sparse_classes_30k_train_007113
Implement the Python class `TimelineSegment` described below. Class description: Implement the TimelineSegment class. Method signatures and docstrings: - def __init__(self, timeline_files, timeline_props, timestep, frequency, name): :param timeline_files: tml files :param timeline_props: tml files properties :param t...
Implement the Python class `TimelineSegment` described below. Class description: Implement the TimelineSegment class. Method signatures and docstrings: - def __init__(self, timeline_files, timeline_props, timestep, frequency, name): :param timeline_files: tml files :param timeline_props: tml files properties :param t...
fdb8a1a14bcf0b372ebaf152f2bbb1f5d804172e
<|skeleton|> class TimelineSegment: def __init__(self, timeline_files, timeline_props, timestep, frequency, name): """:param timeline_files: tml files :param timeline_props: tml files properties :param timestep: md timestep :param frequency: md trajectory save frequency""" <|body_0|> def __con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimelineSegment: def __init__(self, timeline_files, timeline_props, timestep, frequency, name): """:param timeline_files: tml files :param timeline_props: tml files properties :param timestep: md timestep :param frequency: md trajectory save frequency""" self.name = name self.timeline_...
the_stack_v2_python_sparse
dynamics_analysis/mm_analysis_timeline.py
michal2am/bioscripts
train
3
197aca49344dfcc04d4f605007a3eef427ef1e43
[ "super(IdentityResidualBlock, self).__init__()\nself.dist_bn = dist_bn\nif len(channels) != 2 and len(channels) != 3:\n raise ValueError('channels must contain either two or three values')\nif len(channels) == 2 and groups != 1:\n raise ValueError('groups > 1 are only valid if len(channels) == 3')\nis_bottlen...
<|body_start_0|> super(IdentityResidualBlock, self).__init__() self.dist_bn = dist_bn if len(channels) != 2 and len(channels) != 3: raise ValueError('channels must contain either two or three values') if len(channels) == 2 and groups != 1: raise ValueError('groups...
Identity Residual Block for WideResnet
IdentityResidualBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentityResidualBlock: """Identity Residual Block for WideResnet""" def __init__(self, in_channels, channels, strides=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): """Configurable identity-mapping residual block Parameters ---------- in_channels : int Number...
stack_v2_sparse_classes_36k_train_015980
13,143
permissive
[ { "docstring": "Configurable identity-mapping residual block Parameters ---------- in_channels : int Number of input channels. channels : list of int Number of channels in the internal feature maps. Can either have two or three elements: if three construct a residual block with two `3 x 3` convolutions, otherwi...
2
null
Implement the Python class `IdentityResidualBlock` described below. Class description: Identity Residual Block for WideResnet Method signatures and docstrings: - def __init__(self, in_channels, channels, strides=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): Configurable identity-mapping resi...
Implement the Python class `IdentityResidualBlock` described below. Class description: Identity Residual Block for WideResnet Method signatures and docstrings: - def __init__(self, in_channels, channels, strides=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): Configurable identity-mapping resi...
567775619f3b97d47e7c360748912a4fd883ff52
<|skeleton|> class IdentityResidualBlock: """Identity Residual Block for WideResnet""" def __init__(self, in_channels, channels, strides=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): """Configurable identity-mapping residual block Parameters ---------- in_channels : int Number...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdentityResidualBlock: """Identity Residual Block for WideResnet""" def __init__(self, in_channels, channels, strides=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): """Configurable identity-mapping residual block Parameters ---------- in_channels : int Number of input cha...
the_stack_v2_python_sparse
gluoncv/model_zoo/wideresnet.py
dmlc/gluon-cv
train
6,064
11c287e088260c257405754a756a3a480f6b1814
[ "bootcamp_application = self.instance.bootcamp_application\nif 'review_status' in attrs:\n if bootcamp_application.state not in (AppStates.AWAITING_SUBMISSION_REVIEW.value, AppStates.AWAITING_USER_SUBMISSIONS.value, AppStates.AWAITING_PAYMENT.value, AppStates.REJECTED.value) or bootcamp_application.total_paid > ...
<|body_start_0|> bootcamp_application = self.instance.bootcamp_application if 'review_status' in attrs: if bootcamp_application.state not in (AppStates.AWAITING_SUBMISSION_REVIEW.value, AppStates.AWAITING_USER_SUBMISSIONS.value, AppStates.AWAITING_PAYMENT.value, AppStates.REJECTED.value) or ...
ApplicationStepSubmission serializer for reviewers
SubmissionReviewSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmissionReviewSerializer: """ApplicationStepSubmission serializer for reviewers""" def validate(self, attrs): """Validate incoming data for a write""" <|body_0|> def update(self, instance, validated_data): """Update an ApplicationStepSubmission""" <|bod...
stack_v2_sparse_classes_36k_train_015981
10,254
permissive
[ { "docstring": "Validate incoming data for a write", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Update an ApplicationStepSubmission", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
null
Implement the Python class `SubmissionReviewSerializer` described below. Class description: ApplicationStepSubmission serializer for reviewers Method signatures and docstrings: - def validate(self, attrs): Validate incoming data for a write - def update(self, instance, validated_data): Update an ApplicationStepSubmis...
Implement the Python class `SubmissionReviewSerializer` described below. Class description: ApplicationStepSubmission serializer for reviewers Method signatures and docstrings: - def validate(self, attrs): Validate incoming data for a write - def update(self, instance, validated_data): Update an ApplicationStepSubmis...
339c67b84b661a37ffe32580da72383d95666c5c
<|skeleton|> class SubmissionReviewSerializer: """ApplicationStepSubmission serializer for reviewers""" def validate(self, attrs): """Validate incoming data for a write""" <|body_0|> def update(self, instance, validated_data): """Update an ApplicationStepSubmission""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubmissionReviewSerializer: """ApplicationStepSubmission serializer for reviewers""" def validate(self, attrs): """Validate incoming data for a write""" bootcamp_application = self.instance.bootcamp_application if 'review_status' in attrs: if bootcamp_application.state...
the_stack_v2_python_sparse
applications/serializers.py
mitodl/bootcamp-ecommerce
train
6
3d41406e71ebc01b4e5e9a129fc5d76fc4176518
[ "self.k = k\nheapq.heapify(nums)\nself.heap = nums\nwhile len(self.heap) > k:\n heapq.heappop(self.heap)", "if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\nelse:\n heapq.heappushpop(self.heap, val)\nreturn self.heap[0]" ]
<|body_start_0|> self.k = k heapq.heapify(nums) self.heap = nums while len(self.heap) > k: heapq.heappop(self.heap) <|end_body_0|> <|body_start_1|> if len(self.heap) < self.k: heapq.heappush(self.heap, val) else: heapq.heappushpop(self...
KthLargest2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest2: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k heapq.heapify(nums) self.heap ...
stack_v2_sparse_classes_36k_train_015982
2,963
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_013272
Implement the Python class `KthLargest2` described below. Class description: Implement the KthLargest2 class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest2` described below. Class description: Implement the KthLargest2 class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest2: def __init__(self, k,...
3e50f6a936b98ad75c47d7c1719e69163c648235
<|skeleton|> class KthLargest2: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest2: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k heapq.heapify(nums) self.heap = nums while len(self.heap) > k: heapq.heappop(self.heap) def add(self, val): """:type val: int :rtype: int""" if...
the_stack_v2_python_sparse
LeetcodeNew/Heap/LC_703_Kth_Largest_Element_in_a_Stream.py
Taoge123/OptimizedLeetcode
train
9
60cf00c644f27363a7c55b6806154de4cc15e677
[ "super(SimSiam, self).__init__()\nself.encoder = encoder\nself.projector = MLPHead(in_dim=encoder_dim, out_dim=feature_dim, n_layers=n_mlplayers, hidden_dims=[hidden_dim] * (n_mlplayers - 1), use_bn=use_bn)\nself.model = nn.Sequential(self.encoder, self.projector)\nself.predictor = nn.Sequential(nn.Linear(feature_d...
<|body_start_0|> super(SimSiam, self).__init__() self.encoder = encoder self.projector = MLPHead(in_dim=encoder_dim, out_dim=feature_dim, n_layers=n_mlplayers, hidden_dims=[hidden_dim] * (n_mlplayers - 1), use_bn=use_bn) self.model = nn.Sequential(self.encoder, self.projector) se...
Build a SimSiam model. f: backbone + projection mlp h: prediction mlp for x in loader: # load a minibatch x with n samples x1, x2 = aug(x), aug(x) # random augmentation z1, z2 = f(x1), f(x2) # projections, n-by-d p1, p2 = h(z1), h(z2) # predictions, n-by-d L = D(p1, z2)/2 + D(p2, z1)/2 # loss L.backward() # back-propag...
SimSiam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimSiam: """Build a SimSiam model. f: backbone + projection mlp h: prediction mlp for x in loader: # load a minibatch x with n samples x1, x2 = aug(x), aug(x) # random augmentation z1, z2 = f(x1), f(x2) # projections, n-by-d p1, p2 = h(z1), h(z2) # predictions, n-by-d L = D(p1, z2)/2 + D(p2, z1)/...
stack_v2_sparse_classes_36k_train_015983
2,986
no_license
[ { "docstring": "- encoder: encoder you want to use to get feature representations (eg. resnet50) - encoder_dim: dimension of the encoder output, your feature dimension (default: 2048 for resnets) - feature_dim: dimension of the projector output (default: 512) - predict_dim: hidden dimension of the predictor (de...
2
null
Implement the Python class `SimSiam` described below. Class description: Build a SimSiam model. f: backbone + projection mlp h: prediction mlp for x in loader: # load a minibatch x with n samples x1, x2 = aug(x), aug(x) # random augmentation z1, z2 = f(x1), f(x2) # projections, n-by-d p1, p2 = h(z1), h(z2) # predictio...
Implement the Python class `SimSiam` described below. Class description: Build a SimSiam model. f: backbone + projection mlp h: prediction mlp for x in loader: # load a minibatch x with n samples x1, x2 = aug(x), aug(x) # random augmentation z1, z2 = f(x1), f(x2) # projections, n-by-d p1, p2 = h(z1), h(z2) # predictio...
5976cea3f0b4ec86503150bbe0935cdf6dab4f7b
<|skeleton|> class SimSiam: """Build a SimSiam model. f: backbone + projection mlp h: prediction mlp for x in loader: # load a minibatch x with n samples x1, x2 = aug(x), aug(x) # random augmentation z1, z2 = f(x1), f(x2) # projections, n-by-d p1, p2 = h(z1), h(z2) # predictions, n-by-d L = D(p1, z2)/2 + D(p2, z1)/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimSiam: """Build a SimSiam model. f: backbone + projection mlp h: prediction mlp for x in loader: # load a minibatch x with n samples x1, x2 = aug(x), aug(x) # random augmentation z1, z2 = f(x1), f(x2) # projections, n-by-d p1, p2 = h(z1), h(z2) # predictions, n-by-d L = D(p1, z2)/2 + D(p2, z1)/2 # loss L.ba...
the_stack_v2_python_sparse
selfsupervised/simsiam.py
yuty2009/prml-python
train
3
ff9edaf548a129ab1b37732c94dc0f1193ada842
[ "self.turbine = turbine\nself.controller = controller\nself.linturb = linturb", "if fig and ax:\n self.fig = fig\n self.ax = ax\nelse:\n self.fig, self.ax = plt.subplots(1, 1, num=num)\nw, H = self.get_nyquistdata(u, omega, k_float=k_float)\nself.line, = self.ax.plot(H.real, H.imag, **kwargs)\nplt.scatte...
<|body_start_0|> self.turbine = turbine self.controller = controller self.linturb = linturb <|end_body_0|> <|body_start_1|> if fig and ax: self.fig = fig self.ax = ax else: self.fig, self.ax = plt.subplots(1, 1, num=num) w, H = self.ge...
lin_plotting
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lin_plotting: def __init__(self, controller, turbine, linturb): """Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object""" <|body_0|> def plot_nyquist(self, u, omega, k_float=0.0, xlim=None...
stack_v2_sparse_classes_36k_train_015984
2,541
permissive
[ { "docstring": "Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object", "name": "__init__", "signature": "def __init__(self, controller, turbine, linturb)" }, { "docstring": "Plot nyquist diagram Parameters: ---...
3
stack_v2_sparse_classes_30k_train_002242
Implement the Python class `lin_plotting` described below. Class description: Implement the lin_plotting class. Method signatures and docstrings: - def __init__(self, controller, turbine, linturb): Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object RO...
Implement the Python class `lin_plotting` described below. Class description: Implement the lin_plotting class. Method signatures and docstrings: - def __init__(self, controller, turbine, linturb): Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object RO...
e3b7db779ad9e7bea5dea692e92f52b10116cf02
<|skeleton|> class lin_plotting: def __init__(self, controller, turbine, linturb): """Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object""" <|body_0|> def plot_nyquist(self, u, omega, k_float=0.0, xlim=None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class lin_plotting: def __init__(self, controller, turbine, linturb): """Parameters ---------- controller: object ROSCO controller object turbine: object ROSCO turbine object linturb: object ROSCO linturb object""" self.turbine = turbine self.controller = controller self.linturb = li...
the_stack_v2_python_sparse
ROSCO_toolbox/linear/lin_vis.py
NREL/ROSCO
train
78
ffeffc1a88b7c63ca777c6c62936f3cd1e974fc0
[ "self._mask_num_classes = num_classes\nself._num_downsample_channels = num_downsample_channels\nself._mask_crop_size = mask_crop_size\nself._num_convs = num_convs\nself._coarse_mask_thr = coarse_mask_thr\nself._gt_upsample_scale = gt_upsample_scale\nself._class_predict_conv = tf.keras.layers.Conv2D(self._mask_num_c...
<|body_start_0|> self._mask_num_classes = num_classes self._num_downsample_channels = num_downsample_channels self._mask_crop_size = mask_crop_size self._num_convs = num_convs self._coarse_mask_thr = coarse_mask_thr self._gt_upsample_scale = gt_upsample_scale self...
ShapemaskFinemaskHead head.
ShapemaskFinemaskHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShapemaskFinemaskHead: """ShapemaskFinemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, num_convs, coarse_mask_thr, gt_upsample_scale, norm_activation=nn_ops.norm_activation_builder()): """Initialize params to build ShapeMask coarse and fine ...
stack_v2_sparse_classes_36k_train_015985
45,524
permissive
[ { "docstring": "Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number of mask classification categories. num_downsample_channels: `int` number of filters at mask head. mask_crop_size: feature crop size. num_convs: `int` number of stacked convolution before the las...
3
stack_v2_sparse_classes_30k_test_000447
Implement the Python class `ShapemaskFinemaskHead` described below. Class description: ShapemaskFinemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, num_convs, coarse_mask_thr, gt_upsample_scale, norm_activation=nn_ops.norm_activation_builder(...
Implement the Python class `ShapemaskFinemaskHead` described below. Class description: ShapemaskFinemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, num_convs, coarse_mask_thr, gt_upsample_scale, norm_activation=nn_ops.norm_activation_builder(...
965cc3eef54a3a173a2347fe0059a35f1e5f2496
<|skeleton|> class ShapemaskFinemaskHead: """ShapemaskFinemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, num_convs, coarse_mask_thr, gt_upsample_scale, norm_activation=nn_ops.norm_activation_builder()): """Initialize params to build ShapeMask coarse and fine ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShapemaskFinemaskHead: """ShapemaskFinemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, num_convs, coarse_mask_thr, gt_upsample_scale, norm_activation=nn_ops.norm_activation_builder()): """Initialize params to build ShapeMask coarse and fine prediction he...
the_stack_v2_python_sparse
official/vision/detection/modeling/architecture/heads.py
ayushmankumar7/models
train
4
fc19620a0bc8c846d631b91f661043b1f9bac0bb
[ "self.agent = agent\nself.env = env\nassert not isinstance(self.env, VecEnv), 'The environment cannot be of type VecEnv. '\nself.gamma = gamma", "D = []\nfor n in range(N):\n trajectory = Trajectory(gamma=self.gamma)\n obs = self.env.reset()\n for t in range(T):\n output_agent = self.agent.choose_...
<|body_start_0|> self.agent = agent self.env = env assert not isinstance(self.env, VecEnv), 'The environment cannot be of type VecEnv. ' self.gamma = gamma <|end_body_0|> <|body_start_1|> D = [] for n in range(N): trajectory = Trajectory(gamma=self.gamma) ...
Batched data collection for an agent in one environment for a number of trajectories and a certain time steps. It includes successive transitions (observation, action, reward, next observation, done) and additional data useful for training the agent such as the action log-probabilities, policy entropies, Q values etc. ...
TrajectoryRunner
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrajectoryRunner: """Batched data collection for an agent in one environment for a number of trajectories and a certain time steps. It includes successive transitions (observation, action, reward, next observation, done) and additional data useful for training the agent such as the action log-pro...
stack_v2_sparse_classes_36k_train_015986
5,657
permissive
[ { "docstring": "Args: agent (BaseAgent): agent env (Env): environment gamma (float): discount factor", "name": "__init__", "signature": "def __init__(self, agent, env, gamma)" }, { "docstring": "Run the agent in the environment and collect all necessary data for given number of trajectories and ...
2
stack_v2_sparse_classes_30k_train_013788
Implement the Python class `TrajectoryRunner` described below. Class description: Batched data collection for an agent in one environment for a number of trajectories and a certain time steps. It includes successive transitions (observation, action, reward, next observation, done) and additional data useful for traini...
Implement the Python class `TrajectoryRunner` described below. Class description: Batched data collection for an agent in one environment for a number of trajectories and a certain time steps. It includes successive transitions (observation, action, reward, next observation, done) and additional data useful for traini...
6dc636ea6102b69e631421688a238db5e0b2d9c0
<|skeleton|> class TrajectoryRunner: """Batched data collection for an agent in one environment for a number of trajectories and a certain time steps. It includes successive transitions (observation, action, reward, next observation, done) and additional data useful for training the agent such as the action log-pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrajectoryRunner: """Batched data collection for an agent in one environment for a number of trajectories and a certain time steps. It includes successive transitions (observation, action, reward, next observation, done) and additional data useful for training the agent such as the action log-probabilities, p...
the_stack_v2_python_sparse
lagom/runner/trajectory_runner.py
MuharremOkutan/lagom
train
0
d4d0081531fe0da503738abd16ff13fff8f9bc23
[ "profile_result = get_profile_data(kwargs)\nif not profile_result.ok:\n return WebsiteErrorView.website_error(request, WebsiteError.PROFILE_NOT_FOUND, {'profile_oid': profile_result.oid_org})\nroot_oid = get_root_oid(request)\nprofile_model = profile_result.model\nchannel_model = ChannelManager.get_channel_oid(p...
<|body_start_0|> profile_result = get_profile_data(kwargs) if not profile_result.ok: return WebsiteErrorView.website_error(request, WebsiteError.PROFILE_NOT_FOUND, {'profile_oid': profile_result.oid_org}) root_oid = get_root_oid(request) profile_model = profile_result.model ...
View to see the profile info.
ProfileInfoView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileInfoView: """View to see the profile info.""" def get(self, request, **kwargs): """Page to see the profile info.""" <|body_0|> def post(self, request, **kwargs): """Handle the action request sent from the profile info page.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_015987
7,451
permissive
[ { "docstring": "Page to see the profile info.", "name": "get", "signature": "def get(self, request, **kwargs)" }, { "docstring": "Handle the action request sent from the profile info page.", "name": "post", "signature": "def post(self, request, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_007857
Implement the Python class `ProfileInfoView` described below. Class description: View to see the profile info. Method signatures and docstrings: - def get(self, request, **kwargs): Page to see the profile info. - def post(self, request, **kwargs): Handle the action request sent from the profile info page.
Implement the Python class `ProfileInfoView` described below. Class description: View to see the profile info. Method signatures and docstrings: - def get(self, request, **kwargs): Page to see the profile info. - def post(self, request, **kwargs): Handle the action request sent from the profile info page. <|skeleton...
c7da1e91783dce3a2b71b955b3a22b68db9056cf
<|skeleton|> class ProfileInfoView: """View to see the profile info.""" def get(self, request, **kwargs): """Page to see the profile info.""" <|body_0|> def post(self, request, **kwargs): """Handle the action request sent from the profile info page.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileInfoView: """View to see the profile info.""" def get(self, request, **kwargs): """Page to see the profile info.""" profile_result = get_profile_data(kwargs) if not profile_result.ok: return WebsiteErrorView.website_error(request, WebsiteError.PROFILE_NOT_FOUND,...
the_stack_v2_python_sparse
JellyBot/views/info/profile.py
RxJellyBot/Jelly-Bot
train
5
e261b8cf8d7d23fb9cde5d495c5d935ab37d6604
[ "path = os.path.normpath(path)\narchive_path: Optional[str] = None\ninner_path: Optional[str] = None\nfor ext in extensions:\n ext_index: int = path.lower().find(f'{ext.lower()}{os.path.sep}')\n if ext_index == -1:\n continue\n archive_path = path[:ext_index + len(ext)]\n inner_path = path[ext_in...
<|body_start_0|> path = os.path.normpath(path) archive_path: Optional[str] = None inner_path: Optional[str] = None for ext in extensions: ext_index: int = path.lower().find(f'{ext.lower()}{os.path.sep}') if ext_index == -1: continue arc...
Returns version information from a plist
Versioner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Versioner: """Returns version information from a plist""" def _read_from_zip(self, path: str, skip_single_root_dir: bool, deserializer: Callable[[FileOrPath], VarDict], extensions: List[str]) -> Optional[VarDict]: """Parse a member from a zip and return `bytes`, or `None` if it does ...
stack_v2_sparse_classes_36k_train_015988
8,470
permissive
[ { "docstring": "Parse a member from a zip and return `bytes`, or `None` if it does not exist. The `path` argument should be structured such that the path into the zip file follows the path to the zip file directly. Example: path/to/archive.zip/path/in/archive/to/version.plist If the flag `skip_single_root_dir` ...
4
null
Implement the Python class `Versioner` described below. Class description: Returns version information from a plist Method signatures and docstrings: - def _read_from_zip(self, path: str, skip_single_root_dir: bool, deserializer: Callable[[FileOrPath], VarDict], extensions: List[str]) -> Optional[VarDict]: Parse a me...
Implement the Python class `Versioner` described below. Class description: Returns version information from a plist Method signatures and docstrings: - def _read_from_zip(self, path: str, skip_single_root_dir: bool, deserializer: Callable[[FileOrPath], VarDict], extensions: List[str]) -> Optional[VarDict]: Parse a me...
126f90f7c6ea9c89c164b9dd575520bf97718e38
<|skeleton|> class Versioner: """Returns version information from a plist""" def _read_from_zip(self, path: str, skip_single_root_dir: bool, deserializer: Callable[[FileOrPath], VarDict], extensions: List[str]) -> Optional[VarDict]: """Parse a member from a zip and return `bytes`, or `None` if it does ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Versioner: """Returns version information from a plist""" def _read_from_zip(self, path: str, skip_single_root_dir: bool, deserializer: Callable[[FileOrPath], VarDict], extensions: List[str]) -> Optional[VarDict]: """Parse a member from a zip and return `bytes`, or `None` if it does not exist. Th...
the_stack_v2_python_sparse
Code/autopkglib/Versioner.py
autopkg/autopkg
train
1,059
aff24664b06e3ba0f2e12f2a4f985279d59adada
[ "self._traces_tree = Node('')\nfor trace in traces:\n node = self._traces_tree\n for func in trace:\n if func in node.childs:\n node.childs[func].times += 1\n else:\n node.childs[func] = Node(func)\n node = node.childs[func]", "if node is None:\n node = self._tr...
<|body_start_0|> self._traces_tree = Node('') for trace in traces: node = self._traces_tree for func in trace: if func in node.childs: node.childs[func].times += 1 else: node.childs[func] = Node(func) ...
TracesProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TracesProcessor: def __init__(self, traces): """Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop", "select"], ["main", "parse_args"], ["main", "workloop", "parse_data", "parse_entry"], ["main", "workl...
stack_v2_sparse_classes_36k_train_015989
2,199
no_license
[ { "docstring": "Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ [\"main\", \"workloop\", \"select\"], [\"main\", \"parse_args\"], [\"main\", \"workloop\", \"parse_data\", \"parse_entry\"], [\"main\", \"workloop\", \"select\"] ]", "name": ...
2
null
Implement the Python class `TracesProcessor` described below. Class description: Implement the TracesProcessor class. Method signatures and docstrings: - def __init__(self, traces): Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop...
Implement the Python class `TracesProcessor` described below. Class description: Implement the TracesProcessor class. Method signatures and docstrings: - def __init__(self, traces): Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop...
5e63e238950c2f6bdfd3ff48311d6c69a676d382
<|skeleton|> class TracesProcessor: def __init__(self, traces): """Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop", "select"], ["main", "parse_args"], ["main", "workloop", "parse_data", "parse_entry"], ["main", "workl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TracesProcessor: def __init__(self, traces): """Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop", "select"], ["main", "parse_args"], ["main", "workloop", "parse_data", "parse_entry"], ["main", "workloop", "select"...
the_stack_v2_python_sparse
uber.py
alonsovidales/interview_questions
train
6
06ece201a8c873d530283ea3bf97ea18221990f5
[ "sku_id = json.loads(request.body.decode()).get('sku_id')\ntry:\n sku = SKU.objects.get(id=sku_id)\nexcept SKU.DoesNotExist:\n return http.JsonResponse({'code': RETCODE.PARAMERR, 'errmsg': '参数错误'})\nuser = request.user\nif not user.is_authenticated:\n return http.JsonResponse({'code': RETCODE.OK, 'errmsg':...
<|body_start_0|> sku_id = json.loads(request.body.decode()).get('sku_id') try: sku = SKU.objects.get(id=sku_id) except SKU.DoesNotExist: return http.JsonResponse({'code': RETCODE.PARAMERR, 'errmsg': '参数错误'}) user = request.user if not user.is_authenticated...
需要用View, 否则非登录用户会转到登录界面
BrowseHistoriesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowseHistoriesView: """需要用View, 否则非登录用户会转到登录界面""" def post(self, request): """存储商品浏览记录""" <|body_0|> def get(self, request): """用户中心展示浏览记录""" <|body_1|> <|end_skeleton|> <|body_start_0|> sku_id = json.loads(request.body.decode()).get('sku_id') ...
stack_v2_sparse_classes_36k_train_015990
9,947
permissive
[ { "docstring": "存储商品浏览记录", "name": "post", "signature": "def post(self, request)" }, { "docstring": "用户中心展示浏览记录", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_016609
Implement the Python class `BrowseHistoriesView` described below. Class description: 需要用View, 否则非登录用户会转到登录界面 Method signatures and docstrings: - def post(self, request): 存储商品浏览记录 - def get(self, request): 用户中心展示浏览记录
Implement the Python class `BrowseHistoriesView` described below. Class description: 需要用View, 否则非登录用户会转到登录界面 Method signatures and docstrings: - def post(self, request): 存储商品浏览记录 - def get(self, request): 用户中心展示浏览记录 <|skeleton|> class BrowseHistoriesView: """需要用View, 否则非登录用户会转到登录界面""" def post(self, request...
50825e82aca3b82cd5354cd8a77d793cf32cfbcf
<|skeleton|> class BrowseHistoriesView: """需要用View, 否则非登录用户会转到登录界面""" def post(self, request): """存储商品浏览记录""" <|body_0|> def get(self, request): """用户中心展示浏览记录""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrowseHistoriesView: """需要用View, 否则非登录用户会转到登录界面""" def post(self, request): """存储商品浏览记录""" sku_id = json.loads(request.body.decode()).get('sku_id') try: sku = SKU.objects.get(id=sku_id) except SKU.DoesNotExist: return http.JsonResponse({'code': RETC...
the_stack_v2_python_sparse
meiduo/meiduo/apps/goods/views.py
Archer1314/MeiDuo_store
train
0
7e211fd2c0414dcfea889002ba45d2d8c6c78b07
[ "ret_data = []\ndb_query = DBSetting.extend()\nname = self.get_argument('name', None)\nif name is not None:\n db_query = db_query.filter(DBSetting.name == name)\ndb_type = self.get_argument('type', None)\nif db_type is not None:\n db_query = db_query.filter(DBSetting.db_type == db_type)\ndb_query = db_query.o...
<|body_start_0|> ret_data = [] db_query = DBSetting.extend() name = self.get_argument('name', None) if name is not None: db_query = db_query.filter(DBSetting.name == name) db_type = self.get_argument('type', None) if db_type is not None: db_query =...
DbSettingHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbSettingHandler: async def get(self, *args, **kwargs): """获取数据库配置列表数据""" <|body_0|> async def post(self, *args, **kwargs): """更新数据库配置数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret_data = [] db_query = DBSetting.extend() name...
stack_v2_sparse_classes_36k_train_015991
17,374
permissive
[ { "docstring": "获取数据库配置列表数据", "name": "get", "signature": "async def get(self, *args, **kwargs)" }, { "docstring": "更新数据库配置数据", "name": "post", "signature": "async def post(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_002825
Implement the Python class `DbSettingHandler` described below. Class description: Implement the DbSettingHandler class. Method signatures and docstrings: - async def get(self, *args, **kwargs): 获取数据库配置列表数据 - async def post(self, *args, **kwargs): 更新数据库配置数据
Implement the Python class `DbSettingHandler` described below. Class description: Implement the DbSettingHandler class. Method signatures and docstrings: - async def get(self, *args, **kwargs): 获取数据库配置列表数据 - async def post(self, *args, **kwargs): 更新数据库配置数据 <|skeleton|> class DbSettingHandler: async def get(self...
dc9b4c55f0b3ace180c30b7f080eb5d88bb38fdb
<|skeleton|> class DbSettingHandler: async def get(self, *args, **kwargs): """获取数据库配置列表数据""" <|body_0|> async def post(self, *args, **kwargs): """更新数据库配置数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DbSettingHandler: async def get(self, *args, **kwargs): """获取数据库配置列表数据""" ret_data = [] db_query = DBSetting.extend() name = self.get_argument('name', None) if name is not None: db_query = db_query.filter(DBSetting.name == name) db_type = self.get_ar...
the_stack_v2_python_sparse
apps/project/handlers.py
xiaoxiaolulu/MagicTestPlatform
train
5
5da86bad0e179c3b719e2cf27cb1d6af6bb9a69d
[ "current_user_banned_by = self.request.user.banned_by.values_list('user', flat=True)\nqueryset = super().get_queryset()\nqueryset = queryset.exclude(meeting__created_by__in=current_user_banned_by)\nis_visible = self.request.user.is_visible\nif is_visible:\n return queryset\nreturn queryset.meeting_points()", "...
<|body_start_0|> current_user_banned_by = self.request.user.banned_by.values_list('user', flat=True) queryset = super().get_queryset() queryset = queryset.exclude(meeting__created_by__in=current_user_banned_by) is_visible = self.request.user.is_visible if is_visible: ...
View for get all locations created for map.
LocationViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationViewSet: """View for get all locations created for map.""" def get_queryset(self): """Return queryset. This function returns queryset with all locations only for user with is_visible and also show meetings for the current user from users who didn't banned him.""" <|bo...
stack_v2_sparse_classes_36k_train_015992
6,239
no_license
[ { "docstring": "Return queryset. This function returns queryset with all locations only for user with is_visible and also show meetings for the current user from users who didn't banned him.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Create or update user ...
2
null
Implement the Python class `LocationViewSet` described below. Class description: View for get all locations created for map. Method signatures and docstrings: - def get_queryset(self): Return queryset. This function returns queryset with all locations only for user with is_visible and also show meetings for the curre...
Implement the Python class `LocationViewSet` described below. Class description: View for get all locations created for map. Method signatures and docstrings: - def get_queryset(self): Return queryset. This function returns queryset with all locations only for user with is_visible and also show meetings for the curre...
0879ade24685b628624dce06698f8a0afd042000
<|skeleton|> class LocationViewSet: """View for get all locations created for map.""" def get_queryset(self): """Return queryset. This function returns queryset with all locations only for user with is_visible and also show meetings for the current user from users who didn't banned him.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocationViewSet: """View for get all locations created for map.""" def get_queryset(self): """Return queryset. This function returns queryset with all locations only for user with is_visible and also show meetings for the current user from users who didn't banned him.""" current_user_bann...
the_stack_v2_python_sparse
camp-python-2021-find-me-develop/apps/map/api/views.py
rhanmar/oi_projects_summer_2021
train
0
4b5138967c1399153a6017b312fffa391e733bdc
[ "cycletime = '20171122T0100Z'\ndt = datetime(2017, 11, 22, 1, 0)\nresult = cycletime_to_datetime(cycletime)\nself.assertIsInstance(result, datetime)\nself.assertEqual(result, dt)", "cycletime = '201711220100'\ndt = datetime(2017, 11, 22, 1, 0)\nresult = cycletime_to_datetime(cycletime, cycletime_format='%Y%m%d%H%...
<|body_start_0|> cycletime = '20171122T0100Z' dt = datetime(2017, 11, 22, 1, 0) result = cycletime_to_datetime(cycletime) self.assertIsInstance(result, datetime) self.assertEqual(result, dt) <|end_body_0|> <|body_start_1|> cycletime = '201711220100' dt = datetime...
Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a datetime object.
Test_cycletime_to_datetime
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_cycletime_to_datetime: """Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a datetime object.""" def test_basic(self): """Test that a datetime object is returned of the expected value.""" <|body_0|> def test_define_cycletime_format(self): ...
stack_v2_sparse_classes_36k_train_015993
19,622
permissive
[ { "docstring": "Test that a datetime object is returned of the expected value.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test when a cycletime is defined.", "name": "test_define_cycletime_format", "signature": "def test_define_cycletime_format(self)" ...
2
null
Implement the Python class `Test_cycletime_to_datetime` described below. Class description: Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a datetime object. Method signatures and docstrings: - def test_basic(self): Test that a datetime object is returned of the expected value. - def test_...
Implement the Python class `Test_cycletime_to_datetime` described below. Class description: Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a datetime object. Method signatures and docstrings: - def test_basic(self): Test that a datetime object is returned of the expected value. - def test_...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_cycletime_to_datetime: """Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a datetime object.""" def test_basic(self): """Test that a datetime object is returned of the expected value.""" <|body_0|> def test_define_cycletime_format(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_cycletime_to_datetime: """Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a datetime object.""" def test_basic(self): """Test that a datetime object is returned of the expected value.""" cycletime = '20171122T0100Z' dt = datetime(2017, 11, 22, 1, 0)...
the_stack_v2_python_sparse
improver_tests/utilities/temporal/test_temporal.py
metoppv/improver
train
101
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTriggerDistanceToNextIntersection, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._distance = distance\nself._map = CarlaDataProvider.get_map()\nwaypoint = self._map.get_waypoint(self._actor.get_location())\nwhile waypoint and (not waypoint.is_...
<|body_start_0|> super(InTriggerDistanceToNextIntersection, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._distance = distance self._map = CarlaDataProvider.get_map() waypoint = self._map.get_waypoint(self._acto...
This class contains the trigger (condition) for a distance to the next intersection of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - distance: Trigger distance between the actor and the next intersection in meters The condition terminates with SUCCESS, whe...
InTriggerDistanceToNextIntersection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerDistanceToNextIntersection: """This class contains the trigger (condition) for a distance to the next intersection of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - distance: Trigger distance between the actor and the next in...
stack_v2_sparse_classes_36k_train_015994
18,494
permissive
[ { "docstring": "Setup trigger distance", "name": "__init__", "signature": "def __init__(self, actor, distance, name='InTriggerDistanceToNextIntersection')" }, { "docstring": "Check if the actor is within trigger distance to the intersection", "name": "update", "signature": "def update(se...
2
stack_v2_sparse_classes_30k_train_004670
Implement the Python class `InTriggerDistanceToNextIntersection` described below. Class description: This class contains the trigger (condition) for a distance to the next intersection of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - distance: Trigger dis...
Implement the Python class `InTriggerDistanceToNextIntersection` described below. Class description: This class contains the trigger (condition) for a distance to the next intersection of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - distance: Trigger dis...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTriggerDistanceToNextIntersection: """This class contains the trigger (condition) for a distance to the next intersection of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - distance: Trigger distance between the actor and the next in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InTriggerDistanceToNextIntersection: """This class contains the trigger (condition) for a distance to the next intersection of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - distance: Trigger distance between the actor and the next intersection in...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
d2220e089bad569adfbfb020344c9badbd03bdae
[ "super(LocalFilesystemCopy, self).__init__(state, name=name, critical=critical)\nself._target_directory = str()\nself._compress = False", "self._compress = compress\nif not target_directory:\n self._target_directory = tempfile.mkdtemp(prefix='dftimewolf_local_fs')\nelse:\n self._target_directory = target_di...
<|body_start_0|> super(LocalFilesystemCopy, self).__init__(state, name=name, critical=critical) self._target_directory = str() self._compress = False <|end_body_0|> <|body_start_1|> self._compress = compress if not target_directory: self._target_directory = tempfile....
Copies the files in the previous module's output to a given path. input: List of paths to copy the files from. output: The directory in which the files have been copied.
LocalFilesystemCopy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalFilesystemCopy: """Copies the files in the previous module's output to a given path. input: List of paths to copy the files from. output: The directory in which the files have been copied.""" def __init__(self, state: DFTimewolfState, name: Optional[str]=None, critical: bool=False) -> N...
stack_v2_sparse_classes_36k_train_015995
4,005
permissive
[ { "docstring": "Initializes a local file system exporter module.", "name": "__init__", "signature": "def __init__(self, state: DFTimewolfState, name: Optional[str]=None, critical: bool=False) -> None" }, { "docstring": "Sets up the _target_directory attribute. Args: target_directory (Optional[st...
4
stack_v2_sparse_classes_30k_train_006094
Implement the Python class `LocalFilesystemCopy` described below. Class description: Copies the files in the previous module's output to a given path. input: List of paths to copy the files from. output: The directory in which the files have been copied. Method signatures and docstrings: - def __init__(self, state: D...
Implement the Python class `LocalFilesystemCopy` described below. Class description: Copies the files in the previous module's output to a given path. input: List of paths to copy the files from. output: The directory in which the files have been copied. Method signatures and docstrings: - def __init__(self, state: D...
bcea85b1ce7a0feb2aa28b5be4fc6ae124e8ca3c
<|skeleton|> class LocalFilesystemCopy: """Copies the files in the previous module's output to a given path. input: List of paths to copy the files from. output: The directory in which the files have been copied.""" def __init__(self, state: DFTimewolfState, name: Optional[str]=None, critical: bool=False) -> N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocalFilesystemCopy: """Copies the files in the previous module's output to a given path. input: List of paths to copy the files from. output: The directory in which the files have been copied.""" def __init__(self, state: DFTimewolfState, name: Optional[str]=None, critical: bool=False) -> None: ...
the_stack_v2_python_sparse
dftimewolf/lib/exporters/local_filesystem.py
log2timeline/dftimewolf
train
248
0f4c485eb4324fd63468979bf018562474699973
[ "if target == 'html':\n return f'<a href=\"{link}\">{description}</a>'\nelif target == 'md':\n return f'[{description}]({link})'\nelse:\n raise ValueError(f'Can only template links to `html` or `md`, got `{target}`')", "link_format = request.query_params.get('link_format', 'md')\nif link_format not in ('...
<|body_start_0|> if target == 'html': return f'<a href="{link}">{description}</a>' elif target == 'md': return f'[{description}]({link})' else: raise ValueError(f'Can only template links to `html` or `md`, got `{target}`') <|end_body_0|> <|body_start_1|> ...
Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["Take your medicine.", ["medicine", "he...
RulesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RulesView: """Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["T...
stack_v2_sparse_classes_36k_train_015996
7,527
permissive
[ { "docstring": "Build the markup for rendering the link. This will render `link` with `description` as its description in the given `target` language. Arguments: description (str): A textual description of the string. Represents the content between the `<a>` tags in HTML, or the content between the array bracke...
2
stack_v2_sparse_classes_30k_train_005702
Implement the Python class `RulesView` described below. Class description: Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wak...
Implement the Python class `RulesView` described below. Class description: Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wak...
cb6326cabee6570a5725702cb2893ae39f752279
<|skeleton|> class RulesView: """Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RulesView: """Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["Take your medi...
the_stack_v2_python_sparse
pydis_site/apps/api/views.py
python-discord/site
train
746
01ec29067a90c0a318f9f636df059870beb91fd1
[ "n = len(nums)\ndp = [0 for _ in range(n + 1)]\ndp[1] = nums[0]\nfor i in range(2, n + 1):\n dp[i] = max(nums[i - 1] + dp[i - 2], dp[i - 1])\nreturn dp[n]", "dp1 = 0\ndp2 = nums[0]\nfor i in range(1, len(nums)):\n dp2, dp1 = (max(dp2, dp1 + nums[i]), dp2)\nreturn dp2" ]
<|body_start_0|> n = len(nums) dp = [0 for _ in range(n + 1)] dp[1] = nums[0] for i in range(2, n + 1): dp[i] = max(nums[i - 1] + dp[i - 2], dp[i - 1]) return dp[n] <|end_body_0|> <|body_start_1|> dp1 = 0 dp2 = nums[0] for i in range(1, len(nu...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob2(self, nums: List[int]) -> int: """68 / 68 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.3 MB :param nums: :return:""" <|body_0|> def rob(self, nums: List[int]) -> int: """Update: 04/20/2022 11:28 Runtime: 40 ms, faster than 61...
stack_v2_sparse_classes_36k_train_015997
2,093
permissive
[ { "docstring": "68 / 68 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.3 MB :param nums: :return:", "name": "rob2", "signature": "def rob2(self, nums: List[int]) -> int" }, { "docstring": "Update: 04/20/2022 11:28 Runtime: 40 ms, faster than 61.84% Memory Usage: 13.9 MB, les...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob2(self, nums: List[int]) -> int: 68 / 68 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.3 MB :param nums: :return: - def rob(self, nums: List[int]) ->...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob2(self, nums: List[int]) -> int: 68 / 68 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.3 MB :param nums: :return: - def rob(self, nums: List[int]) ->...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def rob2(self, nums: List[int]) -> int: """68 / 68 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.3 MB :param nums: :return:""" <|body_0|> def rob(self, nums: List[int]) -> int: """Update: 04/20/2022 11:28 Runtime: 40 ms, faster than 61...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob2(self, nums: List[int]) -> int: """68 / 68 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.3 MB :param nums: :return:""" n = len(nums) dp = [0 for _ in range(n + 1)] dp[1] = nums[0] for i in range(2, n + 1): dp[i] = max(...
the_stack_v2_python_sparse
src/198-HouseRobber.py
Jiezhi/myleetcode
train
1
57fa4f3a76e0045cd9b2a32fc61b7df1f2f52ffc
[ "self.detect_key = self.get_detect_key(argv)\nself.exit_code = exit_code\nself.file = history_file if history_file else _META_FILE\nself.history = self.get_history()\nself.caught_result = self.detect_bug_caught()\nself.update_history()", "argv_without_option = [x for x in argv if x not in _DETECT_OPTION_FILTER]\n...
<|body_start_0|> self.detect_key = self.get_detect_key(argv) self.exit_code = exit_code self.file = history_file if history_file else _META_FILE self.history = self.get_history() self.caught_result = self.detect_bug_caught() self.update_history() <|end_body_0|> <|body_st...
Class for handling if a bug is detected by comparing test history.
BugDetector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BugDetector: """Class for handling if a bug is detected by comparing test history.""" def __init__(self, argv, exit_code, history_file=None): """BugDetector constructor Args: argv: A list of arguments. exit_code: An integer of exit code. history_file: A string of a given history file...
stack_v2_sparse_classes_36k_train_015998
4,691
no_license
[ { "docstring": "BugDetector constructor Args: argv: A list of arguments. exit_code: An integer of exit code. history_file: A string of a given history file path.", "name": "__init__", "signature": "def __init__(self, argv, exit_code, history_file=None)" }, { "docstring": "Get the key for history...
5
stack_v2_sparse_classes_30k_train_011093
Implement the Python class `BugDetector` described below. Class description: Class for handling if a bug is detected by comparing test history. Method signatures and docstrings: - def __init__(self, argv, exit_code, history_file=None): BugDetector constructor Args: argv: A list of arguments. exit_code: An integer of ...
Implement the Python class `BugDetector` described below. Class description: Class for handling if a bug is detected by comparing test history. Method signatures and docstrings: - def __init__(self, argv, exit_code, history_file=None): BugDetector constructor Args: argv: A list of arguments. exit_code: An integer of ...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class BugDetector: """Class for handling if a bug is detected by comparing test history.""" def __init__(self, argv, exit_code, history_file=None): """BugDetector constructor Args: argv: A list of arguments. exit_code: An integer of exit code. history_file: A string of a given history file...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BugDetector: """Class for handling if a bug is detected by comparing test history.""" def __init__(self, argv, exit_code, history_file=None): """BugDetector constructor Args: argv: A list of arguments. exit_code: An integer of exit code. history_file: A string of a given history file path.""" ...
the_stack_v2_python_sparse
tools/asuite/atest/bug_detector.py
ZYHGOD-1/Aosp11
train
0
ba75d90170c49681434242c1a4c113e4960506ee
[ "user = get_a_users_app(id)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn get_a_users_app(data=data)", "user = complete_users_app(id)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn complete_users_app(data=data)", "user = delete_use...
<|body_start_0|> user = get_a_users_app(id) if not user: api.abort(404) else: return user data = request.json return get_a_users_app(data=data) <|end_body_0|> <|body_start_1|> user = complete_users_app(id) if not user: api.abor...
Users_app
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Users_app: def get(self, id): """get a users_app given its identifier""" <|body_0|> def put(self, id): """users_app Updated""" <|body_1|> def delete(self, id): """users_app Deleted""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_015999
2,662
no_license
[ { "docstring": "get a users_app given its identifier", "name": "get", "signature": "def get(self, id)" }, { "docstring": "users_app Updated", "name": "put", "signature": "def put(self, id)" }, { "docstring": "users_app Deleted", "name": "delete", "signature": "def delete(...
3
null
Implement the Python class `Users_app` described below. Class description: Implement the Users_app class. Method signatures and docstrings: - def get(self, id): get a users_app given its identifier - def put(self, id): users_app Updated - def delete(self, id): users_app Deleted
Implement the Python class `Users_app` described below. Class description: Implement the Users_app class. Method signatures and docstrings: - def get(self, id): get a users_app given its identifier - def put(self, id): users_app Updated - def delete(self, id): users_app Deleted <|skeleton|> class Users_app: def...
4fa4042304ee01cf23ecc81f9c27977fd12c31b9
<|skeleton|> class Users_app: def get(self, id): """get a users_app given its identifier""" <|body_0|> def put(self, id): """users_app Updated""" <|body_1|> def delete(self, id): """users_app Deleted""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Users_app: def get(self, id): """get a users_app given its identifier""" user = get_a_users_app(id) if not user: api.abort(404) else: return user data = request.json return get_a_users_app(data=data) def put(self, id): """use...
the_stack_v2_python_sparse
main/controller/users_app_controller.py
Gauravkumar45/Flask-RESTPlus-API
train
0