blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
473b7264a210362b0ce31e3450bbd7aabd145c1c
[ "t = {}\nfor n in nums:\n if n in t:\n t[n] += 1\n else:\n t[n] = 1\n if t[n] == 2:\n del t[n]\nres = []\nfor key, val in t.items():\n res.append(key)\nreturn res", "d = set()\nfor n in nums:\n if n in d:\n d.remove(n)\n else:\n d.add(n)\nreturn list(d)" ]
<|body_start_0|> t = {} for n in nums: if n in t: t[n] += 1 else: t[n] = 1 if t[n] == 2: del t[n] res = [] for key, val in t.items(): res.append(key) return res <|end_body_0|> <|body_...
https://leetcode.com/problems/single-number-iii/description/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/single-number-iii/description/""" def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|...
stack_v2_sparse_classes_10k_train_007600
843
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber2", "signature": "def singleNumber2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/single-number-iii/description/ Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber2(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/single-number-iii/description/ Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber2(self, nums): :type nums: List[int] :rtype: List[int] <|s...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: """https://leetcode.com/problems/single-number-iii/description/""" def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """https://leetcode.com/problems/single-number-iii/description/""" def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" t = {} for n in nums: if n in t: t[n] += 1 else: t[n] = 1 if...
the_stack_v2_python_sparse
old/Session002/Arrays/SingleNumberIII.py
MaxIakovliev/algorithms
train
0
97ba2c8dbb90199871ebead20570ddb79ccca4d5
[ "try:\n movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('could not find movie with id %d in list %d' % (movie_id, list_id))\nreturn jsonify(movie.to_dict())", "try:\n movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id...
<|body_start_0|> try: movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id, session=session) except NoResultFound: raise NotFoundError('could not find movie with id %d in list %d' % (movie_id, list_id)) return jsonify(movie.to_dict()) <|end_body_0|> <|body_start...
MovieListMovieAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieListMovieAPI: def get(self, list_id, movie_id, session=None): """Get a movie by list ID and movie ID""" <|body_0|> def delete(self, list_id, movie_id, session=None): """Delete a movie by list ID and movie ID""" <|body_1|> def put(self, list_id, movi...
stack_v2_sparse_classes_10k_train_007601
12,846
permissive
[ { "docstring": "Get a movie by list ID and movie ID", "name": "get", "signature": "def get(self, list_id, movie_id, session=None)" }, { "docstring": "Delete a movie by list ID and movie ID", "name": "delete", "signature": "def delete(self, list_id, movie_id, session=None)" }, { "...
3
null
Implement the Python class `MovieListMovieAPI` described below. Class description: Implement the MovieListMovieAPI class. Method signatures and docstrings: - def get(self, list_id, movie_id, session=None): Get a movie by list ID and movie ID - def delete(self, list_id, movie_id, session=None): Delete a movie by list ...
Implement the Python class `MovieListMovieAPI` described below. Class description: Implement the MovieListMovieAPI class. Method signatures and docstrings: - def get(self, list_id, movie_id, session=None): Get a movie by list ID and movie ID - def delete(self, list_id, movie_id, session=None): Delete a movie by list ...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class MovieListMovieAPI: def get(self, list_id, movie_id, session=None): """Get a movie by list ID and movie ID""" <|body_0|> def delete(self, list_id, movie_id, session=None): """Delete a movie by list ID and movie ID""" <|body_1|> def put(self, list_id, movi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovieListMovieAPI: def get(self, list_id, movie_id, session=None): """Get a movie by list ID and movie ID""" try: movie = db.get_movie_by_id(list_id=list_id, movie_id=movie_id, session=session) except NoResultFound: raise NotFoundError('could not find movie with...
the_stack_v2_python_sparse
flexget/components/managed_lists/lists/movie_list/api.py
BrutuZ/Flexget
train
1
c7a7f5471973ac0f215bd6f89ea525ae42881c73
[ "unit = ['', 'Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Tujuh', 'Delapan', 'Sembilan', 'Sepuluh', 'Sebelas']\nresult = ' '\ntotal_terbilang = self.total_terbilang\nfor line in self:\n n = int(amount_total)\n if n >= 0 and n <= 11:\n result = result + unit[n]\n elif n < 20:\n result = to...
<|body_start_0|> unit = ['', 'Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Tujuh', 'Delapan', 'Sembilan', 'Sepuluh', 'Sebelas'] result = ' ' total_terbilang = self.total_terbilang for line in self: n = int(amount_total) if n >= 0 and n <= 11: re...
inherit model account.invoice
AccountInvoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInvoice: """inherit model account.invoice""" def total_terbilang(self, amount_total): """function to converting amount total into word""" <|body_0|> def currency_word(self): """function to converting currency into word""" <|body_1|> def _prepa...
stack_v2_sparse_classes_10k_train_007602
3,798
no_license
[ { "docstring": "function to converting amount total into word", "name": "total_terbilang", "signature": "def total_terbilang(self, amount_total)" }, { "docstring": "function to converting currency into word", "name": "currency_word", "signature": "def currency_word(self)" }, { "d...
5
stack_v2_sparse_classes_30k_train_002482
Implement the Python class `AccountInvoice` described below. Class description: inherit model account.invoice Method signatures and docstrings: - def total_terbilang(self, amount_total): function to converting amount total into word - def currency_word(self): function to converting currency into word - def _prepare_r...
Implement the Python class `AccountInvoice` described below. Class description: inherit model account.invoice Method signatures and docstrings: - def total_terbilang(self, amount_total): function to converting amount total into word - def currency_word(self): function to converting currency into word - def _prepare_r...
976928395f3b600275f6ab53445605fe1167c6ba
<|skeleton|> class AccountInvoice: """inherit model account.invoice""" def total_terbilang(self, amount_total): """function to converting amount total into word""" <|body_0|> def currency_word(self): """function to converting currency into word""" <|body_1|> def _prepa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccountInvoice: """inherit model account.invoice""" def total_terbilang(self, amount_total): """function to converting amount total into word""" unit = ['', 'Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Tujuh', 'Delapan', 'Sembilan', 'Sepuluh', 'Sebelas'] result = ' ' t...
the_stack_v2_python_sparse
pn_account/models/account_invoice.py
detian08/pennyu
train
0
b904cb88c9ecceff791a4ec96939146c945b1b1c
[ "super(SoftmaxSelfAttentionEncoder, self).__init__()\nself._attention_mlp = attention_mlp\nself._is_end_padded = is_end_padded", "att_scores = self._attention_mlp(batch_sequences)\nmask = pwF.create_mask_from_length(batch_sequence_lengths, batch_sequences.size(1), self._is_end_padded).unsqueeze(-1)\nmasked_att_sc...
<|body_start_0|> super(SoftmaxSelfAttentionEncoder, self).__init__() self._attention_mlp = attention_mlp self._is_end_padded = is_end_padded <|end_body_0|> <|body_start_1|> att_scores = self._attention_mlp(batch_sequences) mask = pwF.create_mask_from_length(batch_sequence_length...
Encodes a sequence using soft-max self-attention.
SoftmaxSelfAttentionEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftmaxSelfAttentionEncoder: """Encodes a sequence using soft-max self-attention.""" def __init__(self, attention_mlp, is_end_padded=True): """:param attention_mlp: MLP object used to generate unnormalized attention score(s). If the last dimension of the tensor returned by the MLP is...
stack_v2_sparse_classes_10k_train_007603
1,994
permissive
[ { "docstring": ":param attention_mlp: MLP object used to generate unnormalized attention score(s). If the last dimension of the tensor returned by the MLP is larger than 1 then multi-attention is applied. :param is_end_padded: Whether to mask at the end.", "name": "__init__", "signature": "def __init__(...
2
stack_v2_sparse_classes_30k_train_006501
Implement the Python class `SoftmaxSelfAttentionEncoder` described below. Class description: Encodes a sequence using soft-max self-attention. Method signatures and docstrings: - def __init__(self, attention_mlp, is_end_padded=True): :param attention_mlp: MLP object used to generate unnormalized attention score(s). I...
Implement the Python class `SoftmaxSelfAttentionEncoder` described below. Class description: Encodes a sequence using soft-max self-attention. Method signatures and docstrings: - def __init__(self, attention_mlp, is_end_padded=True): :param attention_mlp: MLP object used to generate unnormalized attention score(s). I...
57c85161bd6e09961cb7a1e69debc8e3e0bf7d29
<|skeleton|> class SoftmaxSelfAttentionEncoder: """Encodes a sequence using soft-max self-attention.""" def __init__(self, attention_mlp, is_end_padded=True): """:param attention_mlp: MLP object used to generate unnormalized attention score(s). If the last dimension of the tensor returned by the MLP is...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SoftmaxSelfAttentionEncoder: """Encodes a sequence using soft-max self-attention.""" def __init__(self, attention_mlp, is_end_padded=True): """:param attention_mlp: MLP object used to generate unnormalized attention score(s). If the last dimension of the tensor returned by the MLP is larger than ...
the_stack_v2_python_sparse
pytorch_wrapper/modules/softmax_self_attention_encoder.py
ajaxis001/pytorch-wrapper
train
1
4bff64b5ea30f00bceac84482cd4ab24f3a15ed2
[ "super(DefaultStaticAssetPolicy, self).__init__(config)\nself.settings = config.registry.settings\nself.views = {}", "cache_max_age = self.settings.get('websauna.cache_max_age_seconds')\nif cache_max_age:\n cache_max_age = int(cache_max_age)\nself.config.add_static_view(name, path, cache_max_age=cache_max_age)...
<|body_start_0|> super(DefaultStaticAssetPolicy, self).__init__(config) self.settings = config.registry.settings self.views = {} <|end_body_0|> <|body_start_1|> cache_max_age = self.settings.get('websauna.cache_max_age_seconds') if cache_max_age: cache_max_age = int(...
Default inplementation of StaticAssetPolicy.
DefaultStaticAssetPolicy
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultStaticAssetPolicy: """Default inplementation of StaticAssetPolicy.""" def __init__(self, config: Configurator): """Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.""" <|body_0|> def add_static_view(self, name: str, path: str): """Include...
stack_v2_sparse_classes_10k_train_007604
9,928
permissive
[ { "docstring": "Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.", "name": "__init__", "signature": "def __init__(self, config: Configurator)" }, { "docstring": "Include a path in static assets and configures cache busting for it. This does not only include the static resource...
3
stack_v2_sparse_classes_30k_train_006696
Implement the Python class `DefaultStaticAssetPolicy` described below. Class description: Default inplementation of StaticAssetPolicy. Method signatures and docstrings: - def __init__(self, config: Configurator): Initialize DefaultStaticAssetPolicy. :param config: Pyramid config. - def add_static_view(self, name: str...
Implement the Python class `DefaultStaticAssetPolicy` described below. Class description: Default inplementation of StaticAssetPolicy. Method signatures and docstrings: - def __init__(self, config: Configurator): Initialize DefaultStaticAssetPolicy. :param config: Pyramid config. - def add_static_view(self, name: str...
a57de54fb8a3fae859f24f373f0292e1e4b3c344
<|skeleton|> class DefaultStaticAssetPolicy: """Default inplementation of StaticAssetPolicy.""" def __init__(self, config: Configurator): """Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.""" <|body_0|> def add_static_view(self, name: str, path: str): """Include...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DefaultStaticAssetPolicy: """Default inplementation of StaticAssetPolicy.""" def __init__(self, config: Configurator): """Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.""" super(DefaultStaticAssetPolicy, self).__init__(config) self.settings = config.registry.s...
the_stack_v2_python_sparse
websauna/system/http/static.py
websauna/websauna
train
294
fc7e7f164d6ac62856bc4f9717c4d73d7301922f
[ "queue = [root] if root else []\nres = ''\nwhile queue:\n node = queue.pop(0)\n if node:\n res += '%d,' % node.val\n queue.append(node.left)\n queue.append(node.right)\n else:\n res += 'N,'\nreturn res[:-1]", "data_list = data.split(',')\nval = data_list.pop(0)\nif not val:\n ...
<|body_start_0|> queue = [root] if root else [] res = '' while queue: node = queue.pop(0) if node: res += '%d,' % node.val queue.append(node.left) queue.append(node.right) else: res += 'N,' ...
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_10k_train_007605
2,305
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_002767
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:...
95d5aa4158209ad9ab81017e3bc82ef0680ea6bd
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" queue = [root] if root else [] res = '' while queue: node = queue.pop(0) if node: res += '%d,' % node.val queue.ap...
the_stack_v2_python_sparse
Tree/BinaryTree/297_Serialize_and_Deserialize_Binary_Tree.py
OldFuzzier/Data-Structures-and-Algorithms-
train
0
8c9c14c67e2c0dd60900ff0110504cb21224f1f2
[ "user = create_user()\nlist_sensor = []\nsensor1 = create_sensor('test1', 'code1', user)\nlist_sensor.append(sensor1)\nsensor2 = create_sensor('test2', 'code2', user)\nlist_sensor.append(sensor2)\nself.assertEqual(len(list_sensor), 2)", "user = create_user()\ncode_mouse_event = 'The event is attached to its targe...
<|body_start_0|> user = create_user() list_sensor = [] sensor1 = create_sensor('test1', 'code1', user) list_sensor.append(sensor1) sensor2 = create_sensor('test2', 'code2', user) list_sensor.append(sensor2) self.assertEqual(len(list_sensor), 2) <|end_body_0|> <|b...
SensorTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorTests: def test_list_Sensor(self): """Test for a list of Sensor :return:""" <|body_0|> def test_create_Sensor(self): """Test for a created Sensor :return:""" <|body_1|> def test_update_Sensor(self): """Test for a update Sensor :return:""" ...
stack_v2_sparse_classes_10k_train_007606
3,684
no_license
[ { "docstring": "Test for a list of Sensor :return:", "name": "test_list_Sensor", "signature": "def test_list_Sensor(self)" }, { "docstring": "Test for a created Sensor :return:", "name": "test_create_Sensor", "signature": "def test_create_Sensor(self)" }, { "docstring": "Test for...
4
stack_v2_sparse_classes_30k_train_000165
Implement the Python class `SensorTests` described below. Class description: Implement the SensorTests class. Method signatures and docstrings: - def test_list_Sensor(self): Test for a list of Sensor :return: - def test_create_Sensor(self): Test for a created Sensor :return: - def test_update_Sensor(self): Test for a...
Implement the Python class `SensorTests` described below. Class description: Implement the SensorTests class. Method signatures and docstrings: - def test_list_Sensor(self): Test for a list of Sensor :return: - def test_create_Sensor(self): Test for a created Sensor :return: - def test_update_Sensor(self): Test for a...
8c8f76acb85baff1cd2d8258f686515d08678350
<|skeleton|> class SensorTests: def test_list_Sensor(self): """Test for a list of Sensor :return:""" <|body_0|> def test_create_Sensor(self): """Test for a created Sensor :return:""" <|body_1|> def test_update_Sensor(self): """Test for a update Sensor :return:""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SensorTests: def test_list_Sensor(self): """Test for a list of Sensor :return:""" user = create_user() list_sensor = [] sensor1 = create_sensor('test1', 'code1', user) list_sensor.append(sensor1) sensor2 = create_sensor('test2', 'code2', user) list_senso...
the_stack_v2_python_sparse
probe_project/apps/probe_dispatcher/tests.py
liflab/cornipickle-probe
train
0
cc10a6146830a1de30f6f3d90ec2d7c3c2cfe1d0
[ "super().__init__()\nself.encoder = smp.encoders.get_encoder(encoder_name, in_channels=in_channels, depth=encoder_depth, weights=encoder_weights)\nencoder_out_channels = [c * 2 for c in self.encoder.out_channels[1:]]\nencoder_out_channels.insert(0, self.encoder.out_channels[0])\ntry:\n UnetDecoder = smp.decoders...
<|body_start_0|> super().__init__() self.encoder = smp.encoders.get_encoder(encoder_name, in_channels=in_channels, depth=encoder_depth, weights=encoder_weights) encoder_out_channels = [c * 2 for c in self.encoder.out_channels[1:]] encoder_out_channels.insert(0, self.encoder.out_channels[...
Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652
FCSiamConc
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FCSiamConc: """Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652""" def __init__(self, encoder_name: str='resnet34', encoder_depth: int=5, encoder_weights: Optional[st...
stack_v2_sparse_classes_10k_train_007607
8,273
permissive
[ { "docstring": "Initialize a new FCSiamConc model. Args: encoder_name: Name of the classification model that will be used as an encoder (a.k.a backbone) to extract features of different spatial resolution encoder_depth: A number of stages used in encoder in range [3, 5]. two times smaller in spatial dimensions ...
2
stack_v2_sparse_classes_30k_train_003051
Implement the Python class `FCSiamConc` described below. Class description: Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652 Method signatures and docstrings: - def __init__(self, encoder_name...
Implement the Python class `FCSiamConc` described below. Class description: Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652 Method signatures and docstrings: - def __init__(self, encoder_name...
29985861614b3b93f9ef5389469ebb98570de7dd
<|skeleton|> class FCSiamConc: """Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652""" def __init__(self, encoder_name: str='resnet34', encoder_depth: int=5, encoder_weights: Optional[st...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FCSiamConc: """Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652""" def __init__(self, encoder_name: str='resnet34', encoder_depth: int=5, encoder_weights: Optional[str]='imagenet'...
the_stack_v2_python_sparse
torchgeo/models/fcsiam.py
microsoft/torchgeo
train
1,724
180af0e2f8459b3b0b6b121af00fb575b9d8f0f0
[ "if not nums:\n return 0\nm = -float('inf')\ni = 0\nwhile i < len(nums) and nums[i] == 0:\n i += 1\nif i > 0:\n m = 0\nwhile i < len(nums):\n p = 1\n for j in range(i, len(nums)):\n if nums[j] == 0:\n for k in range(i, j - 1):\n p //= nums[k]\n m = max(...
<|body_start_0|> if not nums: return 0 m = -float('inf') i = 0 while i < len(nums) and nums[i] == 0: i += 1 if i > 0: m = 0 while i < len(nums): p = 1 for j in range(i, len(nums)): if nums[j] == 0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, nums): """07/27/2018 22:42""" <|body_0|> def maxProduct(self, nums: List[int]) -> int: """Time complexity: O(n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 ...
stack_v2_sparse_classes_10k_train_007608
3,384
no_license
[ { "docstring": "07/27/2018 22:42", "name": "maxProduct", "signature": "def maxProduct(self, nums)" }, { "docstring": "Time complexity: O(n) Space complexity: O(1)", "name": "maxProduct", "signature": "def maxProduct(self, nums: List[int]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): 07/27/2018 22:42 - def maxProduct(self, nums: List[int]) -> int: Time complexity: O(n) Space complexity: O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): 07/27/2018 22:42 - def maxProduct(self, nums: List[int]) -> int: Time complexity: O(n) Space complexity: O(1) <|skeleton|> class Solution: def m...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxProduct(self, nums): """07/27/2018 22:42""" <|body_0|> def maxProduct(self, nums: List[int]) -> int: """Time complexity: O(n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProduct(self, nums): """07/27/2018 22:42""" if not nums: return 0 m = -float('inf') i = 0 while i < len(nums) and nums[i] == 0: i += 1 if i > 0: m = 0 while i < len(nums): p = 1 ...
the_stack_v2_python_sparse
leetcode/solved/152_Maximum_Product_Subarray/solution.py
sungminoh/algorithms
train
0
5cdad122a09bbee668c5cdb59b18113607caf063
[ "exp = ' A -> B\\n A.radius < B.radius\\n '\ndm = dotmotif.Motif(exp)\nself.assertEqual(len(dm.list_dynamic_node_constraints()), 1)", "exp = ' macro(A, B) {\\n A.radius > B.radius\\n }\\n macro(A, B)\\n A -> B\\n '\ndm = dotmotif.Motif(exp)\nself....
<|body_start_0|> exp = ' A -> B\n A.radius < B.radius\n ' dm = dotmotif.Motif(exp) self.assertEqual(len(dm.list_dynamic_node_constraints()), 1) <|end_body_0|> <|body_start_1|> exp = ' macro(A, B) {\n A.radius > B.radius\n }\n macro(A,...
TestDynamicNodeConstraints
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDynamicNodeConstraints: def test_dynamic_constraints(self): """Test that comparisons may be made between variables, e.g.: A.type != B.type""" <|body_0|> def test_dynamic_constraints_in_macro(self): """Test that comparisons may be made between variables in a macro...
stack_v2_sparse_classes_10k_train_007609
11,613
permissive
[ { "docstring": "Test that comparisons may be made between variables, e.g.: A.type != B.type", "name": "test_dynamic_constraints", "signature": "def test_dynamic_constraints(self)" }, { "docstring": "Test that comparisons may be made between variables in a macro, e.g.: A.type != B.type", "nam...
2
stack_v2_sparse_classes_30k_val_000381
Implement the Python class `TestDynamicNodeConstraints` described below. Class description: Implement the TestDynamicNodeConstraints class. Method signatures and docstrings: - def test_dynamic_constraints(self): Test that comparisons may be made between variables, e.g.: A.type != B.type - def test_dynamic_constraints...
Implement the Python class `TestDynamicNodeConstraints` described below. Class description: Implement the TestDynamicNodeConstraints class. Method signatures and docstrings: - def test_dynamic_constraints(self): Test that comparisons may be made between variables, e.g.: A.type != B.type - def test_dynamic_constraints...
db093ddad7308756e9cf7ee01199f0dca1369872
<|skeleton|> class TestDynamicNodeConstraints: def test_dynamic_constraints(self): """Test that comparisons may be made between variables, e.g.: A.type != B.type""" <|body_0|> def test_dynamic_constraints_in_macro(self): """Test that comparisons may be made between variables in a macro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestDynamicNodeConstraints: def test_dynamic_constraints(self): """Test that comparisons may be made between variables, e.g.: A.type != B.type""" exp = ' A -> B\n A.radius < B.radius\n ' dm = dotmotif.Motif(exp) self.assertEqual(len(dm.list_dynamic_node_con...
the_stack_v2_python_sparse
dotmotif/parsers/v2/test_v2_parser.py
JuttaPig/dotmotif
train
0
aae8e91d5707b7c830fa13f71f44f3d131aa4b29
[ "QtGui.QMainWindow.__init__(self)\nself.resize(800, 600)\nself.centralwidget = QtGui.QWidget(self)\nself.mainLayout = QtGui.QHBoxLayout(self.centralwidget)\nself.mainLayout.setSpacing(0)\nself.mainLayout.setMargin(1)\nself.frame = QtGui.QFrame(self.centralwidget)\nself.gridLayout = QtGui.QVBoxLayout(self.frame)\nse...
<|body_start_0|> QtGui.QMainWindow.__init__(self) self.resize(800, 600) self.centralwidget = QtGui.QWidget(self) self.mainLayout = QtGui.QHBoxLayout(self.centralwidget) self.mainLayout.setSpacing(0) self.mainLayout.setMargin(1) self.frame = QtGui.QFrame(self.centr...
Browser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Browser: def __init__(self, default_url='http://google.com'): """Initialize the browser GUI and connect the events""" <|body_0|> def browse(self): """Make a web browse on a specific url and show the page on the Webview widget.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_007610
33,580
no_license
[ { "docstring": "Initialize the browser GUI and connect the events", "name": "__init__", "signature": "def __init__(self, default_url='http://google.com')" }, { "docstring": "Make a web browse on a specific url and show the page on the Webview widget.", "name": "browse", "signature": "def...
2
stack_v2_sparse_classes_30k_val_000169
Implement the Python class `Browser` described below. Class description: Implement the Browser class. Method signatures and docstrings: - def __init__(self, default_url='http://google.com'): Initialize the browser GUI and connect the events - def browse(self): Make a web browse on a specific url and show the page on ...
Implement the Python class `Browser` described below. Class description: Implement the Browser class. Method signatures and docstrings: - def __init__(self, default_url='http://google.com'): Initialize the browser GUI and connect the events - def browse(self): Make a web browse on a specific url and show the page on ...
211c963dbac615920051be3a57991853e2081ac0
<|skeleton|> class Browser: def __init__(self, default_url='http://google.com'): """Initialize the browser GUI and connect the events""" <|body_0|> def browse(self): """Make a web browse on a specific url and show the page on the Webview widget.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Browser: def __init__(self, default_url='http://google.com'): """Initialize the browser GUI and connect the events""" QtGui.QMainWindow.__init__(self) self.resize(800, 600) self.centralwidget = QtGui.QWidget(self) self.mainLayout = QtGui.QHBoxLayout(self.centralwidget) ...
the_stack_v2_python_sparse
pyFAI-src/integrate_widget.py
SulzmannFr/pyFAI
train
0
916150bf5326ec2632b7f2617308ef38fb5d272e
[ "total_sum = sum(arr)\nexpected_sum = (len(arr) + 1) * (len(arr) + 2) // 2\nreturn expected_sum - total_sum", "i, j = (0, len(arr) - 1)\nexpected_sum = arr[i] + arr[j]\nwhile i < j:\n i += 1\n j -= 1\n actual_sum = arr[i] + arr[j]\n if expected_sum > actual_sum:\n return arr[j] + 1\n elif ex...
<|body_start_0|> total_sum = sum(arr) expected_sum = (len(arr) + 1) * (len(arr) + 2) // 2 return expected_sum - total_sum <|end_body_0|> <|body_start_1|> i, j = (0, len(arr) - 1) expected_sum = arr[i] + arr[j] while i < j: i += 1 j -= 1 ...
MissingNumber
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MissingNumber: def get_missing_int_in_sequence(arr: []): """This is a linear solution and it will traverse the array entirely :param arr: Sequence from 1 to N in an array of size N - 1. ARRAY DOES NOT HAVE TO BE SORTED :return: The missing number""" <|body_0|> def get_missin...
stack_v2_sparse_classes_10k_train_007611
1,170
no_license
[ { "docstring": "This is a linear solution and it will traverse the array entirely :param arr: Sequence from 1 to N in an array of size N - 1. ARRAY DOES NOT HAVE TO BE SORTED :return: The missing number", "name": "get_missing_int_in_sequence", "signature": "def get_missing_int_in_sequence(arr: [])" },...
2
stack_v2_sparse_classes_30k_train_003892
Implement the Python class `MissingNumber` described below. Class description: Implement the MissingNumber class. Method signatures and docstrings: - def get_missing_int_in_sequence(arr: []): This is a linear solution and it will traverse the array entirely :param arr: Sequence from 1 to N in an array of size N - 1. ...
Implement the Python class `MissingNumber` described below. Class description: Implement the MissingNumber class. Method signatures and docstrings: - def get_missing_int_in_sequence(arr: []): This is a linear solution and it will traverse the array entirely :param arr: Sequence from 1 to N in an array of size N - 1. ...
638a1312a66805fefb2a1e1dd7b4968d2c957564
<|skeleton|> class MissingNumber: def get_missing_int_in_sequence(arr: []): """This is a linear solution and it will traverse the array entirely :param arr: Sequence from 1 to N in an array of size N - 1. ARRAY DOES NOT HAVE TO BE SORTED :return: The missing number""" <|body_0|> def get_missin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MissingNumber: def get_missing_int_in_sequence(arr: []): """This is a linear solution and it will traverse the array entirely :param arr: Sequence from 1 to N in an array of size N - 1. ARRAY DOES NOT HAVE TO BE SORTED :return: The missing number""" total_sum = sum(arr) expected_sum = ...
the_stack_v2_python_sparse
missing_number.py
wotann07/leetcode_py
train
0
3431a82db2f3101739038a4e92529a1b825a25ca
[ "connection_created.connect(self.activate_pragmas_per_connection)\nself.activate_pragmas_on_start()\nlogger.info('Running Kolibri with the following settings: {settings}'.format(settings=os.environ['DJANGO_SETTINGS_MODULE']))\nself.check_redis_settings()\nfrom morango.models import UUIDField\nFilterSet.FILTER_DEFAU...
<|body_start_0|> connection_created.connect(self.activate_pragmas_per_connection) self.activate_pragmas_on_start() logger.info('Running Kolibri with the following settings: {settings}'.format(settings=os.environ['DJANGO_SETTINGS_MODULE'])) self.check_redis_settings() from morango...
KolibriCoreConfig
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KolibriCoreConfig: def ready(self): """Sets up PRAGMAs.""" <|body_0|> def activate_pragmas_per_connection(sender, connection, **kwargs): """Activate SQLite3 PRAGMAs that apply on a per-connection basis. A no-op right now, but kept around as infrastructure if we ever ...
stack_v2_sparse_classes_10k_train_007612
7,006
permissive
[ { "docstring": "Sets up PRAGMAs.", "name": "ready", "signature": "def ready(self)" }, { "docstring": "Activate SQLite3 PRAGMAs that apply on a per-connection basis. A no-op right now, but kept around as infrastructure if we ever want to add PRAGMAs in the future.", "name": "activate_pragmas_...
4
stack_v2_sparse_classes_30k_train_006109
Implement the Python class `KolibriCoreConfig` described below. Class description: Implement the KolibriCoreConfig class. Method signatures and docstrings: - def ready(self): Sets up PRAGMAs. - def activate_pragmas_per_connection(sender, connection, **kwargs): Activate SQLite3 PRAGMAs that apply on a per-connection b...
Implement the Python class `KolibriCoreConfig` described below. Class description: Implement the KolibriCoreConfig class. Method signatures and docstrings: - def ready(self): Sets up PRAGMAs. - def activate_pragmas_per_connection(sender, connection, **kwargs): Activate SQLite3 PRAGMAs that apply on a per-connection b...
cc9da2a6acd139acac3cd71c4cb05c15d4465712
<|skeleton|> class KolibriCoreConfig: def ready(self): """Sets up PRAGMAs.""" <|body_0|> def activate_pragmas_per_connection(sender, connection, **kwargs): """Activate SQLite3 PRAGMAs that apply on a per-connection basis. A no-op right now, but kept around as infrastructure if we ever ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KolibriCoreConfig: def ready(self): """Sets up PRAGMAs.""" connection_created.connect(self.activate_pragmas_per_connection) self.activate_pragmas_on_start() logger.info('Running Kolibri with the following settings: {settings}'.format(settings=os.environ['DJANGO_SETTINGS_MODULE'...
the_stack_v2_python_sparse
kolibri/core/apps.py
learningequality/kolibri
train
689
1dcb7afdfb5aa1df0f97431d261f89594d143751
[ "if k == 1:\n return [i for i in range(1, n + 1)]\nans = [n]\ndec = True\nfor diff in range(k, 0, -1):\n if dec:\n ans.append(ans[len(ans) - 1] - diff)\n dec = False\n else:\n ans.append(ans[len(ans) - 1] + diff)\n dec = True\nlast = ans[len(ans) - 1]\nif last - 2 > 0:\n ans....
<|body_start_0|> if k == 1: return [i for i in range(1, n + 1)] ans = [n] dec = True for diff in range(k, 0, -1): if dec: ans.append(ans[len(ans) - 1] - diff) dec = False else: ans.append(ans[len(ans) - 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_0|> def constructArray2(self, n, k): """We need k+1 numbers to generate k distinct differences. Put first (n-k-1) elements in order: [1, 2, ..., n-k-1], then for the re...
stack_v2_sparse_classes_10k_train_007613
1,609
no_license
[ { "docstring": ":type n: int :type k: int :rtype: List[int]", "name": "constructArray", "signature": "def constructArray(self, n, k)" }, { "docstring": "We need k+1 numbers to generate k distinct differences. Put first (n-k-1) elements in order: [1, 2, ..., n-k-1], then for the remaining [n-k, n...
2
stack_v2_sparse_classes_30k_train_000403
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int] - def constructArray2(self, n, k): We need k+1 numbers to generate k distinct differences. Put first (...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int] - def constructArray2(self, n, k): We need k+1 numbers to generate k distinct differences. Put first (...
143aa25f92f3827aa379f29c67a9b7ec3757fef9
<|skeleton|> class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_0|> def constructArray2(self, n, k): """We need k+1 numbers to generate k distinct differences. Put first (n-k-1) elements in order: [1, 2, ..., n-k-1], then for the re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" if k == 1: return [i for i in range(1, n + 1)] ans = [n] dec = True for diff in range(k, 0, -1): if dec: ans.append(ans[len(ans) - 1] - di...
the_stack_v2_python_sparse
py/leetcode_py/667.py
imsure/tech-interview-prep
train
0
c051275ca47b9101d783269539d6b03c1b6b7a11
[ "end = res = 0\nwhile end < T:\n tmp = max([r for l, r in clips if l <= end] or [0])\n if tmp == end:\n return -1\n end = tmp\n res += 1\nreturn res", "T += 1\ndp = [-1] * T\ndp[0] = 0\nclips = sorted(clips, key=lambda a: a[0])\nfor c in clips:\n if c[0] >= T:\n break\n if dp[c[0]]...
<|body_start_0|> end = res = 0 while end < T: tmp = max([r for l, r in clips if l <= end] or [0]) if tmp == end: return -1 end = tmp res += 1 return res <|end_body_0|> <|body_start_1|> T += 1 dp = [-1] * T d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_0|> def videoStitching2(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_1|> def videoStitching3(self, cli...
stack_v2_sparse_classes_10k_train_007614
3,920
no_license
[ { "docstring": ":type clips: List[List[int]] :type T: int :rtype: int", "name": "videoStitching", "signature": "def videoStitching(self, clips, T)" }, { "docstring": ":type clips: List[List[int]] :type T: int :rtype: int", "name": "videoStitching2", "signature": "def videoStitching2(self...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching(self, clips, T): :type clips: List[List[int]] :type T: int :rtype: int - def videoStitching2(self, clips, T): :type clips: List[List[int]] :type T: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching(self, clips, T): :type clips: List[List[int]] :type T: int :rtype: int - def videoStitching2(self, clips, T): :type clips: List[List[int]] :type T: int :rtype:...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_0|> def videoStitching2(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_1|> def videoStitching3(self, cli...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" end = res = 0 while end < T: tmp = max([r for l, r in clips if l <= end] or [0]) if tmp == end: return -1 end = tmp ...
the_stack_v2_python_sparse
1024_视频拼接.py
lovehhf/LeetCode
train
0
9981a9d733723cae2a904efb9b12018279e61c85
[ "url = '{0}/consumers'.format(container_ref)\nresp = self.client.post(url, request_model=model, extra_headers=extra_headers, user_name=user_name, use_auth=use_auth)\nif resp.status_code == 401 and (not use_auth):\n return (resp, None)\nif resp.status_code == 200:\n if admin is None:\n admin = user_name...
<|body_start_0|> url = '{0}/consumers'.format(container_ref) resp = self.client.post(url, request_model=model, extra_headers=extra_headers, user_name=user_name, use_auth=use_auth) if resp.status_code == 401 and (not use_auth): return (resp, None) if resp.status_code == 200: ...
ConsumerBehaviors
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsumerBehaviors: def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): """Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: ...
stack_v2_sparse_classes_10k_train_007615
4,859
permissive
[ { "docstring": "Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: Any additional headers to pass to the request :param user_name: The user name used to create the consumer :param admin: The user with permissi...
4
stack_v2_sparse_classes_30k_train_005656
Implement the Python class `ConsumerBehaviors` described below. Class description: Implement the ConsumerBehaviors class. Method signatures and docstrings: - def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): Register a consumer to a container. :param model...
Implement the Python class `ConsumerBehaviors` described below. Class description: Implement the ConsumerBehaviors class. Method signatures and docstrings: - def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): Register a consumer to a container. :param model...
c8e3dc14e6225f1d400131434e8afec0aa410ae7
<|skeleton|> class ConsumerBehaviors: def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): """Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConsumerBehaviors: def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): """Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: Any additional...
the_stack_v2_python_sparse
functionaltests/api/v1/behaviors/consumer_behaviors.py
openstack/barbican
train
189
d59c5bcbf86acd4fe52fa3f4d700dfa09fb8783a
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Run()", "from ..entity import Entity\nfrom .lifecycle_workflow_processing_status import LifecycleWorkflowProcessingStatus\nfrom .task_processing_result import TaskProcessingResult\nfrom .user_processing_result import UserProcessingResu...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Run() <|end_body_0|> <|body_start_1|> from ..entity import Entity from .lifecycle_workflow_processing_status import LifecycleWorkflowProcessingStatus from .task_processing_result...
Run
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Run: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Run: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Run""" <|b...
stack_v2_sparse_classes_10k_train_007616
7,160
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Run", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_nod...
3
stack_v2_sparse_classes_30k_train_002715
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Run: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n...
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Run: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Run: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Run: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Run""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Run: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Run: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Run""" if not parse_node...
the_stack_v2_python_sparse
msgraph/generated/models/identity_governance/run.py
microsoftgraph/msgraph-sdk-python
train
135
f9eda54446842508b1e43dd70e0451c368dec8e4
[ "sketch = Sketch.query.get_with_acl(sketch_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.')\ngraphs = sketch.graphs\nreturn self.to_json(graphs)", "sketch = Sketch.query.get_with_acl(sketch_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with ...
<|body_start_0|> sketch = Sketch.query.get_with_acl(sketch_id) if not sketch: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.') graphs = sketch.graphs return self.to_json(graphs) <|end_body_0|> <|body_start_1|> sketch = Sketch.query.get_with_acl(sket...
Resource to get all saved graphs for a sketch.
GraphListResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphListResource: """Resource to get all saved graphs for a sketch.""" def get(self, sketch_id): """Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)""" <|body_0|> def post(self, sketch_id): """Handles POS...
stack_v2_sparse_classes_10k_train_007617
12,247
permissive
[ { "docstring": "Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)", "name": "get", "signature": "def get(self, sketch_id)" }, { "docstring": "Handles POST request to the resource.", "name": "post", "signature": "def post(self, sket...
2
stack_v2_sparse_classes_30k_train_007200
Implement the Python class `GraphListResource` described below. Class description: Resource to get all saved graphs for a sketch. Method signatures and docstrings: - def get(self, sketch_id): Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response) - def post(self, sk...
Implement the Python class `GraphListResource` described below. Class description: Resource to get all saved graphs for a sketch. Method signatures and docstrings: - def get(self, sketch_id): Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response) - def post(self, sk...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class GraphListResource: """Resource to get all saved graphs for a sketch.""" def get(self, sketch_id): """Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)""" <|body_0|> def post(self, sketch_id): """Handles POS...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GraphListResource: """Resource to get all saved graphs for a sketch.""" def get(self, sketch_id): """Handles GET request to the resource. Returns: List of graphs in JSON (instance of flask.wrappers.Response)""" sketch = Sketch.query.get_with_acl(sketch_id) if not sketch: ...
the_stack_v2_python_sparse
timesketch/api/v1/resources/graph.py
google/timesketch
train
2,263
a336ef000ab596e522c1b2ebb922b1fc3207b773
[ "super().__init__(source_image_path, source_image_size, output_image_path, output_image_size)\nself.__levels = len(neighbourhood_padding)\nself.__neighbourhood_padding = neighbourhood_padding\nself.__tsvq_branching_factor = tsvq_branching_factor\nassert self.__levels > 0, 'At least one neighbourhood padding size mu...
<|body_start_0|> super().__init__(source_image_path, source_image_size, output_image_path, output_image_size) self.__levels = len(neighbourhood_padding) self.__neighbourhood_padding = neighbourhood_padding self.__tsvq_branching_factor = tsvq_branching_factor assert self.__levels ...
A RasterPixelNeighbourhoodSynthesizer object synthesizes textures using the algorithm from https://graphics.stanford.edu/papers/texture-synthesis-sig00/texture.pdf. The basic idea is to seed the output Image with noise from the source Image and then resolve the pixels one-by-one in scanline order by finding the best ne...
RasterPixelNeighbourhoodSynthesizer
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RasterPixelNeighbourhoodSynthesizer: """A RasterPixelNeighbourhoodSynthesizer object synthesizes textures using the algorithm from https://graphics.stanford.edu/papers/texture-synthesis-sig00/texture.pdf. The basic idea is to seed the output Image with noise from the source Image and then resolve...
stack_v2_sparse_classes_10k_train_007618
6,847
permissive
[ { "docstring": "Constructs a new RasterPixelNeighbourhoodSynthesizer object with the given TextureSynthesizer parameters and neighbourhood padding. Args: source_image_path: See TextureSynthesizer.__init__(). source_image_size: See TextureSynthesizer.__init__(). output_image_path: See TextureSynthesizer.__init__...
5
stack_v2_sparse_classes_30k_test_000181
Implement the Python class `RasterPixelNeighbourhoodSynthesizer` described below. Class description: A RasterPixelNeighbourhoodSynthesizer object synthesizes textures using the algorithm from https://graphics.stanford.edu/papers/texture-synthesis-sig00/texture.pdf. The basic idea is to seed the output Image with noise...
Implement the Python class `RasterPixelNeighbourhoodSynthesizer` described below. Class description: A RasterPixelNeighbourhoodSynthesizer object synthesizes textures using the algorithm from https://graphics.stanford.edu/papers/texture-synthesis-sig00/texture.pdf. The basic idea is to seed the output Image with noise...
7e7282698befd53383cbd6566039340babb0a289
<|skeleton|> class RasterPixelNeighbourhoodSynthesizer: """A RasterPixelNeighbourhoodSynthesizer object synthesizes textures using the algorithm from https://graphics.stanford.edu/papers/texture-synthesis-sig00/texture.pdf. The basic idea is to seed the output Image with noise from the source Image and then resolve...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RasterPixelNeighbourhoodSynthesizer: """A RasterPixelNeighbourhoodSynthesizer object synthesizes textures using the algorithm from https://graphics.stanford.edu/papers/texture-synthesis-sig00/texture.pdf. The basic idea is to seed the output Image with noise from the source Image and then resolve the pixels o...
the_stack_v2_python_sparse
sandbox/synthesizers/raster_pixel_neighbourhood_synthesizer.py
Mandrenkov/SVBRDF-Texture-Synthesis
train
3
2858c938ca3a0c39bdec654ba994f789328e59bb
[ "self.mins = mins\nself.maxs = maxs\nself.children = []", "for axis in range(3):\n if coord[axis] < self.mins[axis] or coord[axis] > self.maxs[axis]:\n return False\nreturn True", "for corner in itertools.product(*zip(self.mins, self.maxs)):\n if manhattan_dist(nanobot.coord, corner) > nanobot.r:\n...
<|body_start_0|> self.mins = mins self.maxs = maxs self.children = [] <|end_body_0|> <|body_start_1|> for axis in range(3): if coord[axis] < self.mins[axis] or coord[axis] > self.maxs[axis]: return False return True <|end_body_1|> <|body_start_2|> ...
Node in an octree
OctreeNode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OctreeNode: """Node in an octree""" def __init__(self, mins, maxs): """Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound""" <|body_0|> def in_node(self, coord): """Return True if coord is in this node""" <|body_1|> def n...
stack_v2_sparse_classes_10k_train_007619
8,665
permissive
[ { "docstring": "Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound", "name": "__init__", "signature": "def __init__(self, mins, maxs)" }, { "docstring": "Return True if coord is in this node", "name": "in_node", "signature": "def in_node(self, coord)" }, ...
4
stack_v2_sparse_classes_30k_train_003242
Implement the Python class `OctreeNode` described below. Class description: Node in an octree Method signatures and docstrings: - def __init__(self, mins, maxs): Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound - def in_node(self, coord): Return True if coord is in this node - def nanob...
Implement the Python class `OctreeNode` described below. Class description: Node in an octree Method signatures and docstrings: - def __init__(self, mins, maxs): Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound - def in_node(self, coord): Return True if coord is in this node - def nanob...
6671ef8c16a837f697bb3fb91004d1bd892814ba
<|skeleton|> class OctreeNode: """Node in an octree""" def __init__(self, mins, maxs): """Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound""" <|body_0|> def in_node(self, coord): """Return True if coord is in this node""" <|body_1|> def n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OctreeNode: """Node in an octree""" def __init__(self, mins, maxs): """Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound""" self.mins = mins self.maxs = maxs self.children = [] def in_node(self, coord): """Return True if coord is ...
the_stack_v2_python_sparse
2018/day23/challenge.py
ericgreveson/adventofcode
train
0
3e05973f6ac5ea06f6720404166b62a28046930a
[ "left = []\nself.rt = 0\n\ndef dfs(root, pos, level):\n if not root:\n return\n if len(left) < level + 1:\n left.append(pos)\n self.rt = max(self.rt, pos - left[level] + 1)\n dfs(root.left, pos * 2 + 1, level + 1)\n dfs(root.right, pos * 2 + 2, level + 1)\ndfs(root, 0, 0)\nreturn self.r...
<|body_start_0|> left = [] self.rt = 0 def dfs(root, pos, level): if not root: return if len(left) < level + 1: left.append(pos) self.rt = max(self.rt, pos - left[level] + 1) dfs(root.left, pos * 2 + 1, level + 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def widthOfBinaryTree_dfs(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def widthOfBinaryTree_bfs(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = [] self.rt =...
stack_v2_sparse_classes_10k_train_007620
1,553
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "widthOfBinaryTree_dfs", "signature": "def widthOfBinaryTree_dfs(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "widthOfBinaryTree_bfs", "signature": "def widthOfBinaryTree_bfs(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree_dfs(self, root): :type root: TreeNode :rtype: int - def widthOfBinaryTree_bfs(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree_dfs(self, root): :type root: TreeNode :rtype: int - def widthOfBinaryTree_bfs(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def widthOfBinaryTree_dfs(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def widthOfBinaryTree_bfs(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def widthOfBinaryTree_dfs(self, root): """:type root: TreeNode :rtype: int""" left = [] self.rt = 0 def dfs(root, pos, level): if not root: return if len(left) < level + 1: left.append(pos) self.rt =...
the_stack_v2_python_sparse
medium/tree/test_662_Maximum_Width_of_Binary_Tree.py
wuxu1019/leetcode_sophia
train
1
b9b2002d877d4ba901c817d04112a42d2e3d500f
[ "super(CTCModule, self).__init__()\nself.pred_output_position_inclu_blank = nn.LSTM(in_dim, out_seq_len + 1, num_layers=2, batch_first=True)\nself.out_seq_len = out_seq_len\nself.softmax = nn.Softmax(dim=2)", "pred_output_position_inclu_blank, _ = self.pred_output_position_inclu_blank(x)\nprob_pred_output_positio...
<|body_start_0|> super(CTCModule, self).__init__() self.pred_output_position_inclu_blank = nn.LSTM(in_dim, out_seq_len + 1, num_layers=2, batch_first=True) self.out_seq_len = out_seq_len self.softmax = nn.Softmax(dim=2) <|end_body_0|> <|body_start_1|> pred_output_position_inclu_...
CTCModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CTCModule: def __init__(self, in_dim, out_seq_len): """This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B""" <|body_0|> def forward(self, x): ...
stack_v2_sparse_classes_10k_train_007621
25,941
no_license
[ { "docstring": "This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B", "name": "__init__", "signature": "def __init__(self, in_dim, out_seq_len)" }, { "docstring": ":inp...
2
null
Implement the Python class `CTCModule` described below. Class description: Implement the CTCModule class. Method signatures and docstrings: - def __init__(self, in_dim, out_seq_len): This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_se...
Implement the Python class `CTCModule` described below. Class description: Implement the CTCModule class. Method signatures and docstrings: - def __init__(self, in_dim, out_seq_len): This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_se...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class CTCModule: def __init__(self, in_dim, out_seq_len): """This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B""" <|body_0|> def forward(self, x): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CTCModule: def __init__(self, in_dim, out_seq_len): """This module is performing alignment from A (e.g., audio) to B (e.g., text). :param in_dim: Dimension for input modality A :param out_seq_len: Sequence length for output modality B""" super(CTCModule, self).__init__() self.pred_outp...
the_stack_v2_python_sparse
generated/test_yaohungt_Multimodal_Transformer.py
jansel/pytorch-jit-paritybench
train
35
80d599a72b2874f7c907b3cc362274669670f885
[ "super().__init__(input_key, output_key)\nlambda_fn = lambda_fn or (lambda x: x)\nself.lambda_fn = functools.partial(lambda_fn, **kwargs)", "if self.input_key is not None:\n element = element[self.input_key]\noutput = self.lambda_fn(element)\nif self.output_key is not None:\n output = {self.output_key: outp...
<|body_start_0|> super().__init__(input_key, output_key) lambda_fn = lambda_fn or (lambda x: x) self.lambda_fn = functools.partial(lambda_fn, **kwargs) <|end_body_0|> <|body_start_1|> if self.input_key is not None: element = element[self.input_key] output = self.lamb...
Reader abstraction with an lambda encoders. Can read an elem from dataset and apply `encode_fn` function to it.
LambdaReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LambdaReader: """Reader abstraction with an lambda encoders. Can read an elem from dataset and apply `encode_fn` function to it.""" def __init__(self, input_key: str, output_key: Optional[str]=None, lambda_fn: Optional[Callable]=None, **kwargs): """Args: input_key: input key to use f...
stack_v2_sparse_classes_10k_train_007622
5,229
permissive
[ { "docstring": "Args: input_key: input key to use from annotation dict output_key: output key to use to store the result lambda_fn: encode function to use to prepare your data (for example convert chars/words/tokens to indices, etc) kwargs: kwargs for encode function", "name": "__init__", "signature": "...
2
stack_v2_sparse_classes_30k_train_005682
Implement the Python class `LambdaReader` described below. Class description: Reader abstraction with an lambda encoders. Can read an elem from dataset and apply `encode_fn` function to it. Method signatures and docstrings: - def __init__(self, input_key: str, output_key: Optional[str]=None, lambda_fn: Optional[Calla...
Implement the Python class `LambdaReader` described below. Class description: Reader abstraction with an lambda encoders. Can read an elem from dataset and apply `encode_fn` function to it. Method signatures and docstrings: - def __init__(self, input_key: str, output_key: Optional[str]=None, lambda_fn: Optional[Calla...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class LambdaReader: """Reader abstraction with an lambda encoders. Can read an elem from dataset and apply `encode_fn` function to it.""" def __init__(self, input_key: str, output_key: Optional[str]=None, lambda_fn: Optional[Callable]=None, **kwargs): """Args: input_key: input key to use f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LambdaReader: """Reader abstraction with an lambda encoders. Can read an elem from dataset and apply `encode_fn` function to it.""" def __init__(self, input_key: str, output_key: Optional[str]=None, lambda_fn: Optional[Callable]=None, **kwargs): """Args: input_key: input key to use from annotatio...
the_stack_v2_python_sparse
catalyst/contrib/data/reader.py
catalyst-team/catalyst
train
3,038
852d747b43a63cccaedfd6a77a1248f772c33014
[ "len_n, right_most = (len(nums), 0)\nfor i in range(len_n):\n if i <= right_most:\n right_most = max(nums[i] + i, right_most)\n if right_most >= len_n - 1:\n return True\nreturn False", "len_n = len(nums)\ndp = [False] * len_n\ndp[0] = True\nfor i in range(len_n):\n if dp[i]:\n ...
<|body_start_0|> len_n, right_most = (len(nums), 0) for i in range(len_n): if i <= right_most: right_most = max(nums[i] + i, right_most) if right_most >= len_n - 1: return True return False <|end_body_0|> <|body_start_1|> l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """执行用时: 52 ms , 在所有 Python3 提交中击败了 52.08% 的用户 内存消耗: 16 MB , 在所有 Python3 提交中击败了 73.49% 的用户""" <|body_0|> def canJump1(self, nums: List[int]) -> bool: """超时""" <|body_1|> def jump1(self, nums: List[int...
stack_v2_sparse_classes_10k_train_007623
4,093
no_license
[ { "docstring": "执行用时: 52 ms , 在所有 Python3 提交中击败了 52.08% 的用户 内存消耗: 16 MB , 在所有 Python3 提交中击败了 73.49% 的用户", "name": "canJump", "signature": "def canJump(self, nums: List[int]) -> bool" }, { "docstring": "超时", "name": "canJump1", "signature": "def canJump1(self, nums: List[int]) -> bool" ...
4
stack_v2_sparse_classes_30k_train_005577
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: 执行用时: 52 ms , 在所有 Python3 提交中击败了 52.08% 的用户 内存消耗: 16 MB , 在所有 Python3 提交中击败了 73.49% 的用户 - def canJump1(self, nums: List[int]) -> bool:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: 执行用时: 52 ms , 在所有 Python3 提交中击败了 52.08% 的用户 内存消耗: 16 MB , 在所有 Python3 提交中击败了 73.49% 的用户 - def canJump1(self, nums: List[int]) -> bool:...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """执行用时: 52 ms , 在所有 Python3 提交中击败了 52.08% 的用户 内存消耗: 16 MB , 在所有 Python3 提交中击败了 73.49% 的用户""" <|body_0|> def canJump1(self, nums: List[int]) -> bool: """超时""" <|body_1|> def jump1(self, nums: List[int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canJump(self, nums: List[int]) -> bool: """执行用时: 52 ms , 在所有 Python3 提交中击败了 52.08% 的用户 内存消耗: 16 MB , 在所有 Python3 提交中击败了 73.49% 的用户""" len_n, right_most = (len(nums), 0) for i in range(len_n): if i <= right_most: right_most = max(nums[i] + i, ri...
the_stack_v2_python_sparse
跳跃游戏1&2.py
nomboy/leetcode
train
0
f1e13f61e172db31f48c1bbaf280d7f24ffb5310
[ "import math\nfor i in range(int(math.sqrt(c)) + 1):\n left, right = (0, int(math.sqrt(c - i ** 2)) + 1)\n while left < right:\n mid = left + right >> 1\n res = mid ** 2 + i ** 2\n if res > c:\n right = mid - 1\n elif res == c:\n return True\n else:\n ...
<|body_start_0|> import math for i in range(int(math.sqrt(c)) + 1): left, right = (0, int(math.sqrt(c - i ** 2)) + 1) while left < right: mid = left + right >> 1 res = mid ** 2 + i ** 2 if res > c: right = mid - ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def judgeSquareSum(self, c: int) -> bool: """双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:""" <|body_0|> def judgeSquareSum2(self, c: int) -> bool: """双指针 :param c: :return:""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_10k_train_007624
1,521
no_license
[ { "docstring": "双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:", "name": "judgeSquareSum", "signature": "def judgeSquareSum(self, c: int) -> bool" }, { "docstring": "双指针 :param c: :return:", "name": "judgeSquareSum2", "signature": "def judgeSquareSum2(self, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum(self, c: int) -> bool: 双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return: - def judgeSquareSum2(self, c: int) -> bool: 双指针 :param c: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum(self, c: int) -> bool: 双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return: - def judgeSquareSum2(self, c: int) -> bool: 双指针 :param c: ...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def judgeSquareSum(self, c: int) -> bool: """双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:""" <|body_0|> def judgeSquareSum2(self, c: int) -> bool: """双指针 :param c: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def judgeSquareSum(self, c: int) -> bool: """双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:""" import math for i in range(int(math.sqrt(c)) + 1): left, right = (0, int(math.sqrt(c - i ** 2)) + 1) while left < right: ...
the_stack_v2_python_sparse
Interview_preparation/tencent/JudgeSquareSum.py
yinhuax/leet_code
train
0
bd771c814da2ec9ba4337f24a133ee01a51fccb8
[ "params = Parameters.instance().place_params\ntransmission = params['place_transmission']\nplace_idx = place.place_type.value - 1\ntry:\n num_groups = params['mean_group_size'][place_idx]\nexcept IndexError:\n num_groups = 1\nplace_inf = 0 if hasattr(infector.microcell, 'closure_start_time') and infector.is_p...
<|body_start_0|> params = Parameters.instance().place_params transmission = params['place_transmission'] place_idx = place.place_type.value - 1 try: num_groups = params['mean_group_size'][place_idx] except IndexError: num_groups = 1 place_inf = 0 i...
Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, within places.
PlaceInfection
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlaceInfection: """Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, within places.""" def place_inf(place, infector, time: float): """Calculate the infectiousness of a place. Does not include interventions such as isolation, or...
stack_v2_sparse_classes_10k_train_007625
6,023
permissive
[ { "docstring": "Calculate the infectiousness of a place. Does not include interventions such as isolation, or whether individual is a carehome resident. Does not yet differentiate between places as we have not decided which places to implement, and what transmission to give them. Parameters ---------- place : P...
3
stack_v2_sparse_classes_30k_train_005064
Implement the Python class `PlaceInfection` described below. Class description: Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, within places. Method signatures and docstrings: - def place_inf(place, infector, time: float): Calculate the infectiousness of a pl...
Implement the Python class `PlaceInfection` described below. Class description: Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, within places. Method signatures and docstrings: - def place_inf(place, infector, time: float): Calculate the infectiousness of a pl...
c11de122c6bfdf9103162e4045758808da5df322
<|skeleton|> class PlaceInfection: """Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, within places.""" def place_inf(place, infector, time: float): """Calculate the infectiousness of a place. Does not include interventions such as isolation, or...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PlaceInfection: """Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, within places.""" def place_inf(place, infector, time: float): """Calculate the infectiousness of a place. Does not include interventions such as isolation, or whether indi...
the_stack_v2_python_sparse
pyEpiabm/pyEpiabm/property/place_foi.py
SABS-R3-Epidemiology/epiabm
train
21
2810122f26f673f977042e805b49b7a230765355
[ "if not matrix or not matrix[0]:\n return\nrows, self.cols = (len(matrix), len(matrix[0]))\nfor r in range(rows):\n for c in range(1, self.cols):\n matrix[r][c] += matrix[r][c - 1]\nself.matrix = matrix", "prev = self.matrix[row][col]\nif col != 0:\n prev -= self.matrix[row][col - 1]\ndiff = val -...
<|body_start_0|> if not matrix or not matrix[0]: return rows, self.cols = (len(matrix), len(matrix[0])) for r in range(rows): for c in range(1, self.cols): matrix[r][c] += matrix[r][c - 1] self.matrix = matrix <|end_body_0|> <|body_start_1|> ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_10k_train_007626
1,888
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row: int :type col: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, row, col, val)" }, { "docstring": ":type r...
3
stack_v2_sparse_classes_30k_train_001178
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if not matrix or not matrix[0]: return rows, self.cols = (len(matrix), len(matrix[0])) for r in range(rows): for c in range(1, self.cols): matrix[r][c] += matrix[r...
the_stack_v2_python_sparse
python_1_to_1000/308_Range_Sum_Query_2D-Mutable.py
jakehoare/leetcode
train
58
c627d91b66216d6c8f763a0b794ca6667ebeed2e
[ "nums = sorted(nums)\nsize = len(nums)\ndiff = sys.maxsize\nfor i in range(2, size):\n remaining_target = target - nums[i]\n cur_diff = self.explore(nums, 0, i - 1, remaining_target)\n if abs(cur_diff) < abs(diff):\n diff = cur_diff\nreturn target - diff", "diff = sys.maxsize\nwhile left < right:\...
<|body_start_0|> nums = sorted(nums) size = len(nums) diff = sys.maxsize for i in range(2, size): remaining_target = target - nums[i] cur_diff = self.explore(nums, 0, i - 1, remaining_target) if abs(cur_diff) < abs(diff): diff = cur_dif...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def explore(self, nums, left, right, target): """return the smallest diff found (target - (nums[i] + nums[j]))""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k_train_007627
1,168
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest", "signature": "def threeSumClosest(self, nums, target)" }, { "docstring": "return the smallest diff found (target - (nums[i] + nums[j]))", "name": "explore", "signature": "def explore(self, nu...
2
stack_v2_sparse_classes_30k_train_003301
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def explore(self, nums, left, right, target): return the smallest diff found (targe...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def explore(self, nums, left, right, target): return the smallest diff found (targe...
78a8b27ee108ba93aa7b659665976112f48fc2c2
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def explore(self, nums, left, right, target): """return the smallest diff found (target - (nums[i] + nums[j]))""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" nums = sorted(nums) size = len(nums) diff = sys.maxsize for i in range(2, size): remaining_target = target - nums[i] cur_diff = self.expl...
the_stack_v2_python_sparse
companies/airbnb/p16/Solution.py
pololee/oj-leetcode
train
0
f0d86abd0b544c2067bcc2dadf9d6d615a2b08cd
[ "super(ItemThread, self).__init__(name=name)\nself.domain_name = domain_name\nself.conn = SDBConnection()\nself.item_names = item_names\nself.items = []", "for item_name in self.item_names:\n item = self.conn.get_attributes(self.domain_name, item_name)\n self.items.append(item)" ]
<|body_start_0|> super(ItemThread, self).__init__(name=name) self.domain_name = domain_name self.conn = SDBConnection() self.item_names = item_names self.items = [] <|end_body_0|> <|body_start_1|> for item_name in self.item_names: item = self.conn.get_attribu...
A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto.sdb.connection.ItemThread.run>` method...
ItemThread
[ "CC-BY-3.0", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "ZPL-2.0", "Unlicense", "LGPL-3.0-only", "CC0-1.0", "LicenseRef-scancode-other-permissive", "CNRI-Python", "LicenseRef-scancode-warranty-disclaimer", "GPL-2.0-or-later", "Python-2.0", "GPL-3.0...
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemThread: """A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto....
stack_v2_sparse_classes_10k_train_007628
26,088
permissive
[ { "docstring": ":param str name: A thread name. Used for identification. :param str domain_name: The name of a SimpleDB :class:`Domain <boto.sdb.domain.Domain>` :type item_names: string or list of strings :param item_names: The name(s) of the items to retrieve from the specified :class:`Domain <boto.sdb.domain....
2
stack_v2_sparse_classes_30k_train_002256
Implement the Python class `ItemThread` described below. Class description: A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will ...
Implement the Python class `ItemThread` described below. Class description: A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will ...
dccb9467675c67b9c3399fc76c5de6d31bfb8255
<|skeleton|> class ItemThread: """A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ItemThread: """A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto.sdb.connectio...
the_stack_v2_python_sparse
desktop/core/ext-py3/boto-2.49.0/boto/sdb/connection.py
cloudera/hue
train
5,655
513a297965d3db04bdbaf65093dd086512482eb4
[ "if head is None:\n return None\nslow = head.next\nif slow is None:\n return None\nfast = slow.next\nwhile slow is not None and fast is not None:\n if slow == fast:\n return fast\n slow = slow.next\n fast = fast.next\n if fast is not None:\n fast = fast.next\nreturn None", "meet_no...
<|body_start_0|> if head is None: return None slow = head.next if slow is None: return None fast = slow.next while slow is not None and fast is not None: if slow == fast: return fast slow = slow.next fast...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def meeting_node(self, head): """在链表存在环的前提下找到一快一慢指针相遇的结点, :param head: 链表的头结点 :return:""" <|body_0|> def entry_node_of_loop(self, head): """找到环的入口结点 :param head: 链表头结点 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head is Non...
stack_v2_sparse_classes_10k_train_007629
1,932
no_license
[ { "docstring": "在链表存在环的前提下找到一快一慢指针相遇的结点, :param head: 链表的头结点 :return:", "name": "meeting_node", "signature": "def meeting_node(self, head)" }, { "docstring": "找到环的入口结点 :param head: 链表头结点 :return:", "name": "entry_node_of_loop", "signature": "def entry_node_of_loop(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_001410
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def meeting_node(self, head): 在链表存在环的前提下找到一快一慢指针相遇的结点, :param head: 链表的头结点 :return: - def entry_node_of_loop(self, head): 找到环的入口结点 :param head: 链表头结点 :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def meeting_node(self, head): 在链表存在环的前提下找到一快一慢指针相遇的结点, :param head: 链表的头结点 :return: - def entry_node_of_loop(self, head): 找到环的入口结点 :param head: 链表头结点 :return: <|skeleton|> class...
51e6d72bfc631fa96e5a8ed6e4e55cd240ad47d9
<|skeleton|> class Solution: def meeting_node(self, head): """在链表存在环的前提下找到一快一慢指针相遇的结点, :param head: 链表的头结点 :return:""" <|body_0|> def entry_node_of_loop(self, head): """找到环的入口结点 :param head: 链表头结点 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def meeting_node(self, head): """在链表存在环的前提下找到一快一慢指针相遇的结点, :param head: 链表的头结点 :return:""" if head is None: return None slow = head.next if slow is None: return None fast = slow.next while slow is not None and fast is not None: ...
the_stack_v2_python_sparse
剑指Offer/23.链表中环的入口结点.py
CodingBuye/PythonForNowcoder
train
2
8b50a8804e58a0b95aac9e05e870fe0678a42afd
[ "if stanza_type is None:\n if element is None:\n raise ValueError('Missing iq type')\nelif stanza_type not in IQ_TYPES:\n raise ValueError('Bad iq type')\nif element is None and stanza_id is None and (stanza_type in ('get', 'set')):\n stanza_id = self.gen_id()\nif element is None:\n element = 'iq...
<|body_start_0|> if stanza_type is None: if element is None: raise ValueError('Missing iq type') elif stanza_type not in IQ_TYPES: raise ValueError('Bad iq type') if element is None and stanza_id is None and (stanza_type in ('get', 'set')): sta...
<message /> stanza class.
Iq
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Iq: """<message /> stanza class.""" def __init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None): """Initialize an `Iq` object. :Parameters: - `element`: XML element of this stanza. - `fro...
stack_v2_sparse_classes_10k_train_007630
6,218
permissive
[ { "docstring": "Initialize an `Iq` object. :Parameters: - `element`: XML element of this stanza. - `from_jid`: sender JID. - `to_jid`: recipient JID. - `stanza_type`: staza type: one of: \"get\", \"set\", \"response\" or \"error\". - `stanza_id`: stanza id -- value of stanza's \"id\" attribute. If not given, th...
5
stack_v2_sparse_classes_30k_train_000306
Implement the Python class `Iq` described below. Class description: <message /> stanza class. Method signatures and docstrings: - def __init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None): Initialize an `Iq` object. :Pa...
Implement the Python class `Iq` described below. Class description: <message /> stanza class. Method signatures and docstrings: - def __init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None): Initialize an `Iq` object. :Pa...
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
<|skeleton|> class Iq: """<message /> stanza class.""" def __init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None): """Initialize an `Iq` object. :Parameters: - `element`: XML element of this stanza. - `fro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Iq: """<message /> stanza class.""" def __init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None): """Initialize an `Iq` object. :Parameters: - `element`: XML element of this stanza. - `from_jid`: sende...
the_stack_v2_python_sparse
python3-alpha/python-libs/pyxmpp2/iq.py
kuri65536/python-for-android
train
280
9ac60113e50b2b027b65a49adebdea59f22d16e5
[ "try:\n runner_view, __ = self._get_producer(operation_type)\nexcept ValueError:\n return redirect('home')\nreturn runner_view(request, operation_type=operation_type, **kwargs)", "try:\n __, runner_cls = self._get_producer(action_type)\nexcept ValueError:\n return redirect('home')\nreturn runner_cls()...
<|body_start_0|> try: runner_view, __ = self._get_producer(operation_type) except ValueError: return redirect('home') return runner_view(request, operation_type=operation_type, **kwargs) <|end_body_0|> <|body_start_1|> try: __, runner_cls = self._get_...
Factory to manage scheduling of action runs. Producer stores a tuple with: - Class.as_view() for view processing - Class to execute other methods
ActionRunFactory
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionRunFactory: """Factory to manage scheduling of action runs. Producer stores a tuple with: - Class.as_view() for view processing - Class to execute other methods""" def process_request(self, request: http.HttpRequest, operation_type: int, **kwargs) -> http.HttpResponse: """Execu...
stack_v2_sparse_classes_10k_train_007631
7,115
permissive
[ { "docstring": "Execute function to process a run request. :param request: Http Request received (get or post) :param operation_type: Type of action being run. :param kwargs: Dictionary with action :return: HttpResponse", "name": "process_request", "signature": "def process_request(self, request: http.H...
2
stack_v2_sparse_classes_30k_train_003875
Implement the Python class `ActionRunFactory` described below. Class description: Factory to manage scheduling of action runs. Producer stores a tuple with: - Class.as_view() for view processing - Class to execute other methods Method signatures and docstrings: - def process_request(self, request: http.HttpRequest, o...
Implement the Python class `ActionRunFactory` described below. Class description: Factory to manage scheduling of action runs. Producer stores a tuple with: - Class.as_view() for view processing - Class to execute other methods Method signatures and docstrings: - def process_request(self, request: http.HttpRequest, o...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ActionRunFactory: """Factory to manage scheduling of action runs. Producer stores a tuple with: - Class.as_view() for view processing - Class to execute other methods""" def process_request(self, request: http.HttpRequest, operation_type: int, **kwargs) -> http.HttpResponse: """Execu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ActionRunFactory: """Factory to manage scheduling of action runs. Producer stores a tuple with: - Class.as_view() for view processing - Class to execute other methods""" def process_request(self, request: http.HttpRequest, operation_type: int, **kwargs) -> http.HttpResponse: """Execute function t...
the_stack_v2_python_sparse
ontask/action/services/run_factory.py
abelardopardo/ontask_b
train
43
32b1f1e35a1ebb6bf6cc9caba8c37ee4db8c757b
[ "self.filepath = filepath\nself.interval = interval\nself.verbose = verbose\nself.kmodel = kmodel\nself.total_steps = 0", "self.total_steps += 1\nif self.total_steps % self.interval != 0:\n return\nfilepath = self.filepath.format(step=self.total_steps, **logs)\nif self.verbose > 0:\n print('\\nStep {}: savi...
<|body_start_0|> self.filepath = filepath self.interval = interval self.verbose = verbose self.kmodel = kmodel self.total_steps = 0 <|end_body_0|> <|body_start_1|> self.total_steps += 1 if self.total_steps % self.interval != 0: return filepath...
ModelIntervalCheck
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelIntervalCheck: def __init__(self, filepath, interval, verbose=0, kmodel=None): """save every x steps""" <|body_0|> def on_step_end(self, step, logs={}): """Save weights at interval steps during training""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_007632
2,749
no_license
[ { "docstring": "save every x steps", "name": "__init__", "signature": "def __init__(self, filepath, interval, verbose=0, kmodel=None)" }, { "docstring": "Save weights at interval steps during training", "name": "on_step_end", "signature": "def on_step_end(self, step, logs={})" } ]
2
stack_v2_sparse_classes_30k_train_004988
Implement the Python class `ModelIntervalCheck` described below. Class description: Implement the ModelIntervalCheck class. Method signatures and docstrings: - def __init__(self, filepath, interval, verbose=0, kmodel=None): save every x steps - def on_step_end(self, step, logs={}): Save weights at interval steps duri...
Implement the Python class `ModelIntervalCheck` described below. Class description: Implement the ModelIntervalCheck class. Method signatures and docstrings: - def __init__(self, filepath, interval, verbose=0, kmodel=None): save every x steps - def on_step_end(self, step, logs={}): Save weights at interval steps duri...
a49eb348ff994f35b0efbbd5ac3ac8ae8ccb57d2
<|skeleton|> class ModelIntervalCheck: def __init__(self, filepath, interval, verbose=0, kmodel=None): """save every x steps""" <|body_0|> def on_step_end(self, step, logs={}): """Save weights at interval steps during training""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelIntervalCheck: def __init__(self, filepath, interval, verbose=0, kmodel=None): """save every x steps""" self.filepath = filepath self.interval = interval self.verbose = verbose self.kmodel = kmodel self.total_steps = 0 def on_step_end(self, step, logs=...
the_stack_v2_python_sparse
reinforcement_learning/0x01-deep_q_learning/train.py
salmenz/holbertonschool-machine_learning
train
4
bd06bad255a2b08ec7786dc1613d94c7874d2793
[ "self._episode_length = episode_length\nself._use_actions_for_distance = use_actions_for_distance\nself._vectorized_demonstrations = self._vectorize(demonstrations_it)\natom_dims = self._vectorized_demonstrations.shape[1]\nself._reward_sigma = beta * self._episode_length / np.sqrt(atom_dims)\nself._reward_scale = a...
<|body_start_0|> self._episode_length = episode_length self._use_actions_for_distance = use_actions_for_distance self._vectorized_demonstrations = self._vectorize(demonstrations_it) atom_dims = self._vectorized_demonstrations.shape[1] self._reward_sigma = beta * self._episode_len...
Computes PWIL rewards along a trajectory. The rewards measure similarity to the demonstration transitions and are based on a greedy approximation to the Wasserstein distance between trajectories.
WassersteinDistanceRewarder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WassersteinDistanceRewarder: """Computes PWIL rewards along a trajectory. The rewards measure similarity to the demonstration transitions and are based on a greedy approximation to the Wasserstein distance between trajectories.""" def __init__(self, demonstrations_it: Iterator[types.Transiti...
stack_v2_sparse_classes_10k_train_007633
6,140
permissive
[ { "docstring": "Initializes the rewarder. Args: demonstrations_it: An iterator over acme.types.Transition. episode_length: a target episode length (policies will be encouraged by the imitation reward to have that length). use_actions_for_distance: whether to use action to compute reward. alpha: float scaling th...
4
stack_v2_sparse_classes_30k_train_004686
Implement the Python class `WassersteinDistanceRewarder` described below. Class description: Computes PWIL rewards along a trajectory. The rewards measure similarity to the demonstration transitions and are based on a greedy approximation to the Wasserstein distance between trajectories. Method signatures and docstri...
Implement the Python class `WassersteinDistanceRewarder` described below. Class description: Computes PWIL rewards along a trajectory. The rewards measure similarity to the demonstration transitions and are based on a greedy approximation to the Wasserstein distance between trajectories. Method signatures and docstri...
97c50eaa62c039d8f4b9efa3e80c4d80e6f40c4c
<|skeleton|> class WassersteinDistanceRewarder: """Computes PWIL rewards along a trajectory. The rewards measure similarity to the demonstration transitions and are based on a greedy approximation to the Wasserstein distance between trajectories.""" def __init__(self, demonstrations_it: Iterator[types.Transiti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WassersteinDistanceRewarder: """Computes PWIL rewards along a trajectory. The rewards measure similarity to the demonstration transitions and are based on a greedy approximation to the Wasserstein distance between trajectories.""" def __init__(self, demonstrations_it: Iterator[types.Transition], episode_...
the_stack_v2_python_sparse
acme/agents/jax/pwil/rewarder.py
RaoulDrake/acme
train
0
5c34c03d9c7799f25d0266f603218f87ec677b3e
[ "super().__init__()\nself.layer_norm_att = normalization_class(size, **normalization_args)\nself.layer_norm_ffn = normalization_class(size, **normalization_args)\nself.att = SelfAttention(size, attention_size, context_size, block_id, num_blocks)\nself.dropout_att = torch.nn.Dropout(p=att_dropout_rate)\nself.ffn = F...
<|body_start_0|> super().__init__() self.layer_norm_att = normalization_class(size, **normalization_args) self.layer_norm_ffn = normalization_class(size, **normalization_args) self.att = SelfAttention(size, attention_size, context_size, block_id, num_blocks) self.dropout_att = to...
RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer class. normalization_args: Norma...
RWKV
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RWKV: """RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer ...
stack_v2_sparse_classes_10k_train_007634
2,602
permissive
[ { "docstring": "Construct a RWKV object.", "name": "__init__", "signature": "def __init__(self, size: int, linear_size: int, attention_size: int, context_size: int, block_id: int, num_blocks: int, normalization_class: torch.nn.Module=torch.nn.LayerNorm, normalization_args: Dict={}, att_dropout_rate: flo...
2
null
Implement the Python class `RWKV` described below. Class description: RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. no...
Implement the Python class `RWKV` described below. Class description: RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. no...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class RWKV: """RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RWKV: """RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer class. normal...
the_stack_v2_python_sparse
espnet2/asr_transducer/decoder/blocks/rwkv.py
espnet/espnet
train
7,242
fc7185e1a1f2145302ffafc4bffe2b5cb5a15e44
[ "if not self.base_directory.exists():\n raise TestConnectionError(f'Path: {self.base_directory.resolve()} does not exist.')\nif self.assets and test_assets:\n for asset in self.assets:\n asset.test_connection()", "if kwargs:\n raise TypeError(f'_build_data_connector() got unexpected keyword argume...
<|body_start_0|> if not self.base_directory.exists(): raise TestConnectionError(f'Path: {self.base_directory.resolve()} does not exist.') if self.assets and test_assets: for asset in self.assets: asset.test_connection() <|end_body_0|> <|body_start_1|> if ...
Pandas based Datasource for filesystem based data assets.
PandasFilesystemDatasource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PandasFilesystemDatasource: """Pandas based Datasource for filesystem based data assets.""" def test_connection(self, test_assets: bool=True) -> None: """Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatas...
stack_v2_sparse_classes_10k_train_007635
3,249
permissive
[ { "docstring": "Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatasource, whether to test them as well. Raises: TestConnectionError: If the connection test fails.", "name": "test_connection", "signature": "def test_connection...
2
null
Implement the Python class `PandasFilesystemDatasource` described below. Class description: Pandas based Datasource for filesystem based data assets. Method signatures and docstrings: - def test_connection(self, test_assets: bool=True) -> None: Test the connection for the PandasFilesystemDatasource. Args: test_assets...
Implement the Python class `PandasFilesystemDatasource` described below. Class description: Pandas based Datasource for filesystem based data assets. Method signatures and docstrings: - def test_connection(self, test_assets: bool=True) -> None: Test the connection for the PandasFilesystemDatasource. Args: test_assets...
b0290e2fd2aa05aec6d7d8871b91cb4478e9501d
<|skeleton|> class PandasFilesystemDatasource: """Pandas based Datasource for filesystem based data assets.""" def test_connection(self, test_assets: bool=True) -> None: """Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatas...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PandasFilesystemDatasource: """Pandas based Datasource for filesystem based data assets.""" def test_connection(self, test_assets: bool=True) -> None: """Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatasource, whethe...
the_stack_v2_python_sparse
great_expectations/datasource/fluent/pandas_filesystem_datasource.py
great-expectations/great_expectations
train
8,931
6d11d78fff02fb7571563af224e71110fffe64cf
[ "super(FuturesSession, self).__init__(*args, **kwargs)\nif executor is None:\n executor = ThreadPoolExecutor(max_workers=max_workers)\n if max_workers > DEFAULT_POOLSIZE:\n adapter_kwargs = dict(pool_connections=max_workers, pool_maxsize=max_workers)\n self.mount('https://', HTTPAdapter(**adapte...
<|body_start_0|> super(FuturesSession, self).__init__(*args, **kwargs) if executor is None: executor = ThreadPoolExecutor(max_workers=max_workers) if max_workers > DEFAULT_POOLSIZE: adapter_kwargs = dict(pool_connections=max_workers, pool_maxsize=max_workers) ...
FuturesSession
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuturesSession: def __init__(self, executor=None, max_workers=2, *args, **kwargs): """Creates a FuturesSession Notes ~~~~~ * ProcessPoolExecutor is not supported b/c Response objects are not picklable. * If you provide both `executor` and `max_workers`, the latter is ignored and provided...
stack_v2_sparse_classes_10k_train_007636
5,711
no_license
[ { "docstring": "Creates a FuturesSession Notes ~~~~~ * ProcessPoolExecutor is not supported b/c Response objects are not picklable. * If you provide both `executor` and `max_workers`, the latter is ignored and provided executor is used as is.", "name": "__init__", "signature": "def __init__(self, execut...
2
stack_v2_sparse_classes_30k_test_000350
Implement the Python class `FuturesSession` described below. Class description: Implement the FuturesSession class. Method signatures and docstrings: - def __init__(self, executor=None, max_workers=2, *args, **kwargs): Creates a FuturesSession Notes ~~~~~ * ProcessPoolExecutor is not supported b/c Response objects ar...
Implement the Python class `FuturesSession` described below. Class description: Implement the FuturesSession class. Method signatures and docstrings: - def __init__(self, executor=None, max_workers=2, *args, **kwargs): Creates a FuturesSession Notes ~~~~~ * ProcessPoolExecutor is not supported b/c Response objects ar...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class FuturesSession: def __init__(self, executor=None, max_workers=2, *args, **kwargs): """Creates a FuturesSession Notes ~~~~~ * ProcessPoolExecutor is not supported b/c Response objects are not picklable. * If you provide both `executor` and `max_workers`, the latter is ignored and provided...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FuturesSession: def __init__(self, executor=None, max_workers=2, *args, **kwargs): """Creates a FuturesSession Notes ~~~~~ * ProcessPoolExecutor is not supported b/c Response objects are not picklable. * If you provide both `executor` and `max_workers`, the latter is ignored and provided executor is u...
the_stack_v2_python_sparse
repoData/ross-requests-futures/allPythonContent.py
aCoffeeYin/pyreco
train
0
e04f4ba55e5799f7c6d4990e9c3306dc8d85cbf0
[ "def preorder(root):\n if not root:\n return ['null']\n return [str(root.val)] + preorder(root.left) + preorder(root.right)\nreturn '[' + ','.join(preorder(root)) + ']'", "arr = data[1:-1].split(',')\nself.index = 0\n\ndef construct():\n if arr[self.index] == 'null':\n self.index += 1\n ...
<|body_start_0|> def preorder(root): if not root: return ['null'] return [str(root.val)] + preorder(root.left) + preorder(root.right) return '[' + ','.join(preorder(root)) + ']' <|end_body_0|> <|body_start_1|> arr = data[1:-1].split(',') self.inde...
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_10k_train_007637
1,360
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_002163
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:...
19be0766f6b9c298fb32754f66416f79567843c1
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def preorder(root): if not root: return ['null'] return [str(root.val)] + preorder(root.left) + preorder(root.right) return '[' + ','.join...
the_stack_v2_python_sparse
leetcode/Problems/297--Serialize-and-Deserialize-Binary-Tree-Hard.py
niteesh2268/coding-prepation
train
0
2b51311d07af84be25efbf7608db02b427566682
[ "mocked_input_list = (n for n in command_list)\nprint_argument = 'Spam & Eggs'\n\ndef mocked_input(*_):\n return next(mocked_input_list)\nmocker.patch.object(mailroom, 'input', new=mocked_input)\nmocked_print = mocker.patch.object(mailroom, 'print')\nmocked_thank_you = mocker.patch.object(mailroom, 'thank_you', ...
<|body_start_0|> mocked_input_list = (n for n in command_list) print_argument = 'Spam & Eggs' def mocked_input(*_): return next(mocked_input_list) mocker.patch.object(mailroom, 'input', new=mocked_input) mocked_print = mocker.patch.object(mailroom, 'print') m...
Tests the mailroom.thank_you_cli function. Ensures that the user selection loop runs as expected __builtins__.input() is mocked to simulate user-interaction __builtins__.print() is mocked to simulate user-interaction
Test_Thank_You_CLI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_Thank_You_CLI: """Tests the mailroom.thank_you_cli function. Ensures that the user selection loop runs as expected __builtins__.input() is mocked to simulate user-interaction __builtins__.print() is mocked to simulate user-interaction""" def test_thank_you_cli_name_number(self, mocker, ...
stack_v2_sparse_classes_10k_train_007638
17,359
no_license
[ { "docstring": "Positive-Test-Cases", "name": "test_thank_you_cli_name_number", "signature": "def test_thank_you_cli_name_number(self, mocker, command_list)" }, { "docstring": "Positive-Test-Cases", "name": "test_thank_you_cli_list_quit", "signature": "def test_thank_you_cli_list_quit(se...
3
null
Implement the Python class `Test_Thank_You_CLI` described below. Class description: Tests the mailroom.thank_you_cli function. Ensures that the user selection loop runs as expected __builtins__.input() is mocked to simulate user-interaction __builtins__.print() is mocked to simulate user-interaction Method signatures...
Implement the Python class `Test_Thank_You_CLI` described below. Class description: Tests the mailroom.thank_you_cli function. Ensures that the user selection loop runs as expected __builtins__.input() is mocked to simulate user-interaction __builtins__.print() is mocked to simulate user-interaction Method signatures...
76224d0fb871d0bf0b838f3fccf01022edd70f82
<|skeleton|> class Test_Thank_You_CLI: """Tests the mailroom.thank_you_cli function. Ensures that the user selection loop runs as expected __builtins__.input() is mocked to simulate user-interaction __builtins__.print() is mocked to simulate user-interaction""" def test_thank_you_cli_name_number(self, mocker, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test_Thank_You_CLI: """Tests the mailroom.thank_you_cli function. Ensures that the user selection loop runs as expected __builtins__.input() is mocked to simulate user-interaction __builtins__.print() is mocked to simulate user-interaction""" def test_thank_you_cli_name_number(self, mocker, command_list)...
the_stack_v2_python_sparse
students/jerickson/Lesson6/test_mailroom.py
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
train
19
3d58f8291db8462e35e8f461da0100080a13a27c
[ "host = self._zapi.host.get({'output': 'extend', 'selectParentTemplates': ['name'], 'filter': {search_key: host_identifier}, 'selectInventory': host_inventory})\nif len(host) < 1:\n self._module.fail_json(msg='Host not found: %s' % host_identifier)\nelse:\n return host[0]", "output = 'extend'\ntriggers_list...
<|body_start_0|> host = self._zapi.host.get({'output': 'extend', 'selectParentTemplates': ['name'], 'filter': {search_key: host_identifier}, 'selectInventory': host_inventory}) if len(host) < 1: self._module.fail_json(msg='Host not found: %s' % host_identifier) else: retu...
Host
[ "MIT", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Host: def get_host(self, host_identifier, host_inventory, search_key): """Get host by hostname|visible_name|hostid""" <|body_0|> def get_triggers_by_host_id_in_problem_state(self, host_id, trigger_severity): """Get triggers in problem state from a hostid""" <...
stack_v2_sparse_classes_10k_train_007639
10,249
permissive
[ { "docstring": "Get host by hostname|visible_name|hostid", "name": "get_host", "signature": "def get_host(self, host_identifier, host_inventory, search_key)" }, { "docstring": "Get triggers in problem state from a hostid", "name": "get_triggers_by_host_id_in_problem_state", "signature": ...
3
null
Implement the Python class `Host` described below. Class description: Implement the Host class. Method signatures and docstrings: - def get_host(self, host_identifier, host_inventory, search_key): Get host by hostname|visible_name|hostid - def get_triggers_by_host_id_in_problem_state(self, host_id, trigger_severity):...
Implement the Python class `Host` described below. Class description: Implement the Host class. Method signatures and docstrings: - def get_host(self, host_identifier, host_inventory, search_key): Get host by hostname|visible_name|hostid - def get_triggers_by_host_id_in_problem_state(self, host_id, trigger_severity):...
2ea7d4f00212f502bc684ac257371ada73da1ca9
<|skeleton|> class Host: def get_host(self, host_identifier, host_inventory, search_key): """Get host by hostname|visible_name|hostid""" <|body_0|> def get_triggers_by_host_id_in_problem_state(self, host_id, trigger_severity): """Get triggers in problem state from a hostid""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Host: def get_host(self, host_identifier, host_inventory, search_key): """Get host by hostname|visible_name|hostid""" host = self._zapi.host.get({'output': 'extend', 'selectParentTemplates': ['name'], 'filter': {search_key: host_identifier}, 'selectInventory': host_inventory}) if len(h...
the_stack_v2_python_sparse
intro-ansible/venv3/lib/python3.8/site-packages/ansible_collections/community/zabbix/plugins/modules/zabbix_host_events_info.py
SimonFangCisco/dne-dna-code
train
0
320fdc1518fb6449ed3f8f9856ea07816755a960
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EdiscoveryExportOperation()", "from .case_operation import CaseOperation\nfrom .ediscovery_review_set import EdiscoveryReviewSet\nfrom .ediscovery_review_set_query import EdiscoveryReviewSetQuery\nfrom .export_file_metadata import Expo...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return EdiscoveryExportOperation() <|end_body_0|> <|body_start_1|> from .case_operation import CaseOperation from .ediscovery_review_set import EdiscoveryReviewSet from .ediscovery_revi...
EdiscoveryExportOperation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdiscoveryExportOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoveryExportOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and c...
stack_v2_sparse_classes_10k_train_007640
4,962
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: EdiscoveryExportOperation", "name": "create_from_discriminator_value", "signature": "def create_from_discrim...
3
stack_v2_sparse_classes_30k_val_000371
Implement the Python class `EdiscoveryExportOperation` described below. Class description: Implement the EdiscoveryExportOperation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoveryExportOperation: Creates a new instance of the appropriat...
Implement the Python class `EdiscoveryExportOperation` described below. Class description: Implement the EdiscoveryExportOperation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoveryExportOperation: Creates a new instance of the appropriat...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class EdiscoveryExportOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoveryExportOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EdiscoveryExportOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoveryExportOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
the_stack_v2_python_sparse
msgraph/generated/models/security/ediscovery_export_operation.py
microsoftgraph/msgraph-sdk-python
train
135
548bd0c95c9774f2920849080ee3229c9b8cf9ad
[ "q = deque([root])\nlev = 0\nwhile q:\n nxt = deque()\n filled = True\n n = len(q)\n for i in range(len(q)):\n node = q.popleft()\n if node.left:\n if not filled:\n return False\n nxt.append(node.left)\n else:\n filled = False\n ...
<|body_start_0|> q = deque([root]) lev = 0 while q: nxt = deque() filled = True n = len(q) for i in range(len(q)): node = q.popleft() if node.left: if not filled: return Fa...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isCompleteTree(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isCompleteTreeAC(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> q = deque([root]) lev = 0 ...
stack_v2_sparse_classes_10k_train_007641
2,907
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isCompleteTree", "signature": "def isCompleteTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isCompleteTreeAC", "signature": "def isCompleteTreeAC(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root): :type root: TreeNode :rtype: bool - def isCompleteTreeAC(self, root): :type root: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root): :type root: TreeNode :rtype: bool - def isCompleteTreeAC(self, root): :type root: TreeNode :rtype: bool <|skeleton|> class Solution: def isC...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def isCompleteTree(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isCompleteTreeAC(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isCompleteTree(self, root): """:type root: TreeNode :rtype: bool""" q = deque([root]) lev = 0 while q: nxt = deque() filled = True n = len(q) for i in range(len(q)): node = q.popleft() ...
the_stack_v2_python_sparse
C/CheckCompletenessofaBinaryTree.py
bssrdf/pyleet
train
2
e8c339aa2d79fc5be8e4267acd9b40b784f4382b
[ "def rserialize(root, s):\n if not root:\n s += 'null,'\n return s\n s += '{},'.format(root.val)\n s = rserialize(root.left, s)\n s = rserialize(root.right, s)\n return s\nreturn rserialize(root, '')", "l = []\n_tmp = data.split(',')\nfor item in _tmp:\n if item:\n l.append(...
<|body_start_0|> def rserialize(root, s): if not root: s += 'null,' return s s += '{},'.format(root.val) s = rserialize(root.left, s) s = rserialize(root.right, s) return s return rserialize(root, '') <|end_body_...
Codec
[ "Apache-2.0" ]
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_10k_train_007642
1,475
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_004387
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:...
ad5e724d20a8492b8eba03fc0f24e4ff5964b3ea
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def rserialize(root, s): if not root: s += 'null,' return s s += '{},'.format(root.val) s = rserialize(root.left, s) ...
the_stack_v2_python_sparse
dailyQuestion/2020/2020-06/06-15/python/solution_dfs.py
russellgao/algorithm
train
3
07c50ab56308c6a681a4d6a999190e9b85907a60
[ "q = [(-nums[i], i) for i in range(k)]\nheapq.heapify(q)\nret = [-q[0][0]]\nfor i in range(k, len(nums)):\n while q and q[0][1] <= i - k:\n heapq.heappop(q)\n heapq.heappush(q, (-nums[i], i))\n ret.append(-q[0][0])\nreturn ret", "if k == 1:\n return nums\nif k == len(nums):\n return [max(num...
<|body_start_0|> q = [(-nums[i], i) for i in range(k)] heapq.heapify(q) ret = [-q[0][0]] for i in range(k, len(nums)): while q and q[0][1] <= i - k: heapq.heappop(q) heapq.heappush(q, (-nums[i], i)) ret.append(-q[0][0]) return r...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow2(self, nums: List[int], k: int) -> List[int]: """Use python heapq Runtime: 1976 ms, faster than 43.70% Memory Usage: 39 MB, less than 5.23% 1 <= nums.length <= 10^5 -10^4 <= nums[i] <= 10^4 1 <= k <= nums.length :param nums: :param k: :return:""" <|...
stack_v2_sparse_classes_10k_train_007643
2,696
permissive
[ { "docstring": "Use python heapq Runtime: 1976 ms, faster than 43.70% Memory Usage: 39 MB, less than 5.23% 1 <= nums.length <= 10^5 -10^4 <= nums[i] <= 10^4 1 <= k <= nums.length :param nums: :param k: :return:", "name": "maxSlidingWindow2", "signature": "def maxSlidingWindow2(self, nums: List[int], k: ...
2
stack_v2_sparse_classes_30k_train_007106
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow2(self, nums: List[int], k: int) -> List[int]: Use python heapq Runtime: 1976 ms, faster than 43.70% Memory Usage: 39 MB, less than 5.23% 1 <= nums.length <= ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow2(self, nums: List[int], k: int) -> List[int]: Use python heapq Runtime: 1976 ms, faster than 43.70% Memory Usage: 39 MB, less than 5.23% 1 <= nums.length <= ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def maxSlidingWindow2(self, nums: List[int], k: int) -> List[int]: """Use python heapq Runtime: 1976 ms, faster than 43.70% Memory Usage: 39 MB, less than 5.23% 1 <= nums.length <= 10^5 -10^4 <= nums[i] <= 10^4 1 <= k <= nums.length :param nums: :param k: :return:""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxSlidingWindow2(self, nums: List[int], k: int) -> List[int]: """Use python heapq Runtime: 1976 ms, faster than 43.70% Memory Usage: 39 MB, less than 5.23% 1 <= nums.length <= 10^5 -10^4 <= nums[i] <= 10^4 1 <= k <= nums.length :param nums: :param k: :return:""" q = [(-nums[i], ...
the_stack_v2_python_sparse
src/todo/239-SlidingWindowMaximum.py
Jiezhi/myleetcode
train
1
6c952ce6ef498b3213542d60cb26c72a2df90e6d
[ "self.X = X\nself.fs = fs\nself.N = 2 * (len(self.X) - 1)", "x = np.zeros(self.N)\nfor n in range(self.N):\n x[n] = 1 / np.sqrt(self.N) * self.X[0] * np.exp(1j * 2 * cmath.pi * 0 * n / self.N)\n for k in range(1, int(self.N / 2)):\n x[n] = x[n] + 1 / np.sqrt(self.N) * self.X[k] * np.exp(1j * 2 * cmat...
<|body_start_0|> self.X = X self.fs = fs self.N = 2 * (len(self.X) - 1) <|end_body_0|> <|body_start_1|> x = np.zeros(self.N) for n in range(self.N): x[n] = 1 / np.sqrt(self.N) * self.X[0] * np.exp(1j * 2 * cmath.pi * 0 * n / self.N) for k in range(1, int(...
idft Inverse Discrete Fourier transform.
idft_p11
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class idft_p11: """idft Inverse Discrete Fourier transform.""" def __init__(self, X, fs): """:param X: Input DFT X :param fs: Input integer fs contains the sample frequency""" <|body_0|> def solve(self): """\\\\\\ METHOD: Compute the iDFT with truncated N/2+1 coefficie...
stack_v2_sparse_classes_10k_train_007644
25,417
no_license
[ { "docstring": ":param X: Input DFT X :param fs: Input integer fs contains the sample frequency", "name": "__init__", "signature": "def __init__(self, X, fs)" }, { "docstring": "\\\\\\\\\\\\ METHOD: Compute the iDFT with truncated N/2+1 coefficients :return iDFT x of duration N from partial DFT ...
2
stack_v2_sparse_classes_30k_train_002343
Implement the Python class `idft_p11` described below. Class description: idft Inverse Discrete Fourier transform. Method signatures and docstrings: - def __init__(self, X, fs): :param X: Input DFT X :param fs: Input integer fs contains the sample frequency - def solve(self): \\\\\\ METHOD: Compute the iDFT with trun...
Implement the Python class `idft_p11` described below. Class description: idft Inverse Discrete Fourier transform. Method signatures and docstrings: - def __init__(self, X, fs): :param X: Input DFT X :param fs: Input integer fs contains the sample frequency - def solve(self): \\\\\\ METHOD: Compute the iDFT with trun...
b72322cfc6d81c996117cea2160ee312da62d3ed
<|skeleton|> class idft_p11: """idft Inverse Discrete Fourier transform.""" def __init__(self, X, fs): """:param X: Input DFT X :param fs: Input integer fs contains the sample frequency""" <|body_0|> def solve(self): """\\\\\\ METHOD: Compute the iDFT with truncated N/2+1 coefficie...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class idft_p11: """idft Inverse Discrete Fourier transform.""" def __init__(self, X, fs): """:param X: Input DFT X :param fs: Input integer fs contains the sample frequency""" self.X = X self.fs = fs self.N = 2 * (len(self.X) - 1) def solve(self): """\\\\\\ METHOD: ...
the_stack_v2_python_sparse
Inverse Discrete Fourier Transform/iDFT_main.py
FG-14/Signals-and-Information-Processing-DSP-
train
0
3c5ccabd61ebb30610d25a6c995ccbfc4b730de5
[ "pytest.importorskip('pysteps')\nshape = (30, 30)\nearlier_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_precipitation_rate', units='m s-1', time=datetime(2018, 2, 20, 4, 15))\nlater_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_precipitation_rate', units='m s-1', time=...
<|body_start_0|> pytest.importorskip('pysteps') shape = (30, 30) earlier_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_precipitation_rate', units='m s-1', time=datetime(2018, 2, 20, 4, 15)) later_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_...
Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.
Test_generate_advection_velocities_from_winds
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_generate_advection_velocities_from_winds: """Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.""" def setUp(self): """Set up test input cubes""" <|...
stack_v2_sparse_classes_10k_train_007645
5,214
permissive
[ { "docstring": "Set up test input cubes", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test function returns a cubelist with the expected components", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test output time coordinates a...
4
stack_v2_sparse_classes_30k_train_006436
Implement the Python class `Test_generate_advection_velocities_from_winds` described below. Class description: Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only. Method signatures and docstrings:...
Implement the Python class `Test_generate_advection_velocities_from_winds` described below. Class description: Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only. Method signatures and docstrings:...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_generate_advection_velocities_from_winds: """Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.""" def setUp(self): """Set up test input cubes""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test_generate_advection_velocities_from_winds: """Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.""" def setUp(self): """Set up test input cubes""" pytest.importor...
the_stack_v2_python_sparse
improver_tests/nowcasting/optical_flow/test_generate_advection_velocities_from_winds.py
metoppv/improver
train
101
2ac79297d833e31d205c61d8eb0ecbc295ee55b7
[ "datas1 = []\ndatas2 = []\nfor data in datas:\n dataF = FilterData.filterFunction_key_words(data)\n if dataF != None:\n datas1.append(dataF)\n else:\n datas2.append(data)\nreturn (datas1, datas2)", "datas1 = []\ndatas2 = []\nfor data in datas:\n dataF = FilterData.filterFunction_site(dat...
<|body_start_0|> datas1 = [] datas2 = [] for data in datas: dataF = FilterData.filterFunction_key_words(data) if dataF != None: datas1.append(dataF) else: datas2.append(data) return (datas1, datas2) <|end_body_0|> <|bod...
DataCuter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" <|body_0|> def dataCuterBySite(self, datas): """位置过滤器""" <|body_1|> <|end_skeleton|> <|body_start_0|> datas1 = [] datas2 = [] for data in datas: dataF = FilterData....
stack_v2_sparse_classes_10k_train_007646
899
no_license
[ { "docstring": "关键词过滤器", "name": "dataCuterByKey", "signature": "def dataCuterByKey(self, datas)" }, { "docstring": "位置过滤器", "name": "dataCuterBySite", "signature": "def dataCuterBySite(self, datas)" } ]
2
stack_v2_sparse_classes_30k_test_000201
Implement the Python class `DataCuter` described below. Class description: Implement the DataCuter class. Method signatures and docstrings: - def dataCuterByKey(self, datas): 关键词过滤器 - def dataCuterBySite(self, datas): 位置过滤器
Implement the Python class `DataCuter` described below. Class description: Implement the DataCuter class. Method signatures and docstrings: - def dataCuterByKey(self, datas): 关键词过滤器 - def dataCuterBySite(self, datas): 位置过滤器 <|skeleton|> class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" ...
5eda21e66f65dd6f7f79e56441073bdcb7f18bdf
<|skeleton|> class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" <|body_0|> def dataCuterBySite(self, datas): """位置过滤器""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" datas1 = [] datas2 = [] for data in datas: dataF = FilterData.filterFunction_key_words(data) if dataF != None: datas1.append(dataF) else: datas2.append(d...
the_stack_v2_python_sparse
clientScrapySystem/DataFilterSystem/src/tool/DataCuter.py
jhfwb/Web-spiders
train
0
0bc268e0959ebd52db661aadc09388190f61175c
[ "super(BasicLinker, self).__init__()\nself.config = config\nself.encoder = encoder\nself.entity_embeddings = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nself.relu = nn.ReLU()", "context_representation_affined = self.encoder(padded_left_contexts, left_context_lens, padded_right_contexts, righ...
<|body_start_0|> super(BasicLinker, self).__init__() self.config = config self.encoder = encoder self.entity_embeddings = nn.Embedding(self.config.entity_size, self.config.embedding_dim) self.relu = nn.ReLU() <|end_body_0|> <|body_start_1|> context_representation_affined...
BasicLinker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicLinker: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, padded_left_contexts, left_context_lens, padded_right_contexts,...
stack_v2_sparse_classes_10k_train_007647
42,719
permissive
[ { "docstring": ":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions", "name": "__init__", "signature": "def __init__(self, config, encoder)" }, { "docstring": ":param mention: A mention object :return: unnormalized log pr...
2
stack_v2_sparse_classes_30k_train_006386
Implement the Python class `BasicLinker` described below. Class description: Implement the BasicLinker class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions - def fo...
Implement the Python class `BasicLinker` described below. Class description: Implement the BasicLinker class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions - def fo...
6a7dcd7d3756327c61ef949e5b4f6af6e2849187
<|skeleton|> class BasicLinker: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, padded_left_contexts, left_context_lens, padded_right_contexts,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BasicLinker: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" super(BasicLinker, self).__init__() self.config = config self.encoder = encoder self.en...
the_stack_v2_python_sparse
typenet/src/model.py
dhruvdcoder/dl-with-constraints
train
0
b4e0bf1f4f27cd4638cd77fd5aa0efdf7ace359f
[ "if not s:\n return True\nidx = t.find(s[0])\nt = t[idx:]\nm, n = (len(s), len(t))\ndp = [[False] * (n + 1) for _ in range(m + 1)]\ndp[0][0] = True\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n dp[i][j] = dp[i - 1][j - 1] or dp[i][j - 1] if s[i - 1] == t[j - 1] else dp[i][j - 1]\nreturn dp[-...
<|body_start_0|> if not s: return True idx = t.find(s[0]) t = t[idx:] m, n = (len(s), len(t)) dp = [[False] * (n + 1) for _ in range(m + 1)] dp[0][0] = True for i in range(1, m + 1): for j in range(1, n + 1): dp[i][j] = dp[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSubsequence(self, s: str, t: str) -> bool: """先找出t中第一个s[0]出现的位置idx t=t[idx:] dp[i][j] 表示s前i个字符和t前j个字符是否匹配 abc ajhbdbc dp[i][j] =dp[i-1_最短回文串.py][j-1_最短回文串.py] or dp[i][j-1_最短回文串.py] if s[i-1_最短回文串.py]==t[j-1_最短回文串.py] =dp[i][j-1_最短回文串.py] dp[0][j] = False dp[i][0] = False...
stack_v2_sparse_classes_10k_train_007648
2,070
no_license
[ { "docstring": "先找出t中第一个s[0]出现的位置idx t=t[idx:] dp[i][j] 表示s前i个字符和t前j个字符是否匹配 abc ajhbdbc dp[i][j] =dp[i-1_最短回文串.py][j-1_最短回文串.py] or dp[i][j-1_最短回文串.py] if s[i-1_最短回文串.py]==t[j-1_最短回文串.py] =dp[i][j-1_最短回文串.py] dp[0][j] = False dp[i][0] = False dp[0][0] = True res = dp[-1_最短回文串.py][-1_最短回文串.py]", "name": "isS...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubsequence(self, s: str, t: str) -> bool: 先找出t中第一个s[0]出现的位置idx t=t[idx:] dp[i][j] 表示s前i个字符和t前j个字符是否匹配 abc ajhbdbc dp[i][j] =dp[i-1_最短回文串.py][j-1_最短回文串.py] or dp[i][j-1_最短回...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubsequence(self, s: str, t: str) -> bool: 先找出t中第一个s[0]出现的位置idx t=t[idx:] dp[i][j] 表示s前i个字符和t前j个字符是否匹配 abc ajhbdbc dp[i][j] =dp[i-1_最短回文串.py][j-1_最短回文串.py] or dp[i][j-1_最短回...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def isSubsequence(self, s: str, t: str) -> bool: """先找出t中第一个s[0]出现的位置idx t=t[idx:] dp[i][j] 表示s前i个字符和t前j个字符是否匹配 abc ajhbdbc dp[i][j] =dp[i-1_最短回文串.py][j-1_最短回文串.py] or dp[i][j-1_最短回文串.py] if s[i-1_最短回文串.py]==t[j-1_最短回文串.py] =dp[i][j-1_最短回文串.py] dp[0][j] = False dp[i][0] = False...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isSubsequence(self, s: str, t: str) -> bool: """先找出t中第一个s[0]出现的位置idx t=t[idx:] dp[i][j] 表示s前i个字符和t前j个字符是否匹配 abc ajhbdbc dp[i][j] =dp[i-1_最短回文串.py][j-1_最短回文串.py] or dp[i][j-1_最短回文串.py] if s[i-1_最短回文串.py]==t[j-1_最短回文串.py] =dp[i][j-1_最短回文串.py] dp[0][j] = False dp[i][0] = False dp[0][0] = Tr...
the_stack_v2_python_sparse
4_LEETCODE/2_DP/字符串匹配问题/392_判断子序列.py
fzingithub/SwordRefers2Offer
train
1
48c24ab6ba1f56814b406a9ddbcdf1235913f441
[ "msg = cast(DefaultMessage, msg)\ndefault_msg = default_pb2.DefaultMessage()\ndefault_msg.message_id = msg.message_id\ndialogue_reference = msg.dialogue_reference\ndefault_msg.dialogue_starter_reference = dialogue_reference[0]\ndefault_msg.dialogue_responder_reference = dialogue_reference[1]\ndefault_msg.target = m...
<|body_start_0|> msg = cast(DefaultMessage, msg) default_msg = default_pb2.DefaultMessage() default_msg.message_id = msg.message_id dialogue_reference = msg.dialogue_reference default_msg.dialogue_starter_reference = dialogue_reference[0] default_msg.dialogue_responder_re...
Serialization for the 'default' protocol.
DefaultSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultSerializer: """Serialization for the 'default' protocol.""" def encode(msg: Message) -> bytes: """Encode a 'Default' message into bytes. :param msg: the message object. :return: the bytes.""" <|body_0|> def decode(obj: bytes) -> Message: """Decode bytes in...
stack_v2_sparse_classes_10k_train_007649
4,510
permissive
[ { "docstring": "Encode a 'Default' message into bytes. :param msg: the message object. :return: the bytes.", "name": "encode", "signature": "def encode(msg: Message) -> bytes" }, { "docstring": "Decode bytes into a 'Default' message. :param obj: the bytes object. :return: the 'Default' message."...
2
stack_v2_sparse_classes_30k_train_000865
Implement the Python class `DefaultSerializer` described below. Class description: Serialization for the 'default' protocol. Method signatures and docstrings: - def encode(msg: Message) -> bytes: Encode a 'Default' message into bytes. :param msg: the message object. :return: the bytes. - def decode(obj: bytes) -> Mes...
Implement the Python class `DefaultSerializer` described below. Class description: Serialization for the 'default' protocol. Method signatures and docstrings: - def encode(msg: Message) -> bytes: Encode a 'Default' message into bytes. :param msg: the message object. :return: the bytes. - def decode(obj: bytes) -> Mes...
6411fcba8af2cdf55a3005939ae8129df92e8c3e
<|skeleton|> class DefaultSerializer: """Serialization for the 'default' protocol.""" def encode(msg: Message) -> bytes: """Encode a 'Default' message into bytes. :param msg: the message object. :return: the bytes.""" <|body_0|> def decode(obj: bytes) -> Message: """Decode bytes in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DefaultSerializer: """Serialization for the 'default' protocol.""" def encode(msg: Message) -> bytes: """Encode a 'Default' message into bytes. :param msg: the message object. :return: the bytes.""" msg = cast(DefaultMessage, msg) default_msg = default_pb2.DefaultMessage() ...
the_stack_v2_python_sparse
aea/protocols/default/serialization.py
ejfitzgerald/agents-aea
train
0
62e1b3920cfb42c82371c959dcab2fee493d3d9a
[ "self.n_rows = n_rows\nself.n_cols = n_cols\nself.num = []\nfor i in range(n_rows):\n self.num.append([0] * n_cols)", "sum_num = sum((sum(i) for i in self.num))\nif sum_num == self.n_rows * self.n_cols:\n return\nimport random\nwhile True:\n x = random.randint(0, self.n_rows - 1)\n y = random.randint(...
<|body_start_0|> self.n_rows = n_rows self.n_cols = n_cols self.num = [] for i in range(n_rows): self.num.append([0] * n_cols) <|end_body_0|> <|body_start_1|> sum_num = sum((sum(i) for i in self.num)) if sum_num == self.n_rows * self.n_cols: retur...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def __init__(self, n_rows, n_cols): """:type n_rows: int :type n_cols: int""" <|body_0|> def flip(self): """:rtype: List[int]""" <|body_1|> def reset(self): """:rtype: None""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_007650
1,777
no_license
[ { "docstring": ":type n_rows: int :type n_cols: int", "name": "__init__", "signature": "def __init__(self, n_rows, n_cols)" }, { "docstring": ":rtype: List[int]", "name": "flip", "signature": "def flip(self)" }, { "docstring": ":rtype: None", "name": "reset", "signature":...
3
stack_v2_sparse_classes_30k_val_000203
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def __init__(self, n_rows, n_cols): :type n_rows: int :type n_cols: int - def flip(self): :rtype: List[int] - def reset(self): :rtype: None
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def __init__(self, n_rows, n_cols): :type n_rows: int :type n_cols: int - def flip(self): :rtype: List[int] - def reset(self): :rtype: None <|skeleton|> class Solution1: ...
176cc1db3291843fb068f06d0180766dd8c3122c
<|skeleton|> class Solution1: def __init__(self, n_rows, n_cols): """:type n_rows: int :type n_cols: int""" <|body_0|> def flip(self): """:rtype: List[int]""" <|body_1|> def reset(self): """:rtype: None""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution1: def __init__(self, n_rows, n_cols): """:type n_rows: int :type n_cols: int""" self.n_rows = n_rows self.n_cols = n_cols self.num = [] for i in range(n_rows): self.num.append([0] * n_cols) def flip(self): """:rtype: List[int]""" ...
the_stack_v2_python_sparse
2019/sampling/random_flip_matrix_519.py
yehongyu/acode
train
0
79018f99c43d9acb3717d20a86edbd2675c4c362
[ "super(SubGraphLayer, self).__init__()\nself.mlp_input_size = feature_length\nself.mlp_output_size = feature_length\nself.hidden_size = 64\nself.node_encoder = nn.Sequential(nn.Linear(self.mlp_input_size, self.hidden_size), nn.LayerNorm(self.hidden_size), nn.ReLU(True), nn.Linear(self.hidden_size, self.mlp_output_s...
<|body_start_0|> super(SubGraphLayer, self).__init__() self.mlp_input_size = feature_length self.mlp_output_size = feature_length self.hidden_size = 64 self.node_encoder = nn.Sequential(nn.Linear(self.mlp_input_size, self.hidden_size), nn.LayerNorm(self.hidden_size), nn.ReLU(True...
One layer of subgraph, include the MLP of g_enc. The calculation detail in this paper's 3.2 section. Input some vectors with 'feature_length' length, the output's length is '2*feature_length'(because of concat operator).
SubGraphLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubGraphLayer: """One layer of subgraph, include the MLP of g_enc. The calculation detail in this paper's 3.2 section. Input some vectors with 'feature_length' length, the output's length is '2*feature_length'(because of concat operator).""" def __init__(self, feature_length): """:pa...
stack_v2_sparse_classes_10k_train_007651
3,612
no_license
[ { "docstring": ":param feature_length: the length of input vector.", "name": "__init__", "signature": "def __init__(self, feature_length)" }, { "docstring": ":param x: A number of vectors. x.shape = [batch size, vNumber, feature_length] :return: All processed vectors with shape [batch size, vNum...
2
stack_v2_sparse_classes_30k_test_000300
Implement the Python class `SubGraphLayer` described below. Class description: One layer of subgraph, include the MLP of g_enc. The calculation detail in this paper's 3.2 section. Input some vectors with 'feature_length' length, the output's length is '2*feature_length'(because of concat operator). Method signatures ...
Implement the Python class `SubGraphLayer` described below. Class description: One layer of subgraph, include the MLP of g_enc. The calculation detail in this paper's 3.2 section. Input some vectors with 'feature_length' length, the output's length is '2*feature_length'(because of concat operator). Method signatures ...
0a314f7bdfc6db0247c92bc2c5c3806fdd18b885
<|skeleton|> class SubGraphLayer: """One layer of subgraph, include the MLP of g_enc. The calculation detail in this paper's 3.2 section. Input some vectors with 'feature_length' length, the output's length is '2*feature_length'(because of concat operator).""" def __init__(self, feature_length): """:pa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SubGraphLayer: """One layer of subgraph, include the MLP of g_enc. The calculation detail in this paper's 3.2 section. Input some vectors with 'feature_length' length, the output's length is '2*feature_length'(because of concat operator).""" def __init__(self, feature_length): """:param feature_l...
the_stack_v2_python_sparse
sub_graph.py
JieFeng-cse/dynamic_driving
train
1
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_10k_train_007652
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_006212
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_10k
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
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "self.ratio = ratio\nself.kernel_size = 4\nsuper().__init__()", "x, _ = equiangular_calculator(x, self.ratio)\nx = x.permute(0, 3, 1, 2)\nx = F.interpolate(x, scale_factor=(self.kernel_size, self.kernel_size), mode='nearest')\nx = reformat(x)\nreturn x" ]
<|body_start_0|> self.ratio = ratio self.kernel_size = 4 super().__init__() <|end_body_0|> <|body_start_1|> x, _ = equiangular_calculator(x, self.ratio) x = x.permute(0, 3, 1, 2) x = F.interpolate(x, scale_factor=(self.kernel_size, self.kernel_size), mode='nearest') ...
EquiAngular Average Unpooling version 1 using the interpolate function when unpooling
EquiangularAvgUnpool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EquiangularAvgUnpool: """EquiAngular Average Unpooling version 1 using the interpolate function when unpooling""" def __init__(self, ratio): """Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data""" <|body_0|> def forward(self,...
stack_v2_sparse_classes_10k_train_007653
41,403
no_license
[ { "docstring": "Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data", "name": "__init__", "signature": "def __init__(self, ratio)" }, { "docstring": "calls pytorch's interpolate function to create the values while unpooling based on the nearby values A...
2
null
Implement the Python class `EquiangularAvgUnpool` described below. Class description: EquiAngular Average Unpooling version 1 using the interpolate function when unpooling Method signatures and docstrings: - def __init__(self, ratio): Initialization Args: ratio (float): ratio between latitude and longitude dimensions...
Implement the Python class `EquiangularAvgUnpool` described below. Class description: EquiAngular Average Unpooling version 1 using the interpolate function when unpooling Method signatures and docstrings: - def __init__(self, ratio): Initialization Args: ratio (float): ratio between latitude and longitude dimensions...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class EquiangularAvgUnpool: """EquiAngular Average Unpooling version 1 using the interpolate function when unpooling""" def __init__(self, ratio): """Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data""" <|body_0|> def forward(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EquiangularAvgUnpool: """EquiAngular Average Unpooling version 1 using the interpolate function when unpooling""" def __init__(self, ratio): """Initialization Args: ratio (float): ratio between latitude and longitude dimensions of the data""" self.ratio = ratio self.kernel_size = ...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
cef60fd4ba8cfacbde5250863002e2f5baea7091
[ "def dist(p1, p2):\n return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])\nheap = []\ngraph = {}\nfor i in range(len(points)):\n for j in range(i + 1, len(points)):\n d = dist(points[i], points[j])\n graph.setdefault(i, {})[j] = graph.setdefault(j, {})[i] = d\n heappush(heap, (d, i, j))\n\nclas...
<|body_start_0|> def dist(p1, p2): return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1]) heap = [] graph = {} for i in range(len(points)): for j in range(i + 1, len(points)): d = dist(points[i], points[j]) graph.setdefault(i, {})[j] = grap...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minCostConnectPoints(self, points: List[List[int]]) -> int: """Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)""" <|body_0|> def minCostConnectPoints(self, points: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)"""...
stack_v2_sparse_classes_10k_train_007654
6,484
no_license
[ { "docstring": "Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)", "name": "minCostConnectPoints", "signature": "def minCostConnectPoints(self, points: List[List[int]]) -> int" }, { "docstring": "Time complexity: O(n^2) Space complexity: O(n^2)", "name": "minCostConnectPoints", ...
3
stack_v2_sparse_classes_30k_train_004816
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCostConnectPoints(self, points: List[List[int]]) -> int: Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2) - def minCostConnectPoints(self, points: List[List[int]]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCostConnectPoints(self, points: List[List[int]]) -> int: Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2) - def minCostConnectPoints(self, points: List[List[int]]...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def minCostConnectPoints(self, points: List[List[int]]) -> int: """Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)""" <|body_0|> def minCostConnectPoints(self, points: List[List[int]]) -> int: """Time complexity: O(n^2) Space complexity: O(n^2)"""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minCostConnectPoints(self, points: List[List[int]]) -> int: """Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)""" def dist(p1, p2): return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1]) heap = [] graph = {} for i in range(len(points)): ...
the_stack_v2_python_sparse
leetcode/solved/1706_Min_Cost_to_Connect_All_Points/solution.py
sungminoh/algorithms
train
0
9f66a29b51c9a3ff4895581fd03cdeb5e6075cf4
[ "result = []\nsynsets = wn.synsets(word)\nfor synset in synsets:\n hypernyms = synset.hypernyms()\n for hyp in hypernyms:\n result.append(hyp.lemmas()[0].name())\nreturn set(result)", "results = []\nfor word in words:\n hypernyms = self.get_hypernyms_for_single_word(word)\n for hypernym in hype...
<|body_start_0|> result = [] synsets = wn.synsets(word) for synset in synsets: hypernyms = synset.hypernyms() for hyp in hypernyms: result.append(hyp.lemmas()[0].name()) return set(result) <|end_body_0|> <|body_start_1|> results = [] ...
Generate labels for the topic models with wordnet.
ExtrensicTopicLabeler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtrensicTopicLabeler: """Generate labels for the topic models with wordnet.""" def get_hypernyms_for_single_word(self, word): """Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the g...
stack_v2_sparse_classes_10k_train_007655
3,555
no_license
[ { "docstring": "Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the given word", "name": "get_hypernyms_for_single_word", "signature": "def get_hypernyms_for_single_word(self, word)" }, { "docstr...
4
stack_v2_sparse_classes_30k_train_004641
Implement the Python class `ExtrensicTopicLabeler` described below. Class description: Generate labels for the topic models with wordnet. Method signatures and docstrings: - def get_hypernyms_for_single_word(self, word): Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from...
Implement the Python class `ExtrensicTopicLabeler` described below. Class description: Generate labels for the topic models with wordnet. Method signatures and docstrings: - def get_hypernyms_for_single_word(self, word): Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from...
34cdff618595bdb495d0cd7b23e543e089ea0c41
<|skeleton|> class ExtrensicTopicLabeler: """Generate labels for the topic models with wordnet.""" def get_hypernyms_for_single_word(self, word): """Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the g...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExtrensicTopicLabeler: """Generate labels for the topic models with wordnet.""" def get_hypernyms_for_single_word(self, word): """Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the given word""" ...
the_stack_v2_python_sparse
src/Automati_Topic_Labeling_Wordnet/extrinsic_topic_labler.py
ga65duy/Topic-Modeling
train
0
c2d9c3916d607173ab3c2bfd8cf464ac770f52ae
[ "self.continue_on_error = continue_on_error\nself.is_active = is_active\nself.script_params = script_params\nself.script_path = script_path\nself.timeout_secs = timeout_secs", "if dictionary is None:\n return None\ncontinue_on_error = dictionary.get('continueOnError')\nis_active = dictionary.get('isActive')\ns...
<|body_start_0|> self.continue_on_error = continue_on_error self.is_active = is_active self.script_params = script_params self.script_path = script_path self.timeout_secs = timeout_secs <|end_body_0|> <|body_start_1|> if dictionary is None: return None ...
Implementation of the 'RemoteScriptPathAndParams' model. Specifies the path to the remote script and any parameters expected by the remote script. Attributes: continue_on_error (bool): Specifies if the script needs to continue even if there is an occurence of an error. If this flag is set to true, then backup job will ...
RemoteScriptPathAndParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteScriptPathAndParams: """Implementation of the 'RemoteScriptPathAndParams' model. Specifies the path to the remote script and any parameters expected by the remote script. Attributes: continue_on_error (bool): Specifies if the script needs to continue even if there is an occurence of an erro...
stack_v2_sparse_classes_10k_train_007656
3,261
permissive
[ { "docstring": "Constructor for the RemoteScriptPathAndParams class", "name": "__init__", "signature": "def __init__(self, continue_on_error=None, is_active=None, script_params=None, script_path=None, timeout_secs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args...
2
stack_v2_sparse_classes_30k_train_001214
Implement the Python class `RemoteScriptPathAndParams` described below. Class description: Implementation of the 'RemoteScriptPathAndParams' model. Specifies the path to the remote script and any parameters expected by the remote script. Attributes: continue_on_error (bool): Specifies if the script needs to continue e...
Implement the Python class `RemoteScriptPathAndParams` described below. Class description: Implementation of the 'RemoteScriptPathAndParams' model. Specifies the path to the remote script and any parameters expected by the remote script. Attributes: continue_on_error (bool): Specifies if the script needs to continue e...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RemoteScriptPathAndParams: """Implementation of the 'RemoteScriptPathAndParams' model. Specifies the path to the remote script and any parameters expected by the remote script. Attributes: continue_on_error (bool): Specifies if the script needs to continue even if there is an occurence of an erro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RemoteScriptPathAndParams: """Implementation of the 'RemoteScriptPathAndParams' model. Specifies the path to the remote script and any parameters expected by the remote script. Attributes: continue_on_error (bool): Specifies if the script needs to continue even if there is an occurence of an error. If this fl...
the_stack_v2_python_sparse
cohesity_management_sdk/models/remote_script_path_and_params.py
cohesity/management-sdk-python
train
24
86ea5b412a5051862aa5a8479f9359323b11a33f
[ "nodes_val = []\nstack = [root]\nwhile stack:\n node = stack.pop()\n nodes_val.append(node.val)\n if node.left:\n stack.append(node.left)\n if node.right:\n stack.append(node.right)\nnodes_val.sort()\nreturn min((nodes_val[i] - nodes_val[i - 1] for i in range(1, len(nodes_val))))", "node...
<|body_start_0|> nodes_val = [] stack = [root] while stack: node = stack.pop() nodes_val.append(node.val) if node.left: stack.append(node.left) if node.right: stack.append(node.right) nodes_val.sort() ...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getMinimumDifference(self, root): """a general case, 52ms""" <|body_0|> def getMinimumDifference2(self, root): """BST, 48ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> nodes_val = [] stack = [root] while stack: ...
stack_v2_sparse_classes_10k_train_007657
1,556
permissive
[ { "docstring": "a general case, 52ms", "name": "getMinimumDifference", "signature": "def getMinimumDifference(self, root)" }, { "docstring": "BST, 48ms", "name": "getMinimumDifference2", "signature": "def getMinimumDifference2(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifference(self, root): a general case, 52ms - def getMinimumDifference2(self, root): BST, 48ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifference(self, root): a general case, 52ms - def getMinimumDifference2(self, root): BST, 48ms <|skeleton|> class Solution: def getMinimumDifference(self, ro...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def getMinimumDifference(self, root): """a general case, 52ms""" <|body_0|> def getMinimumDifference2(self, root): """BST, 48ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def getMinimumDifference(self, root): """a general case, 52ms""" nodes_val = [] stack = [root] while stack: node = stack.pop() nodes_val.append(node.val) if node.left: stack.append(node.left) if node.righ...
the_stack_v2_python_sparse
leetcode/0530_minimum_absolute_difference_in_bst.py
chaosWsF/Python-Practice
train
1
78e5409add72f1ae97417a4b3d4b401c9ddd9989
[ "Frame.__init__(self, master)\nself.master.rowconfigure(0, weight=1)\nself.master.columnconfigure(0, weight=1)\nself.grid(sticky=N + S + E + W)\nl0 = Label(self, text='Email Database Search', font=('Helvetica', 16))\nl0.grid(row=0, column=1, columnspan=2)\nl1 = Label(self, text='Not Before (yyy-mm-dd):')\nl1.grid(r...
<|body_start_0|> Frame.__init__(self, master) self.master.rowconfigure(0, weight=1) self.master.columnconfigure(0, weight=1) self.grid(sticky=N + S + E + W) l0 = Label(self, text='Email Database Search', font=('Helvetica', 16)) l0.grid(row=0, column=1, columnspan=2) ...
Create window app signature
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Create window app signature""" def __init__(self, master=None): """Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method.""" <|bod...
stack_v2_sparse_classes_10k_train_007658
5,775
no_license
[ { "docstring": "Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method.", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Take th...
3
stack_v2_sparse_classes_30k_train_003395
Implement the Python class `Application` described below. Class description: Create window app signature Method signatures and docstrings: - def __init__(self, master=None): Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subje...
Implement the Python class `Application` described below. Class description: Create window app signature Method signatures and docstrings: - def __init__(self, master=None): Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subje...
06c45545ed064d0e9c4fd15cc81cf454cb079c9d
<|skeleton|> class Application: """Create window app signature""" def __init__(self, master=None): """Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method.""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Application: """Create window app signature""" def __init__(self, master=None): """Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method.""" Frame.__init__(sel...
the_stack_v2_python_sparse
Lesson 13 - Email Search and Display/mailgui.py
jmwoloso/Python_2
train
0
500e8ca776184cac5ece24ee08aa1b26a15bee2a
[ "points.sort()\nif len(points) < 4:\n return 0\nMAX = 10000\ndict_X = set()\nres = float('inf')\nfor i in range(len(points)):\n for j in range(len(points)):\n if points[i][0] == points[j][0] or points[i][1] == points[j][1]:\n continue\n if points[i][0] * MAX + points[j][1] in dict_X a...
<|body_start_0|> points.sort() if len(points) < 4: return 0 MAX = 10000 dict_X = set() res = float('inf') for i in range(len(points)): for j in range(len(points)): if points[i][0] == points[j][0] or points[i][1] == points[j][1]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minAreaRect(self, points): """:type points: List[List[int]] :rtype: int""" <|body_0|> def minAreaRect2(self, points): """:type points: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> points.sort() if...
stack_v2_sparse_classes_10k_train_007659
1,437
no_license
[ { "docstring": ":type points: List[List[int]] :rtype: int", "name": "minAreaRect", "signature": "def minAreaRect(self, points)" }, { "docstring": ":type points: List[List[int]] :rtype: int", "name": "minAreaRect2", "signature": "def minAreaRect2(self, points)" } ]
2
stack_v2_sparse_classes_30k_train_000921
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaRect(self, points): :type points: List[List[int]] :rtype: int - def minAreaRect2(self, points): :type points: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaRect(self, points): :type points: List[List[int]] :rtype: int - def minAreaRect2(self, points): :type points: List[List[int]] :rtype: int <|skeleton|> class Solution:...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def minAreaRect(self, points): """:type points: List[List[int]] :rtype: int""" <|body_0|> def minAreaRect2(self, points): """:type points: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minAreaRect(self, points): """:type points: List[List[int]] :rtype: int""" points.sort() if len(points) < 4: return 0 MAX = 10000 dict_X = set() res = float('inf') for i in range(len(points)): for j in range(len(poin...
the_stack_v2_python_sparse
minAreaRect.py
NeilWangziyu/Leetcode_py
train
2
e1b7d4eb0e8d63e8c2b87014d01f9ed063b0139b
[ "super(ParsingFilter, self).__init__()\nself.config = config\ntry:\n if self.config['filter']['whitelist'] and self.config['filter']['blacklist']:\n _LOGGER.warning(_('Both whitelist and blacklist filters found in configuration. Only one can be used at a time - only the whitelist filter will be used.'))\n...
<|body_start_0|> super(ParsingFilter, self).__init__() self.config = config try: if self.config['filter']['whitelist'] and self.config['filter']['blacklist']: _LOGGER.warning(_('Both whitelist and blacklist filters found in configuration. Only one can be used at a tim...
Class that filters logs.
ParsingFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParsingFilter: """Class that filters logs.""" def __init__(self, config, *parse_list): """Create object to implement filtering.""" <|body_0|> def filter(self, record): """Apply filter to the log message. This is a subset of Logger.filter, this method applies the ...
stack_v2_sparse_classes_10k_train_007660
6,253
permissive
[ { "docstring": "Create object to implement filtering.", "name": "__init__", "signature": "def __init__(self, config, *parse_list)" }, { "docstring": "Apply filter to the log message. This is a subset of Logger.filter, this method applies the logger filters and returns a bool. If the value is tru...
2
stack_v2_sparse_classes_30k_test_000103
Implement the Python class `ParsingFilter` described below. Class description: Class that filters logs. Method signatures and docstrings: - def __init__(self, config, *parse_list): Create object to implement filtering. - def filter(self, record): Apply filter to the log message. This is a subset of Logger.filter, thi...
Implement the Python class `ParsingFilter` described below. Class description: Class that filters logs. Method signatures and docstrings: - def __init__(self, config, *parse_list): Create object to implement filtering. - def filter(self, record): Apply filter to the log message. This is a subset of Logger.filter, thi...
41246da2f6f379a889dadd1d3b4e139b65d3c9fb
<|skeleton|> class ParsingFilter: """Class that filters logs.""" def __init__(self, config, *parse_list): """Create object to implement filtering.""" <|body_0|> def filter(self, record): """Apply filter to the log message. This is a subset of Logger.filter, this method applies the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParsingFilter: """Class that filters logs.""" def __init__(self, config, *parse_list): """Create object to implement filtering.""" super(ParsingFilter, self).__init__() self.config = config try: if self.config['filter']['whitelist'] and self.config['filter']['b...
the_stack_v2_python_sparse
opsdroid/logging.py
opsdroid/opsdroid
train
835
0e103175b0aa04e41769df1903e096d4ac2d6596
[ "print()\nprint('-+- ' * 40)\nlog.debug('ROUTE class : %s', self.__class__.__name__)\nlog.debug('payload : \\n{}'.format(pformat(ns.payload)))\nclaims = get_jwt_claims()\nlog.debug('claims : \\n %s', pformat(claims))\nupdated_doc, response_code = Query_db_update(ns, models, document_type, doc_id, claims, roles_for_...
<|body_start_0|> print() print('-+- ' * 40) log.debug('ROUTE class : %s', self.__class__.__name__) log.debug('payload : \n{}'.format(pformat(ns.payload))) claims = get_jwt_claims() log.debug('claims : \n %s', pformat(claims)) updated_doc, response_code = Query_db_...
rec edition : PUT - Updates document's infos DELETE - Let you delete document
Rec_edit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rec_edit: """rec edition : PUT - Updates document's infos DELETE - Let you delete document""" def put(self, doc_id): """Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data""" <|body_0|> def delete(...
stack_v2_sparse_classes_10k_train_007661
3,280
permissive
[ { "docstring": "Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data", "name": "put", "signature": "def put(self, doc_id)" }, { "docstring": "delete a rec in db > --- needs : a valid access_token (as admin or current user) ...
2
stack_v2_sparse_classes_30k_train_006403
Implement the Python class `Rec_edit` described below. Class description: rec edition : PUT - Updates document's infos DELETE - Let you delete document Method signatures and docstrings: - def put(self, doc_id): Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> retur...
Implement the Python class `Rec_edit` described below. Class description: rec edition : PUT - Updates document's infos DELETE - Let you delete document Method signatures and docstrings: - def put(self, doc_id): Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> retur...
08ba9151069f2f633461f5166b1954fdeac7854a
<|skeleton|> class Rec_edit: """rec edition : PUT - Updates document's infos DELETE - Let you delete document""" def put(self, doc_id): """Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data""" <|body_0|> def delete(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Rec_edit: """rec edition : PUT - Updates document's infos DELETE - Let you delete document""" def put(self, doc_id): """Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data""" print() print('-+- ' * 40) ...
the_stack_v2_python_sparse
solidata_api/api/api_recipes/endpoint_rec_edit.py
entrepreneur-interet-general/solidata_backend
train
9
c4eeb9b0f2227bc32a04f2175c8f590c52cdba29
[ "self.restore_to_original_site = restore_to_original_site\nself.site_owner_list = site_owner_list\nself.target_document_library_name = target_document_library_name\nself.target_document_library_prefix = target_document_library_prefix\nself.target_site = target_site", "if dictionary is None:\n return None\nrest...
<|body_start_0|> self.restore_to_original_site = restore_to_original_site self.site_owner_list = site_owner_list self.target_document_library_name = target_document_library_name self.target_document_library_prefix = target_document_library_prefix self.target_site = target_site <|...
Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (list of SiteOwner): Specifies the list of SharePoint Sit...
SharePointRestoreParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharePointRestoreParameters: """Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (l...
stack_v2_sparse_classes_10k_train_007662
3,700
permissive
[ { "docstring": "Constructor for the SharePointRestoreParameters class", "name": "__init__", "signature": "def __init__(self, restore_to_original_site=None, site_owner_list=None, target_document_library_name=None, target_document_library_prefix=None, target_site=None)" }, { "docstring": "Creates ...
2
stack_v2_sparse_classes_30k_val_000359
Implement the Python class `SharePointRestoreParameters` described below. Class description: Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to...
Implement the Python class `SharePointRestoreParameters` described below. Class description: Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SharePointRestoreParameters: """Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SharePointRestoreParameters: """Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (list of SiteOw...
the_stack_v2_python_sparse
cohesity_management_sdk/models/share_point_restore_parameters.py
cohesity/management-sdk-python
train
24
f68f8a4871ae7c81ef230e96f4cf236968a7e00d
[ "\"\"\":field\n Byte data of the sound.\n \"\"\"\nself.bytes: bytes = bytes(np.array(snd * 32767, dtype='int16'))\n':field\\n A base64 string of the sound. Send this to the build.\\n '\nself.wav_str = base64.b64encode(self.bytes).decode('utf-8')\n':field\\n The length of the byte ...
<|body_start_0|> """:field Byte data of the sound. """ self.bytes: bytes = bytes(np.array(snd * 32767, dtype='int16')) ':field\n A base64 string of the sound. Send this to the build.\n ' self.wav_str = base64.b64encode(self.bytes).decode('utf...
This class is used only in PyImpact, which has been deprecated. See: [`Clatter`](../add_ons/clatter.md). A sound encoded as a base64 string.
Base64Sound
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base64Sound: """This class is used only in PyImpact, which has been deprecated. See: [`Clatter`](../add_ons/clatter.md). A sound encoded as a base64 string.""" def __init__(self, snd: np.ndarray): """:param snd: The sound byte array.""" <|body_0|> def write(self, path: U...
stack_v2_sparse_classes_10k_train_007663
1,305
permissive
[ { "docstring": ":param snd: The sound byte array.", "name": "__init__", "signature": "def __init__(self, snd: np.ndarray)" }, { "docstring": "Write audio to disk. :param path: The path to the .wav file.", "name": "write", "signature": "def write(self, path: Union[str, Path]) -> None" }...
2
null
Implement the Python class `Base64Sound` described below. Class description: This class is used only in PyImpact, which has been deprecated. See: [`Clatter`](../add_ons/clatter.md). A sound encoded as a base64 string. Method signatures and docstrings: - def __init__(self, snd: np.ndarray): :param snd: The sound byte ...
Implement the Python class `Base64Sound` described below. Class description: This class is used only in PyImpact, which has been deprecated. See: [`Clatter`](../add_ons/clatter.md). A sound encoded as a base64 string. Method signatures and docstrings: - def __init__(self, snd: np.ndarray): :param snd: The sound byte ...
9df96fba455b327bb360d8dd5886d8754046c690
<|skeleton|> class Base64Sound: """This class is used only in PyImpact, which has been deprecated. See: [`Clatter`](../add_ons/clatter.md). A sound encoded as a base64 string.""" def __init__(self, snd: np.ndarray): """:param snd: The sound byte array.""" <|body_0|> def write(self, path: U...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Base64Sound: """This class is used only in PyImpact, which has been deprecated. See: [`Clatter`](../add_ons/clatter.md). A sound encoded as a base64 string.""" def __init__(self, snd: np.ndarray): """:param snd: The sound byte array.""" """:field Byte data of the sound. ...
the_stack_v2_python_sparse
Python/tdw/physics_audio/base64_sound.py
threedworld-mit/tdw
train
427
b2b1e3f407fe13f0ee61d12232288fbade0d0cb0
[ "from collections import deque\nstack = deque()\nif root == None:\n return\nstack.appendleft(root)\nprev = None\nwhile len(stack) > 0:\n node = stack.popleft()\n if node.right != None:\n rnode = node.right\n stack.appendleft(rnode)\n if node.left != None:\n stack.appendleft(node.lef...
<|body_start_0|> from collections import deque stack = deque() if root == None: return stack.appendleft(root) prev = None while len(stack) > 0: node = stack.popleft() if node.right != None: rnode = node.right ...
Ex114
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ex114: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def flatten0(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|...
stack_v2_sparse_classes_10k_train_007664
2,377
no_license
[ { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "flatten0",...
2
stack_v2_sparse_classes_30k_train_005104
Implement the Python class `Ex114` described below. Class description: Implement the Ex114 class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def flatten0(self, root): :type root: TreeNode :rtype: void Do not re...
Implement the Python class `Ex114` described below. Class description: Implement the Ex114 class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def flatten0(self, root): :type root: TreeNode :rtype: void Do not re...
8f9327a1879949f61b462cc6c82e00e7c27b8b07
<|skeleton|> class Ex114: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def flatten0(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ex114: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" from collections import deque stack = deque() if root == None: return stack.appendleft(root) prev = None while len(s...
the_stack_v2_python_sparse
LeetCode/Ex100/Ex114.py
JasonVann/CrackingCodingInterview
train
0
5a96c15aba770dd768ce1a2343c71c1dc6d79302
[ "self.enable_worm_on_external_target = enable_worm_on_external_target\nself.policy_type = policy_type\nself.retention_secs = retention_secs\nself.version = version", "if dictionary is None:\n return None\nenable_worm_on_external_target = dictionary.get('enableWormOnExternalTarget')\npolicy_type = dictionary.ge...
<|body_start_0|> self.enable_worm_on_external_target = enable_worm_on_external_target self.policy_type = policy_type self.retention_secs = retention_secs self.version = version <|end_body_0|> <|body_start_1|> if dictionary is None: return None enable_worm_on_...
Implementation of the 'WormRetentionProto' model. Message that specifies the WORM attributes. WORM attributes can be associated with any of the following: 1. backup policy: compliance or administrative policy with worm retention. 2. backup runs: worm retention inherited from policy at successful backup run completion.....
WormRetentionProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WormRetentionProto: """Implementation of the 'WormRetentionProto' model. Message that specifies the WORM attributes. WORM attributes can be associated with any of the following: 1. backup policy: compliance or administrative policy with worm retention. 2. backup runs: worm retention inherited fro...
stack_v2_sparse_classes_10k_train_007665
3,033
permissive
[ { "docstring": "Constructor for the WormRetentionProto class", "name": "__init__", "signature": "def __init__(self, enable_worm_on_external_target=None, policy_type=None, retention_secs=None, version=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (...
2
stack_v2_sparse_classes_30k_train_005737
Implement the Python class `WormRetentionProto` described below. Class description: Implementation of the 'WormRetentionProto' model. Message that specifies the WORM attributes. WORM attributes can be associated with any of the following: 1. backup policy: compliance or administrative policy with worm retention. 2. ba...
Implement the Python class `WormRetentionProto` described below. Class description: Implementation of the 'WormRetentionProto' model. Message that specifies the WORM attributes. WORM attributes can be associated with any of the following: 1. backup policy: compliance or administrative policy with worm retention. 2. ba...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class WormRetentionProto: """Implementation of the 'WormRetentionProto' model. Message that specifies the WORM attributes. WORM attributes can be associated with any of the following: 1. backup policy: compliance or administrative policy with worm retention. 2. backup runs: worm retention inherited fro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WormRetentionProto: """Implementation of the 'WormRetentionProto' model. Message that specifies the WORM attributes. WORM attributes can be associated with any of the following: 1. backup policy: compliance or administrative policy with worm retention. 2. backup runs: worm retention inherited from policy at s...
the_stack_v2_python_sparse
cohesity_management_sdk/models/worm_retention_proto.py
cohesity/management-sdk-python
train
24
84efe49c9c908c131952f8070c2d00f556ce3776
[ "self.url = api_reverse('authentication:email_password')\nself.register_url = api_reverse('authentication:user-registration')\nself.user = {'user': {'username': 'kevin', 'email': 'koechkevin92@gmail.com', 'password': 'Kevin12345'}}\nself.client.post(self.register_url, self.user, format='json')\nUser.is_active = Tru...
<|body_start_0|> self.url = api_reverse('authentication:email_password') self.register_url = api_reverse('authentication:user-registration') self.user = {'user': {'username': 'kevin', 'email': 'koechkevin92@gmail.com', 'password': 'Kevin12345'}} self.client.post(self.register_url, self.u...
test for class to send password reset link to email
TestEmailSent
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEmailSent: """test for class to send password reset link to email""" def setUp(self): """set up method to test email to be sent endpoint""" <|body_0|> def test_unregistered_email(self): """case where unregistered user tries to request a password""" <|...
stack_v2_sparse_classes_10k_train_007666
7,001
permissive
[ { "docstring": "set up method to test email to be sent endpoint", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "case where unregistered user tries to request a password", "name": "test_unregistered_email", "signature": "def test_unregistered_email(self)" }, { ...
6
stack_v2_sparse_classes_30k_train_006443
Implement the Python class `TestEmailSent` described below. Class description: test for class to send password reset link to email Method signatures and docstrings: - def setUp(self): set up method to test email to be sent endpoint - def test_unregistered_email(self): case where unregistered user tries to request a p...
Implement the Python class `TestEmailSent` described below. Class description: test for class to send password reset link to email Method signatures and docstrings: - def setUp(self): set up method to test email to be sent endpoint - def test_unregistered_email(self): case where unregistered user tries to request a p...
a14ffcac494053ff338aa7f0a5524062964a49cc
<|skeleton|> class TestEmailSent: """test for class to send password reset link to email""" def setUp(self): """set up method to test email to be sent endpoint""" <|body_0|> def test_unregistered_email(self): """case where unregistered user tries to request a password""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestEmailSent: """test for class to send password reset link to email""" def setUp(self): """set up method to test email to be sent endpoint""" self.url = api_reverse('authentication:email_password') self.register_url = api_reverse('authentication:user-registration') self....
the_stack_v2_python_sparse
authors/apps/authentication/test_password_reset.py
andela/ah-shakas
train
1
c7343e36430c63026d8a3c6cd5fe11726cb84ca3
[ "logging.debug('Enabling user to execute test as root...')\ncommand = \"sed -i -e '$a{mark}\\\\n{user} ALL=NOPASSWD: /usr/bin/python' {filename}\".format(mark=self.MARK, user=os.getenv('SUDO_USER'), script=os.path.realpath(__file__), filename=self.SUDOERS)\nCommand(command, verbose=False).run()", "logging.debug('...
<|body_start_0|> logging.debug('Enabling user to execute test as root...') command = "sed -i -e '$a{mark}\\n{user} ALL=NOPASSWD: /usr/bin/python' {filename}".format(mark=self.MARK, user=os.getenv('SUDO_USER'), script=os.path.realpath(__file__), filename=self.SUDOERS) Command(command, verbose=Fal...
Enable/disable reboot test to be executed as root to make sure that reboot test works properly
SudoersConfigurator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SudoersConfigurator: """Enable/disable reboot test to be executed as root to make sure that reboot test works properly""" def enable(self): """Make sure that user will be allowed to execute reboot test as root""" <|body_0|> def disable(self): """Revert sudoers co...
stack_v2_sparse_classes_10k_train_007667
33,067
permissive
[ { "docstring": "Make sure that user will be allowed to execute reboot test as root", "name": "enable", "signature": "def enable(self)" }, { "docstring": "Revert sudoers configuration changes", "name": "disable", "signature": "def disable(self)" } ]
2
stack_v2_sparse_classes_30k_train_000101
Implement the Python class `SudoersConfigurator` described below. Class description: Enable/disable reboot test to be executed as root to make sure that reboot test works properly Method signatures and docstrings: - def enable(self): Make sure that user will be allowed to execute reboot test as root - def disable(sel...
Implement the Python class `SudoersConfigurator` described below. Class description: Enable/disable reboot test to be executed as root to make sure that reboot test works properly Method signatures and docstrings: - def enable(self): Make sure that user will be allowed to execute reboot test as root - def disable(sel...
40ceac081f5181d01e188a5a1c40463d891203e6
<|skeleton|> class SudoersConfigurator: """Enable/disable reboot test to be executed as root to make sure that reboot test works properly""" def enable(self): """Make sure that user will be allowed to execute reboot test as root""" <|body_0|> def disable(self): """Revert sudoers co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SudoersConfigurator: """Enable/disable reboot test to be executed as root to make sure that reboot test works properly""" def enable(self): """Make sure that user will be allowed to execute reboot test as root""" logging.debug('Enabling user to execute test as root...') command = ...
the_stack_v2_python_sparse
work/pm.py
sebastian-code/ideas_sueltas
train
0
093cb63b9bbe69ba7e87c92ff6cdc3111d86a772
[ "fields = list(super().get_fields(request, model_instance))\nordered_field_names = reversed(['notes', 'type', 'title', 'slug', 'summary', 'certainty', 'elaboration'])\nfor field_name in ordered_field_names:\n if field_name in fields:\n fields.remove(field_name)\n fields.insert(0, field_name)\nretur...
<|body_start_0|> fields = list(super().get_fields(request, model_instance)) ordered_field_names = reversed(['notes', 'type', 'title', 'slug', 'summary', 'certainty', 'elaboration']) for field_name in ordered_field_names: if field_name in fields: fields.remove(field_na...
Model admin for searchable models.
SearchableModelAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchableModelAdmin: """Model admin for searchable models.""" def get_fields(self, request: 'HttpRequest', model_instance: Optional['SearchableModel']=None) -> list[str]: """Return reordered fields to be displayed in the admin.""" <|body_0|> def get_fieldsets(self, requ...
stack_v2_sparse_classes_10k_train_007668
4,473
no_license
[ { "docstring": "Return reordered fields to be displayed in the admin.", "name": "get_fields", "signature": "def get_fields(self, request: 'HttpRequest', model_instance: Optional['SearchableModel']=None) -> list[str]" }, { "docstring": "Return the fieldsets to be displayed in the admin form.", ...
3
null
Implement the Python class `SearchableModelAdmin` described below. Class description: Model admin for searchable models. Method signatures and docstrings: - def get_fields(self, request: 'HttpRequest', model_instance: Optional['SearchableModel']=None) -> list[str]: Return reordered fields to be displayed in the admin...
Implement the Python class `SearchableModelAdmin` described below. Class description: Model admin for searchable models. Method signatures and docstrings: - def get_fields(self, request: 'HttpRequest', model_instance: Optional['SearchableModel']=None) -> list[str]: Return reordered fields to be displayed in the admin...
8bbdc8eec3622af22c17214051c34e36bea8e05a
<|skeleton|> class SearchableModelAdmin: """Model admin for searchable models.""" def get_fields(self, request: 'HttpRequest', model_instance: Optional['SearchableModel']=None) -> list[str]: """Return reordered fields to be displayed in the admin.""" <|body_0|> def get_fieldsets(self, requ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SearchableModelAdmin: """Model admin for searchable models.""" def get_fields(self, request: 'HttpRequest', model_instance: Optional['SearchableModel']=None) -> list[str]: """Return reordered fields to be displayed in the admin.""" fields = list(super().get_fields(request, model_instance)...
the_stack_v2_python_sparse
apps/search/admin.py
abdulwahed-mansour/modularhistory
train
1
d8f9cbbdd2cd224519603aa535f863b40799f92c
[ "URLPlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache)\nNamePlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache, disable_kw=disable_kw)\nself._iterable_list = []\nself.data = data\nself.datatype = datatype\nself.pl...
<|body_start_0|> URLPlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache) NamePlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache, disable_kw=disable_kw) self._iterable_list = [] self.data ...
Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname
Player
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Player: """Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname""" def __init__(self, data, on_repeat, datatype=None, playlisttype=None, show_lyrics=False, dont_cache_search=False, no_cac...
stack_v2_sparse_classes_10k_train_007669
12,182
permissive
[ { "docstring": "data can be anything of the above supported types. If playlist then it is iterated over, if it is some other type then its simply sent to be played according to the player. datatype supports the following types: - playlist - song - URL", "name": "__init__", "signature": "def __init__(sel...
6
stack_v2_sparse_classes_30k_test_000217
Implement the Python class `Player` described below. Class description: Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname Method signatures and docstrings: - def __init__(self, data, on_repeat, datatype=None, p...
Implement the Python class `Player` described below. Class description: Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname Method signatures and docstrings: - def __init__(self, data, on_repeat, datatype=None, p...
9050f0c5f9fef7b9c9b14a7f26a055684e260d4c
<|skeleton|> class Player: """Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname""" def __init__(self, data, on_repeat, datatype=None, playlisttype=None, show_lyrics=False, dont_cache_search=False, no_cac...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Player: """Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname""" def __init__(self, data, on_repeat, datatype=None, playlisttype=None, show_lyrics=False, dont_cache_search=False, no_cache=False, no_...
the_stack_v2_python_sparse
playx/player.py
NISH1001/playx
train
229
2b87986897b4c1a914fc6d44e0fd0a9501f56877
[ "self.num_eval_symbols = num_eval_symbols\nself.remove_end_of_line = remove_end_of_line\nresponse = requests.get(self.ENWIKI_URL, stream=True)\nwith ZipFile(BytesIO(response.content), 'r') as z:\n train, val, test = self._process(z.read('enwik8'))\nsuper().__init__(train, val, test, cache=cache, transform=transf...
<|body_start_0|> self.num_eval_symbols = num_eval_symbols self.remove_end_of_line = remove_end_of_line response = requests.get(self.ENWIKI_URL, stream=True) with ZipFile(BytesIO(response.content), 'r') as z: train, val, test = self._process(z.read('enwik8')) super()._...
The official WikiText103 dataset.
Enwiki8
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Enwiki8: """The official WikiText103 dataset.""" def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: """Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: i...
stack_v2_sparse_classes_10k_train_007670
6,879
permissive
[ { "docstring": "Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: int, optional The number of symbols to use for seach of validation, and testing. Default ``5000000``. remove_end_of_line: bool, optional If True, remove end of line tokens. Default ``True``. see TabularDataset for other ar...
2
stack_v2_sparse_classes_30k_train_003753
Implement the Python class `Enwiki8` described below. Class description: The official WikiText103 dataset. Method signatures and docstrings: - def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: Initialize the Wik...
Implement the Python class `Enwiki8` described below. Class description: The official WikiText103 dataset. Method signatures and docstrings: - def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: Initialize the Wik...
0dc2f5b2b286694defe8abf450fe5be9ae12c097
<|skeleton|> class Enwiki8: """The official WikiText103 dataset.""" def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: """Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Enwiki8: """The official WikiText103 dataset.""" def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: """Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: int, optional ...
the_stack_v2_python_sparse
flambe/nlp/language_modeling/datasets.py
cle-ros/flambe
train
1
13322461e8e0238b7b5b14f835abcbe5fad75e0b
[ "self.courseID = courseID\nself.jobID = jobID\nself.submissionLanguage = submissionLanguage\nself.directoryFormat = directoryFormat\nself.baseFile = baseFile\nself.userEmail = userEmail\nself.toggleEmail = toggleEmail\nself.fRoot = fRoot\nself.fOut = fOut", "path = os.path.join(dirname, 'folderizer.py')\nprint('s...
<|body_start_0|> self.courseID = courseID self.jobID = jobID self.submissionLanguage = submissionLanguage self.directoryFormat = directoryFormat self.baseFile = baseFile self.userEmail = userEmail self.toggleEmail = toggleEmail self.fRoot = fRoot s...
The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.
jobRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class jobRequest: """The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.""" def __init__(self, courseID, jobID, submissionLanguage, directoryFormat, baseF...
stack_v2_sparse_classes_10k_train_007671
6,136
no_license
[ { "docstring": "Constructor of the Job Request that we submit to the MOSS server The job object takes 8 parameters namely: CourseID(course associated with user account) jobID(unique identifier of submitted job) submissionLanguage - Coding language utilised for code file submissions to MOSS directoryFormat - For...
6
stack_v2_sparse_classes_30k_train_004257
Implement the Python class `jobRequest` described below. Class description: The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server. Method signatures and docstrings: - def __init...
Implement the Python class `jobRequest` described below. Class description: The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server. Method signatures and docstrings: - def __init...
2c0d408a5ff930c34be669737ff4b6d0ae13da2f
<|skeleton|> class jobRequest: """The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.""" def __init__(self, courseID, jobID, submissionLanguage, directoryFormat, baseF...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class jobRequest: """The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.""" def __init__(self, courseID, jobID, submissionLanguage, directoryFormat, baseFile, userEmai...
the_stack_v2_python_sparse
backend/SSRG/Jobs/MossBackendJobs/jobRequest.py
Suvanth/SSRG-Django-Website
train
0
6a49f704aa0351a21a848b0fc40c7b451f35bdbd
[ "validated_data['bundle_name'] = validated_data.pop('name')\nvalidated_data['bundle_note'] = validated_data.pop('note')\nreturn Bundle.UploadNew(**validated_data)", "project_name = validated_data.pop('project_name')\nbundle_name = instance.name\ndata = {'dst_bundle_name': validated_data.pop('new_name', None), 'no...
<|body_start_0|> validated_data['bundle_name'] = validated_data.pop('name') validated_data['bundle_note'] = validated_data.pop('note') return Bundle.UploadNew(**validated_data) <|end_body_0|> <|body_start_1|> project_name = validated_data.pop('project_name') bundle_name = instan...
Serialize or deserialize Bundle objects.
BundleSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BundleSerializer: """Serialize or deserialize Bundle objects.""" def create(self, validated_data): """Override parent's method.""" <|body_0|> def update(self, instance, validated_data): """Override parent's method.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_007672
6,625
permissive
[ { "docstring": "Override parent's method.", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Override parent's method.", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
null
Implement the Python class `BundleSerializer` described below. Class description: Serialize or deserialize Bundle objects. Method signatures and docstrings: - def create(self, validated_data): Override parent's method. - def update(self, instance, validated_data): Override parent's method.
Implement the Python class `BundleSerializer` described below. Class description: Serialize or deserialize Bundle objects. Method signatures and docstrings: - def create(self, validated_data): Override parent's method. - def update(self, instance, validated_data): Override parent's method. <|skeleton|> class BundleS...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class BundleSerializer: """Serialize or deserialize Bundle objects.""" def create(self, validated_data): """Override parent's method.""" <|body_0|> def update(self, instance, validated_data): """Override parent's method.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BundleSerializer: """Serialize or deserialize Bundle objects.""" def create(self, validated_data): """Override parent's method.""" validated_data['bundle_name'] = validated_data.pop('name') validated_data['bundle_note'] = validated_data.pop('note') return Bundle.UploadNew(...
the_stack_v2_python_sparse
py/dome/backend/serializers.py
bridder/factory
train
0
952c47525b3cb8ed2d97ec70f31695ae0a766477
[ "seed(datetime.now())\nheight = randint(HEIGHT[0], HEIGHT[1])\nscratch = AVLHandler.from_scratch(height, POINT_CAP)\nstate = scratch.get_gamestate()\nhandler = AVLHandler.from_graph(state)\nreturn handler", "successes = 0\nfailures = 0\niterations = NUM_CALLS\nfor _ in range(iterations):\n handler = self.new_h...
<|body_start_0|> seed(datetime.now()) height = randint(HEIGHT[0], HEIGHT[1]) scratch = AVLHandler.from_scratch(height, POINT_CAP) state = scratch.get_gamestate() handler = AVLHandler.from_graph(state) return handler <|end_body_0|> <|body_start_1|> successes = 0 ...
Test the state of the AVL tree upon generation from deserialization
AVLOldGeneration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AVLOldGeneration: """Test the state of the AVL tree upon generation from deserialization""" def new_handler(): """create new handler to test""" <|body_0|> def test_golden_old(self): """make sure new avl is generated with correct golden node""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_007673
20,558
permissive
[ { "docstring": "create new handler to test", "name": "new_handler", "signature": "def new_handler()" }, { "docstring": "make sure new avl is generated with correct golden node", "name": "test_golden_old", "signature": "def test_golden_old(self)" }, { "docstring": "make sure nodes...
4
stack_v2_sparse_classes_30k_train_007017
Implement the Python class `AVLOldGeneration` described below. Class description: Test the state of the AVL tree upon generation from deserialization Method signatures and docstrings: - def new_handler(): create new handler to test - def test_golden_old(self): make sure new avl is generated with correct golden node -...
Implement the Python class `AVLOldGeneration` described below. Class description: Test the state of the AVL tree upon generation from deserialization Method signatures and docstrings: - def new_handler(): create new handler to test - def test_golden_old(self): make sure new avl is generated with correct golden node -...
a47c849ea97763eff1005273a58aa3d8ab663ff2
<|skeleton|> class AVLOldGeneration: """Test the state of the AVL tree upon generation from deserialization""" def new_handler(): """create new handler to test""" <|body_0|> def test_golden_old(self): """make sure new avl is generated with correct golden node""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AVLOldGeneration: """Test the state of the AVL tree upon generation from deserialization""" def new_handler(): """create new handler to test""" seed(datetime.now()) height = randint(HEIGHT[0], HEIGHT[1]) scratch = AVLHandler.from_scratch(height, POINT_CAP) state = ...
the_stack_v2_python_sparse
game_board/avl/test_avl.py
Plongesam/data-structures-game
train
2
ae30ef96654b959357e94a65d26d48da6c244672
[ "self.image = tf.placeholder(dtype=tf.float32, shape=dataset.shape)\nself.model = model_class(tf.expand_dims(self.image, axis=0), trainable=False, num_classes=dataset.num_classes, **params)\nself.logits = self.model.logits[0]\nself.num_classes = self.logits.shape.as_list()[0]\nself.logits_grad = jacobian(self.logit...
<|body_start_0|> self.image = tf.placeholder(dtype=tf.float32, shape=dataset.shape) self.model = model_class(tf.expand_dims(self.image, axis=0), trainable=False, num_classes=dataset.num_classes, **params) self.logits = self.model.logits[0] self.num_classes = self.logits.shape.as_list()[0...
DeepfoolOp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepfoolOp: def __init__(self, model_class, dataset, params): """Creates necessary ops for deepfool in the tensorflow graph Args: model_class: The class of the model to construct. Expects subclass of BasicModel dataset: The dataset to use. Only necessary for shape and number of classes p...
stack_v2_sparse_classes_10k_train_007674
3,133
permissive
[ { "docstring": "Creates necessary ops for deepfool in the tensorflow graph Args: model_class: The class of the model to construct. Expects subclass of BasicModel dataset: The dataset to use. Only necessary for shape and number of classes params: Additional parameters to pass to the model init", "name": "__i...
2
stack_v2_sparse_classes_30k_train_002671
Implement the Python class `DeepfoolOp` described below. Class description: Implement the DeepfoolOp class. Method signatures and docstrings: - def __init__(self, model_class, dataset, params): Creates necessary ops for deepfool in the tensorflow graph Args: model_class: The class of the model to construct. Expects s...
Implement the Python class `DeepfoolOp` described below. Class description: Implement the DeepfoolOp class. Method signatures and docstrings: - def __init__(self, model_class, dataset, params): Creates necessary ops for deepfool in the tensorflow graph Args: model_class: The class of the model to construct. Expects s...
2aea27d28746c0726c2da6be21a51c92bf120b70
<|skeleton|> class DeepfoolOp: def __init__(self, model_class, dataset, params): """Creates necessary ops for deepfool in the tensorflow graph Args: model_class: The class of the model to construct. Expects subclass of BasicModel dataset: The dataset to use. Only necessary for shape and number of classes p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeepfoolOp: def __init__(self, model_class, dataset, params): """Creates necessary ops for deepfool in the tensorflow graph Args: model_class: The class of the model to construct. Expects subclass of BasicModel dataset: The dataset to use. Only necessary for shape and number of classes params: Additio...
the_stack_v2_python_sparse
code/attacks/deepfool.py
Ichbinhippo/Adversarial-Attacks-on-CapsNets
train
0
462db16007ab5dca10b5b6043d85e46b16de3ffa
[ "result = {}\ntesting_mode = PyFunceble.cli.utils.testing.get_testing_mode()\nif testing_mode not in self.SUPPORTED_TEST_MODES:\n raise ValueError('<testing_mode> ({testing_mode!r}) is not supported.')\nfor registrar, value in self.dataset['counter'].items():\n if registrar == 'total':\n continue\n ...
<|body_start_0|> result = {} testing_mode = PyFunceble.cli.utils.testing.get_testing_mode() if testing_mode not in self.SUPPORTED_TEST_MODES: raise ValueError('<testing_mode> ({testing_mode!r}) is not supported.') for registrar, value in self.dataset['counter'].items(): ...
Provides our registrar stats counter.
RegistrarCounter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrarCounter: """Provides our registrar stats counter.""" def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: """Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:...
stack_v2_sparse_classes_10k_train_007675
5,731
permissive
[ { "docstring": "Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:: If set to :code:`None`, all registrars will be displayed. :raise ValueError: When the current testing mode is not supported (yet?).", "name": "get_dataset_for_printer", ...
2
stack_v2_sparse_classes_30k_train_004522
Implement the Python class `RegistrarCounter` described below. Class description: Provides our registrar stats counter. Method signatures and docstrings: - def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: Provides the dataset that the printer may understand. :param li...
Implement the Python class `RegistrarCounter` described below. Class description: Provides our registrar stats counter. Method signatures and docstrings: - def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: Provides the dataset that the printer may understand. :param li...
214a57d0eca3df7c4ed3421937aaff9998452ba6
<|skeleton|> class RegistrarCounter: """Provides our registrar stats counter.""" def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: """Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegistrarCounter: """Provides our registrar stats counter.""" def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: """Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:: If set to :...
the_stack_v2_python_sparse
PyFunceble/cli/filesystem/registrar_counter.py
funilrys/PyFunceble
train
267
2ea15cf44b4fd5622fc0e931fe4ed287652c1b6c
[ "self.trec_eval_command = trec_eval_command\nself.relevant_metrics = relevant_metrics\nself.q_rel_file = q_rel_file\nself.temp_run_file = '/tmp/temp_run_by_carlos.run'\nself.run_file_exporter = RUN_File_Transform_Exporter(self.temp_run_file, model_name='temp_model_by_carlos')", "self.run_file_exporter(samples)\nr...
<|body_start_0|> self.trec_eval_command = trec_eval_command self.relevant_metrics = relevant_metrics self.q_rel_file = q_rel_file self.temp_run_file = '/tmp/temp_run_by_carlos.run' self.run_file_exporter = RUN_File_Transform_Exporter(self.temp_run_file, model_name='temp_model_by_...
TREC_Eval_Command_Experiment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TREC_Eval_Command_Experiment: def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metrics=['ndcg_cut_3', 'ndcg_cut_5', 'ndcg_cut_1000', 'map_cut_1000', 'recall_500', 'recall_1000'], q_rel_file='datasets/TREC_CAsT/2...
stack_v2_sparse_classes_10k_train_007676
13,210
no_license
[ { "docstring": "This is an experiment transform that uses the official trec_eval command to compute scores for each query and return valid results according to the command specified.", "name": "__init__", "signature": "def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,2...
2
stack_v2_sparse_classes_30k_train_003255
Implement the Python class `TREC_Eval_Command_Experiment` described below. Class description: Implement the TREC_Eval_Command_Experiment class. Method signatures and docstrings: - def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metr...
Implement the Python class `TREC_Eval_Command_Experiment` described below. Class description: Implement the TREC_Eval_Command_Experiment class. Method signatures and docstrings: - def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metr...
92dd4d41ad6f2be5b5c4e296e2a355bb14b9a1db
<|skeleton|> class TREC_Eval_Command_Experiment: def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metrics=['ndcg_cut_3', 'ndcg_cut_5', 'ndcg_cut_1000', 'map_cut_1000', 'recall_500', 'recall_1000'], q_rel_file='datasets/TREC_CAsT/2...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TREC_Eval_Command_Experiment: def __init__(self, trec_eval_command='trec_eval -q -c -M1000 -m ndcg_cut.3,5,10,15,20,100,1000 -m all_trec qRELS RUN_FILE', relevant_metrics=['ndcg_cut_3', 'ndcg_cut_5', 'ndcg_cut_1000', 'map_cut_1000', 'recall_500', 'recall_1000'], q_rel_file='datasets/TREC_CAsT/2020qrels.txt')...
the_stack_v2_python_sparse
notebooks/src/Experiments.py
carlos-gemmell/Glasgow-NLP
train
0
106f72fc320b7c2f5c3743091c3f0dfeb99a35b6
[ "Version.objects.all().delete()\nTestModel.objects.all().delete()\nTestManyToManyModel.objects.all().delete()\nreversion.register(TestModel, follow=('testmanytomanymodel_set',))\nreversion.register(TestManyToManyModel, follow=('relations',))", "with reversion.revision:\n test1 = TestModel.objects.create(name='...
<|body_start_0|> Version.objects.all().delete() TestModel.objects.all().delete() TestManyToManyModel.objects.all().delete() reversion.register(TestModel, follow=('testmanytomanymodel_set',)) reversion.register(TestManyToManyModel, follow=('relations',)) <|end_body_0|> <|body_sta...
Tests the ManyToMany support.
ReversionManyToManyTest
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReversionManyToManyTest: """Tests the ManyToMany support.""" def setUp(self): """Sets up the TestModel.""" <|body_0|> def testCanCreateRevision(self): """Tests that a revision containing both models is created.""" <|body_1|> def testCanCreateRevision...
stack_v2_sparse_classes_10k_train_007677
24,355
permissive
[ { "docstring": "Sets up the TestModel.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests that a revision containing both models is created.", "name": "testCanCreateRevision", "signature": "def testCanCreateRevision(self)" }, { "docstring": "Tests that a r...
6
null
Implement the Python class `ReversionManyToManyTest` described below. Class description: Tests the ManyToMany support. Method signatures and docstrings: - def setUp(self): Sets up the TestModel. - def testCanCreateRevision(self): Tests that a revision containing both models is created. - def testCanCreateRevisionRela...
Implement the Python class `ReversionManyToManyTest` described below. Class description: Tests the ManyToMany support. Method signatures and docstrings: - def setUp(self): Sets up the TestModel. - def testCanCreateRevision(self): Tests that a revision containing both models is created. - def testCanCreateRevisionRela...
abc3fbfb34f791f84e9a9d4dc522966421778ab2
<|skeleton|> class ReversionManyToManyTest: """Tests the ManyToMany support.""" def setUp(self): """Sets up the TestModel.""" <|body_0|> def testCanCreateRevision(self): """Tests that a revision containing both models is created.""" <|body_1|> def testCanCreateRevision...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReversionManyToManyTest: """Tests the ManyToMany support.""" def setUp(self): """Sets up the TestModel.""" Version.objects.all().delete() TestModel.objects.all().delete() TestManyToManyModel.objects.all().delete() reversion.register(TestModel, follow=('testmanytoma...
the_stack_v2_python_sparse
py/django_tools/django-reversion/src/reversion/tests.py
marceltoben/evandrix.github.com
train
3
9bc0e5788345cca6d77b7b1463622f186d7ab828
[ "method_map = kwargs['method_map'] if kwargs.get('method_map', None) else self.method_map\nfor request_method, mapped_method in method_map.items():\n mapped_method = getattr(self, mapped_method)\n method_proxy = self.view_proxy(mapped_method)\n setattr(self, request_method, method_proxy)\nsuper(APIMethodMa...
<|body_start_0|> method_map = kwargs['method_map'] if kwargs.get('method_map', None) else self.method_map for request_method, mapped_method in method_map.items(): mapped_method = getattr(self, mapped_method) method_proxy = self.view_proxy(mapped_method) setattr(self, ...
将请求方法映射到子类属性上 :method_map: dict, 方法映射字典。 如将 get 方法映射到 list 方法,其值则为 {'get':'list'}
APIMethodMapMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIMethodMapMixin: """将请求方法映射到子类属性上 :method_map: dict, 方法映射字典。 如将 get 方法映射到 list 方法,其值则为 {'get':'list'}""" def __init__(self, *args, **kwargs): """映射请求方法。会从传入子类的关键字参数中寻找 method_map 参数,期望值为 dict类型。寻找对应参数值。 若在类属性和传入参数中同时定义了 method_map ,则以传入参数为准。 :param args: 传入的位置参数 :param kwargs: 传入的关...
stack_v2_sparse_classes_10k_train_007678
9,950
no_license
[ { "docstring": "映射请求方法。会从传入子类的关键字参数中寻找 method_map 参数,期望值为 dict类型。寻找对应参数值。 若在类属性和传入参数中同时定义了 method_map ,则以传入参数为准。 :param args: 传入的位置参数 :param kwargs: 传入的关键字参数", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "代理被映射方法,并代理接收传入视图函数的其他参数。 :param mapped_method...
2
stack_v2_sparse_classes_30k_train_003179
Implement the Python class `APIMethodMapMixin` described below. Class description: 将请求方法映射到子类属性上 :method_map: dict, 方法映射字典。 如将 get 方法映射到 list 方法,其值则为 {'get':'list'} Method signatures and docstrings: - def __init__(self, *args, **kwargs): 映射请求方法。会从传入子类的关键字参数中寻找 method_map 参数,期望值为 dict类型。寻找对应参数值。 若在类属性和传入参数中同时定义了 metho...
Implement the Python class `APIMethodMapMixin` described below. Class description: 将请求方法映射到子类属性上 :method_map: dict, 方法映射字典。 如将 get 方法映射到 list 方法,其值则为 {'get':'list'} Method signatures and docstrings: - def __init__(self, *args, **kwargs): 映射请求方法。会从传入子类的关键字参数中寻找 method_map 参数,期望值为 dict类型。寻找对应参数值。 若在类属性和传入参数中同时定义了 metho...
9821516dc739a1fdeca688454831728b64461999
<|skeleton|> class APIMethodMapMixin: """将请求方法映射到子类属性上 :method_map: dict, 方法映射字典。 如将 get 方法映射到 list 方法,其值则为 {'get':'list'}""" def __init__(self, *args, **kwargs): """映射请求方法。会从传入子类的关键字参数中寻找 method_map 参数,期望值为 dict类型。寻找对应参数值。 若在类属性和传入参数中同时定义了 method_map ,则以传入参数为准。 :param args: 传入的位置参数 :param kwargs: 传入的关...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class APIMethodMapMixin: """将请求方法映射到子类属性上 :method_map: dict, 方法映射字典。 如将 get 方法映射到 list 方法,其值则为 {'get':'list'}""" def __init__(self, *args, **kwargs): """映射请求方法。会从传入子类的关键字参数中寻找 method_map 参数,期望值为 dict类型。寻找对应参数值。 若在类属性和传入参数中同时定义了 method_map ,则以传入参数为准。 :param args: 传入的位置参数 :param kwargs: 传入的关键字参数""" ...
the_stack_v2_python_sparse
online_intepreter/mixins.py
Arithmeticjia/MyBlog
train
5
600b474162e535fa590fe388601d73e476261085
[ "super().__init__()\nself.add_module('conv', Conv(in_channels=in_feats, out_channels=out_feats, kernel_size=3, stride=1, padding=1, bias=False))\nself.add_module('norm', Norm(out_feats))\nself.add_module('relu', nn.ReLU(inplace=True))", "x = self.conv(x)\nx = self.norm(x)\nx = self.relu(x)\nreturn x" ]
<|body_start_0|> super().__init__() self.add_module('conv', Conv(in_channels=in_feats, out_channels=out_feats, kernel_size=3, stride=1, padding=1, bias=False)) self.add_module('norm', Norm(out_feats)) self.add_module('relu', nn.ReLU(inplace=True)) <|end_body_0|> <|body_start_1|> ...
A block consisting of a convolutional layer followed by batch normalization and ReLU activation. Args: in_feats (int): Number of input features. out_feats (int): Number of output features. Norm (nn.Module): A normalization layer. Conv (nn.Module): A convolutional layer.
_ConvBlock
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ConvBlock: """A block consisting of a convolutional layer followed by batch normalization and ReLU activation. Args: in_feats (int): Number of input features. out_feats (int): Number of output features. Norm (nn.Module): A normalization layer. Conv (nn.Module): A convolutional layer.""" def...
stack_v2_sparse_classes_10k_train_007679
24,719
permissive
[ { "docstring": "Initializes the ConvBlock. Args: in_feats (int): Number of input features. out_feats (int): Number of output features. Norm (nn.Module): A normalization layer. Conv (nn.Module): A convolutional layer.", "name": "__init__", "signature": "def __init__(self, in_feats, out_feats, Norm, Conv)...
2
stack_v2_sparse_classes_30k_train_000712
Implement the Python class `_ConvBlock` described below. Class description: A block consisting of a convolutional layer followed by batch normalization and ReLU activation. Args: in_feats (int): Number of input features. out_feats (int): Number of output features. Norm (nn.Module): A normalization layer. Conv (nn.Modu...
Implement the Python class `_ConvBlock` described below. Class description: A block consisting of a convolutional layer followed by batch normalization and ReLU activation. Args: in_feats (int): Number of input features. out_feats (int): Number of output features. Norm (nn.Module): A normalization layer. Conv (nn.Modu...
72eb99f68205afd5f8d49a3bb6cfc08cfd467582
<|skeleton|> class _ConvBlock: """A block consisting of a convolutional layer followed by batch normalization and ReLU activation. Args: in_feats (int): Number of input features. out_feats (int): Number of output features. Norm (nn.Module): A normalization layer. Conv (nn.Module): A convolutional layer.""" def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _ConvBlock: """A block consisting of a convolutional layer followed by batch normalization and ReLU activation. Args: in_feats (int): Number of input features. out_feats (int): Number of output features. Norm (nn.Module): A normalization layer. Conv (nn.Module): A convolutional layer.""" def __init__(sel...
the_stack_v2_python_sparse
GANDLF/models/unetr.py
mlcommons/GaNDLF
train
45
802b140501e2e4fa4a08c5199ede2efb439cba17
[ "dp = [i for i in range(n + 1)]\nsquares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]\nfor i in range(1, n + 1):\n for s in squares:\n if i < s:\n break\n dp[i] = min(dp[i], dp[i - s] + 1)\nreturn dp[-1]", "visited = [False] * (n + 1)\nqueue = [n]\nsquares = {i: i ** 2 for i in rang...
<|body_start_0|> dp = [i for i in range(n + 1)] squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)] for i in range(1, n + 1): for s in squares: if i < s: break dp[i] = min(dp[i], dp[i - s] + 1) return dp[-1] <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquaresBFS(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [i for i in range(n + 1)] squares = [i ** 2 for i in ra...
stack_v2_sparse_classes_10k_train_007680
1,657
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numSquares", "signature": "def numSquares(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numSquaresBFS", "signature": "def numSquaresBFS(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_000548
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquaresBFS(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 numSquares(self, n): :type n: int :rtype: int - def numSquaresBFS(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numSquares(self, n): """:t...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquaresBFS(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numSquares(self, n): """:type n: int :rtype: int""" dp = [i for i in range(n + 1)] squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)] for i in range(1, n + 1): for s in squares: if i < s: break d...
the_stack_v2_python_sparse
cs_notes/BFS/perfect_squares.py
hwc1824/LeetCodeSolution
train
0
a4bd136857769352d181965d0072472887e8c4bd
[ "self.batch_size = batch_size\nself.is_training = is_training\nself.latent_dim = latent_dim\nself.output_cells_dim = output_cells_dim\nself.var_scope = var_scope\nself.gen_layers = gen_layers\nself.output_lsn = output_lsn\nself.gen_cond_type = gen_cond_type\nself.clusters_no = clusters_no\nself.input_clusters = inp...
<|body_start_0|> self.batch_size = batch_size self.is_training = is_training self.latent_dim = latent_dim self.output_cells_dim = output_cells_dim self.var_scope = var_scope self.gen_layers = gen_layers self.output_lsn = output_lsn self.gen_cond_type = gen...
Generic class for the Generator network.
Generator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """Generic class for the Generator network.""" def __init__(self, fake_outputs, batch_size, latent_dim, output_cells_dim, var_scope, gen_layers, output_lsn, gen_cond_type=None, is_training=None, clusters_ratios=None, clusters_no=None, input_clusters=None, reuse=None): """D...
stack_v2_sparse_classes_10k_train_007681
29,633
permissive
[ { "docstring": "Default constructor. Parameters ---------- fake_outputs : Tensor Tensor holding the output of the generator. batch_size : int Batch size used during the training. latent_dim : int Dimension of the latent space used from which the input noise of the generator is sampled. output_cells_dim : int Di...
3
stack_v2_sparse_classes_30k_train_006613
Implement the Python class `Generator` described below. Class description: Generic class for the Generator network. Method signatures and docstrings: - def __init__(self, fake_outputs, batch_size, latent_dim, output_cells_dim, var_scope, gen_layers, output_lsn, gen_cond_type=None, is_training=None, clusters_ratios=No...
Implement the Python class `Generator` described below. Class description: Generic class for the Generator network. Method signatures and docstrings: - def __init__(self, fake_outputs, batch_size, latent_dim, output_cells_dim, var_scope, gen_layers, output_lsn, gen_cond_type=None, is_training=None, clusters_ratios=No...
a06f8ccd6a071d57e591dacd6164c9f78987a794
<|skeleton|> class Generator: """Generic class for the Generator network.""" def __init__(self, fake_outputs, batch_size, latent_dim, output_cells_dim, var_scope, gen_layers, output_lsn, gen_cond_type=None, is_training=None, clusters_ratios=None, clusters_no=None, input_clusters=None, reuse=None): """D...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Generator: """Generic class for the Generator network.""" def __init__(self, fake_outputs, batch_size, latent_dim, output_cells_dim, var_scope, gen_layers, output_lsn, gen_cond_type=None, is_training=None, clusters_ratios=None, clusters_no=None, input_clusters=None, reuse=None): """Default constr...
the_stack_v2_python_sparse
estimators/utilities.py
imsb-uke/scGAN
train
73
93e5989775c1779db6095dc63156b6743d503b4e
[ "author = g.user\ntag = TagModel.query.get(tag_id)\nif not tag:\n abort(404, error=f'Tag with id={tag_id} not found')\nif tag.author != author:\n abort(403, error=f'Access denied to tag with id={tag_id}')\nreturn (tag, 200)", "author = g.user\ntag = TagModel.query.get(tag_id)\nif not tag:\n abort(404, er...
<|body_start_0|> author = g.user tag = TagModel.query.get(tag_id) if not tag: abort(404, error=f'Tag with id={tag_id} not found') if tag.author != author: abort(403, error=f'Access denied to tag with id={tag_id}') return (tag, 200) <|end_body_0|> <|body_s...
TagResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagResource: def get(self, tag_id): """Возвращает тег по id. Требуется аутентификация. :param tag_id: id тега :return: тег""" <|body_0|> def put(self, tag_id, **kwargs): """Изменяет тег по id. Требуется аутентификация. :param tag_id: id тега :param kwargs: параметры ...
stack_v2_sparse_classes_10k_train_007682
3,928
no_license
[ { "docstring": "Возвращает тег по id. Требуется аутентификация. :param tag_id: id тега :return: тег", "name": "get", "signature": "def get(self, tag_id)" }, { "docstring": "Изменяет тег по id. Требуется аутентификация. :param tag_id: id тега :param kwargs: параметры для изменения тега :return: т...
3
stack_v2_sparse_classes_30k_val_000114
Implement the Python class `TagResource` described below. Class description: Implement the TagResource class. Method signatures and docstrings: - def get(self, tag_id): Возвращает тег по id. Требуется аутентификация. :param tag_id: id тега :return: тег - def put(self, tag_id, **kwargs): Изменяет тег по id. Требуется ...
Implement the Python class `TagResource` described below. Class description: Implement the TagResource class. Method signatures and docstrings: - def get(self, tag_id): Возвращает тег по id. Требуется аутентификация. :param tag_id: id тега :return: тег - def put(self, tag_id, **kwargs): Изменяет тег по id. Требуется ...
adb9a3f4524ab76e8ba656344e2ed452e87b577c
<|skeleton|> class TagResource: def get(self, tag_id): """Возвращает тег по id. Требуется аутентификация. :param tag_id: id тега :return: тег""" <|body_0|> def put(self, tag_id, **kwargs): """Изменяет тег по id. Требуется аутентификация. :param tag_id: id тега :param kwargs: параметры ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TagResource: def get(self, tag_id): """Возвращает тег по id. Требуется аутентификация. :param tag_id: id тега :return: тег""" author = g.user tag = TagModel.query.get(tag_id) if not tag: abort(404, error=f'Tag with id={tag_id} not found') if tag.author != au...
the_stack_v2_python_sparse
api/resources/tag.py
UshakovAleksandr/Blog
train
1
fce13c1fc668522367ea9f8bbe0eb33620fc9437
[ "self.webAddress = webAddress\nself.redirectAddress = redirectAddress\nself.clientId = clientId\nself.clientSecret = clientSecret\nif type(scopes) == list:\n self.scopes = ''\n for scope in scopes:\n self.scopes += '{} '.format(scope)\nelif type(scopes) == str:\n self.scopes = scopes\nelse:\n rai...
<|body_start_0|> self.webAddress = webAddress self.redirectAddress = redirectAddress self.clientId = clientId self.clientSecret = clientSecret if type(scopes) == list: self.scopes = '' for scope in scopes: self.scopes += '{} '.format(scope)...
Class to negotiate the authentication with the Autodesk Forge Api Authentication servers.
OAuth2Negotiator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuth2Negotiator: """Class to negotiate the authentication with the Autodesk Forge Api Authentication servers.""" def __init__(self, webAddress, clientId, clientSecret, scopes, redirectAddress=None, endAddress=None, timeout=1): """Initialize the OAuth2Negotiator class and assign the ...
stack_v2_sparse_classes_10k_train_007683
3,381
permissive
[ { "docstring": "Initialize the OAuth2Negotiator class and assign the needed parameters for authentication. Args: webAddress (str): Web address for the Autodesk Forge API authentication server. clientId (str): Client id for the Forge App this authentication is used for. clientSecret (str): Client secret for the ...
2
stack_v2_sparse_classes_30k_train_005956
Implement the Python class `OAuth2Negotiator` described below. Class description: Class to negotiate the authentication with the Autodesk Forge Api Authentication servers. Method signatures and docstrings: - def __init__(self, webAddress, clientId, clientSecret, scopes, redirectAddress=None, endAddress=None, timeout=...
Implement the Python class `OAuth2Negotiator` described below. Class description: Class to negotiate the authentication with the Autodesk Forge Api Authentication servers. Method signatures and docstrings: - def __init__(self, webAddress, clientId, clientSecret, scopes, redirectAddress=None, endAddress=None, timeout=...
50a95378e2cf37df210269c8576bdae57d232c3b
<|skeleton|> class OAuth2Negotiator: """Class to negotiate the authentication with the Autodesk Forge Api Authentication servers.""" def __init__(self, webAddress, clientId, clientSecret, scopes, redirectAddress=None, endAddress=None, timeout=1): """Initialize the OAuth2Negotiator class and assign the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OAuth2Negotiator: """Class to negotiate the authentication with the Autodesk Forge Api Authentication servers.""" def __init__(self, webAddress, clientId, clientSecret, scopes, redirectAddress=None, endAddress=None, timeout=1): """Initialize the OAuth2Negotiator class and assign the needed parame...
the_stack_v2_python_sparse
PyForge/AuthNegotiator.py
eduardhendriksen/PyForge
train
2
7d1b9baa94cd53c41b2e78671dae21d926f7bd39
[ "self.lrow = len(matrix)\nif self.lrow == 0:\n self.dp = [[]]\n return\nself.lcol = len(matrix[0])\nself.dp = [[0 for _ in range(self.lcol)] for _ in range(self.lrow)]\nfor i in range(self.lrow):\n for j in range(self.lcol):\n self.dp[i][j] = self.dp[i][j - 1] + matrix[i][j]", "r = 0\nfor row in r...
<|body_start_0|> self.lrow = len(matrix) if self.lrow == 0: self.dp = [[]] return self.lcol = len(matrix[0]) self.dp = [[0 for _ in range(self.lcol)] for _ in range(self.lrow)] for i in range(self.lrow): for j in range(self.lcol): ...
NumMatrix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_007684
1,038
permissive
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
65549f72c565d9f11641c86d6cef9c7988805817
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.lrow = len(matrix) if self.lrow == 0: self.dp = [[]] return self.lcol = len(matrix[0]) self.dp = [[0 for _ in range(self.lcol)] for _ in range(self.lrow)] for...
the_stack_v2_python_sparse
utils/numSumMatrix.py
wisesky/LeetCode-Practice
train
0
8e419dd4daffbd51e106252a8ad6b1d0425b18a9
[ "future_question = create_question(question_text='Future question.', days=5)\nresponse = self.client.get(reverse('polls:detail', args=(future_question.id,)))\nself.assertEqual(response.status_code, 404)", "past_question = create_question(question_text='Past Question.', days=-5)\nresponse = self.client.get(reverse...
<|body_start_0|> future_question = create_question(question_text='Future question.', days=5) response = self.client.get(reverse('polls:detail', args=(future_question.id,))) self.assertEqual(response.status_code, 404) <|end_body_0|> <|body_start_1|> past_question = create_question(questi...
QuestionIndexDetailTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionIndexDetailTests: def test_detail_view_with_a_future_question(self): """The detail view of a question with a pub_date in the future should return a 404 not found.""" <|body_0|> def test_detail_view_with_a_past_question(self): """The detail view of a question ...
stack_v2_sparse_classes_10k_train_007685
12,478
no_license
[ { "docstring": "The detail view of a question with a pub_date in the future should return a 404 not found.", "name": "test_detail_view_with_a_future_question", "signature": "def test_detail_view_with_a_future_question(self)" }, { "docstring": "The detail view of a question with a pub_date in the...
2
stack_v2_sparse_classes_30k_train_002619
Implement the Python class `QuestionIndexDetailTests` described below. Class description: Implement the QuestionIndexDetailTests class. Method signatures and docstrings: - def test_detail_view_with_a_future_question(self): The detail view of a question with a pub_date in the future should return a 404 not found. - de...
Implement the Python class `QuestionIndexDetailTests` described below. Class description: Implement the QuestionIndexDetailTests class. Method signatures and docstrings: - def test_detail_view_with_a_future_question(self): The detail view of a question with a pub_date in the future should return a 404 not found. - de...
43bca49c77eb16de7580e55f7418cdab92a9a596
<|skeleton|> class QuestionIndexDetailTests: def test_detail_view_with_a_future_question(self): """The detail view of a question with a pub_date in the future should return a 404 not found.""" <|body_0|> def test_detail_view_with_a_past_question(self): """The detail view of a question ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuestionIndexDetailTests: def test_detail_view_with_a_future_question(self): """The detail view of a question with a pub_date in the future should return a 404 not found.""" future_question = create_question(question_text='Future question.', days=5) response = self.client.get(reverse('...
the_stack_v2_python_sparse
sdd_project copy/labhelpers/tests.py
katrusso/LabHelpers
train
0
3659d158856a2feeb2e0680b0bf2eb2142f1c3a5
[ "k = None\ngo = True\nfor i in range(len(nums) - 1, -1, -1):\n for j in range(i + 1, len(nums)):\n if nums[i] < nums[j] and (k is None or nums[j] < nums[k]):\n k = j\n if k is not None:\n nums[i], nums[k] = (nums[k], nums[i])\n nums[i + 1:] = sorted(nums[i + 1:])\n break...
<|body_start_0|> k = None go = True for i in range(len(nums) - 1, -1, -1): for j in range(i + 1, len(nums)): if nums[i] < nums[j] and (k is None or nums[j] < nums[k]): k = j if k is not None: nums[i], nums[k] = (nums[k],...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_007686
2,067
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signature": "d...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def permuteUnique(self, nums): :type nums: List[int] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def permuteUnique(self, nums): :type nums: List[int] :...
c026f2969c784827fac702b34b07a9268b70b62a
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" k = None go = True for i in range(len(nums) - 1, -1, -1): for j in range(i + 1, len(nums)): if nums[i] < nums[j]...
the_stack_v2_python_sparse
codes/contest/leetcode/permutations-ii.py
jiluhu/dirtysalt.github.io
train
0
5ee937ced5a77d338602e7d14205dbeaa6cf50e5
[ "if user_input is None:\n user_input = {}\nreturn self.async_show_form(step_id='user', data_schema=vol.Schema({vol.Required(CONF_STATION_CODE, default=user_input.get(CONF_STATION_CODE, '')): str}), errors=errors or {})", "errors = {}\nif user_input is None:\n return self._show_setup_form(user_input, errors)...
<|body_start_0|> if user_input is None: user_input = {} return self.async_show_form(step_id='user', data_schema=vol.Schema({vol.Required(CONF_STATION_CODE, default=user_input.get(CONF_STATION_CODE, '')): str}), errors=errors or {}) <|end_body_0|> <|body_start_1|> errors = {} ...
Handle a Meteoclimatic config flow.
MeteoclimaticFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeteoclimaticFlowHandler: """Handle a Meteoclimatic config flow.""" def _show_setup_form(self, user_input=None, errors=None): """Show the setup form to the user.""" <|body_0|> async def async_step_user(self, user_input=None): """Handle a flow initiated by the use...
stack_v2_sparse_classes_10k_train_007687
2,082
permissive
[ { "docstring": "Show the setup form to the user.", "name": "_show_setup_form", "signature": "def _show_setup_form(self, user_input=None, errors=None)" }, { "docstring": "Handle a flow initiated by the user.", "name": "async_step_user", "signature": "async def async_step_user(self, user_i...
2
stack_v2_sparse_classes_30k_train_004874
Implement the Python class `MeteoclimaticFlowHandler` described below. Class description: Handle a Meteoclimatic config flow. Method signatures and docstrings: - def _show_setup_form(self, user_input=None, errors=None): Show the setup form to the user. - async def async_step_user(self, user_input=None): Handle a flow...
Implement the Python class `MeteoclimaticFlowHandler` described below. Class description: Handle a Meteoclimatic config flow. Method signatures and docstrings: - def _show_setup_form(self, user_input=None, errors=None): Show the setup form to the user. - async def async_step_user(self, user_input=None): Handle a flow...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class MeteoclimaticFlowHandler: """Handle a Meteoclimatic config flow.""" def _show_setup_form(self, user_input=None, errors=None): """Show the setup form to the user.""" <|body_0|> async def async_step_user(self, user_input=None): """Handle a flow initiated by the use...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MeteoclimaticFlowHandler: """Handle a Meteoclimatic config flow.""" def _show_setup_form(self, user_input=None, errors=None): """Show the setup form to the user.""" if user_input is None: user_input = {} return self.async_show_form(step_id='user', data_schema=vol.Schem...
the_stack_v2_python_sparse
homeassistant/components/meteoclimatic/config_flow.py
home-assistant/core
train
35,501
24581175401848fac323e00d17629aabd49187d7
[ "results = super(CompanyLDAP, self).get_ldap_dicts()\nldaps = self.sudo().search([('ldap_server', '!=', False)], order='sequence')\ncacert_paths = ldaps.read(['cacert_path'])\nfor i in range(len(results)):\n results[i].update(cacert_paths[i])\nreturn results", "uri = 'ldap://%s:%d' % (conf['ldap_server'], conf...
<|body_start_0|> results = super(CompanyLDAP, self).get_ldap_dicts() ldaps = self.sudo().search([('ldap_server', '!=', False)], order='sequence') cacert_paths = ldaps.read(['cacert_path']) for i in range(len(results)): results[i].update(cacert_paths[i]) return results...
CompanyLDAP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanyLDAP: def get_ldap_dicts(self): """Add cacert_path to ldap_dicts""" <|body_0|> def connect(self, conf): """Override odoo connect function to fix StartTLS Connect to an LDAP server specified by an ldap configuration dictionary. :param dict conf: LDAP configurat...
stack_v2_sparse_classes_10k_train_007688
1,325
no_license
[ { "docstring": "Add cacert_path to ldap_dicts", "name": "get_ldap_dicts", "signature": "def get_ldap_dicts(self)" }, { "docstring": "Override odoo connect function to fix StartTLS Connect to an LDAP server specified by an ldap configuration dictionary. :param dict conf: LDAP configuration :retur...
2
stack_v2_sparse_classes_30k_train_006833
Implement the Python class `CompanyLDAP` described below. Class description: Implement the CompanyLDAP class. Method signatures and docstrings: - def get_ldap_dicts(self): Add cacert_path to ldap_dicts - def connect(self, conf): Override odoo connect function to fix StartTLS Connect to an LDAP server specified by an ...
Implement the Python class `CompanyLDAP` described below. Class description: Implement the CompanyLDAP class. Method signatures and docstrings: - def get_ldap_dicts(self): Add cacert_path to ldap_dicts - def connect(self, conf): Override odoo connect function to fix StartTLS Connect to an LDAP server specified by an ...
c355e18aeb3e7123fe184fcc7ec06485ab498343
<|skeleton|> class CompanyLDAP: def get_ldap_dicts(self): """Add cacert_path to ldap_dicts""" <|body_0|> def connect(self, conf): """Override odoo connect function to fix StartTLS Connect to an LDAP server specified by an ldap configuration dictionary. :param dict conf: LDAP configurat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CompanyLDAP: def get_ldap_dicts(self): """Add cacert_path to ldap_dicts""" results = super(CompanyLDAP, self).get_ldap_dicts() ldaps = self.sudo().search([('ldap_server', '!=', False)], order='sequence') cacert_paths = ldaps.read(['cacert_path']) for i in range(len(resu...
the_stack_v2_python_sparse
auth_ldap_tls/models/res_company_ldap.py
rythe77/odoo11_customized
train
5
ee7b5825add6c424d2cd9ae8e2a32436bdd3bde4
[ "output = []\nif root is None:\n return str([])\nqueue = deque()\nqueue.append(root)\nwhile queue:\n cur = queue.popleft()\n if cur is None:\n output.append('#')\n continue\n output.append(cur.val)\n queue.extend([cur.left, cur.right])\nreturn str(output)", "if data == '[]':\n retu...
<|body_start_0|> output = [] if root is None: return str([]) queue = deque() queue.append(root) while queue: cur = queue.popleft() if cur is None: output.append('#') continue output.append(cur.val) ...
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_10k_train_007689
1,846
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:...
61923f8714f21e8dd5ebafa89b2c3929cff3adf1
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" output = [] if root is None: return str([]) queue = deque() queue.append(root) while queue: cur = queue.popleft() if c...
the_stack_v2_python_sparse
Leetcode/Hard/BSTSerialize.py
pumbaacave/atcoder
train
1
6260698a778091b1c0d836752927da6b53939092
[ "snap = super(FlowArea, self).snapshot()\nsnap['direction'] = self.direction\nsnap['align'] = self.align\nsnap['horizontal_spacing'] = self.horizontal_spacing\nsnap['vertical_spacing'] = self.vertical_spacing\nsnap['margins'] = self.margins\nreturn snap", "super(FlowArea, self).bind()\nattrs = ('direction', 'alig...
<|body_start_0|> snap = super(FlowArea, self).snapshot() snap['direction'] = self.direction snap['align'] = self.align snap['horizontal_spacing'] = self.horizontal_spacing snap['vertical_spacing'] = self.vertical_spacing snap['margins'] = self.margins return snap ...
A widget which lays out its children in flowing manner, wrapping around at the end of the available space.
FlowArea
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowArea: """A widget which lays out its children in flowing manner, wrapping around at the end of the available space.""" def snapshot(self): """Returns the snapshot dict for the FlowArea.""" <|body_0|> def bind(self): """Bind the change handler for the FlowItem...
stack_v2_sparse_classes_10k_train_007690
2,869
permissive
[ { "docstring": "Returns the snapshot dict for the FlowArea.", "name": "snapshot", "signature": "def snapshot(self)" }, { "docstring": "Bind the change handler for the FlowItem.", "name": "bind", "signature": "def bind(self)" }, { "docstring": "The getter for the 'flow_items' prop...
3
null
Implement the Python class `FlowArea` described below. Class description: A widget which lays out its children in flowing manner, wrapping around at the end of the available space. Method signatures and docstrings: - def snapshot(self): Returns the snapshot dict for the FlowArea. - def bind(self): Bind the change han...
Implement the Python class `FlowArea` described below. Class description: A widget which lays out its children in flowing manner, wrapping around at the end of the available space. Method signatures and docstrings: - def snapshot(self): Returns the snapshot dict for the FlowArea. - def bind(self): Bind the change han...
424bba29219de58fe9e47196de6763de8b2009f2
<|skeleton|> class FlowArea: """A widget which lays out its children in flowing manner, wrapping around at the end of the available space.""" def snapshot(self): """Returns the snapshot dict for the FlowArea.""" <|body_0|> def bind(self): """Bind the change handler for the FlowItem...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlowArea: """A widget which lays out its children in flowing manner, wrapping around at the end of the available space.""" def snapshot(self): """Returns the snapshot dict for the FlowArea.""" snap = super(FlowArea, self).snapshot() snap['direction'] = self.direction snap[...
the_stack_v2_python_sparse
enaml/widgets/flow_area.py
enthought/enaml
train
17
046d76758e1b005faef5dcfa3d772c11ab50a958
[ "self.horizontal_line = [ShapePoint(start_end_points[0]), ShapePoint(start_end_points[1])]\nself.colors = colors or list()\nself.bins = bins\ncolumn_count = 2\ncolumns_width = (0.8, 0.2)\nself.text = text\nself.text_scale = 0.6\nself.start_dots_values = start_dots_values\nself.default_color = 'red'\nself.customers,...
<|body_start_0|> self.horizontal_line = [ShapePoint(start_end_points[0]), ShapePoint(start_end_points[1])] self.colors = colors or list() self.bins = bins column_count = 2 columns_width = (0.8, 0.2) self.text = text self.text_scale = 0.6 self.start_dots_va...
Overridden Table class. Custom text and dots were added.
CustomersTable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomersTable: """Overridden Table class. Custom text and dots were added.""" def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.5, visible_row_count: int=0, colors: list=None, bins: Union[int, float]=0, text: str='', start_dots_value...
stack_v2_sparse_classes_10k_train_007691
9,066
no_license
[ { "docstring": "Class initialization. Args: start_end_points (Tuple[tuple, tuple]): Left top and right top points. ((x1,y1), (x2,y2)). row_count (int, optional): Table row count. Defaults to 0. row_height (Union[int, float], optional): Table row height. Defaults to 0.2. visible_row_count (int, optional): Table ...
2
stack_v2_sparse_classes_30k_train_006738
Implement the Python class `CustomersTable` described below. Class description: Overridden Table class. Custom text and dots were added. Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.5, visible_row_count: int=0, colors: ...
Implement the Python class `CustomersTable` described below. Class description: Overridden Table class. Custom text and dots were added. Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.5, visible_row_count: int=0, colors: ...
290bf56ef888283a0225939ed8b1f87445e506d0
<|skeleton|> class CustomersTable: """Overridden Table class. Custom text and dots were added.""" def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.5, visible_row_count: int=0, colors: list=None, bins: Union[int, float]=0, text: str='', start_dots_value...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomersTable: """Overridden Table class. Custom text and dots were added.""" def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.5, visible_row_count: int=0, colors: list=None, bins: Union[int, float]=0, text: str='', start_dots_values: list=None)...
the_stack_v2_python_sparse
classes/table.py
mohovkm/habr_manim
train
0
b1d217c48da1f80ffbbea6749dd6d83afb775db1
[ "include_inactive = request.args.get('include_inactive', '0') != '0'\nget_users_response = InternalApi().get(url_for('flexmeasures_api_v2_0.get_users', include_inactive=include_inactive))\nusers = [process_internal_api_response(user, make_obj=True) for user in get_users_response.json()]\nreturn render_flexmeasures_...
<|body_start_0|> include_inactive = request.args.get('include_inactive', '0') != '0' get_users_response = InternalApi().get(url_for('flexmeasures_api_v2_0.get_users', include_inactive=include_inactive)) users = [process_internal_api_response(user, make_obj=True) for user in get_users_response.js...
UserCrudUI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCrudUI: def index(self): """/users""" <|body_0|> def get(self, id: str): """GET from /users/<id>""" <|body_1|> def toggle_active(self, id: str): """Toggle activation status via /users/toggle_active/<id>""" <|body_2|> def reset_pa...
stack_v2_sparse_classes_10k_train_007692
4,885
permissive
[ { "docstring": "/users", "name": "index", "signature": "def index(self)" }, { "docstring": "GET from /users/<id>", "name": "get", "signature": "def get(self, id: str)" }, { "docstring": "Toggle activation status via /users/toggle_active/<id>", "name": "toggle_active", "si...
4
null
Implement the Python class `UserCrudUI` described below. Class description: Implement the UserCrudUI class. Method signatures and docstrings: - def index(self): /users - def get(self, id: str): GET from /users/<id> - def toggle_active(self, id: str): Toggle activation status via /users/toggle_active/<id> - def reset_...
Implement the Python class `UserCrudUI` described below. Class description: Implement the UserCrudUI class. Method signatures and docstrings: - def index(self): /users - def get(self, id: str): GET from /users/<id> - def toggle_active(self, id: str): Toggle activation status via /users/toggle_active/<id> - def reset_...
6ba518bae7e9b8a715b9a05f6fae19f5e4ade791
<|skeleton|> class UserCrudUI: def index(self): """/users""" <|body_0|> def get(self, id: str): """GET from /users/<id>""" <|body_1|> def toggle_active(self, id: str): """Toggle activation status via /users/toggle_active/<id>""" <|body_2|> def reset_pa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserCrudUI: def index(self): """/users""" include_inactive = request.args.get('include_inactive', '0') != '0' get_users_response = InternalApi().get(url_for('flexmeasures_api_v2_0.get_users', include_inactive=include_inactive)) users = [process_internal_api_response(user, make_...
the_stack_v2_python_sparse
flexmeasures/ui/crud/users.py
meeseeksmachine/flexmeasures
train
0
aab53c42c26c9d1287effbd607bd152114a4056c
[ "req_body = cli.make_body(sp=sp, ipPort=ip_port, ipAddress=ip_address, netmask=netmask, v6PrefixLength=v6_prefix_length, gateway=gateway, vlanId=vlan_id)\nresp = cli.post(cls().resource_class, **req_body)\nresp.raise_if_err()\nreturn cls.get(cli, resp.resource_id)", "req_body = self._cli.make_body(sp=sp, ipPort=i...
<|body_start_0|> req_body = cli.make_body(sp=sp, ipPort=ip_port, ipAddress=ip_address, netmask=netmask, v6PrefixLength=v6_prefix_length, gateway=gateway, vlanId=vlan_id) resp = cli.post(cls().resource_class, **req_body) resp.raise_if_err() return cls.get(cli, resp.resource_id) <|end_body...
UnityReplicationInterface
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnityReplicationInterface: def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on...
stack_v2_sparse_classes_10k_train_007693
3,507
permissive
[ { "docstring": "Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on which the replication interface is running. :param ip_port: `UnityIpPort` object. Physical port or link aggregation on the storage processor on which...
2
null
Implement the Python class `UnityReplicationInterface` described below. Class description: Implement the UnityReplicationInterface class. Method signatures and docstrings: - def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): Creates a replication interface....
Implement the Python class `UnityReplicationInterface` described below. Class description: Implement the UnityReplicationInterface class. Method signatures and docstrings: - def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): Creates a replication interface....
ccfccba0bceda34c0d5dc8105c95731036f4e955
<|skeleton|> class UnityReplicationInterface: def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UnityReplicationInterface: def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on which the rep...
the_stack_v2_python_sparse
storops/unity/resource/replication_interface.py
emc-openstack/storops
train
61
a7761fd27dde869d14df70a5edc58025834e9163
[ "self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\nself.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)\na, b = self.tokenize_dataset(self.data_train)\nself.tokenizer_en = b\nself.tokenizer_pt = a", "pp = []\nee = []\nfor p...
<|body_start_0|> self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) self.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True) a, b = self.tokenize_dataset(self.data_train) self.tokenizer_en = b se...
Class methods
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Class methods""" def __init__(self): """class constructor""" <|body_0|> def tokenize_dataset(self, data): """creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """encodes a translation into tokens"...
stack_v2_sparse_classes_10k_train_007694
1,609
no_license
[ { "docstring": "class constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "creates sub-word tokenizers for our dataset", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" }, { "docstring": "encodes a translation into tok...
3
stack_v2_sparse_classes_30k_test_000377
Implement the Python class `Dataset` described below. Class description: Class methods Method signatures and docstrings: - def __init__(self): class constructor - def tokenize_dataset(self, data): creates sub-word tokenizers for our dataset - def encode(self, pt, en): encodes a translation into tokens
Implement the Python class `Dataset` described below. Class description: Class methods Method signatures and docstrings: - def __init__(self): class constructor - def tokenize_dataset(self, data): creates sub-word tokenizers for our dataset - def encode(self, pt, en): encodes a translation into tokens <|skeleton|> c...
91300120d38acb6440a6dbb8c408b1193c07de88
<|skeleton|> class Dataset: """Class methods""" def __init__(self): """class constructor""" <|body_0|> def tokenize_dataset(self, data): """creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """encodes a translation into tokens"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Dataset: """Class methods""" def __init__(self): """class constructor""" self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) self.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True) a, b = ...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/1-dataset.py
anaruzz/holbertonschool-machine_learning
train
0
8a82340e52e1e486e613389d71969df2d28f9ea7
[ "super().__init__(kwargs)\nself.desc = copy.deepcopy(kwargs)\nself.fm = NormalizedWeightedFMLayer(input_dim4lookup=kwargs['input_dim4lookup'], alpha_init_mean=kwargs['alpha_init_mean'], alpha_init_radius=0.0001, alpha_activation=kwargs['alpha_activation'], selected_pairs=kwargs['selected_pairs'])\nself.l1_cover_par...
<|body_start_0|> super().__init__(kwargs) self.desc = copy.deepcopy(kwargs) self.fm = NormalizedWeightedFMLayer(input_dim4lookup=kwargs['input_dim4lookup'], alpha_init_mean=kwargs['alpha_init_mean'], alpha_init_radius=0.0001, alpha_activation=kwargs['alpha_activation'], selected_pairs=kwargs['se...
Automatic Feature Interaction Selection (FIS) For DeepFM. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim4lookup: int :param embed_dim: length of each feature's latent vector(embedding ...
AutoGateModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoGateModel: """Automatic Feature Interaction Selection (FIS) For DeepFM. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim4lookup: int :param embed_dim: length o...
stack_v2_sparse_classes_10k_train_007695
3,679
permissive
[ { "docstring": "Construct the AutoGateModel class. :param net_desc: config of the structure :type net_desc: class object :return: return AutoGateModel class :rtype: class object", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Retrieve feature interaction scor...
2
null
Implement the Python class `AutoGateModel` described below. Class description: Automatic Feature Interaction Selection (FIS) For DeepFM. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim...
Implement the Python class `AutoGateModel` described below. Class description: Automatic Feature Interaction Selection (FIS) For DeepFM. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class AutoGateModel: """Automatic Feature Interaction Selection (FIS) For DeepFM. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim4lookup: int :param embed_dim: length o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AutoGateModel: """Automatic Feature Interaction Selection (FIS) For DeepFM. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim4lookup: int :param embed_dim: length of each featur...
the_stack_v2_python_sparse
zeus/networks/pytorch/customs/autogate.py
huawei-noah/xingtian
train
308
708d26e2ea4e4ff93db62ddf7d60a9b528bdc111
[ "topicTitle = request.args.get('topicTitle', '', type=str)\nreportId = request.args.get('reportId', 0, type=int)\nalgorithm = request.args.get('algorithm', '', type=str)\nthreshold = request.args.get('threshold', 0, type=float)\npage = request.args.get('page', 1, type=int)\nper_page = request.args.get('per_page', 1...
<|body_start_0|> topicTitle = request.args.get('topicTitle', '', type=str) reportId = request.args.get('reportId', 0, type=int) algorithm = request.args.get('algorithm', '', type=str) threshold = request.args.get('threshold', 0, type=float) page = request.args.get('page', 1, type...
EmotionAnalyzerController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmotionAnalyzerController: def get(self): """Returns a page of tweet with emotions""" <|body_0|> def post(self): """Analyses the emotion of tweets generated by a similarity algorithm.""" <|body_1|> <|end_skeleton|> <|body_start_0|> topicTitle = requ...
stack_v2_sparse_classes_10k_train_007696
2,883
no_license
[ { "docstring": "Returns a page of tweet with emotions", "name": "get", "signature": "def get(self)" }, { "docstring": "Analyses the emotion of tweets generated by a similarity algorithm.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003468
Implement the Python class `EmotionAnalyzerController` described below. Class description: Implement the EmotionAnalyzerController class. Method signatures and docstrings: - def get(self): Returns a page of tweet with emotions - def post(self): Analyses the emotion of tweets generated by a similarity algorithm.
Implement the Python class `EmotionAnalyzerController` described below. Class description: Implement the EmotionAnalyzerController class. Method signatures and docstrings: - def get(self): Returns a page of tweet with emotions - def post(self): Analyses the emotion of tweets generated by a similarity algorithm. <|sk...
e8d5fd562724df1ad26b90d0c731e133b052df24
<|skeleton|> class EmotionAnalyzerController: def get(self): """Returns a page of tweet with emotions""" <|body_0|> def post(self): """Analyses the emotion of tweets generated by a similarity algorithm.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EmotionAnalyzerController: def get(self): """Returns a page of tweet with emotions""" topicTitle = request.args.get('topicTitle', '', type=str) reportId = request.args.get('reportId', 0, type=int) algorithm = request.args.get('algorithm', '', type=str) threshold = reque...
the_stack_v2_python_sparse
app/main/controllers/emotionAnalyzerController.py
ProyectoFinal2020/TweetAnalyzer-Backend
train
0
a2b22a60dab12bf7e7554da6c77aeab2692b3b5f
[ "n = len(triangle)\ndp = [[0] * n for _ in range(n)]\nfor i in range(n - 1, -1, -1):\n for j in range(len(triangle[i]) - 1, -1, -1):\n if i == n - 1:\n dp[i][j] = triangle[i][j]\n else:\n dp[i][j] = min(dp[i + 1][j + 1], dp[i + 1][j]) + triangle[i][j]\nreturn dp[0][0]", "if ...
<|body_start_0|> n = len(triangle) dp = [[0] * n for _ in range(n)] for i in range(n - 1, -1, -1): for j in range(len(triangle[i]) - 1, -1, -1): if i == n - 1: dp[i][j] = triangle[i][j] else: dp[i][j] = min(dp[i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotal2(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(triang...
stack_v2_sparse_classes_10k_train_007697
3,302
no_license
[ { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotal", "signature": "def minimumTotal(self, triangle)" }, { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotal2", "signature": "def minimumTotal2(self, triangle)" } ]
2
stack_v2_sparse_classes_30k_test_000391
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotal2(self, triangle): :type triangle: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotal2(self, triangle): :type triangle: List[List[int]] :rtype: int <|skeleton|> class...
690b685048c8e89d26047b6bc48b5f9af7d59cbb
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotal2(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" n = len(triangle) dp = [[0] * n for _ in range(n)] for i in range(n - 1, -1, -1): for j in range(len(triangle[i]) - 1, -1, -1): if i == n - 1: ...
the_stack_v2_python_sparse
数组/120. 三角形最小路径和.py
SimmonsChen/LeetCode
train
0
dd9bf306928f5cb5cc4ac537661e6a284ab1b507
[ "super().__init__()\nimport sklearn\nimport sklearn.linear_model\nself.model = sklearn.linear_model.LarsCV", "specs = super(LarsCV, cls).getInputSpecification()\nspecs.description = 'The \\\\xmlNode{LarsCV} is Cross-validated \\\\textit{Least Angle Regression model} model\\n is a regression...
<|body_start_0|> super().__init__() import sklearn import sklearn.linear_model self.model = sklearn.linear_model.LarsCV <|end_body_0|> <|body_start_1|> specs = super(LarsCV, cls).getInputSpecification() specs.description = 'The \\xmlNode{LarsCV} is Cross-validated \\text...
Cross-validated Least Angle Regression model.
LarsCV
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LarsCV: """Cross-validated Least Angle Regression model.""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a c...
stack_v2_sparse_classes_10k_train_007698
6,409
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
null
Implement the Python class `LarsCV` described below. Class description: Cross-validated Least Angle Regression model. Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to g...
Implement the Python class `LarsCV` described below. Class description: Cross-validated Least Angle Regression model. Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to g...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class LarsCV: """Cross-validated Least Angle Regression model.""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LarsCV: """Cross-validated Least Angle Regression model.""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.linear_model self.model = sklea...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/LinearModel/LarsCV.py
idaholab/raven
train
201
2f8e94dd4de6db0b49673e27b220bd8d13830f0a
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookFilter()", "from .entity import Entity\nfrom .workbook_filter_criteria import WorkbookFilterCriteria\nfrom .entity import Entity\nfrom .workbook_filter_criteria import WorkbookFilterCriteria\nfields: Dict[str, Callable[[Any], N...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WorkbookFilter() <|end_body_0|> <|body_start_1|> from .entity import Entity from .workbook_filter_criteria import WorkbookFilterCriteria from .entity import Entity from ....
WorkbookFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkbookFilter: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_10k_train_007699
2,232
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: WorkbookFilter", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
null
Implement the Python class `WorkbookFilter` described below. Class description: Implement the WorkbookFilter class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `WorkbookFilter` described below. Class description: Implement the WorkbookFilter class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WorkbookFilter: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WorkbookFilter: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: WorkbookFi...
the_stack_v2_python_sparse
msgraph/generated/models/workbook_filter.py
microsoftgraph/msgraph-sdk-python
train
135