blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
44cbef43a60810286d2b96efeb3d660c13200f68
[ "count = 0\nfor x in data:\n if count == 0:\n if x >> 5 == 6:\n count = 1\n elif x >> 4 == 14:\n count = 2\n elif x >> 3 == 30:\n count = 3\n elif x >> 7 == 1:\n return False\n else:\n if x >> 6 != 2:\n return False\n ...
<|body_start_0|> count = 0 for x in data: if count == 0: if x >> 5 == 6: count = 1 elif x >> 4 == 14: count = 2 elif x >> 3 == 30: count = 3 elif x >> 7 == 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def validUtf8_2(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> count = 0 for x in data: ...
stack_v2_sparse_classes_75kplus_train_072800
4,568
no_license
[ { "docstring": ":type data: List[int] :rtype: bool", "name": "validUtf8", "signature": "def validUtf8(self, data)" }, { "docstring": ":type data: List[int] :rtype: bool", "name": "validUtf8_2", "signature": "def validUtf8_2(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_021884
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def validUtf8_2(self, data): :type data: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def validUtf8_2(self, data): :type data: List[int] :rtype: bool <|skeleton|> class Solution: def validUtf8(s...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def validUtf8_2(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" count = 0 for x in data: if count == 0: if x >> 5 == 6: count = 1 elif x >> 4 == 14: count = 2 elif x >> 3 =...
the_stack_v2_python_sparse
code393UTF-8Validation.py
cybelewang/leetcode-python
train
0
c8f473163be1faf17479ce07946458e01c796f5c
[ "self.path_to_triage_model = path_to_triage_model\npath_to_filters = change_extension(path_to_triage_model, 'yaml')\nself.filters_dict = load_yaml(path_to_filters)\nR1 = self.filters_dict['size']\nK1, K2 = self.filters_dict['filters']\nC = self.filters_dict['n_neighbors']\nself.W1 = weight_variable([R1, 1, 1, K1])\...
<|body_start_0|> self.path_to_triage_model = path_to_triage_model path_to_filters = change_extension(path_to_triage_model, 'yaml') self.filters_dict = load_yaml(path_to_filters) R1 = self.filters_dict['size'] K1, K2 = self.filters_dict['filters'] C = self.filters_dict['n_...
Class for training and running convolutional neural network detector for spike detection and autoencoder for feature extraction. Attributes: ----------- config: configuration object configuration object containing the training parameters. C: int spatial filter size of the spatial convolutional layer. R: int temporal fi...
NeuralNetTriage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeuralNetTriage: """Class for training and running convolutional neural network detector for spike detection and autoencoder for feature extraction. Attributes: ----------- config: configuration object configuration object containing the training parameters. C: int spatial filter size of the spat...
stack_v2_sparse_classes_75kplus_train_072801
4,428
permissive
[ { "docstring": "Initializes the attributes for the class NeuralNetDetector. Parameters: ----------- config: configuration file", "name": "__init__", "signature": "def __init__(self, path_to_triage_model)" }, { "docstring": "Detects and indexes spikes from the recording. The recording will be cho...
2
stack_v2_sparse_classes_30k_train_033980
Implement the Python class `NeuralNetTriage` described below. Class description: Class for training and running convolutional neural network detector for spike detection and autoencoder for feature extraction. Attributes: ----------- config: configuration object configuration object containing the training parameters....
Implement the Python class `NeuralNetTriage` described below. Class description: Class for training and running convolutional neural network detector for spike detection and autoencoder for feature extraction. Attributes: ----------- config: configuration object configuration object containing the training parameters....
96fa9a03028d37f0291a4c2a3d9b16b18ee8a539
<|skeleton|> class NeuralNetTriage: """Class for training and running convolutional neural network detector for spike detection and autoencoder for feature extraction. Attributes: ----------- config: configuration object configuration object containing the training parameters. C: int spatial filter size of the spat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NeuralNetTriage: """Class for training and running convolutional neural network detector for spike detection and autoencoder for feature extraction. Attributes: ----------- config: configuration object configuration object containing the training parameters. C: int spatial filter size of the spatial convoluti...
the_stack_v2_python_sparse
src/yass/neuralnetwork/nntriage.py
hooshmandshr/yass
train
0
60bd669028818aeb02e9aaa5b251cc7581d7c83b
[ "if self.config.fallbackValueType != 'USER':\n assert mi, 'No maskedImage provided'\nif self.config.fallbackValueType == 'MEAN':\n fallbackValue = afwMath.makeStatistics(mi, afwMath.MEAN).getValue()\nelif self.config.fallbackValueType == 'MEDIAN':\n fallbackValue = afwMath.makeStatistics(mi, afwMath.MEDIAN...
<|body_start_0|> if self.config.fallbackValueType != 'USER': assert mi, 'No maskedImage provided' if self.config.fallbackValueType == 'MEAN': fallbackValue = afwMath.makeStatistics(mi, afwMath.MEAN).getValue() elif self.config.fallbackValueType == 'MEDIAN': fa...
Interpolate over bad image pixels
InterpImageTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterpImageTask: """Interpolate over bad image pixels""" def _setFallbackValue(self, mi=None): """Set the edge fallbackValue for interpolation \\param[in] mi input maksedImage on which to calculate the statistics Must be provided if fallbackValueType != "USER". eturn fallbackValue Th...
stack_v2_sparse_classes_75kplus_train_072802
7,890
no_license
[ { "docstring": "Set the edge fallbackValue for interpolation \\\\param[in] mi input maksedImage on which to calculate the statistics Must be provided if fallbackValueType != \"USER\". eturn fallbackValue The value set/computed based on the fallbackValueType and negativeFallbackAllowed config parameters", "n...
2
null
Implement the Python class `InterpImageTask` described below. Class description: Interpolate over bad image pixels Method signatures and docstrings: - def _setFallbackValue(self, mi=None): Set the edge fallbackValue for interpolation \\param[in] mi input maksedImage on which to calculate the statistics Must be provid...
Implement the Python class `InterpImageTask` described below. Class description: Interpolate over bad image pixels Method signatures and docstrings: - def _setFallbackValue(self, mi=None): Set the edge fallbackValue for interpolation \\param[in] mi input maksedImage on which to calculate the statistics Must be provid...
4aa99acb1adbd868263f7b465f8619ae343f197e
<|skeleton|> class InterpImageTask: """Interpolate over bad image pixels""" def _setFallbackValue(self, mi=None): """Set the edge fallbackValue for interpolation \\param[in] mi input maksedImage on which to calculate the statistics Must be provided if fallbackValueType != "USER". eturn fallbackValue Th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InterpImageTask: """Interpolate over bad image pixels""" def _setFallbackValue(self, mi=None): """Set the edge fallbackValue for interpolation \\param[in] mi input maksedImage on which to calculate the statistics Must be provided if fallbackValueType != "USER". eturn fallbackValue The value set/c...
the_stack_v2_python_sparse
python/lsst/pipe/tasks/interpImage.py
DominiqueFouchez/pipe_tasks
train
0
0cf9da5f06ac240af10829f5c53aa2d06461477c
[ "try:\n logger.info('在会议中成功添加一个在线的听课')\n self.login()\n self.create_teaching_meeting('')\n sleep(2)\n self.addlistener(readconfig.Attendant1)\n sleep(8)\n self.assertEqual(self.get_usernum(), 2)\n self.assertTrue(self.judge_Success_added())\nexcept Exception as msg:\n logger.error(u'异常原因:...
<|body_start_0|> try: logger.info('在会议中成功添加一个在线的听课') self.login() self.create_teaching_meeting('') sleep(2) self.addlistener(readconfig.Attendant1) sleep(8) self.assertEqual(self.get_usernum(), 2) self.assertTrue(sel...
授课模式会议的测试
IterTeachingTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IterTeachingTest: """授课模式会议的测试""" def test1_online_addlistener(self): """在会议中成功添加一个在在线的听课""" <|body_0|> def test2_offline_addlistener(self): """在会议中添加一个不在线的听课""" <|body_1|> def test3_remove_listener(self): """移除听课的测试""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_072803
3,521
no_license
[ { "docstring": "在会议中成功添加一个在在线的听课", "name": "test1_online_addlistener", "signature": "def test1_online_addlistener(self)" }, { "docstring": "在会议中添加一个不在线的听课", "name": "test2_offline_addlistener", "signature": "def test2_offline_addlistener(self)" }, { "docstring": "移除听课的测试", "n...
4
null
Implement the Python class `IterTeachingTest` described below. Class description: 授课模式会议的测试 Method signatures and docstrings: - def test1_online_addlistener(self): 在会议中成功添加一个在在线的听课 - def test2_offline_addlistener(self): 在会议中添加一个不在线的听课 - def test3_remove_listener(self): 移除听课的测试 - def test4_del_listener(self): 删除在线的听课的...
Implement the Python class `IterTeachingTest` described below. Class description: 授课模式会议的测试 Method signatures and docstrings: - def test1_online_addlistener(self): 在会议中成功添加一个在在线的听课 - def test2_offline_addlistener(self): 在会议中添加一个不在线的听课 - def test3_remove_listener(self): 移除听课的测试 - def test4_del_listener(self): 删除在线的听课的...
fd552eeb47fd4838c2c5caef4deea7480ab75ce9
<|skeleton|> class IterTeachingTest: """授课模式会议的测试""" def test1_online_addlistener(self): """在会议中成功添加一个在在线的听课""" <|body_0|> def test2_offline_addlistener(self): """在会议中添加一个不在线的听课""" <|body_1|> def test3_remove_listener(self): """移除听课的测试""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IterTeachingTest: """授课模式会议的测试""" def test1_online_addlistener(self): """在会议中成功添加一个在在线的听课""" try: logger.info('在会议中成功添加一个在线的听课') self.login() self.create_teaching_meeting('') sleep(2) self.addlistener(readconfig.Attendant1) ...
the_stack_v2_python_sparse
test_case/B014_interaction_teaching_test.py
luhuifnag/AVA_UIauto_test
train
0
3d80d4ee880c3e6e256ea4694b3363fa19c1191a
[ "friender = Profile.objects.get(user_id=request.user.id)\nfriendee = Profile.objects.get(user_id=request.data['friendee'])\nrelationship = Relationship.objects.create(friender=friender, friendee=friendee, status=request.data['status'])\nserializer = RelationshipSerializer(relationship, context={'request': request})...
<|body_start_0|> friender = Profile.objects.get(user_id=request.user.id) friendee = Profile.objects.get(user_id=request.data['friendee']) relationship = Relationship.objects.create(friender=friender, friendee=friendee, status=request.data['status']) serializer = RelationshipSerializer(re...
Relationships
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Relationships: def create(self, request): """Handle POST request for a comment Returns: JSON serialized comment instance""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for single comment Returns: JSON serialized comment instance""" ...
stack_v2_sparse_classes_75kplus_train_072804
3,251
no_license
[ { "docstring": "Handle POST request for a comment Returns: JSON serialized comment instance", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Handle GET requests for single comment Returns: JSON serialized comment instance", "name": "retrieve", "signature": ...
5
stack_v2_sparse_classes_30k_train_045443
Implement the Python class `Relationships` described below. Class description: Implement the Relationships class. Method signatures and docstrings: - def create(self, request): Handle POST request for a comment Returns: JSON serialized comment instance - def retrieve(self, request, pk=None): Handle GET requests for s...
Implement the Python class `Relationships` described below. Class description: Implement the Relationships class. Method signatures and docstrings: - def create(self, request): Handle POST request for a comment Returns: JSON serialized comment instance - def retrieve(self, request, pk=None): Handle GET requests for s...
56a0c25108f6b6c1b7fe68a16a109209d82eed00
<|skeleton|> class Relationships: def create(self, request): """Handle POST request for a comment Returns: JSON serialized comment instance""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for single comment Returns: JSON serialized comment instance""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Relationships: def create(self, request): """Handle POST request for a comment Returns: JSON serialized comment instance""" friender = Profile.objects.get(user_id=request.user.id) friendee = Profile.objects.get(user_id=request.data['friendee']) relationship = Relationship.objec...
the_stack_v2_python_sparse
cleverlyapi/views/relationship.py
danny128373/Cleverly-API-side
train
0
1fd19d705a88a00a92178287290f6b596390877e
[ "super(PointerNet, self).__init__()\nself.embedding_dim = embedding_dim\nself.bidir = bidir\nself.embedding = nn.Linear(2, embedding_dim)\nself.encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir)\nself.decoder = Decoder(embedding_dim, hidden_dim)\nself.decoder_input0 = Parameter(torch.FloatTen...
<|body_start_0|> super(PointerNet, self).__init__() self.embedding_dim = embedding_dim self.bidir = bidir self.embedding = nn.Linear(2, embedding_dim) self.encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir) self.decoder = Decoder(embedding_dim, hidd...
Pointer-Net
PointerNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointerNet: """Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LST...
stack_v2_sparse_classes_75kplus_train_072805
10,835
permissive
[ { "docstring": "Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LSTMs :param float dropout: Float between 0-1 :param bool bidir: Bidirectional", "name": "__init__", "signature": "def __i...
2
null
Implement the Python class `PointerNet` described below. Class description: Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidd...
Implement the Python class `PointerNet` described below. Class description: Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidd...
99cba1030ed8c012a453bc7715830fc99fb980dc
<|skeleton|> class PointerNet: """Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LST...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PointerNet: """Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LSTMs :param flo...
the_stack_v2_python_sparse
models/networks/recurrent/pointer.py
jamesoneill12/LayerFusion
train
2
e612a9431dc0052f2269acc6a46d67041eb602ff
[ "super(ReferenceTransformationDataset, self).__init__(dim, datasources, data_generators, data_generator_sources, iterator, all_generators_post_processing, debug_image_folder, debug_image_type)\nself.reference_datasource_keys = reference_datasource_keys\nself.reference_transformation = reference_transformation\nself...
<|body_start_0|> super(ReferenceTransformationDataset, self).__init__(dim, datasources, data_generators, data_generator_sources, iterator, all_generators_post_processing, debug_image_folder, debug_image_type) self.reference_datasource_keys = reference_datasource_keys self.reference_transformatio...
Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/localization tasks, where the generated outputs must have t...
ReferenceTransformationDataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReferenceTransformationDataset: """Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/l...
stack_v2_sparse_classes_75kplus_train_072806
7,259
no_license
[ { "docstring": "Initializer. Example: reference_datasource_keys = {'image': 'image_datasource'} data_sources = {'image_datasource': ImageDataSource(...), 'segmentation_datasource': ImageDataSource(...)} data_generators = {'image_generator': ImageGenerator(...), 'segmentation_generator': ImageGenerator(...)} dat...
3
stack_v2_sparse_classes_30k_train_021473
Implement the Python class `ReferenceTransformationDataset` described below. Class description: Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. ...
Implement the Python class `ReferenceTransformationDataset` described below. Class description: Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. ...
ef6cee91264ba1fe6b40d9823a07647b95bcc2c4
<|skeleton|> class ReferenceTransformationDataset: """Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReferenceTransformationDataset: """Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/localization t...
the_stack_v2_python_sparse
datasets/reference_image_transformation_dataset.py
XiaoweiXu/MedicalDataAugmentationTool
train
1
24de685695a38fe580ff96bbc2b7326f3a706915
[ "self.cloud_vtk_points = vtk.vtkPoints()\nself.cloud_vtk_polydata = vtk.vtkPolyData()\nself.cloud_octree = vtk.vtkOctreePointLocator()\nself.cloud_color = vtk.vtkUnsignedCharArray()\nself.cloud_actor = vtk.vtkActor()\nself.v_filter = vtk.vtkVertexGlyphFilter()\nself.mapper = vtk.vtkPolyDataMapper()", "self.np_clo...
<|body_start_0|> self.cloud_vtk_points = vtk.vtkPoints() self.cloud_vtk_polydata = vtk.vtkPolyData() self.cloud_octree = vtk.vtkOctreePointLocator() self.cloud_color = vtk.vtkUnsignedCharArray() self.cloud_actor = vtk.vtkActor() self.v_filter = vtk.vtkVertexGlyphFilter() ...
Cloud
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cloud: def __init__(self): """初始化变量""" <|body_0|> def initialize_car(self, path): """载入点云数据""" <|body_1|> def build_car(self): """汽车点云染色""" <|body_2|> def color_points(self, cloud_clipped_points): """对被切割点染色""" <|body...
stack_v2_sparse_classes_75kplus_train_072807
4,869
no_license
[ { "docstring": "初始化变量", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "载入点云数据", "name": "initialize_car", "signature": "def initialize_car(self, path)" }, { "docstring": "汽车点云染色", "name": "build_car", "signature": "def build_car(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_001487
Implement the Python class `Cloud` described below. Class description: Implement the Cloud class. Method signatures and docstrings: - def __init__(self): 初始化变量 - def initialize_car(self, path): 载入点云数据 - def build_car(self): 汽车点云染色 - def color_points(self, cloud_clipped_points): 对被切割点染色
Implement the Python class `Cloud` described below. Class description: Implement the Cloud class. Method signatures and docstrings: - def __init__(self): 初始化变量 - def initialize_car(self, path): 载入点云数据 - def build_car(self): 汽车点云染色 - def color_points(self, cloud_clipped_points): 对被切割点染色 <|skeleton|> class Cloud: ...
2f18e869bcc2dfb118da69f02a5e231ff2602a68
<|skeleton|> class Cloud: def __init__(self): """初始化变量""" <|body_0|> def initialize_car(self, path): """载入点云数据""" <|body_1|> def build_car(self): """汽车点云染色""" <|body_2|> def color_points(self, cloud_clipped_points): """对被切割点染色""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Cloud: def __init__(self): """初始化变量""" self.cloud_vtk_points = vtk.vtkPoints() self.cloud_vtk_polydata = vtk.vtkPolyData() self.cloud_octree = vtk.vtkOctreePointLocator() self.cloud_color = vtk.vtkUnsignedCharArray() self.cloud_actor = vtk.vtkActor() sel...
the_stack_v2_python_sparse
wind_planes.py
baobaotang0/new_outline
train
0
3dc01d0aea014a13affd7c161978a87343a9ac3b
[ "matrix.reverse()\nfor i in range(len(matrix)):\n for j in range(i):\n matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j])", "for i in range(len(matrix)):\n for j in range(i):\n matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j])\nmatrix.reverse()" ]
<|body_start_0|> matrix.reverse() for i in range(len(matrix)): for j in range(i): matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j]) <|end_body_0|> <|body_start_1|> for i in range(len(matrix)): for j in range(i): matrix[i][j], matri...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """clockwise rotate * first reverse up to down, then swap the symmetry * 1 2 3 7 8 9 7 4 1 * 4 5 6 => 4 5 6 => 8 5 2 * 7 8 9 1 2 3 9 6 3""" <|body_0|> def anti_rotate(self, matrix: List[List[int]]) -> None: ...
stack_v2_sparse_classes_75kplus_train_072808
1,189
no_license
[ { "docstring": "clockwise rotate * first reverse up to down, then swap the symmetry * 1 2 3 7 8 9 7 4 1 * 4 5 6 => 4 5 6 => 8 5 2 * 7 8 9 1 2 3 9 6 3", "name": "rotate", "signature": "def rotate(self, matrix: List[List[int]]) -> None" }, { "docstring": "anti-clockwise rotate * first swap the sym...
2
stack_v2_sparse_classes_30k_train_017984
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: clockwise rotate * first reverse up to down, then swap the symmetry * 1 2 3 7 8 9 7 4 1 * 4 5 6 => 4 5 6 => 8 5 2 * 7 8 9 1 2 3...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: clockwise rotate * first reverse up to down, then swap the symmetry * 1 2 3 7 8 9 7 4 1 * 4 5 6 => 4 5 6 => 8 5 2 * 7 8 9 1 2 3...
73654b6567fdb282af84a868608929be234075c5
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """clockwise rotate * first reverse up to down, then swap the symmetry * 1 2 3 7 8 9 7 4 1 * 4 5 6 => 4 5 6 => 8 5 2 * 7 8 9 1 2 3 9 6 3""" <|body_0|> def anti_rotate(self, matrix: List[List[int]]) -> None: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """clockwise rotate * first reverse up to down, then swap the symmetry * 1 2 3 7 8 9 7 4 1 * 4 5 6 => 4 5 6 => 8 5 2 * 7 8 9 1 2 3 9 6 3""" matrix.reverse() for i in range(len(matrix)): for j in range(i): ...
the_stack_v2_python_sparse
LeetCode/0048-Rotate image/main.py
PRKKILLER/Algorithm_Practice
train
0
8bc3656021dd7152f460937bec6cd225d2611d69
[ "super(MixedParameterTests, self).setUp()\nself.p_On = [self.constructor(Name='d', Prefix='-', Value=True), self.constructor(Name='d', Prefix='-', Value=5), self.constructor(Name='d', Prefix='-', Value=[1]), self.constructor(Name='d', Prefix='-', Value=None), self.constructor(Name='d', Prefix='-', Value='F')]\nself...
<|body_start_0|> super(MixedParameterTests, self).setUp() self.p_On = [self.constructor(Name='d', Prefix='-', Value=True), self.constructor(Name='d', Prefix='-', Value=5), self.constructor(Name='d', Prefix='-', Value=[1]), self.constructor(Name='d', Prefix='-', Value=None), self.constructor(Name='d', Pr...
Tests of the MixedParameter class
MixedParameterTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixedParameterTests: """Tests of the MixedParameter class""" def setUp(self): """Setup some variables for the tests to use""" <|body_0|> def test_on(self): """Parameter: on functions as expected""" <|body_1|> def test_init_defaults(self): """...
stack_v2_sparse_classes_75kplus_train_072809
20,121
no_license
[ { "docstring": "Setup some variables for the tests to use", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Parameter: on functions as expected", "name": "test_on", "signature": "def test_on(self)" }, { "docstring": "MixedParameter: init functions as expected w...
4
stack_v2_sparse_classes_30k_train_001660
Implement the Python class `MixedParameterTests` described below. Class description: Tests of the MixedParameter class Method signatures and docstrings: - def setUp(self): Setup some variables for the tests to use - def test_on(self): Parameter: on functions as expected - def test_init_defaults(self): MixedParameter:...
Implement the Python class `MixedParameterTests` described below. Class description: Tests of the MixedParameter class Method signatures and docstrings: - def setUp(self): Setup some variables for the tests to use - def test_on(self): Parameter: on functions as expected - def test_init_defaults(self): MixedParameter:...
b49442bd793a743188a43809903dc140512420b7
<|skeleton|> class MixedParameterTests: """Tests of the MixedParameter class""" def setUp(self): """Setup some variables for the tests to use""" <|body_0|> def test_on(self): """Parameter: on functions as expected""" <|body_1|> def test_init_defaults(self): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MixedParameterTests: """Tests of the MixedParameter class""" def setUp(self): """Setup some variables for the tests to use""" super(MixedParameterTests, self).setUp() self.p_On = [self.constructor(Name='d', Prefix='-', Value=True), self.constructor(Name='d', Prefix='-', Value=5), ...
the_stack_v2_python_sparse
old_cogent_tests/app/test_parameters.py
pycogent/old-cogent
train
0
fceffbcc16bd4e996b7bdedc484e557466c23c61
[ "try:\n self.post_user = User.objects.prefetch_related('posts').get(username__iexact=self.kwargs.get('username'))\nexcept User.DoesNotExist:\n raise Http404\nelse:\n return self.post_user.posts.all()", "context = super().get_context_data(**kwargs)\ncontext['post_user'] = self.post_user\nreturn context" ]
<|body_start_0|> try: self.post_user = User.objects.prefetch_related('posts').get(username__iexact=self.kwargs.get('username')) except User.DoesNotExist: raise Http404 else: return self.post_user.posts.all() <|end_body_0|> <|body_start_1|> context = s...
return user posts list
UserPosts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPosts: """return user posts list""" def get_queryset(self): """find all user posts""" <|body_0|> def get_context_data(self, **kwargs): """return post list of the user""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: self.post...
stack_v2_sparse_classes_75kplus_train_072810
6,022
no_license
[ { "docstring": "find all user posts", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "return post list of the user", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_015655
Implement the Python class `UserPosts` described below. Class description: return user posts list Method signatures and docstrings: - def get_queryset(self): find all user posts - def get_context_data(self, **kwargs): return post list of the user
Implement the Python class `UserPosts` described below. Class description: return user posts list Method signatures and docstrings: - def get_queryset(self): find all user posts - def get_context_data(self, **kwargs): return post list of the user <|skeleton|> class UserPosts: """return user posts list""" de...
0e15551ce2ea89375a5c87e61a4702906f5cdbbe
<|skeleton|> class UserPosts: """return user posts list""" def get_queryset(self): """find all user posts""" <|body_0|> def get_context_data(self, **kwargs): """return post list of the user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserPosts: """return user posts list""" def get_queryset(self): """find all user posts""" try: self.post_user = User.objects.prefetch_related('posts').get(username__iexact=self.kwargs.get('username')) except User.DoesNotExist: raise Http404 else: ...
the_stack_v2_python_sparse
posts/views.py
ZivMalka/simplesocial
train
1
b086ff106deb5c7a92d5a32ff39423214fabfa86
[ "a0 = -4.1236\na1 = 13.788\na2 = -26.068\na3 = 26.272\na4 = -14.663\na5 = 4.4954\na6 = -0.6905\na7 = 0.0397\nlog_t = math.log10(temperature)\nf_exp = a0 + a1 * log_t + a2 * log_t ** 2.0 + a3 * log_t ** 3.0 + a4 * log_t ** 4.0 + a5 * log_t ** 5.0 + a6 * log_t ** 6.0 + a7 * log_t ** 7\ng10_thermal_conductivity = 10.0...
<|body_start_0|> a0 = -4.1236 a1 = 13.788 a2 = -26.068 a3 = 26.272 a4 = -14.663 a5 = 4.4954 a6 = -0.6905 a7 = 0.0397 log_t = math.log10(temperature) f_exp = a0 + a1 * log_t + a2 * log_t ** 2.0 + a3 * log_t ** 3.0 + a4 * log_t ** 4.0 + a5 * ...
G10NISTMaterialProperties
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class G10NISTMaterialProperties: def thermal_conductivity(temperature): """Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float""" <|body_0|> def volumetric_heat_capacity(temperature): ...
stack_v2_sparse_classes_75kplus_train_072811
1,623
no_license
[ { "docstring": "Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float", "name": "thermal_conductivity", "signature": "def thermal_conductivity(temperature)" }, { "docstring": "Calculates volumetric heat ...
2
stack_v2_sparse_classes_30k_train_023022
Implement the Python class `G10NISTMaterialProperties` described below. Class description: Implement the G10NISTMaterialProperties class. Method signatures and docstrings: - def thermal_conductivity(temperature): Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as flo...
Implement the Python class `G10NISTMaterialProperties` described below. Class description: Implement the G10NISTMaterialProperties class. Method signatures and docstrings: - def thermal_conductivity(temperature): Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as flo...
3872a62c01b6d0f7dca97042bbd26b95a2ecc952
<|skeleton|> class G10NISTMaterialProperties: def thermal_conductivity(temperature): """Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float""" <|body_0|> def volumetric_heat_capacity(temperature): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class G10NISTMaterialProperties: def thermal_conductivity(temperature): """Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float""" a0 = -4.1236 a1 = 13.788 a2 = -26.068 a3 = 26.272 ...
the_stack_v2_python_sparse
source/materials/g10_nist_material_properties.py
MichalWilczek/steam-ansys-modelling
train
1
02f96e1cb4ede0523cbd4caeaee70ff158f5ff13
[ "fig = go.Figure(data=go.Scatter(x=kwargs['x'], y=kwargs['y'], mode='markers'))\nfig.update_layout(title=kwargs['title'], xaxis_title='x Axis', yaxis_title='y Axis', font=dict(family='Courier New, monospace', size=15))\nfig.write_image('images/fig1.png')\nfig.show()", "point = 100\nrandom_x = np.linspace(0, 1, po...
<|body_start_0|> fig = go.Figure(data=go.Scatter(x=kwargs['x'], y=kwargs['y'], mode='markers')) fig.update_layout(title=kwargs['title'], xaxis_title='x Axis', yaxis_title='y Axis', font=dict(family='Courier New, monospace', size=15)) fig.write_image('images/fig1.png') fig.show() <|end_bo...
programPlotly
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class programPlotly: def scatter_plot(self, **kwargs): """Draw a scatter plot""" <|body_0|> def line_plot(self): """Draw line and scatter plots for random 100 x and y coordinates""" <|body_1|> def style_scatter(self): """Draw a scatter plot for random ...
stack_v2_sparse_classes_75kplus_train_072812
4,448
no_license
[ { "docstring": "Draw a scatter plot", "name": "scatter_plot", "signature": "def scatter_plot(self, **kwargs)" }, { "docstring": "Draw line and scatter plots for random 100 x and y coordinates", "name": "line_plot", "signature": "def line_plot(self)" }, { "docstring": "Draw a scat...
4
null
Implement the Python class `programPlotly` described below. Class description: Implement the programPlotly class. Method signatures and docstrings: - def scatter_plot(self, **kwargs): Draw a scatter plot - def line_plot(self): Draw line and scatter plots for random 100 x and y coordinates - def style_scatter(self): D...
Implement the Python class `programPlotly` described below. Class description: Implement the programPlotly class. Method signatures and docstrings: - def scatter_plot(self, **kwargs): Draw a scatter plot - def line_plot(self): Draw line and scatter plots for random 100 x and y coordinates - def style_scatter(self): D...
9a137436df58ff4d32c36e58f6b67679346167b9
<|skeleton|> class programPlotly: def scatter_plot(self, **kwargs): """Draw a scatter plot""" <|body_0|> def line_plot(self): """Draw line and scatter plots for random 100 x and y coordinates""" <|body_1|> def style_scatter(self): """Draw a scatter plot for random ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class programPlotly: def scatter_plot(self, **kwargs): """Draw a scatter plot""" fig = go.Figure(data=go.Scatter(x=kwargs['x'], y=kwargs['y'], mode='markers')) fig.update_layout(title=kwargs['title'], xaxis_title='x Axis', yaxis_title='y Axis', font=dict(family='Courier New, monospace', size...
the_stack_v2_python_sparse
Plotly/plotlyScatter.py
shivamgupta7/python-program
train
0
c8025e3a7b36a3db6b8255e16159a2f4c3f33bd2
[ "self.__lang = lang\nself.__speech = speech\nif dict_replace is not None:\n self.__repl = dict_replace\nelse:\n self.__repl = sppasDictRepl(None)", "y = u(utt)\ntmp = ' '.join(y)\nsstr = re.sub(u('([0-90-9a-zA-ZA-T\\\\s]+\\\\.?[0-90-9a-zA-ZA-T\\\\s]+)'), lambda o: u(' %s ' % o.group(0).replace(' ', '')), tm...
<|body_start_0|> self.__lang = lang self.__speech = speech if dict_replace is not None: self.__repl = dict_replace else: self.__repl = sppasDictRepl(None) <|end_body_0|> <|body_start_1|> y = u(utt) tmp = ' '.join(y) sstr = re.sub(u('([0-90...
Utterance splitter :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Split an utterance into tokens using whitespace or characters. Should be extended to properly split telephone nu...
sppasSimpleSplitter
[ "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasSimpleSplitter: """Utterance splitter :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Split an utterance into tokens using whitespace or characters. Sh...
stack_v2_sparse_classes_75kplus_train_072813
5,442
permissive
[ { "docstring": "Creates a sppasSimpleSplitter. :param lang: the language code in iso639-3. :param dict_replace: Replacement dictionary :param speech: (bool) split transcribed speech vs written text", "name": "__init__", "signature": "def __init__(self, lang, dict_replace=None, speech=True)" }, { ...
3
stack_v2_sparse_classes_30k_train_007212
Implement the Python class `sppasSimpleSplitter` described below. Class description: Utterance splitter :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Split an utterance into to...
Implement the Python class `sppasSimpleSplitter` described below. Class description: Utterance splitter :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Split an utterance into to...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasSimpleSplitter: """Utterance splitter :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Split an utterance into tokens using whitespace or characters. Sh...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class sppasSimpleSplitter: """Utterance splitter :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Split an utterance into tokens using whitespace or characters. Should be exten...
the_stack_v2_python_sparse
sppas/sppas/src/annotations/TextNorm/splitter.py
mirfan899/MTTS
train
0
34d15558c42e28ffdcd0a3b5667b691c81dc2861
[ "self.application_environment = application_environment\nself.application_restore_objects = application_restore_objects\nself.hosting_protection_source = hosting_protection_source\nself.protection_source_and_application_objects = protection_source_and_application_objects", "if dictionary is None:\n return None...
<|body_start_0|> self.application_environment = application_environment self.application_restore_objects = application_restore_objects self.hosting_protection_source = hosting_protection_source self.protection_source_and_application_objects = protection_source_and_application_objects <|e...
Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore like 'kSQL','kAD',or 'kExchange'. Supported environment typ...
ApplicationRestoreParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationRestoreParameters: """Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore lik...
stack_v2_sparse_classes_75kplus_train_072814
8,238
permissive
[ { "docstring": "Constructor for the ApplicationRestoreParameters class", "name": "__init__", "signature": "def __init__(self, application_environment=None, application_restore_objects=None, hosting_protection_source=None, protection_source_and_application_objects=None)" }, { "docstring": "Create...
2
stack_v2_sparse_classes_30k_test_001618
Implement the Python class `ApplicationRestoreParameters` described below. Class description: Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment o...
Implement the Python class `ApplicationRestoreParameters` described below. Class description: Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment o...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ApplicationRestoreParameters: """Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore lik...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApplicationRestoreParameters: """Implementation of the 'ApplicationRestoreParameters' model. Specifies the information regarding the application restore parameters. Attributes: application_environment (ApplicationEnvironmentEnum): Specifies the Environment of the Application server to restore like 'kSQL','kAD...
the_stack_v2_python_sparse
cohesity_management_sdk/models/application_restore_parameters.py
cohesity/management-sdk-python
train
24
65fd104381a496096042906bb1d4f6c5a6f2eaef
[ "if filters:\n notifications = Notification.objects.filter(**filters).order_by('-created_on')\nelse:\n notifications = Notification.objects.all().order_by('-created_on')\npage = request.GET.get('page', 1)\nnotifs_per_page = request.GET.get('notifications_per_page', None)\nif notifs_per_page:\n paginator = ...
<|body_start_0|> if filters: notifications = Notification.objects.filter(**filters).order_by('-created_on') else: notifications = Notification.objects.all().order_by('-created_on') page = request.GET.get('page', 1) notifs_per_page = request.GET.get('notifications_...
NotificationList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationList: def get(self, request, filters=None, format=None): """A list of Notification objects as dicts.""" <|body_0|> def post(self, request, format=None): """Acknowledge notifications.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if fil...
stack_v2_sparse_classes_75kplus_train_072815
15,168
permissive
[ { "docstring": "A list of Notification objects as dicts.", "name": "get", "signature": "def get(self, request, filters=None, format=None)" }, { "docstring": "Acknowledge notifications.", "name": "post", "signature": "def post(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_015202
Implement the Python class `NotificationList` described below. Class description: Implement the NotificationList class. Method signatures and docstrings: - def get(self, request, filters=None, format=None): A list of Notification objects as dicts. - def post(self, request, format=None): Acknowledge notifications.
Implement the Python class `NotificationList` described below. Class description: Implement the NotificationList class. Method signatures and docstrings: - def get(self, request, filters=None, format=None): A list of Notification objects as dicts. - def post(self, request, format=None): Acknowledge notifications. <|...
df8c3e4a8b70be8697ac46f0acec9169752b4698
<|skeleton|> class NotificationList: def get(self, request, filters=None, format=None): """A list of Notification objects as dicts.""" <|body_0|> def post(self, request, format=None): """Acknowledge notifications.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationList: def get(self, request, filters=None, format=None): """A list of Notification objects as dicts.""" if filters: notifications = Notification.objects.filter(**filters).order_by('-created_on') else: notifications = Notification.objects.all().order_...
the_stack_v2_python_sparse
adjutant/api/v1/views.py
openstack/adjutant
train
23
75c417275544c5d9faf8c430ac76ad405b576c65
[ "a = args[0]\ndtype = a.dtype\nprecision = a.precision\nreturn (dtype, precision)", "a = args[0]\nrank = a.rank\nshape = a.shape\nreturn (shape, rank)" ]
<|body_start_0|> a = args[0] dtype = a.dtype precision = a.precision return (dtype, precision) <|end_body_0|> <|body_start_1|> a = args[0] rank = a.rank shape = a.shape return (shape, rank) <|end_body_1|>
Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator
PyccelUnaryOperator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyccelUnaryOperator: """Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator""" def _calculate_dtype(*args): """Sets the dtype and precision They are chosen to match the argument""" ...
stack_v2_sparse_classes_75kplus_train_072816
35,482
permissive
[ { "docstring": "Sets the dtype and precision They are chosen to match the argument", "name": "_calculate_dtype", "signature": "def _calculate_dtype(*args)" }, { "docstring": "Sets the shape and rank They are chosen to match the argument", "name": "_calculate_shape_rank", "signature": "de...
2
stack_v2_sparse_classes_30k_val_002184
Implement the Python class `PyccelUnaryOperator` described below. Class description: Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator Method signatures and docstrings: - def _calculate_dtype(*args): Sets the dtype an...
Implement the Python class `PyccelUnaryOperator` described below. Class description: Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator Method signatures and docstrings: - def _calculate_dtype(*args): Sets the dtype an...
1896b761ba662c90b14c195bbb6eb5cddc57cbfc
<|skeleton|> class PyccelUnaryOperator: """Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator""" def _calculate_dtype(*args): """Sets the dtype and precision They are chosen to match the argument""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PyccelUnaryOperator: """Abstract superclass representing a python operator with only one argument Parameters ---------- arg: PyccelAstNode The argument passed to the operator""" def _calculate_dtype(*args): """Sets the dtype and precision They are chosen to match the argument""" a = args[...
the_stack_v2_python_sparse
pyccel/ast/operators.py
pyccel/pyccel
train
307
c366c822a03354c31f0f502231e1406787b923d0
[ "xp = get_array_module(x)\ny = xp.exp(x)\nreturn y", "y = self.outputs[0]()\ngx = gy * y\nreturn gx" ]
<|body_start_0|> xp = get_array_module(x) y = xp.exp(x) return y <|end_body_0|> <|body_start_1|> y = self.outputs[0]() gx = gy * y return gx <|end_body_1|>
Exp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exp: def forward(self, x): """Parameters ---------- x: xp.ndarray (baredl.Tensor.data) Returns ------- y: xp.ndarray""" <|body_0|> def backward(self, gy): """Parameters ---------- gy: baredl.Tensor (baredl.Tensor.grad) Returns ------- gx: baredl.Tensor""" <|b...
stack_v2_sparse_classes_75kplus_train_072817
25,227
permissive
[ { "docstring": "Parameters ---------- x: xp.ndarray (baredl.Tensor.data) Returns ------- y: xp.ndarray", "name": "forward", "signature": "def forward(self, x)" }, { "docstring": "Parameters ---------- gy: baredl.Tensor (baredl.Tensor.grad) Returns ------- gx: baredl.Tensor", "name": "backwar...
2
null
Implement the Python class `Exp` described below. Class description: Implement the Exp class. Method signatures and docstrings: - def forward(self, x): Parameters ---------- x: xp.ndarray (baredl.Tensor.data) Returns ------- y: xp.ndarray - def backward(self, gy): Parameters ---------- gy: baredl.Tensor (baredl.Tenso...
Implement the Python class `Exp` described below. Class description: Implement the Exp class. Method signatures and docstrings: - def forward(self, x): Parameters ---------- x: xp.ndarray (baredl.Tensor.data) Returns ------- y: xp.ndarray - def backward(self, gy): Parameters ---------- gy: baredl.Tensor (baredl.Tenso...
10fe8c9d5811bfcb9ee303aba2087524574681e6
<|skeleton|> class Exp: def forward(self, x): """Parameters ---------- x: xp.ndarray (baredl.Tensor.data) Returns ------- y: xp.ndarray""" <|body_0|> def backward(self, gy): """Parameters ---------- gy: baredl.Tensor (baredl.Tensor.grad) Returns ------- gx: baredl.Tensor""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Exp: def forward(self, x): """Parameters ---------- x: xp.ndarray (baredl.Tensor.data) Returns ------- y: xp.ndarray""" xp = get_array_module(x) y = xp.exp(x) return y def backward(self, gy): """Parameters ---------- gy: baredl.Tensor (baredl.Tensor.grad) Returns -...
the_stack_v2_python_sparse
bareml/deeplearning/functions.py
shotahorii/bareml
train
3
9c5fad70bc955bdb37d760f0c4fbb7ccce117ec3
[ "print('Type your service name which executed Django below.')\nservice_name = input()\nprint('Your service name which has run Django: {}'.format(service_name))\nreturn service_name", "print('Type your Django project name below.')\nproject_name = input()\nprint('your project name: {}'.format(project_name))\nreturn...
<|body_start_0|> print('Type your service name which executed Django below.') service_name = input() print('Your service name which has run Django: {}'.format(service_name)) return service_name <|end_body_0|> <|body_start_1|> print('Type your Django project name below.') ...
Utility
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Utility: def input_service_name(): """Input service name whitch defined on docker-compose.yml.""" <|body_0|> def input_project_name(): """Input Django project name""" <|body_1|> <|end_skeleton|> <|body_start_0|> print('Type your service name which e...
stack_v2_sparse_classes_75kplus_train_072818
650
no_license
[ { "docstring": "Input service name whitch defined on docker-compose.yml.", "name": "input_service_name", "signature": "def input_service_name()" }, { "docstring": "Input Django project name", "name": "input_project_name", "signature": "def input_project_name()" } ]
2
stack_v2_sparse_classes_30k_train_032044
Implement the Python class `Utility` described below. Class description: Implement the Utility class. Method signatures and docstrings: - def input_service_name(): Input service name whitch defined on docker-compose.yml. - def input_project_name(): Input Django project name
Implement the Python class `Utility` described below. Class description: Implement the Utility class. Method signatures and docstrings: - def input_service_name(): Input service name whitch defined on docker-compose.yml. - def input_project_name(): Input Django project name <|skeleton|> class Utility: def input...
87bd1842d49e34abef8c66f666b6526d3fb18522
<|skeleton|> class Utility: def input_service_name(): """Input service name whitch defined on docker-compose.yml.""" <|body_0|> def input_project_name(): """Input Django project name""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Utility: def input_service_name(): """Input service name whitch defined on docker-compose.yml.""" print('Type your service name which executed Django below.') service_name = input() print('Your service name which has run Django: {}'.format(service_name)) return service_...
the_stack_v2_python_sparse
docker-django/cli/util.py
koike-ya/health
train
0
66f4852fd4f4ffadd33f36f25760bfa23338c89c
[ "sketch = Sketch.query.get_with_acl(sketch_id)\nscenario = Scenario.query.get(scenario_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID')\nif not sketch.has_permission(current_user, 'write'):\n abort(HTTP_STATUS_CODE_FORBIDDEN, 'User does not have write access controls on ...
<|body_start_0|> sketch = Sketch.query.get_with_acl(sketch_id) scenario = Scenario.query.get(scenario_id) if not sketch: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID') if not sketch.has_permission(current_user, 'write'): abort(HTTP_STATUS_CODE_F...
Resource for investigative scenarios.
ScenarioResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScenarioResource: """Resource for investigative scenarios.""" def get(self, sketch_id, scenario_id): """Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.""" <|body_0|> def post(self, sketch_id, scenario_id): """Handles...
stack_v2_sparse_classes_75kplus_train_072819
15,391
permissive
[ { "docstring": "Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.", "name": "get", "signature": "def get(self, sketch_id, scenario_id)" }, { "docstring": "Handles POST request to the resource. This resource creates a new scenario for a sketch based on...
2
stack_v2_sparse_classes_30k_train_007589
Implement the Python class `ScenarioResource` described below. Class description: Resource for investigative scenarios. Method signatures and docstrings: - def get(self, sketch_id, scenario_id): Handles GET request to the resource. Returns: A list of JSON representations of the scenarios. - def post(self, sketch_id, ...
Implement the Python class `ScenarioResource` described below. Class description: Resource for investigative scenarios. Method signatures and docstrings: - def get(self, sketch_id, scenario_id): Handles GET request to the resource. Returns: A list of JSON representations of the scenarios. - def post(self, sketch_id, ...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class ScenarioResource: """Resource for investigative scenarios.""" def get(self, sketch_id, scenario_id): """Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.""" <|body_0|> def post(self, sketch_id, scenario_id): """Handles...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScenarioResource: """Resource for investigative scenarios.""" def get(self, sketch_id, scenario_id): """Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.""" sketch = Sketch.query.get_with_acl(sketch_id) scenario = Scenario.query.get(sce...
the_stack_v2_python_sparse
timesketch/api/v1/resources/scenarios.py
google/timesketch
train
2,263
cfe8803fb0d0878cc21ec74d87d8fab115e7ecf7
[ "mock_data = [load_test_data('unshorten.me', mock_files_prefix + f'_{i}') for i in range(mock_files_count)]\nmock_data.append(mock_data[-1])\n\ndef redirect_side_effect() -> dict:\n for d in mock_data:\n yield d\nmocker.patch.object(BaseClient, '_http_request', side_effect=redirect_side_effect())\nresult ...
<|body_start_0|> mock_data = [load_test_data('unshorten.me', mock_files_prefix + f'_{i}') for i in range(mock_files_count)] mock_data.append(mock_data[-1]) def redirect_side_effect() -> dict: for d in mock_data: yield d mocker.patch.object(BaseClient, '_http_...
TestUnshortenMeService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUnshortenMeService: def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict): """Given: Parameters for unshortening a URL that redirects to another shortened URL using unshorten.me. When: Calling the `unshorten_url`...
stack_v2_sparse_classes_75kplus_train_072820
12,600
permissive
[ { "docstring": "Given: Parameters for unshortening a URL that redirects to another shortened URL using unshorten.me. When: Calling the `unshorten_url` function. Then: Ensure the context output is returned as expected, and that redirect_limit is working as expected.", "name": "test_nested_shortened_url", ...
2
stack_v2_sparse_classes_30k_train_031278
Implement the Python class `TestUnshortenMeService` described below. Class description: Implement the TestUnshortenMeService class. Method signatures and docstrings: - def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict): Given: Parameters for u...
Implement the Python class `TestUnshortenMeService` described below. Class description: Implement the TestUnshortenMeService class. Method signatures and docstrings: - def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict): Given: Parameters for u...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestUnshortenMeService: def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict): """Given: Parameters for unshortening a URL that redirects to another shortened URL using unshorten.me. When: Calling the `unshorten_url`...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestUnshortenMeService: def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict): """Given: Parameters for unshortening a URL that redirects to another shortened URL using unshorten.me. When: Calling the `unshorten_url` function. The...
the_stack_v2_python_sparse
Packs/CommonScripts/Scripts/ResolveShortenedURL/ResolveShortenedURL_test.py
demisto/content
train
1,023
2c6c30ec30e047db53cd0fefe0f6e7c1bf2ffaec
[ "DXDataObject.__init__(self, dxid=dxid, project=project)\nself._read_buf = BytesIO()\nself._read_bufsize = read_buffer_size\nself._expected_file_size = expected_file_size\nself._file_is_mmapd = file_is_mmapd\nself._download_url, self._download_url_headers, self._download_url_expires = (None, None, None)\nself._url_...
<|body_start_0|> DXDataObject.__init__(self, dxid=dxid, project=project) self._read_buf = BytesIO() self._read_bufsize = read_buffer_size self._expected_file_size = expected_file_size self._file_is_mmapd = file_is_mmapd self._download_url, self._download_url_headers, self...
Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string
DXDatabase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DXDatabase: """Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string""" def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, expected_file_size=None, file_is_mmapd=False): """:param dxid...
stack_v2_sparse_classes_75kplus_train_072821
9,041
permissive
[ { "docstring": ":param dxid: Object ID :type dxid: string :param project: Project ID :type project: string :param read_buffer_size: size of read buffer in bytes :type read_buffer_size: int :param expected_file_size: size of data that will be written, if known :type expected_file_size: int :param file_is_mmapd: ...
2
stack_v2_sparse_classes_30k_val_002578
Implement the Python class `DXDatabase` described below. Class description: Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string Method signatures and docstrings: - def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, e...
Implement the Python class `DXDatabase` described below. Class description: Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string Method signatures and docstrings: - def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, e...
ad4f498ae80fb0cd2e591f63a7bf4fb983049c75
<|skeleton|> class DXDatabase: """Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string""" def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, expected_file_size=None, file_is_mmapd=False): """:param dxid...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DXDatabase: """Remote database object handler. :param dxid: Object ID :type dxid: string :param project: Project ID :type project: string""" def __init__(self, dxid=None, project=None, read_buffer_size=DEFAULT_BUFFER_SIZE, expected_file_size=None, file_is_mmapd=False): """:param dxid: Object ID :...
the_stack_v2_python_sparse
src/python/dxpy/bindings/dxdatabase.py
dnanexus/dx-toolkit
train
82
15a33f3fd93703409a0fe7597f24a7ee84e5a6f6
[ "if self.is_active(global_step):\n tic = self._compute(global_step, params, batch_loss).item()\n if self._verbose:\n print(f'[Step {global_step}] TICTrace: {tic:.4f}')\n self.output[global_step]['tic_trace'] = tic\n if self._check:\n self.__run_check(global_step, params, batch_loss)", "s...
<|body_start_0|> if self.is_active(global_step): tic = self._compute(global_step, params, batch_loss).item() if self._verbose: print(f'[Step {global_step}] TICTrace: {tic:.4f}') self.output[global_step]['tic_trace'] = tic if self._check: ...
TIC approximation using the trace of curvature and gradient covariance.
TICTrace
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TICTrace: """TIC approximation using the trace of curvature and gradient covariance.""" def compute(self, global_step, params, batch_loss): """Compute TICTrace. Args: global_step (int): The current iteration number. params ([torch.Tensor]): List of torch.Tensors holding the network's...
stack_v2_sparse_classes_75kplus_train_072822
9,326
permissive
[ { "docstring": "Compute TICTrace. Args: global_step (int): The current iteration number. params ([torch.Tensor]): List of torch.Tensors holding the network's parameters. batch_loss (torch.Tensor): Mini-batch loss from current step.", "name": "compute", "signature": "def compute(self, global_step, params...
3
stack_v2_sparse_classes_30k_train_040654
Implement the Python class `TICTrace` described below. Class description: TIC approximation using the trace of curvature and gradient covariance. Method signatures and docstrings: - def compute(self, global_step, params, batch_loss): Compute TICTrace. Args: global_step (int): The current iteration number. params ([to...
Implement the Python class `TICTrace` described below. Class description: TIC approximation using the trace of curvature and gradient covariance. Method signatures and docstrings: - def compute(self, global_step, params, batch_loss): Compute TICTrace. Args: global_step (int): The current iteration number. params ([to...
5bd5ab3cda03eda0b0bf276f29d5c28b83d70b06
<|skeleton|> class TICTrace: """TIC approximation using the trace of curvature and gradient covariance.""" def compute(self, global_step, params, batch_loss): """Compute TICTrace. Args: global_step (int): The current iteration number. params ([torch.Tensor]): List of torch.Tensors holding the network's...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TICTrace: """TIC approximation using the trace of curvature and gradient covariance.""" def compute(self, global_step, params, batch_loss): """Compute TICTrace. Args: global_step (int): The current iteration number. params ([torch.Tensor]): List of torch.Tensors holding the network's parameters. ...
the_stack_v2_python_sparse
cockpit/quantities/tic.py
MeNicefellow/cockpit
train
0
bcd4c5cdfc5fc31fb0308918d83b577d71ea77ee
[ "seattle = UserLocation(city='Seattle', state='WA', country='USA')\nparis = UserLocation(city='Paris', country='France')\nqueenstown = UserLocation(city='Queenstown', country='NZ')\nvictoria = UserLocation(city='Victoria', state='BC', country='Canada')\nbejing = UserLocation(city='Bejing', country='China')\nvague_c...
<|body_start_0|> seattle = UserLocation(city='Seattle', state='WA', country='USA') paris = UserLocation(city='Paris', country='France') queenstown = UserLocation(city='Queenstown', country='NZ') victoria = UserLocation(city='Victoria', state='BC', country='Canada') bejing = UserL...
Class to test the User Location feature.
TestUserLocation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUserLocation: """Class to test the User Location feature.""" def setUp(self): """Setup UserLocation Objects.""" <|body_0|> def test_create_user_location(self): """Test creating new user locations.""" <|body_1|> def test_get_location_data(self): ...
stack_v2_sparse_classes_75kplus_train_072823
2,097
no_license
[ { "docstring": "Setup UserLocation Objects.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test creating new user locations.", "name": "test_create_user_location", "signature": "def test_create_user_location(self)" }, { "docstring": "Test getting the geoloca...
3
stack_v2_sparse_classes_30k_train_008665
Implement the Python class `TestUserLocation` described below. Class description: Class to test the User Location feature. Method signatures and docstrings: - def setUp(self): Setup UserLocation Objects. - def test_create_user_location(self): Test creating new user locations. - def test_get_location_data(self): Test ...
Implement the Python class `TestUserLocation` described below. Class description: Class to test the User Location feature. Method signatures and docstrings: - def setUp(self): Setup UserLocation Objects. - def test_create_user_location(self): Test creating new user locations. - def test_get_location_data(self): Test ...
18241b6f27b16db4c4842c464b890afa6ab3c877
<|skeleton|> class TestUserLocation: """Class to test the User Location feature.""" def setUp(self): """Setup UserLocation Objects.""" <|body_0|> def test_create_user_location(self): """Test creating new user locations.""" <|body_1|> def test_get_location_data(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestUserLocation: """Class to test the User Location feature.""" def setUp(self): """Setup UserLocation Objects.""" seattle = UserLocation(city='Seattle', state='WA', country='USA') paris = UserLocation(city='Paris', country='France') queenstown = UserLocation(city='Queens...
the_stack_v2_python_sparse
test_location.py
awildstone/Water-Mate
train
1
12029a082f09dc317def3d8adaae053dfd10f99f
[ "if not userid:\n raise ValueError('Users must have an email address')\nuser = self.model(userid=userid, date_of_birth=date_of_birth)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(userid, password=password, date_of_birth=date_of_birth)\nuser.is_admin = True\nus...
<|body_start_0|> if not userid: raise ValueError('Users must have an email address') user = self.model(userid=userid, date_of_birth=date_of_birth) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.cr...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, userid, date_of_birth, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, userid, date_of_birth, password): """Creates and saves a superuser with ...
stack_v2_sparse_classes_75kplus_train_072824
15,631
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, userid, date_of_birth, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", ...
2
stack_v2_sparse_classes_30k_train_051213
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, userid, date_of_birth, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, use...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, userid, date_of_birth, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, use...
54f2b945e5214c7f7e85984cafd5b22c999a3640
<|skeleton|> class MyUserManager: def create_user(self, userid, date_of_birth, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, userid, date_of_birth, password): """Creates and saves a superuser with ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyUserManager: def create_user(self, userid, date_of_birth, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not userid: raise ValueError('Users must have an email address') user = self.model(userid=userid, date_of_birth=da...
the_stack_v2_python_sparse
testuser/newapp/models.py
vaibhavs95/NSIT-Hostel-MS
train
0
ea7efa50be86af5da879c21c491a699497fe0adb
[ "from fcntl import fcntl, F_GETFL, F_SETFL\nfrom subprocess import Popen, PIPE\nimport os\nself._command = command\nself._executable = command.split(' ', 1)[0]\n_Log.debug('Starting the interactive process: {}'.format(command))\nself._process = Popen(command, shell=True, stdout=PIPE, stdin=PIPE, stderr=PIPE)\nfcntl...
<|body_start_0|> from fcntl import fcntl, F_GETFL, F_SETFL from subprocess import Popen, PIPE import os self._command = command self._executable = command.split(' ', 1)[0] _Log.debug('Starting the interactive process: {}'.format(command)) self._process = Popen(com...
Class representing an object that interacts with a binary multiple times
InteractiveProcess
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractiveProcess: """Class representing an object that interacts with a binary multiple times""" def __init__(self, command): """Creates an interactive process to interact with out of a command :param str command: the command to be executed""" <|body_0|> def write(self...
stack_v2_sparse_classes_75kplus_train_072825
15,038
permissive
[ { "docstring": "Creates an interactive process to interact with out of a command :param str command: the command to be executed", "name": "__init__", "signature": "def __init__(self, command)" }, { "docstring": "Writes a command into the interactive process :param str command: the command to be ...
5
stack_v2_sparse_classes_30k_train_042827
Implement the Python class `InteractiveProcess` described below. Class description: Class representing an object that interacts with a binary multiple times Method signatures and docstrings: - def __init__(self, command): Creates an interactive process to interact with out of a command :param str command: the command...
Implement the Python class `InteractiveProcess` described below. Class description: Class representing an object that interacts with a binary multiple times Method signatures and docstrings: - def __init__(self, command): Creates an interactive process to interact with out of a command :param str command: the command...
dd393666aa1ba1117d1c472cfdef4d0b18216904
<|skeleton|> class InteractiveProcess: """Class representing an object that interacts with a binary multiple times""" def __init__(self, command): """Creates an interactive process to interact with out of a command :param str command: the command to be executed""" <|body_0|> def write(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InteractiveProcess: """Class representing an object that interacts with a binary multiple times""" def __init__(self, command): """Creates an interactive process to interact with out of a command :param str command: the command to be executed""" from fcntl import fcntl, F_GETFL, F_SETFL ...
the_stack_v2_python_sparse
scrounger/utils/general.py
exploit-inters/scrounger
train
0
058ee048c2941619a5277b10aaff068299d37a46
[ "self.snmp_object = snmp_object\ntest_oid = '.1.3.6.1.4.1.9.9.87.1.4.1.1.18'\nsuper().__init__(snmp_object, test_oid, tags=['layer1'])", "final = defaultdict(lambda: defaultdict(dict))\nvalues = self.c2900portduplexstatus()\nfor key, value in values.items():\n final[key]['c2900PortDuplexStatus'] = value\nvalue...
<|body_start_0|> self.snmp_object = snmp_object test_oid = '.1.3.6.1.4.1.9.9.87.1.4.1.1.18' super().__init__(snmp_object, test_oid, tags=['layer1']) <|end_body_0|> <|body_start_1|> final = defaultdict(lambda: defaultdict(dict)) values = self.c2900portduplexstatus() for k...
Class interacts with CISCO-C2900-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB information from the de...
CiscoC2900Query
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CiscoC2900Query: """Class interacts with CISCO-C2900-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all...
stack_v2_sparse_classes_75kplus_train_072826
3,592
permissive
[ { "docstring": "Function for intializing the class. Args: snmp_object: SNMP Interact class object from snmp_manager.py Returns: None", "name": "__init__", "signature": "def __init__(self, snmp_object)" }, { "docstring": "Get layer 1 data from device. Args: None Returns: final: Final results", ...
4
null
Implement the Python class `CiscoC2900Query` described below. Class description: Class interacts with CISCO-C2900-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the...
Implement the Python class `CiscoC2900Query` described below. Class description: Class interacts with CISCO-C2900-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the...
ae82589fbbab77fef6d6be09c1fcca5846f595a8
<|skeleton|> class CiscoC2900Query: """Class interacts with CISCO-C2900-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CiscoC2900Query: """Class interacts with CISCO-C2900-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer...
the_stack_v2_python_sparse
switchmap/snmp/cisco/mib_ciscoc2900.py
PalisadoesFoundation/switchmap-ng
train
8
b2077dfd5c493c0062f755c4e6744e11896dfc9e
[ "conf = cls.get_ssh_setting()\nssh = SSHClient()\nssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())\ntry:\n ssh.connect(conf['host'], conf['port'], conf['user'], conf['pwd'], timeout=15)\nexcept paramiko.SSHException as e:\n AppException(str(e))\nelse:\n chan = ssh.invoke_shell(term='xterm-256color...
<|body_start_0|> conf = cls.get_ssh_setting() ssh = SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: ssh.connect(conf['host'], conf['port'], conf['user'], conf['pwd'], timeout=15) except paramiko.SSHException as e: AppException(st...
# 提供ssh服务
SSHSrv
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSHSrv: """# 提供ssh服务""" def get_ssh_connect(cls) -> tuple: """# 完成SSH连接 :return: (SSHClient, SSH连接通道)""" <|body_0|> def get_ssh_setting(cls) -> dict: """# 获取ssh配置信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> conf = cls.get_ssh_setting() ...
stack_v2_sparse_classes_75kplus_train_072827
1,402
permissive
[ { "docstring": "# 完成SSH连接 :return: (SSHClient, SSH连接通道)", "name": "get_ssh_connect", "signature": "def get_ssh_connect(cls) -> tuple" }, { "docstring": "# 获取ssh配置信息", "name": "get_ssh_setting", "signature": "def get_ssh_setting(cls) -> dict" } ]
2
stack_v2_sparse_classes_30k_train_020365
Implement the Python class `SSHSrv` described below. Class description: # 提供ssh服务 Method signatures and docstrings: - def get_ssh_connect(cls) -> tuple: # 完成SSH连接 :return: (SSHClient, SSH连接通道) - def get_ssh_setting(cls) -> dict: # 获取ssh配置信息
Implement the Python class `SSHSrv` described below. Class description: # 提供ssh服务 Method signatures and docstrings: - def get_ssh_connect(cls) -> tuple: # 完成SSH连接 :return: (SSHClient, SSH连接通道) - def get_ssh_setting(cls) -> dict: # 获取ssh配置信息 <|skeleton|> class SSHSrv: """# 提供ssh服务""" def get_ssh_connect(cls)...
2a6f44f86469bfbb472dfd1bec4238587d8402bf
<|skeleton|> class SSHSrv: """# 提供ssh服务""" def get_ssh_connect(cls) -> tuple: """# 完成SSH连接 :return: (SSHClient, SSH连接通道)""" <|body_0|> def get_ssh_setting(cls) -> dict: """# 获取ssh配置信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSHSrv: """# 提供ssh服务""" def get_ssh_connect(cls) -> tuple: """# 完成SSH连接 :return: (SSHClient, SSH连接通道)""" conf = cls.get_ssh_setting() ssh = SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: ssh.connect(conf['host'], conf['port']...
the_stack_v2_python_sparse
backend/blog/service/ssh.py
o8oo8o/blog
train
0
63d3b7b8403148179ab79cb06409ddda1816154c
[ "description = response.css('.content > p::text').extract_first()\nif not re.search('100 W(est)? Randolph', description):\n raise ValueError('Meeting location has changed')\nfor item in response.css('.content > ul li'):\n meeting = Meeting(title='Local Records Commission', description='', classification=COMMI...
<|body_start_0|> description = response.css('.content > p::text').extract_first() if not re.search('100 W(est)? Randolph', description): raise ValueError('Meeting location has changed') for item in response.css('.content > ul li'): meeting = Meeting(title='Local Records C...
CookLocalRecordsSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CookLocalRecordsSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start datetime as a naive dateti...
stack_v2_sparse_classes_75kplus_train_072828
2,513
permissive
[ { "docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse start datetime as a naive datetime object.", "name": "_parse_st...
3
stack_v2_sparse_classes_30k_train_026633
Implement the Python class `CookLocalRecordsSpider` described below. Class description: Implement the CookLocalRecordsSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping ne...
Implement the Python class `CookLocalRecordsSpider` described below. Class description: Implement the CookLocalRecordsSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping ne...
611fce6a2705446e25a2fc33e32090a571eb35d1
<|skeleton|> class CookLocalRecordsSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start datetime as a naive dateti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CookLocalRecordsSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" description = response.css('.content > p::text').extract_first() if not re.search('100 W(est)? Randol...
the_stack_v2_python_sparse
city_scrapers/spiders/cook_local_records.py
City-Bureau/city-scrapers
train
308
2739bbbe8e09cf167adcfbb2bb0ec3b6172816aa
[ "password1 = self.cleaned_data.get('password1')\npassword2 = self.cleaned_data.get('password2')\nif not password1:\n raise forms.ValidationError('Password not found')\nif not password2:\n raise forms.ValidationError('Confirmation Password not found')\nif password1 != password2:\n raise forms.ValidationErro...
<|body_start_0|> password1 = self.cleaned_data.get('password1') password2 = self.cleaned_data.get('password2') if not password1: raise forms.ValidationError('Password not found') if not password2: raise forms.ValidationError('Confirmation Password not found') ...
UserAdminCreationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAdminCreationForm: def clean_password2(self): """Checks by comparing password2 with password1 and Returns password2""" <|body_0|> def save(self, commit: bool=True): """Saves the user using super""" <|body_1|> <|end_skeleton|> <|body_start_0|> pa...
stack_v2_sparse_classes_75kplus_train_072829
1,654
no_license
[ { "docstring": "Checks by comparing password2 with password1 and Returns password2", "name": "clean_password2", "signature": "def clean_password2(self)" }, { "docstring": "Saves the user using super", "name": "save", "signature": "def save(self, commit: bool=True)" } ]
2
null
Implement the Python class `UserAdminCreationForm` described below. Class description: Implement the UserAdminCreationForm class. Method signatures and docstrings: - def clean_password2(self): Checks by comparing password2 with password1 and Returns password2 - def save(self, commit: bool=True): Saves the user using ...
Implement the Python class `UserAdminCreationForm` described below. Class description: Implement the UserAdminCreationForm class. Method signatures and docstrings: - def clean_password2(self): Checks by comparing password2 with password1 and Returns password2 - def save(self, commit: bool=True): Saves the user using ...
22057399f34cdc1edb0ef04e622c97df46532de3
<|skeleton|> class UserAdminCreationForm: def clean_password2(self): """Checks by comparing password2 with password1 and Returns password2""" <|body_0|> def save(self, commit: bool=True): """Saves the user using super""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserAdminCreationForm: def clean_password2(self): """Checks by comparing password2 with password1 and Returns password2""" password1 = self.cleaned_data.get('password1') password2 = self.cleaned_data.get('password2') if not password1: raise forms.ValidationError('Pa...
the_stack_v2_python_sparse
bumblebee/users/forms.py
sthasam2/bumblebee-backend
train
0
7abc6252ada1b99cc5fb14f9884eb32c6550786d
[ "while True:\n y, x = self.select_random_position(example)\n patch = self.get_patch_for_position(example, y, x)\n if np.any(patch.roi):\n roi_image_patch = patch.image * np.expand_dims(patch.roi, axis=-1)\n patch = CrowdExample(image=roi_image_patch, label=patch.label * patch.roi, roi=patch.r...
<|body_start_0|> while True: y, x = self.select_random_position(example) patch = self.get_patch_for_position(example, y, x) if np.any(patch.roi): roi_image_patch = patch.image * np.expand_dims(patch.roi, axis=-1) patch = CrowdExample(image=roi_...
Selects a patch of the example and resizes it based on the perspective map.
RandomlySelectPatchAndRescale
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomlySelectPatchAndRescale: """Selects a patch of the example and resizes it based on the perspective map.""" def __call__(self, example): """:param example: A crowd example with perspective. :type example: CrowdExample :return: A crowd example. :rtype: CrowdExample""" <|b...
stack_v2_sparse_classes_75kplus_train_072830
23,650
no_license
[ { "docstring": ":param example: A crowd example with perspective. :type example: CrowdExample :return: A crowd example. :rtype: CrowdExample", "name": "__call__", "signature": "def __call__(self, example)" }, { "docstring": "Picks a random position in the full example. :param example: The full e...
2
null
Implement the Python class `RandomlySelectPatchAndRescale` described below. Class description: Selects a patch of the example and resizes it based on the perspective map. Method signatures and docstrings: - def __call__(self, example): :param example: A crowd example with perspective. :type example: CrowdExample :ret...
Implement the Python class `RandomlySelectPatchAndRescale` described below. Class description: Selects a patch of the example and resizes it based on the perspective map. Method signatures and docstrings: - def __call__(self, example): :param example: A crowd example with perspective. :type example: CrowdExample :ret...
35b8075910572a8d33f244c366fda2599c7f2093
<|skeleton|> class RandomlySelectPatchAndRescale: """Selects a patch of the example and resizes it based on the perspective map.""" def __call__(self, example): """:param example: A crowd example with perspective. :type example: CrowdExample :return: A crowd example. :rtype: CrowdExample""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomlySelectPatchAndRescale: """Selects a patch of the example and resizes it based on the perspective map.""" def __call__(self, example): """:param example: A crowd example with perspective. :type example: CrowdExample :return: A crowd example. :rtype: CrowdExample""" while True: ...
the_stack_v2_python_sparse
crowd/data.py
golmschenk/sr-gan
train
33
378c845527ed1579e91c7197270a543a223c26a0
[ "data = np.ones((16, 16), dtype=np.float32)\nself.cube = set_up_variable_cube(data, 'precipitation_amount', 'kg m^-2', grid_spacing=1, domain_corner=(49, -8))\nself.cube_360 = set_up_variable_cube(data, 'precipitation_amount', 'kg m^-2', grid_spacing=1, domain_corner=(49, 345))\nself.spot_cube = create_spot_cube(xr...
<|body_start_0|> data = np.ones((16, 16), dtype=np.float32) self.cube = set_up_variable_cube(data, 'precipitation_amount', 'kg m^-2', grid_spacing=1, domain_corner=(49, -8)) self.cube_360 = set_up_variable_cube(data, 'precipitation_amount', 'kg m^-2', grid_spacing=1, domain_corner=(49, 345)) ...
Test string representation
Test__daynight_lat_lon_cube
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__daynight_lat_lon_cube: """Test string representation""" def setUp(self): """Set up the cube for testing.""" <|body_0|> def test_basic_lat_lon_cube_gridded(self): """Test this create a blank gridded mask cube""" <|body_1|> def test_basic_lat_lon...
stack_v2_sparse_classes_75kplus_train_072831
18,065
permissive
[ { "docstring": "Set up the cube for testing.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test this create a blank gridded mask cube", "name": "test_basic_lat_lon_cube_gridded", "signature": "def test_basic_lat_lon_cube_gridded(self)" }, { "docstring": "Te...
4
stack_v2_sparse_classes_30k_train_040620
Implement the Python class `Test__daynight_lat_lon_cube` described below. Class description: Test string representation Method signatures and docstrings: - def setUp(self): Set up the cube for testing. - def test_basic_lat_lon_cube_gridded(self): Test this create a blank gridded mask cube - def test_basic_lat_lon_cub...
Implement the Python class `Test__daynight_lat_lon_cube` described below. Class description: Test string representation Method signatures and docstrings: - def setUp(self): Set up the cube for testing. - def test_basic_lat_lon_cube_gridded(self): Test this create a blank gridded mask cube - def test_basic_lat_lon_cub...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__daynight_lat_lon_cube: """Test string representation""" def setUp(self): """Set up the cube for testing.""" <|body_0|> def test_basic_lat_lon_cube_gridded(self): """Test this create a blank gridded mask cube""" <|body_1|> def test_basic_lat_lon...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test__daynight_lat_lon_cube: """Test string representation""" def setUp(self): """Set up the cube for testing.""" data = np.ones((16, 16), dtype=np.float32) self.cube = set_up_variable_cube(data, 'precipitation_amount', 'kg m^-2', grid_spacing=1, domain_corner=(49, -8)) se...
the_stack_v2_python_sparse
improver_tests/utilities/solar/test_DayNightMask.py
metoppv/improver
train
101
24c3fa2ed01e9e9a7a05aaf3eb9d54c95726ba31
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywords are allowed per keyword plan. A maximum of 1,000 negative keywor...
KeywordPlanAdGroupKeywordServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordPlanAdGroupKeywordServiceServicer: """Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywo...
stack_v2_sparse_classes_75kplus_train_072832
7,403
permissive
[ { "docstring": "Returns the requested Keyword Plan ad group keyword in full detail.", "name": "GetKeywordPlanAdGroupKeyword", "signature": "def GetKeywordPlanAdGroupKeyword(self, request, context)" }, { "docstring": "Creates, updates, or removes Keyword Plan ad group keywords. Operation statuses...
2
stack_v2_sparse_classes_30k_train_010957
Implement the Python class `KeywordPlanAdGroupKeywordServiceServicer` described below. Class description: Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are suppor...
Implement the Python class `KeywordPlanAdGroupKeywordServiceServicer` described below. Class description: Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are suppor...
969eff5b6c3cec59d21191fa178cffb6270074c3
<|skeleton|> class KeywordPlanAdGroupKeywordServiceServicer: """Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KeywordPlanAdGroupKeywordServiceServicer: """Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywords are allow...
the_stack_v2_python_sparse
google/ads/google_ads/v6/proto/services/keyword_plan_ad_group_keyword_service_pb2_grpc.py
VincentFritzsche/google-ads-python
train
0
909682b53f3183c561aa0ced34e09240014b39fb
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Task()", "from ..entity import Entity\nfrom ..key_value_pair import KeyValuePair\nfrom .lifecycle_task_category import LifecycleTaskCategory\nfrom .task_processing_result import TaskProcessingResult\nfrom ..entity import Entity\nfrom ....
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Task() <|end_body_0|> <|body_start_1|> from ..entity import Entity from ..key_value_pair import KeyValuePair from .lifecycle_task_category import LifecycleTaskCategory fr...
Task
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Task: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: """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: Task""" ...
stack_v2_sparse_classes_75kplus_train_072833
5,225
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: Task", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_no...
3
stack_v2_sparse_classes_30k_train_036368
Implement the Python class `Task` described below. Class description: Implement the Task class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
Implement the Python class `Task` described below. Class description: Implement the Task class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Task: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: """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: Task""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Task: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: """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: Task""" if not parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/identity_governance/task.py
microsoftgraph/msgraph-sdk-python
train
135
c9869702c505c2b9e303ebad14f97cea1036e7de
[ "visited = {}\nif not head or not head.next:\n return False\nwhile head:\n if head not in visited:\n visited[head] = head.val\n else:\n return True\n head = head.next\nreturn False", "if not head or not head.next:\n return False\nfast = head\nslow = head\nwhile fast and fast.next:\n ...
<|body_start_0|> visited = {} if not head or not head.next: return False while head: if head not in visited: visited[head] = head.val else: return True head = head.next return False <|end_body_0|> <|body_sta...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle_1(self, head): """*哈希表 时间复杂度 o(n) 空间复杂度 o(n)""" <|body_0|> def hasCycle_2(self, head): """*快慢指针 时间复杂度 o(n) 空间复杂度 o(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> visited = {} if not head or not head.next: ...
stack_v2_sparse_classes_75kplus_train_072834
956
no_license
[ { "docstring": "*哈希表 时间复杂度 o(n) 空间复杂度 o(n)", "name": "hasCycle_1", "signature": "def hasCycle_1(self, head)" }, { "docstring": "*快慢指针 时间复杂度 o(n) 空间复杂度 o(1)", "name": "hasCycle_2", "signature": "def hasCycle_2(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_020012
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle_1(self, head): *哈希表 时间复杂度 o(n) 空间复杂度 o(n) - def hasCycle_2(self, head): *快慢指针 时间复杂度 o(n) 空间复杂度 o(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle_1(self, head): *哈希表 时间复杂度 o(n) 空间复杂度 o(n) - def hasCycle_2(self, head): *快慢指针 时间复杂度 o(n) 空间复杂度 o(1) <|skeleton|> class Solution: def hasCycle_1(self, head): ...
ebf9503d4bc6d4335c463aa2b4622dd7df55fb87
<|skeleton|> class Solution: def hasCycle_1(self, head): """*哈希表 时间复杂度 o(n) 空间复杂度 o(n)""" <|body_0|> def hasCycle_2(self, head): """*快慢指针 时间复杂度 o(n) 空间复杂度 o(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasCycle_1(self, head): """*哈希表 时间复杂度 o(n) 空间复杂度 o(n)""" visited = {} if not head or not head.next: return False while head: if head not in visited: visited[head] = head.val else: return True ...
the_stack_v2_python_sparse
linkedlist/141_hasCycle.py
huuu97/LeetCode
train
0
14578cbb11816b708c1079137fe3d9f69b5469ce
[ "parts = self._get_where_helper()\nif not parts:\n return ''\nclauses = len(parts) > 1 and ' AND '.join(parts) or parts[0]\nreturn ' WHERE ' + clauses", "elems = []\nRELATIONS = {'lt': ' < ', 'gt': ' > ', 'le': ' <= ', 'ge': ' >= ', 'in': ' in ', 'notin': ' not in '}\nfor elem in self.__dict__:\n if elem.en...
<|body_start_0|> parts = self._get_where_helper() if not parts: return '' clauses = len(parts) > 1 and ' AND '.join(parts) or parts[0] return ' WHERE ' + clauses <|end_body_0|> <|body_start_1|> elems = [] RELATIONS = {'lt': ' < ', 'gt': ' > ', 'le': ' <= ', '...
Class for representing queries to DB. Simple usage: we want to select JobRecords with EventTime > 2011-01-01. We must construct query as follows: query = Query() query.EventTime_gt = parseTimestamp('2011-01-01', '%Y-%m-%d') apel_db.get_records(... query, ...)
Query
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: """Class for representing queries to DB. Simple usage: we want to select JobRecords with EventTime > 2011-01-01. We must construct query as follows: query = Query() query.EventTime_gt = parseTimestamp('2011-01-01', '%Y-%m-%d') apel_db.get_records(... query, ...)""" def get_where(self)...
stack_v2_sparse_classes_75kplus_train_072835
4,659
permissive
[ { "docstring": "Returns dynamically created SQL conditions for query. For example: field_name > 0 AND field_name < 100", "name": "get_where", "signature": "def get_where(self)" }, { "docstring": "Private function which uses reflection to get information about fields and relations. Possible relat...
2
null
Implement the Python class `Query` described below. Class description: Class for representing queries to DB. Simple usage: we want to select JobRecords with EventTime > 2011-01-01. We must construct query as follows: query = Query() query.EventTime_gt = parseTimestamp('2011-01-01', '%Y-%m-%d') apel_db.get_records(... ...
Implement the Python class `Query` described below. Class description: Class for representing queries to DB. Simple usage: we want to select JobRecords with EventTime > 2011-01-01. We must construct query as follows: query = Query() query.EventTime_gt = parseTimestamp('2011-01-01', '%Y-%m-%d') apel_db.get_records(... ...
f4504d743fcedf67344095bd1c5e0a6efa54142a
<|skeleton|> class Query: """Class for representing queries to DB. Simple usage: we want to select JobRecords with EventTime > 2011-01-01. We must construct query as follows: query = Query() query.EventTime_gt = parseTimestamp('2011-01-01', '%Y-%m-%d') apel_db.get_records(... query, ...)""" def get_where(self)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Query: """Class for representing queries to DB. Simple usage: we want to select JobRecords with EventTime > 2011-01-01. We must construct query as follows: query = Query() query.EventTime_gt = parseTimestamp('2011-01-01', '%Y-%m-%d') apel_db.get_records(... query, ...)""" def get_where(self): """...
the_stack_v2_python_sparse
apel/db/apeldb.py
apel/apel
train
11
a63faa9bd9666db8af129c61f1bd66ef7228cf50
[ "super().__init__(test_name)\nself.notebook_locals = notebook_locals\nTerrain = self.notebook_locals['Terrain']\nself.footstep_planner = self.notebook_locals['GCS_footstep_planner']\nself.solver = SnoptSolver()\nself.terrains = {'A': Terrain([1, 1, 1, 1]), 'B': Terrain([1, 1, 1, 0])}\nself.n_steps = 8\nself.step_sp...
<|body_start_0|> super().__init__(test_name) self.notebook_locals = notebook_locals Terrain = self.notebook_locals['Terrain'] self.footstep_planner = self.notebook_locals['GCS_footstep_planner'] self.solver = SnoptSolver() self.terrains = {'A': Terrain([1, 1, 1, 1]), 'B':...
TestFootstepPlanning
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFootstepPlanning: def __init__(self, test_name, notebook_locals): """Since the planner raises an error if the problem is infeasible, it is better to solve the optimizations inside each method rather than here in the __init__ method. This way if the plan is infeasible, students get ze...
stack_v2_sparse_classes_75kplus_train_072836
4,279
permissive
[ { "docstring": "Since the planner raises an error if the problem is infeasible, it is better to solve the optimizations inside each method rather than here in the __init__ method. This way if the plan is infeasible, students get zero points instead of an error from the test file. Note also that each time a test...
4
null
Implement the Python class `TestFootstepPlanning` described below. Class description: Implement the TestFootstepPlanning class. Method signatures and docstrings: - def __init__(self, test_name, notebook_locals): Since the planner raises an error if the problem is infeasible, it is better to solve the optimizations in...
Implement the Python class `TestFootstepPlanning` described below. Class description: Implement the TestFootstepPlanning class. Method signatures and docstrings: - def __init__(self, test_name, notebook_locals): Since the planner raises an error if the problem is infeasible, it is better to solve the optimizations in...
a37b43e36057f2008d5db3c488ddbc541bdb0975
<|skeleton|> class TestFootstepPlanning: def __init__(self, test_name, notebook_locals): """Since the planner raises an error if the problem is infeasible, it is better to solve the optimizations inside each method rather than here in the __init__ method. This way if the plan is infeasible, students get ze...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFootstepPlanning: def __init__(self, test_name, notebook_locals): """Since the planner raises an error if the problem is infeasible, it is better to solve the optimizations inside each method rather than here in the __init__ method. This way if the plan is infeasible, students get zero points inst...
the_stack_v2_python_sparse
underactuated/exercises/humanoids/test_footstep_planning_gcs.py
RussTedrake/underactuated
train
565
6624fd84c6b1f5e0132a61e1bef7c09ccec13819
[ "key = ndb.Key(models.Instance, 'fake-key')\nmetadata.reschedule_active_metadata_update(key, 'url')\nself.failIf(key.get())", "key = models.Instance(key=instances.get_instance_key('base-name', 'revision', 'zone', 'instance-name'), pending_metadata_updates=[models.MetadataUpdate(metadata={'key2': 'value2'})]).put(...
<|body_start_0|> key = ndb.Key(models.Instance, 'fake-key') metadata.reschedule_active_metadata_update(key, 'url') self.failIf(key.get()) <|end_body_0|> <|body_start_1|> key = models.Instance(key=instances.get_instance_key('base-name', 'revision', 'zone', 'instance-name'), pending_metad...
Tests for metadata.reschedule_active_metadata_update.
RescheduleActiveMetadataUpdateTest
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RescheduleActiveMetadataUpdateTest: """Tests for metadata.reschedule_active_metadata_update.""" def test_not_found(self): """Ensures nothing happens when the entity doesn't exist.""" <|body_0|> def test_active_metadata_update_unspecified(self): """Ensures nothing...
stack_v2_sparse_classes_75kplus_train_072837
29,404
permissive
[ { "docstring": "Ensures nothing happens when the entity doesn't exist.", "name": "test_not_found", "signature": "def test_not_found(self)" }, { "docstring": "Ensures nothing happens when an active metadata update is unspecified.", "name": "test_active_metadata_update_unspecified", "signa...
4
null
Implement the Python class `RescheduleActiveMetadataUpdateTest` described below. Class description: Tests for metadata.reschedule_active_metadata_update. Method signatures and docstrings: - def test_not_found(self): Ensures nothing happens when the entity doesn't exist. - def test_active_metadata_update_unspecified(s...
Implement the Python class `RescheduleActiveMetadataUpdateTest` described below. Class description: Tests for metadata.reschedule_active_metadata_update. Method signatures and docstrings: - def test_not_found(self): Ensures nothing happens when the entity doesn't exist. - def test_active_metadata_update_unspecified(s...
3fa4c520dddd82ed190152709e0a54b35faa3bae
<|skeleton|> class RescheduleActiveMetadataUpdateTest: """Tests for metadata.reschedule_active_metadata_update.""" def test_not_found(self): """Ensures nothing happens when the entity doesn't exist.""" <|body_0|> def test_active_metadata_update_unspecified(self): """Ensures nothing...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RescheduleActiveMetadataUpdateTest: """Tests for metadata.reschedule_active_metadata_update.""" def test_not_found(self): """Ensures nothing happens when the entity doesn't exist.""" key = ndb.Key(models.Instance, 'fake-key') metadata.reschedule_active_metadata_update(key, 'url') ...
the_stack_v2_python_sparse
appengine/gce-backend/metadata_test.py
Slayo2008/New2
train
1
bf2007a9d519c1ef8356ea1a687cbc5399279d61
[ "start_time = datetime.now()\ntitle = cls.get_parameter('title', required=True, location=['json', 'form'])\ndesc = cls.get_parameter('desc', location=['json', 'form'])\nBaseController().create_task(index_id=index, task_id=task, title=title, desc=desc)\nresponse_data = dict(index=index, task=task, title=title, desc=...
<|body_start_0|> start_time = datetime.now() title = cls.get_parameter('title', required=True, location=['json', 'form']) desc = cls.get_parameter('desc', location=['json', 'form']) BaseController().create_task(index_id=index, task_id=task, title=title, desc=desc) response_data =...
Task相关资源接口
TaskResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskResource: """Task相关资源接口""" def post(cls, index, task): """新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应""" <|body_0|> def delete(cls, index, task): """删除一个task :param index: Task所属的index :param task: Task的id :return: 删除成功响应""" ...
stack_v2_sparse_classes_75kplus_train_072838
3,892
permissive
[ { "docstring": "新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应", "name": "post", "signature": "def post(cls, index, task)" }, { "docstring": "删除一个task :param index: Task所属的index :param task: Task的id :return: 删除成功响应", "name": "delete", "signature": "def delete(cl...
5
stack_v2_sparse_classes_30k_train_052727
Implement the Python class `TaskResource` described below. Class description: Task相关资源接口 Method signatures and docstrings: - def post(cls, index, task): 新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应 - def delete(cls, index, task): 删除一个task :param index: Task所属的index :param task: Task的id :re...
Implement the Python class `TaskResource` described below. Class description: Task相关资源接口 Method signatures and docstrings: - def post(cls, index, task): 新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应 - def delete(cls, index, task): 删除一个task :param index: Task所属的index :param task: Task的id :re...
3d50d3854a087eecaf45a744ddfe2fa2e225951a
<|skeleton|> class TaskResource: """Task相关资源接口""" def post(cls, index, task): """新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应""" <|body_0|> def delete(cls, index, task): """删除一个task :param index: Task所属的index :param task: Task的id :return: 删除成功响应""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskResource: """Task相关资源接口""" def post(cls, index, task): """新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应""" start_time = datetime.now() title = cls.get_parameter('title', required=True, location=['json', 'form']) desc = cls.get_parameter('desc...
the_stack_v2_python_sparse
App/apis/TaskResource.py
PhenomingZ/dicer2
train
1
13fd04895ddf33751a92afca4c0c14529f454ebb
[ "user = validate_token(request.headers.get('Authorization'))\nif user is not None:\n all = request.GET.get('all', None)\n if all in [True, 'true', 'True'] and user.is_superuser is True:\n queryset = UserCoin.objects.all()\n else:\n queryset = UserCoin.objects.filter(user=user.id)\n seriali...
<|body_start_0|> user = validate_token(request.headers.get('Authorization')) if user is not None: all = request.GET.get('all', None) if all in [True, 'true', 'True'] and user.is_superuser is True: queryset = UserCoin.objects.all() else: ...
API user coin relation
UserCoinApiView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCoinApiView: """API user coin relation""" def get(self, request, format=None): """get all user coin relation""" <|body_0|> def post(self, request): """join user and coins""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = validate_token(...
stack_v2_sparse_classes_75kplus_train_072839
6,385
no_license
[ { "docstring": "get all user coin relation", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "join user and coins", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `UserCoinApiView` described below. Class description: API user coin relation Method signatures and docstrings: - def get(self, request, format=None): get all user coin relation - def post(self, request): join user and coins
Implement the Python class `UserCoinApiView` described below. Class description: API user coin relation Method signatures and docstrings: - def get(self, request, format=None): get all user coin relation - def post(self, request): join user and coins <|skeleton|> class UserCoinApiView: """API user coin relation"...
05863858a09a25cf0d34e855e7e9c4a2569d1978
<|skeleton|> class UserCoinApiView: """API user coin relation""" def get(self, request, format=None): """get all user coin relation""" <|body_0|> def post(self, request): """join user and coins""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserCoinApiView: """API user coin relation""" def get(self, request, format=None): """get all user coin relation""" user = validate_token(request.headers.get('Authorization')) if user is not None: all = request.GET.get('all', None) if all in [True, 'true', ...
the_stack_v2_python_sparse
backend/users_coins_api/views.py
edwardforero/reto-ripio
train
0
5eda071cd9233e924464d81ffef01b0d406a58b7
[ "vals = []\n\ndef preorder(node):\n if node:\n vals.append(str(node.val))\n for child in node.children:\n preorder(child)\n vals.append('#')\npreorder(root)\nreturn ' '.join(vals)", "if not data:\n return None\nstream = iter(data.split())\nval = int(next(stream))\nroot = Node...
<|body_start_0|> vals = [] def preorder(node): if node: vals.append(str(node.val)) for child in node.children: preorder(child) vals.append('#') preorder(root) return ' '.join(vals) <|end_body_0|> <|body_sta...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_072840
1,297
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
2
stack_v2_sparse_classes_30k_train_054451
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
3719f5cb059eefd66b83eb8ae990652f4b7fd124
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" vals = [] def preorder(node): if node: vals.append(str(node.val)) for child in node.children: preorder(child) ...
the_stack_v2_python_sparse
Python3/0428-Serialize-and-Deserialize-N-ary-Tree/soln-1.py
wyaadarsh/LeetCode-Solutions
train
0
f7896360b1176c5b14b793cece3ab81321262c09
[ "assert length > 0\nself.length = length\nself.reset()", "self.history = []\nself.val = 0.0\nself.avg = 0.0", "if isinstance(val, torch.Tensor):\n val = val.item()\nassert isinstance(val, list) or isinstance(val, numbers.Integral) or isinstance(val, numbers.Real)\nself.history.append(val)\nif len(self.histor...
<|body_start_0|> assert length > 0 self.length = length self.reset() <|end_body_0|> <|body_start_1|> self.history = [] self.val = 0.0 self.avg = 0.0 <|end_body_1|> <|body_start_2|> if isinstance(val, torch.Tensor): val = val.item() assert isi...
Overview: Computes and stores the average and current value, scalar and 1D-array Interface: __init__, reset, update
AverageMeter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AverageMeter: """Overview: Computes and stores the average and current value, scalar and 1D-array Interface: __init__, reset, update""" def __init__(self, length=0): """Overview: init AverageMeter class Arguments: - length (:obj:`int`) : set the default length of iters to average""" ...
stack_v2_sparse_classes_75kplus_train_072841
19,939
permissive
[ { "docstring": "Overview: init AverageMeter class Arguments: - length (:obj:`int`) : set the default length of iters to average", "name": "__init__", "signature": "def __init__(self, length=0)" }, { "docstring": "Overview: reset AverageMeter class", "name": "reset", "signature": "def res...
3
null
Implement the Python class `AverageMeter` described below. Class description: Overview: Computes and stores the average and current value, scalar and 1D-array Interface: __init__, reset, update Method signatures and docstrings: - def __init__(self, length=0): Overview: init AverageMeter class Arguments: - length (:ob...
Implement the Python class `AverageMeter` described below. Class description: Overview: Computes and stores the average and current value, scalar and 1D-array Interface: __init__, reset, update Method signatures and docstrings: - def __init__(self, length=0): Overview: init AverageMeter class Arguments: - length (:ob...
09d507c412235a2f0cf9c0b3485ec9ed15fb6421
<|skeleton|> class AverageMeter: """Overview: Computes and stores the average and current value, scalar and 1D-array Interface: __init__, reset, update""" def __init__(self, length=0): """Overview: init AverageMeter class Arguments: - length (:obj:`int`) : set the default length of iters to average""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AverageMeter: """Overview: Computes and stores the average and current value, scalar and 1D-array Interface: __init__, reset, update""" def __init__(self, length=0): """Overview: init AverageMeter class Arguments: - length (:obj:`int`) : set the default length of iters to average""" asser...
the_stack_v2_python_sparse
ctools/utils/log_helper.py
LFhase/DI-star
train
1
61a04c4d382f5dfe80c3384ec7277519399addc6
[ "self.load_date = load_date\nself.verbose = verbose\nif isinstance(self.load_date, str):\n self.load_date = pd.to_datetime(self.load_date)\nif isinstance(self.load_date, pd.Timestamp):\n self.doy = int(self.load_date.dayofyear)\nelif isinstance(self.load_date, (datetime, date)):\n self.doy = int(self.load_...
<|body_start_0|> self.load_date = load_date self.verbose = verbose if isinstance(self.load_date, str): self.load_date = pd.to_datetime(self.load_date) if isinstance(self.load_date, pd.Timestamp): self.doy = int(self.load_date.dayofyear) elif isinstance(sel...
Load_SAMPEX_Attitude
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Load_SAMPEX_Attitude: def __init__(self, load_date, verbose=False): """This class loads the appropriate SAMEX attitude file, parses the complex header and converts the time columns into datetime objects""" <|body_0|> def find_matching_attitude_file(self): """Uses pat...
stack_v2_sparse_classes_75kplus_train_072842
10,167
permissive
[ { "docstring": "This class loads the appropriate SAMEX attitude file, parses the complex header and converts the time columns into datetime objects", "name": "__init__", "signature": "def __init__(self, load_date, verbose=False)" }, { "docstring": "Uses pathlib.rglob to find the attitude file th...
5
stack_v2_sparse_classes_30k_train_037550
Implement the Python class `Load_SAMPEX_Attitude` described below. Class description: Implement the Load_SAMPEX_Attitude class. Method signatures and docstrings: - def __init__(self, load_date, verbose=False): This class loads the appropriate SAMEX attitude file, parses the complex header and converts the time column...
Implement the Python class `Load_SAMPEX_Attitude` described below. Class description: Implement the Load_SAMPEX_Attitude class. Method signatures and docstrings: - def __init__(self, load_date, verbose=False): This class loads the appropriate SAMEX attitude file, parses the complex header and converts the time column...
916a24f072034fea4680ab13f98d967d2ecfcf5d
<|skeleton|> class Load_SAMPEX_Attitude: def __init__(self, load_date, verbose=False): """This class loads the appropriate SAMEX attitude file, parses the complex header and converts the time columns into datetime objects""" <|body_0|> def find_matching_attitude_file(self): """Uses pat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Load_SAMPEX_Attitude: def __init__(self, load_date, verbose=False): """This class loads the appropriate SAMEX attitude file, parses the complex header and converts the time columns into datetime objects""" self.load_date = load_date self.verbose = verbose if isinstance(self.loa...
the_stack_v2_python_sparse
sampex_microburst_widths/misc/load_hilt_data.py
mshumko/sampex_microburst_widths
train
0
7016a21fda554472eef57a66d3b8bb72b6fbed3a
[ "super(Criterion, self).__init__()\nself.tan_angular_margin = np.tan(np.pi / 180 * opt.loss_angular_alpha)\nself.lam = opt.loss_angular_npair_ang_weight\nself.l2_weight = opt.loss_angular_npair_l2\nself.batchminer = batchminer\nself.name = 'angular'", "anchors, positives, negatives = self.batchminer(batch, labels...
<|body_start_0|> super(Criterion, self).__init__() self.tan_angular_margin = np.tan(np.pi / 180 * opt.loss_angular_alpha) self.lam = opt.loss_angular_npair_ang_weight self.l2_weight = opt.loss_angular_npair_l2 self.batchminer = batchminer self.name = 'angular' <|end_body_...
Criterion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Criterion: def __init__(self, opt, batchminer): """Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training.""" <|body_0|> def forward(self, batch, labels...
stack_v2_sparse_classes_75kplus_train_072843
2,596
permissive
[ { "docstring": "Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training.", "name": "__init__", "signature": "def __init__(self, opt, batchminer)" }, { "docstring": "Args: bat...
2
null
Implement the Python class `Criterion` described below. Class description: Implement the Criterion class. Method signatures and docstrings: - def __init__(self, opt, batchminer): Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Numbe...
Implement the Python class `Criterion` described below. Class description: Implement the Criterion class. Method signatures and docstrings: - def __init__(self, opt, batchminer): Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Numbe...
01a7220bac7ebb1e70416ef663f3ba7cee9e8bf5
<|skeleton|> class Criterion: def __init__(self, opt, batchminer): """Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training.""" <|body_0|> def forward(self, batch, labels...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Criterion: def __init__(self, opt, batchminer): """Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training.""" super(Criterion, self).__init__() self.tan_angular_ma...
the_stack_v2_python_sparse
criteria/angular.py
chenyanlinzhugoushou/DCML
train
0
d7159805acca800515479ff894aa025129c26e83
[ "def preorder(node):\n l = []\n r = []\n if not node:\n return [None]\n l = preorder(node.left)\n r = preorder(node.right)\n return [node.val] + l + r\nres = [str(i) for i in preorder(root)]\nreturn ','.join(res)", "q = data.split(',')\n\ndef buildTree(q):\n curr = q.pop(0)\n if cur...
<|body_start_0|> def preorder(node): l = [] r = [] if not node: return [None] l = preorder(node.left) r = preorder(node.right) return [node.val] + l + r res = [str(i) for i in preorder(root)] return ','.join(...
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_75kplus_train_072844
1,255
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_052163
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:...
792c6bca54ac34b47b8c30b19600c18de877a832
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def preorder(node): l = [] r = [] if not node: return [None] l = preorder(node.left) r = preorder(node.right) ...
the_stack_v2_python_sparse
RANDOM/serialize_deserialize_bt.py
salonikalsekar/2021_Learn
train
0
f8e035b9b474e6fe48f26bd751f494f141c91db0
[ "if obstacleGrid[0][0]:\n return 0\nrow = len(obstacleGrid)\ncol = len(obstacleGrid[0])\nres = [[0 for _ in range(col)] for _ in range(row)]\nfor i in range(row):\n if not obstacleGrid[i][0]:\n res[i][0] = 1\n else:\n break\nfor i in range(col):\n if not obstacleGrid[0][i]:\n res[0]...
<|body_start_0|> if obstacleGrid[0][0]: return 0 row = len(obstacleGrid) col = len(obstacleGrid[0]) res = [[0 for _ in range(col)] for _ in range(row)] for i in range(row): if not obstacleGrid[i][0]: res[i][0] = 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePathsWithObstacles(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]""" <|body_0|> def uniquePathsWithObstacles2(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int""" ...
stack_v2_sparse_classes_75kplus_train_072845
2,225
no_license
[ { "docstring": ":type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]", "name": "uniquePathsWithObstacles", "signature": "def uniquePathsWithObstacles(self, obstacleGrid)" }, { "docstring": ":type obstacleGrid: List[List[int]] :rtype: int", "name": "uniquePathsW...
2
stack_v2_sparse_classes_30k_train_007925
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1] - def uniquePathsWithObstacles2(self, obstac...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1] - def uniquePathsWithObstacles2(self, obstac...
013f6f222c6c2a617787b258f8a37003a9f51526
<|skeleton|> class Solution: def uniquePathsWithObstacles(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]""" <|body_0|> def uniquePathsWithObstacles2(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def uniquePathsWithObstacles(self, obstacleGrid): """:type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]""" if obstacleGrid[0][0]: return 0 row = len(obstacleGrid) col = len(obstacleGrid[0]) res = [[0 for _ in range(...
the_stack_v2_python_sparse
dp/unique_paths_withobstacles.py
terrifyzhao/leetcode
train
0
f1dacaa1405a2fcbe13f11f80472341143ebff7d
[ "self.ctype = 'column_apply'\n'str: type of data processor'\nself.key = key\nself.lam = lam\nself.dtype = self.typecast(dtype)", "lam_arg[self.key] = lam_arg[self.key].apply(self.lam)\nlam_arg[self.key] = lam_arg[self.key].astype(self.dtype)\nreturn lam_arg" ]
<|body_start_0|> self.ctype = 'column_apply' 'str: type of data processor' self.key = key self.lam = lam self.dtype = self.typecast(dtype) <|end_body_0|> <|body_start_1|> lam_arg[self.key] = lam_arg[self.key].apply(self.lam) lam_arg[self.key] = lam_arg[self.key]....
Used to apply a function across the rows in a column of a DataFrame
ColumnApply
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnApply: """Used to apply a function across the rows in a column of a DataFrame""" def __init__(self, key: str, lam: Callable[[Any], Any], dtype: Any): """Creates a ColumnApply Object Args: key: The column to apply the function to lam: The function to apply dtype: The python nati...
stack_v2_sparse_classes_75kplus_train_072846
1,905
permissive
[ { "docstring": "Creates a ColumnApply Object Args: key: The column to apply the function to lam: The function to apply dtype: The python native type of the function output", "name": "__init__", "signature": "def __init__(self, key: str, lam: Callable[[Any], Any], dtype: Any)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_005220
Implement the Python class `ColumnApply` described below. Class description: Used to apply a function across the rows in a column of a DataFrame Method signatures and docstrings: - def __init__(self, key: str, lam: Callable[[Any], Any], dtype: Any): Creates a ColumnApply Object Args: key: The column to apply the func...
Implement the Python class `ColumnApply` described below. Class description: Used to apply a function across the rows in a column of a DataFrame Method signatures and docstrings: - def __init__(self, key: str, lam: Callable[[Any], Any], dtype: Any): Creates a ColumnApply Object Args: key: The column to apply the func...
8c8b14280441f5153ff146c23359a0eb91022ddb
<|skeleton|> class ColumnApply: """Used to apply a function across the rows in a column of a DataFrame""" def __init__(self, key: str, lam: Callable[[Any], Any], dtype: Any): """Creates a ColumnApply Object Args: key: The column to apply the function to lam: The function to apply dtype: The python nati...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ColumnApply: """Used to apply a function across the rows in a column of a DataFrame""" def __init__(self, key: str, lam: Callable[[Any], Any], dtype: Any): """Creates a ColumnApply Object Args: key: The column to apply the function to lam: The function to apply dtype: The python native type of th...
the_stack_v2_python_sparse
src/api2db/ingest/post_process/column_apply.py
TristenHarr/api2db
train
46
3b942947bf45003b6be4fd779653d3b9bf262773
[ "self.leads = []\nself.times = times\ncount = {}\nlead = -1\nfor p, t in zip(persons, times):\n count[p] = count.get(p, 0) + 1\n if count.get(lead, 0) <= count[p]:\n lead = p\n self.leads.append(lead)", "left = 0\nright = len(self.times) - 1\nwhile left <= right:\n mid = (left + right) // 2\n ...
<|body_start_0|> self.leads = [] self.times = times count = {} lead = -1 for p, t in zip(persons, times): count[p] = count.get(p, 0) + 1 if count.get(lead, 0) <= count[p]: lead = p self.leads.append(lead) <|end_body_0|> <|body_...
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.leads = [] self.times = ...
stack_v2_sparse_classes_75kplus_train_072847
879
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
stack_v2_sparse_classes_30k_train_028277
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...
6d361cad2821248350f1d8432fdfef86895ca281
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" self.leads = [] self.times = times count = {} lead = -1 for p, t in zip(persons, times): count[p] = count.get(p, 0) + 1 if count....
the_stack_v2_python_sparse
Binary Search/onlineElection.py
tr1503/LeetCode
train
0
9fa6f4fcc902ec6f654df3cbcfff050e01c1e997
[ "client = test_client.TestClient(context.node['baseurl'])\npid = object_info.identifier.value()\nresponse = client.get(context.TOKEN, pid)\nchecksum_from_get = test_utilities.calculate_checksum_on_string(response, object_info.checksum.algorithm)\nassert object_info.checksum.value() == checksum_from_get\nresponse = ...
<|body_start_0|> client = test_client.TestClient(context.node['baseurl']) pid = object_info.identifier.value() response = client.get(context.TOKEN, pid) checksum_from_get = test_utilities.calculate_checksum_on_string(response, object_info.checksum.algorithm) assert object_info.ch...
Test050Get
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" <|body_0|> def test_010_get_object_by_invalid_pid(self): """404 NotFound when attempting to get non-existing object.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_072848
2,629
permissive
[ { "docstring": "Get object and verify retrieved information against its ObjectInfo.", "name": "validate_object", "signature": "def validate_object(self, object_info)" }, { "docstring": "404 NotFound when attempting to get non-existing object.", "name": "test_010_get_object_by_invalid_pid", ...
3
stack_v2_sparse_classes_30k_train_034365
Implement the Python class `Test050Get` described below. Class description: Implement the Test050Get class. Method signatures and docstrings: - def validate_object(self, object_info): Get object and verify retrieved information against its ObjectInfo. - def test_010_get_object_by_invalid_pid(self): 404 NotFound when ...
Implement the Python class `Test050Get` described below. Class description: Implement the Test050Get class. Method signatures and docstrings: - def validate_object(self, object_info): Get object and verify retrieved information against its ObjectInfo. - def test_010_get_object_by_invalid_pid(self): 404 NotFound when ...
d72a9461894d9be7d71178fb7310101b8ef9066a
<|skeleton|> class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" <|body_0|> def test_010_get_object_by_invalid_pid(self): """404 NotFound when attempting to get non-existing object.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" client = test_client.TestClient(context.node['baseurl']) pid = object_info.identifier.value() response = client.get(context.TOKEN, pid) checksum...
the_stack_v2_python_sparse
test_utilities/src/d1_test/stress_tester/projects/_unit_test_bases_for_stress_tests/tier_1_mn_read_get.py
DataONEorg/d1_python
train
15
28021ac69c06105417413a442f0e3985354d5fee
[ "parent = self.ancestor.ancestor.ancestor\nif self.relation == self.absolute:\n pqu = PQUModule.PQU(self.value, parent.unit)\n if unit is not None:\n pqu.convertToUnit(unit)\nelse:\n pqu = self.value * parent.pqu(unit)\n if self.relation == self.percent:\n pqu /= 100\nreturn pqu", "if no...
<|body_start_0|> parent = self.ancestor.ancestor.ancestor if self.relation == self.absolute: pqu = PQUModule.PQU(self.value, parent.unit) if unit is not None: pqu.convertToUnit(unit) else: pqu = self.value * parent.pqu(unit) if self...
This is an abstract base class for number quantities. This class adds the pqu and float methods.
Number
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Number: """This is an abstract base class for number quantities. This class adds the pqu and float methods.""" def pqu(self, unit=None): """Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.""" <|body_0|> def float(self, unit):...
stack_v2_sparse_classes_75kplus_train_072849
5,573
permissive
[ { "docstring": "Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.", "name": "pqu", "signature": "def pqu(self, unit=None)" }, { "docstring": "Returns a float instance of self's value in units of unit.", "name": "float", "signature": "def float...
2
stack_v2_sparse_classes_30k_train_001807
Implement the Python class `Number` described below. Class description: This is an abstract base class for number quantities. This class adds the pqu and float methods. Method signatures and docstrings: - def pqu(self, unit=None): Returns a PQU instance of self's value in units of unit. If unit is None, self's unit i...
Implement the Python class `Number` described below. Class description: This is an abstract base class for number quantities. This class adds the pqu and float methods. Method signatures and docstrings: - def pqu(self, unit=None): Returns a PQU instance of self's value in units of unit. If unit is None, self's unit i...
6ba80855ae47cb32c37f635d065b228fadb03412
<|skeleton|> class Number: """This is an abstract base class for number quantities. This class adds the pqu and float methods.""" def pqu(self, unit=None): """Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.""" <|body_0|> def float(self, unit):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Number: """This is an abstract base class for number quantities. This class adds the pqu and float methods.""" def pqu(self, unit=None): """Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.""" parent = self.ancestor.ancestor.ancestor if...
the_stack_v2_python_sparse
xData/uncertainty/physicalQuantity/uncertainty.py
LLNL/fudge
train
21
394de0bfa35330a8b684b72f9adf5859a1095706
[ "OrthogonalPolynomial.initialize(self, quad)\nself.printTag = 'JACOBI-ORTHOPOLY'\nself._poly = polys.jacobi\nself._evPoly = polys.eval_jacobi\nself.params = quad.params\nself.setMeasures(quad)", "if quad.type == 'Jacobi':\n self.pointMod = self.stdPointMod\n self.quad = quad\nelse:\n OrthogonalPolynomial...
<|body_start_0|> OrthogonalPolynomial.initialize(self, quad) self.printTag = 'JACOBI-ORTHOPOLY' self._poly = polys.jacobi self._evPoly = polys.eval_jacobi self.params = quad.params self.setMeasures(quad) <|end_body_0|> <|body_start_1|> if quad.type == 'Jacobi': ...
Provides polynomial Jacobi generators and evaluators for stochastic collocation.
Jacobi
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Jacobi: """Provides polynomial Jacobi generators and evaluators for stochastic collocation.""" def initialize(self, quad): """Initializes object with items not set in __init__ @ In, quad, string, quadrature object name @ Out, None""" <|body_0|> def setMeasures(self, quad...
stack_v2_sparse_classes_75kplus_train_072850
13,405
permissive
[ { "docstring": "Initializes object with items not set in __init__ @ In, quad, string, quadrature object name @ Out, None", "name": "initialize", "signature": "def initialize(self, quad)" }, { "docstring": "Implements specific measures for given quadSet. @ In, quad, Quadrature object, quadrature ...
4
stack_v2_sparse_classes_30k_train_008851
Implement the Python class `Jacobi` described below. Class description: Provides polynomial Jacobi generators and evaluators for stochastic collocation. Method signatures and docstrings: - def initialize(self, quad): Initializes object with items not set in __init__ @ In, quad, string, quadrature object name @ Out, N...
Implement the Python class `Jacobi` described below. Class description: Provides polynomial Jacobi generators and evaluators for stochastic collocation. Method signatures and docstrings: - def initialize(self, quad): Initializes object with items not set in __init__ @ In, quad, string, quadrature object name @ Out, N...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class Jacobi: """Provides polynomial Jacobi generators and evaluators for stochastic collocation.""" def initialize(self, quad): """Initializes object with items not set in __init__ @ In, quad, string, quadrature object name @ Out, None""" <|body_0|> def setMeasures(self, quad...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Jacobi: """Provides polynomial Jacobi generators and evaluators for stochastic collocation.""" def initialize(self, quad): """Initializes object with items not set in __init__ @ In, quad, string, quadrature object name @ Out, None""" OrthogonalPolynomial.initialize(self, quad) sel...
the_stack_v2_python_sparse
ravenframework/OrthoPolynomials.py
idaholab/raven
train
201
3d53c1aec4a26c471e66d8c60b20d73e7b36de34
[ "self.SUBJECT = 'MOSJA00294'\nsuper(OASEMailOnetimePasswd, self).__init__(self.MAILACC, addr_to, self.SUBJECT, '', inquiry_url, login_url, charset)\nself.create_mail_text(user_name, passwd, expire_h)", "self.MAILTEXT = get_message('MOSJA00295', self.lang_mode, showMsgId=False, user_name=user_name, passwd=passwd, ...
<|body_start_0|> self.SUBJECT = 'MOSJA00294' super(OASEMailOnetimePasswd, self).__init__(self.MAILACC, addr_to, self.SUBJECT, '', inquiry_url, login_url, charset) self.create_mail_text(user_name, passwd, expire_h) <|end_body_0|> <|body_start_1|> self.MAILTEXT = get_message('MOSJA00295',...
[クラス概要] ワンタイムパスワード通知メール
OASEMailOnetimePasswd
[ "Apache-2.0", "BSD-3-Clause", "LGPL-3.0-only", "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OASEMailOnetimePasswd: """[クラス概要] ワンタイムパスワード通知メール""" def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'): """[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str ワンタイムパスワード ...
stack_v2_sparse_classes_75kplus_train_072851
20,173
permissive
[ { "docstring": "[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str ワンタイムパスワード expire_h : int パスワード有効期間(hour) inquiry_url : str お問い合わせ画面 login_url : str ログイン画面 charset : str 文字コード", "name": "__init__", "signature": "def __init__(self, addr_from, add...
2
stack_v2_sparse_classes_30k_train_002187
Implement the Python class `OASEMailOnetimePasswd` described below. Class description: [クラス概要] ワンタイムパスワード通知メール Method signatures and docstrings: - def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'): [メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str ...
Implement the Python class `OASEMailOnetimePasswd` described below. Class description: [クラス概要] ワンタイムパスワード通知メール Method signatures and docstrings: - def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'): [メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str ...
c00ea4fe1bf4b4a18d545aabeaaf1d95c7664b94
<|skeleton|> class OASEMailOnetimePasswd: """[クラス概要] ワンタイムパスワード通知メール""" def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'): """[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str ワンタイムパスワード ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OASEMailOnetimePasswd: """[クラス概要] ワンタイムパスワード通知メール""" def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'): """[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str ワンタイムパスワード expire_h : in...
the_stack_v2_python_sparse
oase-root/libs/webcommonlibs/oase_mail.py
exastro-suite/oase
train
10
606062fb692b504b7de03579c1ef109bacfb0cbc
[ "set = {}\nfor num in nums:\n if num in set:\n set[num] = 1\n else:\n set[num] = 0\nfor num in set:\n if set[num] == 0:\n return num", "a = 0\nfor i in nums:\n a ^= i\nreturn a" ]
<|body_start_0|> set = {} for num in nums: if num in set: set[num] = 1 else: set[num] = 0 for num in set: if set[num] == 0: return num <|end_body_0|> <|body_start_1|> a = 0 for i in nums: ...
O(n) / linear time, O(n) / linear space
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """O(n) / linear time, O(n) / linear space""" def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_072852
1,245
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_009567
Implement the Python class `Solution` described below. Class description: O(n) / linear time, O(n) / linear space Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: O(n) / linear time, O(n) / linear space Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: """O...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: """O(n) / linear time, O(n) / linear space""" def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """O(n) / linear time, O(n) / linear space""" def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" set = {} for num in nums: if num in set: set[num] = 1 else: set[num] = 0 for num in set: ...
the_stack_v2_python_sparse
136-single_number.py
stevestar888/leetcode-problems
train
2
90ede9c4febc3f15833bf5a2988a1cbeb04a7660
[ "if not s and (not t):\n return True\nelif not s and t or (not t and s):\n return False\nelse:\n return self.same(s.left, t.left) and self.same(s.right, t.right) if s.val == t.val else False", "if self.same(s, t):\n return True\nleft = right = False\nif s.left:\n left = self.isSubtree(s.left, t)\ni...
<|body_start_0|> if not s and (not t): return True elif not s and t or (not t and s): return False else: return self.same(s.left, t.left) and self.same(s.right, t.right) if s.val == t.val else False <|end_body_0|> <|body_start_1|> if self.same(s, t): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def same(self, s, t): """:type s:TreeNode :type t:TreeNode :rtype: bool""" <|body_0|> def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s and (not t): ...
stack_v2_sparse_classes_75kplus_train_072853
1,039
no_license
[ { "docstring": ":type s:TreeNode :type t:TreeNode :rtype: bool", "name": "same", "signature": "def same(self, s, t)" }, { "docstring": ":type s: TreeNode :type t: TreeNode :rtype: bool", "name": "isSubtree", "signature": "def isSubtree(self, s, t)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def same(self, s, t): :type s:TreeNode :type t:TreeNode :rtype: bool - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def same(self, s, t): :type s:TreeNode :type t:TreeNode :rtype: bool - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool <|skeleton|> class Solution: ...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def same(self, s, t): """:type s:TreeNode :type t:TreeNode :rtype: bool""" <|body_0|> def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def same(self, s, t): """:type s:TreeNode :type t:TreeNode :rtype: bool""" if not s and (not t): return True elif not s and t or (not t and s): return False else: return self.same(s.left, t.left) and self.same(s.right, t.right) if s...
the_stack_v2_python_sparse
python/leetcode_bak/572_Subtree_of_Another_Tree.py
bobcaoge/my-code
train
0
b38989d148a7bdbe085c2511acd1689c1b1fa96c
[ "if minfo is None:\n minfo = {}\nsuper(ResetStatsMessage, self).__init__(minfo)\nself.IsSystemMessage = False\nself.IsForward = True\nself.IsReliable = True\nself.DomainList = minfo.get('DomainList', [])\nself.MetricList = minfo.get('MetricList', [])", "result = super(ResetStatsMessage, self).dump()\nresult['D...
<|body_start_0|> if minfo is None: minfo = {} super(ResetStatsMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True self.DomainList = minfo.get('DomainList', []) self.MetricList = minfo.get('MetricList...
Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules. IsForward (bool): Whether the message sho...
ResetStatsMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetStatsMessage: """Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rul...
stack_v2_sparse_classes_75kplus_train_072854
13,482
permissive
[ { "docstring": "Constructor for the ResetStatsMessage class. Args: minfo (dict): Dictionary of values for message fields.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Dumps a dict containing object attributes. Returns: dict: A mapping of object attribute...
2
stack_v2_sparse_classes_30k_train_022645
Implement the Python class `ResetStatsMessage` described below. Class description: Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System mess...
Implement the Python class `ResetStatsMessage` described below. Class description: Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System mess...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class ResetStatsMessage: """Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResetStatsMessage: """Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules. IsForward...
the_stack_v2_python_sparse
validator/gossip/messages/gossip_debug.py
aludvik/sawtooth-core
train
0
0d672dfa6072ecf4601b47a28bea5c6f135d9ea4
[ "n = 2\nl = 4\nm = 100\nself.matrices = [util.randomHermetian(n) for i in range(l)]\nself.integers = np.random.randint(2, 90000000.0, m)\nself.mins = [[]]\nself.maxes = [[]]\nself.means = [[]]", "for matrix in self.matrices:\n for integer in self.integers:\n temp_max = []\n temp_min = []\n ...
<|body_start_0|> n = 2 l = 4 m = 100 self.matrices = [util.randomHermetian(n) for i in range(l)] self.integers = np.random.randint(2, 90000000.0, m) self.mins = [[]] self.maxes = [[]] self.means = [[]] <|end_body_0|> <|body_start_1|> for matrix in...
NumericalTestFunm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumericalTestFunm: def setUp(self): """Creates Hermetian test matrices, instantiates means, maxes, mins lists""" <|body_0|> def test_inverse_integer(self): """Tests implementation for the case M**(1/p) where p is an integer""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_072855
1,939
no_license
[ { "docstring": "Creates Hermetian test matrices, instantiates means, maxes, mins lists", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests implementation for the case M**(1/p) where p is an integer", "name": "test_inverse_integer", "signature": "def test_inverse_in...
2
null
Implement the Python class `NumericalTestFunm` described below. Class description: Implement the NumericalTestFunm class. Method signatures and docstrings: - def setUp(self): Creates Hermetian test matrices, instantiates means, maxes, mins lists - def test_inverse_integer(self): Tests implementation for the case M**(...
Implement the Python class `NumericalTestFunm` described below. Class description: Implement the NumericalTestFunm class. Method signatures and docstrings: - def setUp(self): Creates Hermetian test matrices, instantiates means, maxes, mins lists - def test_inverse_integer(self): Tests implementation for the case M**(...
14fff0c2cc955a1faf685337dc087c4e5badc20e
<|skeleton|> class NumericalTestFunm: def setUp(self): """Creates Hermetian test matrices, instantiates means, maxes, mins lists""" <|body_0|> def test_inverse_integer(self): """Tests implementation for the case M**(1/p) where p is an integer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumericalTestFunm: def setUp(self): """Creates Hermetian test matrices, instantiates means, maxes, mins lists""" n = 2 l = 4 m = 100 self.matrices = [util.randomHermetian(n) for i in range(l)] self.integers = np.random.randint(2, 90000000.0, m) self.mins...
the_stack_v2_python_sparse
ReverseDistinguishability/scripts/test_funm.py
aarongrisez/ReverseDistinguishability
train
0
0e92e566cc1c946207b087acc0d50ae5ab978d1a
[ "self.lambtha = float(lambtha)\nif data is None:\n if self.lambtha <= 0:\n raise ValueError('lambtha must be a positive value')\nelif type(data) is not list:\n raise TypeError('data must be a list')\nelif len(data) < 2:\n raise ValueError('data must contain multiple values')\nelse:\n self.data = ...
<|body_start_0|> self.lambtha = float(lambtha) if data is None: if self.lambtha <= 0: raise ValueError('lambtha must be a positive value') elif type(data) is not list: raise TypeError('data must be a list') elif len(data) < 2: raise Val...
Exponential represents an exponential distribution
Exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exponential: """Exponential represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Args: data is a list of the data to be used to estimate the distribution. lambtha is the expected number of occurences in a given time frame.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_072856
1,723
no_license
[ { "docstring": "Args: data is a list of the data to be used to estimate the distribution. lambtha is the expected number of occurences in a given time frame.", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" }, { "docstring": "pdf - Calculates the value of the PDF f...
3
stack_v2_sparse_classes_30k_train_047895
Implement the Python class `Exponential` described below. Class description: Exponential represents an exponential distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Args: data is a list of the data to be used to estimate the distribution. lambtha is the expected number of oc...
Implement the Python class `Exponential` described below. Class description: Exponential represents an exponential distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Args: data is a list of the data to be used to estimate the distribution. lambtha is the expected number of oc...
8cd5e0f837a5c0facbf73647dcc9c6a3b1b1b9e0
<|skeleton|> class Exponential: """Exponential represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Args: data is a list of the data to be used to estimate the distribution. lambtha is the expected number of occurences in a given time frame.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Exponential: """Exponential represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Args: data is a list of the data to be used to estimate the distribution. lambtha is the expected number of occurences in a given time frame.""" self.lambtha = float(lambth...
the_stack_v2_python_sparse
math/0x03-probability/exponential.py
giovannyortegon/holbertonschool-machine_learning
train
1
0f660b7b7084aea29b98e2450469533bcd373e29
[ "\"\"\"\n :type x: int\n :rtype: bool\n \"\"\"\n\"\\n Q. Do we have negative number?\\n A. maybe, and it's not a palindrome number\\n Q. Do we have hexadecimal number?\\n A. No\\n Q. How to solve it without extra memory?\\n A.\\n \\n Probl...
<|body_start_0|> """ :type x: int :rtype: bool """ "\n Q. Do we have negative number?\n A. maybe, and it's not a palindrome number\n Q. Do we have hexadecimal number?\n A. No\n Q. How to solve it without extra memory?\n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """11507 / 11507 test cases passed. Status: Accepted Runtime: 212 ms 71.72%""" <|body_0|> def isPalindrome_compare2ends(self, x): """compare two ends 11507 / 11507 test cases passed. Status: Accepted Runtime: 236 ms 45.14%""" ...
stack_v2_sparse_classes_75kplus_train_072857
1,827
no_license
[ { "docstring": "11507 / 11507 test cases passed. Status: Accepted Runtime: 212 ms 71.72%", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": "compare two ends 11507 / 11507 test cases passed. Status: Accepted Runtime: 236 ms 45.14%", "name": "isPalindrome_com...
2
stack_v2_sparse_classes_30k_val_000399
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): 11507 / 11507 test cases passed. Status: Accepted Runtime: 212 ms 71.72% - def isPalindrome_compare2ends(self, x): compare two ends 11507 / 11507 test ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): 11507 / 11507 test cases passed. Status: Accepted Runtime: 212 ms 71.72% - def isPalindrome_compare2ends(self, x): compare two ends 11507 / 11507 test ...
5532195d25a32474aeb13b5564f26a8d2b0759db
<|skeleton|> class Solution: def isPalindrome(self, x): """11507 / 11507 test cases passed. Status: Accepted Runtime: 212 ms 71.72%""" <|body_0|> def isPalindrome_compare2ends(self, x): """compare two ends 11507 / 11507 test cases passed. Status: Accepted Runtime: 236 ms 45.14%""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPalindrome(self, x): """11507 / 11507 test cases passed. Status: Accepted Runtime: 212 ms 71.72%""" """ :type x: int :rtype: bool """ "\n Q. Do we have negative number?\n A. maybe, and it's not a palindrome n...
the_stack_v2_python_sparse
leetcode/9_palindrome_number/solution.py
stenliao/coding_practice
train
0
0472d7093a90e3c34e739000e1c51a7bd167fd65
[ "self.name = name\nself.items = []\nself.load()", "db = TinyDB(f'maxchess_db.json')\ntable = db.table(self.name)\ntable.truncate()\ntable.insert_multiple(self.items)", "db = TinyDB(f'maxchess_db.json')\ntable = db.table(self.name)\nself.items = table.all()" ]
<|body_start_0|> self.name = name self.items = [] self.load() <|end_body_0|> <|body_start_1|> db = TinyDB(f'maxchess_db.json') table = db.table(self.name) table.truncate() table.insert_multiple(self.items) <|end_body_1|> <|body_start_2|> db = TinyDB(f'ma...
Table
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Table: def __init__(self, name): """Charge le nom de table joueurs/matchs/tournois depuis la base de donnée""" <|body_0|> def save(self): """Save all table items to the persistant db""" <|body_1|> def load(self): """Load all items from the persis...
stack_v2_sparse_classes_75kplus_train_072858
828
no_license
[ { "docstring": "Charge le nom de table joueurs/matchs/tournois depuis la base de donnée", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Save all table items to the persistant db", "name": "save", "signature": "def save(self)" }, { "docstring": "Lo...
3
stack_v2_sparse_classes_30k_train_050703
Implement the Python class `Table` described below. Class description: Implement the Table class. Method signatures and docstrings: - def __init__(self, name): Charge le nom de table joueurs/matchs/tournois depuis la base de donnée - def save(self): Save all table items to the persistant db - def load(self): Load all...
Implement the Python class `Table` described below. Class description: Implement the Table class. Method signatures and docstrings: - def __init__(self, name): Charge le nom de table joueurs/matchs/tournois depuis la base de donnée - def save(self): Save all table items to the persistant db - def load(self): Load all...
38ac2de90e891acdd9af42aab53488dd8db5b691
<|skeleton|> class Table: def __init__(self, name): """Charge le nom de table joueurs/matchs/tournois depuis la base de donnée""" <|body_0|> def save(self): """Save all table items to the persistant db""" <|body_1|> def load(self): """Load all items from the persis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Table: def __init__(self, name): """Charge le nom de table joueurs/matchs/tournois depuis la base de donnée""" self.name = name self.items = [] self.load() def save(self): """Save all table items to the persistant db""" db = TinyDB(f'maxchess_db.json') ...
the_stack_v2_python_sparse
model/database.py
maximesoydas/maxchess
train
0
92c592b1c1b9a0fbb0d703e41acb399017898dcb
[ "s = login_xadmin\ndetails = Contract_details(s, contractNo=20090900006)\nassert details['data']['baseInfo']['contractNo'] == 20090900006\nassert details['success'] == True", "s = login_xadmin\ndetails = Contract_details(s, contractNo=200909000)\nassert details['success'] == False\nprint('66666666')\nassert '未搵到該...
<|body_start_0|> s = login_xadmin details = Contract_details(s, contractNo=20090900006) assert details['data']['baseInfo']['contractNo'] == 20090900006 assert details['success'] == True <|end_body_0|> <|body_start_1|> s = login_xadmin details = Contract_details(s, contra...
合同详情信息查询
Test_Contract_details
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_Contract_details: """合同详情信息查询""" def test_Contract_details_34(self, login_xadmin): """验证输入有效的合同编号,可对合同详情信息进行查询""" <|body_0|> def test_Contract_details_35(self, login_xadmin): """验证输入无效的合同编号,查询的合同为空""" <|body_1|> def test_Contract_details_36(self...
stack_v2_sparse_classes_75kplus_train_072859
20,573
no_license
[ { "docstring": "验证输入有效的合同编号,可对合同详情信息进行查询", "name": "test_Contract_details_34", "signature": "def test_Contract_details_34(self, login_xadmin)" }, { "docstring": "验证输入无效的合同编号,查询的合同为空", "name": "test_Contract_details_35", "signature": "def test_Contract_details_35(self, login_xadmin)" },...
3
stack_v2_sparse_classes_30k_train_017299
Implement the Python class `Test_Contract_details` described below. Class description: 合同详情信息查询 Method signatures and docstrings: - def test_Contract_details_34(self, login_xadmin): 验证输入有效的合同编号,可对合同详情信息进行查询 - def test_Contract_details_35(self, login_xadmin): 验证输入无效的合同编号,查询的合同为空 - def test_Contract_details_36(self, lo...
Implement the Python class `Test_Contract_details` described below. Class description: 合同详情信息查询 Method signatures and docstrings: - def test_Contract_details_34(self, login_xadmin): 验证输入有效的合同编号,可对合同详情信息进行查询 - def test_Contract_details_35(self, login_xadmin): 验证输入无效的合同编号,查询的合同为空 - def test_Contract_details_36(self, lo...
196ebbddaad6ee2acaf6b2b6ba40c856af2a35c3
<|skeleton|> class Test_Contract_details: """合同详情信息查询""" def test_Contract_details_34(self, login_xadmin): """验证输入有效的合同编号,可对合同详情信息进行查询""" <|body_0|> def test_Contract_details_35(self, login_xadmin): """验证输入无效的合同编号,查询的合同为空""" <|body_1|> def test_Contract_details_36(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_Contract_details: """合同详情信息查询""" def test_Contract_details_34(self, login_xadmin): """验证输入有效的合同编号,可对合同详情信息进行查询""" s = login_xadmin details = Contract_details(s, contractNo=20090900006) assert details['data']['baseInfo']['contractNo'] == 20090900006 assert deta...
the_stack_v2_python_sparse
case/VC_project/Annual_contract/test_annual_contract.py
wuyouyaun/django_templte
train
0
abe78fe2a7a62e6b4cada02be55bb40f1fdc550e
[ "super(BasicCv, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass)\nK_sp = self.get_parameter_from_exponent('K_sp')\nlinear_diffusivity = self._length_factor ** 2.0 * self.get_parameter_from_exponent('linear_diffusivity')\nself.climate_factor = self.params['climate_fac...
<|body_start_0|> super(BasicCv, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass) K_sp = self.get_parameter_from_exponent('K_sp') linear_diffusivity = self._length_factor ** 2.0 * self.get_parameter_from_exponent('linear_diffusivity') self....
A BasicCV computes erosion using linear diffusion, basic stream power, and Q~A. It also has basic climate change
BasicCv
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicCv: """A BasicCV computes erosion using linear diffusion, basic stream power, and Q~A. It also has basic climate change""" def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): """Initialize the BasicCv model.""" <|body_0|> def run_one_step(s...
stack_v2_sparse_classes_75kplus_train_072860
3,438
permissive
[ { "docstring": "Initialize the BasicCv model.", "name": "__init__", "signature": "def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None)" }, { "docstring": "Advance model for one time-step of duration dt.", "name": "run_one_step", "signature": "def run_one_step(self...
2
stack_v2_sparse_classes_30k_train_041480
Implement the Python class `BasicCv` described below. Class description: A BasicCV computes erosion using linear diffusion, basic stream power, and Q~A. It also has basic climate change Method signatures and docstrings: - def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): Initialize the Bas...
Implement the Python class `BasicCv` described below. Class description: A BasicCV computes erosion using linear diffusion, basic stream power, and Q~A. It also has basic climate change Method signatures and docstrings: - def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): Initialize the Bas...
1b756477b8a8ab6a8f1275b1b30ec84855c840ea
<|skeleton|> class BasicCv: """A BasicCV computes erosion using linear diffusion, basic stream power, and Q~A. It also has basic climate change""" def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): """Initialize the BasicCv model.""" <|body_0|> def run_one_step(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicCv: """A BasicCV computes erosion using linear diffusion, basic stream power, and Q~A. It also has basic climate change""" def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): """Initialize the BasicCv model.""" super(BasicCv, self).__init__(input_file=input_...
the_stack_v2_python_sparse
terrainbento/derived_models/model_CCC_basicCv/model_CCC_basicCv.py
mcflugen/terrainbento
train
0
ebf37d5b11aa0bbedc85cdbd4d6eddc8c656c46e
[ "if type(dateTime) == datetime.datetime:\n return dateTime.isoformat()\nraise ValueError('dateTime value must be a datetime.datetime instance')", "if type(date) == datetime.date:\n return date.strftime('%m%Y')\nraise ValueError('date value must be a datetime.date instance')", "if amount is None or amount ...
<|body_start_0|> if type(dateTime) == datetime.datetime: return dateTime.isoformat() raise ValueError('dateTime value must be a datetime.datetime instance') <|end_body_0|> <|body_start_1|> if type(date) == datetime.date: return date.strftime('%m%Y') raise ValueEr...
Converts fields to the paypal required format.
FormatFields
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormatFields: """Converts fields to the paypal required format.""" def get_datetime_field(self, dateTime): """This method is used inside main classes, if any classes needs date argument you can use Python datetime.datetime. In short - you will not need to use this method. Paypal need...
stack_v2_sparse_classes_75kplus_train_072861
3,991
no_license
[ { "docstring": "This method is used inside main classes, if any classes needs date argument you can use Python datetime.datetime. In short - you will not need to use this method. Paypal needs Coordinated Universal Time (UTC/GMT), using ISO 8601 format, and of type ns:dateTime for Date/Time formats. An example d...
3
stack_v2_sparse_classes_30k_train_047329
Implement the Python class `FormatFields` described below. Class description: Converts fields to the paypal required format. Method signatures and docstrings: - def get_datetime_field(self, dateTime): This method is used inside main classes, if any classes needs date argument you can use Python datetime.datetime. In ...
Implement the Python class `FormatFields` described below. Class description: Converts fields to the paypal required format. Method signatures and docstrings: - def get_datetime_field(self, dateTime): This method is used inside main classes, if any classes needs date argument you can use Python datetime.datetime. In ...
36573ab5b9ee305679ceba097b2953f52be670e4
<|skeleton|> class FormatFields: """Converts fields to the paypal required format.""" def get_datetime_field(self, dateTime): """This method is used inside main classes, if any classes needs date argument you can use Python datetime.datetime. In short - you will not need to use this method. Paypal need...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FormatFields: """Converts fields to the paypal required format.""" def get_datetime_field(self, dateTime): """This method is used inside main classes, if any classes needs date argument you can use Python datetime.datetime. In short - you will not need to use this method. Paypal needs Coordinated...
the_stack_v2_python_sparse
modules/paypalnvp/util.py
acidjunk/web2py-paypal
train
2
af990f654bb0d4bce5429d2399ea308da3c683a8
[ "login(self)\nself.selenium.find_element_by_link_text(\"Page d'accueil du site\").click()\nwait = WebDriverWait(self.selenium, 10)\nwait.until(EC.number_of_windows_to_be(2))\ndefault_handle = self.selenium.current_window_handle\nself.selenium.switch_to_window(self.selenium.window_handles[1])\nheader_title = self.se...
<|body_start_0|> login(self) self.selenium.find_element_by_link_text("Page d'accueil du site").click() wait = WebDriverWait(self.selenium, 10) wait.until(EC.number_of_windows_to_be(2)) default_handle = self.selenium.current_window_handle self.selenium.switch_to_window(sel...
Tests for the manager login and logout
BrowseManagerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowseManagerTests: """Tests for the manager login and logout""" def test_navbar(self): """test for the navbar manager""" <|body_0|> def test_dashboard(self): """test for the dasboard links""" <|body_1|> <|end_skeleton|> <|body_start_0|> login(s...
stack_v2_sparse_classes_75kplus_train_072862
5,021
no_license
[ { "docstring": "test for the navbar manager", "name": "test_navbar", "signature": "def test_navbar(self)" }, { "docstring": "test for the dasboard links", "name": "test_dashboard", "signature": "def test_dashboard(self)" } ]
2
stack_v2_sparse_classes_30k_train_001581
Implement the Python class `BrowseManagerTests` described below. Class description: Tests for the manager login and logout Method signatures and docstrings: - def test_navbar(self): test for the navbar manager - def test_dashboard(self): test for the dasboard links
Implement the Python class `BrowseManagerTests` described below. Class description: Tests for the manager login and logout Method signatures and docstrings: - def test_navbar(self): test for the navbar manager - def test_dashboard(self): test for the dasboard links <|skeleton|> class BrowseManagerTests: """Tests...
43f808ecaf3ef0294912009b05d4ab583d457559
<|skeleton|> class BrowseManagerTests: """Tests for the manager login and logout""" def test_navbar(self): """test for the navbar manager""" <|body_0|> def test_dashboard(self): """test for the dasboard links""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BrowseManagerTests: """Tests for the manager login and logout""" def test_navbar(self): """test for the navbar manager""" login(self) self.selenium.find_element_by_link_text("Page d'accueil du site").click() wait = WebDriverWait(self.selenium, 10) wait.until(EC.num...
the_stack_v2_python_sparse
managingapp/tests.py
JBthePenguin/PoilAuNezWebApp
train
0
a97198722f52db4946a40cc6fb43901061f19a98
[ "ar = np.empty(i.shape, dtype=ClassificationType)\nar['i'] = i\nar['q'] = q\nar['state'] = state\nself.data[qubit] = np.rec.array(ar)", "ar = np.empty(i.shape, dtype=ClassificationType)\nar['i'] = i\nar['q'] = q\nar['state'] = state\nself.data[qubit] = np.append(self.data[qubit], np.rec.array(ar))" ]
<|body_start_0|> ar = np.empty(i.shape, dtype=ClassificationType) ar['i'] = i ar['q'] = q ar['state'] = state self.data[qubit] = np.rec.array(ar) <|end_body_0|> <|body_start_1|> ar = np.empty(i.shape, dtype=ClassificationType) ar['i'] = i ar['q'] = q ...
SingleShotClassificationData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleShotClassificationData: def register_qubit(self, qubit, state, i, q): """Store output for single qubit.""" <|body_0|> def add_data(self, qubit, state, i, q): """Store output for single qubit.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ar ...
stack_v2_sparse_classes_75kplus_train_072863
19,179
permissive
[ { "docstring": "Store output for single qubit.", "name": "register_qubit", "signature": "def register_qubit(self, qubit, state, i, q)" }, { "docstring": "Store output for single qubit.", "name": "add_data", "signature": "def add_data(self, qubit, state, i, q)" } ]
2
null
Implement the Python class `SingleShotClassificationData` described below. Class description: Implement the SingleShotClassificationData class. Method signatures and docstrings: - def register_qubit(self, qubit, state, i, q): Store output for single qubit. - def add_data(self, qubit, state, i, q): Store output for si...
Implement the Python class `SingleShotClassificationData` described below. Class description: Implement the SingleShotClassificationData class. Method signatures and docstrings: - def register_qubit(self, qubit, state, i, q): Store output for single qubit. - def add_data(self, qubit, state, i, q): Store output for si...
5015685ee8396dbf1256604d376dc2376d328cc0
<|skeleton|> class SingleShotClassificationData: def register_qubit(self, qubit, state, i, q): """Store output for single qubit.""" <|body_0|> def add_data(self, qubit, state, i, q): """Store output for single qubit.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SingleShotClassificationData: def register_qubit(self, qubit, state, i, q): """Store output for single qubit.""" ar = np.empty(i.shape, dtype=ClassificationType) ar['i'] = i ar['q'] = q ar['state'] = state self.data[qubit] = np.rec.array(ar) def add_data(se...
the_stack_v2_python_sparse
src/qibocal/protocols/characterization/classification.py
qiboteam/qibocal
train
18
295d06eed69e6e677b5fdfd8eec4f2757d7b8ef9
[ "try:\n graph = facebook.GraphAPI(access_token=auth_token)\n facebook_profile = graph.request('/me?fields=name,email')\n return facebook_profile\nexcept facebook.GraphAPIError as e:\n pass", "try:\n google_profile = id_token.verify_oauth2_token(auth_token, requests.Request())\n return google_pro...
<|body_start_0|> try: graph = facebook.GraphAPI(access_token=auth_token) facebook_profile = graph.request('/me?fields=name,email') return facebook_profile except facebook.GraphAPIError as e: pass <|end_body_0|> <|body_start_1|> try: go...
SocialAuth
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialAuth: def verify_facebook_token(auth_token): """This verify facebook token class handles both verifying and decoding of the token acquired from the facebook GraphAPI and then returns the facebook user""" <|body_0|> def verify_google_token(auth_token): """Here t...
stack_v2_sparse_classes_75kplus_train_072864
2,118
permissive
[ { "docstring": "This verify facebook token class handles both verifying and decoding of the token acquired from the facebook GraphAPI and then returns the facebook user", "name": "verify_facebook_token", "signature": "def verify_facebook_token(auth_token)" }, { "docstring": "Here there is valida...
3
stack_v2_sparse_classes_30k_train_009307
Implement the Python class `SocialAuth` described below. Class description: Implement the SocialAuth class. Method signatures and docstrings: - def verify_facebook_token(auth_token): This verify facebook token class handles both verifying and decoding of the token acquired from the facebook GraphAPI and then returns ...
Implement the Python class `SocialAuth` described below. Class description: Implement the SocialAuth class. Method signatures and docstrings: - def verify_facebook_token(auth_token): This verify facebook token class handles both verifying and decoding of the token acquired from the facebook GraphAPI and then returns ...
60c830977fa39a7eea9ab978a9ba0c3beb0c4d88
<|skeleton|> class SocialAuth: def verify_facebook_token(auth_token): """This verify facebook token class handles both verifying and decoding of the token acquired from the facebook GraphAPI and then returns the facebook user""" <|body_0|> def verify_google_token(auth_token): """Here t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SocialAuth: def verify_facebook_token(auth_token): """This verify facebook token class handles both verifying and decoding of the token acquired from the facebook GraphAPI and then returns the facebook user""" try: graph = facebook.GraphAPI(access_token=auth_token) face...
the_stack_v2_python_sparse
authors/apps/authentication/social_auth.py
andela/Ah-backend-xmen
train
4
95994913788885273e82de83f7c447c796e3a268
[ "self.Wz = np.random.normal(size=(i + h, h))\nself.bz = np.zeros((1, h))\nself.Wr = np.random.normal(size=(i + h, h))\nself.br = np.zeros((1, h))\nself.Wh = np.random.normal(size=(i + h, h))\nself.bh = np.zeros((1, h))\nself.Wy = np.random.normal(size=(h, o))\nself.by = np.zeros((1, o))", "concat = np.concatenate...
<|body_start_0|> self.Wz = np.random.normal(size=(i + h, h)) self.bz = np.zeros((1, h)) self.Wr = np.random.normal(size=(i + h, h)) self.br = np.zeros((1, h)) self.Wh = np.random.normal(size=(i + h, h)) self.bh = np.zeros((1, h)) self.Wy = np.random.normal(size=(h...
Class represenation of a gated recurrent unit
GRUCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRUCell: """Class represenation of a gated recurrent unit""" def __init__(self, i, h, o): """i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs""" <|body_0|> def forward(self, h_prev, x_t): """Pe...
stack_v2_sparse_classes_75kplus_train_072865
1,627
no_license
[ { "docstring": "i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "Performs forward propagation for one time step Returns h_next, y h_next is th...
2
null
Implement the Python class `GRUCell` described below. Class description: Class represenation of a gated recurrent unit Method signatures and docstrings: - def __init__(self, i, h, o): i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs - def forward(s...
Implement the Python class `GRUCell` described below. Class description: Class represenation of a gated recurrent unit Method signatures and docstrings: - def __init__(self, i, h, o): i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs - def forward(s...
2757c8526290197d45a4de33cda71e686ddcbf1c
<|skeleton|> class GRUCell: """Class represenation of a gated recurrent unit""" def __init__(self, i, h, o): """i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs""" <|body_0|> def forward(self, h_prev, x_t): """Pe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GRUCell: """Class represenation of a gated recurrent unit""" def __init__(self, i, h, o): """i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs""" self.Wz = np.random.normal(size=(i + h, h)) self.bz = np.zeros((1,...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/2-gru_cell.py
95ktsmith/holbertonschool-machine_learning
train
0
973ef26aef138882cf7ce8ca05b9ce384d3a0481
[ "init_parser = parser.add_parser('filter', help='Filters usermap objects by positions or areas')\ngroup = init_parser.add_mutually_exclusive_group(required=True)\ngroup.add_argument('-b', '--boundaries', metavar='<boundary>', nargs=4, help='The set of N, S, W, E boundaries input in that order', type=int)\ngroup.add...
<|body_start_0|> init_parser = parser.add_parser('filter', help='Filters usermap objects by positions or areas') group = init_parser.add_mutually_exclusive_group(required=True) group.add_argument('-b', '--boundaries', metavar='<boundary>', nargs=4, help='The set of N, S, W, E boundaries input in...
Filter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Filter: def get_argparser(cls, parser): """Returns a base parser with common arguments for the filter plugin""" <|body_0|> def run(self, args): """Executes the filter command of the uchart tool.""" <|body_1|> <|end_skeleton|> <|body_start_0|> init_p...
stack_v2_sparse_classes_75kplus_train_072866
4,445
no_license
[ { "docstring": "Returns a base parser with common arguments for the filter plugin", "name": "get_argparser", "signature": "def get_argparser(cls, parser)" }, { "docstring": "Executes the filter command of the uchart tool.", "name": "run", "signature": "def run(self, args)" } ]
2
stack_v2_sparse_classes_30k_train_031599
Implement the Python class `Filter` described below. Class description: Implement the Filter class. Method signatures and docstrings: - def get_argparser(cls, parser): Returns a base parser with common arguments for the filter plugin - def run(self, args): Executes the filter command of the uchart tool.
Implement the Python class `Filter` described below. Class description: Implement the Filter class. Method signatures and docstrings: - def get_argparser(cls, parser): Returns a base parser with common arguments for the filter plugin - def run(self, args): Executes the filter command of the uchart tool. <|skeleton|>...
a5c1ef3c35479290ed47a853b1e6f5cc5adc534a
<|skeleton|> class Filter: def get_argparser(cls, parser): """Returns a base parser with common arguments for the filter plugin""" <|body_0|> def run(self, args): """Executes the filter command of the uchart tool.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Filter: def get_argparser(cls, parser): """Returns a base parser with common arguments for the filter plugin""" init_parser = parser.add_parser('filter', help='Filters usermap objects by positions or areas') group = init_parser.add_mutually_exclusive_group(required=True) group....
the_stack_v2_python_sparse
src/uchart/feature_filter.py
VasAtanasov/uchart-cli
train
0
3395ad48072911babb9b71df9b9edf22582197da
[ "res = CM.task_by_id(task_id, cm_name=cm_name)\nres.revoke(terminate=True)\nreturn redirect(url_for('.cm_cm_task', cm_name=cm_name, task_id=task_id))", "task = CM.task_by_id(task_id, cm_name=cm_name)\ntask_status = {'status': task.status, 'task_id': task_id, 'cm_name': cm_name}\nif not task.ready():\n task_sta...
<|body_start_0|> res = CM.task_by_id(task_id, cm_name=cm_name) res.revoke(terminate=True) return redirect(url_for('.cm_cm_task', cm_name=cm_name, task_id=task_id)) <|end_body_0|> <|body_start_1|> task = CM.task_by_id(task_id, cm_name=cm_name) task_status = {'status': task.status...
CMTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMTask: def delete(self, cm_name, task_id): """Delete task based on the CM name and the task ID, and redirect the user to "cm/<string:cm_name>/task/<string:task_id>".""" <|body_0|> def get(self, cm_name, task_id): """Get task based on the CM name and the task ID, and...
stack_v2_sparse_classes_75kplus_train_072867
2,996
permissive
[ { "docstring": "Delete task based on the CM name and the task ID, and redirect the user to \"cm/<string:cm_name>/task/<string:task_id>\".", "name": "delete", "signature": "def delete(self, cm_name, task_id)" }, { "docstring": "Get task based on the CM name and the task ID, and return a dictionar...
2
stack_v2_sparse_classes_30k_train_014777
Implement the Python class `CMTask` described below. Class description: Implement the CMTask class. Method signatures and docstrings: - def delete(self, cm_name, task_id): Delete task based on the CM name and the task ID, and redirect the user to "cm/<string:cm_name>/task/<string:task_id>". - def get(self, cm_name, t...
Implement the Python class `CMTask` described below. Class description: Implement the CMTask class. Method signatures and docstrings: - def delete(self, cm_name, task_id): Delete task based on the CM name and the task ID, and redirect the user to "cm/<string:cm_name>/task/<string:task_id>". - def get(self, cm_name, t...
bb336e434afcc11463b53880558d9c314f309c0e
<|skeleton|> class CMTask: def delete(self, cm_name, task_id): """Delete task based on the CM name and the task ID, and redirect the user to "cm/<string:cm_name>/task/<string:task_id>".""" <|body_0|> def get(self, cm_name, task_id): """Get task based on the CM name and the task ID, and...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CMTask: def delete(self, cm_name, task_id): """Delete task based on the CM name and the task ID, and redirect the user to "cm/<string:cm_name>/task/<string:task_id>".""" res = CM.task_by_id(task_id, cm_name=cm_name) res.revoke(terminate=True) return redirect(url_for('.cm_cm_tas...
the_stack_v2_python_sparse
api/app/endpoints/calculation_module.py
sfrias/enermaps
train
0
4c63fbd7c64251ffc4ab2e8b269460ee951a99fd
[ "queryset = model_admin.queryset(request)\nresults = queryset.values_list('ip__country').order_by('ip__country').distinct()\ndata = ((code[0] or 'none', dict(COUNTRIES).get(code[0], _('None'))) for code in results if code[0] not in ['None', ''])\nreturn data", "value = self.value()\nif value == 'none':\n retur...
<|body_start_0|> queryset = model_admin.queryset(request) results = queryset.values_list('ip__country').order_by('ip__country').distinct() data = ((code[0] or 'none', dict(COUNTRIES).get(code[0], _('None'))) for code in results if code[0] not in ['None', '']) return data <|end_body_0|> ...
Filtre admin des pays des IP des accès
AccessIPCountryFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessIPCountryFilter: """Filtre admin des pays des IP des accès""" def lookups(self, request, model_admin): """Renvoyer les options de pays""" <|body_0|> def queryset(self, request, queryset): """Filtrer le queryset par le pays sélectionné""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_072868
1,802
no_license
[ { "docstring": "Renvoyer les options de pays", "name": "lookups", "signature": "def lookups(self, request, model_admin)" }, { "docstring": "Filtrer le queryset par le pays sélectionné", "name": "queryset", "signature": "def queryset(self, request, queryset)" } ]
2
stack_v2_sparse_classes_30k_train_050578
Implement the Python class `AccessIPCountryFilter` described below. Class description: Filtre admin des pays des IP des accès Method signatures and docstrings: - def lookups(self, request, model_admin): Renvoyer les options de pays - def queryset(self, request, queryset): Filtrer le queryset par le pays sélectionné
Implement the Python class `AccessIPCountryFilter` described below. Class description: Filtre admin des pays des IP des accès Method signatures and docstrings: - def lookups(self, request, model_admin): Renvoyer les options de pays - def queryset(self, request, queryset): Filtrer le queryset par le pays sélectionné ...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class AccessIPCountryFilter: """Filtre admin des pays des IP des accès""" def lookups(self, request, model_admin): """Renvoyer les options de pays""" <|body_0|> def queryset(self, request, queryset): """Filtrer le queryset par le pays sélectionné""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccessIPCountryFilter: """Filtre admin des pays des IP des accès""" def lookups(self, request, model_admin): """Renvoyer les options de pays""" queryset = model_admin.queryset(request) results = queryset.values_list('ip__country').order_by('ip__country').distinct() data = ...
the_stack_v2_python_sparse
scoop/user/access/admin/filters.py
artscoop/scoop
train
0
acfdc12b117c79e15784a364b554aa0ec916d6bb
[ "from yaml import load, dump\ntry:\n from yaml import CLoader as Loader, CDumper as Dumper\nexcept ImportError:\n from yaml import Loader, Dumper\nstate_file_path = '%s/%s' % (self.settings.SALT_CONFIG_FILES_DIR, state_filename)\nif os.path.isfile(state_file_path):\n with open(state_file_path) as f:\n ...
<|body_start_0|> from yaml import load, dump try: from yaml import CLoader as Loader, CDumper as Dumper except ImportError: from yaml import Loader, Dumper state_file_path = '%s/%s' % (self.settings.SALT_CONFIG_FILES_DIR, state_filename) if os.path.isfile(...
State
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class State: def load_state_files(self, state_filename): """该函数用于读取yaml格式的文件并解析成字典格式 依赖pyyaml模块,所有先要安装这个模块 :param state_filename: :return:""" <|body_0|> def apply(self): """1. load the configueration file 2. parse it 3. create a task and send it to the MQ 4. collect the re...
stack_v2_sparse_classes_75kplus_train_072869
4,141
no_license
[ { "docstring": "该函数用于读取yaml格式的文件并解析成字典格式 依赖pyyaml模块,所有先要安装这个模块 :param state_filename: :return:", "name": "load_state_files", "signature": "def load_state_files(self, state_filename)" }, { "docstring": "1. load the configueration file 2. parse it 3. create a task and send it to the MQ 4. collect ...
2
null
Implement the Python class `State` described below. Class description: Implement the State class. Method signatures and docstrings: - def load_state_files(self, state_filename): 该函数用于读取yaml格式的文件并解析成字典格式 依赖pyyaml模块,所有先要安装这个模块 :param state_filename: :return: - def apply(self): 1. load the configueration file 2. parse i...
Implement the Python class `State` described below. Class description: Implement the State class. Method signatures and docstrings: - def load_state_files(self, state_filename): 该函数用于读取yaml格式的文件并解析成字典格式 依赖pyyaml模块,所有先要安装这个模块 :param state_filename: :return: - def apply(self): 1. load the configueration file 2. parse i...
3c02098163611eaa4a21994cded89912794b9338
<|skeleton|> class State: def load_state_files(self, state_filename): """该函数用于读取yaml格式的文件并解析成字典格式 依赖pyyaml模块,所有先要安装这个模块 :param state_filename: :return:""" <|body_0|> def apply(self): """1. load the configueration file 2. parse it 3. create a task and send it to the MQ 4. collect the re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class State: def load_state_files(self, state_filename): """该函数用于读取yaml格式的文件并解析成字典格式 依赖pyyaml模块,所有先要安装这个模块 :param state_filename: :return:""" from yaml import load, dump try: from yaml import CLoader as Loader, CDumper as Dumper except ImportError: from yaml i...
the_stack_v2_python_sparse
stark/Arya/plugins/state.py
sunjiebin/s12
train
0
8af36d333b5e6d20ca9350e733056ffe0f295f9d
[ "n = len(arr)\nfor i in range(n - 2):\n if all((j % 2 == 1 for j in arr[i:i + 3])):\n return True\nreturn False", "n = len(arr)\nfor i in range(n - 2):\n if arr[i] & 1 and arr[i + 1] & 1 and arr[i + 2] & 1:\n return True\nreturn False" ]
<|body_start_0|> n = len(arr) for i in range(n - 2): if all((j % 2 == 1 for j in arr[i:i + 3])): return True return False <|end_body_0|> <|body_start_1|> n = len(arr) for i in range(n - 2): if arr[i] & 1 and arr[i + 1] & 1 and arr[i + 2] &...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeConsecutiveOdds(self, arr): """:type arr: List[int] :rtype: bool""" <|body_0|> def threeConsecutiveOdds(self, arr): """:type arr: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(arr) for i in...
stack_v2_sparse_classes_75kplus_train_072870
628
no_license
[ { "docstring": ":type arr: List[int] :rtype: bool", "name": "threeConsecutiveOdds", "signature": "def threeConsecutiveOdds(self, arr)" }, { "docstring": ":type arr: List[int] :rtype: bool", "name": "threeConsecutiveOdds", "signature": "def threeConsecutiveOdds(self, arr)" } ]
2
stack_v2_sparse_classes_30k_train_031370
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeConsecutiveOdds(self, arr): :type arr: List[int] :rtype: bool - def threeConsecutiveOdds(self, arr): :type arr: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeConsecutiveOdds(self, arr): :type arr: List[int] :rtype: bool - def threeConsecutiveOdds(self, arr): :type arr: List[int] :rtype: bool <|skeleton|> class Solution: ...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def threeConsecutiveOdds(self, arr): """:type arr: List[int] :rtype: bool""" <|body_0|> def threeConsecutiveOdds(self, arr): """:type arr: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def threeConsecutiveOdds(self, arr): """:type arr: List[int] :rtype: bool""" n = len(arr) for i in range(n - 2): if all((j % 2 == 1 for j in arr[i:i + 3])): return True return False def threeConsecutiveOdds(self, arr): """:type...
the_stack_v2_python_sparse
1550_Three_Consecutive_Odds.py
bingli8802/leetcode
train
0
6fc4b746b192a737442735583c4009decb5234d3
[ "if not root:\n return '[]'\nres = []\nqueue = collections.deque()\nqueue.append(root)\nwhile queue:\n node = queue.popleft()\n if node:\n res.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\n else:\n res.append('null')\nreturn '[' + ','.join(res) +...
<|body_start_0|> if not root: return '[]' res = [] queue = collections.deque() queue.append(root) while queue: node = queue.popleft() if node: res.append(str(node.val)) queue.append(node.left) que...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def serialize(self, root): """类似于面试题32 :param root: 传入一棵树 :return: 返回字符串""" <|body_0|> def deserialize(self, data): """:param data: 是一个字符串 :return: 返回一棵树""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return '[]' ...
stack_v2_sparse_classes_75kplus_train_072871
2,245
no_license
[ { "docstring": "类似于面试题32 :param root: 传入一棵树 :return: 返回字符串", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": ":param data: 是一个字符串 :return: 返回一棵树", "name": "deserialize", "signature": "def deserialize(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_007152
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def serialize(self, root): 类似于面试题32 :param root: 传入一棵树 :return: 返回字符串 - def deserialize(self, data): :param data: 是一个字符串 :return: 返回一棵树
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def serialize(self, root): 类似于面试题32 :param root: 传入一棵树 :return: 返回字符串 - def deserialize(self, data): :param data: 是一个字符串 :return: 返回一棵树 <|skeleton|> class Solution: def ser...
f1bbd6b3197cd9ac4f0d35a37539c11b02272065
<|skeleton|> class Solution: def serialize(self, root): """类似于面试题32 :param root: 传入一棵树 :return: 返回字符串""" <|body_0|> def deserialize(self, data): """:param data: 是一个字符串 :return: 返回一棵树""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def serialize(self, root): """类似于面试题32 :param root: 传入一棵树 :return: 返回字符串""" if not root: return '[]' res = [] queue = collections.deque() queue.append(root) while queue: node = queue.popleft() if node: ...
the_stack_v2_python_sparse
offer/树/37. 序列化二叉树/Codec.py
guohaoyuan/algorithms-for-work
train
2
7510fdf9594cb57861702aba23f3774bdeed8ebb
[ "self.item = item\nself.key = key\nself.left = left\nself.right = right", "if key == self.key:\n self.item = item\nelif key < self.key:\n if self.left:\n self.left.insert(item, key)\n else:\n self.left = BSTreeNode(item, key)\nelif self.right:\n self.right.insert(item, key)\nelse:\n s...
<|body_start_0|> self.item = item self.key = key self.left = left self.right = right <|end_body_0|> <|body_start_1|> if key == self.key: self.item = item elif key < self.key: if self.left: self.left.insert(item, key) el...
Binary search tree node (subtree)
BSTreeNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" ...
stack_v2_sparse_classes_75kplus_train_072872
3,431
no_license
[ { "docstring": "Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)", "name": "__init__", "signature": "def __init__(self, item, key, left=None, right=None)" }, { "docstring": "Assi...
6
stack_v2_sparse_classes_30k_train_038737
Implement the Python class `BSTreeNode` described below. Class description: Binary search tree node (subtree) Method signatures and docstrings: - def __init__(self, item, key, left=None, right=None): Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) ...
Implement the Python class `BSTreeNode` described below. Class description: Binary search tree node (subtree) Method signatures and docstrings: - def __init__(self, item, key, left=None, right=None): Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) ...
548dc99014e8c3b9a27638a9df3a376387470fbf
<|skeleton|> class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" self.item ...
the_stack_v2_python_sparse
MPIAA3/bstree_node.py
zdarovagoshan/PythonLabs
train
0
eb61fcc3acc3bd9619406313a1e48c7f64e90ef5
[ "self.task_controller = task_controller\nself.clear_before = clear_before\nself.clear_after = clear_after\nself.retries = retries\nself.recovery_task = recovery_task\nself.depend = depend\nself.block = block", "max_len = max((len(s) for s in sequences))\nfor s in sequences:\n if len(s) != max_len:\n rai...
<|body_start_0|> self.task_controller = task_controller self.clear_before = clear_before self.clear_after = clear_after self.retries = retries self.recovery_task = recovery_task self.depend = depend self.block = block <|end_body_0|> <|body_start_1|> max_l...
Make an `ITaskController` look like an `IMapper`. This class provides a load balanced version of `map`.
TaskMapper
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskMapper: """Make an `ITaskController` look like an `IMapper`. This class provides a load balanced version of `map`.""" def __init__(self, task_controller, clear_before=False, clear_after=False, retries=0, recovery_task=None, depend=None, block=True): """Create a `IMapper` given a ...
stack_v2_sparse_classes_75kplus_train_072873
8,554
permissive
[ { "docstring": "Create a `IMapper` given a `TaskController` and arguments. The additional arguments are those that are common to all types of tasks and are described in the documentation for `IPython.kernel.task.BaseTask`. :Parameters: task_controller : an `IBlockingTaskClient` implementer The `TaskController` ...
2
stack_v2_sparse_classes_30k_train_051347
Implement the Python class `TaskMapper` described below. Class description: Make an `ITaskController` look like an `IMapper`. This class provides a load balanced version of `map`. Method signatures and docstrings: - def __init__(self, task_controller, clear_before=False, clear_after=False, retries=0, recovery_task=No...
Implement the Python class `TaskMapper` described below. Class description: Make an `ITaskController` look like an `IMapper`. This class provides a load balanced version of `map`. Method signatures and docstrings: - def __init__(self, task_controller, clear_before=False, clear_after=False, retries=0, recovery_task=No...
1cf44de3833929a4cf9e0069e8c75ef9086eeaca
<|skeleton|> class TaskMapper: """Make an `ITaskController` look like an `IMapper`. This class provides a load balanced version of `map`.""" def __init__(self, task_controller, clear_before=False, clear_after=False, retries=0, recovery_task=None, depend=None, block=True): """Create a `IMapper` given a ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskMapper: """Make an `ITaskController` look like an `IMapper`. This class provides a load balanced version of `map`.""" def __init__(self, task_controller, clear_before=False, clear_after=False, retries=0, recovery_task=None, depend=None, block=True): """Create a `IMapper` given a `TaskControll...
the_stack_v2_python_sparse
IPython/kernel/mapper.py
omazapa/ipython
train
3
e56b1cf13574e362df8cd5785b9816c1507793f6
[ "log_as_info('\\nIncludeDirective.run')\nnode = IncludeNode('')\njinja2_value = self.arguments[0].replace('<', '{{ ').replace('>', ' }}')\nnode.markup = create_post_processing_markup('INCLUDE', jinja2_value)\nreturn [node]", "for node in doctree.traverse(IncludeNode):\n replacement_node = docutils.nodes.raw(''...
<|body_start_0|> log_as_info('\nIncludeDirective.run') node = IncludeNode('') jinja2_value = self.arguments[0].replace('<', '{{ ').replace('>', ' }}') node.markup = create_post_processing_markup('INCLUDE', jinja2_value) return [node] <|end_body_0|> <|body_start_1|> for n...
Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory of the Flask application. This directive is ...
IncludeDirective
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IncludeDirective: """Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory ...
stack_v2_sparse_classes_75kplus_train_072874
16,710
permissive
[ { "docstring": "Replaces the directive in the \\\\*.rst file with a IncludeNode.", "name": "run", "signature": "def run(self) -> List[docutils.nodes.Node]" }, { "docstring": "Handle include modification by inserting post processing markup.", "name": "handle_insert_markup", "signature": "...
2
stack_v2_sparse_classes_30k_train_024726
Implement the Python class `IncludeDirective` described below. Class description: Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the ...
Implement the Python class `IncludeDirective` described below. Class description: Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the ...
46a11295394093de3a23cb8dec1e2e76eac752e8
<|skeleton|> class IncludeDirective: """Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IncludeDirective: """Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory of the Flask ...
the_stack_v2_python_sparse
src/astutus/sphinx/dyn_pages.py
rich-dobbs-13440/astutus
train
0
e687ddea6188522ff329a0d263d38474f6c9dedb
[ "try:\n user_schema = UserSchema()\n users_schema = UserModelSchema(many=True)\n if user_id:\n user = User.query.get_or_404(int(user_id))\n result = user_schema.dump(user)\n else:\n users = User.query.all()\n result = users_schema.dump(users)\n logger.info('Users List: Use...
<|body_start_0|> try: user_schema = UserSchema() users_schema = UserModelSchema(many=True) if user_id: user = User.query.get_or_404(int(user_id)) result = user_schema.dump(user) else: users = User.query.all() ...
UserAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAPI: def get(self, user_id=None): """GET List of All Users or details of a User. --- parameters: - name: user_id type: integer in: path required: false description: ID of a user. responses: 200: description: Returns list of all users or details of a user. 400: description: Any DB err...
stack_v2_sparse_classes_75kplus_train_072875
7,256
no_license
[ { "docstring": "GET List of All Users or details of a User. --- parameters: - name: user_id type: integer in: path required: false description: ID of a user. responses: 200: description: Returns list of all users or details of a user. 400: description: Any DB error occurred. 401: description: Only Admin Role Us...
3
null
Implement the Python class `UserAPI` described below. Class description: Implement the UserAPI class. Method signatures and docstrings: - def get(self, user_id=None): GET List of All Users or details of a User. --- parameters: - name: user_id type: integer in: path required: false description: ID of a user. responses...
Implement the Python class `UserAPI` described below. Class description: Implement the UserAPI class. Method signatures and docstrings: - def get(self, user_id=None): GET List of All Users or details of a User. --- parameters: - name: user_id type: integer in: path required: false description: ID of a user. responses...
d2b127048d562768a4173bd78c32a896b7ea919c
<|skeleton|> class UserAPI: def get(self, user_id=None): """GET List of All Users or details of a User. --- parameters: - name: user_id type: integer in: path required: false description: ID of a user. responses: 200: description: Returns list of all users or details of a user. 400: description: Any DB err...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserAPI: def get(self, user_id=None): """GET List of All Users or details of a User. --- parameters: - name: user_id type: integer in: path required: false description: ID of a user. responses: 200: description: Returns list of all users or details of a user. 400: description: Any DB error occurred. 4...
the_stack_v2_python_sparse
app/api/v1/users/views.py
ikpune/parking_assistant
train
0
b6ca9fa988e5a85d61bc2a1675e6fab2dff03265
[ "np.random.seed(random_seed)\nrnd = np.random.random(n)\nbeta = self.get_beta()\nMc = self.Mc\nif Mmax is None:\n Mmax = self.Mm\nassert Mmax > Mc\nreturn -1.0 / beta * np.log(np.exp(-beta * Mc) - (1 - rnd) * (np.exp(-beta * Mc) - np.exp(-beta * Mmax)))", "np.random.seed(random_seed)\ntail_size = self.get_num_...
<|body_start_0|> np.random.seed(random_seed) rnd = np.random.random(n) beta = self.get_beta() Mc = self.Mc if Mmax is None: Mmax = self.Mm assert Mmax > Mc return -1.0 / beta * np.log(np.exp(-beta * Mc) - (1 - rnd) * (np.exp(-beta * Mc) - np.exp(-beta ...
Base class for Gutenberg-Richter Omori law, where aftershock magnitudes follow a Gutenberg-Richter distribution.
GROmoriLaw
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GROmoriLaw: """Base class for Gutenberg-Richter Omori law, where aftershock magnitudes follow a Gutenberg-Richter distribution.""" def get_random_magnitudes(self, n, Mmax=None, random_seed=None): """Generate random aftershock magnitudes :param n: int, length of aftershock sequence :p...
stack_v2_sparse_classes_75kplus_train_072876
27,058
no_license
[ { "docstring": "Generate random aftershock magnitudes :param n: int, length of aftershock sequence :param Mmax: float, maximum magnitude (default: None, will use mainshock magnitude in :prop:`Mm`) :param random_seed: int, seed for random number generator (default: None) :return: float array, aftershock magnitud...
4
null
Implement the Python class `GROmoriLaw` described below. Class description: Base class for Gutenberg-Richter Omori law, where aftershock magnitudes follow a Gutenberg-Richter distribution. Method signatures and docstrings: - def get_random_magnitudes(self, n, Mmax=None, random_seed=None): Generate random aftershock m...
Implement the Python class `GROmoriLaw` described below. Class description: Base class for Gutenberg-Richter Omori law, where aftershock magnitudes follow a Gutenberg-Richter distribution. Method signatures and docstrings: - def get_random_magnitudes(self, n, Mmax=None, random_seed=None): Generate random aftershock m...
740fe6b7fe3060ec4503e3abdb48c19894d99e0e
<|skeleton|> class GROmoriLaw: """Base class for Gutenberg-Richter Omori law, where aftershock magnitudes follow a Gutenberg-Richter distribution.""" def get_random_magnitudes(self, n, Mmax=None, random_seed=None): """Generate random aftershock magnitudes :param n: int, length of aftershock sequence :p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GROmoriLaw: """Base class for Gutenberg-Richter Omori law, where aftershock magnitudes follow a Gutenberg-Richter distribution.""" def get_random_magnitudes(self, n, Mmax=None, random_seed=None): """Generate random aftershock magnitudes :param n: int, length of aftershock sequence :param Mmax: fl...
the_stack_v2_python_sparse
omori.py
ROB-Seismology/eqcatalog
train
5
036fb6800bf0d3d3d9f9a92a03b01f109b99584e
[ "self.delay = map(int, delay.split(':'))\nself.name = name\nself.active = True\nself.hash_value = hash_value\nself.last_run = datetime.datetime.now()\nif not len(self.delay) == 4:\n raise Exception('Timer delay have invalid format')", "if self.active and self.last_run + datetime.timedelta(days=self.delay[0], h...
<|body_start_0|> self.delay = map(int, delay.split(':')) self.name = name self.active = True self.hash_value = hash_value self.last_run = datetime.datetime.now() if not len(self.delay) == 4: raise Exception('Timer delay have invalid format') <|end_body_0|> <|...
VEE_timer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VEE_timer: def __init__(self, name, delay, hash_value): """delay should be in format 00:00:00:00, where each digit - delay in day:hr:min:sec""" <|body_0|> def check(self): """Return true if since last run needed time already passed. Timer should be active""" ...
stack_v2_sparse_classes_75kplus_train_072877
762
no_license
[ { "docstring": "delay should be in format 00:00:00:00, where each digit - delay in day:hr:min:sec", "name": "__init__", "signature": "def __init__(self, name, delay, hash_value)" }, { "docstring": "Return true if since last run needed time already passed. Timer should be active", "name": "ch...
2
stack_v2_sparse_classes_30k_train_026928
Implement the Python class `VEE_timer` described below. Class description: Implement the VEE_timer class. Method signatures and docstrings: - def __init__(self, name, delay, hash_value): delay should be in format 00:00:00:00, where each digit - delay in day:hr:min:sec - def check(self): Return true if since last run ...
Implement the Python class `VEE_timer` described below. Class description: Implement the VEE_timer class. Method signatures and docstrings: - def __init__(self, name, delay, hash_value): delay should be in format 00:00:00:00, where each digit - delay in day:hr:min:sec - def check(self): Return true if since last run ...
c3bbadde24330fb2dff4aa2c32cc6b11e044fbc9
<|skeleton|> class VEE_timer: def __init__(self, name, delay, hash_value): """delay should be in format 00:00:00:00, where each digit - delay in day:hr:min:sec""" <|body_0|> def check(self): """Return true if since last run needed time already passed. Timer should be active""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VEE_timer: def __init__(self, name, delay, hash_value): """delay should be in format 00:00:00:00, where each digit - delay in day:hr:min:sec""" self.delay = map(int, delay.split(':')) self.name = name self.active = True self.hash_value = hash_value self.last_run...
the_stack_v2_python_sparse
Libraries/VEE_timer.py
EAC-Technology/eApp-Builder
train
0
7425639b403dc57b0e2c69bc7bf7d1aecd6990bb
[ "self.testTag(elem, 'dict')\nout = {}\nfor xitem in elem:\n key = xitem.get('key')\n try:\n value = XmlDataIO.fromXml(xitem[0])\n except IndexError:\n value = None\n out[key] = value\nreturn out", "if xparent is not None:\n elem = ElementTree.SubElement(xparent, 'dict')\nelse:\n el...
<|body_start_0|> self.testTag(elem, 'dict') out = {} for xitem in elem: key = xitem.get('key') try: value = XmlDataIO.fromXml(xitem[0]) except IndexError: value = None out[key] = value return out <|end_body_0...
DictIO
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DictIO: def load(self, elem): """Converts the inputted dict tag to Python. :param elem | <xml.etree.ElementTree> :return <dict>""" <|body_0|> def save(self, data, xparent=None): """Parses the element from XML to Python. :param data | <variant> xparent | <xml.etree.El...
stack_v2_sparse_classes_75kplus_train_072878
15,996
permissive
[ { "docstring": "Converts the inputted dict tag to Python. :param elem | <xml.etree.ElementTree> :return <dict>", "name": "load", "signature": "def load(self, elem)" }, { "docstring": "Parses the element from XML to Python. :param data | <variant> xparent | <xml.etree.ElementTree.Element> || None...
2
stack_v2_sparse_classes_30k_train_039537
Implement the Python class `DictIO` described below. Class description: Implement the DictIO class. Method signatures and docstrings: - def load(self, elem): Converts the inputted dict tag to Python. :param elem | <xml.etree.ElementTree> :return <dict> - def save(self, data, xparent=None): Parses the element from XML...
Implement the Python class `DictIO` described below. Class description: Implement the DictIO class. Method signatures and docstrings: - def load(self, elem): Converts the inputted dict tag to Python. :param elem | <xml.etree.ElementTree> :return <dict> - def save(self, data, xparent=None): Parses the element from XML...
d31743ec456a41428709968ab11a2cf6c6c76247
<|skeleton|> class DictIO: def load(self, elem): """Converts the inputted dict tag to Python. :param elem | <xml.etree.ElementTree> :return <dict>""" <|body_0|> def save(self, data, xparent=None): """Parses the element from XML to Python. :param data | <variant> xparent | <xml.etree.El...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DictIO: def load(self, elem): """Converts the inputted dict tag to Python. :param elem | <xml.etree.ElementTree> :return <dict>""" self.testTag(elem, 'dict') out = {} for xitem in elem: key = xitem.get('key') try: value = XmlDataIO.fromXm...
the_stack_v2_python_sparse
projex/xmlutil.py
bitesofcode/projex
train
7
812248a8164863b123be84ff54d8eaf319a53f08
[ "super().__init__(main_window)\nstacked_layout = QStackedLayout()\nmain_window.communication.item_selected.connect(stacked_layout.setCurrentIndex)\nself.setLayout(stacked_layout)\nself.showEvent = self._get_show_event(main_window)\nfor item in items:\n frame = AttributesFrame(main_window=main_window, item=item)\...
<|body_start_0|> super().__init__(main_window) stacked_layout = QStackedLayout() main_window.communication.item_selected.connect(stacked_layout.setCurrentIndex) self.setLayout(stacked_layout) self.showEvent = self._get_show_event(main_window) for item in items: ...
DataWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataWidget: def __init__(self, main_window, items): """Widget contains items with inputs.""" <|body_0|> def _get_show_event(main_window): """Emit signal to hide ActionButton.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(main_wind...
stack_v2_sparse_classes_75kplus_train_072879
946
no_license
[ { "docstring": "Widget contains items with inputs.", "name": "__init__", "signature": "def __init__(self, main_window, items)" }, { "docstring": "Emit signal to hide ActionButton.", "name": "_get_show_event", "signature": "def _get_show_event(main_window)" } ]
2
stack_v2_sparse_classes_30k_train_003515
Implement the Python class `DataWidget` described below. Class description: Implement the DataWidget class. Method signatures and docstrings: - def __init__(self, main_window, items): Widget contains items with inputs. - def _get_show_event(main_window): Emit signal to hide ActionButton.
Implement the Python class `DataWidget` described below. Class description: Implement the DataWidget class. Method signatures and docstrings: - def __init__(self, main_window, items): Widget contains items with inputs. - def _get_show_event(main_window): Emit signal to hide ActionButton. <|skeleton|> class DataWidge...
606e188e88ee3a2b2e1daee60c71948c678228e1
<|skeleton|> class DataWidget: def __init__(self, main_window, items): """Widget contains items with inputs.""" <|body_0|> def _get_show_event(main_window): """Emit signal to hide ActionButton.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataWidget: def __init__(self, main_window, items): """Widget contains items with inputs.""" super().__init__(main_window) stacked_layout = QStackedLayout() main_window.communication.item_selected.connect(stacked_layout.setCurrentIndex) self.setLayout(stacked_layout) ...
the_stack_v2_python_sparse
Hospital-Helper-2-master/app/gui/data_widget.py
JoaoBueno/estudos-python
train
2
2c86e4980cc4aa7ca84b3aebea1a7cd1254c959f
[ "if columns is not None:\n if isinstance(columns, list) or isinstance(columns, tuple):\n self.columns = columns\n else:\n raise NameError('Invalid type {}'.format(type(columns)))\nelse:\n self.columns = columns", "if not isinstance(X, pd.core.frame.DataFrame):\n raise NameError('Invalid ...
<|body_start_0|> if columns is not None: if isinstance(columns, list) or isinstance(columns, tuple): self.columns = columns else: raise NameError('Invalid type {}'.format(type(columns))) else: self.columns = columns <|end_body_0|> <|bo...
This transformer handles missing values for idmax. Attributes ---------- columns: list of columns to transformer [n_columns] Examples -------- For usage examples, please see https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FillNaTransformer_idmax/
FillNaTransformer_idmax
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FillNaTransformer_idmax: """This transformer handles missing values for idmax. Attributes ---------- columns: list of columns to transformer [n_columns] Examples -------- For usage examples, please see https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FillNaTransformer_idmax/""" ...
stack_v2_sparse_classes_75kplus_train_072880
18,127
permissive
[ { "docstring": "Init replace missing values.", "name": "__init__", "signature": "def __init__(self, columns=None)" }, { "docstring": "Gets the columns to make a replace missing values. Parameters ---------- X : {Dataframe}, shape = [n_samples, n_features] Dataframe, where n_samples is the number...
3
stack_v2_sparse_classes_30k_train_037345
Implement the Python class `FillNaTransformer_idmax` described below. Class description: This transformer handles missing values for idmax. Attributes ---------- columns: list of columns to transformer [n_columns] Examples -------- For usage examples, please see https://jaisenbe58r.github.io/MLearner/user_guide/prepro...
Implement the Python class `FillNaTransformer_idmax` described below. Class description: This transformer handles missing values for idmax. Attributes ---------- columns: list of columns to transformer [n_columns] Examples -------- For usage examples, please see https://jaisenbe58r.github.io/MLearner/user_guide/prepro...
e768a4cad150b35fb5bf543ab28aa23764af51d9
<|skeleton|> class FillNaTransformer_idmax: """This transformer handles missing values for idmax. Attributes ---------- columns: list of columns to transformer [n_columns] Examples -------- For usage examples, please see https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FillNaTransformer_idmax/""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FillNaTransformer_idmax: """This transformer handles missing values for idmax. Attributes ---------- columns: list of columns to transformer [n_columns] Examples -------- For usage examples, please see https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FillNaTransformer_idmax/""" def __init_...
the_stack_v2_python_sparse
mlearner/preprocessing/replace_na.py
jaisenbe58r/MLearner
train
9
16cd2e7870134e4ab9b6a1dd88f5fa6cb4f655ae
[ "output_xors = [Xor(ckt0.outputs()[name], ckt1.outputs()[name]) for name in ckt0.outputs()]\ndiff = Or(*output_xors)\nreturn {'diff': diff}", "self.visited_nodes = []\nself.inputs = []\nself.specified_inputs = spec_inputs\noutputs = {}\nfor name in output_names:\n outputs[name] = self._build_node(nodes, name, ...
<|body_start_0|> output_xors = [Xor(ckt0.outputs()[name], ckt1.outputs()[name]) for name in ckt0.outputs()] diff = Or(*output_xors) return {'diff': diff} <|end_body_0|> <|body_start_1|> self.visited_nodes = [] self.inputs = [] self.specified_inputs = spec_inputs ...
CircuitBuilder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircuitBuilder: def build_miter(self, ckt0, ckt1): """Builds a miter circuit z3 representation from two smaller circuits." ckt0: the first half of the miter circuit ckt1: the second half of the miter circuit returns: a miter circuit z3 representation""" <|body_0|> def build(...
stack_v2_sparse_classes_75kplus_train_072881
3,861
no_license
[ { "docstring": "Builds a miter circuit z3 representation from two smaller circuits.\" ckt0: the first half of the miter circuit ckt1: the second half of the miter circuit returns: a miter circuit z3 representation", "name": "build_miter", "signature": "def build_miter(self, ckt0, ckt1)" }, { "do...
6
null
Implement the Python class `CircuitBuilder` described below. Class description: Implement the CircuitBuilder class. Method signatures and docstrings: - def build_miter(self, ckt0, ckt1): Builds a miter circuit z3 representation from two smaller circuits." ckt0: the first half of the miter circuit ckt1: the second hal...
Implement the Python class `CircuitBuilder` described below. Class description: Implement the CircuitBuilder class. Method signatures and docstrings: - def build_miter(self, ckt0, ckt1): Builds a miter circuit z3 representation from two smaller circuits." ckt0: the first half of the miter circuit ckt1: the second hal...
e8de79fdf7151cc1beebcee129bbc228ca97fda0
<|skeleton|> class CircuitBuilder: def build_miter(self, ckt0, ckt1): """Builds a miter circuit z3 representation from two smaller circuits." ckt0: the first half of the miter circuit ckt1: the second half of the miter circuit returns: a miter circuit z3 representation""" <|body_0|> def build(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CircuitBuilder: def build_miter(self, ckt0, ckt1): """Builds a miter circuit z3 representation from two smaller circuits." ckt0: the first half of the miter circuit ckt1: the second half of the miter circuit returns: a miter circuit z3 representation""" output_xors = [Xor(ckt0.outputs()[name],...
the_stack_v2_python_sparse
sat_attack/circuit_builder.py
Actasclown/sat_attack
train
0
cec27f6eb6952275041226d249745f932379fd4d
[ "self.host = host\nself.port = port\nself.r = redis.Redis(host, port)", "try:\n serial_json = self.r.rpop(COMMAND_QUEUE_KEY).decode()\n return json.loads(serial_json)\nexcept AttributeError:\n return None", "location = {'azimuth': azimuth, 'altitude': altitude}\nserial_json = json.dumps(location)\nretu...
<|body_start_0|> self.host = host self.port = port self.r = redis.Redis(host, port) <|end_body_0|> <|body_start_1|> try: serial_json = self.r.rpop(COMMAND_QUEUE_KEY).decode() return json.loads(serial_json) except AttributeError: return None <|...
Used on jetson, inside vision loop check for new commands and always post location for last thing requested
VisionSlave
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisionSlave: """Used on jetson, inside vision loop check for new commands and always post location for last thing requested""" def __init__(self, host, port): """establish connection :param host: redis host :param port: redis port""" <|body_0|> def pop_command(self): ...
stack_v2_sparse_classes_75kplus_train_072882
1,143
permissive
[ { "docstring": "establish connection :param host: redis host :param port: redis port", "name": "__init__", "signature": "def __init__(self, host, port)" }, { "docstring": "check for a command on the queue, returns None if empty queue", "name": "pop_command", "signature": "def pop_command...
3
null
Implement the Python class `VisionSlave` described below. Class description: Used on jetson, inside vision loop check for new commands and always post location for last thing requested Method signatures and docstrings: - def __init__(self, host, port): establish connection :param host: redis host :param port: redis p...
Implement the Python class `VisionSlave` described below. Class description: Used on jetson, inside vision loop check for new commands and always post location for last thing requested Method signatures and docstrings: - def __init__(self, host, port): establish connection :param host: redis host :param port: redis p...
0fb6be22420b1488ca3d6abb04588e8564d768b9
<|skeleton|> class VisionSlave: """Used on jetson, inside vision loop check for new commands and always post location for last thing requested""" def __init__(self, host, port): """establish connection :param host: redis host :param port: redis port""" <|body_0|> def pop_command(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VisionSlave: """Used on jetson, inside vision loop check for new commands and always post location for last thing requested""" def __init__(self, host, port): """establish connection :param host: redis host :param port: redis port""" self.host = host self.port = port self....
the_stack_v2_python_sparse
vision/visionslave.py
dragonrobotics/2018-PowerUp
train
2
ac13a1650b5c3a580a75696bd1c28ff1a14c785c
[ "a = b = 1\nfor i in range(n - 1):\n temp = a + b\n a = b\n b = temp\nreturn b", "if n == 1:\n return 1\nelif n == 2:\n return 2\nelse:\n return self.climbStairsRecursive(n - 1) + self.climbStairsRecursive(n - 2)" ]
<|body_start_0|> a = b = 1 for i in range(n - 1): temp = a + b a = b b = temp return b <|end_body_0|> <|body_start_1|> if n == 1: return 1 elif n == 2: return 2 else: return self.climbStairsRecursive...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n): """Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int""" <|body_0|> def climbStairsRecursive(self, n): """Solves fibonacci sequence problem using recursion""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_072883
813
no_license
[ { "docstring": "Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" }, { "docstring": "Solves fibonacci sequence problem using recursion", "name": "climbStairsRecursive", "signat...
2
stack_v2_sparse_classes_30k_train_011042
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int - def climbStairsRecursive(self, n): Solves fibonacci s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int - def climbStairsRecursive(self, n): Solves fibonacci s...
308889e57e71c369aa8516fba8a2064f6a26abee
<|skeleton|> class Solution: def climbStairs(self, n): """Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int""" <|body_0|> def climbStairsRecursive(self, n): """Solves fibonacci sequence problem using recursion""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def climbStairs(self, n): """Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int""" a = b = 1 for i in range(n - 1): temp = a + b a = b b = temp return b def climbStairsRecursive(sel...
the_stack_v2_python_sparse
leet_70.py
mike-jolliffe/Learning
train
0
135f99febf5c5cb5fe67a4415429b11a1863a545
[ "if get_jwt_claims()['roles'] == 'admin':\n return Fqdns().json()\nreturn Fqdns().json(get_jwt_identity())", "api_v1.payload.update({'owner': get_jwt_identity()})\nif Fqdn(api_v1.payload['fqdn']).exists():\n return ({'message': \"Can't create WTF already present 'fqdn' fqdn\"}, 409)\nf = Fqdn().create(api_v...
<|body_start_0|> if get_jwt_claims()['roles'] == 'admin': return Fqdns().json() return Fqdns().json(get_jwt_identity()) <|end_body_0|> <|body_start_1|> api_v1.payload.update({'owner': get_jwt_identity()}) if Fqdn(api_v1.payload['fqdn']).exists(): return ({'messag...
Shows a list of all Fqdns(), and lets you POST to add new fqdn
Fqdns_R
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fqdns_R: """Shows a list of all Fqdns(), and lets you POST to add new fqdn""" def get(self): """List all fqdn entries that you own.""" <|body_0|> def post(self): """Create a new fqdn entry""" <|body_1|> <|end_skeleton|> <|body_start_0|> if get_j...
stack_v2_sparse_classes_75kplus_train_072884
5,039
permissive
[ { "docstring": "List all fqdn entries that you own.", "name": "get", "signature": "def get(self)" }, { "docstring": "Create a new fqdn entry", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_036302
Implement the Python class `Fqdns_R` described below. Class description: Shows a list of all Fqdns(), and lets you POST to add new fqdn Method signatures and docstrings: - def get(self): List all fqdn entries that you own. - def post(self): Create a new fqdn entry
Implement the Python class `Fqdns_R` described below. Class description: Shows a list of all Fqdns(), and lets you POST to add new fqdn Method signatures and docstrings: - def get(self): List all fqdn entries that you own. - def post(self): Create a new fqdn entry <|skeleton|> class Fqdns_R: """Shows a list of a...
6a9bf3a3d73fb3faa7cf1e5cfc757cc360fbafde
<|skeleton|> class Fqdns_R: """Shows a list of all Fqdns(), and lets you POST to add new fqdn""" def get(self): """List all fqdn entries that you own.""" <|body_0|> def post(self): """Create a new fqdn entry""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Fqdns_R: """Shows a list of all Fqdns(), and lets you POST to add new fqdn""" def get(self): """List all fqdn entries that you own.""" if get_jwt_claims()['roles'] == 'admin': return Fqdns().json() return Fqdns().json(get_jwt_identity()) def post(self): ""...
the_stack_v2_python_sparse
haprestio/api_v1/fqdns.py
innofocus/haprestio
train
0
7a9c378d91253808bbe5354da282174d2e198ab4
[ "if len(s) == 0:\n return ' '\ns_dict = {}\nfor i, c in enumerate(s):\n if s_dict.get(c):\n s_dict[c][1] = s_dict[c][1] + 1\n else:\n s_dict.setdefault(c, [i, 1])\nnum_1_c = []\nfor key in s_dict:\n if s_dict[key][1] == 1:\n num_1_c.append([key, s_dict[key][0]])\nreturn sorted(num_1...
<|body_start_0|> if len(s) == 0: return ' ' s_dict = {} for i, c in enumerate(s): if s_dict.get(c): s_dict[c][1] = s_dict[c][1] + 1 else: s_dict.setdefault(c, [i, 1]) num_1_c = [] for key in s_dict: i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstUniqChar(self, s): """在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str""" <|body_0|> def firstUniqChar2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) == 0: ...
stack_v2_sparse_classes_75kplus_train_072885
1,136
no_license
[ { "docstring": "在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str", "name": "firstUniqChar", "signature": "def firstUniqChar(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "firstUniqChar2", "signature": "def firstUniqChar2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_032477
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar(self, s): 在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str - def firstUniqChar2(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar(self, s): 在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str - def firstUniqChar2(self, s): :type s: str :rtype: str <|skeleton|> class So...
97cc61fefe0bedf5161687aab92fb09b0df990e2
<|skeleton|> class Solution: def firstUniqChar(self, s): """在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str""" <|body_0|> def firstUniqChar2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def firstUniqChar(self, s): """在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 s 只包含小写字母。 :type s: str :rtype: str""" if len(s) == 0: return ' ' s_dict = {} for i, c in enumerate(s): if s_dict.get(c): s_dict[c][1] = s_dict[c][1] + 1 ...
the_stack_v2_python_sparse
code/other/first_appear_char.py
JiaXingBinggan/For_work
train
0
2b528387a3551b84ca60e69e7a474f48f3e1773e
[ "try:\n url = value.url\nexcept AttributeError:\n return None\nrequest = self.context.get('request', None)\nif request is not None:\n return request.build_absolute_uri(url)\nreturn url", "if not value:\n return None\nreturn {'filename': value.name, 'height': value.height, 'width': value.width, 'src': ...
<|body_start_0|> try: url = value.url except AttributeError: return None request = self.context.get('request', None) if request is not None: return request.build_absolute_uri(url) return url <|end_body_0|> <|body_start_1|> if not value...
Custom serializer ImageField to return image details as dict.
ImageDetailField
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageDetailField: """Custom serializer ImageField to return image details as dict.""" def get_absolute_url(self, value): """Build absolute url from value.""" <|body_0|> def to_representation(self, value): """Return image filename, url and dimensions.""" <...
stack_v2_sparse_classes_75kplus_train_072886
2,131
permissive
[ { "docstring": "Build absolute url from value.", "name": "get_absolute_url", "signature": "def get_absolute_url(self, value)" }, { "docstring": "Return image filename, url and dimensions.", "name": "to_representation", "signature": "def to_representation(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_018327
Implement the Python class `ImageDetailField` described below. Class description: Custom serializer ImageField to return image details as dict. Method signatures and docstrings: - def get_absolute_url(self, value): Build absolute url from value. - def to_representation(self, value): Return image filename, url and dim...
Implement the Python class `ImageDetailField` described below. Class description: Custom serializer ImageField to return image details as dict. Method signatures and docstrings: - def get_absolute_url(self, value): Build absolute url from value. - def to_representation(self, value): Return image filename, url and dim...
6571a67d020715358fec807a1137f89bdf4b305a
<|skeleton|> class ImageDetailField: """Custom serializer ImageField to return image details as dict.""" def get_absolute_url(self, value): """Build absolute url from value.""" <|body_0|> def to_representation(self, value): """Return image filename, url and dimensions.""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageDetailField: """Custom serializer ImageField to return image details as dict.""" def get_absolute_url(self, value): """Build absolute url from value.""" try: url = value.url except AttributeError: return None request = self.context.get('request...
the_stack_v2_python_sparse
src/backend/joanie/core/serializers/fields.py
openfun/joanie
train
13
cf9ab9e445469504ff2e8a22c2ad2ea0f5236136
[ "if self._logical_drives is None:\n self._logical_drives = logical_drive.HPELogicalDriveCollection(self._conn, utils.get_subresource_path_by(self, ['Links', 'LogicalDrives']), redfish_version=self.redfish_version)\nself._logical_drives.refresh(force=False)\nreturn self._logical_drives", "if self._physical_driv...
<|body_start_0|> if self._logical_drives is None: self._logical_drives = logical_drive.HPELogicalDriveCollection(self._conn, utils.get_subresource_path_by(self, ['Links', 'LogicalDrives']), redfish_version=self.redfish_version) self._logical_drives.refresh(force=False) return self._l...
This class represents the HPEArrayControllers resource
HPEArrayController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HPEArrayController: """This class represents the HPEArrayControllers resource""" def logical_drives(self): """Gets the resource HPELogicalDriveCollection of ArrayControllers""" <|body_0|> def physical_drives(self): """Gets the resource HPEPhysicalDriveCollection ...
stack_v2_sparse_classes_75kplus_train_072887
7,552
permissive
[ { "docstring": "Gets the resource HPELogicalDriveCollection of ArrayControllers", "name": "logical_drives", "signature": "def logical_drives(self)" }, { "docstring": "Gets the resource HPEPhysicalDriveCollection of ArrayControllers", "name": "physical_drives", "signature": "def physical_...
3
stack_v2_sparse_classes_30k_train_041222
Implement the Python class `HPEArrayController` described below. Class description: This class represents the HPEArrayControllers resource Method signatures and docstrings: - def logical_drives(self): Gets the resource HPELogicalDriveCollection of ArrayControllers - def physical_drives(self): Gets the resource HPEPhy...
Implement the Python class `HPEArrayController` described below. Class description: This class represents the HPEArrayControllers resource Method signatures and docstrings: - def logical_drives(self): Gets the resource HPELogicalDriveCollection of ArrayControllers - def physical_drives(self): Gets the resource HPEPhy...
35c711e391b839bbb93c24880e08e4ac7554dae6
<|skeleton|> class HPEArrayController: """This class represents the HPEArrayControllers resource""" def logical_drives(self): """Gets the resource HPELogicalDriveCollection of ArrayControllers""" <|body_0|> def physical_drives(self): """Gets the resource HPEPhysicalDriveCollection ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HPEArrayController: """This class represents the HPEArrayControllers resource""" def logical_drives(self): """Gets the resource HPELogicalDriveCollection of ArrayControllers""" if self._logical_drives is None: self._logical_drives = logical_drive.HPELogicalDriveCollection(self...
the_stack_v2_python_sparse
proliantutils/redfish/resources/system/storage/array_controller.py
anta-nok/proliantutils
train
0
7fa977f7f9b29a202334f7eae88dbf350f4ddb2d
[ "header = utils.Struct(header)\nif 'suffix' not in header:\n raise exceptions.CrdsTypeSpecError(\"Missing 'suffix' field in type spec.\")\nif 'filetype' not in header:\n raise exceptions.CrdsTypeSpecError(\"Missing 'filetype' field in type spec.\")\nif 'text_descr' not in header and header.filetype != 'all':\...
<|body_start_0|> header = utils.Struct(header) if 'suffix' not in header: raise exceptions.CrdsTypeSpecError("Missing 'suffix' field in type spec.") if 'filetype' not in header: raise exceptions.CrdsTypeSpecError("Missing 'filetype' field in type spec.") if 'text_...
This class captures type definition parameters for a single type
TypeSpec
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeSpec: """This class captures type definition parameters for a single type""" def __init__(self, header): """Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields.""" <|body_0|> def from_file(cls, filename...
stack_v2_sparse_classes_75kplus_train_072888
17,916
permissive
[ { "docstring": "Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields.", "name": "__init__", "signature": "def __init__(self, header)" }, { "docstring": "For historical HST types, build type info from a spec file derived from CDBS sp...
2
stack_v2_sparse_classes_30k_val_001516
Implement the Python class `TypeSpec` described below. Class description: This class captures type definition parameters for a single type Method signatures and docstrings: - def __init__(self, header): Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing field...
Implement the Python class `TypeSpec` described below. Class description: This class captures type definition parameters for a single type Method signatures and docstrings: - def __init__(self, header): Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing field...
08da10721c0e979877dc9579b4092c79f4ceee27
<|skeleton|> class TypeSpec: """This class captures type definition parameters for a single type""" def __init__(self, header): """Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields.""" <|body_0|> def from_file(cls, filename...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TypeSpec: """This class captures type definition parameters for a single type""" def __init__(self, header): """Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields.""" header = utils.Struct(header) if 'suffix' not in...
the_stack_v2_python_sparse
crds/core/reftypes.py
spacetelescope/crds
train
9
39d5cbde1df13348c577ea715dc9665445e8b593
[ "category = unicodedata.category(c)[0]\nif category == 'C':\n return u' '\nif category == 'Z':\n return u' '\nreturn c", "assert isinstance(s, unicode)\ns = unicodedata.normalize('NFC', s)\nsanitized_lines = []\nfor line in s.split(u'\\n'):\n sanitized_lines.append(u''.join(map(TextSanitizer._sanitize, l...
<|body_start_0|> category = unicodedata.category(c)[0] if category == 'C': return u' ' if category == 'Z': return u' ' return c <|end_body_0|> <|body_start_1|> assert isinstance(s, unicode) s = unicodedata.normalize('NFC', s) sanitized_lin...
TextSanitizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextSanitizer: def _sanitize(c): """Returns space if character is not printable""" <|body_0|> def clean_utf8(s): """Removes most funny characters from Unicode""" <|body_1|> <|end_skeleton|> <|body_start_0|> category = unicodedata.category(c)[0] ...
stack_v2_sparse_classes_75kplus_train_072889
4,023
permissive
[ { "docstring": "Returns space if character is not printable", "name": "_sanitize", "signature": "def _sanitize(c)" }, { "docstring": "Removes most funny characters from Unicode", "name": "clean_utf8", "signature": "def clean_utf8(s)" } ]
2
stack_v2_sparse_classes_30k_train_046076
Implement the Python class `TextSanitizer` described below. Class description: Implement the TextSanitizer class. Method signatures and docstrings: - def _sanitize(c): Returns space if character is not printable - def clean_utf8(s): Removes most funny characters from Unicode
Implement the Python class `TextSanitizer` described below. Class description: Implement the TextSanitizer class. Method signatures and docstrings: - def _sanitize(c): Returns space if character is not printable - def clean_utf8(s): Removes most funny characters from Unicode <|skeleton|> class TextSanitizer: de...
f9248c3528a415a1e5af2c5a54a60c16cd79ff1d
<|skeleton|> class TextSanitizer: def _sanitize(c): """Returns space if character is not printable""" <|body_0|> def clean_utf8(s): """Removes most funny characters from Unicode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextSanitizer: def _sanitize(c): """Returns space if character is not printable""" category = unicodedata.category(c)[0] if category == 'C': return u' ' if category == 'Z': return u' ' return c def clean_utf8(s): """Removes most funn...
the_stack_v2_python_sparse
baseline/util/encoding.py
christianbuck/CorpusMining
train
2
d0f2bdbaaca60b057b829c012d88b6f4ac91566d
[ "self.rt = []\n\ndef pathSumHelper(root, base, left):\n if not root:\n return\n if not root.left and (not root.right):\n if left == root.val:\n self.rt.append(base + [root.val])\n return\n base.append(root.val)\n exleft = left - root.val\n pathSumHelper(root.left, base...
<|body_start_0|> self.rt = [] def pathSumHelper(root, base, left): if not root: return if not root.left and (not root.right): if left == root.val: self.rt.append(base + [root.val]) return base.append...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum_dfs(self, root, sum): """:type root: TreeNode :type sum: int :rtype: List[List[int]]""" <|body_0|> def pathSum_bfs(self, root, sum): """:type root: TreeNode :type sum: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_072890
1,877
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: List[List[int]]", "name": "pathSum_dfs", "signature": "def pathSum_dfs(self, root, sum)" }, { "docstring": ":type root: TreeNode :type sum: int :rtype: List[List[int]]", "name": "pathSum_bfs", "signature": "def pathSum_bfs(self,...
2
stack_v2_sparse_classes_30k_train_050335
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum_dfs(self, root, sum): :type root: TreeNode :type sum: int :rtype: List[List[int]] - def pathSum_bfs(self, root, sum): :type root: TreeNode :type sum: int :rtype: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum_dfs(self, root, sum): :type root: TreeNode :type sum: int :rtype: List[List[int]] - def pathSum_bfs(self, root, sum): :type root: TreeNode :type sum: int :rtype: List...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def pathSum_dfs(self, root, sum): """:type root: TreeNode :type sum: int :rtype: List[List[int]]""" <|body_0|> def pathSum_bfs(self, root, sum): """:type root: TreeNode :type sum: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def pathSum_dfs(self, root, sum): """:type root: TreeNode :type sum: int :rtype: List[List[int]]""" self.rt = [] def pathSumHelper(root, base, left): if not root: return if not root.left and (not root.right): if left ==...
the_stack_v2_python_sparse
medium/tree/test_113_Path_Sum_II.py
wuxu1019/leetcode_sophia
train
1
a8c90bd1f109a271af58a5767da9b95bbcf07318
[ "super(SharedAdam, self).__init__(params, lr=lr, betas=betas, eps=eps, weight_decay=weight_decay, amsgrad=amsgrad)\nfor group in self.param_groups:\n for p in group['params']:\n state = self.state[p]\n state['step'] = 0\n state['shared_step'] = torch.zeros(1).share_memory_()\n state['...
<|body_start_0|> super(SharedAdam, self).__init__(params, lr=lr, betas=betas, eps=eps, weight_decay=weight_decay, amsgrad=amsgrad) for group in self.param_groups: for p in group['params']: state = self.state[p] state['step'] = 0 state['shared_s...
SharedAdam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharedAdam: def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): """arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term ...
stack_v2_sparse_classes_75kplus_train_072891
23,572
no_license
[ { "docstring": "arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term to denominator, weight_decay is L2 penalty, and amsgrad is boolean weather to use AMSGrad. Adam is subclass of torch.optim....
2
stack_v2_sparse_classes_30k_train_016142
Implement the Python class `SharedAdam` described below. Class description: Implement the SharedAdam class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): arguments are all default arguments of torch.optim.Adam. Params are weight...
Implement the Python class `SharedAdam` described below. Class description: Implement the SharedAdam class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): arguments are all default arguments of torch.optim.Adam. Params are weight...
6f38cfd121c504e78ecd4b7762e86f4825bb596d
<|skeleton|> class SharedAdam: def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): """arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SharedAdam: def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): """arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term to denominator...
the_stack_v2_python_sparse
algorithm/a3c_breakout.py
corot/reinforcement-learning
train
0
b3e39a1bb1553be909a04195dc2df49472001850
[ "from components.slots.slots import CategoricalSlot\nif not reuse:\n slot = CategoricalSlot(name=name, questioner=questioner, silent_value=silent_value, categories_synsets=categories_domain_specification).save()\nelse:\n slot, created = CategoricalSlot.get_or_create(name=name, questioner=questioner, silent_va...
<|body_start_0|> from components.slots.slots import CategoricalSlot if not reuse: slot = CategoricalSlot(name=name, questioner=questioner, silent_value=silent_value, categories_synsets=categories_domain_specification).save() else: slot, created = CategoricalSlot.get_or_cr...
Bunch of factory methods to create a Slot instances retrievable by Interactions from UserDialog TODO: should factory make registration of object?
SlotsFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlotsFactory: """Bunch of factory methods to create a Slot instances retrievable by Interactions from UserDialog TODO: should factory make registration of object?""" def produce_categorical_slot(cls, name, questioner, categories_domain_specification, requestioning_strategy='ResumeOnIdle', re...
stack_v2_sparse_classes_75kplus_train_072892
6,892
no_license
[ { "docstring": "factory method for production of unregistered slots with categorical values Args: name: name of slot questioner: categories_domain_specification: TODO specify format requestioning_strategy:", "name": "produce_categorical_slot", "signature": "def produce_categorical_slot(cls, name, questi...
5
stack_v2_sparse_classes_30k_train_018351
Implement the Python class `SlotsFactory` described below. Class description: Bunch of factory methods to create a Slot instances retrievable by Interactions from UserDialog TODO: should factory make registration of object? Method signatures and docstrings: - def produce_categorical_slot(cls, name, questioner, catego...
Implement the Python class `SlotsFactory` described below. Class description: Bunch of factory methods to create a Slot instances retrievable by Interactions from UserDialog TODO: should factory make registration of object? Method signatures and docstrings: - def produce_categorical_slot(cls, name, questioner, catego...
7a0bc78ca03ee8ca1202e8ad2a6860444f0ce75d
<|skeleton|> class SlotsFactory: """Bunch of factory methods to create a Slot instances retrievable by Interactions from UserDialog TODO: should factory make registration of object?""" def produce_categorical_slot(cls, name, questioner, categories_domain_specification, requestioning_strategy='ResumeOnIdle', re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SlotsFactory: """Bunch of factory methods to create a Slot instances retrievable by Interactions from UserDialog TODO: should factory make registration of object?""" def produce_categorical_slot(cls, name, questioner, categories_domain_specification, requestioning_strategy='ResumeOnIdle', reuse=True, sil...
the_stack_v2_python_sparse
ruler_bot/components/slots/slots_factory.py
acriptis/dj_bot
train
3
3c4af0957cd2bcc5c8b83ea53577392244bd6cdc
[ "self.event_id = event_id\nself.type = 'FILL'\nself.symbol = symbol\nself.fill_date = fill_date\nself.exchange = exchange\nself.quantity = quantity\nself.direction = direction\nself.price = price\nself.order_type = order_type\nif commission is None:\n self.commission = self.calculate_ib_commission()\nelse:\n ...
<|body_start_0|> self.event_id = event_id self.type = 'FILL' self.symbol = symbol self.fill_date = fill_date self.exchange = exchange self.quantity = quantity self.direction = direction self.price = price self.order_type = order_type if com...
计算下单需要的数据, 包括 数量, 价格, 交易费用等 将 订单 产生的Single注册为Event, 由 下单系统 处理
FillEvent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FillEvent: """计算下单需要的数据, 包括 数量, 价格, 交易费用等 将 订单 产生的Single注册为Event, 由 下单系统 处理""" def __init__(self, event_id, symbol, fill_date, exchange, quantity, direction, order_type, price, commission=None): """Initialises the FillEvent object. Sets the symbol, exchange, quantity, direction, cost...
stack_v2_sparse_classes_75kplus_train_072893
5,253
permissive
[ { "docstring": "Initialises the FillEvent object. Sets the symbol, exchange, quantity, direction, cost of fill and an optional commission. If commission is not provided, the Fill object will calculate it based on the trade size and Interactive Brokers fees. Parameters: event_id - 自增序列, 由一个事件引发的其余事件使用一个id, 用于追踪 ...
2
stack_v2_sparse_classes_30k_train_013168
Implement the Python class `FillEvent` described below. Class description: 计算下单需要的数据, 包括 数量, 价格, 交易费用等 将 订单 产生的Single注册为Event, 由 下单系统 处理 Method signatures and docstrings: - def __init__(self, event_id, symbol, fill_date, exchange, quantity, direction, order_type, price, commission=None): Initialises the FillEvent obj...
Implement the Python class `FillEvent` described below. Class description: 计算下单需要的数据, 包括 数量, 价格, 交易费用等 将 订单 产生的Single注册为Event, 由 下单系统 处理 Method signatures and docstrings: - def __init__(self, event_id, symbol, fill_date, exchange, quantity, direction, order_type, price, commission=None): Initialises the FillEvent obj...
f65122f5ed01cc1272fd2f03121ff3805a1967cb
<|skeleton|> class FillEvent: """计算下单需要的数据, 包括 数量, 价格, 交易费用等 将 订单 产生的Single注册为Event, 由 下单系统 处理""" def __init__(self, event_id, symbol, fill_date, exchange, quantity, direction, order_type, price, commission=None): """Initialises the FillEvent object. Sets the symbol, exchange, quantity, direction, cost...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FillEvent: """计算下单需要的数据, 包括 数量, 价格, 交易费用等 将 订单 产生的Single注册为Event, 由 下单系统 处理""" def __init__(self, event_id, symbol, fill_date, exchange, quantity, direction, order_type, price, commission=None): """Initialises the FillEvent object. Sets the symbol, exchange, quantity, direction, cost of fill and ...
the_stack_v2_python_sparse
trade_free/event.py
NewLanded/TradeFree
train
2
833d81a482d47135e45ff8e2016166896f6f5383
[ "if not s:\n return ''\nn, left, length = (len(s), 0, 1)\ndp = [[False] * n for _ in range(n)]\nfor i in range(n):\n dp[i][i] = True\nfor i in range(n - 1, 0, -1):\n if s[i] == s[i - 1]:\n dp[i - 1][i] = True\n length = 2\n left = i - 1\nfor k in range(3, n + 1):\n for i in range(0,...
<|body_start_0|> if not s: return '' n, left, length = (len(s), 0, 1) dp = [[False] * n for _ in range(n)] for i in range(n): dp[i][i] = True for i in range(n - 1, 0, -1): if s[i] == s[i - 1]: dp[i - 1][i] = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s: return '' n, left, length ...
stack_v2_sparse_classes_75kplus_train_072894
1,533
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_011362
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def longestPalindrome(self...
75aef2f6c42aeb51261b9450a24099957a084d51
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if not s: return '' n, left, length = (len(s), 0, 1) dp = [[False] * n for _ in range(n)] for i in range(n): dp[i][i] = True for i in range(n - 1, 0, -1): ...
the_stack_v2_python_sparse
Python/0005_LongestPalindromicSubstring/longestPalindrome.py
mtmmy/Leetcode
train
3
bbabdd8dcb523a539fc0cba2f95ba346e0000c55
[ "if level != 0:\n image1 = ImageExtender.extend_image(image, int(image.width), int(image.height))\n image2 = GaussianNoiseGenerator.generate_gaussian_noise_by_level(image1, level, image.width)\n return BoundedImageCropper.crop_bounded_image_inverse(image2, (255, 255, 255, 0))\nelse:\n return image", "...
<|body_start_0|> if level != 0: image1 = ImageExtender.extend_image(image, int(image.width), int(image.height)) image2 = GaussianNoiseGenerator.generate_gaussian_noise_by_level(image1, level, image.width) return BoundedImageCropper.crop_bounded_image_inverse(image2, (255, 255...
NoisedImageGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoisedImageGenerator: def generate_noised_image_by_level(image, level): """Blur an image with the intended noise level :param image: the image to modify :param level: the level of the noise (more explanation in gaussian_noise_generator) :type image: an image file :type level: int (prefer...
stack_v2_sparse_classes_75kplus_train_072895
1,670
permissive
[ { "docstring": "Blur an image with the intended noise level :param image: the image to modify :param level: the level of the noise (more explanation in gaussian_noise_generator) :type image: an image file :type level: int (preferably from 0 to 100)", "name": "generate_noised_image_by_level", "signature"...
2
stack_v2_sparse_classes_30k_train_028474
Implement the Python class `NoisedImageGenerator` described below. Class description: Implement the NoisedImageGenerator class. Method signatures and docstrings: - def generate_noised_image_by_level(image, level): Blur an image with the intended noise level :param image: the image to modify :param level: the level of...
Implement the Python class `NoisedImageGenerator` described below. Class description: Implement the NoisedImageGenerator class. Method signatures and docstrings: - def generate_noised_image_by_level(image, level): Blur an image with the intended noise level :param image: the image to modify :param level: the level of...
8931c8859878692134f5113d4c6c3e17561f0196
<|skeleton|> class NoisedImageGenerator: def generate_noised_image_by_level(image, level): """Blur an image with the intended noise level :param image: the image to modify :param level: the level of the noise (more explanation in gaussian_noise_generator) :type image: an image file :type level: int (prefer...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NoisedImageGenerator: def generate_noised_image_by_level(image, level): """Blur an image with the intended noise level :param image: the image to modify :param level: the level of the noise (more explanation in gaussian_noise_generator) :type image: an image file :type level: int (preferably from 0 to...
the_stack_v2_python_sparse
UpdatedSyntheticDataset/SyntheticDataset2/ElementsCreator/noised_image_generator.py
FlintHill/SUAS-Competition
train
5
d8b7e5049481d013cf8bec0ffa5b371ec8b886ac
[ "self.suits = {}\nfor card in self.cards:\n self.suits[card.suit] = self.suits.get(card.suit, 0) + 1", "self.suit_hist()\nfor val in self.suits.values():\n if val >= 5:\n return True\nreturn False" ]
<|body_start_0|> self.suits = {} for card in self.cards: self.suits[card.suit] = self.suits.get(card.suit, 0) + 1 <|end_body_0|> <|body_start_1|> self.suit_hist() for val in self.suits.values(): if val >= 5: return True return False <|end_...
Represents a poker hand.
PokerHand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PokerHand: """Represents a poker hand.""" def suit_hist(self): """Builds a histogram of the suits that appear in the hand. Stores the result in attribute suits.""" <|body_0|> def has_flush(self): """Returns True if the hand has a flush, False otherwise. Note that...
stack_v2_sparse_classes_75kplus_train_072896
1,245
permissive
[ { "docstring": "Builds a histogram of the suits that appear in the hand. Stores the result in attribute suits.", "name": "suit_hist", "signature": "def suit_hist(self)" }, { "docstring": "Returns True if the hand has a flush, False otherwise. Note that this works correctly for hands with more th...
2
stack_v2_sparse_classes_30k_test_000178
Implement the Python class `PokerHand` described below. Class description: Represents a poker hand. Method signatures and docstrings: - def suit_hist(self): Builds a histogram of the suits that appear in the hand. Stores the result in attribute suits. - def has_flush(self): Returns True if the hand has a flush, False...
Implement the Python class `PokerHand` described below. Class description: Represents a poker hand. Method signatures and docstrings: - def suit_hist(self): Builds a histogram of the suits that appear in the hand. Stores the result in attribute suits. - def has_flush(self): Returns True if the hand has a flush, False...
7961de5ba9923512bd50c579c37f1dadf070b692
<|skeleton|> class PokerHand: """Represents a poker hand.""" def suit_hist(self): """Builds a histogram of the suits that appear in the hand. Stores the result in attribute suits.""" <|body_0|> def has_flush(self): """Returns True if the hand has a flush, False otherwise. Note that...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PokerHand: """Represents a poker hand.""" def suit_hist(self): """Builds a histogram of the suits that appear in the hand. Stores the result in attribute suits.""" self.suits = {} for card in self.cards: self.suits[card.suit] = self.suits.get(card.suit, 0) + 1 def...
the_stack_v2_python_sparse
thinkpython/18/PokerHand.py
Hellorelei/oc-2018
train
0
de48ea093cbca475fc04911d694b91cd53c1d68b
[ "begin = 0\nend = len(height) - 1\nmaxArea = -1\nwhile begin < end:\n if height[begin] <= height[end]:\n maxArea = max(maxArea, height[begin] * (end - begin))\n begin += 1\n else:\n maxArea = max(maxArea, height[end] * (end - begin))\n end -= 1\nreturn maxArea", "maxArea = -1\nma...
<|body_start_0|> begin = 0 end = len(height) - 1 maxArea = -1 while begin < end: if height[begin] <= height[end]: maxArea = max(maxArea, height[begin] * (end - begin)) begin += 1 else: maxArea = max(maxArea, height[e...
AC time complexity O(n) reference to Solution 2
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """AC time complexity O(n) reference to Solution 2""" def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea_WA(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_75kplus_train_072897
2,574
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea_WA", "signature": "def maxArea_WA(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_053963
Implement the Python class `Solution` described below. Class description: AC time complexity O(n) reference to Solution 2 Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea_WA(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: AC time complexity O(n) reference to Solution 2 Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea_WA(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution:...
2e146808b2d3259965d9aa671f2956b130d43a7e
<|skeleton|> class Solution: """AC time complexity O(n) reference to Solution 2""" def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea_WA(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """AC time complexity O(n) reference to Solution 2""" def maxArea(self, height): """:type height: List[int] :rtype: int""" begin = 0 end = len(height) - 1 maxArea = -1 while begin < end: if height[begin] <= height[end]: maxArea...
the_stack_v2_python_sparse
medium/11_containerWithMostWater.py
grapefruit623/leetcode
train
0
305572fe9bd59dbccba654884516e2bf5b0421d3
[ "super().__init__()\nself.hypo_parameters = dict(hypo_module.meta_named_parameters())\nself.representation_dim = 0\nself.rank = rank\nself.names = []\nself.nets = nn.ModuleList()\nself.param_shapes = []\nfor name, param in self.hypo_parameters.items():\n self.names.append(name)\n self.param_shapes.append(para...
<|body_start_0|> super().__init__() self.hypo_parameters = dict(hypo_module.meta_named_parameters()) self.representation_dim = 0 self.rank = rank self.names = [] self.nets = nn.ModuleList() self.param_shapes = [] for name, param in self.hypo_parameters.ite...
LowRankHyperNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LowRankHyperNetwork: def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, linear=False, rank=10, nonlinearity='relu'): """Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidd...
stack_v2_sparse_classes_75kplus_train_072898
7,605
no_license
[ { "docstring": "Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: Number of hidden units in hypernetwork hypo_module: MetaModule. The module whose parameters are predicted.", "name": "__init__", "signature": "def __in...
2
stack_v2_sparse_classes_30k_train_019840
Implement the Python class `LowRankHyperNetwork` described below. Class description: Implement the LowRankHyperNetwork class. Method signatures and docstrings: - def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, linear=False, rank=10, nonlinearity='relu'): Args: hyper_in_f...
Implement the Python class `LowRankHyperNetwork` described below. Class description: Implement the LowRankHyperNetwork class. Method signatures and docstrings: - def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, linear=False, rank=10, nonlinearity='relu'): Args: hyper_in_f...
1c2ba87c6b2cf89f14ea43ec14b179579cbc9220
<|skeleton|> class LowRankHyperNetwork: def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, linear=False, rank=10, nonlinearity='relu'): """Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidd...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LowRankHyperNetwork: def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, linear=False, rank=10, nonlinearity='relu'): """Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: N...
the_stack_v2_python_sparse
colf/supplementary_colf/code/hyperlayers.py
cameronosmith/cameronosmith.github.io
train
0
e7de1083ef3d794c292c21d9936230232ec7eb7a
[ "self.type = 'FILL'\nself.timeindex = timeindex\nself.symbol = symbol\nself.exchange = exchange\nself.quantity = quantity\nself.direction = direction\nself.fill_cost = fill_cost\nif commission is None:\n self.commission = self.calculate_ib_commission()\nelse:\n self.commission = commission", "full_cost = 1....
<|body_start_0|> self.type = 'FILL' self.timeindex = timeindex self.symbol = symbol self.exchange = exchange self.quantity = quantity self.direction = direction self.fill_cost = fill_cost if commission is None: self.commission = self.calculate_...
Encapsulates the notion of a Filled Order, as returned from a brokerage. Stores the quantity of an instrument actually filled and at what price. In addition, stores the commission of the trade from the brokerage.
FillEvent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FillEvent: """Encapsulates the notion of a Filled Order, as returned from a brokerage. Stores the quantity of an instrument actually filled and at what price. In addition, stores the commission of the trade from the brokerage.""" def __init__(self, timeindex, symbol, exchange, quantity, dire...
stack_v2_sparse_classes_75kplus_train_072899
4,992
no_license
[ { "docstring": "Initializes the FillEvent object. Sets the symbol, exchange, quantity, direction, cost of fill, and an optional commission. If commission is not provided, the Fill object will calculate it based on the trade size and Interactive Brokers fees. Parameters ---------- @timeindex: The bar-resolution ...
2
stack_v2_sparse_classes_30k_train_027925
Implement the Python class `FillEvent` described below. Class description: Encapsulates the notion of a Filled Order, as returned from a brokerage. Stores the quantity of an instrument actually filled and at what price. In addition, stores the commission of the trade from the brokerage. Method signatures and docstrin...
Implement the Python class `FillEvent` described below. Class description: Encapsulates the notion of a Filled Order, as returned from a brokerage. Stores the quantity of an instrument actually filled and at what price. In addition, stores the commission of the trade from the brokerage. Method signatures and docstrin...
c0fa7da1903fc531d7be00ef468b498c631e3e1d
<|skeleton|> class FillEvent: """Encapsulates the notion of a Filled Order, as returned from a brokerage. Stores the quantity of an instrument actually filled and at what price. In addition, stores the commission of the trade from the brokerage.""" def __init__(self, timeindex, symbol, exchange, quantity, dire...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FillEvent: """Encapsulates the notion of a Filled Order, as returned from a brokerage. Stores the quantity of an instrument actually filled and at what price. In addition, stores the commission of the trade from the brokerage.""" def __init__(self, timeindex, symbol, exchange, quantity, direction, fill_c...
the_stack_v2_python_sparse
EventDrivenBacktester/EventClasses.py
nicktheodore/EventDrivenBacktestingEngine
train
0