blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
729a3eb68034a3f73c67c66af776a625880feb83
[ "self.fname = fname\nself.U = mean_flow\nself.d_max = d_max\nself.particles = {}\ndata = loadtxt(self.fname)\nself.times = list(set(data[:, -1]))\nfor tm in self.times:\n self.particles[tm] = []\n p_ = data[data[:, -1] == tm]\n for i in range(p_.shape[0]):\n p = array([-1] + list(p_[i, :]))\n ...
<|body_start_0|> self.fname = fname self.U = mean_flow self.d_max = d_max self.particles = {} data = loadtxt(self.fname) self.times = list(set(data[:, -1])) for tm in self.times: self.particles[tm] = [] p_ = data[data[:, -1] == tm] ...
A nearest-neighbour 3D particle tracking algorithm
tracker_nearest_neighbour
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tracker_nearest_neighbour: """A nearest-neighbour 3D particle tracking algorithm""" def __init__(self, fname, mean_flow=0.0, d_max=10000000000.0): """fname - string, path of the particles containing file to which tracking should be performed. mean_flow - a numpy array of the mean flo...
stack_v2_sparse_classes_36k_train_032500
26,658
permissive
[ { "docstring": "fname - string, path of the particles containing file to which tracking should be performed. mean_flow - a numpy array of the mean flow vector, in units of the calibrations spatial units per frame (e.g. mm per frame). The mean flow is assumed not to change in space and time. d_max - maximum allo...
6
stack_v2_sparse_classes_30k_train_019536
Implement the Python class `tracker_nearest_neighbour` described below. Class description: A nearest-neighbour 3D particle tracking algorithm Method signatures and docstrings: - def __init__(self, fname, mean_flow=0.0, d_max=10000000000.0): fname - string, path of the particles containing file to which tracking shoul...
Implement the Python class `tracker_nearest_neighbour` described below. Class description: A nearest-neighbour 3D particle tracking algorithm Method signatures and docstrings: - def __init__(self, fname, mean_flow=0.0, d_max=10000000000.0): fname - string, path of the particles containing file to which tracking shoul...
6b81c66ce5b63b7e6b833db19ebf5f117c90c9e8
<|skeleton|> class tracker_nearest_neighbour: """A nearest-neighbour 3D particle tracking algorithm""" def __init__(self, fname, mean_flow=0.0, d_max=10000000000.0): """fname - string, path of the particles containing file to which tracking should be performed. mean_flow - a numpy array of the mean flo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tracker_nearest_neighbour: """A nearest-neighbour 3D particle tracking algorithm""" def __init__(self, fname, mean_flow=0.0, d_max=10000000000.0): """fname - string, path of the particles containing file to which tracking should be performed. mean_flow - a numpy array of the mean flow vector, in ...
the_stack_v2_python_sparse
myptv/tracking_mod.py
ronshnapp/MyPTV
train
28
8eccf0e5cf8e669b0ab4df4a7084aa00f6db75bc
[ "for name in self.__dict__:\n if name in override_parameters:\n override_value = override_parameters[name]\n if override_value is not None:\n setattr(self, name, override_value.copy())", "if self.always:\n for attribute_name in self.__dict__:\n if attribute_name != 'always':\...
<|body_start_0|> for name in self.__dict__: if name in override_parameters: override_value = override_parameters[name] if override_value is not None: setattr(self, name, override_value.copy()) <|end_body_0|> <|body_start_1|> if self.always...
Lists that are used to configure outputs
OutputLists
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputLists: """Lists that are used to configure outputs""" def update(self, override_parameters: Dict) -> None: """update all parameters with any non-None values in override_parameters Note, the override_parameters input is not the full parameter set, it contains a dict that maps to...
stack_v2_sparse_classes_36k_train_032501
12,746
permissive
[ { "docstring": "update all parameters with any non-None values in override_parameters Note, the override_parameters input is not the full parameter set, it contains a dict that maps to an OutputList", "name": "update", "signature": "def update(self, override_parameters: Dict) -> None" }, { "docs...
2
stack_v2_sparse_classes_30k_val_000868
Implement the Python class `OutputLists` described below. Class description: Lists that are used to configure outputs Method signatures and docstrings: - def update(self, override_parameters: Dict) -> None: update all parameters with any non-None values in override_parameters Note, the override_parameters input is no...
Implement the Python class `OutputLists` described below. Class description: Lists that are used to configure outputs Method signatures and docstrings: - def update(self, override_parameters: Dict) -> None: update all parameters with any non-None values in override_parameters Note, the override_parameters input is no...
909ede3d1fe75fa5d64c6ff1b4c6016dc3df6746
<|skeleton|> class OutputLists: """Lists that are used to configure outputs""" def update(self, override_parameters: Dict) -> None: """update all parameters with any non-None values in override_parameters Note, the override_parameters input is not the full parameter set, it contains a dict that maps to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutputLists: """Lists that are used to configure outputs""" def update(self, override_parameters: Dict) -> None: """update all parameters with any non-None values in override_parameters Note, the override_parameters input is not the full parameter set, it contains a dict that maps to an OutputLis...
the_stack_v2_python_sparse
metatlas/tools/config.py
biorack/metatlas
train
10
ef5cb29c6e8b6c990f5416606b8c73f1c8ad09e4
[ "self.affine_layer = Affine()\nself.relu_layer = ReLU()\nif dropout_param is not None:\n self.dropout_layer = Dropout(prob=dropout_param['prob'], seed=dropout_param.get('seed', None))\nelse:\n self.dropout_layer = Dropout()", "affine_out = self.affine_layer.forward_pass(x, w, b)\nrelu_out = self.relu_layer....
<|body_start_0|> self.affine_layer = Affine() self.relu_layer = ReLU() if dropout_param is not None: self.dropout_layer = Dropout(prob=dropout_param['prob'], seed=dropout_param.get('seed', None)) else: self.dropout_layer = Dropout() <|end_body_0|> <|body_start_1|...
AffineReLUDropout
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AffineReLUDropout: def __init__(self, dropout_param=None): """Args: dropout_param: A dictionary with the following key(s): - prob: Probability for each neuron to drop out, required - seed: Seeding integer for random generator, optional""" <|body_0|> def forward_pass(self, x,...
stack_v2_sparse_classes_36k_train_032502
1,923
no_license
[ { "docstring": "Args: dropout_param: A dictionary with the following key(s): - prob: Probability for each neuron to drop out, required - seed: Seeding integer for random generator, optional", "name": "__init__", "signature": "def __init__(self, dropout_param=None)" }, { "docstring": "Performs fo...
3
null
Implement the Python class `AffineReLUDropout` described below. Class description: Implement the AffineReLUDropout class. Method signatures and docstrings: - def __init__(self, dropout_param=None): Args: dropout_param: A dictionary with the following key(s): - prob: Probability for each neuron to drop out, required -...
Implement the Python class `AffineReLUDropout` described below. Class description: Implement the AffineReLUDropout class. Method signatures and docstrings: - def __init__(self, dropout_param=None): Args: dropout_param: A dictionary with the following key(s): - prob: Probability for each neuron to drop out, required -...
7da789ef34d5e5bcf9033cfbe0ff5df607b2437a
<|skeleton|> class AffineReLUDropout: def __init__(self, dropout_param=None): """Args: dropout_param: A dictionary with the following key(s): - prob: Probability for each neuron to drop out, required - seed: Seeding integer for random generator, optional""" <|body_0|> def forward_pass(self, x,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AffineReLUDropout: def __init__(self, dropout_param=None): """Args: dropout_param: A dictionary with the following key(s): - prob: Probability for each neuron to drop out, required - seed: Seeding integer for random generator, optional""" self.affine_layer = Affine() self.relu_layer = ...
the_stack_v2_python_sparse
convolutional_neural_networks/conv_net/composite/affine_relu_dropout.py
calvinfeng/machine-learning-notebook
train
38
d98c900e59d00e5c3f03ff7f3dd1fea9267eed7d
[ "detector = MTCNN()\noffset_percent = 0.2\nmin_confidence = 0.9\ndebug_ = True if 'debug' in opts else False\nframe_set_path = FrameSetSubDir.path(frame_set_id)\ntransform_set_id = TransformSetModel().insert(self.name, frame_set_id)\ntransform_set_path = TransformSetSubDir.path(transform_set_id)\nos.makedirs(transf...
<|body_start_0|> detector = MTCNN() offset_percent = 0.2 min_confidence = 0.9 debug_ = True if 'debug' in opts else False frame_set_path = FrameSetSubDir.path(frame_set_id) transform_set_id = TransformSetModel().insert(self.name, frame_set_id) transform_set_path =...
This class implements the MTCNNFrameSetSelectExtractPlugin class.
MTCNNFrameSetSelectExtractPlugin
[ "BSD-3-Clause-Clear" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MTCNNFrameSetSelectExtractPlugin: """This class implements the MTCNNFrameSetSelectExtractPlugin class.""" def frame_set_select_extract(self, frame_set_id, opts): """This method extracts faces from each frame in a frame set. :param int frame_set_id: The frame set ID. :param dict opts:...
stack_v2_sparse_classes_36k_train_032503
4,679
permissive
[ { "docstring": "This method extracts faces from each frame in a frame set. :param int frame_set_id: The frame set ID. :param dict opts: The dict of opts. :rtype: int", "name": "frame_set_select_extract", "signature": "def frame_set_select_extract(self, frame_set_id, opts)" }, { "docstring": "Thi...
2
null
Implement the Python class `MTCNNFrameSetSelectExtractPlugin` described below. Class description: This class implements the MTCNNFrameSetSelectExtractPlugin class. Method signatures and docstrings: - def frame_set_select_extract(self, frame_set_id, opts): This method extracts faces from each frame in a frame set. :pa...
Implement the Python class `MTCNNFrameSetSelectExtractPlugin` described below. Class description: This class implements the MTCNNFrameSetSelectExtractPlugin class. Method signatures and docstrings: - def frame_set_select_extract(self, frame_set_id, opts): This method extracts faces from each frame in a frame set. :pa...
fe0fe12317975104fa6ff6c058d141f11e6e951d
<|skeleton|> class MTCNNFrameSetSelectExtractPlugin: """This class implements the MTCNNFrameSetSelectExtractPlugin class.""" def frame_set_select_extract(self, frame_set_id, opts): """This method extracts faces from each frame in a frame set. :param int frame_set_id: The frame set ID. :param dict opts:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MTCNNFrameSetSelectExtractPlugin: """This class implements the MTCNNFrameSetSelectExtractPlugin class.""" def frame_set_select_extract(self, frame_set_id, opts): """This method extracts faces from each frame in a frame set. :param int frame_set_id: The frame set ID. :param dict opts: The dict of ...
the_stack_v2_python_sparse
deepstar/plugins/mtcnn_frame_set_select_extract_plugin.py
lcsouzamenezes/deepstar
train
0
e5f17b8d90a485bc0aa84624d66872474fb08b83
[ "_LOGGER.info('validate: Got type %s', type(value))\nif value is not None and (not isinstance(value, client.Credentials)):\n raise TypeError('Property {0} must be convertible to a credentials instance; received: {1}.'.format(self._name, value))", "if value is None:\n return ''\nelse:\n return value.to_js...
<|body_start_0|> _LOGGER.info('validate: Got type %s', type(value)) if value is not None and (not isinstance(value, client.Credentials)): raise TypeError('Property {0} must be convertible to a credentials instance; received: {1}.'.format(self._name, value)) <|end_body_0|> <|body_start_1|> ...
App Engine NDB datastore Property for Credentials. Serves the same purpose as the DB CredentialsProperty, but for NDB models. Since CredentialsProperty stores data as a blob and this inherits from BlobProperty, the data in the datastore will be the same as in the DB case. Utility property that allows easy storage and r...
CredentialsNDBProperty
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CredentialsNDBProperty: """App Engine NDB datastore Property for Credentials. Serves the same purpose as the DB CredentialsProperty, but for NDB models. Since CredentialsProperty stores data as a blob and this inherits from BlobProperty, the data in the datastore will be the same as in the DB cas...
stack_v2_sparse_classes_36k_train_032504
5,381
permissive
[ { "docstring": "Validates a value as a proper credentials object. Args: value: A value to be set on the property. Raises: TypeError if the value is not an instance of Credentials.", "name": "_validate", "signature": "def _validate(self, value)" }, { "docstring": "Converts our validated value to ...
3
null
Implement the Python class `CredentialsNDBProperty` described below. Class description: App Engine NDB datastore Property for Credentials. Serves the same purpose as the DB CredentialsProperty, but for NDB models. Since CredentialsProperty stores data as a blob and this inherits from BlobProperty, the data in the data...
Implement the Python class `CredentialsNDBProperty` described below. Class description: App Engine NDB datastore Property for Credentials. Serves the same purpose as the DB CredentialsProperty, but for NDB models. Since CredentialsProperty stores data as a blob and this inherits from BlobProperty, the data in the data...
975a95032ce5b7012d1772c7f1f5cfe606eae839
<|skeleton|> class CredentialsNDBProperty: """App Engine NDB datastore Property for Credentials. Serves the same purpose as the DB CredentialsProperty, but for NDB models. Since CredentialsProperty stores data as a blob and this inherits from BlobProperty, the data in the datastore will be the same as in the DB cas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CredentialsNDBProperty: """App Engine NDB datastore Property for Credentials. Serves the same purpose as the DB CredentialsProperty, but for NDB models. Since CredentialsProperty stores data as a blob and this inherits from BlobProperty, the data in the datastore will be the same as in the DB case. Utility pr...
the_stack_v2_python_sparse
courses/machine_learning/deepdive2/end_to_end_ml/solutions/serving/application/lib/oauth2client/contrib/_appengine_ndb.py
GoogleCloudPlatform/training-data-analyst
train
7,311
f187006e01fc57789e714d7778b7868779b7bbe4
[ "context = super().get_context_data(*args, **kwargs)\nsearch_text = self.request.GET['product_search']\nproducts = self.get_products(search_text)\ncontext['suppliers'] = sort_products_by_supplier(products)\nreorders = models.Reorder.objects.filter(product__in=products).open()\ncontext['reorder_counts'] = {}\ncontex...
<|body_start_0|> context = super().get_context_data(*args, **kwargs) search_text = self.request.GET['product_search'] products = self.get_products(search_text) context['suppliers'] = sort_products_by_supplier(products) reorders = models.Reorder.objects.filter(product__in=products...
View for restock page search results.
SearchResults
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchResults: """View for restock page search results.""" def get_context_data(self, *args, **kwargs): """Return context for the template.""" <|body_0|> def get_products(self, search_text): """Return products matching the search string.""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_032505
6,889
no_license
[ { "docstring": "Return context for the template.", "name": "get_context_data", "signature": "def get_context_data(self, *args, **kwargs)" }, { "docstring": "Return products matching the search string.", "name": "get_products", "signature": "def get_products(self, search_text)" } ]
2
stack_v2_sparse_classes_30k_train_019040
Implement the Python class `SearchResults` described below. Class description: View for restock page search results. Method signatures and docstrings: - def get_context_data(self, *args, **kwargs): Return context for the template. - def get_products(self, search_text): Return products matching the search string.
Implement the Python class `SearchResults` described below. Class description: View for restock page search results. Method signatures and docstrings: - def get_context_data(self, *args, **kwargs): Return context for the template. - def get_products(self, search_text): Return products matching the search string. <|s...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class SearchResults: """View for restock page search results.""" def get_context_data(self, *args, **kwargs): """Return context for the template.""" <|body_0|> def get_products(self, search_text): """Return products matching the search string.""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchResults: """View for restock page search results.""" def get_context_data(self, *args, **kwargs): """Return context for the template.""" context = super().get_context_data(*args, **kwargs) search_text = self.request.GET['product_search'] products = self.get_products(...
the_stack_v2_python_sparse
restock/views.py
stcstores/stcadmin
train
0
1c9dbcbc2355b6faf0dc17559bf5561e80e5caa4
[ "super().__init__(**kwargs)\nif differentiator is None:\n differentiator = parameter_shift.ParameterShift()\nif not isinstance(differentiator, diff.Differentiator):\n raise TypeError('Differentiator must inherit from tfq.differentiators.Differentiator')\nif not isinstance(backend, cirq.Sampler) and isinstance...
<|body_start_0|> super().__init__(**kwargs) if differentiator is None: differentiator = parameter_shift.ParameterShift() if not isinstance(differentiator, diff.Differentiator): raise TypeError('Differentiator must inherit from tfq.differentiators.Differentiator') ...
A layer that calculates a sampled expectation value. Given an input circuit and set of parameter values, output expectation values of observables computed using measurement results sampled from the input circuit. First define a simple helper function for generating a parametrized quantum circuit that we will use throug...
SampledExpectation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampledExpectation: """A layer that calculates a sampled expectation value. Given an input circuit and set of parameter values, output expectation values of observables computed using measurement results sampled from the input circuit. First define a simple helper function for generating a parame...
stack_v2_sparse_classes_36k_train_032506
14,093
permissive
[ { "docstring": "Instantiate this Layer. Create a layer that will output expectation values gained from sampling a quantum circuit. Args: backend: Optional Backend to use to simulate states. Can be either {'noiseless', 'noisy'} users may also specify a preconfigured `cirq.Sampler` object to use instead. differen...
2
stack_v2_sparse_classes_30k_train_001376
Implement the Python class `SampledExpectation` described below. Class description: A layer that calculates a sampled expectation value. Given an input circuit and set of parameter values, output expectation values of observables computed using measurement results sampled from the input circuit. First define a simple ...
Implement the Python class `SampledExpectation` described below. Class description: A layer that calculates a sampled expectation value. Given an input circuit and set of parameter values, output expectation values of observables computed using measurement results sampled from the input circuit. First define a simple ...
f56257bceb988b743790e1e480eac76fd036d4ff
<|skeleton|> class SampledExpectation: """A layer that calculates a sampled expectation value. Given an input circuit and set of parameter values, output expectation values of observables computed using measurement results sampled from the input circuit. First define a simple helper function for generating a parame...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SampledExpectation: """A layer that calculates a sampled expectation value. Given an input circuit and set of parameter values, output expectation values of observables computed using measurement results sampled from the input circuit. First define a simple helper function for generating a parametrized quantu...
the_stack_v2_python_sparse
tensorflow_quantum/python/layers/circuit_executors/sampled_expectation.py
tensorflow/quantum
train
1,799
dbef54efe0dba295d211f38b2fb631354546f080
[ "assert len(input_data.shape) == 2\nassert len(output_data.shape) == 2\nassert input_data.shape[0] == output_data.shape[0]\nregressor = linear_model.LinearRegression(copy_X=True, fit_intercept=bias)\nregressor.fit(X=input_data, y=output_data)\nlogger.info('finished linear regression fit ')\nnew_weight = regressor.c...
<|body_start_0|> assert len(input_data.shape) == 2 assert len(output_data.shape) == 2 assert input_data.shape[0] == output_data.shape[0] regressor = linear_model.LinearRegression(copy_X=True, fit_intercept=bias) regressor.fit(X=input_data, y=output_data) logger.info('fini...
Class enables weights to be reconstructed for a channel-pruned layer
WeightReconstructor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeightReconstructor: """Class enables weights to be reconstructed for a channel-pruned layer""" def _linear_regression(input_data: np.ndarray, output_data: np.ndarray, bias: bool) -> (np.ndarray, np.ndarray): """least square linear regression Given a matrix of input_data (X) and outp...
stack_v2_sparse_classes_36k_train_032507
6,907
permissive
[ { "docstring": "least square linear regression Given a matrix of input_data (X) and output_data (y), linear regression attempts to find solution vector (W) that will approximate y = W * X + b. :param input_data: input_data, in the shape of [n_samples, n_features] :param output_data: output_data, in the shape of...
3
null
Implement the Python class `WeightReconstructor` described below. Class description: Class enables weights to be reconstructed for a channel-pruned layer Method signatures and docstrings: - def _linear_regression(input_data: np.ndarray, output_data: np.ndarray, bias: bool) -> (np.ndarray, np.ndarray): least square li...
Implement the Python class `WeightReconstructor` described below. Class description: Class enables weights to be reconstructed for a channel-pruned layer Method signatures and docstrings: - def _linear_regression(input_data: np.ndarray, output_data: np.ndarray, bias: bool) -> (np.ndarray, np.ndarray): least square li...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class WeightReconstructor: """Class enables weights to be reconstructed for a channel-pruned layer""" def _linear_regression(input_data: np.ndarray, output_data: np.ndarray, bias: bool) -> (np.ndarray, np.ndarray): """least square linear regression Given a matrix of input_data (X) and outp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeightReconstructor: """Class enables weights to be reconstructed for a channel-pruned layer""" def _linear_regression(input_data: np.ndarray, output_data: np.ndarray, bias: bool) -> (np.ndarray, np.ndarray): """least square linear regression Given a matrix of input_data (X) and output_data (y), ...
the_stack_v2_python_sparse
TrainingExtensions/torch/src/python/aimet_torch/channel_pruning/weight_reconstruction.py
quic/aimet
train
1,676
5ed40b0c2124d4659b163f7515f7ac00128620dc
[ "self.broadcast_threshold = broadcast_threshold\nself.multicast_threshold = multicast_threshold\nself.unknown_unicast_threshold = unknown_unicast_threshold", "if dictionary is None:\n return None\nbroadcast_threshold = dictionary.get('broadcastThreshold')\nmulticast_threshold = dictionary.get('multicastThresho...
<|body_start_0|> self.broadcast_threshold = broadcast_threshold self.multicast_threshold = multicast_threshold self.unknown_unicast_threshold = unknown_unicast_threshold <|end_body_0|> <|body_start_1|> if dictionary is None: return None broadcast_threshold = dictiona...
Implementation of the 'updateNetworkSwitchSettingsStormControl' model. TODO: type model description here. Attributes: broadcast_threshold (int): Percentage (1 to 99) of total available port bandwidth for broadcast traffic type. Default value 100 percent rate is to clear the configuration. multicast_threshold (int): Per...
UpdateNetworkSwitchSettingsStormControlModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkSwitchSettingsStormControlModel: """Implementation of the 'updateNetworkSwitchSettingsStormControl' model. TODO: type model description here. Attributes: broadcast_threshold (int): Percentage (1 to 99) of total available port bandwidth for broadcast traffic type. Default value 100 pe...
stack_v2_sparse_classes_36k_train_032508
2,778
permissive
[ { "docstring": "Constructor for the UpdateNetworkSwitchSettingsStormControlModel class", "name": "__init__", "signature": "def __init__(self, broadcast_threshold=None, multicast_threshold=None, unknown_unicast_threshold=None)" }, { "docstring": "Creates an instance of this model from a dictionar...
2
stack_v2_sparse_classes_30k_train_000292
Implement the Python class `UpdateNetworkSwitchSettingsStormControlModel` described below. Class description: Implementation of the 'updateNetworkSwitchSettingsStormControl' model. TODO: type model description here. Attributes: broadcast_threshold (int): Percentage (1 to 99) of total available port bandwidth for broad...
Implement the Python class `UpdateNetworkSwitchSettingsStormControlModel` described below. Class description: Implementation of the 'updateNetworkSwitchSettingsStormControl' model. TODO: type model description here. Attributes: broadcast_threshold (int): Percentage (1 to 99) of total available port bandwidth for broad...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkSwitchSettingsStormControlModel: """Implementation of the 'updateNetworkSwitchSettingsStormControl' model. TODO: type model description here. Attributes: broadcast_threshold (int): Percentage (1 to 99) of total available port bandwidth for broadcast traffic type. Default value 100 pe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNetworkSwitchSettingsStormControlModel: """Implementation of the 'updateNetworkSwitchSettingsStormControl' model. TODO: type model description here. Attributes: broadcast_threshold (int): Percentage (1 to 99) of total available port bandwidth for broadcast traffic type. Default value 100 percent rate is...
the_stack_v2_python_sparse
meraki/models/update_network_switch_settings_storm_control_model.py
RaulCatalano/meraki-python-sdk
train
1
1d2cd9bd9615ce46726039047b1a32fbbf4011cb
[ "self.sentences = sentences\nself.frequency_elements = frequency_elements\nself.split_train_test = split_train_test\nself.max_speakers = max_speakers\nself.speaker_list = speaker_list\nself.max_audio_length = max_audio_length\nif output_name is None:\n self.output_name = speaker_list\nelse:\n self.output_name...
<|body_start_0|> self.sentences = sentences self.frequency_elements = frequency_elements self.split_train_test = split_train_test self.max_speakers = max_speakers self.speaker_list = speaker_list self.max_audio_length = max_audio_length if output_name is None: ...
Speaker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Speaker: def __init__(self, split_train_test, max_speakers, speaker_list, output_name=None, sentences=10, frequency_elements=128, max_audio_length=800): """Represents a fully defined speaker in the Speaker clustering suite. :param frequency_elements: How many frequency elements should be...
stack_v2_sparse_classes_36k_train_032509
4,024
no_license
[ { "docstring": "Represents a fully defined speaker in the Speaker clustering suite. :param frequency_elements: How many frequency elements should be in a spectrogram :param split_train_test: Whether or not to split the test and training data :param max_speakers: The maximum amount of speakers to fetch from TIMI...
3
stack_v2_sparse_classes_30k_train_007965
Implement the Python class `Speaker` described below. Class description: Implement the Speaker class. Method signatures and docstrings: - def __init__(self, split_train_test, max_speakers, speaker_list, output_name=None, sentences=10, frequency_elements=128, max_audio_length=800): Represents a fully defined speaker i...
Implement the Python class `Speaker` described below. Class description: Implement the Speaker class. Method signatures and docstrings: - def __init__(self, split_train_test, max_speakers, speaker_list, output_name=None, sentences=10, frequency_elements=128, max_audio_length=800): Represents a fully defined speaker i...
baf97bd4815a92c769276b84224d9f9f6c3fc59a
<|skeleton|> class Speaker: def __init__(self, split_train_test, max_speakers, speaker_list, output_name=None, sentences=10, frequency_elements=128, max_audio_length=800): """Represents a fully defined speaker in the Speaker clustering suite. :param frequency_elements: How many frequency elements should be...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Speaker: def __init__(self, split_train_test, max_speakers, speaker_list, output_name=None, sentences=10, frequency_elements=128, max_audio_length=800): """Represents a fully defined speaker in the Speaker clustering suite. :param frequency_elements: How many frequency elements should be in a spectrog...
the_stack_v2_python_sparse
ext_clust/common/extrapolation/speaker.py
kutoga/learning2cluster
train
12
3ca9ed498b8c4ee00062889e80d79ef68b77e7c4
[ "for key, func in _default_parameters.iteritems():\n ids = not force and self.search(cr, SUPERUSER_ID, [('key', '=', key)])\n if not ids:\n value, groups = func()\n self.set_param(cr, SUPERUSER_ID, key, value, groups=groups)", "ids = self.search(cr, uid, [('key', '=', key)], context=context)\n...
<|body_start_0|> for key, func in _default_parameters.iteritems(): ids = not force and self.search(cr, SUPERUSER_ID, [('key', '=', key)]) if not ids: value, groups = func() self.set_param(cr, SUPERUSER_ID, key, value, groups=groups) <|end_body_0|> <|body_...
Per-database storage of configuration key-value pairs.
ir_config_parameter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ir_config_parameter: """Per-database storage of configuration key-value pairs.""" def init(self, cr, force=False): """Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.""" <|body_0|> def get_param(self, cr, ui...
stack_v2_sparse_classes_36k_train_032510
4,580
no_license
[ { "docstring": "Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.", "name": "init", "signature": "def init(self, cr, force=False)" }, { "docstring": "Retrieve the value for a given key. :param string key: The key of the parameter val...
3
null
Implement the Python class `ir_config_parameter` described below. Class description: Per-database storage of configuration key-value pairs. Method signatures and docstrings: - def init(self, cr, force=False): Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True...
Implement the Python class `ir_config_parameter` described below. Class description: Per-database storage of configuration key-value pairs. Method signatures and docstrings: - def init(self, cr, force=False): Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True...
d8a531ae9ade5f3e1f49c7d1b21583fbe1b8c09e
<|skeleton|> class ir_config_parameter: """Per-database storage of configuration key-value pairs.""" def init(self, cr, force=False): """Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.""" <|body_0|> def get_param(self, cr, ui...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ir_config_parameter: """Per-database storage of configuration key-value pairs.""" def init(self, cr, force=False): """Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.""" for key, func in _default_parameters.iteritems(): ...
the_stack_v2_python_sparse
odoo/openerp/addons/base/ir/ir_config_parameter.py
ihyf/raspberry_pi
train
1
9923f29d3cc88b68ee931e8f9406b423c8e0f587
[ "try:\n article = Articles.objects.get(slug=slug)\n comments = Comment.objects.all().filter(article_id=article.id, parent=request.query_params.get('parent', None))\n serializer = self.serializer_class(comments, many=True)\n return Response(serializer.data, status=status.HTTP_200_OK)\nexcept Articles.Doe...
<|body_start_0|> try: article = Articles.objects.get(slug=slug) comments = Comment.objects.all().filter(article_id=article.id, parent=request.query_params.get('parent', None)) serializer = self.serializer_class(comments, many=True) return Response(serializer.data,...
Handles viewing of comments if not authenticated and Handles creating comments on an article if authenticated
RetrieveCommentAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetrieveCommentAPIView: """Handles viewing of comments if not authenticated and Handles creating comments on an article if authenticated""" def get(self, request, slug): """Handles listing all comments on an article :param slug: :return: [comments]""" <|body_0|> def post...
stack_v2_sparse_classes_36k_train_032511
7,543
permissive
[ { "docstring": "Handles listing all comments on an article :param slug: :return: [comments]", "name": "get", "signature": "def get(self, request, slug)" }, { "docstring": "Handles creating a new comment on an article :param request: :param slug: :return: comment", "name": "post", "signat...
2
stack_v2_sparse_classes_30k_train_012969
Implement the Python class `RetrieveCommentAPIView` described below. Class description: Handles viewing of comments if not authenticated and Handles creating comments on an article if authenticated Method signatures and docstrings: - def get(self, request, slug): Handles listing all comments on an article :param slug...
Implement the Python class `RetrieveCommentAPIView` described below. Class description: Handles viewing of comments if not authenticated and Handles creating comments on an article if authenticated Method signatures and docstrings: - def get(self, request, slug): Handles listing all comments on an article :param slug...
5a31840856de4b361fe2594dfa7a33d7774d3fe2
<|skeleton|> class RetrieveCommentAPIView: """Handles viewing of comments if not authenticated and Handles creating comments on an article if authenticated""" def get(self, request, slug): """Handles listing all comments on an article :param slug: :return: [comments]""" <|body_0|> def post...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetrieveCommentAPIView: """Handles viewing of comments if not authenticated and Handles creating comments on an article if authenticated""" def get(self, request, slug): """Handles listing all comments on an article :param slug: :return: [comments]""" try: article = Articles.o...
the_stack_v2_python_sparse
authors/apps/comments/views.py
bl4ck4ndbr0wn/ah-centauri-backend
train
0
d00aba6c37f9bb09f46592d521c1758c3ed33fa7
[ "if arr is None:\n return arr\nn = len(arr)\nif n <= 1:\n return arr\nfor i in range(0, n):\n min_index = i\n j = i + 1\n while j < n:\n if arr[j] < arr[min_index]:\n min_index = j\n j += 1\n arr[i], arr[min_index] = (arr[min_index], arr[i])\nreturn arr", "if arr is None...
<|body_start_0|> if arr is None: return arr n = len(arr) if n <= 1: return arr for i in range(0, n): min_index = i j = i + 1 while j < n: if arr[j] < arr[min_index]: min_index = j ...
SelectionSort
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectionSort: def selection_sort_min_version(arr): """Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int],...
stack_v2_sparse_classes_36k_train_032512
2,594
permissive
[ { "docstring": "Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int], list to be sorted :return: List[int], sorted list", "name"...
2
stack_v2_sparse_classes_30k_train_003920
Implement the Python class `SelectionSort` described below. Class description: Implement the SelectionSort class. Method signatures and docstrings: - def selection_sort_min_version(arr): Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires...
Implement the Python class `SelectionSort` described below. Class description: Implement the SelectionSort class. Method signatures and docstrings: - def selection_sort_min_version(arr): Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires...
8504db89a3f6a1596c0bb7343a4936884b44e6ea
<|skeleton|> class SelectionSort: def selection_sort_min_version(arr): """Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int],...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelectionSort: def selection_sort_min_version(arr): """Selection sort in selecting-min-element style. Note that selection is the slowest of all the common sorting algorithms. It requires quadratic time even in the best case (i.e., when the array is already sorted). :param arr: List[int], list to be so...
the_stack_v2_python_sparse
sorting/selection_sort.py
fimh/dsa-py
train
2
9d7ea5a991ee4356b043c37db960c262f22e1f8b
[ "m = len(obstacleGrid)\nn = len(obstacleGrid[0])\nif m == 0 or n == 0:\n return 0\nif obstacleGrid[0][0] == 1:\n return 0\ndp = [[0] * n for _ in range(m)]\nfor i in range(m):\n if obstacleGrid[i][0] == 1:\n break\n dp[i][0] = 1\nfor j in range(n):\n if obstacleGrid[0][j] == 1:\n break\...
<|body_start_0|> m = len(obstacleGrid) n = len(obstacleGrid[0]) if m == 0 or n == 0: return 0 if obstacleGrid[0][0] == 1: return 0 dp = [[0] * n for _ in range(m)] for i in range(m): if obstacleGrid[i][0] == 1: break ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePathsWithObstacles(self, obstacleGrid) -> int: """动态规划, 时间复杂度O(m*n), 空间复杂度O(m*n)""" <|body_0|> def uniquePathsWithObstacles2(self, obstacleGrid) -> int: """动态规划优化, 使用ob数组,额外空间为O(1)""" <|body_1|> def uniquePathsWithObstacles3(self, obs...
stack_v2_sparse_classes_36k_train_032513
3,577
no_license
[ { "docstring": "动态规划, 时间复杂度O(m*n), 空间复杂度O(m*n)", "name": "uniquePathsWithObstacles", "signature": "def uniquePathsWithObstacles(self, obstacleGrid) -> int" }, { "docstring": "动态规划优化, 使用ob数组,额外空间为O(1)", "name": "uniquePathsWithObstacles2", "signature": "def uniquePathsWithObstacles2(self,...
3
stack_v2_sparse_classes_30k_train_019159
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePathsWithObstacles(self, obstacleGrid) -> int: 动态规划, 时间复杂度O(m*n), 空间复杂度O(m*n) - def uniquePathsWithObstacles2(self, obstacleGrid) -> int: 动态规划优化, 使用ob数组,额外空间为O(1) - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePathsWithObstacles(self, obstacleGrid) -> int: 动态规划, 时间复杂度O(m*n), 空间复杂度O(m*n) - def uniquePathsWithObstacles2(self, obstacleGrid) -> int: 动态规划优化, 使用ob数组,额外空间为O(1) - def...
13e7ec9fe7a92ab13b247bd4edeb1ada5de81a08
<|skeleton|> class Solution: def uniquePathsWithObstacles(self, obstacleGrid) -> int: """动态规划, 时间复杂度O(m*n), 空间复杂度O(m*n)""" <|body_0|> def uniquePathsWithObstacles2(self, obstacleGrid) -> int: """动态规划优化, 使用ob数组,额外空间为O(1)""" <|body_1|> def uniquePathsWithObstacles3(self, obs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePathsWithObstacles(self, obstacleGrid) -> int: """动态规划, 时间复杂度O(m*n), 空间复杂度O(m*n)""" m = len(obstacleGrid) n = len(obstacleGrid[0]) if m == 0 or n == 0: return 0 if obstacleGrid[0][0] == 1: return 0 dp = [[0] * n for _ ...
the_stack_v2_python_sparse
Algorithms/63_Unique_Paths_II/Unique_Paths_II.py
lirui-ML/my_leetcode
train
1
90ae74e091adac5620debf889b0bda6ac7e80037
[ "if s == None:\n return False\nif self.isSameTree(s, t):\n return True\nreturn self.isSubtree(s.left, t) or self.isSubtree(s.right, t)", "if t1 == None and t2 == None:\n return True\nif t1 == None or t2 == None:\n return False\nif t1.val == t2.val:\n left = self.isSameTree(t1.left, t2.left)\n ri...
<|body_start_0|> if s == None: return False if self.isSameTree(s, t): return True return self.isSubtree(s.left, t) or self.isSubtree(s.right, t) <|end_body_0|> <|body_start_1|> if t1 == None and t2 == None: return True if t1 == None or t2 == N...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, t1, t2): """Returns if t1 and t2 are exactly the same tree""" <|body_1|> <|end_skeleton|> <|body_start_0|> if s == None: ...
stack_v2_sparse_classes_36k_train_032514
1,488
no_license
[ { "docstring": ":type s: TreeNode :type t: TreeNode :rtype: bool", "name": "isSubtree", "signature": "def isSubtree(self, s, t)" }, { "docstring": "Returns if t1 and t2 are exactly the same tree", "name": "isSameTree", "signature": "def isSameTree(self, t1, t2)" } ]
2
stack_v2_sparse_classes_30k_train_009047
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool - def isSameTree(self, t1, t2): Returns if t1 and t2 are exactly the same tree
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool - def isSameTree(self, t1, t2): Returns if t1 and t2 are exactly the same tree <|skeleton|> class Sol...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, t1, t2): """Returns if t1 and t2 are exactly the same tree""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" if s == None: return False if self.isSameTree(s, t): return True return self.isSubtree(s.left, t) or self.isSubtree(s.right, t) def isSameTree(self, t1, t2):...
the_stack_v2_python_sparse
572-subtree_of_another_tree.py
stevestar888/leetcode-problems
train
2
4dc27ee5295f4084bf5e5649b4b23512b9374ec2
[ "res = []\nif root:\n res.extend(self.postorderTraversal(root.left))\n res.extend(self.postorderTraversal(root.right))\n res.append(root.val)\nreturn res", "nodes = [root]\nres = []\nwhile nodes:\n root = nodes.pop()\n if root:\n res.append(root.val)\n nodes.append(root.left)\n ...
<|body_start_0|> res = [] if root: res.extend(self.postorderTraversal(root.left)) res.extend(self.postorderTraversal(root.right)) res.append(root.val) return res <|end_body_0|> <|body_start_1|> nodes = [root] res = [] while nodes: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def __postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def ___postorderTraversal(self, root): """:type r...
stack_v2_sparse_classes_36k_train_032515
3,206
permissive
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "_postorderTraversal", "signature": "def _postorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "__postorderTraversal", "signature": "def __postorderTraversal(self, root)" }, ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def __postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def ___postorderTrave...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def __postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def ___postorderTrave...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def __postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def ___postorderTraversal(self, root): """:type r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" res = [] if root: res.extend(self.postorderTraversal(root.left)) res.extend(self.postorderTraversal(root.right)) res.append(root.val) return res ...
the_stack_v2_python_sparse
145.binary-tree-postorder-traversal.py
windard/leeeeee
train
0
eea60ad92b847edb5f9854240c2da5fa07d695cd
[ "string = ''\nstack = [root]\nwhile stack:\n node = stack.pop(0)\n if node is None:\n string += 'null,'\n continue\n else:\n string += f'{node.val},'\n stack.extend([node.left, node.right])\nreturn f'[{string[:-1]}]'", "nodes = data.strip('[').strip(']').split(',')\nheader = nodes...
<|body_start_0|> string = '' stack = [root] while stack: node = stack.pop(0) if node is None: string += 'null,' continue else: string += f'{node.val},' stack.extend([node.left, node.right]) re...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_032516
1,676
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_005484
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:...
b47280681276ec7001efa3d0dbb9c354ca5c6abc
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" string = '' stack = [root] while stack: node = stack.pop(0) if node is None: string += 'null,' continue ...
the_stack_v2_python_sparse
算法训练营/07-递归/297/广度优先遍历.py
youguanxinqing/RoadOfDSA
train
0
f5cc5c96060972f1370e439d0b2f9fbb3c265ec4
[ "self.login()\ns0 = decode_json(self.submit_to('/add_flashcard', POPULARITY_SEARCH))\ns1 = decode_json(self.submit_to('/add_flashcard', flashcard_submission(s0)))\ns2 = decode_json(self.submit_to('/add_flashcard', flashcard_submission(s1)))\ns3 = decode_json(self.submit_to('/add_flashcard', flashcard_submission(s2)...
<|body_start_0|> self.login() s0 = decode_json(self.submit_to('/add_flashcard', POPULARITY_SEARCH)) s1 = decode_json(self.submit_to('/add_flashcard', flashcard_submission(s0))) s2 = decode_json(self.submit_to('/add_flashcard', flashcard_submission(s1))) s3 = decode_json(self.subm...
Tests for Anime Flashcards UC
FlashcardTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlashcardTest: """Tests for Anime Flashcards UC""" def test_popularity_flashcards(self): """Tests searching and adding anime flashcards by popularity""" <|body_0|> def test_ratings_flashcards(self): """Tests searching and adding anime flashcards by rating""" ...
stack_v2_sparse_classes_36k_train_032517
6,302
no_license
[ { "docstring": "Tests searching and adding anime flashcards by popularity", "name": "test_popularity_flashcards", "signature": "def test_popularity_flashcards(self)" }, { "docstring": "Tests searching and adding anime flashcards by rating", "name": "test_ratings_flashcards", "signature":...
5
stack_v2_sparse_classes_30k_train_000493
Implement the Python class `FlashcardTest` described below. Class description: Tests for Anime Flashcards UC Method signatures and docstrings: - def test_popularity_flashcards(self): Tests searching and adding anime flashcards by popularity - def test_ratings_flashcards(self): Tests searching and adding anime flashca...
Implement the Python class `FlashcardTest` described below. Class description: Tests for Anime Flashcards UC Method signatures and docstrings: - def test_popularity_flashcards(self): Tests searching and adding anime flashcards by popularity - def test_ratings_flashcards(self): Tests searching and adding anime flashca...
7e9a9de45c5c004f9af68aa76701d9ce302f2d5a
<|skeleton|> class FlashcardTest: """Tests for Anime Flashcards UC""" def test_popularity_flashcards(self): """Tests searching and adding anime flashcards by popularity""" <|body_0|> def test_ratings_flashcards(self): """Tests searching and adding anime flashcards by rating""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlashcardTest: """Tests for Anime Flashcards UC""" def test_popularity_flashcards(self): """Tests searching and adding anime flashcards by popularity""" self.login() s0 = decode_json(self.submit_to('/add_flashcard', POPULARITY_SEARCH)) s1 = decode_json(self.submit_to('/add...
the_stack_v2_python_sparse
unittests/FlashcardTester.py
aqiu384/MALBuilder
train
0
d95184ef18dd30147e975eb40965d047e857aef7
[ "if not n:\n return n\ndp = [0] * (n + 1)\ndp[0] = dp[1] = 1\nfor i in range(2, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2]\nreturn dp[n]", "if not n:\n return n\na, b = (1, 1)\nfor i in range(2, n + 1):\n b, a = (a + b, b)\nreturn b" ]
<|body_start_0|> if not n: return n dp = [0] * (n + 1) dp[0] = dp[1] = 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] <|end_body_0|> <|body_start_1|> if not n: return n a, b = (1, 1) for i in ran...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs1(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not n: return n dp = [0] * (n + 1) d...
stack_v2_sparse_classes_36k_train_032518
1,419
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs1", "signature": "def climbStairs1(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "climbStairs2", "signature": "def climbStairs2(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs1(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs1(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def climbStairs1(self, n): ""...
65bd3cc5b6a6221b7e4d22d2a405fdaf3a08afc0
<|skeleton|> class Solution: def climbStairs1(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs1(self, n): """:type n: int :rtype: int""" if not n: return n dp = [0] * (n + 1) dp[0] = dp[1] = 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] def climbStairs2(self, n): """:t...
the_stack_v2_python_sparse
Week_04/id_26/LeetCode_70_26.py
laocaicaicai/algorithm
train
0
b0736143b09e4cd01bff38757acfc82dc08aae42
[ "choices_data = validated_data.pop('choices')\ndecision = Decision.objects.create(author=self.context['request'].user, **validated_data)\nfor choice in choices_data:\n Choice.objects.create(decision=decision, content=choice['content'])\nreturn decision", "try:\n user = self.context['request'].user\n vote...
<|body_start_0|> choices_data = validated_data.pop('choices') decision = Decision.objects.create(author=self.context['request'].user, **validated_data) for choice in choices_data: Choice.objects.create(decision=decision, content=choice['content']) return decision <|end_body_0...
This serializer class will be used in all the operations with Decision model instances except fetching the current user's own decisions.
DecisionSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecisionSerializer: """This serializer class will be used in all the operations with Decision model instances except fetching the current user's own decisions.""" def create(self, validated_data): """We provide create method to be able to create choice objects got from nested seriali...
stack_v2_sparse_classes_36k_train_032519
2,923
no_license
[ { "docstring": "We provide create method to be able to create choice objects got from nested serialization.", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "get_already_voted method helps to identify whether the current user has already voted on this particu...
2
stack_v2_sparse_classes_30k_train_014226
Implement the Python class `DecisionSerializer` described below. Class description: This serializer class will be used in all the operations with Decision model instances except fetching the current user's own decisions. Method signatures and docstrings: - def create(self, validated_data): We provide create method to...
Implement the Python class `DecisionSerializer` described below. Class description: This serializer class will be used in all the operations with Decision model instances except fetching the current user's own decisions. Method signatures and docstrings: - def create(self, validated_data): We provide create method to...
e1ffc6a7fc24ce29bd5d0d5016166ae2d7d58212
<|skeleton|> class DecisionSerializer: """This serializer class will be used in all the operations with Decision model instances except fetching the current user's own decisions.""" def create(self, validated_data): """We provide create method to be able to create choice objects got from nested seriali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecisionSerializer: """This serializer class will be used in all the operations with Decision model instances except fetching the current user's own decisions.""" def create(self, validated_data): """We provide create method to be able to create choice objects got from nested serialization.""" ...
the_stack_v2_python_sparse
decisions/serializers.py
andrei-papou/Life-Social-Decision
train
0
2094cd3a2aca8a161e5a55135394c2be91542b44
[ "self.factory = RequestFactory()\nself.user = User.objects.create_user(username='david', email='david@test.com', password='david')\nself.user.is_superuser = True\nself.booking = Bookings.objects.create(customer_name='David', username='david')\nself.booking_id = self.booking.booking_id\nself.booking.save()\nself.set...
<|body_start_0|> self.factory = RequestFactory() self.user = User.objects.create_user(username='david', email='david@test.com', password='david') self.user.is_superuser = True self.booking = Bookings.objects.create(customer_name='David', username='david') self.booking_id = self.b...
testBookingModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class testBookingModel: def setUp(self): """Create super user for testing""" <|body_0|> def test_confirm_booking(self): """A test that checks when a booking id is posted to update_booking_status, that the confirmed status of the booking is changed and the correct booking i...
stack_v2_sparse_classes_36k_train_032520
2,558
no_license
[ { "docstring": "Create super user for testing", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "A test that checks when a booking id is posted to update_booking_status, that the confirmed status of the booking is changed and the correct booking id is returned", "name": "te...
3
stack_v2_sparse_classes_30k_train_020739
Implement the Python class `testBookingModel` described below. Class description: Implement the testBookingModel class. Method signatures and docstrings: - def setUp(self): Create super user for testing - def test_confirm_booking(self): A test that checks when a booking id is posted to update_booking_status, that the...
Implement the Python class `testBookingModel` described below. Class description: Implement the testBookingModel class. Method signatures and docstrings: - def setUp(self): Create super user for testing - def test_confirm_booking(self): A test that checks when a booking id is posted to update_booking_status, that the...
63c3f4d1692fd3228d2acc69ab2b700f9591ad5d
<|skeleton|> class testBookingModel: def setUp(self): """Create super user for testing""" <|body_0|> def test_confirm_booking(self): """A test that checks when a booking id is posted to update_booking_status, that the confirmed status of the booking is changed and the correct booking i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class testBookingModel: def setUp(self): """Create super user for testing""" self.factory = RequestFactory() self.user = User.objects.create_user(username='david', email='david@test.com', password='david') self.user.is_superuser = True self.booking = Bookings.objects.create(c...
the_stack_v2_python_sparse
management/tests.py
Code-Institute-Submissions/beauty4u
train
0
c66c7f75cdec8715952f9733848b77343aee8077
[ "self.set_element_value(self.username, username)\nself.set_element_value(self.password, passsword)\nself.login_button.click()", "if self.login_error_message.is_visible():\n return True\nreturn False", "if self.login_error_message.is_visible():\n message = self.read_element_value(self.login_error_message)\...
<|body_start_0|> self.set_element_value(self.username, username) self.set_element_value(self.password, passsword) self.login_button.click() <|end_body_0|> <|body_start_1|> if self.login_error_message.is_visible(): return True return False <|end_body_1|> <|body_start...
Selenium Page Object Model: LoginPage.
LoginPage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginPage: """Selenium Page Object Model: LoginPage.""" def login(self, username, passsword): """Submit login details to Web Admin login page. :param username: The username :param password: The password""" <|body_0|> def login_error(self): """Check for presence o...
stack_v2_sparse_classes_36k_train_032521
1,471
permissive
[ { "docstring": "Submit login details to Web Admin login page. :param username: The username :param password: The password", "name": "login", "signature": "def login(self, username, passsword)" }, { "docstring": "Check for presence of login error text. :returns: True if error displayed, False oth...
3
stack_v2_sparse_classes_30k_train_007732
Implement the Python class `LoginPage` described below. Class description: Selenium Page Object Model: LoginPage. Method signatures and docstrings: - def login(self, username, passsword): Submit login details to Web Admin login page. :param username: The username :param password: The password - def login_error(self):...
Implement the Python class `LoginPage` described below. Class description: Selenium Page Object Model: LoginPage. Method signatures and docstrings: - def login(self, username, passsword): Submit login details to Web Admin login page. :param username: The username :param password: The password - def login_error(self):...
0b3e96b892fb332a1252fc231b30561b2374071f
<|skeleton|> class LoginPage: """Selenium Page Object Model: LoginPage.""" def login(self, username, passsword): """Submit login details to Web Admin login page. :param username: The username :param password: The password""" <|body_0|> def login_error(self): """Check for presence o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginPage: """Selenium Page Object Model: LoginPage.""" def login(self, username, passsword): """Submit login details to Web Admin login page. :param username: The username :param password: The password""" self.set_element_value(self.username, username) self.set_element_value(self...
the_stack_v2_python_sparse
draytekwebadmin/pages/login_page.py
dMajoIT/Draytek-Web-Auto-Configuration
train
0
740adc535a591d98501eb11a6930dccd22b5ff00
[ "q = [root]\nop = []\nwhile q:\n cur_node = q.pop(0)\n if not cur_node:\n op.append('None')\n continue\n else:\n op.append(str(cur_node.val))\n q.append(cur_node.left)\n q.append(cur_node.right)\nreturn ','.join(op)", "data = list(data.split(','))\nif data[0] == 'None':\n re...
<|body_start_0|> q = [root] op = [] while q: cur_node = q.pop(0) if not cur_node: op.append('None') continue else: op.append(str(cur_node.val)) q.append(cur_node.left) q.append(cur_node.ri...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_032522
1,622
permissive
[ { "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_003700
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:...
fe57e668db23f7c480835c0a10f363d718fbaefd
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = [root] op = [] while q: cur_node = q.pop(0) if not cur_node: op.append('None') continue else: ...
the_stack_v2_python_sparse
Python/lc_297_serialize_deserialize_binary_tree.py
cmattey/leetcode_problems
train
6
d37814361508d5d24a63e1673f9e517bcaf7a95e
[ "super(ACELoss, self).__init__()\nself.dict = character\nself.eps = eps", "batch, time_dim, _ = inputs.size()\ninputs = inputs + self.eps\nlabel = label.float()\nlabel[:, 0] = time_dim - label[:, 0]\ninputs = torch.sum(inputs, 1)\ninputs = inputs / time_dim\nlabel = label / time_dim\nloss = -torch.sum(torch.log(i...
<|body_start_0|> super(ACELoss, self).__init__() self.dict = character self.eps = eps <|end_body_0|> <|body_start_1|> batch, time_dim, _ = inputs.size() inputs = inputs + self.eps label = label.float() label[:, 0] = time_dim - label[:, 0] inputs = torch.s...
Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019
ACELoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ACELoss: """Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019""" def __init__(self, character, eps=1e-10): """Args: character (dict): recognition dictionary eps (float): margin of error""" <|body_0|> def forward(self, inputs, label): """Args:...
stack_v2_sparse_classes_36k_train_032523
1,733
permissive
[ { "docstring": "Args: character (dict): recognition dictionary eps (float): margin of error", "name": "__init__", "signature": "def __init__(self, character, eps=1e-10)" }, { "docstring": "Args: inputs (Torch.Tensor): model output label (Torch.Tensor): label information Returns: Torch.Tensor: ac...
2
null
Implement the Python class `ACELoss` described below. Class description: Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019 Method signatures and docstrings: - def __init__(self, character, eps=1e-10): Args: character (dict): recognition dictionary eps (float): margin of error - def forward(self, ...
Implement the Python class `ACELoss` described below. Class description: Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019 Method signatures and docstrings: - def __init__(self, character, eps=1e-10): Args: character (dict): recognition dictionary eps (float): margin of error - def forward(self, ...
fb47a96d1a38f5ce634c6f12d710ed5300cc89fc
<|skeleton|> class ACELoss: """Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019""" def __init__(self, character, eps=1e-10): """Args: character (dict): recognition dictionary eps (float): margin of error""" <|body_0|> def forward(self, inputs, label): """Args:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ACELoss: """Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019""" def __init__(self, character, eps=1e-10): """Args: character (dict): recognition dictionary eps (float): margin of error""" super(ACELoss, self).__init__() self.dict = character self.eps ...
the_stack_v2_python_sparse
davarocr/davarocr/davar_rcg/models/losses/ace_loss.py
OCRWorld/DAVAR-Lab-OCR
train
0
1c8b61f3590884d15f424bcecbc43bb796b6e659
[ "init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties')\ninit_log.info('Initialization Complete.')\nif hold_state is True:\n flags = fix_state_vars(self, state_args)\n return flags\nelse:\n return", "init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties')\nif flags is None:...
<|body_start_0|> init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties') init_log.info('Initialization Complete.') if hold_state is True: flags = fix_state_vars(self, state_args) return flags else: return <|end_body_0|> <|body_start_1|>...
This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks.
_WaterStateBlock
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _WaterStateBlock: """This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks.""" def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=N...
stack_v2_sparse_classes_36k_train_032524
12,757
permissive
[ { "docstring": "Initialization routine for property package. Keyword Arguments: state_args : Dictionary with initial guesses for the state vars chosen. Note that if this method is triggered through the control volume, and if initial guesses were not provied at the unit model level, the control volume passes the...
2
stack_v2_sparse_classes_30k_train_007136
Implement the Python class `_WaterStateBlock` described below. Class description: This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks. Method signatures and docstrings: - def initialize(self, state_args=None, state_vars_fixed=Fa...
Implement the Python class `_WaterStateBlock` described below. Class description: This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks. Method signatures and docstrings: - def initialize(self, state_args=None, state_vars_fixed=Fa...
14dc1a8906230747ce8f3edcb88641ac587be968
<|skeleton|> class _WaterStateBlock: """This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks.""" def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _WaterStateBlock: """This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks.""" def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=None): ...
the_stack_v2_python_sparse
watertap/core/zero_order_properties.py
watertap-org/watertap
train
20
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_36k_train_032525
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_val_000157
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_36k
data/stack_v2_sparse_classes_30k
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
02c384edbe10f3eb243f3ef56c90f36b17d24a08
[ "self._buffer_queue = buffer_queue\nself._buffer_condition = buffer_condition\nself._shutdown_event = shutdown_event", "start = 0\nend = min(start + _QUEUE_ITEM_MAX_SIZE, len(data))\nwhile start < len(data):\n with self._buffer_condition:\n while len(self._buffer_queue) >= _MAX_BUFFER_QUEUE_SIZE and (no...
<|body_start_0|> self._buffer_queue = buffer_queue self._buffer_condition = buffer_condition self._shutdown_event = shutdown_event <|end_body_0|> <|body_start_1|> start = 0 end = min(start + _QUEUE_ITEM_MAX_SIZE, len(data)) while start < len(data): with self....
A write-only stream class that writes to the buffer queue.
_WritableStream
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _WritableStream: """A write-only stream class that writes to the buffer queue.""" def __init__(self, buffer_queue, buffer_condition, shutdown_event): """Initializes WritableStream. Args: buffer_queue (collections.deque): A queue where the data gets written. buffer_condition (threadin...
stack_v2_sparse_classes_36k_train_032526
17,228
permissive
[ { "docstring": "Initializes WritableStream. Args: buffer_queue (collections.deque): A queue where the data gets written. buffer_condition (threading.Condition): The condition object to wait on if the buffer is full. shutdown_event (threading.Event): Used for signaling the thread to terminate.", "name": "__i...
2
null
Implement the Python class `_WritableStream` described below. Class description: A write-only stream class that writes to the buffer queue. Method signatures and docstrings: - def __init__(self, buffer_queue, buffer_condition, shutdown_event): Initializes WritableStream. Args: buffer_queue (collections.deque): A queu...
Implement the Python class `_WritableStream` described below. Class description: A write-only stream class that writes to the buffer queue. Method signatures and docstrings: - def __init__(self, buffer_queue, buffer_condition, shutdown_event): Initializes WritableStream. Args: buffer_queue (collections.deque): A queu...
060174026ac068b6442b6c58bedf5adc7bc549cb
<|skeleton|> class _WritableStream: """A write-only stream class that writes to the buffer queue.""" def __init__(self, buffer_queue, buffer_condition, shutdown_event): """Initializes WritableStream. Args: buffer_queue (collections.deque): A queue where the data gets written. buffer_condition (threadin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _WritableStream: """A write-only stream class that writes to the buffer queue.""" def __init__(self, buffer_queue, buffer_condition, shutdown_event): """Initializes WritableStream. Args: buffer_queue (collections.deque): A queue where the data gets written. buffer_condition (threading.Condition):...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/tasks/cp/daisy_chain_copy_task.py
salewski/google-cloud-sdk
train
0
5fa3f76a150a38cf2edcbc3ad7e01e5d68dedc0f
[ "n = len(intervals)\nif n <= 1:\n return intervals\nintervals = sorted(intervals, key=lambda x: x[0])\nstack = []\nfor i in range(0, len(intervals)):\n start = intervals[i][0]\n if stack and stack[-1][1] >= start:\n stack[-1][1] = max(stack[-1][1], intervals[i][1])\n else:\n stack.append([...
<|body_start_0|> n = len(intervals) if n <= 1: return intervals intervals = sorted(intervals, key=lambda x: x[0]) stack = [] for i in range(0, len(intervals)): start = intervals[i][0] if stack and stack[-1][1] >= start: stack[-1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def merge0(self, intervals): """:type intervals: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_032527
1,868
no_license
[ { "docstring": ":type intervals: List[List[int]] :rtype: List[List[int]]", "name": "merge", "signature": "def merge(self, intervals)" }, { "docstring": ":type intervals: List[List[int]] :rtype: List[List[int]]", "name": "merge0", "signature": "def merge0(self, intervals)" } ]
2
stack_v2_sparse_classes_30k_train_001706
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[List[int]] :rtype: List[List[int]] - def merge0(self, intervals): :type intervals: List[List[int]] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[List[int]] :rtype: List[List[int]] - def merge0(self, intervals): :type intervals: List[List[int]] :rtype: List[List[int]] <|sk...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def merge0(self, intervals): """:type intervals: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, intervals): """:type intervals: List[List[int]] :rtype: List[List[int]]""" n = len(intervals) if n <= 1: return intervals intervals = sorted(intervals, key=lambda x: x[0]) stack = [] for i in range(0, len(intervals)): ...
the_stack_v2_python_sparse
56.合并区间.py
yangyuxiang1996/leetcode
train
0
e4a05d6f059cdd4baff726d325d5f1d43c065f6b
[ "self._host = host\nself._port = port\nself._ipp_printers = ipp_printers\nself.is_cups = ipp_printers is None\nself.printers: dict[str, dict[str, Any]] | None = None\nself.attributes: dict[str, Any] = {}\nself.available = False", "cups = importlib.import_module('cups')\ntry:\n conn = cups.Connection(host=self....
<|body_start_0|> self._host = host self._port = port self._ipp_printers = ipp_printers self.is_cups = ipp_printers is None self.printers: dict[str, dict[str, Any]] | None = None self.attributes: dict[str, Any] = {} self.available = False <|end_body_0|> <|body_sta...
Get the latest data from CUPS and update the state.
CupsData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CupsData: """Get the latest data from CUPS and update the state.""" def __init__(self, host: str, port: int, ipp_printers: list[str] | None) -> None: """Initialize the data object.""" <|body_0|> def update(self) -> None: """Get the latest data from CUPS.""" ...
stack_v2_sparse_classes_36k_train_032528
10,904
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, host: str, port: int, ipp_printers: list[str] | None) -> None" }, { "docstring": "Get the latest data from CUPS.", "name": "update", "signature": "def update(self) -> None" } ]
2
null
Implement the Python class `CupsData` described below. Class description: Get the latest data from CUPS and update the state. Method signatures and docstrings: - def __init__(self, host: str, port: int, ipp_printers: list[str] | None) -> None: Initialize the data object. - def update(self) -> None: Get the latest dat...
Implement the Python class `CupsData` described below. Class description: Get the latest data from CUPS and update the state. Method signatures and docstrings: - def __init__(self, host: str, port: int, ipp_printers: list[str] | None) -> None: Initialize the data object. - def update(self) -> None: Get the latest dat...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class CupsData: """Get the latest data from CUPS and update the state.""" def __init__(self, host: str, port: int, ipp_printers: list[str] | None) -> None: """Initialize the data object.""" <|body_0|> def update(self) -> None: """Get the latest data from CUPS.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CupsData: """Get the latest data from CUPS and update the state.""" def __init__(self, host: str, port: int, ipp_printers: list[str] | None) -> None: """Initialize the data object.""" self._host = host self._port = port self._ipp_printers = ipp_printers self.is_cup...
the_stack_v2_python_sparse
homeassistant/components/cups/sensor.py
home-assistant/core
train
35,501
6925179f89cbc157740e9df21a43e6a9d4bc5539
[ "allure.dynamic.title('Testing invite_more_women function (positive)')\nallure.dynamic.severity(allure.severity_level.NORMAL)\nallure.dynamic.description_html('<h3>Codewars badge:</h3><img src=\"https://www.codewars.com/users/myFirstCode/badges/large\"><h3>Test Description:</h3><p></p>')\nwith allure.step('Enter te...
<|body_start_0|> allure.dynamic.title('Testing invite_more_women function (positive)') allure.dynamic.severity(allure.severity_level.NORMAL) allure.dynamic.description_html('<h3>Codewars badge:</h3><img src="https://www.codewars.com/users/myFirstCode/badges/large"><h3>Test Description:</h3><p></...
Simple Fun #152: Invite More Women? Testing invite_more_women function
InviteMoreWomenTestCase
[ "Unlicense", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InviteMoreWomenTestCase: """Simple Fun #152: Invite More Women? Testing invite_more_women function""" def test_invite_more_women_positive(self): """Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:""" <|body_0|> def test_invite_mo...
stack_v2_sparse_classes_36k_train_032529
2,818
permissive
[ { "docstring": "Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:", "name": "test_invite_more_women_positive", "signature": "def test_invite_more_women_positive(self)" }, { "docstring": "Simple Fun #152: Invite More Women? Testing invite_more_women functi...
2
stack_v2_sparse_classes_30k_train_011810
Implement the Python class `InviteMoreWomenTestCase` described below. Class description: Simple Fun #152: Invite More Women? Testing invite_more_women function Method signatures and docstrings: - def test_invite_more_women_positive(self): Simple Fun #152: Invite More Women? Testing invite_more_women function (positiv...
Implement the Python class `InviteMoreWomenTestCase` described below. Class description: Simple Fun #152: Invite More Women? Testing invite_more_women function Method signatures and docstrings: - def test_invite_more_women_positive(self): Simple Fun #152: Invite More Women? Testing invite_more_women function (positiv...
ba3ea81125b6082d867f0ae34c6c9be15e153966
<|skeleton|> class InviteMoreWomenTestCase: """Simple Fun #152: Invite More Women? Testing invite_more_women function""" def test_invite_more_women_positive(self): """Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:""" <|body_0|> def test_invite_mo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InviteMoreWomenTestCase: """Simple Fun #152: Invite More Women? Testing invite_more_women function""" def test_invite_more_women_positive(self): """Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:""" allure.dynamic.title('Testing invite_more_women...
the_stack_v2_python_sparse
kyu_7/simple_fun_152/test_invite_more_women.py
qamine-test/codewars
train
0
1b585b2aceb3f79ffa82ffe93720519d8c079ba2
[ "Simulator.__init__(self, state_set, action_set, modules)\nassert 'auctions' in modules.keys()\nassert 'clicks' in modules.keys()\nassert 'rpc' in modules.keys()\nassert 'cpc' in modules.keys()", "assert a in self.action_set\nhow = self.s_ix\nN_A = self.modules['auctions'].sample(how=how)\nN_c = self.modules['cli...
<|body_start_0|> Simulator.__init__(self, state_set, action_set, modules) assert 'auctions' in modules.keys() assert 'clicks' in modules.keys() assert 'rpc' in modules.keys() assert 'cpc' in modules.keys() <|end_body_0|> <|body_start_1|> assert a in self.action_set ...
Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of modules used to model stochastic variables in th...
SimulatorConstRPCHoW
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatorConstRPCHoW: """Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of ...
stack_v2_sparse_classes_36k_train_032530
40,659
permissive
[ { "docstring": ":param list state_set: List of possible states. :param list action_set: List of valid actions. :param dict modules: Dictionary of modules used to model stochastic variables in the simulator.", "name": "__init__", "signature": "def __init__(self, state_set, action_set, modules)" }, { ...
2
null
Implement the Python class `SimulatorConstRPCHoW` described below. Class description: Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid acti...
Implement the Python class `SimulatorConstRPCHoW` described below. Class description: Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid acti...
ade886e9dcbde9fcea218a19f0130cc09f81e55e
<|skeleton|> class SimulatorConstRPCHoW: """Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulatorConstRPCHoW: """Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of modules used ...
the_stack_v2_python_sparse
ssa_sim_v2/simulator/simulator.py
donghun2018/adclick-simulator-v2
train
0
73dc5a7d0ef009b7289a3b07bea55fc9b7055afd
[ "super(LinearND, self).__init__()\nself.dropout = dropout\nwith self.init_scope():\n self.fc = L.Linear(*size, nobias=not bias, initialW=None, initial_bias=None)\n if use_cuda:\n self.fc.to_gpu()", "size = list(xs.shape)\nxs = xs.reshape(np.prod(size[:-1]), size[-1])\nxs = self.fc(xs)\nif self.dropou...
<|body_start_0|> super(LinearND, self).__init__() self.dropout = dropout with self.init_scope(): self.fc = L.Linear(*size, nobias=not bias, initialW=None, initial_bias=None) if use_cuda: self.fc.to_gpu() <|end_body_0|> <|body_start_1|> size = list...
LinearND
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearND: def __init__(self, *size, bias=True, dropout=0, use_cuda=False): """A chainer.links.Linear layer modified to accept ND arrays. The function treats the last dimension of the input as the hidden dimension. Args: size (): bias (bool, optional): dropout (float, optional): use_cuda ...
stack_v2_sparse_classes_36k_train_032531
5,435
no_license
[ { "docstring": "A chainer.links.Linear layer modified to accept ND arrays. The function treats the last dimension of the input as the hidden dimension. Args: size (): bias (bool, optional): dropout (float, optional): use_cuda (bool, optional): if True, use GPUs", "name": "__init__", "signature": "def __...
2
stack_v2_sparse_classes_30k_train_009791
Implement the Python class `LinearND` described below. Class description: Implement the LinearND class. Method signatures and docstrings: - def __init__(self, *size, bias=True, dropout=0, use_cuda=False): A chainer.links.Linear layer modified to accept ND arrays. The function treats the last dimension of the input as...
Implement the Python class `LinearND` described below. Class description: Implement the LinearND class. Method signatures and docstrings: - def __init__(self, *size, bias=True, dropout=0, use_cuda=False): A chainer.links.Linear layer modified to accept ND arrays. The function treats the last dimension of the input as...
b6b60a338d65bb369d0034f423feb09db10db8b7
<|skeleton|> class LinearND: def __init__(self, *size, bias=True, dropout=0, use_cuda=False): """A chainer.links.Linear layer modified to accept ND arrays. The function treats the last dimension of the input as the hidden dimension. Args: size (): bias (bool, optional): dropout (float, optional): use_cuda ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearND: def __init__(self, *size, bias=True, dropout=0, use_cuda=False): """A chainer.links.Linear layer modified to accept ND arrays. The function treats the last dimension of the input as the hidden dimension. Args: size (): bias (bool, optional): dropout (float, optional): use_cuda (bool, optiona...
the_stack_v2_python_sparse
models/chainer/linear.py
carolinebear/pytorch_end2end_speech_recognition
train
0
230c9696ecd1af6f139dd14a5a44f54c8263132c
[ "year = response.xpath('//u/font/strong/em/text()').get()[0:4]\nfor item in response.xpath('//ol/li'):\n date_text = item.xpath('./font/strong/em/text()').get()\n meeting = Meeting(title=self.title, description='', classification=COMMISSION, start=self._parse_start(date_text, year), end=None, all_day=False, t...
<|body_start_0|> year = response.xpath('//u/font/strong/em/text()').get()[0:4] for item in response.xpath('//ol/li'): date_text = item.xpath('./font/strong/em/text()').get() meeting = Meeting(title=self.title, description='', classification=COMMISSION, start=self._parse_start(dat...
ChiSsa72Spider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChiSsa72Spider: 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, date_text, year): """Parse start datetime as a naive dat...
stack_v2_sparse_classes_36k_train_032532
3,869
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_020923
Implement the Python class `ChiSsa72Spider` described below. Class description: Implement the ChiSsa72Spider 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 needs. - def _pars...
Implement the Python class `ChiSsa72Spider` described below. Class description: Implement the ChiSsa72Spider 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 needs. - def _pars...
611fce6a2705446e25a2fc33e32090a571eb35d1
<|skeleton|> class ChiSsa72Spider: 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, date_text, year): """Parse start datetime as a naive dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChiSsa72Spider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" year = response.xpath('//u/font/strong/em/text()').get()[0:4] for item in response.xpath('//ol/li'): ...
the_stack_v2_python_sparse
city_scrapers/spiders/chi_ssa_72.py
City-Bureau/city-scrapers
train
308
34086c3d695312db7a5c06d83c72ed934239bef5
[ "self.file = None\nself.tmp_file = None\nself.pipe = []\nif file_path:\n try:\n if file_override:\n self.file = open(file_path, 'wt')\n else:\n self.file = open(file_path, 'at')\n except FileNotFoundError as e:\n '\\n 只是特别标注出来这里可能弹出的错误。\\n ...
<|body_start_0|> self.file = None self.tmp_file = None self.pipe = [] if file_path: try: if file_override: self.file = open(file_path, 'wt') else: self.file = open(file_path, 'at') except File...
重定向输出
StdoutRedirection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StdoutRedirection: """重定向输出""" def __init__(self, file_path=None, file_override=True): """如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。""" <|body_0|> def context(self): """重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进入with时执行,yield为with语句...
stack_v2_sparse_classes_36k_train_032533
4,538
no_license
[ { "docstring": "如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。", "name": "__init__", "signature": "def __init__(self, file_path=None, file_override=True)" }, { "docstring": "重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进入with时执行,yield为with语句返回值,yield后退出with时执行", "name"...
2
stack_v2_sparse_classes_30k_train_015768
Implement the Python class `StdoutRedirection` described below. Class description: 重定向输出 Method signatures and docstrings: - def __init__(self, file_path=None, file_override=True): 如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。 - def context(self): 重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进...
Implement the Python class `StdoutRedirection` described below. Class description: 重定向输出 Method signatures and docstrings: - def __init__(self, file_path=None, file_override=True): 如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。 - def context(self): 重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进...
d44f7303bc4ce3764a300830d361115200ad3602
<|skeleton|> class StdoutRedirection: """重定向输出""" def __init__(self, file_path=None, file_override=True): """如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。""" <|body_0|> def context(self): """重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进入with时执行,yield为with语句...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StdoutRedirection: """重定向输出""" def __init__(self, file_path=None, file_override=True): """如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。""" self.file = None self.tmp_file = None self.pipe = [] if file_path: try: if file_override: ...
the_stack_v2_python_sparse
pysh/manage/middleware.py
Arianxx/Pysh
train
18
af58de8b0c5b984c491299ef3487fe03d09511ca
[ "if value is None:\n return None\nreturn DbHash(hash=value, hashMethod=self.hashMethod)", "if value is None:\n return None\nreturn self.hashMethod(value)" ]
<|body_start_0|> if value is None: return None return DbHash(hash=value, hashMethod=self.hashMethod) <|end_body_0|> <|body_start_1|> if value is None: return None return self.hashMethod(value) <|end_body_1|>
Provides formal SQLObject validation services for the HashCol.
HashValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashValidator: """Provides formal SQLObject validation services for the HashCol.""" def to_python(self, value, state): """Passes out a hash object.""" <|body_0|> def from_python(self, value, state): """Store the given value as a MD5 hash, or None if specified."""...
stack_v2_sparse_classes_36k_train_032534
2,144
permissive
[ { "docstring": "Passes out a hash object.", "name": "to_python", "signature": "def to_python(self, value, state)" }, { "docstring": "Store the given value as a MD5 hash, or None if specified.", "name": "from_python", "signature": "def from_python(self, value, state)" } ]
2
stack_v2_sparse_classes_30k_train_008300
Implement the Python class `HashValidator` described below. Class description: Provides formal SQLObject validation services for the HashCol. Method signatures and docstrings: - def to_python(self, value, state): Passes out a hash object. - def from_python(self, value, state): Store the given value as a MD5 hash, or ...
Implement the Python class `HashValidator` described below. Class description: Provides formal SQLObject validation services for the HashCol. Method signatures and docstrings: - def to_python(self, value, state): Passes out a hash object. - def from_python(self, value, state): Store the given value as a MD5 hash, or ...
f4972361b768f9b585b9060daa605d5d8346c1a8
<|skeleton|> class HashValidator: """Provides formal SQLObject validation services for the HashCol.""" def to_python(self, value, state): """Passes out a hash object.""" <|body_0|> def from_python(self, value, state): """Store the given value as a MD5 hash, or None if specified."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HashValidator: """Provides formal SQLObject validation services for the HashCol.""" def to_python(self, value, state): """Passes out a hash object.""" if value is None: return None return DbHash(hash=value, hashMethod=self.hashMethod) def from_python(self, value, ...
the_stack_v2_python_sparse
libs/sqlobject/include/hashcol.py
jeremysherriff/HTPC-Manager
train
1
05be5a91b693202788e265bd222a20cc3df25b59
[ "assert isinstance(response, scrapy.http.response.html.HtmlResponse)\ncurboard = ['Sea Fishing']\nurls = [response.url]\nfor x in range(2, LAST_PAGE + 1):\n urls.append('%spage/%s' % (urls[0], x))\nfor url in urls:\n yield scrapy.Request(url, callback=self.crawl_board_threads, dont_filter=False, meta={'curboa...
<|body_start_0|> assert isinstance(response, scrapy.http.response.html.HtmlResponse) curboard = ['Sea Fishing'] urls = [response.url] for x in range(2, LAST_PAGE + 1): urls.append('%spage/%s' % (urls[0], x)) for url in urls: yield scrapy.Request(url, callb...
scrape reports from angling addicts forum
TotalFishingReportsSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TotalFishingReportsSpider: """scrape reports from angling addicts forum""" def parse(self, response): """generate links to pages in a board yields: https://www.total-fishing.com/forums/forum/fishing/sea-fishing/page/24/""" <|body_0|> def crawl_board_threads(self, respons...
stack_v2_sparse_classes_36k_train_032535
3,813
no_license
[ { "docstring": "generate links to pages in a board yields: https://www.total-fishing.com/forums/forum/fishing/sea-fishing/page/24/", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "crawl", "name": "crawl_board_threads", "signature": "def crawl_board_threads(s...
3
stack_v2_sparse_classes_30k_train_004002
Implement the Python class `TotalFishingReportsSpider` described below. Class description: scrape reports from angling addicts forum Method signatures and docstrings: - def parse(self, response): generate links to pages in a board yields: https://www.total-fishing.com/forums/forum/fishing/sea-fishing/page/24/ - def c...
Implement the Python class `TotalFishingReportsSpider` described below. Class description: scrape reports from angling addicts forum Method signatures and docstrings: - def parse(self, response): generate links to pages in a board yields: https://www.total-fishing.com/forums/forum/fishing/sea-fishing/page/24/ - def c...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class TotalFishingReportsSpider: """scrape reports from angling addicts forum""" def parse(self, response): """generate links to pages in a board yields: https://www.total-fishing.com/forums/forum/fishing/sea-fishing/page/24/""" <|body_0|> def crawl_board_threads(self, respons...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TotalFishingReportsSpider: """scrape reports from angling addicts forum""" def parse(self, response): """generate links to pages in a board yields: https://www.total-fishing.com/forums/forum/fishing/sea-fishing/page/24/""" assert isinstance(response, scrapy.http.response.html.HtmlResponse...
the_stack_v2_python_sparse
imgscrape/spiders/total_fishing.py
gmonkman/python
train
0
81315d181d68d575d57fbdf2a02865af4763efa8
[ "EasyFrame.__init__(self, title='Temperature Converter')\nself.model = model\nself.addLabel(text='Celsius', row=0, column=0)\nself.celsiusField = self.addFloatField(value=model.getCelsius(), row=1, column=0, precision=2)\nself.addLabel(text='Fahrenheit', row=0, column=1)\nself.fahrField = self.addFloatField(value=m...
<|body_start_0|> EasyFrame.__init__(self, title='Temperature Converter') self.model = model self.addLabel(text='Celsius', row=0, column=0) self.celsiusField = self.addFloatField(value=model.getCelsius(), row=1, column=0, precision=2) self.addLabel(text='Fahrenheit', row=0, column...
A termperature conversion program.
ThermometerView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThermometerView: """A termperature conversion program.""" def __init__(self, model): """Sets up the view. The model comes in as an argument.""" <|body_0|> def computeFahr(self): """Inputs the Celsius degrees and outputs the Fahrenheit degrees.""" <|body_1...
stack_v2_sparse_classes_36k_train_032536
2,234
no_license
[ { "docstring": "Sets up the view. The model comes in as an argument.", "name": "__init__", "signature": "def __init__(self, model)" }, { "docstring": "Inputs the Celsius degrees and outputs the Fahrenheit degrees.", "name": "computeFahr", "signature": "def computeFahr(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_017069
Implement the Python class `ThermometerView` described below. Class description: A termperature conversion program. Method signatures and docstrings: - def __init__(self, model): Sets up the view. The model comes in as an argument. - def computeFahr(self): Inputs the Celsius degrees and outputs the Fahrenheit degrees...
Implement the Python class `ThermometerView` described below. Class description: A termperature conversion program. Method signatures and docstrings: - def __init__(self, model): Sets up the view. The model comes in as an argument. - def computeFahr(self): Inputs the Celsius degrees and outputs the Fahrenheit degrees...
eca69d000dc77681a30734b073b2383c97ccc02e
<|skeleton|> class ThermometerView: """A termperature conversion program.""" def __init__(self, model): """Sets up the view. The model comes in as an argument.""" <|body_0|> def computeFahr(self): """Inputs the Celsius degrees and outputs the Fahrenheit degrees.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThermometerView: """A termperature conversion program.""" def __init__(self, model): """Sets up the view. The model comes in as an argument.""" EasyFrame.__init__(self, title='Temperature Converter') self.model = model self.addLabel(text='Celsius', row=0, column=0) ...
the_stack_v2_python_sparse
gui/breezy/thermometerview1.py
lforet/robomow
train
11
25a53beeab38801c2d4c974c3f286abf2b50afdb
[ "self._buffer = ObservationBuffer()\nself._lock = Lock()\nself._empty_action = empty_action\nself._memory_threshold = memory_threshold", "flushed_store = None\nwith self._lock:\n self._buffer.insert(*ts)\n mem = self._buffer.estimate_memory_lower_bound()\n if mem > self._memory_threshold:\n flushe...
<|body_start_0|> self._buffer = ObservationBuffer() self._lock = Lock() self._empty_action = empty_action self._memory_threshold = memory_threshold <|end_body_0|> <|body_start_1|> flushed_store = None with self._lock: self._buffer.insert(*ts) mem ...
Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away from memory. Examples: Create a bucket with ...
ObservationBucket
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservationBucket: """Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away...
stack_v2_sparse_classes_36k_train_032537
13,152
permissive
[ { "docstring": "Create a new instance. :param empty_action: a function to store the data collected so far. It takes a single ``ObservationStore`` and returns nothing. Called when the ``memory_threshold`` is reached or the ``empty`` method is called. :param memory_threshold: the amount of bytes past which the st...
3
stack_v2_sparse_classes_30k_train_018008
Implement the Python class `ObservationBucket` described below. Class description: Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that take...
Implement the Python class `ObservationBucket` described below. Class description: Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that take...
505acbfcfdbd6d944a682a54a6c96a5816468675
<|skeleton|> class ObservationBucket: """Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservationBucket: """Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away from memory....
the_stack_v2_python_sparse
src/server/telemetry/observation.py
FIWARE-GEs/quantum-leap
train
0
93146077f13d0a2bce212592ae6c1f5250a085d6
[ "self.time = collections.defaultdict(list)\nself.value = collections.defaultdict(list)\nself.max = collections.defaultdict(int)", "self.time[key].append(timestamp)\nself.value[key].append(value)\nself.max[key] = max(self.max[key], timestamp)", "if key not in self.time:\n return ''\nif timestamp >= self.max[k...
<|body_start_0|> self.time = collections.defaultdict(list) self.value = collections.defaultdict(list) self.max = collections.defaultdict(int) <|end_body_0|> <|body_start_1|> self.time[key].append(timestamp) self.value[key].append(value) self.max[key] = max(self.max[key],...
TimeMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def set(self, key, value, timestamp): """:type key: str :type value: str :type timestamp: int :rtype: None""" <|body_1|> def get(self, key, timestamp): """:type ke...
stack_v2_sparse_classes_36k_train_032538
1,146
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type key: str :type value: str :type timestamp: int :rtype: None", "name": "set", "signature": "def set(self, key, value, timestamp)" }, { "docstring":...
3
null
Implement the Python class `TimeMap` described below. Class description: Implement the TimeMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def set(self, key, value, timestamp): :type key: str :type value: str :type timestamp: int :rtype: None - def get(self, k...
Implement the Python class `TimeMap` described below. Class description: Implement the TimeMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def set(self, key, value, timestamp): :type key: str :type value: str :type timestamp: int :rtype: None - def get(self, k...
8cdb97bc7588b96b91b1c550afd84e976c1926e0
<|skeleton|> class TimeMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def set(self, key, value, timestamp): """:type key: str :type value: str :type timestamp: int :rtype: None""" <|body_1|> def get(self, key, timestamp): """:type ke...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeMap: def __init__(self): """Initialize your data structure here.""" self.time = collections.defaultdict(list) self.value = collections.defaultdict(list) self.max = collections.defaultdict(int) def set(self, key, value, timestamp): """:type key: str :type value:...
the_stack_v2_python_sparse
BinarySearch/981_BS_TImeBasedKeyValueStore.py
ZhengLiangliang1996/Leetcode_ML_Daily
train
1
209288cd6ecdd2edb7e4e434bd57798efe171990
[ "need = defaultdict(int)\nwindow = defaultdict(int)\nfor c in t:\n need[c] += 1\nleft, right = (0, 0)\nvalid = 0\nstart, lth = (0, sys.maxsize)\nwhile right < len(s):\n c = s[right]\n right += 1\n if c in need:\n window[c] += 1\n if window[c] == need[c]:\n valid += 1\n while ...
<|body_start_0|> need = defaultdict(int) window = defaultdict(int) for c in t: need[c] += 1 left, right = (0, 0) valid = 0 start, lth = (0, sys.maxsize) while right < len(s): c = s[right] right += 1 if c in need: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minWindowFrameWork(self, s, t): """use the sliding window framework""" <|body_0|> def minWindow(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_1|> def minWindowAC(self, s, t): """The current window is s[i:j] and the...
stack_v2_sparse_classes_36k_train_032539
4,831
no_license
[ { "docstring": "use the sliding window framework", "name": "minWindowFrameWork", "signature": "def minWindowFrameWork(self, s, t)" }, { "docstring": ":type s: str :type t: str :rtype: str", "name": "minWindow", "signature": "def minWindow(self, s, t)" }, { "docstring": "The curre...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindowFrameWork(self, s, t): use the sliding window framework - def minWindow(self, s, t): :type s: str :type t: str :rtype: str - def minWindowAC(self, s, t): The current...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindowFrameWork(self, s, t): use the sliding window framework - def minWindow(self, s, t): :type s: str :type t: str :rtype: str - def minWindowAC(self, s, t): The current...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def minWindowFrameWork(self, s, t): """use the sliding window framework""" <|body_0|> def minWindow(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_1|> def minWindowAC(self, s, t): """The current window is s[i:j] and the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minWindowFrameWork(self, s, t): """use the sliding window framework""" need = defaultdict(int) window = defaultdict(int) for c in t: need[c] += 1 left, right = (0, 0) valid = 0 start, lth = (0, sys.maxsize) while right <...
the_stack_v2_python_sparse
M/MinimumWindowSubstring.py
bssrdf/pyleet
train
2
cfe24b967a2eccd90e152397f6165e41f715e67a
[ "manifest = ManifestFile(self.physical_location)\nmanifest.read(ignore_missing=True)\nreturn manifest", "manifest = self._get_manifest() if _manifest is None else _manifest\nself.logger.debug('Checking import Manifest entries')\nret = True\nename = None\nfor p in self._packages.values():\n efile = p.get('ebuil...
<|body_start_0|> manifest = ManifestFile(self.physical_location) manifest.read(ignore_missing=True) return manifest <|end_body_0|> <|body_start_1|> manifest = self._get_manifest() if _manifest is None else _manifest self.logger.debug('Checking import Manifest entries') r...
PackageDir class that uses an (mostly) internal implementation for Manifest writing.
PackageDir
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageDir: """PackageDir class that uses an (mostly) internal implementation for Manifest writing.""" def _get_manifest(self): """Returns a ManifestFile object.""" <|body_0|> def _write_import_manifest(self, _manifest=None): """Verifies that Manifest file entrie...
stack_v2_sparse_classes_36k_train_032540
3,313
no_license
[ { "docstring": "Returns a ManifestFile object.", "name": "_get_manifest", "signature": "def _get_manifest(self)" }, { "docstring": "Verifies that Manifest file entries exist for all imported ebuilds. Assumption: ebuild file in Manifest => $SRC_URI, too Returns True on success, else False. argume...
3
stack_v2_sparse_classes_30k_train_001382
Implement the Python class `PackageDir` described below. Class description: PackageDir class that uses an (mostly) internal implementation for Manifest writing. Method signatures and docstrings: - def _get_manifest(self): Returns a ManifestFile object. - def _write_import_manifest(self, _manifest=None): Verifies that...
Implement the Python class `PackageDir` described below. Class description: PackageDir class that uses an (mostly) internal implementation for Manifest writing. Method signatures and docstrings: - def _get_manifest(self): Returns a ManifestFile object. - def _write_import_manifest(self, _manifest=None): Verifies that...
815bc74db18c14807ea4098babeb0253f331bab3
<|skeleton|> class PackageDir: """PackageDir class that uses an (mostly) internal implementation for Manifest writing.""" def _get_manifest(self): """Returns a ManifestFile object.""" <|body_0|> def _write_import_manifest(self, _manifest=None): """Verifies that Manifest file entrie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PackageDir: """PackageDir class that uses an (mostly) internal implementation for Manifest writing.""" def _get_manifest(self): """Returns a ManifestFile object.""" manifest = ManifestFile(self.physical_location) manifest.read(ignore_missing=True) return manifest def ...
the_stack_v2_python_sparse
roverlay/overlay/pkgdir/packagedir_newmanifest.py
dywisor/roverlay
train
0
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.weight, fsmt_layer.self_attn.k_proj.weight, fsmt_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.bias, fsmt_layer.self_attn.k_proj.bias, fsmt_layer.self_attn...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.weight, fsmt_layer.self_attn.k_proj.weight, fsmt_layer.self_attn.v_proj.weight])) self.in_proj_bias = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.bias, fsmt_layer.self_attn...
FSMTEncoderLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FSMTEncoderLayerBetterTransformer: def __init__(self, fsmt_layer, config): """A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.""" <|body_...
stack_v2_sparse_classes_36k_train_032541
43,670
no_license
[ { "docstring": "A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, fsmt_layer, config)" }, { "docstr...
2
stack_v2_sparse_classes_30k_test_000968
Implement the Python class `FSMTEncoderLayerBetterTransformer` described below. Class description: Implement the FSMTEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, fsmt_layer, config): A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation....
Implement the Python class `FSMTEncoderLayerBetterTransformer` described below. Class description: Implement the FSMTEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, fsmt_layer, config): A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation....
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class FSMTEncoderLayerBetterTransformer: def __init__(self, fsmt_layer, config): """A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FSMTEncoderLayerBetterTransformer: def __init__(self, fsmt_layer, config): """A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.""" super().__init__(conf...
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
d66d2250dc4e1f098676eff85ac3dc6607e02255
[ "m = len(triangle)\ndp = [[0 for _ in range(m + 1)] for _ in range(m + 1)]\nfor i in range(m - 1, -1, -1):\n for j in range(i + 1):\n dp[i][j] = min(dp[i + 1][j], dp[i + 1][j + 1]) + triangle[i][j]\nreturn dp[0][0]", "m = len(triangle)\ndp = [0 for _ in range(m + 1)]\nfor i in range(m - 1, -1, -1):\n ...
<|body_start_0|> m = len(triangle) dp = [[0 for _ in range(m + 1)] for _ in range(m + 1)] for i in range(m - 1, -1, -1): for j in range(i + 1): dp[i][j] = min(dp[i + 1][j], dp[i + 1][j + 1]) + triangle[i][j] return dp[0][0] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """1. state definition: dp[i][j] is the min total from (i,j) to bottom 2. state transform: dp[i][j] = min(dp[i+1][j], dp[i+1][j+1]) + triangle[i][j]""" <|body_0|> def minimumTotal(self, triangle: List[List[i...
stack_v2_sparse_classes_36k_train_032542
1,121
no_license
[ { "docstring": "1. state definition: dp[i][j] is the min total from (i,j) to bottom 2. state transform: dp[i][j] = min(dp[i+1][j], dp[i+1][j+1]) + triangle[i][j]", "name": "minimumTotal", "signature": "def minimumTotal(self, triangle: List[List[int]]) -> int" }, { "docstring": "dp[j] = min(dp[j]...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle: List[List[int]]) -> int: 1. state definition: dp[i][j] is the min total from (i,j) to bottom 2. state transform: dp[i][j] = min(dp[i+1][j], dp[i+...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle: List[List[int]]) -> int: 1. state definition: dp[i][j] is the min total from (i,j) to bottom 2. state transform: dp[i][j] = min(dp[i+1][j], dp[i+...
59c8b144f4245ed4a8b06a458954ca05c0c73aea
<|skeleton|> class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """1. state definition: dp[i][j] is the min total from (i,j) to bottom 2. state transform: dp[i][j] = min(dp[i+1][j], dp[i+1][j+1]) + triangle[i][j]""" <|body_0|> def minimumTotal(self, triangle: List[List[i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """1. state definition: dp[i][j] is the min total from (i,j) to bottom 2. state transform: dp[i][j] = min(dp[i+1][j], dp[i+1][j+1]) + triangle[i][j]""" m = len(triangle) dp = [[0 for _ in range(m + 1)] for _ in range(m...
the_stack_v2_python_sparse
06/triangle.py
TrisDing/algorithm010
train
1
22dded66e32ae0010dfd64ef2523df41fc6ab0e8
[ "super().__init__(*args, **kwargs)\nself.setupUi(self)\nself.registerModel(model)\nself.registerView(view)\nself.pb_add_save.clicked.connect(self.onAdd)\nself.pb_remove_save.clicked.connect(self.onRemove)", "if model is None:\n self.model = None\nelse:\n if not isinstance(model, SaveModel):\n raise T...
<|body_start_0|> super().__init__(*args, **kwargs) self.setupUi(self) self.registerModel(model) self.registerView(view) self.pb_add_save.clicked.connect(self.onAdd) self.pb_remove_save.clicked.connect(self.onRemove) <|end_body_0|> <|body_start_1|> if model is Non...
The SaveControls widget is a small utility widget which can be placed underneath a SaveView. It contains all neccessary controls to add or remove save entries. Be sure to register both the model and the view by passing it to the constructor or using `registerModel()` and `registerView()`!
SaveControls
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveControls: """The SaveControls widget is a small utility widget which can be placed underneath a SaveView. It contains all neccessary controls to add or remove save entries. Be sure to register both the model and the view by passing it to the constructor or using `registerModel()` and `registe...
stack_v2_sparse_classes_36k_train_032543
5,444
no_license
[ { "docstring": "Initialize the SaveControls instance. Parameters ---------- model : filter_tree.save_info.model.SaveModel The save model to modify view : filter_tree.save_info.widgets.SaveView The save view to extract item selections from", "name": "__init__", "signature": "def __init__(self, model=None...
5
stack_v2_sparse_classes_30k_train_005197
Implement the Python class `SaveControls` described below. Class description: The SaveControls widget is a small utility widget which can be placed underneath a SaveView. It contains all neccessary controls to add or remove save entries. Be sure to register both the model and the view by passing it to the constructor ...
Implement the Python class `SaveControls` described below. Class description: The SaveControls widget is a small utility widget which can be placed underneath a SaveView. It contains all neccessary controls to add or remove save entries. Be sure to register both the model and the view by passing it to the constructor ...
1e845316f8781a958dd95eaed17e3748a5de41bf
<|skeleton|> class SaveControls: """The SaveControls widget is a small utility widget which can be placed underneath a SaveView. It contains all neccessary controls to add or remove save entries. Be sure to register both the model and the view by passing it to the constructor or using `registerModel()` and `registe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaveControls: """The SaveControls widget is a small utility widget which can be placed underneath a SaveView. It contains all neccessary controls to add or remove save entries. Be sure to register both the model and the view by passing it to the constructor or using `registerModel()` and `registerView()`!""" ...
the_stack_v2_python_sparse
save_info/widgets.py
alexw9988/filter_tree
train
0
b8996bf48c29938c7c14e599decb94ae6c9945e0
[ "words_to_counts = {'cat': 1}\nexpected_result = {'cat': 1}\ntweets.common_words(words_to_counts, 1)\nself.assertEqual(words_to_counts, expected_result, 'none removed')", "dic = {'I': 10, 'you': 5, 'miss': 8, 'here': 6, 'how': 6}\ntweets.common_words(dic, 3)\nexpect_result = {'I': 10, 'miss': 8}\nself.assertEqual...
<|body_start_0|> words_to_counts = {'cat': 1} expected_result = {'cat': 1} tweets.common_words(words_to_counts, 1) self.assertEqual(words_to_counts, expected_result, 'none removed') <|end_body_0|> <|body_start_1|> dic = {'I': 10, 'you': 5, 'miss': 8, 'here': 6, 'how': 6} ...
TestCommonWords
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCommonWords: def test_none_removed(self): """Test common_words with N so that no words are removed.""" <|body_0|> def test_tie_removed(self): """Test common_words with N so that tied words are removed.""" <|body_1|> def test_tie_remained(self): ...
stack_v2_sparse_classes_36k_train_032544
1,649
permissive
[ { "docstring": "Test common_words with N so that no words are removed.", "name": "test_none_removed", "signature": "def test_none_removed(self)" }, { "docstring": "Test common_words with N so that tied words are removed.", "name": "test_tie_removed", "signature": "def test_tie_removed(se...
5
stack_v2_sparse_classes_30k_train_010586
Implement the Python class `TestCommonWords` described below. Class description: Implement the TestCommonWords class. Method signatures and docstrings: - def test_none_removed(self): Test common_words with N so that no words are removed. - def test_tie_removed(self): Test common_words with N so that tied words are re...
Implement the Python class `TestCommonWords` described below. Class description: Implement the TestCommonWords class. Method signatures and docstrings: - def test_none_removed(self): Test common_words with N so that no words are removed. - def test_tie_removed(self): Test common_words with N so that tied words are re...
214525afeeb2da2409f451bf269e792c6940a1ba
<|skeleton|> class TestCommonWords: def test_none_removed(self): """Test common_words with N so that no words are removed.""" <|body_0|> def test_tie_removed(self): """Test common_words with N so that tied words are removed.""" <|body_1|> def test_tie_remained(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCommonWords: def test_none_removed(self): """Test common_words with N so that no words are removed.""" words_to_counts = {'cat': 1} expected_result = {'cat': 1} tweets.common_words(words_to_counts, 1) self.assertEqual(words_to_counts, expected_result, 'none removed'...
the_stack_v2_python_sparse
Python/Tweet/test_common_words.py
LilyYC/legendary-train
train
0
4ceee7e856054e72e7fec01f2df00a248cfde2a4
[ "counter = {c: 1 for c in p}\nl = 1\nfor i in range(1, len(p)):\n if (ord(p[i]) - ord(p[i - 1])) % 26 == 1:\n l += 1\n else:\n l = 1\n counter[p[i]] = max(counter[p[i]], l)\nreturn sum(counter.values())", "if not p:\n return 0\nret = set()\ni = 0\nwhile i < len(p):\n cur = [p[i]]\n ...
<|body_start_0|> counter = {c: 1 for c in p} l = 1 for i in range(1, len(p)): if (ord(p[i]) - ord(p[i - 1])) % 26 == 1: l += 1 else: l = 1 counter[p[i]] = max(counter[p[i]], l) return sum(counter.values()) <|end_body_0|>...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findSubstringInWraproundString(self, p): """wrap around: +1 (delta=1) "zab": 3 + 2 + 1 "zabc": 4 + 3 + 2 + 1 To de-dpulicate, change the way of counting - count backward at the ending char. "zabc": "z": "z" : 1 "a": "a", "za": 2 "zab": "b", "ab", "zab": 3 "zabc": "c", ...: ...
stack_v2_sparse_classes_36k_train_032545
2,686
permissive
[ { "docstring": "wrap around: +1 (delta=1) \"zab\": 3 + 2 + 1 \"zabc\": 4 + 3 + 2 + 1 To de-dpulicate, change the way of counting - count backward at the ending char. \"zabc\": \"z\": \"z\" : 1 \"a\": \"a\", \"za\": 2 \"zab\": \"b\", \"ab\", \"zab\": 3 \"zabc\": \"c\", ...: 4 p.s. possible to count forward but t...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSubstringInWraproundString(self, p): wrap around: +1 (delta=1) "zab": 3 + 2 + 1 "zabc": 4 + 3 + 2 + 1 To de-dpulicate, change the way of counting - count backward at the ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSubstringInWraproundString(self, p): wrap around: +1 (delta=1) "zab": 3 + 2 + 1 "zabc": 4 + 3 + 2 + 1 To de-dpulicate, change the way of counting - count backward at the ...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def findSubstringInWraproundString(self, p): """wrap around: +1 (delta=1) "zab": 3 + 2 + 1 "zabc": 4 + 3 + 2 + 1 To de-dpulicate, change the way of counting - count backward at the ending char. "zabc": "z": "z" : 1 "a": "a", "za": 2 "zab": "b", "ab", "zab": 3 "zabc": "c", ...: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findSubstringInWraproundString(self, p): """wrap around: +1 (delta=1) "zab": 3 + 2 + 1 "zabc": 4 + 3 + 2 + 1 To de-dpulicate, change the way of counting - count backward at the ending char. "zabc": "z": "z" : 1 "a": "a", "za": 2 "zab": "b", "ab", "zab": 3 "zabc": "c", ...: 4 p.s. possibl...
the_stack_v2_python_sparse
467 Unique Substrings in Wraparound String.py
Aminaba123/LeetCode
train
1
1060748d852c981d2ebb7586e2725fff7b4f96d2
[ "warnings.warn('In following versions this function will become deprecated. Use deepattractornet_reconstructor.py instead', Warning)\nsuper(DeepattractorSoftmaxReconstructor, self).__init__(conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation)\nusedbins_names = conf['usedbins'].split(' ')\nusedbins_da...
<|body_start_0|> warnings.warn('In following versions this function will become deprecated. Use deepattractornet_reconstructor.py instead', Warning) super(DeepattractorSoftmaxReconstructor, self).__init__(conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation) usedbins_names = conf['...
the deepattractor softmax reconstructor class a reconstructor using deep attractor netwerk with softmax maskers
DeepattractorSoftmaxReconstructor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepattractorSoftmaxReconstructor: """the deepattractor softmax reconstructor class a reconstructor using deep attractor netwerk with softmax maskers""" def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): """DeepclusteringReconstructor constr...
stack_v2_sparse_classes_36k_train_032546
3,997
permissive
[ { "docstring": "DeepclusteringReconstructor constructor Args: conf: the reconstructor configuration as a dictionary evalconf: the evaluator configuration as a ConfigParser dataconf: the database configuration rec_dir: the directory where the reconstructions will be stored task: task name", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_010227
Implement the Python class `DeepattractorSoftmaxReconstructor` described below. Class description: the deepattractor softmax reconstructor class a reconstructor using deep attractor netwerk with softmax maskers Method signatures and docstrings: - def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_fra...
Implement the Python class `DeepattractorSoftmaxReconstructor` described below. Class description: the deepattractor softmax reconstructor class a reconstructor using deep attractor netwerk with softmax maskers Method signatures and docstrings: - def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_fra...
5e862cbf846d45b8a317f87588533f3fde9f0726
<|skeleton|> class DeepattractorSoftmaxReconstructor: """the deepattractor softmax reconstructor class a reconstructor using deep attractor netwerk with softmax maskers""" def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): """DeepclusteringReconstructor constr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeepattractorSoftmaxReconstructor: """the deepattractor softmax reconstructor class a reconstructor using deep attractor netwerk with softmax maskers""" def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): """DeepclusteringReconstructor constructor Args: c...
the_stack_v2_python_sparse
nabu/postprocessing/reconstructors/deepattractornet_softmax_reconstructor.py
JeroenZegers/Nabu-MSSS
train
19
4fd456fa84724b720606794036a5bdb770270194
[ "if not root:\n return ''\nseries = []\n\ndef dfs(node):\n if not node:\n series.append('1001')\n return\n series.append(str(node.val))\n dfs(node.left)\n dfs(node.right)\ndfs(root)\nres = ','.join(series)\nreturn res", "if not data:\n return\ndata = [int(i) for i in data.split(','...
<|body_start_0|> if not root: return '' series = [] def dfs(node): if not node: series.append('1001') return series.append(str(node.val)) dfs(node.left) dfs(node.right) dfs(root) res = ',...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_032547
3,254
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0a71ef6d9ad2b9722031facc16a308e6a19555db
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' series = [] def dfs(node): if not node: series.append('1001') return series.ap...
the_stack_v2_python_sparse
297.二叉树的序列化与反序列化.py
Interesting6/FuckLeetCode
train
0
7effc7c8715224ecc8e03e5a3a3ba5c3d36b2db8
[ "attr = super().__getattribute__(item)\nif item in ['get', 'options', 'head', 'post', 'patch', 'put', 'delete']:\n return handle_http_exception(attr)\nreturn attr", "resp = self._request('DELETE', params=kwargs)\nif 200 <= resp.status_code <= 299:\n if resp.status_code == 204:\n return True\n else...
<|body_start_0|> attr = super().__getattribute__(item) if item in ['get', 'options', 'head', 'post', 'patch', 'put', 'delete']: return handle_http_exception(attr) return attr <|end_body_0|> <|body_start_1|> resp = self._request('DELETE', params=kwargs) if 200 <= resp...
Wrapper around slumber's Resource with custom exceptions handler.
ResolweResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResolweResource: """Wrapper around slumber's Resource with custom exceptions handler.""" def __getattribute__(self, item): """Return class attribute and wrapp request methods in exception handler.""" <|body_0|> def delete(self, *args, **kwargs): """Delete resourc...
stack_v2_sparse_classes_36k_train_032548
20,535
permissive
[ { "docstring": "Return class attribute and wrapp request methods in exception handler.", "name": "__getattribute__", "signature": "def __getattribute__(self, item)" }, { "docstring": "Delete resource object. This is mostly Slumber default implementation except that it returns the processed respo...
2
stack_v2_sparse_classes_30k_val_000640
Implement the Python class `ResolweResource` described below. Class description: Wrapper around slumber's Resource with custom exceptions handler. Method signatures and docstrings: - def __getattribute__(self, item): Return class attribute and wrapp request methods in exception handler. - def delete(self, *args, **kw...
Implement the Python class `ResolweResource` described below. Class description: Wrapper around slumber's Resource with custom exceptions handler. Method signatures and docstrings: - def __getattribute__(self, item): Return class attribute and wrapp request methods in exception handler. - def delete(self, *args, **kw...
eecd829f3a4bd2868493486f91f198ae0f449830
<|skeleton|> class ResolweResource: """Wrapper around slumber's Resource with custom exceptions handler.""" def __getattribute__(self, item): """Return class attribute and wrapp request methods in exception handler.""" <|body_0|> def delete(self, *args, **kwargs): """Delete resourc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResolweResource: """Wrapper around slumber's Resource with custom exceptions handler.""" def __getattribute__(self, item): """Return class attribute and wrapp request methods in exception handler.""" attr = super().__getattribute__(item) if item in ['get', 'options', 'head', 'post...
the_stack_v2_python_sparse
src/resdk/resolwe.py
genialis/resolwe-bio-py
train
4
b6979e6860d6318f8da40562c9c1837376862e9a
[ "flag = False\nnumbers = sorted(numbers)\nfor i in range(len(numbers) - 1):\n if numbers[i] == numbers[i + 1]:\n duplication[0] = numbers[i]\n flag = True\n break\nreturn flag", "dic = {}\nflag = False\nfor element in numbers:\n if element not in dic:\n dic[element] = 1\n else...
<|body_start_0|> flag = False numbers = sorted(numbers) for i in range(len(numbers) - 1): if numbers[i] == numbers[i + 1]: duplication[0] = numbers[i] flag = True break return flag <|end_body_0|> <|body_start_1|> dic = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def duplicate(self, numbers, duplication): """法一:把数组排序 招重复的数字 --> 时间复杂度 O(nlogn)""" <|body_0|> def duplicate(self, numbers, duplication): """法二:利用一个哈希表 对每个元素用O(1)的时间判断元素是否在哈希表内 --> 时间复杂度 O(n) 空间复杂度 O(n)""" <|body_1|> def duplicate(self, numbers...
stack_v2_sparse_classes_36k_train_032549
2,444
no_license
[ { "docstring": "法一:把数组排序 招重复的数字 --> 时间复杂度 O(nlogn)", "name": "duplicate", "signature": "def duplicate(self, numbers, duplication)" }, { "docstring": "法二:利用一个哈希表 对每个元素用O(1)的时间判断元素是否在哈希表内 --> 时间复杂度 O(n) 空间复杂度 O(n)", "name": "duplicate", "signature": "def duplicate(self, numbers, duplicatio...
3
stack_v2_sparse_classes_30k_train_012750
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def duplicate(self, numbers, duplication): 法一:把数组排序 招重复的数字 --> 时间复杂度 O(nlogn) - def duplicate(self, numbers, duplication): 法二:利用一个哈希表 对每个元素用O(1)的时间判断元素是否在哈希表内 --> 时间复杂度 O(n) 空间复杂...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def duplicate(self, numbers, duplication): 法一:把数组排序 招重复的数字 --> 时间复杂度 O(nlogn) - def duplicate(self, numbers, duplication): 法二:利用一个哈希表 对每个元素用O(1)的时间判断元素是否在哈希表内 --> 时间复杂度 O(n) 空间复杂...
da4a393d8df87d4e738388dfed68eb96d0e2b727
<|skeleton|> class Solution: def duplicate(self, numbers, duplication): """法一:把数组排序 招重复的数字 --> 时间复杂度 O(nlogn)""" <|body_0|> def duplicate(self, numbers, duplication): """法二:利用一个哈希表 对每个元素用O(1)的时间判断元素是否在哈希表内 --> 时间复杂度 O(n) 空间复杂度 O(n)""" <|body_1|> def duplicate(self, numbers...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def duplicate(self, numbers, duplication): """法一:把数组排序 招重复的数字 --> 时间复杂度 O(nlogn)""" flag = False numbers = sorted(numbers) for i in range(len(numbers) - 1): if numbers[i] == numbers[i + 1]: duplication[0] = numbers[i] flag =...
the_stack_v2_python_sparse
51_DuplicatedNumber.py
yiweiyihang/Coding-Interviews
train
1
62de178bbbe4f50fe1369ed7d499ccdbac9c32db
[ "parent = request.GET.get('id', '')\nplanCase = request.GET.get('planCase', '')\nif not parent:\n return Response([])\nelif planCase:\n obj = SceneCase.objects.filter(parent=parent)\n data = PlanModuleSceneCaseSer(obj, many=True).data\nelse:\n obj = SceneCase.objects.filter(parent=parent)\n data = Sc...
<|body_start_0|> parent = request.GET.get('id', '') planCase = request.GET.get('planCase', '') if not parent: return Response([]) elif planCase: obj = SceneCase.objects.filter(parent=parent) data = PlanModuleSceneCaseSer(obj, many=True).data el...
SceneCaseTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SceneCaseTree: def get(self, request, *args, **kwargs): """1.项目不存在返回[] 2.项目存在返回项目下所有的节点""" <|body_0|> def post(self, request, *args, **kwargs): """创建场景用例""" <|body_1|> def put(self, request, *args, **kwargs): """编辑场景接口""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_032550
23,358
no_license
[ { "docstring": "1.项目不存在返回[] 2.项目存在返回项目下所有的节点", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "创建场景用例", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "编辑场景接口", "name": "put", "signature":...
4
stack_v2_sparse_classes_30k_train_015493
Implement the Python class `SceneCaseTree` described below. Class description: Implement the SceneCaseTree class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 1.项目不存在返回[] 2.项目存在返回项目下所有的节点 - def post(self, request, *args, **kwargs): 创建场景用例 - def put(self, request, *args, **kwargs): 编辑场景...
Implement the Python class `SceneCaseTree` described below. Class description: Implement the SceneCaseTree class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 1.项目不存在返回[] 2.项目存在返回项目下所有的节点 - def post(self, request, *args, **kwargs): 创建场景用例 - def put(self, request, *args, **kwargs): 编辑场景...
f2523d6e51cde1b53ac6f453f8066b4b90c523b9
<|skeleton|> class SceneCaseTree: def get(self, request, *args, **kwargs): """1.项目不存在返回[] 2.项目存在返回项目下所有的节点""" <|body_0|> def post(self, request, *args, **kwargs): """创建场景用例""" <|body_1|> def put(self, request, *args, **kwargs): """编辑场景接口""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SceneCaseTree: def get(self, request, *args, **kwargs): """1.项目不存在返回[] 2.项目存在返回项目下所有的节点""" parent = request.GET.get('id', '') planCase = request.GET.get('planCase', '') if not parent: return Response([]) elif planCase: obj = SceneCase.objects.fil...
the_stack_v2_python_sparse
api/interface/rest/sceneInterface.py
zhuzhanhao1/backend
train
0
10ab33b20731b787b82eba39ffe92d3adc28aa20
[ "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 CustomerFeed service. Service to manage customer feeds.
CustomerFeedServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerFeedServiceServicer: """Proto file describing the CustomerFeed service. Service to manage customer feeds.""" def GetCustomerFeed(self, request, context): """Returns the requested customer feed in full detail.""" <|body_0|> def MutateCustomerFeeds(self, request, c...
stack_v2_sparse_classes_36k_train_032551
3,410
permissive
[ { "docstring": "Returns the requested customer feed in full detail.", "name": "GetCustomerFeed", "signature": "def GetCustomerFeed(self, request, context)" }, { "docstring": "Creates, updates, or removes customer feeds. Operation statuses are returned.", "name": "MutateCustomerFeeds", "s...
2
stack_v2_sparse_classes_30k_train_006830
Implement the Python class `CustomerFeedServiceServicer` described below. Class description: Proto file describing the CustomerFeed service. Service to manage customer feeds. Method signatures and docstrings: - def GetCustomerFeed(self, request, context): Returns the requested customer feed in full detail. - def Muta...
Implement the Python class `CustomerFeedServiceServicer` described below. Class description: Proto file describing the CustomerFeed service. Service to manage customer feeds. Method signatures and docstrings: - def GetCustomerFeed(self, request, context): Returns the requested customer feed in full detail. - def Muta...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class CustomerFeedServiceServicer: """Proto file describing the CustomerFeed service. Service to manage customer feeds.""" def GetCustomerFeed(self, request, context): """Returns the requested customer feed in full detail.""" <|body_0|> def MutateCustomerFeeds(self, request, c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomerFeedServiceServicer: """Proto file describing the CustomerFeed service. Service to manage customer feeds.""" def GetCustomerFeed(self, request, context): """Returns the requested customer feed in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_d...
the_stack_v2_python_sparse
google/ads/google_ads/v2/proto/services/customer_feed_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
499c539212c14e60b0adecc683c940442d641b4f
[ "try:\n return json.dumps(value)\nexcept TypeError:\n if isinstance(value, _literal_bindparam):\n return value.value\n raise", "if value is None:\n return\nreturn json.loads(value)" ]
<|body_start_0|> try: return json.dumps(value) except TypeError: if isinstance(value, _literal_bindparam): return value.value raise <|end_body_0|> <|body_start_1|> if value is None: return return json.loads(value) <|end_bod...
A json object stored as a string. json encoding/decoding is handled by SQLAlchemy, so this type is database agnostic and is not affected by differences in underlying JSON types implementations.
JSONString
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONString: """A json object stored as a string. json encoding/decoding is handled by SQLAlchemy, so this type is database agnostic and is not affected by differences in underlying JSON types implementations.""" def process_bind_param(self, value, dialect): """Encode object to a stri...
stack_v2_sparse_classes_36k_train_032552
11,229
permissive
[ { "docstring": "Encode object to a string before inserting into database.", "name": "process_bind_param", "signature": "def process_bind_param(self, value, dialect)" }, { "docstring": "Decode string to an object after selecting from database.", "name": "process_result_value", "signature"...
2
null
Implement the Python class `JSONString` described below. Class description: A json object stored as a string. json encoding/decoding is handled by SQLAlchemy, so this type is database agnostic and is not affected by differences in underlying JSON types implementations. Method signatures and docstrings: - def process_...
Implement the Python class `JSONString` described below. Class description: A json object stored as a string. json encoding/decoding is handled by SQLAlchemy, so this type is database agnostic and is not affected by differences in underlying JSON types implementations. Method signatures and docstrings: - def process_...
c0de6442e1d7653fad824d75e571802a74eee605
<|skeleton|> class JSONString: """A json object stored as a string. json encoding/decoding is handled by SQLAlchemy, so this type is database agnostic and is not affected by differences in underlying JSON types implementations.""" def process_bind_param(self, value, dialect): """Encode object to a stri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONString: """A json object stored as a string. json encoding/decoding is handled by SQLAlchemy, so this type is database agnostic and is not affected by differences in underlying JSON types implementations.""" def process_bind_param(self, value, dialect): """Encode object to a string before ins...
the_stack_v2_python_sparse
rest-service/manager_rest/storage/models_base.py
cloudify-cosmo/cloudify-manager
train
146
936120a7cc5d8196035a3469511be7e0803d1bf4
[ "assert hasattr(clf, 'predict_proba')\nself.estimator_ = clf\nself.pos_label_ = pos_label", "self.estimator_.fit(X, y)\nif self.pos_label_ is not None:\n if hasattr(self.estimator_, 'classess_'):\n self.pos_idx_ = np.where(np.array(self.estimator_.classes_) == self.pos_label_)[0][0]\n else:\n ...
<|body_start_0|> assert hasattr(clf, 'predict_proba') self.estimator_ = clf self.pos_label_ = pos_label <|end_body_0|> <|body_start_1|> self.estimator_.fit(X, y) if self.pos_label_ is not None: if hasattr(self.estimator_, 'classess_'): self.pos_idx_ =...
Returns clf.predict_proba() as features.
PredictProbaFeature
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredictProbaFeature: """Returns clf.predict_proba() as features.""" def __init__(self, clf, pos_label=1): """Init function Args: clf: Classifier pos_label: positive label (default=1)""" <|body_0|> def fit(self, X, y=None): """fit Args: X: Data y: label Returns: s...
stack_v2_sparse_classes_36k_train_032553
17,613
permissive
[ { "docstring": "Init function Args: clf: Classifier pos_label: positive label (default=1)", "name": "__init__", "signature": "def __init__(self, clf, pos_label=1)" }, { "docstring": "fit Args: X: Data y: label Returns: self", "name": "fit", "signature": "def fit(self, X, y=None)" }, ...
3
stack_v2_sparse_classes_30k_val_000134
Implement the Python class `PredictProbaFeature` described below. Class description: Returns clf.predict_proba() as features. Method signatures and docstrings: - def __init__(self, clf, pos_label=1): Init function Args: clf: Classifier pos_label: positive label (default=1) - def fit(self, X, y=None): fit Args: X: Dat...
Implement the Python class `PredictProbaFeature` described below. Class description: Returns clf.predict_proba() as features. Method signatures and docstrings: - def __init__(self, clf, pos_label=1): Init function Args: clf: Classifier pos_label: positive label (default=1) - def fit(self, X, y=None): fit Args: X: Dat...
5db6e80d2bd2d1bf1a381f668db40288888236e4
<|skeleton|> class PredictProbaFeature: """Returns clf.predict_proba() as features.""" def __init__(self, clf, pos_label=1): """Init function Args: clf: Classifier pos_label: positive label (default=1)""" <|body_0|> def fit(self, X, y=None): """fit Args: X: Data y: label Returns: s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PredictProbaFeature: """Returns clf.predict_proba() as features.""" def __init__(self, clf, pos_label=1): """Init function Args: clf: Classifier pos_label: positive label (default=1)""" assert hasattr(clf, 'predict_proba') self.estimator_ = clf self.pos_label_ = pos_label ...
the_stack_v2_python_sparse
learnit/autolearn/blueprints.py
megagonlabs/learnit
train
5
e17233a994c46badccc306325941c946aabae2a4
[ "LDC_Info.__init__(self)\nself.setTitle(self.name)\nself.status = compat_res[0]\nself.ui.setupUi(self.frame)\nself.__fill_frame(info_res, compat_res, diag_res)", "self.ui.modelLineEdit.setText(QtGui.QApplication.translate('FrameDVDCD', info_res.model, None, QtGui.QApplication.UnicodeUTF8))\nself.ui.vendorLineEdit...
<|body_start_0|> LDC_Info.__init__(self) self.setTitle(self.name) self.status = compat_res[0] self.ui.setupUi(self.frame) self.__fill_frame(info_res, compat_res, diag_res) <|end_body_0|> <|body_start_1|> self.ui.modelLineEdit.setText(QtGui.QApplication.translate('FrameDV...
Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de CD/DVD.
GUIDVDCD
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIDVDCD: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de CD/DVD.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResDVDCD') compat...
stack_v2_sparse_classes_36k_train_032554
4,929
no_license
[ { "docstring": "Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResDVDCD') compat_res -- Lista com as tuples de resultados de compatibilidade [(True, msg)] diag_res -- Lista com os resultados do diagnóstico (lista de 'DaigResDVDCD')", "name": "__init__", "signature...
5
null
Implement the Python class `GUIDVDCD` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de CD/DVD. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os...
Implement the Python class `GUIDVDCD` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de CD/DVD. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class GUIDVDCD: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de CD/DVD.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResDVDCD') compat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GUIDVDCD: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de CD/DVD.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResDVDCD') compat_res -- Lista...
the_stack_v2_python_sparse
src/libs/dvdcd/gui_dvdcd.py
adrianomelo/ldc-desktop
train
1
634557e06961d354c8e3976c8083fd672ec1a7bd
[ "template = orm.ContentTemplate.objects.get(key='how_it_works')\ncontent = 'Vinely is a personality test<br />disguised as a wine tasting'\norm.Section.objects.create(category=4, content=content, template=template)\ncontent = \"Are you Whimsical? Serendipitous? Do you think you're Sensational? Exuberant? Full of Mo...
<|body_start_0|> template = orm.ContentTemplate.objects.get(key='how_it_works') content = 'Vinely is a personality test<br />disguised as a wine tasting' orm.Section.objects.create(category=4, content=content, template=template) content = "Are you Whimsical? Serendipitous? Do you think y...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> template = orm.ContentTemplate.objects.get(key='ho...
stack_v2_sparse_classes_36k_train_032555
3,586
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
null
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
c5c7d8a0b1a297e07302870017d3fb03c5dbb009
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" template = orm.ContentTemplate.objects.get(key='how_it_works') content = 'Vinely is a personality test<br />disguised as a wine tasting' orm.Section.objects.create(category=4, content=content, template=...
the_stack_v2_python_sparse
cms/migrations/0006_add_header_sub_heading_sections.py
RSV3/nuvine
train
0
80dd23c3b3ea116d44108125479f9d1849b69473
[ "m, value = (abs(n), 1.0)\nwhile m:\n if m & 1:\n value *= x\n x *= x\n m >>= 1\nreturn value if n >= 0 else 1 / value", "m, value = (abs(n), 1.0)\nwhile m:\n if m % 2:\n value *= x\n x *= x\n m //= 2\nreturn value if n >= 0 else 1 / value" ]
<|body_start_0|> m, value = (abs(n), 1.0) while m: if m & 1: value *= x x *= x m >>= 1 return value if n >= 0 else 1 / value <|end_body_0|> <|body_start_1|> m, value = (abs(n), 1.0) while m: if m % 2: ...
Power
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Power: def get_power(self, x: int, n: int) -> float: """Approach: Fast Power Iterative with right shift and bit-wise "AND" operator. Time Complexity: O(log n) Space Complexity: O(1) :param x: :param n: :return:""" <|body_0|> def get_power_(self, x: int, n: int) -> float: ...
stack_v2_sparse_classes_36k_train_032556
1,082
no_license
[ { "docstring": "Approach: Fast Power Iterative with right shift and bit-wise \"AND\" operator. Time Complexity: O(log n) Space Complexity: O(1) :param x: :param n: :return:", "name": "get_power", "signature": "def get_power(self, x: int, n: int) -> float" }, { "docstring": "Approach: Fast Power ...
2
null
Implement the Python class `Power` described below. Class description: Implement the Power class. Method signatures and docstrings: - def get_power(self, x: int, n: int) -> float: Approach: Fast Power Iterative with right shift and bit-wise "AND" operator. Time Complexity: O(log n) Space Complexity: O(1) :param x: :p...
Implement the Python class `Power` described below. Class description: Implement the Power class. Method signatures and docstrings: - def get_power(self, x: int, n: int) -> float: Approach: Fast Power Iterative with right shift and bit-wise "AND" operator. Time Complexity: O(log n) Space Complexity: O(1) :param x: :p...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Power: def get_power(self, x: int, n: int) -> float: """Approach: Fast Power Iterative with right shift and bit-wise "AND" operator. Time Complexity: O(log n) Space Complexity: O(1) :param x: :param n: :return:""" <|body_0|> def get_power_(self, x: int, n: int) -> float: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Power: def get_power(self, x: int, n: int) -> float: """Approach: Fast Power Iterative with right shift and bit-wise "AND" operator. Time Complexity: O(log n) Space Complexity: O(1) :param x: :param n: :return:""" m, value = (abs(n), 1.0) while m: if m & 1: ...
the_stack_v2_python_sparse
math_and_srings/power_x_n.py
Shiv2157k/leet_code
train
1
cd3573f0dfa867d336d395af0fa81e99a4782534
[ "res = []\nif root:\n queue = deque([root])\n while queue:\n tmp = queue.pop()\n res.append(str(tmp.val))\n res.append(str(len(tmp.children)))\n for ch in tmp.children:\n queue.appendleft(ch)\nreturn ','.join(res)", "if not data:\n return\ndata = map(int, data.split...
<|body_start_0|> res = [] if root: queue = deque([root]) while queue: tmp = queue.pop() res.append(str(tmp.val)) res.append(str(len(tmp.children))) for ch in tmp.children: queue.appendleft(ch) ...
Codec1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec1: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_032557
2,421
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root: 'Node') -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def des...
2
stack_v2_sparse_classes_30k_test_001201
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to t...
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to t...
631df2ce6892a6fbb3e435f57e90d85f8200d125
<|skeleton|> class Codec1: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec1: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" res = [] if root: queue = deque([root]) while queue: tmp = queue.pop() res.append(str(tmp.val)) ...
the_stack_v2_python_sparse
428. Serialize and Deserialize N-ary Tree.py
c940606/leetcode
train
3
4ca4dd46bc8440aa374d4577d60d84218f308a30
[ "cur, res = (float('-inf'), 0)\nfor p in sorted(pairs, key=lambda x: x[1]):\n if cur < p[0]:\n cur, res = (p[1], res + 1)\nreturn res", "pairs.sort(key=lambda p: p[1])\nstack = []\nfor p in pairs:\n if not stack or (stack and stack[-1][1] < p[0]):\n stack.append(p)\nreturn len(stack)", "pair...
<|body_start_0|> cur, res = (float('-inf'), 0) for p in sorted(pairs, key=lambda x: x[1]): if cur < p[0]: cur, res = (p[1], res + 1) return res <|end_body_0|> <|body_start_1|> pairs.sort(key=lambda p: p[1]) stack = [] for p in pairs: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLongestChain(self, pairs): """:type pairs: List[List[int]] :rtype: int 結合 greedy 跟 dp 解 只要記錄當前最大的tail 如果遇到更大的head, 就長度+1, 更新最大 tail 最後回傳長度""" <|body_0|> def findLongestChainStack(self, pairs): """:type pairs: List[List[int]] :rtype: int 沒想到本題有 Greed...
stack_v2_sparse_classes_36k_train_032558
1,642
no_license
[ { "docstring": ":type pairs: List[List[int]] :rtype: int 結合 greedy 跟 dp 解 只要記錄當前最大的tail 如果遇到更大的head, 就長度+1, 更新最大 tail 最後回傳長度", "name": "findLongestChain", "signature": "def findLongestChain(self, pairs)" }, { "docstring": ":type pairs: List[List[int]] :rtype: int 沒想到本題有 Greedy 的解法 根據尾巴值排序後就從頭開始找...
3
stack_v2_sparse_classes_30k_train_015100
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLongestChain(self, pairs): :type pairs: List[List[int]] :rtype: int 結合 greedy 跟 dp 解 只要記錄當前最大的tail 如果遇到更大的head, 就長度+1, 更新最大 tail 最後回傳長度 - def findLongestChainStack(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLongestChain(self, pairs): :type pairs: List[List[int]] :rtype: int 結合 greedy 跟 dp 解 只要記錄當前最大的tail 如果遇到更大的head, 就長度+1, 更新最大 tail 最後回傳長度 - def findLongestChainStack(self, ...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def findLongestChain(self, pairs): """:type pairs: List[List[int]] :rtype: int 結合 greedy 跟 dp 解 只要記錄當前最大的tail 如果遇到更大的head, 就長度+1, 更新最大 tail 最後回傳長度""" <|body_0|> def findLongestChainStack(self, pairs): """:type pairs: List[List[int]] :rtype: int 沒想到本題有 Greed...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findLongestChain(self, pairs): """:type pairs: List[List[int]] :rtype: int 結合 greedy 跟 dp 解 只要記錄當前最大的tail 如果遇到更大的head, 就長度+1, 更新最大 tail 最後回傳長度""" cur, res = (float('-inf'), 0) for p in sorted(pairs, key=lambda x: x[1]): if cur < p[0]: cur, res ...
the_stack_v2_python_sparse
cs_notes/dynamic_programming/maximum_length_of_pair_chain.py
hwc1824/LeetCodeSolution
train
0
e317523d72fa61b6516437c3f10edf5a3480dbe1
[ "if isinstance(nodes, list) and all((isinstance(node, Node) for node in nodes)):\n return nodes[:]\nif isinstance(nodes, Schedule):\n return nodes.children[:]\nif isinstance(nodes, Node):\n return [nodes]\narg_type = str(type(nodes))\nraise TransformationError(f'Error in {self.name}: Argument must be a sin...
<|body_start_0|> if isinstance(nodes, list) and all((isinstance(node, Node) for node in nodes)): return nodes[:] if isinstance(nodes, Schedule): return nodes.children[:] if isinstance(nodes, Node): return [nodes] arg_type = str(type(nodes)) rai...
This abstract class is a base class for all transformations that act on a list of nodes. It gives access to a validate function that makes sure that the nodes in the list are in the same order as in the original AST, no node is duplicated, and that all nodes have the same parent. We also check that all nodes to be encl...
RegionTrans
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegionTrans: """This abstract class is a base class for all transformations that act on a list of nodes. It gives access to a validate function that makes sure that the nodes in the list are in the same order as in the original AST, no node is duplicated, and that all nodes have the same parent. ...
stack_v2_sparse_classes_36k_train_032559
10,133
permissive
[ { "docstring": "This is a helper function for region based transformations. The parameter for any of those transformations is either a single node, a schedule, or a list of nodes. This function converts this into a list of nodes according to the parameter type. This function will always return a copy, to avoid ...
2
stack_v2_sparse_classes_30k_train_006526
Implement the Python class `RegionTrans` described below. Class description: This abstract class is a base class for all transformations that act on a list of nodes. It gives access to a validate function that makes sure that the nodes in the list are in the same order as in the original AST, no node is duplicated, an...
Implement the Python class `RegionTrans` described below. Class description: This abstract class is a base class for all transformations that act on a list of nodes. It gives access to a validate function that makes sure that the nodes in the list are in the same order as in the original AST, no node is duplicated, an...
0b149bc5a76ca85c1dd086c3aa813102d0d04b56
<|skeleton|> class RegionTrans: """This abstract class is a base class for all transformations that act on a list of nodes. It gives access to a validate function that makes sure that the nodes in the list are in the same order as in the original AST, no node is duplicated, and that all nodes have the same parent. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegionTrans: """This abstract class is a base class for all transformations that act on a list of nodes. It gives access to a validate function that makes sure that the nodes in the list are in the same order as in the original AST, no node is duplicated, and that all nodes have the same parent. We also check...
the_stack_v2_python_sparse
src/psyclone/psyir/transformations/region_trans.py
stfc/PSyclone
train
100
97d7075e8c0b4ca6e0fdaf532815263357586f56
[ "Win._load()\nbufferSize = (len(text) + 1) * 2\nhGlobalMem = Win.GlobalAlloc(ctypes.c_int(GHND), ctypes.c_int(bufferSize))\nlpGlobalMem = Win.GlobalLock(ctypes.c_int(hGlobalMem))\nWin.memcpy(lpGlobalMem, ctypes.c_wchar_p(text), ctypes.c_int(bufferSize))\nWin.GlobalUnlock(ctypes.c_int(hGlobalMem))\nif Win.OpenClipbo...
<|body_start_0|> Win._load() bufferSize = (len(text) + 1) * 2 hGlobalMem = Win.GlobalAlloc(ctypes.c_int(GHND), ctypes.c_int(bufferSize)) lpGlobalMem = Win.GlobalLock(ctypes.c_int(hGlobalMem)) Win.memcpy(lpGlobalMem, ctypes.c_wchar_p(text), ctypes.c_int(bufferSize)) Win.Gl...
Exports
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする""" <|body_0|> def clipboard_paste(): """クリップボードからテキストをはり付ける""" <|body_1|> <|end_skeleton|> <|body_start_0|> Win._load() bufferSize = (len(text) + 1) * 2 hGlobalMem = Win.Global...
stack_v2_sparse_classes_36k_train_032560
2,348
permissive
[ { "docstring": "クリップボードにテキストをコピーする", "name": "clipboard_copy", "signature": "def clipboard_copy(text)" }, { "docstring": "クリップボードからテキストをはり付ける", "name": "clipboard_paste", "signature": "def clipboard_paste()" } ]
2
stack_v2_sparse_classes_30k_train_001098
Implement the Python class `Exports` described below. Class description: Implement the Exports class. Method signatures and docstrings: - def clipboard_copy(text): クリップボードにテキストをコピーする - def clipboard_paste(): クリップボードからテキストをはり付ける
Implement the Python class `Exports` described below. Class description: Implement the Exports class. Method signatures and docstrings: - def clipboard_copy(text): クリップボードにテキストをコピーする - def clipboard_paste(): クリップボードからテキストをはり付ける <|skeleton|> class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする"...
f3d89b4449b04e5e587915f3b3623dfbe5ba01d8
<|skeleton|> class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする""" <|body_0|> def clipboard_paste(): """クリップボードからテキストをはり付ける""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする""" Win._load() bufferSize = (len(text) + 1) * 2 hGlobalMem = Win.GlobalAlloc(ctypes.c_int(GHND), ctypes.c_int(bufferSize)) lpGlobalMem = Win.GlobalLock(ctypes.c_int(hGlobalMem)) Win.memcpy(lpGlobalMem, cty...
the_stack_v2_python_sparse
machaon/platforms/windows/clipboard.py
betasewer/machaon
train
4
700103e5b3b016d0101185f1168e8b0db6797ec5
[ "super().__init__()\nself.address: dict[str, list[BluetoothCallbackMatcherWithCallback]] = {}\nself.connectable: list[BluetoothCallbackMatcherWithCallback] = []", "if ADDRESS in matcher:\n self.address.setdefault(matcher[ADDRESS], []).append(matcher)\n return\nif super().add(matcher):\n self.build()\n ...
<|body_start_0|> super().__init__() self.address: dict[str, list[BluetoothCallbackMatcherWithCallback]] = {} self.connectable: list[BluetoothCallbackMatcherWithCallback] = [] <|end_body_0|> <|body_start_1|> if ADDRESS in matcher: self.address.setdefault(matcher[ADDRESS], [])...
Bluetooth matcher for the bluetooth integration. Supports matching on addresses.
BluetoothCallbackMatcherIndex
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BluetoothCallbackMatcherIndex: """Bluetooth matcher for the bluetooth integration. Supports matching on addresses.""" def __init__(self) -> None: """Initialize the matcher index.""" <|body_0|> def add_callback_matcher(self, matcher: BluetoothCallbackMatcherWithCallback) ...
stack_v2_sparse_classes_36k_train_032561
15,444
permissive
[ { "docstring": "Initialize the matcher index.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Add a matcher to the index. Matchers must end up only in one bucket. We put them in the bucket that they are most likely to match.", "name": "add_callback_matcher"...
4
null
Implement the Python class `BluetoothCallbackMatcherIndex` described below. Class description: Bluetooth matcher for the bluetooth integration. Supports matching on addresses. Method signatures and docstrings: - def __init__(self) -> None: Initialize the matcher index. - def add_callback_matcher(self, matcher: Blueto...
Implement the Python class `BluetoothCallbackMatcherIndex` described below. Class description: Bluetooth matcher for the bluetooth integration. Supports matching on addresses. Method signatures and docstrings: - def __init__(self) -> None: Initialize the matcher index. - def add_callback_matcher(self, matcher: Blueto...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class BluetoothCallbackMatcherIndex: """Bluetooth matcher for the bluetooth integration. Supports matching on addresses.""" def __init__(self) -> None: """Initialize the matcher index.""" <|body_0|> def add_callback_matcher(self, matcher: BluetoothCallbackMatcherWithCallback) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BluetoothCallbackMatcherIndex: """Bluetooth matcher for the bluetooth integration. Supports matching on addresses.""" def __init__(self) -> None: """Initialize the matcher index.""" super().__init__() self.address: dict[str, list[BluetoothCallbackMatcherWithCallback]] = {} ...
the_stack_v2_python_sparse
homeassistant/components/bluetooth/match.py
home-assistant/core
train
35,501
e5e16e45cfc728c4a6734d09aace1278bb3f2bff
[ "self.height = height\nself.width = width\nself.food = food\nself.q = collections.deque([(0, 0)])\nself.score = 0", "headRow, headCol = self.q[-1]\nif direction == 'U':\n headRow -= 1\nelif direction == 'L':\n headCol -= 1\nelif direction == 'R':\n headCol += 1\nelif direction == 'D':\n headRow += 1\n...
<|body_start_0|> self.height = height self.width = width self.food = food self.q = collections.deque([(0, 0)]) self.score = 0 <|end_body_0|> <|body_start_1|> headRow, headCol = self.q[-1] if direction == 'U': headRow -= 1 elif direction == 'L'...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k_train_032562
2,104
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
0be5b51e409ae479284452ab24f55b7811583653
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
DesignSnakeGame.py
juhideshpande/LeetCode
train
0
3545980521045371b3059e93e736b3eff2fec254
[ "program, _ = create_program()\ncourse = program.course_set.first()\nenrollment = ProgramEnrollmentFactory.create(program=program)\ncurrent_run = ExamRunFactory.create(course=course, authorized=authorized)\npast_run = ExamRunFactory.create(course=course, scheduling_future=True, authorized=authorized)\nfuture_run = ...
<|body_start_0|> program, _ = create_program() course = program.course_set.first() enrollment = ProgramEnrollmentFactory.create(program=program) current_run = ExamRunFactory.create(course=course, authorized=authorized) past_run = ExamRunFactory.create(course=course, scheduling_fu...
Tests for ExamRun tasks
ExamRunTasksTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExamRunTasksTest: """Tests for ExamRun tasks""" def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): """Test authorize_exam_runs()""" <|body_0|> def test_authorize_enrollment_for_exam_run(self, authorize_for_latest_passed_course_mock):...
stack_v2_sparse_classes_36k_train_032563
2,615
permissive
[ { "docstring": "Test authorize_exam_runs()", "name": "test_authorize_exam_runs", "signature": "def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock)" }, { "docstring": "Test authorize_enrollment_for_exam_run()", "name": "test_authorize_enrollment_for_exam_ru...
2
stack_v2_sparse_classes_30k_train_014514
Implement the Python class `ExamRunTasksTest` described below. Class description: Tests for ExamRun tasks Method signatures and docstrings: - def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): Test authorize_exam_runs() - def test_authorize_enrollment_for_exam_run(self, authorize...
Implement the Python class `ExamRunTasksTest` described below. Class description: Tests for ExamRun tasks Method signatures and docstrings: - def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): Test authorize_exam_runs() - def test_authorize_enrollment_for_exam_run(self, authorize...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class ExamRunTasksTest: """Tests for ExamRun tasks""" def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): """Test authorize_exam_runs()""" <|body_0|> def test_authorize_enrollment_for_exam_run(self, authorize_for_latest_passed_course_mock):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExamRunTasksTest: """Tests for ExamRun tasks""" def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): """Test authorize_exam_runs()""" program, _ = create_program() course = program.course_set.first() enrollment = ProgramEnrollmentFactory...
the_stack_v2_python_sparse
exams/tasks_test.py
mitodl/micromasters
train
35
0ee8d394fdb7f45005ddfa0c8fb8aef51dc1da8a
[ "def dfs(node):\n if not node:\n return '#'\n return '{},{},{}'.format(node.val, dfs(node.left), dfs(node.right))\nreturn dfs(root)", "nodes = data.split(',')\n\ndef dfs(nodes):\n if not nodes:\n return None\n val = nodes.pop(0)\n if val == '#':\n return None\n node = TreeNo...
<|body_start_0|> def dfs(node): if not node: return '#' return '{},{},{}'.format(node.val, dfs(node.left), dfs(node.right)) return dfs(root) <|end_body_0|> <|body_start_1|> nodes = data.split(',') def dfs(nodes): if not nodes: ...
Codec297
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec297: 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|> def serialize_bfs(...
stack_v2_sparse_classes_36k_train_032564
5,051
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...
4
null
Implement the Python class `Codec297` described below. Class description: Implement the Codec297 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 :...
Implement the Python class `Codec297` described below. Class description: Implement the Codec297 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 :...
dca40686c6a280bd394feb8e6e78d40eecf854b9
<|skeleton|> class Codec297: 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|> def serialize_bfs(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec297: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def dfs(node): if not node: return '#' return '{},{},{}'.format(node.val, dfs(node.left), dfs(node.right)) return dfs(root) def de...
the_stack_v2_python_sparse
src/data_structure/tree/seralization.py
1325052669/leetcode
train
0
73f08178b415b5e15b9522aeb8f606ed803825e8
[ "levels = []\nif not root:\n return levels\nnext_level = deque([root])\nwhile root and next_level:\n curr_level = next_level\n next_level = deque()\n for node in curr_level:\n levels[-1].append(node.val)\n if node.left:\n next_level.append(node.left)\n if node.right:\n ...
<|body_start_0|> levels = [] if not root: return levels next_level = deque([root]) while root and next_level: curr_level = next_level next_level = deque() for node in curr_level: levels[-1].append(node.val) i...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def level_order_traversal_(self, root: 'TreeNode') -> List[List[int]]: """Approach: Iterative Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def level_order_traversal(self, root: 'TreeNode') -> List[List[int]]: """Approac...
stack_v2_sparse_classes_36k_train_032565
1,915
no_license
[ { "docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(N) :param root: :return:", "name": "level_order_traversal_", "signature": "def level_order_traversal_(self, root: 'TreeNode') -> List[List[int]]" }, { "docstring": "Approach: Depth First Search Time Complexity: O(N) Sp...
2
null
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def level_order_traversal_(self, root: 'TreeNode') -> List[List[int]]: Approach: Iterative Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def level_orde...
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def level_order_traversal_(self, root: 'TreeNode') -> List[List[int]]: Approach: Iterative Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def level_orde...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class BinaryTree: def level_order_traversal_(self, root: 'TreeNode') -> List[List[int]]: """Approach: Iterative Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def level_order_traversal(self, root: 'TreeNode') -> List[List[int]]: """Approac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryTree: def level_order_traversal_(self, root: 'TreeNode') -> List[List[int]]: """Approach: Iterative Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" levels = [] if not root: return levels next_level = deque([root]) while root and n...
the_stack_v2_python_sparse
revisited/trees/binary_tree_level_order_traversal_ii.py
Shiv2157k/leet_code
train
1
8fead42709f0da39ae2497736d61dcd57dc3f931
[ "if max_id is not None:\n max_id = self.__unpack_id(max_id)\nif min_id is not None:\n min_id = self.__unpack_id(min_id)\nif since_id is not None:\n since_id = self.__unpack_id(since_id)\nparams = self.__generate_params(locals())\nreturn self.__api_request('GET', '/api/v1/favourites', params)", "if max_id...
<|body_start_0|> if max_id is not None: max_id = self.__unpack_id(max_id) if min_id is not None: min_id = self.__unpack_id(min_id) if since_id is not None: since_id = self.__unpack_id(since_id) params = self.__generate_params(locals()) return s...
Mastodon
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mastodon: def favourites(self, max_id: Optional[IdType]=None, min_id: Optional[IdType]=None, since_id: Optional[IdType]=None, limit: Optional[int]=None) -> PaginatableList[Status]: """Fetch the logged-in user's favourited statuses. This endpoint uses internal ids for pagination, passing ...
stack_v2_sparse_classes_36k_train_032566
2,216
permissive
[ { "docstring": "Fetch the logged-in user's favourited statuses. This endpoint uses internal ids for pagination, passing status ids to `max_id`, `min_id`, or `since_id` will not work. Returns a list of :ref:`status dicts <status dicts>`.", "name": "favourites", "signature": "def favourites(self, max_id: ...
2
stack_v2_sparse_classes_30k_train_012609
Implement the Python class `Mastodon` described below. Class description: Implement the Mastodon class. Method signatures and docstrings: - def favourites(self, max_id: Optional[IdType]=None, min_id: Optional[IdType]=None, since_id: Optional[IdType]=None, limit: Optional[int]=None) -> PaginatableList[Status]: Fetch t...
Implement the Python class `Mastodon` described below. Class description: Implement the Mastodon class. Method signatures and docstrings: - def favourites(self, max_id: Optional[IdType]=None, min_id: Optional[IdType]=None, since_id: Optional[IdType]=None, limit: Optional[int]=None) -> PaginatableList[Status]: Fetch t...
cd86887d88bbc07de462d1e00a8fbc3d956c0151
<|skeleton|> class Mastodon: def favourites(self, max_id: Optional[IdType]=None, min_id: Optional[IdType]=None, since_id: Optional[IdType]=None, limit: Optional[int]=None) -> PaginatableList[Status]: """Fetch the logged-in user's favourited statuses. This endpoint uses internal ids for pagination, passing ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mastodon: def favourites(self, max_id: Optional[IdType]=None, min_id: Optional[IdType]=None, since_id: Optional[IdType]=None, limit: Optional[int]=None) -> PaginatableList[Status]: """Fetch the logged-in user's favourited statuses. This endpoint uses internal ids for pagination, passing status ids to ...
the_stack_v2_python_sparse
mastodon/favourites.py
halcy/Mastodon.py
train
880
045f554750eaa65e4aa88273f70d2218fa8bdd77
[ "if not tenant_is_admin(request.headers):\n response.status = 401\n return dict(faultcode='Client', faultstring='Client not authorized to access this function')\nwith db_session() as session:\n user = session.query(AdminAuth.tenant_id.label('tenant'), AdminAuth.level).all()\n session.commit()\nreturn us...
<|body_start_0|> if not tenant_is_admin(request.headers): response.status = 401 return dict(faultcode='Client', faultstring='Client not authorized to access this function') with db_session() as session: user = session.query(AdminAuth.tenant_id.label('tenant'), AdminAu...
UserController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserController: def get_all(self): """Get a list of users""" <|body_0|> def get_one(self, tenant_id=None): """Get a single Admin API user or details about self""" <|body_1|> def delete(self, tenant_id): """Delete a given user from the Admin API""...
stack_v2_sparse_classes_36k_train_032567
6,476
no_license
[ { "docstring": "Get a list of users", "name": "get_all", "signature": "def get_all(self)" }, { "docstring": "Get a single Admin API user or details about self", "name": "get_one", "signature": "def get_one(self, tenant_id=None)" }, { "docstring": "Delete a given user from the Adm...
5
null
Implement the Python class `UserController` described below. Class description: Implement the UserController class. Method signatures and docstrings: - def get_all(self): Get a list of users - def get_one(self, tenant_id=None): Get a single Admin API user or details about self - def delete(self, tenant_id): Delete a ...
Implement the Python class `UserController` described below. Class description: Implement the UserController class. Method signatures and docstrings: - def get_all(self): Get a list of users - def get_one(self, tenant_id=None): Get a single Admin API user or details about self - def delete(self, tenant_id): Delete a ...
a0e8b91e160eba15f35717598b01f9c29a8575a5
<|skeleton|> class UserController: def get_all(self): """Get a list of users""" <|body_0|> def get_one(self, tenant_id=None): """Get a single Admin API user or details about self""" <|body_1|> def delete(self, tenant_id): """Delete a given user from the Admin API""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserController: def get_all(self): """Get a list of users""" if not tenant_is_admin(request.headers): response.status = 401 return dict(faultcode='Client', faultstring='Client not authorized to access this function') with db_session() as session: use...
the_stack_v2_python_sparse
libra/admin_api/controllers/v2/user.py
LoriJean/libra
train
0
124ca10a66646b7a74b52ad28efe9272abe75478
[ "l = r = 0\nseen_dict = {}\nlocal_distance = global_distance = 0\nwhile r < len(s) and l < len(s):\n if s[r] not in seen_dict:\n seen_dict[s[r]] = r\n else:\n l = max(seen_dict[s[r]] + 1, l)\n seen_dict[s[r]] = r\n local_distance = r - l + 1\n if global_distance < local_distance:\n ...
<|body_start_0|> l = r = 0 seen_dict = {} local_distance = global_distance = 0 while r < len(s) and l < len(s): if s[r] not in seen_dict: seen_dict[s[r]] = r else: l = max(seen_dict[s[r]] + 1, l) seen_dict[s[r]] = r ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = r = 0 seen_dict = {} l...
stack_v2_sparse_classes_36k_train_032568
1,316
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring2", "signature": "def lengthOfLongestSubstring2(self, s)" } ]
2
stack_v2_sparse_classes_30k_test_000524
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def lengthOf...
d538b822234dd697bd529c73f815fa9075224230
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" l = r = 0 seen_dict = {} local_distance = global_distance = 0 while r < len(s) and l < len(s): if s[r] not in seen_dict: seen_dict[s[r]] = r else: ...
the_stack_v2_python_sparse
Leetcode/3.LongestSubstringWithoutRepeatingChars.py
XingyuHe/cracking-the-coding-interview
train
0
8a8bfe1ebf127e1875af83b12c48513bd0b3c088
[ "type_repr = _type_pprinters.copy()\ndel type_repr[type]\ndel type_repr[types.BuiltinFunctionType]\ndel type_repr[types.FunctionType]\ndel type_repr[str]\nself._type_repr = type_repr", "try:\n pretty_repr = self._type_repr[type(obj)]\nexcept KeyError:\n return False\npretty_repr(obj, p, cycle)\nreturn True"...
<|body_start_0|> type_repr = _type_pprinters.copy() del type_repr[type] del type_repr[types.BuiltinFunctionType] del type_repr[types.FunctionType] del type_repr[str] self._type_repr = type_repr <|end_body_0|> <|body_start_1|> try: pretty_repr = self._...
SomeIPythonRepr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SomeIPythonRepr: def __init__(self): """Some selected representers from IPython EXAMPLES:: sage: from sage.repl.display.fancy_repr import SomeIPythonRepr sage: SomeIPythonRepr() SomeIPythonRepr pretty printer .. automethod:: __call__""" <|body_0|> def __call__(self, obj, p, ...
stack_v2_sparse_classes_36k_train_032569
10,380
no_license
[ { "docstring": "Some selected representers from IPython EXAMPLES:: sage: from sage.repl.display.fancy_repr import SomeIPythonRepr sage: SomeIPythonRepr() SomeIPythonRepr pretty printer .. automethod:: __call__", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Format obje...
2
null
Implement the Python class `SomeIPythonRepr` described below. Class description: Implement the SomeIPythonRepr class. Method signatures and docstrings: - def __init__(self): Some selected representers from IPython EXAMPLES:: sage: from sage.repl.display.fancy_repr import SomeIPythonRepr sage: SomeIPythonRepr() SomeIP...
Implement the Python class `SomeIPythonRepr` described below. Class description: Implement the SomeIPythonRepr class. Method signatures and docstrings: - def __init__(self): Some selected representers from IPython EXAMPLES:: sage: from sage.repl.display.fancy_repr import SomeIPythonRepr sage: SomeIPythonRepr() SomeIP...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class SomeIPythonRepr: def __init__(self): """Some selected representers from IPython EXAMPLES:: sage: from sage.repl.display.fancy_repr import SomeIPythonRepr sage: SomeIPythonRepr() SomeIPythonRepr pretty printer .. automethod:: __call__""" <|body_0|> def __call__(self, obj, p, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SomeIPythonRepr: def __init__(self): """Some selected representers from IPython EXAMPLES:: sage: from sage.repl.display.fancy_repr import SomeIPythonRepr sage: SomeIPythonRepr() SomeIPythonRepr pretty printer .. automethod:: __call__""" type_repr = _type_pprinters.copy() del type_repr[...
the_stack_v2_python_sparse
sage/src/sage/repl/display/fancy_repr.py
bopopescu/geosci
train
0
ccad59a5071228ca100e415199ffc4d5d0d3454e
[ "min_val = float('inf')\nfor i in range(len(arr1)):\n for j in range(len(arr2)):\n for k in range(len(arr3)):\n curr = max(abs(arr1[i] - arr2[j]), abs(arr1[i] - arr3[k]), abs(arr2[j] - arr3[k]))\n min_val = min(min_val, curr)\nreturn min_val", "min_val = float('inf')\ni, j, k = (0,...
<|body_start_0|> min_val = float('inf') for i in range(len(arr1)): for j in range(len(arr2)): for k in range(len(arr3)): curr = max(abs(arr1[i] - arr2[j]), abs(arr1[i] - arr3[k]), abs(arr2[j] - arr3[k])) min_val = min(min_val, curr) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def array_3p_brute(self, arr1, arr2, arr3): """Brute force algorithm. Time complexity: O(len1 * len2 * len3). Space complexity: O(1), where len1, len2, len3 are len(arr1), len(arr2), len(arr3).""" <|body_0|> def array_3p(self, arr1, arr2, arr3): """Improved...
stack_v2_sparse_classes_36k_train_032570
2,174
no_license
[ { "docstring": "Brute force algorithm. Time complexity: O(len1 * len2 * len3). Space complexity: O(1), where len1, len2, len3 are len(arr1), len(arr2), len(arr3).", "name": "array_3p_brute", "signature": "def array_3p_brute(self, arr1, arr2, arr3)" }, { "docstring": "Improved algorithm using 3 p...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def array_3p_brute(self, arr1, arr2, arr3): Brute force algorithm. Time complexity: O(len1 * len2 * len3). Space complexity: O(1), where len1, len2, len3 are len(arr1), len(arr2)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def array_3p_brute(self, arr1, arr2, arr3): Brute force algorithm. Time complexity: O(len1 * len2 * len3). Space complexity: O(1), where len1, len2, len3 are len(arr1), len(arr2)...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def array_3p_brute(self, arr1, arr2, arr3): """Brute force algorithm. Time complexity: O(len1 * len2 * len3). Space complexity: O(1), where len1, len2, len3 are len(arr1), len(arr2), len(arr3).""" <|body_0|> def array_3p(self, arr1, arr2, arr3): """Improved...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def array_3p_brute(self, arr1, arr2, arr3): """Brute force algorithm. Time complexity: O(len1 * len2 * len3). Space complexity: O(1), where len1, len2, len3 are len(arr1), len(arr2), len(arr3).""" min_val = float('inf') for i in range(len(arr1)): for j in range(le...
the_stack_v2_python_sparse
Arrays/array_3p.py
vladn90/Algorithms
train
0
7ecbacbf79bd9d6220888fa6d3c86b41090084e6
[ "if source is None:\n source = '{0}/vega.hd5'.format(__ROOT__)\nself.source = source\nself.hdf = None", "if self.hdf is None:\n self.hdf = tables.open_file(self.source)\nreturn self", "if self.hdf is not None:\n self.hdf.close()\n self.hdf = None\nreturn False", "with self as s:\n FNAME = s.hdf...
<|body_start_0|> if source is None: source = '{0}/vega.hd5'.format(__ROOT__) self.source = source self.hdf = None <|end_body_0|> <|body_start_1|> if self.hdf is None: self.hdf = tables.open_file(self.source) return self <|end_body_1|> <|body_start_2|> ...
Class that handles vega spectrum and references. This class know where to find the Vega synthetic spectrum (Bohlin 2007) in order to compute fluxes and magnitudes in given filters An instance can be used as a context manager as:: filters = ['HST_WFC3_F275W', 'HST_WFC3_F336W', 'HST_WFC3_F475W', 'HST_WFC3_F814W', 'HST_WF...
Vega
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vega: """Class that handles vega spectrum and references. This class know where to find the Vega synthetic spectrum (Bohlin 2007) in order to compute fluxes and magnitudes in given filters An instance can be used as a context manager as:: filters = ['HST_WFC3_F275W', 'HST_WFC3_F336W', 'HST_WFC3_F...
stack_v2_sparse_classes_36k_train_032571
3,667
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, source=None)" }, { "docstring": "Enter context", "name": "__enter__", "signature": "def __enter__(self)" }, { "docstring": "end context", "name": "__exit__", "signature": "def __exit__(self...
5
null
Implement the Python class `Vega` described below. Class description: Class that handles vega spectrum and references. This class know where to find the Vega synthetic spectrum (Bohlin 2007) in order to compute fluxes and magnitudes in given filters An instance can be used as a context manager as:: filters = ['HST_WFC...
Implement the Python class `Vega` described below. Class description: Class that handles vega spectrum and references. This class know where to find the Vega synthetic spectrum (Bohlin 2007) in order to compute fluxes and magnitudes in given filters An instance can be used as a context manager as:: filters = ['HST_WFC...
8ad7ba6ebcacd86d492532463b29b91e0c61875e
<|skeleton|> class Vega: """Class that handles vega spectrum and references. This class know where to find the Vega synthetic spectrum (Bohlin 2007) in order to compute fluxes and magnitudes in given filters An instance can be used as a context manager as:: filters = ['HST_WFC3_F275W', 'HST_WFC3_F336W', 'HST_WFC3_F...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Vega: """Class that handles vega spectrum and references. This class know where to find the Vega synthetic spectrum (Bohlin 2007) in order to compute fluxes and magnitudes in given filters An instance can be used as a context manager as:: filters = ['HST_WFC3_F275W', 'HST_WFC3_F336W', 'HST_WFC3_F475W', 'HST_W...
the_stack_v2_python_sparse
beast/observationmodel/vega.py
karllark/beast
train
0
b04fd945061f57090941fd0c5021759af2ae09ba
[ "self.dataset = dataset\nself.CRRA = CRRA\nself.u = UtilityFuncCRRA(CRRA)", "state_dict = self._validate_state(state)\nresult = self.u(self.dataset['v_inv'].interp(state_dict, assume_sorted=True, kwargs={'fill_value': 'extrapolate'}))\nresult.name = 'v'\nresult.attrs = self.dataset['v'].attrs\nreturn result", "...
<|body_start_0|> self.dataset = dataset self.CRRA = CRRA self.u = UtilityFuncCRRA(CRRA) <|end_body_0|> <|body_start_1|> state_dict = self._validate_state(state) result = self.u(self.dataset['v_inv'].interp(state_dict, assume_sorted=True, kwargs={'fill_value': 'extrapolate'})) ...
Class to allow for value function interpolation using xarray.
ValueFuncCRRALabeled
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueFuncCRRALabeled: """Class to allow for value function interpolation using xarray.""" def __init__(self, dataset: xr.Dataset, CRRA: float): """Initialize a value function. Parameters ---------- dataset : xr.Dataset Underlying dataset that should include a variable named "v_inv" t...
stack_v2_sparse_classes_36k_train_032572
40,507
permissive
[ { "docstring": "Initialize a value function. Parameters ---------- dataset : xr.Dataset Underlying dataset that should include a variable named \"v_inv\" that is the inverse of the value function. CRRA : float Coefficient of relative risk aversion.", "name": "__init__", "signature": "def __init__(self, ...
5
stack_v2_sparse_classes_30k_train_000413
Implement the Python class `ValueFuncCRRALabeled` described below. Class description: Class to allow for value function interpolation using xarray. Method signatures and docstrings: - def __init__(self, dataset: xr.Dataset, CRRA: float): Initialize a value function. Parameters ---------- dataset : xr.Dataset Underlyi...
Implement the Python class `ValueFuncCRRALabeled` described below. Class description: Class to allow for value function interpolation using xarray. Method signatures and docstrings: - def __init__(self, dataset: xr.Dataset, CRRA: float): Initialize a value function. Parameters ---------- dataset : xr.Dataset Underlyi...
7ce7138b6d9617a28fd4448936be3d61acad21d8
<|skeleton|> class ValueFuncCRRALabeled: """Class to allow for value function interpolation using xarray.""" def __init__(self, dataset: xr.Dataset, CRRA: float): """Initialize a value function. Parameters ---------- dataset : xr.Dataset Underlying dataset that should include a variable named "v_inv" t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueFuncCRRALabeled: """Class to allow for value function interpolation using xarray.""" def __init__(self, dataset: xr.Dataset, CRRA: float): """Initialize a value function. Parameters ---------- dataset : xr.Dataset Underlying dataset that should include a variable named "v_inv" that is the in...
the_stack_v2_python_sparse
HARK/ConsumptionSaving/ConsLabeledModel.py
econ-ark/HARK
train
315
06a5055e0a72c6a0c7c5a7af85d1e3d45b2a140f
[ "p1 = a = headA\np2 = b = headB\na_length = 0\nb_length = 0\nwhile a:\n a_length += 1\n a = a.next\nwhile b:\n b_length += 1\n b = b.next\nif a_length > b_length:\n for i in range(a_length - b_length):\n p1 = p1.next\nelse:\n for i in range(b_length - a_length):\n p2 = p2.next\nwhile...
<|body_start_0|> p1 = a = headA p2 = b = headB a_length = 0 b_length = 0 while a: a_length += 1 a = a.next while b: b_length += 1 b = b.next if a_length > b_length: for i in range(a_length - b_length): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode1(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_032573
2,002
no_license
[ { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode1", "signature": "def getIntersectionNo...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode1(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode1(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
71a02a2c6bc12e86119502c9c4a4b2047b9f3966
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode1(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" p1 = a = headA p2 = b = headB a_length = 0 b_length = 0 while a: a_length += 1 a = a.next while b: b_length += ...
the_stack_v2_python_sparse
Linked List/160. Intersection of Two Linked Lists (easy).py
xilixjd/leetcode
train
1
2cfbb294ed78f0b3c5d89eb41057489cfda4d083
[ "result = []\nwhile s:\n minIdx = min(map(s.rindex, set(s)))\n minChar = min(s[:minIdx + 1])\n firstIdx = s.index(minChar)\n s = s[firstIdx:].replace(minChar, '')\n result.append(minChar)\nreturn ''.join(result)", "result = ''\nidxMap = {c: i for i, c in enumerate(s)}\nsize, i = (len(idxMap), 0)\nb...
<|body_start_0|> result = [] while s: minIdx = min(map(s.rindex, set(s))) minChar = min(s[:minIdx + 1]) firstIdx = s.index(minChar) s = s[firstIdx:].replace(minChar, '') result.append(minChar) return ''.join(result) <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicateLetters2(self, s): """:type s: str :rtype: str""" <|body_0|> def removeDuplicateLetters(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [] while s: minId...
stack_v2_sparse_classes_36k_train_032574
1,064
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "removeDuplicateLetters2", "signature": "def removeDuplicateLetters2(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "removeDuplicateLetters", "signature": "def removeDuplicateLetters(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicateLetters2(self, s): :type s: str :rtype: str - def removeDuplicateLetters(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 removeDuplicateLetters2(self, s): :type s: str :rtype: str - def removeDuplicateLetters(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def removeDuplic...
45e6ba66104bb43efcce39adc92a4904f50c605d
<|skeleton|> class Solution: def removeDuplicateLetters2(self, s): """:type s: str :rtype: str""" <|body_0|> def removeDuplicateLetters(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeDuplicateLetters2(self, s): """:type s: str :rtype: str""" result = [] while s: minIdx = min(map(s.rindex, set(s))) minChar = min(s[:minIdx + 1]) firstIdx = s.index(minChar) s = s[firstIdx:].replace(minChar, '') ...
the_stack_v2_python_sparse
LeetCode/pythonSols/removeDupChars.py
abhitrip/scratchpad
train
0
0f613ca2501ffec3bc91431b9960e4dc78227b02
[ "start_activity('com.android.contacts', '.activities.DialtactsActivity')\npre_settings()\ncall_repeat_times = int(SC.PRIVATE_PHONE_CALL_REPEAT_TIMES)\ndefine_case_success_times = int(SC.PRIVATE_PHONE_DEFINE_CASE_SUCCESS_TIMES)\ncall_time = int(SC.PRIVATE_PHONE_CALL_TIME)\nsuccess_times = 0\nglobal case_flag\ncase_f...
<|body_start_0|> start_activity('com.android.contacts', '.activities.DialtactsActivity') pre_settings() call_repeat_times = int(SC.PRIVATE_PHONE_CALL_REPEAT_TIMES) define_case_success_times = int(SC.PRIVATE_PHONE_DEFINE_CASE_SUCCESS_TIMES) call_time = int(SC.PRIVATE_PHONE_CALL_TI...
test_suit_phone_case2 is a class for phone case. @see: L{TestCaseBase <TestCaseBase>}
test_suit_phone_case2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_suit_phone_case2: """test_suit_phone_case2 is a class for phone case. @see: L{TestCaseBase <TestCaseBase>}""" def test_case_main(self, case_results): """main entry. @type case_results: tuple @param case_results: record some case result information""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_032575
3,206
no_license
[ { "docstring": "main entry. @type case_results: tuple @param case_results: record some case result information", "name": "test_case_main", "signature": "def test_case_main(self, case_results)" }, { "docstring": "record the case result", "name": "test_case_end", "signature": "def test_cas...
2
null
Implement the Python class `test_suit_phone_case2` described below. Class description: test_suit_phone_case2 is a class for phone case. @see: L{TestCaseBase <TestCaseBase>} Method signatures and docstrings: - def test_case_main(self, case_results): main entry. @type case_results: tuple @param case_results: record som...
Implement the Python class `test_suit_phone_case2` described below. Class description: test_suit_phone_case2 is a class for phone case. @see: L{TestCaseBase <TestCaseBase>} Method signatures and docstrings: - def test_case_main(self, case_results): main entry. @type case_results: tuple @param case_results: record som...
a04b717ae437511abae1e7e9e399373c161a7b65
<|skeleton|> class test_suit_phone_case2: """test_suit_phone_case2 is a class for phone case. @see: L{TestCaseBase <TestCaseBase>}""" def test_case_main(self, case_results): """main entry. @type case_results: tuple @param case_results: record some case result information""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_suit_phone_case2: """test_suit_phone_case2 is a class for phone case. @see: L{TestCaseBase <TestCaseBase>}""" def test_case_main(self, case_results): """main entry. @type case_results: tuple @param case_results: record some case result information""" start_activity('com.android.conta...
the_stack_v2_python_sparse
test_env/test_suit_phone/test_suit_phone_case2.py
wwlwwlqaz/Qualcomm
train
1
4f6643ebe76a4567bb923060fe34aa839716141e
[ "list_elements = self.convert_to_list(root)\nnew_list = []\nfor i in list_elements:\n for j in list_elements:\n if i > j:\n res = i - j\n new_list.append(res)\n elif j > i:\n res = j - i\n new_list.append(res)\nreturn min(new_list)", "res = []\nif root:...
<|body_start_0|> list_elements = self.convert_to_list(root) new_list = [] for i in list_elements: for j in list_elements: if i > j: res = i - j new_list.append(res) elif j > i: res = j - i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def min_diff_in_bst(self, root: TreeNode) -> int: """Searching min distance between each node :param root: :return:""" <|body_0|> def convert_to_list(self, root): """Convert tree to list For me it is more easy :param root: :return:""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_032576
1,189
no_license
[ { "docstring": "Searching min distance between each node :param root: :return:", "name": "min_diff_in_bst", "signature": "def min_diff_in_bst(self, root: TreeNode) -> int" }, { "docstring": "Convert tree to list For me it is more easy :param root: :return:", "name": "convert_to_list", "s...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def min_diff_in_bst(self, root: TreeNode) -> int: Searching min distance between each node :param root: :return: - def convert_to_list(self, root): Convert tree to list For me it...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def min_diff_in_bst(self, root: TreeNode) -> int: Searching min distance between each node :param root: :return: - def convert_to_list(self, root): Convert tree to list For me it...
49008edea3db5102cc9fb621ffff05e26aa82bed
<|skeleton|> class Solution: def min_diff_in_bst(self, root: TreeNode) -> int: """Searching min distance between each node :param root: :return:""" <|body_0|> def convert_to_list(self, root): """Convert tree to list For me it is more easy :param root: :return:""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def min_diff_in_bst(self, root: TreeNode) -> int: """Searching min distance between each node :param root: :return:""" list_elements = self.convert_to_list(root) new_list = [] for i in list_elements: for j in list_elements: if i > j: ...
the_stack_v2_python_sparse
leetcode/binary_tree/diiferent_task_with_binary_tree/minimum_distance_between_nodes.py
markosolopenko/python
train
0
17d89cf2a473ce8f620bb76c04a3a41e08108e25
[ "if isinstance(timestamp, datetime.datetime):\n return timestamp\nelif isinstance(timestamp, basestring):\n try:\n return parse(timestamp)\n except ValueError:\n raise ValueError('Timestamp is not in a known parseable format (%s).' % timestamp)\nelse:\n raise TypeError('Timestamp can only ...
<|body_start_0|> if isinstance(timestamp, datetime.datetime): return timestamp elif isinstance(timestamp, basestring): try: return parse(timestamp) except ValueError: raise ValueError('Timestamp is not in a known parseable format (%s).'...
A class with utility functions to convert duration strings to timedelta objects and vice versa.
Duration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Duration: """A class with utility functions to convert duration strings to timedelta objects and vice versa.""" def to_datetime(timestamp): """Attempt to parse the given timestamp as a datetime object. :param timestamp: The timestamp (as a string or datetime object). :type timestamp:...
stack_v2_sparse_classes_36k_train_032577
3,645
no_license
[ { "docstring": "Attempt to parse the given timestamp as a datetime object. :param timestamp: The timestamp (as a string or datetime object). :type timestamp: str | datetime.datetime :return: The parsed timestamp as a datetime object. :rtype: datetime.datetime :raise TypeError: Thrown if the timestamp is not a s...
3
null
Implement the Python class `Duration` described below. Class description: A class with utility functions to convert duration strings to timedelta objects and vice versa. Method signatures and docstrings: - def to_datetime(timestamp): Attempt to parse the given timestamp as a datetime object. :param timestamp: The tim...
Implement the Python class `Duration` described below. Class description: A class with utility functions to convert duration strings to timedelta objects and vice versa. Method signatures and docstrings: - def to_datetime(timestamp): Attempt to parse the given timestamp as a datetime object. :param timestamp: The tim...
7c30438f145c5e59522bb0f27a3914ce21a13c33
<|skeleton|> class Duration: """A class with utility functions to convert duration strings to timedelta objects and vice versa.""" def to_datetime(timestamp): """Attempt to parse the given timestamp as a datetime object. :param timestamp: The timestamp (as a string or datetime object). :type timestamp:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Duration: """A class with utility functions to convert duration strings to timedelta objects and vice versa.""" def to_datetime(timestamp): """Attempt to parse the given timestamp as a datetime object. :param timestamp: The timestamp (as a string or datetime object). :type timestamp: str | dateti...
the_stack_v2_python_sparse
fetchapp/lib/python2.7/site-packages/fetchcore/utils/duration.py
JasonVranek/jason_fetchcore
train
0
18153a319dfb2671d1d3f88ce692ea9aa34798ae
[ "resource_args.AddConnectionProfileResourceArg(parser, 'to update')\ncp_flags.AddDisplayNameFlag(parser)\ncp_flags.AddUsernameFlag(parser)\ncp_flags.AddPasswordFlagGroup(parser)\ncp_flags.AddHostFlag(parser)\ncp_flags.AddPortFlag(parser)\ncp_flags.AddCaCertificateFlag(parser)\ncp_flags.AddPrivateKeyFlag(parser)\nfl...
<|body_start_0|> resource_args.AddConnectionProfileResourceArg(parser, 'to update') cp_flags.AddDisplayNameFlag(parser) cp_flags.AddUsernameFlag(parser) cp_flags.AddPasswordFlagGroup(parser) cp_flags.AddHostFlag(parser) cp_flags.AddPortFlag(parser) cp_flags.AddCaC...
Update a Database Migration Service connection profile.
_Update
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Update: """Update a Database Migration Service connection profile.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional a...
stack_v2_sparse_classes_36k_train_032578
4,794
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
null
Implement the Python class `_Update` described below. Class description: Update a Database Migration Service connection profile. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments tha...
Implement the Python class `_Update` described below. Class description: Update a Database Migration Service connection profile. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments tha...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class _Update: """Update a Database Migration Service connection profile.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Update: """Update a Database Migration Service connection profile.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are ...
the_stack_v2_python_sparse
lib/surface/database_migration/connection_profiles/update.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
b38940cdb61ccb0dbf3376e8a69ac06e3f0c011e
[ "self.sensor = sensor\nself.pump = pump\nself.decider = decider\nself.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}", "current_height = self.sensor.measure()\ncurrent_action = self.pump.get_state()\nnew_state = self.decider.decide(current_height, current_action, self.ac...
<|body_start_0|> self.sensor = sensor self.pump = pump self.decider = decider self.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF} <|end_body_0|> <|body_start_1|> current_height = self.sensor.measure() current_action = self.pump....
Encapsulates command and coordination for the water-regulation module
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_36k_train_032579
1,208
no_license
[ { "docstring": "Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance of decider.Decider", "name": "__init__", "signature": "def __init__(self, sensor, pump, decider)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_006297
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
263685ca90110609bfd05d621516727f8cd0028f
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance...
the_stack_v2_python_sparse
students/eric_rosko/lesson-06/waterregulation/controller.py
aurel1212/Sp2018-Online
train
0
b2a54b0c910ee800d826c76902a1e05816a5ead7
[ "freq = {}\nresult = []\nfor num in nums:\n if num not in freq:\n freq[num] = 0\n freq[num] += 1\nfor key in freq:\n if freq[key] > 1:\n result.append(key)\nreturn result", "result = []\nfor i in range(len(nums)):\n index = abs(nums[i]) - 1\n if nums[index] < 1:\n result.append...
<|body_start_0|> freq = {} result = [] for num in nums: if num not in freq: freq[num] = 0 freq[num] += 1 for key in freq: if freq[key] > 1: result.append(key) return result <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicates(self, nums): """HIGH LEVEL: This is what I can come up with right off the bat. * Have a hashmap that stores the values and their corresponding frequencies. * traverse through the list, and if the key has a frequency count > 1 * add that key to the result list...
stack_v2_sparse_classes_36k_train_032580
1,581
no_license
[ { "docstring": "HIGH LEVEL: This is what I can come up with right off the bat. * Have a hashmap that stores the values and their corresponding frequencies. * traverse through the list, and if the key has a frequency count > 1 * add that key to the result list. * return the list. Complexities: Time: O(n), n = le...
2
stack_v2_sparse_classes_30k_train_005950
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): HIGH LEVEL: This is what I can come up with right off the bat. * Have a hashmap that stores the values and their corresponding frequencies. * trav...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): HIGH LEVEL: This is what I can come up with right off the bat. * Have a hashmap that stores the values and their corresponding frequencies. * trav...
d7fd565163535873b1799016614753059be7b6a9
<|skeleton|> class Solution: def findDuplicates(self, nums): """HIGH LEVEL: This is what I can come up with right off the bat. * Have a hashmap that stores the values and their corresponding frequencies. * traverse through the list, and if the key has a frequency count > 1 * add that key to the result list...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicates(self, nums): """HIGH LEVEL: This is what I can come up with right off the bat. * Have a hashmap that stores the values and their corresponding frequencies. * traverse through the list, and if the key has a frequency count > 1 * add that key to the result list. * return the...
the_stack_v2_python_sparse
Arrays/442_findDupsArray.py
kevinmolina-io/leetcode
train
0
e95bd8306ae4c972d5c70f25c406e8ab007701a1
[ "try:\n detail_html = source.pop('bbd_html', '')\n detail_url = source.get('bbd_url', '')\n self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))\n json_data = json.loads(detail_html)\n get_func = self.get_value(json_data)\n res_dict = {'punish_code': get_func('cfWsh'), 'case_name': ...
<|body_start_0|> try: detail_html = source.pop('bbd_html', '') detail_url = source.get('bbd_url', '') self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url)) json_data = json.loads(detail_html) get_func = self.get_value(json_data) ...
class Parser__qyxg_xzcf__credit_jinzhong for 信用晋中-行政处罚
Parser__qyxg_xzcf__credit_jinzhong
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser__qyxg_xzcf__credit_jinzhong: """class Parser__qyxg_xzcf__credit_jinzhong for 信用晋中-行政处罚""" def parse(self, source, *args, **kwargs): """:Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None""" <|body_0|> def get_value(self, json_dict): ""...
stack_v2_sparse_classes_36k_train_032581
3,338
no_license
[ { "docstring": ":Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None", "name": "parse", "signature": "def parse(self, source, *args, **kwargs)" }, { "docstring": ":Keyword Arguments: self -- json_dict -- :return: None", "name": "get_value", "signature": "def get_value...
2
stack_v2_sparse_classes_30k_train_015405
Implement the Python class `Parser__qyxg_xzcf__credit_jinzhong` described below. Class description: class Parser__qyxg_xzcf__credit_jinzhong for 信用晋中-行政处罚 Method signatures and docstrings: - def parse(self, source, *args, **kwargs): :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None - def get_va...
Implement the Python class `Parser__qyxg_xzcf__credit_jinzhong` described below. Class description: class Parser__qyxg_xzcf__credit_jinzhong for 信用晋中-行政处罚 Method signatures and docstrings: - def parse(self, source, *args, **kwargs): :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None - def get_va...
991902517a94e26fbe6378610d3cd12ff4a5c1f7
<|skeleton|> class Parser__qyxg_xzcf__credit_jinzhong: """class Parser__qyxg_xzcf__credit_jinzhong for 信用晋中-行政处罚""" def parse(self, source, *args, **kwargs): """:Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None""" <|body_0|> def get_value(self, json_dict): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parser__qyxg_xzcf__credit_jinzhong: """class Parser__qyxg_xzcf__credit_jinzhong for 信用晋中-行政处罚""" def parse(self, source, *args, **kwargs): """:Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None""" try: detail_html = source.pop('bbd_html', '') d...
the_stack_v2_python_sparse
parse/qyxg_xzcf/Parser__qyxg_xzcf__credit_jinzhong.py
ZhouForrest/Spider
train
0
a71ad51d88bfae413fde03cd4c074b7a530efffe
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzhang71')\nrepo.dropCollection('bostonPopulation')\nrepo.createCollection('bostonPopulation')\nurl = 'http://datamechanics.io/data/yjunchoi_yzhang71/BostonPopulation.csv'\n...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzhang71') repo.dropCollection('bostonPopulation') repo.createCollection('bostonPopulation') url = 'http://d...
bostonPopulation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bostonPopulation: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_36k_train_032582
3,670
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_017799
Implement the Python class `bostonPopulation` described below. Class description: Implement the bostonPopulation class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
Implement the Python class `bostonPopulation` described below. Class description: Implement the bostonPopulation class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class bostonPopulation: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class bostonPopulation: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzha...
the_stack_v2_python_sparse
yjunchoi_yzhang71/bostonPopulation.py
ROODAY/course-2017-fal-proj
train
3
2bae4dceb5c36e62c7708b93349b2df6f081d0bf
[ "self.img_bytes = img_bytes\nself.img_ext = img_ext\nself.file_name = None\nself.img_size = None\nself.repository = AWSS3(self.env.THUMBNAIL_BUCKET_NAME)\nsuper(SaveImage, self).__init__(prefix='SI', phase_name='Save image', invocation_id=invocation_id)", "self.file_name = f'{self.invocation_id}-{self.env.SMALL_T...
<|body_start_0|> self.img_bytes = img_bytes self.img_ext = img_ext self.file_name = None self.img_size = None self.repository = AWSS3(self.env.THUMBNAIL_BUCKET_NAME) super(SaveImage, self).__init__(prefix='SI', phase_name='Save image', invocation_id=invocation_id) <|end_b...
Image saving object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response.
SaveImage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveImage: """Image saving object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response.""" def __init__(self, img_bytes: bytes, img_ext: str, invocation_id: str): """Constructor of the save image object, stores provided an...
stack_v2_sparse_classes_36k_train_032583
2,728
no_license
[ { "docstring": "Constructor of the save image object, stores provided and locally generated data, runs main object procedure. :param img_bytes: pre-processed image in bytes form. :param img_ext: string containing image extension (type). :param invocation_id: string containing id of current cloud function invoca...
3
stack_v2_sparse_classes_30k_train_002339
Implement the Python class `SaveImage` described below. Class description: Image saving object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response. Method signatures and docstrings: - def __init__(self, img_bytes: bytes, img_ext: str, invocation_id: str):...
Implement the Python class `SaveImage` described below. Class description: Image saving object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response. Method signatures and docstrings: - def __init__(self, img_bytes: bytes, img_ext: str, invocation_id: str):...
8f1b94518303c4e0a38df1ff6caa0e7326451d67
<|skeleton|> class SaveImage: """Image saving object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response.""" def __init__(self, img_bytes: bytes, img_ext: str, invocation_id: str): """Constructor of the save image object, stores provided an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaveImage: """Image saving object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response.""" def __init__(self, img_bytes: bytes, img_ext: str, invocation_id: str): """Constructor of the save image object, stores provided and locally gen...
the_stack_v2_python_sparse
Serverless/handlers/s3_generate_thumbnail/save_image.py
RogerVFbr/MyCelebs
train
0
ca187aac04881c26c4b894294c32172188f2d56c
[ "form = GetUserSkillsForm(request.args)\nif form.validate():\n try:\n user_skills = UserSkills.query.filter(UserSkills.user_id == form.user_id.data).all()\n except:\n return make_response(jsonify({'error': 'Database Connection Error'}), 500)\n if user_skills is []:\n return make_respon...
<|body_start_0|> form = GetUserSkillsForm(request.args) if form.validate(): try: user_skills = UserSkills.query.filter(UserSkills.user_id == form.user_id.data).all() except: return make_response(jsonify({'error': 'Database Connection Error'}), 500)...
This class is a RESTful API for "UserSkill" model. You can find the endpoints for creating, reading, updating and deleting a user below.
UserSkillAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSkillAPI: """This class is a RESTful API for "UserSkill" model. You can find the endpoints for creating, reading, updating and deleting a user below.""" def get(user_id, self): """Returns a list of user's skills with id and name""" <|body_0|> def post(user_id, self):...
stack_v2_sparse_classes_36k_train_032584
36,381
no_license
[ { "docstring": "Returns a list of user's skills with id and name", "name": "get", "signature": "def get(user_id, self)" }, { "docstring": "Adds a new skill to user's skills with name", "name": "post", "signature": "def post(user_id, self)" }, { "docstring": "Deletes the skill fro...
3
stack_v2_sparse_classes_30k_train_012858
Implement the Python class `UserSkillAPI` described below. Class description: This class is a RESTful API for "UserSkill" model. You can find the endpoints for creating, reading, updating and deleting a user below. Method signatures and docstrings: - def get(user_id, self): Returns a list of user's skills with id and...
Implement the Python class `UserSkillAPI` described below. Class description: This class is a RESTful API for "UserSkill" model. You can find the endpoints for creating, reading, updating and deleting a user below. Method signatures and docstrings: - def get(user_id, self): Returns a list of user's skills with id and...
f7aebee17a0a79e8d3c2927733bce8015b4a9da3
<|skeleton|> class UserSkillAPI: """This class is a RESTful API for "UserSkill" model. You can find the endpoints for creating, reading, updating and deleting a user below.""" def get(user_id, self): """Returns a list of user's skills with id and name""" <|body_0|> def post(user_id, self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserSkillAPI: """This class is a RESTful API for "UserSkill" model. You can find the endpoints for creating, reading, updating and deleting a user below.""" def get(user_id, self): """Returns a list of user's skills with id and name""" form = GetUserSkillsForm(request.args) if for...
the_stack_v2_python_sparse
platon/backend/app/auth_system/views.py
bounswe/bounswe2020group7
train
18
60085e43d82d2697ee648d83c863734b8ac5d72e
[ "super(AshaHpo, self).__init__(search_space, **kwargs)\nnum_samples = self.config.policy.num_samples\nepochs_per_iter = self.config.policy.epochs_per_iter\nif self.config.policy.total_epochs != -1:\n num_samples, epochs_per_iter = self.design_parameter(self.config.policy.total_epochs)\nself.hpo = ASHA(self.hps, ...
<|body_start_0|> super(AshaHpo, self).__init__(search_space, **kwargs) num_samples = self.config.policy.num_samples epochs_per_iter = self.config.policy.epochs_per_iter if self.config.policy.total_epochs != -1: num_samples, epochs_per_iter = self.design_parameter(self.config....
An Hpo of ASHA, inherit from HpoGenerator.
AshaHpo
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AshaHpo: """An Hpo of ASHA, inherit from HpoGenerator.""" def __init__(self, search_space=None, **kwargs): """Init AshaHpo.""" <|body_0|> def design_parameter(self, total_epochs): """Design parameters based on total_epochs. :param total_epochs: number of epochs t...
stack_v2_sparse_classes_36k_train_032585
2,358
permissive
[ { "docstring": "Init AshaHpo.", "name": "__init__", "signature": "def __init__(self, search_space=None, **kwargs)" }, { "docstring": "Design parameters based on total_epochs. :param total_epochs: number of epochs the algorithms need. :type total_epochs: int, set by user.", "name": "design_pa...
2
null
Implement the Python class `AshaHpo` described below. Class description: An Hpo of ASHA, inherit from HpoGenerator. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Init AshaHpo. - def design_parameter(self, total_epochs): Design parameters based on total_epochs. :param total_epoch...
Implement the Python class `AshaHpo` described below. Class description: An Hpo of ASHA, inherit from HpoGenerator. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Init AshaHpo. - def design_parameter(self, total_epochs): Design parameters based on total_epochs. :param total_epoch...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class AshaHpo: """An Hpo of ASHA, inherit from HpoGenerator.""" def __init__(self, search_space=None, **kwargs): """Init AshaHpo.""" <|body_0|> def design_parameter(self, total_epochs): """Design parameters based on total_epochs. :param total_epochs: number of epochs t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AshaHpo: """An Hpo of ASHA, inherit from HpoGenerator.""" def __init__(self, search_space=None, **kwargs): """Init AshaHpo.""" super(AshaHpo, self).__init__(search_space, **kwargs) num_samples = self.config.policy.num_samples epochs_per_iter = self.config.policy.epochs_per...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/algorithms/hpo/asha_hpo.py
Huawei-Ascend/modelzoo
train
1
97911c81aa71abbc1acecb6d1811a4a304769b9e
[ "length = len(points)\nif length < 3:\n return length\nans = 2\nfor i in range(length):\n for j in range(i + 1, length):\n x1 = points[i][0]\n y1 = points[i][1]\n x2 = points[j][0]\n y2 = points[j][1]\n temp = 2\n for k in range(j, length):\n if (y2 - y1) *...
<|body_start_0|> length = len(points) if length < 3: return length ans = 2 for i in range(length): for j in range(i + 1, length): x1 = points[i][0] y1 = points[i][1] x2 = points[j][0] y2 = points[j][1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxPoints(self, points: List[List[int]]) -> int: """O(n^3)""" <|body_0|> def _maxPoints(self, points: List[List[int]]) -> int: """对每一个点,统计经过该点的斜率数量,O(N^2)""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(points) if ...
stack_v2_sparse_classes_36k_train_032586
1,537
no_license
[ { "docstring": "O(n^3)", "name": "maxPoints", "signature": "def maxPoints(self, points: List[List[int]]) -> int" }, { "docstring": "对每一个点,统计经过该点的斜率数量,O(N^2)", "name": "_maxPoints", "signature": "def _maxPoints(self, points: List[List[int]]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_008732
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPoints(self, points: List[List[int]]) -> int: O(n^3) - def _maxPoints(self, points: List[List[int]]) -> int: 对每一个点,统计经过该点的斜率数量,O(N^2)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPoints(self, points: List[List[int]]) -> int: O(n^3) - def _maxPoints(self, points: List[List[int]]) -> int: 对每一个点,统计经过该点的斜率数量,O(N^2) <|skeleton|> class Solution: de...
02cccda59a792b27c6d002a8cda797552ec998ae
<|skeleton|> class Solution: def maxPoints(self, points: List[List[int]]) -> int: """O(n^3)""" <|body_0|> def _maxPoints(self, points: List[List[int]]) -> int: """对每一个点,统计经过该点的斜率数量,O(N^2)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxPoints(self, points: List[List[int]]) -> int: """O(n^3)""" length = len(points) if length < 3: return length ans = 2 for i in range(length): for j in range(i + 1, length): x1 = points[i][0] y1 = po...
the_stack_v2_python_sparse
数学/149.py
nnzzll/leetcode
train
0
bafeef6c51ff08041b231a4a5ae4b384ef78a051
[ "self.config = config\nself.name = self.config.get_section_dict('Logger')['Name']\nself.loggers = []\nif self.name == 'csv_logger':\n from .csv_logger import CSVLogger\n self.loggers.append(CSVLogger(self.config, camera_id))\nelse:\n raise ValueError('Not supported logger named: ', self.name)\nif self.conf...
<|body_start_0|> self.config = config self.name = self.config.get_section_dict('Logger')['Name'] self.loggers = [] if self.name == 'csv_logger': from .csv_logger import CSVLogger self.loggers.append(CSVLogger(self.config, camera_id)) else: rais...
logger layer to build a logger and pass data to it for logging this class build a layer based on config specification and call update method of it based on logging frequency :param config: a ConfigEngine object which store all of the config parameters. Access to any parameter is possible by calling get_section_dict met...
Logger
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: """logger layer to build a logger and pass data to it for logging this class build a layer based on config specification and call update method of it based on logging frequency :param config: a ConfigEngine object which store all of the config parameters. Access to any parameter is possib...
stack_v2_sparse_classes_36k_train_032587
4,489
permissive
[ { "docstring": "build the logger and initialize the frame number and set attributes", "name": "__init__", "signature": "def __init__(self, config, camera_id)" }, { "docstring": "call the update method of the logger. based on frame_number, fps and time interval, it decides whether to call the log...
3
stack_v2_sparse_classes_30k_train_001836
Implement the Python class `Logger` described below. Class description: logger layer to build a logger and pass data to it for logging this class build a layer based on config specification and call update method of it based on logging frequency :param config: a ConfigEngine object which store all of the config parame...
Implement the Python class `Logger` described below. Class description: logger layer to build a logger and pass data to it for logging this class build a layer based on config specification and call update method of it based on logging frequency :param config: a ConfigEngine object which store all of the config parame...
f706a64e85c9f04b445d7e6d10a1e7c9369ab465
<|skeleton|> class Logger: """logger layer to build a logger and pass data to it for logging this class build a layer based on config specification and call update method of it based on logging frequency :param config: a ConfigEngine object which store all of the config parameters. Access to any parameter is possib...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logger: """logger layer to build a logger and pass data to it for logging this class build a layer based on config specification and call update method of it based on logging frequency :param config: a ConfigEngine object which store all of the config parameters. Access to any parameter is possible by calling...
the_stack_v2_python_sparse
libs/loggers/loggers.py
undefined-references/smart-social-distancing
train
0
5dac373331926eb7c96493ca13e52938fb7906f1
[ "self.trie = Trie()\nfor i, sentence in enumerate(sentences):\n self.trie.insert(sentence, times[i])\nself.cur_sentence = ''", "if c != '#':\n self.cur_sentence += c\n candidates = self.trie.find_words(self.cur_sentence)\n candidates_times = []\n for candidate in candidates:\n cur_node = sel...
<|body_start_0|> self.trie = Trie() for i, sentence in enumerate(sentences): self.trie.insert(sentence, times[i]) self.cur_sentence = '' <|end_body_0|> <|body_start_1|> if c != '#': self.cur_sentence += c candidates = self.trie.find_words(self.cur_sen...
AutocompleteSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.trie = Trie() ...
stack_v2_sparse_classes_36k_train_032588
7,846
no_license
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
stack_v2_sparse_classes_30k_train_004787
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
e7e529f2c04dc0cca8d823b7774871974422f7a6
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.trie = Trie() for i, sentence in enumerate(sentences): self.trie.insert(sentence, times[i]) self.cur_sentence = '' def input(self, c): ...
the_stack_v2_python_sparse
Trie/642. Design Search Autocomplete System.py
Jason101616/LeetCode_Solution
train
2
d65e4a446117a7cebd6a9f4518582774d8e2afd2
[ "self.doublyll = DoublyLinkedList()\nself.table = {}\nself.capacity = capacity", "if key in self.table:\n get_node = self.table[key]\n self.doublyll.remove(get_node)\n self.doublyll.insert_head(get_node)\n return get_node.value\nreturn -1", "if key not in self.table:\n if self.doublyll.size == se...
<|body_start_0|> self.doublyll = DoublyLinkedList() self.table = {} self.capacity = capacity <|end_body_0|> <|body_start_1|> if key in self.table: get_node = self.table[key] self.doublyll.remove(get_node) self.doublyll.insert_head(get_node) ...
LRUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_032589
2,329
permissive
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.doublyll = DoublyLinkedList() self.table = {} self.capacity = capacity def get(self, key): """:type key: int :rtype: int""" if key in self.table: get_node = self.table[key] ...
the_stack_v2_python_sparse
101-200/141-150/146-LRUCache/LRUCache.py
xuychen/Leetcode
train
0
e3697adc7c749cda1052b924d8b8c4b941b31075
[ "self.email_id = email_id\nself.to_tp_qr_url = to_tp_qr_url\nself.to_tp_secret_key = to_tp_secret_key\nself.two_fa_mode = two_fa_mode", "if dictionary is None:\n return None\nemail_id = dictionary.get('EmailID')\nto_tp_qr_url = dictionary.get('TOTPQRUrl')\nto_tp_secret_key = dictionary.get('TOTPSecretKey')\ntw...
<|body_start_0|> self.email_id = email_id self.to_tp_qr_url = to_tp_qr_url self.to_tp_secret_key = to_tp_secret_key self.two_fa_mode = two_fa_mode <|end_body_0|> <|body_start_1|> if dictionary is None: return None email_id = dictionary.get('EmailID') ...
Implementation of the 'PutLinuxSupportUser2FAResult' model. IRIS will then send that information to the nexus to program in the backend. Attributes: email_id (string): TODO: Type Description here. to_tp_qr_url (string): TODO: Type Description here. to_tp_secret_key (string): TODO: Type Description here. two_fa_mode (lo...
PutLinuxSupportUser2FAResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PutLinuxSupportUser2FAResult: """Implementation of the 'PutLinuxSupportUser2FAResult' model. IRIS will then send that information to the nexus to program in the backend. Attributes: email_id (string): TODO: Type Description here. to_tp_qr_url (string): TODO: Type Description here. to_tp_secret_ke...
stack_v2_sparse_classes_36k_train_032590
2,480
permissive
[ { "docstring": "Constructor for the PutLinuxSupportUser2FAResult class", "name": "__init__", "signature": "def __init__(self, email_id=None, to_tp_qr_url=None, to_tp_secret_key=None, two_fa_mode=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dicti...
2
null
Implement the Python class `PutLinuxSupportUser2FAResult` described below. Class description: Implementation of the 'PutLinuxSupportUser2FAResult' model. IRIS will then send that information to the nexus to program in the backend. Attributes: email_id (string): TODO: Type Description here. to_tp_qr_url (string): TODO:...
Implement the Python class `PutLinuxSupportUser2FAResult` described below. Class description: Implementation of the 'PutLinuxSupportUser2FAResult' model. IRIS will then send that information to the nexus to program in the backend. Attributes: email_id (string): TODO: Type Description here. to_tp_qr_url (string): TODO:...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PutLinuxSupportUser2FAResult: """Implementation of the 'PutLinuxSupportUser2FAResult' model. IRIS will then send that information to the nexus to program in the backend. Attributes: email_id (string): TODO: Type Description here. to_tp_qr_url (string): TODO: Type Description here. to_tp_secret_ke...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PutLinuxSupportUser2FAResult: """Implementation of the 'PutLinuxSupportUser2FAResult' model. IRIS will then send that information to the nexus to program in the backend. Attributes: email_id (string): TODO: Type Description here. to_tp_qr_url (string): TODO: Type Description here. to_tp_secret_key (string): T...
the_stack_v2_python_sparse
cohesity_management_sdk/models/put_linux_support_user_2fa_params_with_to_tp.py
cohesity/management-sdk-python
train
24
ba8ed6bab97d79e5110c1a1bd21897e61461a7c3
[ "distro = remote.get_os_distrib()\nif distro in cls._NFS_CHECKS:\n command = cls._NFS_CHECKS[distro]\n remote.execute_command(command, run_as_root=True)\nelse:\n LOG.warning('Cannot verify installation of NFS mount tools for unknown distro {distro}.'.format(distro=distro))", "local_path = self._get_path(...
<|body_start_0|> distro = remote.get_os_distrib() if distro in cls._NFS_CHECKS: command = cls._NFS_CHECKS[distro] remote.execute_command(command, run_as_root=True) else: LOG.warning('Cannot verify installation of NFS mount tools for unknown distro {distro}.'.f...
Handles mounting of a single NFS share to any number of instances.
_NFSMounter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _NFSMounter: """Handles mounting of a single NFS share to any number of instances.""" def setup_instance(cls, remote): """Prepares an instance to mount this type of share.""" <|body_0|> def mount_to_instance(self, remote, share_info): """Mounts the share to the i...
stack_v2_sparse_classes_36k_train_032591
11,562
permissive
[ { "docstring": "Prepares an instance to mount this type of share.", "name": "setup_instance", "signature": "def setup_instance(cls, remote)" }, { "docstring": "Mounts the share to the instance as configured.", "name": "mount_to_instance", "signature": "def mount_to_instance(self, remote,...
3
null
Implement the Python class `_NFSMounter` described below. Class description: Handles mounting of a single NFS share to any number of instances. Method signatures and docstrings: - def setup_instance(cls, remote): Prepares an instance to mount this type of share. - def mount_to_instance(self, remote, share_info): Moun...
Implement the Python class `_NFSMounter` described below. Class description: Handles mounting of a single NFS share to any number of instances. Method signatures and docstrings: - def setup_instance(cls, remote): Prepares an instance to mount this type of share. - def mount_to_instance(self, remote, share_info): Moun...
a806a536b623b4ce1a345d5718505a5f04c987f4
<|skeleton|> class _NFSMounter: """Handles mounting of a single NFS share to any number of instances.""" def setup_instance(cls, remote): """Prepares an instance to mount this type of share.""" <|body_0|> def mount_to_instance(self, remote, share_info): """Mounts the share to the i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _NFSMounter: """Handles mounting of a single NFS share to any number of instances.""" def setup_instance(cls, remote): """Prepares an instance to mount this type of share.""" distro = remote.get_os_distrib() if distro in cls._NFS_CHECKS: command = cls._NFS_CHECKS[distr...
the_stack_v2_python_sparse
sahara/service/edp/shares.py
openstack/sahara
train
165
9087909750cc8636253d4ff98b575fa19a189210
[ "rides.sort(key=lambda e: (e[1], e[0], e[2]))\ndp = [0]\nendtimes = [e for _, e, _ in rides]\nfor s, e, t in rides:\n i = bisect.bisect_right(endtimes, s)\n dp.append(max(dp[-1], dp[i] + e - s + t))\nreturn dp[-1]", "rides.sort(key=lambda e: (e[1], e[0], e[2]))\ndp = [0 for _ in range(n + 1)]\nfor i in rang...
<|body_start_0|> rides.sort(key=lambda e: (e[1], e[0], e[2])) dp = [0] endtimes = [e for _, e, _ in rides] for s, e, t in rides: i = bisect.bisect_right(endtimes, s) dp.append(max(dp[-1], dp[i] + e - s + t)) return dp[-1] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: """DP + binary search.""" <|body_0|> def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: """DP + sort""" <|body_1|> def maxTaxiEarnings1(self, n: int, rides: List[L...
stack_v2_sparse_classes_36k_train_032592
1,412
no_license
[ { "docstring": "DP + binary search.", "name": "maxTaxiEarnings", "signature": "def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int" }, { "docstring": "DP + sort", "name": "maxTaxiEarnings", "signature": "def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int" }, ...
3
stack_v2_sparse_classes_30k_train_002628
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: DP + binary search. - def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: DP + sort - def maxTaxiE...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: DP + binary search. - def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: DP + sort - def maxTaxiE...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: """DP + binary search.""" <|body_0|> def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: """DP + sort""" <|body_1|> def maxTaxiEarnings1(self, n: int, rides: List[L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int: """DP + binary search.""" rides.sort(key=lambda e: (e[1], e[0], e[2])) dp = [0] endtimes = [e for _, e, _ in rides] for s, e, t in rides: i = bisect.bisect_right(endtimes, s) ...
the_stack_v2_python_sparse
Leetcode/2008.py
hanwgyu/algorithm_problem_solving
train
5
6813dff24d90df241b201ea5a123dfe2ae555c0e
[ "fex.FeatureExtractor.__init__(self)\nself._schema = schema\nself._output_mode = output_mode", "log.info('The final table has %d rows.' % len(df))\nself._validate_df(df)\nif self._output_mode == 'df':\n return df\nelse:\n self.emit(df)", "for colname in df:\n column = df[colname]\n if re.match('[A-Z...
<|body_start_0|> fex.FeatureExtractor.__init__(self) self._schema = schema self._output_mode = output_mode <|end_body_0|> <|body_start_1|> log.info('The final table has %d rows.' % len(df)) self._validate_df(df) if self._output_mode == 'df': return df ...
Our subclass of fex.FeatureExtractor. Offers some additional functionality: - _validate_df() does some sanity checks for testing FeatureExtractor output. - "df" output mode to output the DataFrame rather than saving to CSV.
FeatureExtractor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureExtractor: """Our subclass of fex.FeatureExtractor. Offers some additional functionality: - _validate_df() does some sanity checks for testing FeatureExtractor output. - "df" output mode to output the DataFrame rather than saving to CSV.""" def __init__(self, output_mode='csv', schema...
stack_v2_sparse_classes_36k_train_032593
2,170
permissive
[ { "docstring": "Sutter-specific initialization, delegating to superclass constructor. Output mode can be \"csv\" or \"df\".", "name": "__init__", "signature": "def __init__(self, output_mode='csv', schema='features')" }, { "docstring": "Run verification, then emit a DataFrame of extracted featur...
3
null
Implement the Python class `FeatureExtractor` described below. Class description: Our subclass of fex.FeatureExtractor. Offers some additional functionality: - _validate_df() does some sanity checks for testing FeatureExtractor output. - "df" output mode to output the DataFrame rather than saving to CSV. Method signa...
Implement the Python class `FeatureExtractor` described below. Class description: Our subclass of fex.FeatureExtractor. Offers some additional functionality: - _validate_df() does some sanity checks for testing FeatureExtractor output. - "df" output mode to output the DataFrame rather than saving to CSV. Method signa...
1036f32598903c09c1c16b9c6ada4ab5566cb3bf
<|skeleton|> class FeatureExtractor: """Our subclass of fex.FeatureExtractor. Offers some additional functionality: - _validate_df() does some sanity checks for testing FeatureExtractor output. - "df" output mode to output the DataFrame rather than saving to CSV.""" def __init__(self, output_mode='csv', schema...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureExtractor: """Our subclass of fex.FeatureExtractor. Offers some additional functionality: - _validate_df() does some sanity checks for testing FeatureExtractor output. - "df" output mode to output the DataFrame rather than saving to CSV.""" def __init__(self, output_mode='csv', schema='features'):...
the_stack_v2_python_sparse
features/extraction/lib/feature_extractor.py
Najah-lshanableh/readmission-risk
train
2
9d2be85fcbc878abfcef49e9a6ef17ad071ae8a4
[ "from dials.array_family import flex\ng = handle['entry/data_processing']\nrl = flex.reflection_table(int(g.attrs['num_reflections']))\nfor key in g:\n item = g[key]\n name = item.attrs['flex_type']\n if name == 'shoebox':\n flex_type = getattr(flex, name)\n data = item['data']\n mask ...
<|body_start_0|> from dials.array_family import flex g = handle['entry/data_processing'] rl = flex.reflection_table(int(g.attrs['num_reflections'])) for key in g: item = g[key] name = item.attrs['flex_type'] if name == 'shoebox': flex_t...
Decoder for the reflection data.
ReflectionListDecoder
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReflectionListDecoder: """Decoder for the reflection data.""" def decode(self, handle): """Decode the reflection data.""" <|body_0|> def decode_column(self, flex_type, data): """Decode a column for various flex types.""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_032594
5,824
permissive
[ { "docstring": "Decode the reflection data.", "name": "decode", "signature": "def decode(self, handle)" }, { "docstring": "Decode a column for various flex types.", "name": "decode_column", "signature": "def decode_column(self, flex_type, data)" } ]
2
stack_v2_sparse_classes_30k_train_001039
Implement the Python class `ReflectionListDecoder` described below. Class description: Decoder for the reflection data. Method signatures and docstrings: - def decode(self, handle): Decode the reflection data. - def decode_column(self, flex_type, data): Decode a column for various flex types.
Implement the Python class `ReflectionListDecoder` described below. Class description: Decoder for the reflection data. Method signatures and docstrings: - def decode(self, handle): Decode the reflection data. - def decode_column(self, flex_type, data): Decode a column for various flex types. <|skeleton|> class Refl...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class ReflectionListDecoder: """Decoder for the reflection data.""" def decode(self, handle): """Decode the reflection data.""" <|body_0|> def decode_column(self, flex_type, data): """Decode a column for various flex types.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReflectionListDecoder: """Decoder for the reflection data.""" def decode(self, handle): """Decode the reflection data.""" from dials.array_family import flex g = handle['entry/data_processing'] rl = flex.reflection_table(int(g.attrs['num_reflections'])) for key in ...
the_stack_v2_python_sparse
src/dials/util/nexus_old.py
dials/dials
train
71
11b033f2ebdcae13a257011d04eed5461f13c4be
[ "if settings.DEBUG and request.user.is_staff:\n self.profiler = cProfile.Profile()\n args = (request,) + callback_args\n return self.profiler.runcall(callback, *args, **callback_kwargs)", "response = self.get_response(request)\nif settings.DEBUG and request.user.is_staff and (self.profiler is not None):\...
<|body_start_0|> if settings.DEBUG and request.user.is_staff: self.profiler = cProfile.Profile() args = (request,) + callback_args return self.profiler.runcall(callback, *args, **callback_kwargs) <|end_body_0|> <|body_start_1|> response = self.get_response(request) ...
Middleware de profilage
ProfilerMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfilerMiddleware: """Middleware de profilage""" def process_view(self, request, callback, callback_args, callback_kwargs): """Traiter la vue""" <|body_0|> def __call__(self, request): """Traiter la réponse""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_032595
6,111
no_license
[ { "docstring": "Traiter la vue", "name": "process_view", "signature": "def process_view(self, request, callback, callback_args, callback_kwargs)" }, { "docstring": "Traiter la réponse", "name": "__call__", "signature": "def __call__(self, request)" } ]
2
null
Implement the Python class `ProfilerMiddleware` described below. Class description: Middleware de profilage Method signatures and docstrings: - def process_view(self, request, callback, callback_args, callback_kwargs): Traiter la vue - def __call__(self, request): Traiter la réponse
Implement the Python class `ProfilerMiddleware` described below. Class description: Middleware de profilage Method signatures and docstrings: - def process_view(self, request, callback, callback_args, callback_kwargs): Traiter la vue - def __call__(self, request): Traiter la réponse <|skeleton|> class ProfilerMiddle...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class ProfilerMiddleware: """Middleware de profilage""" def process_view(self, request, callback, callback_args, callback_kwargs): """Traiter la vue""" <|body_0|> def __call__(self, request): """Traiter la réponse""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfilerMiddleware: """Middleware de profilage""" def process_view(self, request, callback, callback_args, callback_kwargs): """Traiter la vue""" if settings.DEBUG and request.user.is_staff: self.profiler = cProfile.Profile() args = (request,) + callback_args ...
the_stack_v2_python_sparse
scoop/core/middleware/profiling.py
artscoop/scoop
train
0
5ee3d66b1c3a1e5b4b3212ab374b0639c7a79cdf
[ "vulnerability = PsirtResult()\nvulnerability.id = data.get('id')\nvulnerability.title = data.get('title')\nvulnerability.bugs = data.get('bugs')\nvulnerability.cves = data.get('cves')\nvulnerability.cvrf = data.get('cvrf')\nvulnerability.oval = data.get('oval')\nvulnerability.cvss = data.get('cvss')\nvulnerability...
<|body_start_0|> vulnerability = PsirtResult() vulnerability.id = data.get('id') vulnerability.title = data.get('title') vulnerability.bugs = data.get('bugs') vulnerability.cves = data.get('cves') vulnerability.cvrf = data.get('cvrf') vulnerability.oval = data.get...
Ciscoapi PSIRT output parser. Supports both text and json (default) outputs.
PsirtParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PsirtParser: """Ciscoapi PSIRT output parser. Supports both text and json (default) outputs.""" def dict_to_result(cls, data: dict) -> PsirtResult: """Convert ciscoapis result dict to PsirtResult object""" <|body_0|> def dict_to_results(cls, data: list) -> PsirtResults: ...
stack_v2_sparse_classes_36k_train_032596
1,441
permissive
[ { "docstring": "Convert ciscoapis result dict to PsirtResult object", "name": "dict_to_result", "signature": "def dict_to_result(cls, data: dict) -> PsirtResult" }, { "docstring": "Convert list of ciscoapis result dicts to PsirtResults", "name": "dict_to_results", "signature": "def dict_...
2
stack_v2_sparse_classes_30k_val_001148
Implement the Python class `PsirtParser` described below. Class description: Ciscoapi PSIRT output parser. Supports both text and json (default) outputs. Method signatures and docstrings: - def dict_to_result(cls, data: dict) -> PsirtResult: Convert ciscoapis result dict to PsirtResult object - def dict_to_results(cl...
Implement the Python class `PsirtParser` described below. Class description: Ciscoapi PSIRT output parser. Supports both text and json (default) outputs. Method signatures and docstrings: - def dict_to_result(cls, data: dict) -> PsirtResult: Convert ciscoapis result dict to PsirtResult object - def dict_to_results(cl...
bb21ff02965ed0cca5a55ee559eae77856d9866c
<|skeleton|> class PsirtParser: """Ciscoapi PSIRT output parser. Supports both text and json (default) outputs.""" def dict_to_result(cls, data: dict) -> PsirtResult: """Convert ciscoapis result dict to PsirtResult object""" <|body_0|> def dict_to_results(cls, data: list) -> PsirtResults: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PsirtParser: """Ciscoapi PSIRT output parser. Supports both text and json (default) outputs.""" def dict_to_result(cls, data: dict) -> PsirtResult: """Convert ciscoapis result dict to PsirtResult object""" vulnerability = PsirtResult() vulnerability.id = data.get('id') vul...
the_stack_v2_python_sparse
tools/ciscoapis/parsers.py
collectivesense/aucote
train
0
cc2b11a5423c0a22227250d7864cb64f00955fb1
[ "self.filepath = bpy.path.abspath('//')\nself.current_filename = bpy.path.display_name_from_filepath(bpy.data.filepath)\nself.current_filename = current_filename.rsplit('.', 1)\nself.does_file_exist = None\nself.file_exists = True\nself.next_numeric = 0\nself.new_filename = ''\nself.new_suffix = ''\nself.non_numeri...
<|body_start_0|> self.filepath = bpy.path.abspath('//') self.current_filename = bpy.path.display_name_from_filepath(bpy.data.filepath) self.current_filename = current_filename.rsplit('.', 1) self.does_file_exist = None self.file_exists = True self.next_numeric = 0 ...
Save incremental version of file
SaveIncrementalFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveIncrementalFile: """Save incremental version of file""" def __init__(self): """Initialize""" <|body_0|> def execute(self): """Execute""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.filepath = bpy.path.abspath('//') self.current...
stack_v2_sparse_classes_36k_train_032597
44,083
no_license
[ { "docstring": "Initialize", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Execute", "name": "execute", "signature": "def execute(self)" } ]
2
null
Implement the Python class `SaveIncrementalFile` described below. Class description: Save incremental version of file Method signatures and docstrings: - def __init__(self): Initialize - def execute(self): Execute
Implement the Python class `SaveIncrementalFile` described below. Class description: Save incremental version of file Method signatures and docstrings: - def __init__(self): Initialize - def execute(self): Execute <|skeleton|> class SaveIncrementalFile: """Save incremental version of file""" def __init__(se...
0788f00283d7c8c083aa5d554eb1f32c201adbd6
<|skeleton|> class SaveIncrementalFile: """Save incremental version of file""" def __init__(self): """Initialize""" <|body_0|> def execute(self): """Execute""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaveIncrementalFile: """Save incremental version of file""" def __init__(self): """Initialize""" self.filepath = bpy.path.abspath('//') self.current_filename = bpy.path.display_name_from_filepath(bpy.data.filepath) self.current_filename = current_filename.rsplit('.', 1) ...
the_stack_v2_python_sparse
repos/blender_addons/internal/2.7.x/addon_customprops_preset.py
BlenderCN-Org/working_files
train
0
e8c5ec6b6bb9472db9e0d2be57d6d16e0478ee20
[ "if get_jwt_claims()['roles'] == 'admin':\n return Fqdns().publish()\nreturn Fqdns().publish(get_jwt_identity())", "if get_jwt_claims()['roles'] == 'admin':\n return Fqdns().unpublish()\nreturn Fqdns().unpublish(get_jwt_identity())" ]
<|body_start_0|> if get_jwt_claims()['roles'] == 'admin': return Fqdns().publish() return Fqdns().publish(get_jwt_identity()) <|end_body_0|> <|body_start_1|> if get_jwt_claims()['roles'] == 'admin': return Fqdns().unpublish() return Fqdns().unpublish(get_jwt_iden...
fqdn publish
PublishFqdn
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublishFqdn: """fqdn publish""" def put(self): """Publish all owned fqdn (only fqdn with state 'publish')""" <|body_0|> def delete(self): """Unpublish all owned fqdn (state isnt modified)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if get_jw...
stack_v2_sparse_classes_36k_train_032598
5,403
permissive
[ { "docstring": "Publish all owned fqdn (only fqdn with state 'publish')", "name": "put", "signature": "def put(self)" }, { "docstring": "Unpublish all owned fqdn (state isnt modified)", "name": "delete", "signature": "def delete(self)" } ]
2
stack_v2_sparse_classes_30k_train_012169
Implement the Python class `PublishFqdn` described below. Class description: fqdn publish Method signatures and docstrings: - def put(self): Publish all owned fqdn (only fqdn with state 'publish') - def delete(self): Unpublish all owned fqdn (state isnt modified)
Implement the Python class `PublishFqdn` described below. Class description: fqdn publish Method signatures and docstrings: - def put(self): Publish all owned fqdn (only fqdn with state 'publish') - def delete(self): Unpublish all owned fqdn (state isnt modified) <|skeleton|> class PublishFqdn: """fqdn publish""...
6a9bf3a3d73fb3faa7cf1e5cfc757cc360fbafde
<|skeleton|> class PublishFqdn: """fqdn publish""" def put(self): """Publish all owned fqdn (only fqdn with state 'publish')""" <|body_0|> def delete(self): """Unpublish all owned fqdn (state isnt modified)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PublishFqdn: """fqdn publish""" def put(self): """Publish all owned fqdn (only fqdn with state 'publish')""" if get_jwt_claims()['roles'] == 'admin': return Fqdns().publish() return Fqdns().publish(get_jwt_identity()) def delete(self): """Unpublish all own...
the_stack_v2_python_sparse
haprestio/api_v1/pub.py
innofocus/haprestio
train
0
546d1cad439b7d937cb6f663332ab6e877374028
[ "params = kwargs.get('params')\nheaders = kwargs.get('headers')\nurl = kwargs.get('url')\ntry:\n result = requests.get(url=url, params=params, headers=headers)\n return result\nexcept Exception as e:\n print('get请求错误: %s' % e)", "log = Log()\nparams = kwargs.get('params')\ndata = kwargs.get('data')\njson...
<|body_start_0|> params = kwargs.get('params') headers = kwargs.get('headers') url = kwargs.get('url') try: result = requests.get(url=url, params=params, headers=headers) return result except Exception as e: print('get请求错误: %s' % e) <|end_body_...
Test_Requests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_Requests: def get(self, **kwargs): """封装get方法""" <|body_0|> def post(self, url, **kwargs): """封装yyj方法""" <|body_1|> def run_main(self, method, **kwargs): """判断请求类型 :param method: 请求接口类型 :param kwargs: 填参数 :return: 接口返回内容""" <|body_2|...
stack_v2_sparse_classes_36k_train_032599
1,537
no_license
[ { "docstring": "封装get方法", "name": "get", "signature": "def get(self, **kwargs)" }, { "docstring": "封装yyj方法", "name": "post", "signature": "def post(self, url, **kwargs)" }, { "docstring": "判断请求类型 :param method: 请求接口类型 :param kwargs: 填参数 :return: 接口返回内容", "name": "run_main", ...
3
null
Implement the Python class `Test_Requests` described below. Class description: Implement the Test_Requests class. Method signatures and docstrings: - def get(self, **kwargs): 封装get方法 - def post(self, url, **kwargs): 封装yyj方法 - def run_main(self, method, **kwargs): 判断请求类型 :param method: 请求接口类型 :param kwargs: 填参数 :retur...
Implement the Python class `Test_Requests` described below. Class description: Implement the Test_Requests class. Method signatures and docstrings: - def get(self, **kwargs): 封装get方法 - def post(self, url, **kwargs): 封装yyj方法 - def run_main(self, method, **kwargs): 判断请求类型 :param method: 请求接口类型 :param kwargs: 填参数 :retur...
7719674278d1324aad283f381e62199cfecb0178
<|skeleton|> class Test_Requests: def get(self, **kwargs): """封装get方法""" <|body_0|> def post(self, url, **kwargs): """封装yyj方法""" <|body_1|> def run_main(self, method, **kwargs): """判断请求类型 :param method: 请求接口类型 :param kwargs: 填参数 :return: 接口返回内容""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_Requests: def get(self, **kwargs): """封装get方法""" params = kwargs.get('params') headers = kwargs.get('headers') url = kwargs.get('url') try: result = requests.get(url=url, params=params, headers=headers) return result except Exception...
the_stack_v2_python_sparse
yyyTest/common/TestRequests.py
luoyangcheng/luoyc
train
1