blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
9f36fc4dee7fef4ff76ff39992ba012bcf394447
[ "page = convert_safely(int, request.args.get('page'), 1)\nfeatures = FeatureDB.query.paginate(page, per_page=LIMIT_PER_PAGE, error_out=False).items\nreturn (features, HTTPStatus.OK)", "feature = FeatureDB.get_by_name(api.payload.get('name'))\ntry:\n if feature:\n feature.add_users(api.payload.get('users...
<|body_start_0|> page = convert_safely(int, request.args.get('page'), 1) features = FeatureDB.query.paginate(page, per_page=LIMIT_PER_PAGE, error_out=False).items return (features, HTTPStatus.OK) <|end_body_0|> <|body_start_1|> feature = FeatureDB.get_by_name(api.payload.get('name')) ...
List and Add features.
ListFeatures
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListFeatures: """List and Add features.""" def get(self): """List of paginated features""" <|body_0|> def post(self): """Add new feature, update it with users if name is identical""" <|body_1|> <|end_skeleton|> <|body_start_0|> page = convert_sa...
stack_v2_sparse_classes_36k_train_034700
3,855
permissive
[ { "docstring": "List of paginated features", "name": "get", "signature": "def get(self)" }, { "docstring": "Add new feature, update it with users if name is identical", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_005554
Implement the Python class `ListFeatures` described below. Class description: List and Add features. Method signatures and docstrings: - def get(self): List of paginated features - def post(self): Add new feature, update it with users if name is identical
Implement the Python class `ListFeatures` described below. Class description: List and Add features. Method signatures and docstrings: - def get(self): List of paginated features - def post(self): Add new feature, update it with users if name is identical <|skeleton|> class ListFeatures: """List and Add features...
18e9ed6d2a660a9fe188881d4af79af3638cdd73
<|skeleton|> class ListFeatures: """List and Add features.""" def get(self): """List of paginated features""" <|body_0|> def post(self): """Add new feature, update it with users if name is identical""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListFeatures: """List and Add features.""" def get(self): """List of paginated features""" page = convert_safely(int, request.args.get('page'), 1) features = FeatureDB.query.paginate(page, per_page=LIMIT_PER_PAGE, error_out=False).items return (features, HTTPStatus.OK) ...
the_stack_v2_python_sparse
requester/api/endpoints/features.py
mrf345/flask_restful_api_production_example
train
1
092bdb9a602ae0f2f00413fa5729592b6f90b7ca
[ "prop = typeFor(ref)\nif not isinstance(prop, TypeProperty):\n return False\nassert isinstance(prop, TypeProperty)\nassert isinstance(prop.parent, TypeContainer), 'Invalid parent for %s' % prop\nif prop.parent.isValid(self):\n descriptor, _clazz = getAttrAndClass(self.__class__, prop.name)\n if not isinsta...
<|body_start_0|> prop = typeFor(ref) if not isinstance(prop, TypeProperty): return False assert isinstance(prop, TypeProperty) assert isinstance(prop.parent, TypeContainer), 'Invalid parent for %s' % prop if prop.parent.isValid(self): descriptor, _clazz = ...
Support class for containers.
Container
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Container: """Support class for containers.""" def __contains__(self, ref): """Checks if the object contains a value for the property even if that value is None. @param ref: TypeProperty reference The type property to check. @return: boolean True if a value for the reference is prese...
stack_v2_sparse_classes_36k_train_034701
16,647
no_license
[ { "docstring": "Checks if the object contains a value for the property even if that value is None. @param ref: TypeProperty reference The type property to check. @return: boolean True if a value for the reference is present, false otherwise.", "name": "__contains__", "signature": "def __contains__(self,...
2
stack_v2_sparse_classes_30k_train_019493
Implement the Python class `Container` described below. Class description: Support class for containers. Method signatures and docstrings: - def __contains__(self, ref): Checks if the object contains a value for the property even if that value is None. @param ref: TypeProperty reference The type property to check. @r...
Implement the Python class `Container` described below. Class description: Support class for containers. Method signatures and docstrings: - def __contains__(self, ref): Checks if the object contains a value for the property even if that value is None. @param ref: TypeProperty reference The type property to check. @r...
e0b3466b34d31548996d57be4a9dac134d904380
<|skeleton|> class Container: """Support class for containers.""" def __contains__(self, ref): """Checks if the object contains a value for the property even if that value is None. @param ref: TypeProperty reference The type property to check. @return: boolean True if a value for the reference is prese...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Container: """Support class for containers.""" def __contains__(self, ref): """Checks if the object contains a value for the property even if that value is None. @param ref: TypeProperty reference The type property to check. @return: boolean True if a value for the reference is present, false oth...
the_stack_v2_python_sparse
components/ally-api/ally/api/operator/descriptor.py
cristidomsa/Ally-Py
train
0
e9b6bf2dd1eb7ddd3c48b9f328ed2be0afecd239
[ "queryset = self.filter_queryset(self.get_queryset())\nuid = force_text(urlsafe_base64_decode(self.kwargs['uid']))\ntoken = self.kwargs['token']\nobj = get_object_or_404(queryset, pk=uid)\nself.check_object_permissions(self.request, obj)\nif not default_token_generator.check_token(user=obj, token=token):\n raise...
<|body_start_0|> queryset = self.filter_queryset(self.get_queryset()) uid = force_text(urlsafe_base64_decode(self.kwargs['uid'])) token = self.kwargs['token'] obj = get_object_or_404(queryset, pk=uid) self.check_object_permissions(self.request, obj) if not default_token_g...
User activate view.
UserActivation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserActivation: """User activate view.""" def get_object(self) -> User: """Get user by uid and check permissions. :return: User.""" <|body_0|> def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Activate user. :param request: :return:"""...
stack_v2_sparse_classes_36k_train_034702
5,061
no_license
[ { "docstring": "Get user by uid and check permissions. :return: User.", "name": "get_object", "signature": "def get_object(self) -> User" }, { "docstring": "Activate user. :param request: :return:", "name": "get", "signature": "def get(self, request: Request, *args: tuple, **kwargs: dict...
2
stack_v2_sparse_classes_30k_train_011306
Implement the Python class `UserActivation` described below. Class description: User activate view. Method signatures and docstrings: - def get_object(self) -> User: Get user by uid and check permissions. :return: User. - def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Activate user. :param...
Implement the Python class `UserActivation` described below. Class description: User activate view. Method signatures and docstrings: - def get_object(self) -> User: Get user by uid and check permissions. :return: User. - def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Activate user. :param...
713b9d84ac70d964d46f189ab1f9c7b944b9684b
<|skeleton|> class UserActivation: """User activate view.""" def get_object(self) -> User: """Get user by uid and check permissions. :return: User.""" <|body_0|> def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response: """Activate user. :param request: :return:"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserActivation: """User activate view.""" def get_object(self) -> User: """Get user by uid and check permissions. :return: User.""" queryset = self.filter_queryset(self.get_queryset()) uid = force_text(urlsafe_base64_decode(self.kwargs['uid'])) token = self.kwargs['token']...
the_stack_v2_python_sparse
jobadvisor/users/views/registration.py
ewgen19892/jobadvisor
train
0
6d6181025affe70786e96cfe13f44c618e7f1338
[ "super().__init__()\nself.num_embeddings = num_embeddings\nself.embedding_dim = embedding_dim\nself.num_positions = positonal_max_length\nself.token_embedding = nn.Embedding(num_embeddings, embedding_dim, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)\nself.pos_embedding = None\nif positional_learned...
<|body_start_0|> super().__init__() self.num_embeddings = num_embeddings self.embedding_dim = embedding_dim self.num_positions = positonal_max_length self.token_embedding = nn.Embedding(num_embeddings, embedding_dim, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse) ...
Implement an Embeddings module. This object replicates the usage of nn.Embedding but registers the from_pretrained classmethod to be used inside a Flambé configuration, as this does not happen automatically during the registration of PyTorch objects. The module also adds optional positional encoding, which can either b...
Embeddings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embeddings: """Implement an Embeddings module. This object replicates the usage of nn.Embedding but registers the from_pretrained classmethod to be used inside a Flambé configuration, as this does not happen automatically during the registration of PyTorch objects. The module also adds optional p...
stack_v2_sparse_classes_36k_train_034703
12,470
permissive
[ { "docstring": "Initialize an Embeddings module. Parameters ---------- num_embeddings : int Size of the dictionary of embeddings. embedding_dim : int The size of each embedding vector. padding_idx : int, optional Pads the output with the embedding vector at :attr:`padding_idx` (initialized to zeros) whenever it...
3
null
Implement the Python class `Embeddings` described below. Class description: Implement an Embeddings module. This object replicates the usage of nn.Embedding but registers the from_pretrained classmethod to be used inside a Flambé configuration, as this does not happen automatically during the registration of PyTorch o...
Implement the Python class `Embeddings` described below. Class description: Implement an Embeddings module. This object replicates the usage of nn.Embedding but registers the from_pretrained classmethod to be used inside a Flambé configuration, as this does not happen automatically during the registration of PyTorch o...
0dc2f5b2b286694defe8abf450fe5be9ae12c097
<|skeleton|> class Embeddings: """Implement an Embeddings module. This object replicates the usage of nn.Embedding but registers the from_pretrained classmethod to be used inside a Flambé configuration, as this does not happen automatically during the registration of PyTorch objects. The module also adds optional p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Embeddings: """Implement an Embeddings module. This object replicates the usage of nn.Embedding but registers the from_pretrained classmethod to be used inside a Flambé configuration, as this does not happen automatically during the registration of PyTorch objects. The module also adds optional positional enc...
the_stack_v2_python_sparse
flambe/nn/embedding.py
cle-ros/flambe
train
1
a8281337f686779f4107e173868b74f7914328df
[ "if n <= 3:\n return n - 1\na, b = (n // 3, n % 3)\nif b == 1:\n return 3 ** (a - 1) * 4\nelif b == 2:\n return 3 ** a * b\nelse:\n return 3 ** a", "dp = [0, 1, 1, 2]\nfor i in range(4, n + 1):\n dp.append(1)\n for j in range(2, i):\n dp[i] = max(dp[i], j * (i - j), j * dp[i - j])\nreturn...
<|body_start_0|> if n <= 3: return n - 1 a, b = (n // 3, n % 3) if b == 1: return 3 ** (a - 1) * 4 elif b == 2: return 3 ** a * b else: return 3 ** a <|end_body_0|> <|body_start_1|> dp = [0, 1, 1, 2] for i in range(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def cuttingRope(self, n: int) -> int: """offer 14-I 剪绳子 绳子优先距离:3>2>1""" <|body_0|> def cuttingRope1(self, n: int) -> int: """动态规划 转移方程:dp[i] = max(dp[i],max(j*(i-j),j*dp[i-j]) dp存放结果,绳长i剪j剩下i-j""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_034704
886
no_license
[ { "docstring": "offer 14-I 剪绳子 绳子优先距离:3>2>1", "name": "cuttingRope", "signature": "def cuttingRope(self, n: int) -> int" }, { "docstring": "动态规划 转移方程:dp[i] = max(dp[i],max(j*(i-j),j*dp[i-j]) dp存放结果,绳长i剪j剩下i-j", "name": "cuttingRope1", "signature": "def cuttingRope1(self, n: int) -> int" ...
2
stack_v2_sparse_classes_30k_test_000173
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope(self, n: int) -> int: offer 14-I 剪绳子 绳子优先距离:3>2>1 - def cuttingRope1(self, n: int) -> int: 动态规划 转移方程:dp[i] = max(dp[i],max(j*(i-j),j*dp[i-j]) dp存放结果,绳长i剪j剩下i-j
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope(self, n: int) -> int: offer 14-I 剪绳子 绳子优先距离:3>2>1 - def cuttingRope1(self, n: int) -> int: 动态规划 转移方程:dp[i] = max(dp[i],max(j*(i-j),j*dp[i-j]) dp存放结果,绳长i剪j剩下i-j <...
3fd69b85f52af861ff7e2c74d8aacc515b192615
<|skeleton|> class Solution: def cuttingRope(self, n: int) -> int: """offer 14-I 剪绳子 绳子优先距离:3>2>1""" <|body_0|> def cuttingRope1(self, n: int) -> int: """动态规划 转移方程:dp[i] = max(dp[i],max(j*(i-j),j*dp[i-j]) dp存放结果,绳长i剪j剩下i-j""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def cuttingRope(self, n: int) -> int: """offer 14-I 剪绳子 绳子优先距离:3>2>1""" if n <= 3: return n - 1 a, b = (n // 3, n % 3) if b == 1: return 3 ** (a - 1) * 4 elif b == 2: return 3 ** a * b else: return 3 ** a...
the_stack_v2_python_sparse
Offer/14_cuttingRope.py
helloprogram6/leetcode_Cookbook_python
train
0
ca0fe48d0190032d9ce9eae85a31bee848ca21b1
[ "assert onehot_name in ['A_cat', 'A_hour', 'A_his', 'B_cat', 'B_cat_xgb', 'A_cat_xgb', 'A_hour_xgb', 'A_his_xgb'], 'onehot name error'\nprint(X_train.shape, ' , ', y_train.shape)\nif data_begin != 'all':\n data_begin = 'begin{0}'.format(data_begin)\nss.save_npz(output_path + '{0}_X_{1}_{2}'.format(file_name, one...
<|body_start_0|> assert onehot_name in ['A_cat', 'A_hour', 'A_his', 'B_cat', 'B_cat_xgb', 'A_cat_xgb', 'A_hour_xgb', 'A_his_xgb'], 'onehot name error' print(X_train.shape, ' , ', y_train.shape) if data_begin != 'all': data_begin = 'begin{0}'.format(data_begin) ss.save_npz(out...
ss.npz小工具
NpzUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NpzUtils: """ss.npz小工具""" def SaveNpz(self, X_train, y_train, output_path, file_name, data_begin, onehot_name): """保存稀疏矩阵""" <|body_0|> def LoadNpz(self, data_path, file_name, data_begin, onehot_name): """导入稀疏矩阵""" <|body_1|> def MergeNpz(self, outpu...
stack_v2_sparse_classes_36k_train_034705
20,177
no_license
[ { "docstring": "保存稀疏矩阵", "name": "SaveNpz", "signature": "def SaveNpz(self, X_train, y_train, output_path, file_name, data_begin, onehot_name)" }, { "docstring": "导入稀疏矩阵", "name": "LoadNpz", "signature": "def LoadNpz(self, data_path, file_name, data_begin, onehot_name)" }, { "doc...
3
stack_v2_sparse_classes_30k_val_001112
Implement the Python class `NpzUtils` described below. Class description: ss.npz小工具 Method signatures and docstrings: - def SaveNpz(self, X_train, y_train, output_path, file_name, data_begin, onehot_name): 保存稀疏矩阵 - def LoadNpz(self, data_path, file_name, data_begin, onehot_name): 导入稀疏矩阵 - def MergeNpz(self, output_pa...
Implement the Python class `NpzUtils` described below. Class description: ss.npz小工具 Method signatures and docstrings: - def SaveNpz(self, X_train, y_train, output_path, file_name, data_begin, onehot_name): 保存稀疏矩阵 - def LoadNpz(self, data_path, file_name, data_begin, onehot_name): 导入稀疏矩阵 - def MergeNpz(self, output_pa...
9b4abb6fe3eae6c54a0c7076755519f910e53ca6
<|skeleton|> class NpzUtils: """ss.npz小工具""" def SaveNpz(self, X_train, y_train, output_path, file_name, data_begin, onehot_name): """保存稀疏矩阵""" <|body_0|> def LoadNpz(self, data_path, file_name, data_begin, onehot_name): """导入稀疏矩阵""" <|body_1|> def MergeNpz(self, outpu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NpzUtils: """ss.npz小工具""" def SaveNpz(self, X_train, y_train, output_path, file_name, data_begin, onehot_name): """保存稀疏矩阵""" assert onehot_name in ['A_cat', 'A_hour', 'A_his', 'B_cat', 'B_cat_xgb', 'A_cat_xgb', 'A_hour_xgb', 'A_his_xgb'], 'onehot name error' print(X_train.shape, '...
the_stack_v2_python_sparse
utils.py
zhouzhiqi/avazu_CTR
train
5
53b2f554872c64a8281ecbc67c258810da5c46f7
[ "pygame.sprite.Sprite.__init__(self)\nself.screen = screenParam\nself.image = pygame.image.load('../res/images/blood/blood06.png')\nself.tranColor = self.image.get_at((1, 1))\nself.image.set_colorkey(self.tranColor)\nself.rect = self.image.get_rect()\nself.imagePath = '../res/images/blood/blood0'\nself.imageList = ...
<|body_start_0|> pygame.sprite.Sprite.__init__(self) self.screen = screenParam self.image = pygame.image.load('../res/images/blood/blood06.png') self.tranColor = self.image.get_at((1, 1)) self.image.set_colorkey(self.tranColor) self.rect = self.image.get_rect() se...
Blood
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blood: def __init__(self, screenParam, x, y): """Initialize variables. @param screenParam: The surface to draw the resources onto.""" <|body_0|> def update(self): """Update object. Invoked each tick.""" <|body_1|> def loadPics(self): """Load all ...
stack_v2_sparse_classes_36k_train_034706
1,546
permissive
[ { "docstring": "Initialize variables. @param screenParam: The surface to draw the resources onto.", "name": "__init__", "signature": "def __init__(self, screenParam, x, y)" }, { "docstring": "Update object. Invoked each tick.", "name": "update", "signature": "def update(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_007486
Implement the Python class `Blood` described below. Class description: Implement the Blood class. Method signatures and docstrings: - def __init__(self, screenParam, x, y): Initialize variables. @param screenParam: The surface to draw the resources onto. - def update(self): Update object. Invoked each tick. - def loa...
Implement the Python class `Blood` described below. Class description: Implement the Blood class. Method signatures and docstrings: - def __init__(self, screenParam, x, y): Initialize variables. @param screenParam: The surface to draw the resources onto. - def update(self): Update object. Invoked each tick. - def loa...
c59bc7e74c8e66044c7454f606b836797d88fdab
<|skeleton|> class Blood: def __init__(self, screenParam, x, y): """Initialize variables. @param screenParam: The surface to draw the resources onto.""" <|body_0|> def update(self): """Update object. Invoked each tick.""" <|body_1|> def loadPics(self): """Load all ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Blood: def __init__(self, screenParam, x, y): """Initialize variables. @param screenParam: The surface to draw the resources onto.""" pygame.sprite.Sprite.__init__(self) self.screen = screenParam self.image = pygame.image.load('../res/images/blood/blood06.png') self.tra...
the_stack_v2_python_sparse
src/Blood.py
RichardFlanagan/SonusOculi
train
0
16324b3148081cd2f78ada89def01d512a8da70e
[ "if sum(nums) == len(nums) // 2 and len(nums) % 2 == 0:\n return len(nums)\nself.dicts = {}\nsum_1 = 0\ncount = 1\nself.dicts[0] = [0, -1]\nfor i in nums:\n if i == 0:\n sum_1 -= 1\n else:\n sum_1 += 1\n if sum_1 not in self.dicts.keys():\n self.dicts[sum_1] = [count, -1]\n else:...
<|body_start_0|> if sum(nums) == len(nums) // 2 and len(nums) % 2 == 0: return len(nums) self.dicts = {} sum_1 = 0 count = 1 self.dicts[0] = [0, -1] for i in nums: if i == 0: sum_1 -= 1 else: sum_1 += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxLength(self, nums): """:type nums: List[int] :rtype: int 1862ms""" <|body_0|> def findMaxLength_1(self, nums): """315ms :param nums: :return:""" <|body_1|> def findMaxLength_2(self, nums): """:type nums: List[int] :rtype: int...
stack_v2_sparse_classes_36k_train_034707
2,531
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 1862ms", "name": "findMaxLength", "signature": "def findMaxLength(self, nums)" }, { "docstring": "315ms :param nums: :return:", "name": "findMaxLength_1", "signature": "def findMaxLength_1(self, nums)" }, { "docstring": ":type num...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxLength(self, nums): :type nums: List[int] :rtype: int 1862ms - def findMaxLength_1(self, nums): 315ms :param nums: :return: - def findMaxLength_2(self, nums): :type nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxLength(self, nums): :type nums: List[int] :rtype: int 1862ms - def findMaxLength_1(self, nums): 315ms :param nums: :return: - def findMaxLength_2(self, nums): :type nu...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def findMaxLength(self, nums): """:type nums: List[int] :rtype: int 1862ms""" <|body_0|> def findMaxLength_1(self, nums): """315ms :param nums: :return:""" <|body_1|> def findMaxLength_2(self, nums): """:type nums: List[int] :rtype: int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxLength(self, nums): """:type nums: List[int] :rtype: int 1862ms""" if sum(nums) == len(nums) // 2 and len(nums) % 2 == 0: return len(nums) self.dicts = {} sum_1 = 0 count = 1 self.dicts[0] = [0, -1] for i in nums: ...
the_stack_v2_python_sparse
ContiguousArray_MID_525.py
953250587/leetcode-python
train
2
91a5687d4c4396e68d100be19e5339ffe3d70d6f
[ "id = str(id)\nconfig = dict(self.config[id])\nwidget_class = get_widget_class(config.pop('class'))\nreturn widget_class(id=id, **config)", "widgets = []\nfor grid_item in self.layout:\n widget = self.get_widget(grid_item['id'])\n widget.set_layout(grid_item)\n widgets.append(widget)\nreturn widgets", ...
<|body_start_0|> id = str(id) config = dict(self.config[id]) widget_class = get_widget_class(config.pop('class')) return widget_class(id=id, **config) <|end_body_0|> <|body_start_1|> widgets = [] for grid_item in self.layout: widget = self.get_widget(grid_ite...
Dashboard
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dashboard: def get_widget(self, id): """Instantiate and return a widget by its ID""" <|body_0|> def get_layout(self): """Return the dashboard's configured layout, suitable for rendering with gridstack.js.""" <|body_1|> def add_widget(self, widget, x=None...
stack_v2_sparse_classes_36k_train_034708
1,918
permissive
[ { "docstring": "Instantiate and return a widget by its ID", "name": "get_widget", "signature": "def get_widget(self, id)" }, { "docstring": "Return the dashboard's configured layout, suitable for rendering with gridstack.js.", "name": "get_layout", "signature": "def get_layout(self)" }...
4
null
Implement the Python class `Dashboard` described below. Class description: Implement the Dashboard class. Method signatures and docstrings: - def get_widget(self, id): Instantiate and return a widget by its ID - def get_layout(self): Return the dashboard's configured layout, suitable for rendering with gridstack.js. ...
Implement the Python class `Dashboard` described below. Class description: Implement the Dashboard class. Method signatures and docstrings: - def get_widget(self, id): Instantiate and return a widget by its ID - def get_layout(self): Return the dashboard's configured layout, suitable for rendering with gridstack.js. ...
506884bc4dc70299db3e2a7ad577dd7fd808065e
<|skeleton|> class Dashboard: def get_widget(self, id): """Instantiate and return a widget by its ID""" <|body_0|> def get_layout(self): """Return the dashboard's configured layout, suitable for rendering with gridstack.js.""" <|body_1|> def add_widget(self, widget, x=None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dashboard: def get_widget(self, id): """Instantiate and return a widget by its ID""" id = str(id) config = dict(self.config[id]) widget_class = get_widget_class(config.pop('class')) return widget_class(id=id, **config) def get_layout(self): """Return the da...
the_stack_v2_python_sparse
netbox/extras/models/dashboard.py
netbox-community/netbox
train
8,122
863a1e173e008b1447b4f4667388beaa1206113b
[ "token = request.query_params.get('apptoken')\nif token:\n return self.authenticate_credentials(token)\nreturn super().authenticate(request)", "model = AppToken\ntry:\n token = model.objects.get(key=key)\nexcept model.DoesNotExist:\n raise exceptions.AuthenticationFailed('Invalid token.')\nif not token.a...
<|body_start_0|> token = request.query_params.get('apptoken') if token: return self.authenticate_credentials(token) return super().authenticate(request) <|end_body_0|> <|body_start_1|> model = AppToken try: token = model.objects.get(key=key) excep...
Similar to Token, but users AppToken as model (belongs to apps not users) and accepts url param token One App <>> Many Tokens
AppTokenAuthentication
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppTokenAuthentication: """Similar to Token, but users AppToken as model (belongs to apps not users) and accepts url param token One App <>> Many Tokens""" def authenticate(self, request): """Override TokenAuthentication.authenticate to support url query param""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_034709
1,468
permissive
[ { "docstring": "Override TokenAuthentication.authenticate to support url query param", "name": "authenticate", "signature": "def authenticate(self, request)" }, { "docstring": "Override TokenAuthentication.authenticate to support url query param", "name": "authenticate_credentials", "sig...
2
stack_v2_sparse_classes_30k_train_020539
Implement the Python class `AppTokenAuthentication` described below. Class description: Similar to Token, but users AppToken as model (belongs to apps not users) and accepts url param token One App <>> Many Tokens Method signatures and docstrings: - def authenticate(self, request): Override TokenAuthentication.authen...
Implement the Python class `AppTokenAuthentication` described below. Class description: Similar to Token, but users AppToken as model (belongs to apps not users) and accepts url param token One App <>> Many Tokens Method signatures and docstrings: - def authenticate(self, request): Override TokenAuthentication.authen...
3533b3558f3f247672840b2c2c33d6ffd71d2517
<|skeleton|> class AppTokenAuthentication: """Similar to Token, but users AppToken as model (belongs to apps not users) and accepts url param token One App <>> Many Tokens""" def authenticate(self, request): """Override TokenAuthentication.authenticate to support url query param""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppTokenAuthentication: """Similar to Token, but users AppToken as model (belongs to apps not users) and accepts url param token One App <>> Many Tokens""" def authenticate(self, request): """Override TokenAuthentication.authenticate to support url query param""" token = request.query_par...
the_stack_v2_python_sparse
backend/recordbin/authentication.py
recordbinco/recordbin-api
train
0
a29f067e6153c1fa2643583f70c2567c597ea6ff
[ "self.npart = npart\nself.ndim = ndim\nself.bounds = bounds", "self.swarm = np.zeros((self.npart, self.ndim))\nif self.bounds == None:\n lo = np.zeros(self.ndim)\n hi = np.ones(self.ndim)\nelse:\n lo = self.bounds.Lower()\n hi = self.bounds.Upper()\nradius = 0.5\nfor i in range(self.npart):\n p = n...
<|body_start_0|> self.npart = npart self.ndim = ndim self.bounds = bounds <|end_body_0|> <|body_start_1|> self.swarm = np.zeros((self.npart, self.ndim)) if self.bounds == None: lo = np.zeros(self.ndim) hi = np.ones(self.ndim) else: lo ...
Initialize a swarm on a hypersphere
SphereInitializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphereInitializer: """Initialize a swarm on a hypersphere""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" <|body_0|> def InitializeSwarm(self): """Return a quasirandomly initialized swarm""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_034710
1,562
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, npart=10, ndim=3, bounds=None)" }, { "docstring": "Return a quasirandomly initialized swarm", "name": "InitializeSwarm", "signature": "def InitializeSwarm(self)" } ]
2
null
Implement the Python class `SphereInitializer` described below. Class description: Initialize a swarm on a hypersphere Method signatures and docstrings: - def __init__(self, npart=10, ndim=3, bounds=None): Constructor - def InitializeSwarm(self): Return a quasirandomly initialized swarm
Implement the Python class `SphereInitializer` described below. Class description: Initialize a swarm on a hypersphere Method signatures and docstrings: - def __init__(self, npart=10, ndim=3, bounds=None): Constructor - def InitializeSwarm(self): Return a quasirandomly initialized swarm <|skeleton|> class SphereInit...
5445b6f90ab49339ca0fdb71e98d44e6827c95a8
<|skeleton|> class SphereInitializer: """Initialize a swarm on a hypersphere""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" <|body_0|> def InitializeSwarm(self): """Return a quasirandomly initialized swarm""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SphereInitializer: """Initialize a swarm on a hypersphere""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" self.npart = npart self.ndim = ndim self.bounds = bounds def InitializeSwarm(self): """Return a quasirandomly initialized swarm"""...
the_stack_v2_python_sparse
SphereInitializer.py
dayoladejo/SwarmOptimization
train
0
8f7a2eedee630850b9f83fe1124899ef58e70d9d
[ "self.validate_parameters(language_set_id=language_set_id)\n_query_builder = Configuration.get_base_uri()\n_query_builder += '/text/language-sets/{languageSetId}/translations'\n_query_builder = APIHelper.append_url_with_template_parameters(_query_builder, {'languageSetId': language_set_id})\n_query_parameters = {'l...
<|body_start_0|> self.validate_parameters(language_set_id=language_set_id) _query_builder = Configuration.get_base_uri() _query_builder += '/text/language-sets/{languageSetId}/translations' _query_builder = APIHelper.append_url_with_template_parameters(_query_builder, {'languageSetId': l...
A Controller to access Endpoints in the idfy_rest_client API.
TranslationsController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TranslationsController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_translations(self, language_set_id, language=None, format=None): """Does a GET request to /text/language-sets/{languageSetId}/translations. Returns a list of all your translations for...
stack_v2_sparse_classes_36k_train_034711
6,361
permissive
[ { "docstring": "Does a GET request to /text/language-sets/{languageSetId}/translations. Returns a list of all your translations for the given language set. Args: language_set_id (int): TODO: type description here. Example: language (string, optional): TODO: type description here. Example: format (Format, option...
3
null
Implement the Python class `TranslationsController` described below. Class description: A Controller to access Endpoints in the idfy_rest_client API. Method signatures and docstrings: - def list_translations(self, language_set_id, language=None, format=None): Does a GET request to /text/language-sets/{languageSetId}/...
Implement the Python class `TranslationsController` described below. Class description: A Controller to access Endpoints in the idfy_rest_client API. Method signatures and docstrings: - def list_translations(self, language_set_id, language=None, format=None): Does a GET request to /text/language-sets/{languageSetId}/...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class TranslationsController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_translations(self, language_set_id, language=None, format=None): """Does a GET request to /text/language-sets/{languageSetId}/translations. Returns a list of all your translations for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TranslationsController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_translations(self, language_set_id, language=None, format=None): """Does a GET request to /text/language-sets/{languageSetId}/translations. Returns a list of all your translations for the given la...
the_stack_v2_python_sparse
idfy_rest_client/controllers/translations_controller.py
dealflowteam/Idfy
train
0
6718f31ac4f3a60952497035881addfe049e3a4b
[ "self.text = text.split(LINESEP)\nself.screen = screen\nself.drawCursor = drawCursor\nif settings.textSpeed == 'SLOW':\n self.speed = 1\nelif settings.textSpeed == 'MEDIUM':\n self.speed = 2\nelif settings.textSpeed == 'FAST':\n self.speed = 4\nfn = os.path.join(settings.path, 'data', globs.DIALOG)\nroot =...
<|body_start_0|> self.text = text.split(LINESEP) self.screen = screen self.drawCursor = drawCursor if settings.textSpeed == 'SLOW': self.speed = 1 elif settings.textSpeed == 'MEDIUM': self.speed = 2 elif settings.textSpeed == 'FAST': se...
Class to provide dialogs to be shown by the script engine.
Dialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dialog: """Class to provide dialogs to be shown by the script engine.""" def __init__(self, text, screen, drawCursor=True): """Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. screen - the surfac...
stack_v2_sparse_classes_36k_train_034712
7,526
no_license
[ { "docstring": "Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. screen - the surface to draw the dialog onto. soundManager - the sound manager. drawCursor - whether a continuation cursor should be drawn when the text has f...
4
stack_v2_sparse_classes_30k_train_017193
Implement the Python class `Dialog` described below. Class description: Class to provide dialogs to be shown by the script engine. Method signatures and docstrings: - def __init__(self, text, screen, drawCursor=True): Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - t...
Implement the Python class `Dialog` described below. Class description: Class to provide dialogs to be shown by the script engine. Method signatures and docstrings: - def __init__(self, text, screen, drawCursor=True): Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - t...
35f58b9c931bd2bef7fd2002cadd468523ffbb5d
<|skeleton|> class Dialog: """Class to provide dialogs to be shown by the script engine.""" def __init__(self, text, screen, drawCursor=True): """Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. screen - the surfac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dialog: """Class to provide dialogs to be shown by the script engine.""" def __init__(self, text, screen, drawCursor=True): """Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. screen - the surface to draw the...
the_stack_v2_python_sparse
dialog.py
wollywatson/DittoEngine
train
0
82fcd049c2303a904e4123d3d02a5c885f1d019e
[ "self.capacity = capacity\nself.cache = {}\nself.rank_queue = []", "if key not in self.cache:\n return -1\nif key in self.rank_queue:\n self.rank_queue.remove(key)\nself.rank_queue.append(key)\nreturn self.cache[key]", "if key not in self.cache and len(self.cache) == self.capacity:\n del self.cache[sel...
<|body_start_0|> self.capacity = capacity self.cache = {} self.rank_queue = [] <|end_body_0|> <|body_start_1|> if key not in self.cache: return -1 if key in self.rank_queue: self.rank_queue.remove(key) self.rank_queue.append(key) return se...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_034713
1,213
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_007468
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.cache = {} self.rank_queue = [] def get(self, key): """:type key: int :rtype: int""" if key not in self.cache: return -1 if key in self.rank_...
the_stack_v2_python_sparse
0.算法/146_LRU_cache.py
unlimitediw/CheckCode
train
0
3fa0ad2a6a34d4ff79a9fa8be342d08b705e3f01
[ "self.smartplug = smartplug\nself.state = None\nself.temperature = None\nself.current_consumption = None\nself.total_consumption = None\nself.available = False\nself._n_tried = 0\nself._last_tried = None", "if self._last_tried is not None:\n last_try_s = (dt_util.now() - self._last_tried).total_seconds() / 60\...
<|body_start_0|> self.smartplug = smartplug self.state = None self.temperature = None self.current_consumption = None self.total_consumption = None self.available = False self._n_tried = 0 self._last_tried = None <|end_body_0|> <|body_start_1|> if...
Get the latest data from smart plug.
SmartPlugData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmartPlugData: """Get the latest data from smart plug.""" def __init__(self, smartplug): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from the smart plug.""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_034714
4,947
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, smartplug)" }, { "docstring": "Get the latest data from the smart plug.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `SmartPlugData` described below. Class description: Get the latest data from smart plug. Method signatures and docstrings: - def __init__(self, smartplug): Initialize the data object. - def update(self): Get the latest data from the smart plug.
Implement the Python class `SmartPlugData` described below. Class description: Get the latest data from smart plug. Method signatures and docstrings: - def __init__(self, smartplug): Initialize the data object. - def update(self): Get the latest data from the smart plug. <|skeleton|> class SmartPlugData: """Get ...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class SmartPlugData: """Get the latest data from smart plug.""" def __init__(self, smartplug): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from the smart plug.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmartPlugData: """Get the latest data from smart plug.""" def __init__(self, smartplug): """Initialize the data object.""" self.smartplug = smartplug self.state = None self.temperature = None self.current_consumption = None self.total_consumption = None ...
the_stack_v2_python_sparse
homeassistant/components/dlink/switch.py
BenWoodford/home-assistant
train
11
79f1f9403e408b557a41330ebb7d2d08d8b3f800
[ "try:\n self.assertEqual(subtract(30, 16), 15)\nexcept Exception as error:\n print(f'Got error in {inspect.stack()[0][3]}, {error}')", "try:\n self.assertEqual(subtract(-18, -5), -13)\nexcept Exception as error:\n print(error)", "try:\n self.assertEqual(subtract(0, -6), 7)\nexcept Exception as er...
<|body_start_0|> try: self.assertEqual(subtract(30, 16), 15) except Exception as error: print(f'Got error in {inspect.stack()[0][3]}, {error}') <|end_body_0|> <|body_start_1|> try: self.assertEqual(subtract(-18, -5), -13) except Exception as error: ...
Test subtract function from calculation.py module.
TestSubtractFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSubtractFunction: """Test subtract function from calculation.py module.""" def test_subtract_all_args_greater_zero(self): """Test subtract function if all arguments are greater than zero.""" <|body_0|> def test_subtract_all_args_less_zero(self): """Test subtr...
stack_v2_sparse_classes_36k_train_034715
1,838
no_license
[ { "docstring": "Test subtract function if all arguments are greater than zero.", "name": "test_subtract_all_args_greater_zero", "signature": "def test_subtract_all_args_greater_zero(self)" }, { "docstring": "Test subtract function if all arguments are less than zero.", "name": "test_subtract...
3
stack_v2_sparse_classes_30k_train_012915
Implement the Python class `TestSubtractFunction` described below. Class description: Test subtract function from calculation.py module. Method signatures and docstrings: - def test_subtract_all_args_greater_zero(self): Test subtract function if all arguments are greater than zero. - def test_subtract_all_args_less_z...
Implement the Python class `TestSubtractFunction` described below. Class description: Test subtract function from calculation.py module. Method signatures and docstrings: - def test_subtract_all_args_greater_zero(self): Test subtract function if all arguments are greater than zero. - def test_subtract_all_args_less_z...
3a500c9d55fecf4032b5faf59a1cbecf64592e9a
<|skeleton|> class TestSubtractFunction: """Test subtract function from calculation.py module.""" def test_subtract_all_args_greater_zero(self): """Test subtract function if all arguments are greater than zero.""" <|body_0|> def test_subtract_all_args_less_zero(self): """Test subtr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSubtractFunction: """Test subtract function from calculation.py module.""" def test_subtract_all_args_greater_zero(self): """Test subtract function if all arguments are greater than zero.""" try: self.assertEqual(subtract(30, 16), 15) except Exception as error: ...
the_stack_v2_python_sparse
python10/test_calculation.py
maksimok93/Dp-189
train
0
3a14029ec4b6b63ca761985e8e6950028285728d
[ "if target == 0:\n res.append(tem_res)\n return\nif index >= len(candidates) or target < candidates[index]:\n return\nfor i in range(index, len(candidates)):\n if i > index and candidates[i] == candidates[i - 1]:\n continue\n if target < candidates[i]:\n break\n self.curSum(self, can...
<|body_start_0|> if target == 0: res.append(tem_res) return if index >= len(candidates) or target < candidates[index]: return for i in range(index, len(candidates)): if i > index and candidates[i] == candidates[i - 1]: continue ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def curSum(self, candidates, index, target, tem_res, res): """:param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int] :type target: ...
stack_v2_sparse_classes_36k_train_034716
1,196
no_license
[ { "docstring": ":param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果", "name": "curSum", "signature": "def curSum(self, candidates, index, target, tem_res, res)" }, { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]] :组合相加", ...
2
stack_v2_sparse_classes_30k_train_021363
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def curSum(self, candidates, index, target, tem_res, res): :param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果 - def combinationSum(self, ca...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def curSum(self, candidates, index, target, tem_res, res): :param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果 - def combinationSum(self, ca...
45fafcc5dd8f3a9dd26984dc6e82441cc2e8f8d7
<|skeleton|> class Solution: def curSum(self, candidates, index, target, tem_res, res): """:param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int] :type target: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def curSum(self, candidates, index, target, tem_res, res): """:param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果""" if target == 0: res.append(tem_res) return if index >= len(candidates) or target < candidates[ind...
the_stack_v2_python_sparse
T40.py
zhanggyang/leedcode
train
0
79ea8c9f796521822e835e9fde4c46269a4d2098
[ "self.allow_api_based_fetch = allow_api_based_fetch\nself.cluster_destroy_hmac_key = cluster_destroy_hmac_key\nself.cluster_name = cluster_name\nself.enable_cluster_destroy = enable_cluster_destroy\nself.encryption_config = encryption_config\nself.ip_preference = ip_preference\nself.ipmi_config = ipmi_config\nself....
<|body_start_0|> self.allow_api_based_fetch = allow_api_based_fetch self.cluster_destroy_hmac_key = cluster_destroy_hmac_key self.cluster_name = cluster_name self.enable_cluster_destroy = enable_cluster_destroy self.encryption_config = encryption_config self.ip_preference...
Implementation of the 'CreatePhysicalClusterParameters' model. Specifies the parameters needed for creation of a new Cluster. Attributes: allow_api_based_fetch (bool): Specifies if API based GET should be enabled for cluster destroy params. cluster_destroy_hmac_key (string): Specifies HMAC secret key that will be used ...
CreatePhysicalClusterParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreatePhysicalClusterParameters: """Implementation of the 'CreatePhysicalClusterParameters' model. Specifies the parameters needed for creation of a new Cluster. Attributes: allow_api_based_fetch (bool): Specifies if API based GET should be enabled for cluster destroy params. cluster_destroy_hmac...
stack_v2_sparse_classes_36k_train_034717
5,957
permissive
[ { "docstring": "Constructor for the CreatePhysicalClusterParameters class", "name": "__init__", "signature": "def __init__(self, allow_api_based_fetch=None, cluster_destroy_hmac_key=None, cluster_name=None, enable_cluster_destroy=None, encryption_config=None, ip_preference=None, ipmi_config=None, metada...
2
stack_v2_sparse_classes_30k_test_001078
Implement the Python class `CreatePhysicalClusterParameters` described below. Class description: Implementation of the 'CreatePhysicalClusterParameters' model. Specifies the parameters needed for creation of a new Cluster. Attributes: allow_api_based_fetch (bool): Specifies if API based GET should be enabled for clust...
Implement the Python class `CreatePhysicalClusterParameters` described below. Class description: Implementation of the 'CreatePhysicalClusterParameters' model. Specifies the parameters needed for creation of a new Cluster. Attributes: allow_api_based_fetch (bool): Specifies if API based GET should be enabled for clust...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CreatePhysicalClusterParameters: """Implementation of the 'CreatePhysicalClusterParameters' model. Specifies the parameters needed for creation of a new Cluster. Attributes: allow_api_based_fetch (bool): Specifies if API based GET should be enabled for cluster destroy params. cluster_destroy_hmac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreatePhysicalClusterParameters: """Implementation of the 'CreatePhysicalClusterParameters' model. Specifies the parameters needed for creation of a new Cluster. Attributes: allow_api_based_fetch (bool): Specifies if API based GET should be enabled for cluster destroy params. cluster_destroy_hmac_key (string)...
the_stack_v2_python_sparse
cohesity_management_sdk/models/create_physical_cluster_parameters.py
cohesity/management-sdk-python
train
24
221af954ec827e037fdab8c1c32d0d14bcb7daeb
[ "if self == other:\n return self\nelif type(self) == type(other):\n return type(self)(self.vars | other.vars)\nelif isinstance(other, SymbolicSubringRejectingVarsFunctor):\n if not self.vars & other.vars:\n return other", "if R is not SR:\n raise NotImplementedError('This functor can only be ap...
<|body_start_0|> if self == other: return self elif type(self) == type(other): return type(self)(self.vars | other.vars) elif isinstance(other, SymbolicSubringRejectingVarsFunctor): if not self.vars & other.vars: return other <|end_body_0|> <|...
SymbolicSubringAcceptingVarsFunctor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SymbolicSubringAcceptingVarsFunctor: def merge(self, other): """Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=...
stack_v2_sparse_classes_36k_train_034718
31,870
no_license
[ { "docstring": "Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=('a',)).construction()[0] sage: G = SymbolicSubring(rejecting_variables=...
2
stack_v2_sparse_classes_30k_train_012252
Implement the Python class `SymbolicSubringAcceptingVarsFunctor` described below. Class description: Implement the SymbolicSubringAcceptingVarsFunctor class. Method signatures and docstrings: - def merge(self, other): Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or...
Implement the Python class `SymbolicSubringAcceptingVarsFunctor` described below. Class description: Implement the SymbolicSubringAcceptingVarsFunctor class. Method signatures and docstrings: - def merge(self, other): Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class SymbolicSubringAcceptingVarsFunctor: def merge(self, other): """Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SymbolicSubringAcceptingVarsFunctor: def merge(self, other): """Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=('a',)).constr...
the_stack_v2_python_sparse
sage/src/sage/symbolic/subring.py
bopopescu/geosci
train
0
b1a5bd9393e2be2a7e542bebf2c293c15f089ab9
[ "CNP = str(CNP)\nif len(CNP) != 13:\n return False\nif CNP[0] != '1' and CNP[0] != '2':\n return False\nyear = int(CNP[1]) * 10 + int(CNP[2])\nif year > 99:\n return False\nmouth = int(CNP[3]) * 10 + int(CNP[4])\nif mouth > 12:\n return False\nday = int(CNP[5]) * 10 + int(CNP[6])\nif day > 31:\n retu...
<|body_start_0|> CNP = str(CNP) if len(CNP) != 13: return False if CNP[0] != '1' and CNP[0] != '2': return False year = int(CNP[1]) * 10 + int(CNP[2]) if year > 99: return False mouth = int(CNP[3]) * 10 + int(CNP[4]) if mouth > ...
ClientValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientValidator: def validateCNP(CNP): """Verify if the given ID is a valid one: -the first number must be 1 or 2 -the 2-3 digits must be the year of birth -the 4-5 digits the mouth -the 6-7 digits are the day -the 8-9 digits are the locality -the 10-12 digits are random -the 13 digit is...
stack_v2_sparse_classes_36k_train_034719
3,725
no_license
[ { "docstring": "Verify if the given ID is a valid one: -the first number must be 1 or 2 -the 2-3 digits must be the year of birth -the 4-5 digits the mouth -the 6-7 digits are the day -the 8-9 digits are the locality -the 10-12 digits are random -the 13 digit is the control one", "name": "validateCNP", ...
3
stack_v2_sparse_classes_30k_train_006668
Implement the Python class `ClientValidator` described below. Class description: Implement the ClientValidator class. Method signatures and docstrings: - def validateCNP(CNP): Verify if the given ID is a valid one: -the first number must be 1 or 2 -the 2-3 digits must be the year of birth -the 4-5 digits the mouth -t...
Implement the Python class `ClientValidator` described below. Class description: Implement the ClientValidator class. Method signatures and docstrings: - def validateCNP(CNP): Verify if the given ID is a valid one: -the first number must be 1 or 2 -the 2-3 digits must be the year of birth -the 4-5 digits the mouth -t...
b3950f4bc0d7a4d2f69d9c9c500e05e6092e8350
<|skeleton|> class ClientValidator: def validateCNP(CNP): """Verify if the given ID is a valid one: -the first number must be 1 or 2 -the 2-3 digits must be the year of birth -the 4-5 digits the mouth -the 6-7 digits are the day -the 8-9 digits are the locality -the 10-12 digits are random -the 13 digit is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientValidator: def validateCNP(CNP): """Verify if the given ID is a valid one: -the first number must be 1 or 2 -the 2-3 digits must be the year of birth -the 4-5 digits the mouth -the 6-7 digits are the day -the 8-9 digits are the locality -the 10-12 digits are random -the 13 digit is the control o...
the_stack_v2_python_sparse
Validator/ClientValidator.py
paul29m/FPMovieRental
train
0
edb13a0c4e93c6c72e628c4fde7ebcf111bff9c9
[ "current_keys = essence.get('metadata', {}).get('annotations', {})\nif frozenset(keys_to_remove) & frozenset(current_keys):\n essence['metadata']['annotations'] = {key: val for key, val in essence.get('metadata', {}).get('annotations', {}).items() if key not in keys_to_remove}", "if 'annotations' in essence.ge...
<|body_start_0|> current_keys = essence.get('metadata', {}).get('annotations', {}) if frozenset(keys_to_remove) & frozenset(current_keys): essence['metadata']['annotations'] = {key: val for key, val in essence.get('metadata', {}).get('annotations', {}).items() if key not in keys_to_remove} <...
A mixin used internally to remove unwanted annotations and empty stanzas.
StorageStanzaCleaner
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageStanzaCleaner: """A mixin used internally to remove unwanted annotations and empty stanzas.""" def remove_annotations(essence: bodies.BodyEssence, keys_to_remove: Collection[str]) -> None: """Remove annotations (in-place).""" <|body_0|> def remove_empty_stanzas(es...
stack_v2_sparse_classes_36k_train_034720
13,196
permissive
[ { "docstring": "Remove annotations (in-place).", "name": "remove_annotations", "signature": "def remove_annotations(essence: bodies.BodyEssence, keys_to_remove: Collection[str]) -> None" }, { "docstring": "Remove (in-place) the parent structs/stanzas if they are empty.", "name": "remove_empt...
2
stack_v2_sparse_classes_30k_train_004100
Implement the Python class `StorageStanzaCleaner` described below. Class description: A mixin used internally to remove unwanted annotations and empty stanzas. Method signatures and docstrings: - def remove_annotations(essence: bodies.BodyEssence, keys_to_remove: Collection[str]) -> None: Remove annotations (in-place...
Implement the Python class `StorageStanzaCleaner` described below. Class description: A mixin used internally to remove unwanted annotations and empty stanzas. Method signatures and docstrings: - def remove_annotations(essence: bodies.BodyEssence, keys_to_remove: Collection[str]) -> None: Remove annotations (in-place...
538df59b88d1aab7b985d703483497f73c6c4783
<|skeleton|> class StorageStanzaCleaner: """A mixin used internally to remove unwanted annotations and empty stanzas.""" def remove_annotations(essence: bodies.BodyEssence, keys_to_remove: Collection[str]) -> None: """Remove annotations (in-place).""" <|body_0|> def remove_empty_stanzas(es...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorageStanzaCleaner: """A mixin used internally to remove unwanted annotations and empty stanzas.""" def remove_annotations(essence: bodies.BodyEssence, keys_to_remove: Collection[str]) -> None: """Remove annotations (in-place).""" current_keys = essence.get('metadata', {}).get('annotati...
the_stack_v2_python_sparse
kopf/_cogs/configs/conventions.py
nolar/kopf
train
1,627
1c0cc1bb98f5c0b5c05583975d459874cf8455b5
[ "super(CombinedLoss, self).__init__()\nassert len(loss_modules) == len(loss_weights)\nself.loss_modules = loss_modules\nself.loss_weights = loss_weights", "losses = self.loss_modules\nweights = self.loss_weights\nloss = losses[0](pred, target) * weights[0]\nfor i in range(1, len(losses)):\n loss = loss + losse...
<|body_start_0|> super(CombinedLoss, self).__init__() assert len(loss_modules) == len(loss_weights) self.loss_modules = loss_modules self.loss_weights = loss_weights <|end_body_0|> <|body_start_1|> losses = self.loss_modules weights = self.loss_weights loss = los...
Loss module to compute weighted sum of the multiple losses.
CombinedLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CombinedLoss: """Loss module to compute weighted sum of the multiple losses.""" def __init__(self, loss_modules, loss_weights): """Args: loss_modules (list[Module]): list of loss modules. loss_weights (list[float]): weight per each loss.""" <|body_0|> def forward(self, p...
stack_v2_sparse_classes_36k_train_034721
3,995
permissive
[ { "docstring": "Args: loss_modules (list[Module]): list of loss modules. loss_weights (list[float]): weight per each loss.", "name": "__init__", "signature": "def __init__(self, loss_modules, loss_weights)" }, { "docstring": "Args: pred (Tensor): tensor with shape (N, C, H, W, D). target (Tensor...
2
stack_v2_sparse_classes_30k_train_018241
Implement the Python class `CombinedLoss` described below. Class description: Loss module to compute weighted sum of the multiple losses. Method signatures and docstrings: - def __init__(self, loss_modules, loss_weights): Args: loss_modules (list[Module]): list of loss modules. loss_weights (list[float]): weight per ...
Implement the Python class `CombinedLoss` described below. Class description: Loss module to compute weighted sum of the multiple losses. Method signatures and docstrings: - def __init__(self, loss_modules, loss_weights): Args: loss_modules (list[Module]): list of loss modules. loss_weights (list[float]): weight per ...
871a24eaad388b8da427e0ab3c95f951629e36d6
<|skeleton|> class CombinedLoss: """Loss module to compute weighted sum of the multiple losses.""" def __init__(self, loss_modules, loss_weights): """Args: loss_modules (list[Module]): list of loss modules. loss_weights (list[float]): weight per each loss.""" <|body_0|> def forward(self, p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CombinedLoss: """Loss module to compute weighted sum of the multiple losses.""" def __init__(self, loss_modules, loss_weights): """Args: loss_modules (list[Module]): list of loss modules. loss_weights (list[float]): weight per each loss.""" super(CombinedLoss, self).__init__() ass...
the_stack_v2_python_sparse
kits19_3d_segmentation/solvers/losses.py
rabbittuan/kits19_3d_segmentation
train
0
2ab13633ed9ab7e66881f3a37c375bac3c180d64
[ "scannable = len(configuration.get('url', []))\nif scannable is 0:\n return False\nscanned = 0\nif configuration.get('hour'):\n if datetime.datetime.utcnow().hour != int(configuration.get('hour')):\n return True\nif configuration.get('minute'):\n if datetime.datetime.utcnow().minute != int(configura...
<|body_start_0|> scannable = len(configuration.get('url', [])) if scannable is 0: return False scanned = 0 if configuration.get('hour'): if datetime.datetime.utcnow().hour != int(configuration.get('hour')): return True if configuration.get(...
Monitor URL's as a source of information This source is designed to provide source data on the URL's configured for a GREASE sourcing cluster. A generic configuration looks like this for a url_source:: { 'name': 'example_source', # <-- A name 'job': 'example_job', # <-- Any job you want to run 'exe_env': 'general', # <...
URLParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URLParser: """Monitor URL's as a source of information This source is designed to provide source data on the URL's configured for a GREASE sourcing cluster. A generic configuration looks like this for a url_source:: { 'name': 'example_source', # <-- A name 'job': 'example_job', # <-- Any job you ...
stack_v2_sparse_classes_36k_train_034722
4,446
permissive
[ { "docstring": "This will make a GET request to all URL's in the list provided by your configuration Args: configuration (dict): Configuration of Source. See Class Documentation above for more info Returns: bool: If True data will be scheduled for ingestion after deduplication. If False the engine will bail out...
2
stack_v2_sparse_classes_30k_train_013486
Implement the Python class `URLParser` described below. Class description: Monitor URL's as a source of information This source is designed to provide source data on the URL's configured for a GREASE sourcing cluster. A generic configuration looks like this for a url_source:: { 'name': 'example_source', # <-- A name '...
Implement the Python class `URLParser` described below. Class description: Monitor URL's as a source of information This source is designed to provide source data on the URL's configured for a GREASE sourcing cluster. A generic configuration looks like this for a url_source:: { 'name': 'example_source', # <-- A name '...
7ebf3df71d5c80a8ed9df44d9b64b735a9d0f899
<|skeleton|> class URLParser: """Monitor URL's as a source of information This source is designed to provide source data on the URL's configured for a GREASE sourcing cluster. A generic configuration looks like this for a url_source:: { 'name': 'example_source', # <-- A name 'job': 'example_job', # <-- Any job you ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class URLParser: """Monitor URL's as a source of information This source is designed to provide source data on the URL's configured for a GREASE sourcing cluster. A generic configuration looks like this for a url_source:: { 'name': 'example_source', # <-- A name 'job': 'example_job', # <-- Any job you want to run '...
the_stack_v2_python_sparse
tgt_grease/enterprise/Sources/UrlParser.py
target/grease
train
46
02d5c01c8b703afcc000002edd93305a52e1a84a
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ThreatIntelligence()", "from ..entity import Entity\nfrom .article import Article\nfrom .article_indicator import ArticleIndicator\nfrom .host import Host\nfrom .host_component import HostComponent\nfrom .host_cookie import HostCookie\...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ThreatIntelligence() <|end_body_0|> <|body_start_1|> from ..entity import Entity from .article import Article from .article_indicator import ArticleIndicator from .host i...
ThreatIntelligence
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreatIntelligence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence: """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...
stack_v2_sparse_classes_36k_train_034723
7,000
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: ThreatIntelligence", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_...
3
stack_v2_sparse_classes_30k_train_014076
Implement the Python class `ThreatIntelligence` described below. Class description: Implement the ThreatIntelligence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence: Creates a new instance of the appropriate class based on disc...
Implement the Python class `ThreatIntelligence` described below. Class description: Implement the ThreatIntelligence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence: Creates a new instance of the appropriate class based on disc...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ThreatIntelligence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThreatIntelligence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatIntelligence: """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: Th...
the_stack_v2_python_sparse
msgraph/generated/models/security/threat_intelligence.py
microsoftgraph/msgraph-sdk-python
train
135
937f48ab9de736cb316fc386c140bf686bcfdca5
[ "torch.nn.Module.__init__(self)\nself.basic_num = basic_num\nself.level_depth = len(kernel_sizes)\nself.inp = scn.InputLayer(dim, spatial_size)\nself.convBN = ConvBNBlock(start_planes, init_conv_nplanes, init_conv_kernel, momentum=momentum)\ninplanes = init_conv_nplanes\nself.downsample = torch.nn.ModuleList([])\ns...
<|body_start_0|> torch.nn.Module.__init__(self) self.basic_num = basic_num self.level_depth = len(kernel_sizes) self.inp = scn.InputLayer(dim, spatial_size) self.convBN = ConvBNBlock(start_planes, init_conv_nplanes, init_conv_kernel, momentum=momentum) inplanes = init_con...
This class implements a net structure built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the ResNet. ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. inplanes : int Number of planes we want after the ini...
ResNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNet: """This class implements a net structure built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the ResNet. ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. inplanes : int Numb...
stack_v2_sparse_classes_36k_train_034724
11,953
no_license
[ { "docstring": "Parameters ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. init_conv_nplaness : int Number of planes we want after the initial SubmanifoldConvolution, that is, to begin downsampling. init_conv_kernel : int Kernel for the first convolu...
2
stack_v2_sparse_classes_30k_train_000291
Implement the Python class `ResNet` described below. Class description: This class implements a net structure built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the ResNet. ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is ...
Implement the Python class `ResNet` described below. Class description: This class implements a net structure built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the ResNet. ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is ...
4c2cf181c6f503bf2a9c09bbe16810e727b052e7
<|skeleton|> class ResNet: """This class implements a net structure built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the ResNet. ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. inplanes : int Numb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResNet: """This class implements a net structure built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the ResNet. ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. inplanes : int Number of planes ...
the_stack_v2_python_sparse
next_sparseconvnet/networks/architectures.py
next-exp/NEXT_SPARSECONVNET
train
0
46a1f61a9f61b70e42207af09d6b08ecbf126e00
[ "super().__init__(param_name, index, default, **options)\nif separator is None:\n separator = ' '\nself._separator = separator", "if value is None:\n return None\nresult = value\nif isinstance(value, LIST_TYPES):\n result = self._separator.join([str(item) for item in value])\nreturn super()._get_represen...
<|body_start_0|> super().__init__(param_name, index, default, **options) if separator is None: separator = ' ' self._separator = separator <|end_body_0|> <|body_start_1|> if value is None: return None result = value if isinstance(value, LIST_TYPES...
composite positional argument class. this class must be used for composite positional cli arguments. composite positional arguments are those that will be emitted after command name at specified index and without any argument name, and the value could be a list. for example: `command value1` or `command value1 value2 v...
CompositePositionalArgument
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompositePositionalArgument: """composite positional argument class. this class must be used for composite positional cli arguments. composite positional arguments are those that will be emitted after command name at specified index and without any argument name, and the value could be a list. fo...
stack_v2_sparse_classes_36k_train_034725
27,947
permissive
[ { "docstring": "initializes an instance of CompositePositionalArgument. :param str param_name: param name presented in method signature. :param int index: zero based index of this param in cli command inputs. :param list[object] | object default: default value to be emitted to cli if this param is not available...
2
null
Implement the Python class `CompositePositionalArgument` described below. Class description: composite positional argument class. this class must be used for composite positional cli arguments. composite positional arguments are those that will be emitted after command name at specified index and without any argument ...
Implement the Python class `CompositePositionalArgument` described below. Class description: composite positional argument class. this class must be used for composite positional cli arguments. composite positional arguments are those that will be emitted after command name at specified index and without any argument ...
9d4776498225de4f3d16a4600b5b19212abe8562
<|skeleton|> class CompositePositionalArgument: """composite positional argument class. this class must be used for composite positional cli arguments. composite positional arguments are those that will be emitted after command name at specified index and without any argument name, and the value could be a list. fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompositePositionalArgument: """composite positional argument class. this class must be used for composite positional cli arguments. composite positional arguments are those that will be emitted after command name at specified index and without any argument name, and the value could be a list. for example: `c...
the_stack_v2_python_sparse
src/pyrin/cli/arguments.py
mononobi/pyrin
train
20
04164599d53bdbebca30700f26d746cfa9a95deb
[ "if len(points) < 2:\n raise Exception('not enough points')\nif len(points) >= 2 and points[0] != points[len(points) - 1]:\n raise Exception('start and end points different')\ntemp_xy = []\nfor point in points:\n if len(point) != 2:\n raise Exception('error for point input: ' + str(point))\n temp...
<|body_start_0|> if len(points) < 2: raise Exception('not enough points') if len(points) >= 2 and points[0] != points[len(points) - 1]: raise Exception('start and end points different') temp_xy = [] for point in points: if len(point) != 2: ...
Boundary object for GDSIO
Boundary
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Boundary: """Boundary object for GDSIO""" def __init__(self, layer, dataType, points): """initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : list xy coordinates for Boundary object""" <|body_0|> def export(self, st...
stack_v2_sparse_classes_36k_train_034726
18,791
permissive
[ { "docstring": "initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : list xy coordinates for Boundary object", "name": "__init__", "signature": "def __init__(self, layer, dataType, points)" }, { "docstring": "Export to stream Parameters ----...
2
null
Implement the Python class `Boundary` described below. Class description: Boundary object for GDSIO Method signatures and docstrings: - def __init__(self, layer, dataType, points): initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : list xy coordinates for Bound...
Implement the Python class `Boundary` described below. Class description: Boundary object for GDSIO Method signatures and docstrings: - def __init__(self, layer, dataType, points): initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : list xy coordinates for Bound...
8f62ec1971480cb27cb592421fd97f590379cff9
<|skeleton|> class Boundary: """Boundary object for GDSIO""" def __init__(self, layer, dataType, points): """initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : list xy coordinates for Boundary object""" <|body_0|> def export(self, st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Boundary: """Boundary object for GDSIO""" def __init__(self, layer, dataType, points): """initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : list xy coordinates for Boundary object""" if len(points) < 2: raise Exception(...
the_stack_v2_python_sparse
GDSIO.py
ucb-art/laygo
train
24
6d5b82fcd467f7544606821183d3b08444962797
[ "self.expiry_timestamp_msecs = expiry_timestamp_msecs\nself.hold_timestamp_msecs = hold_timestamp_msecs\nself.lock_timestamp_msecs = lock_timestamp_msecs\nself.mode = mode\nself.state = state", "if dictionary is None:\n return None\nexpiry_timestamp_msecs = dictionary.get('expiryTimestampMsecs')\nhold_timestam...
<|body_start_0|> self.expiry_timestamp_msecs = expiry_timestamp_msecs self.hold_timestamp_msecs = hold_timestamp_msecs self.lock_timestamp_msecs = lock_timestamp_msecs self.mode = mode self.state = state <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'FileLockStatus' model. Specifies the information of lock status for a file. Attributes: expiry_timestamp_msecs (long|int): Specifies a expiry timestamp in milliseconds until the file is locked. hold_timestamp_msecs (long|int): Specifies a override timestamp in milliseconds when an expired file is...
FileLockStatus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileLockStatus: """Implementation of the 'FileLockStatus' model. Specifies the information of lock status for a file. Attributes: expiry_timestamp_msecs (long|int): Specifies a expiry timestamp in milliseconds until the file is locked. hold_timestamp_msecs (long|int): Specifies a override timesta...
stack_v2_sparse_classes_36k_train_034727
3,226
permissive
[ { "docstring": "Constructor for the FileLockStatus class", "name": "__init__", "signature": "def __init__(self, expiry_timestamp_msecs=None, hold_timestamp_msecs=None, lock_timestamp_msecs=None, mode=None, state=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: ...
2
null
Implement the Python class `FileLockStatus` described below. Class description: Implementation of the 'FileLockStatus' model. Specifies the information of lock status for a file. Attributes: expiry_timestamp_msecs (long|int): Specifies a expiry timestamp in milliseconds until the file is locked. hold_timestamp_msecs (...
Implement the Python class `FileLockStatus` described below. Class description: Implementation of the 'FileLockStatus' model. Specifies the information of lock status for a file. Attributes: expiry_timestamp_msecs (long|int): Specifies a expiry timestamp in milliseconds until the file is locked. hold_timestamp_msecs (...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FileLockStatus: """Implementation of the 'FileLockStatus' model. Specifies the information of lock status for a file. Attributes: expiry_timestamp_msecs (long|int): Specifies a expiry timestamp in milliseconds until the file is locked. hold_timestamp_msecs (long|int): Specifies a override timesta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileLockStatus: """Implementation of the 'FileLockStatus' model. Specifies the information of lock status for a file. Attributes: expiry_timestamp_msecs (long|int): Specifies a expiry timestamp in milliseconds until the file is locked. hold_timestamp_msecs (long|int): Specifies a override timestamp in millise...
the_stack_v2_python_sparse
cohesity_management_sdk/models/file_lock_status.py
cohesity/management-sdk-python
train
24
9d6fd3d12b2418c603df787e8523ba01956be39e
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn user" ]
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.create_user(...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email, date of birth a...
stack_v2_sparse_classes_36k_train_034728
2,325
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name": "create_...
2
stack_v2_sparse_classes_30k_train_012931
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, password): C...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, password): C...
521bcdf8e30a9ce093df29cb7f28e8c2f2d4d979
<|skeleton|> class MyUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email, date of birth a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email)) user....
the_stack_v2_python_sparse
Family_Care/doctor/models.py
dkdinesh982/marvelapp
train
0
63a92be1d7d4fab2c907c4b75b552e7a33d2d229
[ "slow = 0\nfor fast in range(len(nums)):\n if nums[fast] != val:\n nums[slow] = nums[fast]\n slow += 1\nreturn slow", "i = 0\nn = len(nums)\nwhile i < n:\n if nums[i] == val:\n nums[i] = nums[n - 1]\n n -= 1\n else:\n i += 1\nreturn n" ]
<|body_start_0|> slow = 0 for fast in range(len(nums)): if nums[fast] != val: nums[slow] = nums[fast] slow += 1 return slow <|end_body_0|> <|body_start_1|> i = 0 n = len(nums) while i < n: if nums[i] == val: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElement_1(self, nums: List[int], val: int) -> int: """双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:""" <|body_0|> def removeElement_2(self, nums: List[int], val: int) -> int: """双指针2 时间复杂度:O(n), i 和 ...
stack_v2_sparse_classes_36k_train_034729
2,796
no_license
[ { "docstring": "双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:", "name": "removeElement_1", "signature": "def removeElement_1(self, nums: List[int], val: int) -> int" }, { "docstring": "双指针2 时间复杂度:O(n), i 和 n 最多遍历 nn 步。在这个方法中,赋值操作的次数等于要删除的元素的数量。因此,如...
2
stack_v2_sparse_classes_30k_train_001913
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement_1(self, nums: List[int], val: int) -> int: 双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return: - def removeElement_2(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement_1(self, nums: List[int], val: int) -> int: 双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return: - def removeElement_2(s...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def removeElement_1(self, nums: List[int], val: int) -> int: """双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:""" <|body_0|> def removeElement_2(self, nums: List[int], val: int) -> int: """双指针2 时间复杂度:O(n), i 和 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeElement_1(self, nums: List[int], val: int) -> int: """双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:""" slow = 0 for fast in range(len(nums)): if nums[fast] != val: nums[slow] = nums[fast] ...
the_stack_v2_python_sparse
软件开发岗刷题(华为笔试准备)/数组和字符串/removeElement.py
MaoningGuan/LeetCode
train
3
a2c232accecd9e94f71aee65d69d8f7f01c4a76a
[ "n = len(strs)\nif n < 1:\n return []\nsorted_strs = sorted(strs, key=lambda x: sorted(x))\nret = []\npre = sorted_strs[0]\ntmp = [pre]\nfor i in range(1, n):\n cur = sorted_strs[i]\n if sorted(cur) == sorted(pre):\n tmp.append(cur)\n else:\n ret.append(tmp[:])\n tmp = [cur]\n pr...
<|body_start_0|> n = len(strs) if n < 1: return [] sorted_strs = sorted(strs, key=lambda x: sorted(x)) ret = [] pre = sorted_strs[0] tmp = [pre] for i in range(1, n): cur = sorted_strs[i] if sorted(cur) == sorted(pre): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams1(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams2(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> def groupAnagrams3(self, strs): """:type strs:...
stack_v2_sparse_classes_36k_train_034730
1,965
no_license
[ { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams1", "signature": "def groupAnagrams1(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams2", "signature": "def groupAnagrams2(self, strs)" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams1(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams2(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams3...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams1(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams2(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams3...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class Solution: def groupAnagrams1(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams2(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> def groupAnagrams3(self, strs): """:type strs:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def groupAnagrams1(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" n = len(strs) if n < 1: return [] sorted_strs = sorted(strs, key=lambda x: sorted(x)) ret = [] pre = sorted_strs[0] tmp = [pre] for i in ran...
the_stack_v2_python_sparse
leetcode/49.py
liuweilin17/algorithm
train
3
c8762f77d4afa989c809e65e2b7faaa3df03d6d8
[ "uname = self.cleaned_data['username']\nif len(uname) < 6:\n raise forms.ValidationError('用户名太短')\nreturn uname", "pwd1 = self.cleaned_data['password']\npwd2 = self.cleaned_data['password2']\nif pwd1 != pwd2:\n raise forms.ValidationError('两次密码不一致')\nreturn self.cleaned_data" ]
<|body_start_0|> uname = self.cleaned_data['username'] if len(uname) < 6: raise forms.ValidationError('用户名太短') return uname <|end_body_0|> <|body_start_1|> pwd1 = self.cleaned_data['password'] pwd2 = self.cleaned_data['password2'] if pwd1 != pwd2: ...
MyRegFrom
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyRegFrom: def clean_username(self): """此方法限定username必须大于等于6个字符""" <|body_0|> def clean(self): """验证两个密码是否一致!不一致抛出ValidationError类型的异常""" <|body_1|> <|end_skeleton|> <|body_start_0|> uname = self.cleaned_data['username'] if len(uname) < 6: ...
stack_v2_sparse_classes_36k_train_034731
1,209
no_license
[ { "docstring": "此方法限定username必须大于等于6个字符", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "验证两个密码是否一致!不一致抛出ValidationError类型的异常", "name": "clean", "signature": "def clean(self)" } ]
2
null
Implement the Python class `MyRegFrom` described below. Class description: Implement the MyRegFrom class. Method signatures and docstrings: - def clean_username(self): 此方法限定username必须大于等于6个字符 - def clean(self): 验证两个密码是否一致!不一致抛出ValidationError类型的异常
Implement the Python class `MyRegFrom` described below. Class description: Implement the MyRegFrom class. Method signatures and docstrings: - def clean_username(self): 此方法限定username必须大于等于6个字符 - def clean(self): 验证两个密码是否一致!不一致抛出ValidationError类型的异常 <|skeleton|> class MyRegFrom: def clean_username(self): ...
319daf56d88e92f69ee467e0ccf83c01367ed137
<|skeleton|> class MyRegFrom: def clean_username(self): """此方法限定username必须大于等于6个字符""" <|body_0|> def clean(self): """验证两个密码是否一致!不一致抛出ValidationError类型的异常""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyRegFrom: def clean_username(self): """此方法限定username必须大于等于6个字符""" uname = self.cleaned_data['username'] if len(uname) < 6: raise forms.ValidationError('用户名太短') return uname def clean(self): """验证两个密码是否一致!不一致抛出ValidationError类型的异常""" pwd1 = self...
the_stack_v2_python_sparse
django_base/mysite6/user/forms.py
vivid-ZLL/tedu
train
0
c66b999b7b85c6b60b29e358a5db643988fde3b4
[ "n = len(init_val)\nself.segfunc = segfunc\nself.ide_ele = ide_ele\nself.num = 1 << (n - 1).bit_length()\nself.tree = [ide_ele] * 2 * self.num\nfor i in range(n):\n self.tree[self.num + i] = init_val[i]\nfor i in range(self.num - 1, 0, -1):\n self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])...
<|body_start_0|> n = len(init_val) self.segfunc = segfunc self.ide_ele = ide_ele self.num = 1 << (n - 1).bit_length() self.tree = [ide_ele] * 2 * self.num for i in range(n): self.tree[self.num + i] = init_val[i] for i in range(self.num - 1, 0, -1): ...
init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
SegTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegTree: """init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)""" def __init__(self, init_val, segfunc, ide_ele): """init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" ...
stack_v2_sparse_classes_36k_train_034732
2,441
no_license
[ { "docstring": "init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)", "name": "__init__", "signature": "def __init__(self, init_val, segfunc, ide_ele)" }, { "docstring": "k番目の値をxに更新 k: index(0-index) x: update value", "name": "update", "signatur...
3
stack_v2_sparse_classes_30k_train_012215
Implement the Python class `SegTree` described below. Class description: init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN) Method signatures and docstrings: - def __init__(self, init_val, segfunc, ide_ele): init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_el...
Implement the Python class `SegTree` described below. Class description: init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN) Method signatures and docstrings: - def __init__(self, init_val, segfunc, ide_ele): init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_el...
2526e72de9eb19d1e1c634dbd577816bfe39bc10
<|skeleton|> class SegTree: """init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)""" def __init__(self, init_val, segfunc, ide_ele): """init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SegTree: """init(init_val, ide_ele): 配列init_valで初期化 O(N) update(k, x): k番目の値をxに更新 O(N) query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)""" def __init__(self, init_val, segfunc, ide_ele): """init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" n = l...
the_stack_v2_python_sparse
ABC/ACLBC/ACLBC_D.py
happa64/AtCoder_Beginner_Contest
train
0
2f835e30641a7176346e906f0c71ccb04e46bc27
[ "\"\"\"\n self.golden_ratio = 1.618\n self.table_size = 65536\n self.table = [[] for _ in range(self.table_size)]\n self.hash = lambda i: i * math.ceil(self.golden_ratio * self.table_size) % self.table_size\n \"\"\"\nself.dict = {}", "\"\"\"\n self.remove(key) # use the ...
<|body_start_0|> """ self.golden_ratio = 1.618 self.table_size = 65536 self.table = [[] for _ in range(self.table_size)] self.hash = lambda i: i * math.ceil(self.golden_ratio * self.table_size) % self.table_size """ self.dic...
MyHashMap
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key: int, value: int) -> None: """value will always be non-negative.""" <|body_1|> def get(self, key: int) -> int: """Returns the value to which th...
stack_v2_sparse_classes_36k_train_034733
3,048
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "value will always be non-negative.", "name": "put", "signature": "def put(self, key: int, value: int) -> None" }, { "docstring": "Returns the value to w...
4
stack_v2_sparse_classes_30k_train_012088
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key: int, value: int) -> None: value will always be non-negative. - def get(self, key: int) -> int: Ret...
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key: int, value: int) -> None: value will always be non-negative. - def get(self, key: int) -> int: Ret...
4ea4c1579c28308455be4dfa02bd45ebd88b2d0a
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key: int, value: int) -> None: """value will always be non-negative.""" <|body_1|> def get(self, key: int) -> int: """Returns the value to which th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyHashMap: def __init__(self): """Initialize your data structure here.""" """ self.golden_ratio = 1.618 self.table_size = 65536 self.table = [[] for _ in range(self.table_size)] self.hash = lambda i: i * math.ceil(self.golden_rati...
the_stack_v2_python_sparse
src/integers/myHashMap.py
way2arun/datastructures_algorithms
train
1
4f11d10128806d930428a90fe29a6656b189cf32
[ "super().__init__()\ndown_list = []\nif stride == 0:\n down_list.append(nn.AdaptiveAvgPool2d((1, 1)))\nelif stride == 1:\n pass\nelse:\n down_list.append(nn.AvgPool2d(kernel_size=kernel_size, stride=stride, padding=stride))\ndown_list.append(nn.BatchNorm2d(in_planes))\ndown_list.append(nn.ReLU(inplace=True...
<|body_start_0|> super().__init__() down_list = [] if stride == 0: down_list.append(nn.AdaptiveAvgPool2d((1, 1))) elif stride == 1: pass else: down_list.append(nn.AvgPool2d(kernel_size=kernel_size, stride=stride, padding=stride)) down_l...
DAPPMBranch
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DAPPMBranch: def __init__(self, kernel_size: int, stride: int, in_planes: int, branch_planes: int, inter_mode: str='bilinear'): """A DAPPM branch :param kernel_size: the kernel size for the average pooling when stride=0 this parameter is omitted and AdaptiveAvgPool2d over all the input i...
stack_v2_sparse_classes_36k_train_034734
28,514
permissive
[ { "docstring": "A DAPPM branch :param kernel_size: the kernel size for the average pooling when stride=0 this parameter is omitted and AdaptiveAvgPool2d over all the input is performed :param stride: stride for the average pooling when stride=0: an AdaptiveAvgPool2d over all the input is performed (output is 1x...
2
null
Implement the Python class `DAPPMBranch` described below. Class description: Implement the DAPPMBranch class. Method signatures and docstrings: - def __init__(self, kernel_size: int, stride: int, in_planes: int, branch_planes: int, inter_mode: str='bilinear'): A DAPPM branch :param kernel_size: the kernel size for th...
Implement the Python class `DAPPMBranch` described below. Class description: Implement the DAPPMBranch class. Method signatures and docstrings: - def __init__(self, kernel_size: int, stride: int, in_planes: int, branch_planes: int, inter_mode: str='bilinear'): A DAPPM branch :param kernel_size: the kernel size for th...
7240726cf6425b53a26ed2faec03672f30fee6be
<|skeleton|> class DAPPMBranch: def __init__(self, kernel_size: int, stride: int, in_planes: int, branch_planes: int, inter_mode: str='bilinear'): """A DAPPM branch :param kernel_size: the kernel size for the average pooling when stride=0 this parameter is omitted and AdaptiveAvgPool2d over all the input i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DAPPMBranch: def __init__(self, kernel_size: int, stride: int, in_planes: int, branch_planes: int, inter_mode: str='bilinear'): """A DAPPM branch :param kernel_size: the kernel size for the average pooling when stride=0 this parameter is omitted and AdaptiveAvgPool2d over all the input is performed :p...
the_stack_v2_python_sparse
src/super_gradients/training/models/segmentation_models/ddrnet.py
Deci-AI/super-gradients
train
3,237
de2c1fb080b40559cac5fdb6710e8ec24bbf8ef3
[ "assert sr > 9000, 'Sampling rate too low!'\nself.gbank = Gammatone(sr, num_chan, (130.0, 4500.0))\nself.gammawgt = self.gbank.gammawgt(nfft)\n\ndef _stft(sig):\n return stft(sig, wind, hop, nfft, synth=True, zphase=True)\n\ndef _istft(spec):\n return istft(spec, wind, hop, nfft, zphase=True)\nself.stft = _st...
<|body_start_0|> assert sr > 9000, 'Sampling rate too low!' self.gbank = Gammatone(sr, num_chan, (130.0, 4500.0)) self.gammawgt = self.gbank.gammawgt(nfft) def _stft(sig): return stft(sig, wind, hop, nfft, synth=True, zphase=True) def _istft(spec): retur...
Suppression of Slowly-varying components and the Falling edge. This implementation follows paper by Kim and Stern: Kim, Chanwoo, and Richard M. Stern."Nonlinear enhancement of onset for robust speech recognition." Eleventh Annual Conference of the International Speech Communication Association. 2010. See Also -------- ...
SSFEnhancer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSFEnhancer: """Suppression of Slowly-varying components and the Falling edge. This implementation follows paper by Kim and Stern: Kim, Chanwoo, and Richard M. Stern."Nonlinear enhancement of onset for robust speech recognition." Eleventh Annual Conference of the International Speech Communicatio...
stack_v2_sparse_classes_36k_train_034735
19,410
permissive
[ { "docstring": "Instantiate an SSF enhancer. Parameters ---------- sr: int Sampling rate in Hz. wind: numpy.ndarray Window function. hop: float Hop fraction. nfft: int Number of DFT points. Keyword Parameters ------------------ num_chan: int, 40 Number of channels in the Gammatone filterbank. ptype: int, 2 SSF ...
2
stack_v2_sparse_classes_30k_train_015194
Implement the Python class `SSFEnhancer` described below. Class description: Suppression of Slowly-varying components and the Falling edge. This implementation follows paper by Kim and Stern: Kim, Chanwoo, and Richard M. Stern."Nonlinear enhancement of onset for robust speech recognition." Eleventh Annual Conference o...
Implement the Python class `SSFEnhancer` described below. Class description: Suppression of Slowly-varying components and the Falling edge. This implementation follows paper by Kim and Stern: Kim, Chanwoo, and Richard M. Stern."Nonlinear enhancement of onset for robust speech recognition." Eleventh Annual Conference o...
740139490208ca7605e9b520f1a28214fa3903dc
<|skeleton|> class SSFEnhancer: """Suppression of Slowly-varying components and the Falling edge. This implementation follows paper by Kim and Stern: Kim, Chanwoo, and Richard M. Stern."Nonlinear enhancement of onset for robust speech recognition." Eleventh Annual Conference of the International Speech Communicatio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SSFEnhancer: """Suppression of Slowly-varying components and the Falling edge. This implementation follows paper by Kim and Stern: Kim, Chanwoo, and Richard M. Stern."Nonlinear enhancement of onset for robust speech recognition." Eleventh Annual Conference of the International Speech Communication Association...
the_stack_v2_python_sparse
audlib/enhance.py
templeblock/pyaudlib
train
0
8a4920c227e43edb898d2f61e38e463f3df43473
[ "current_method = 1\nnext_method = 1\nfor _ in range(n):\n current_method, next_method = (next_method, current_method + next_method)\nreturn current_method", "from __builtin__ import xrange\ndp = dict()\ndp[0] = 1\ndp[1] = 1\nfor i in xrange(2, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2]\nreturn dp[n]" ]
<|body_start_0|> current_method = 1 next_method = 1 for _ in range(n): current_method, next_method = (next_method, current_method + next_method) return current_method <|end_body_0|> <|body_start_1|> from __builtin__ import xrange dp = dict() dp[0] = 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def rewrite(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> current_method = 1 next_method = 1 for _ in range(n): ...
stack_v2_sparse_classes_36k_train_034736
1,206
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "rewrite", "signature": "def rewrite(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def rewrite(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 climbStairs(self, n): :type n: int :rtype: int - def rewrite(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def climbStairs(self, n): """:type ...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def rewrite(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" current_method = 1 next_method = 1 for _ in range(n): current_method, next_method = (next_method, current_method + next_method) return current_method def rewrite(self, n): """:ty...
the_stack_v2_python_sparse
co_apple/70_Climbing_Stairs.py
vsdrun/lc_public
train
6
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/mybookings/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/mybookings/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 20...
<|body_start_0|> url = '/mybookings/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/mybookings/' self.client.login(username=self.adminUN, password='pass') response = self.cl...
MyBookingsTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyBookingsTestCase: def test_not_logged_in(self): """Test that the mybookings view will load whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the mybookings view will load whilst logged in as admin.""" <|body_1|> def test_...
stack_v2_sparse_classes_36k_train_034737
26,818
permissive
[ { "docstring": "Test that the mybookings view will load whilst not logged in.", "name": "test_not_logged_in", "signature": "def test_not_logged_in(self)" }, { "docstring": "Test that the mybookings view will load whilst logged in as admin.", "name": "test_logged_in_admin", "signature": "...
3
null
Implement the Python class `MyBookingsTestCase` described below. Class description: Implement the MyBookingsTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the mybookings view will load whilst not logged in. - def test_logged_in_admin(self): Test that the mybookings view wi...
Implement the Python class `MyBookingsTestCase` described below. Class description: Implement the MyBookingsTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the mybookings view will load whilst not logged in. - def test_logged_in_admin(self): Test that the mybookings view wi...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class MyBookingsTestCase: def test_not_logged_in(self): """Test that the mybookings view will load whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the mybookings view will load whilst logged in as admin.""" <|body_1|> def test_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyBookingsTestCase: def test_not_logged_in(self): """Test that the mybookings view will load whilst not logged in.""" url = '/mybookings/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) def test_logged_in_admin(self)...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
8e96b820a3ed175dd08658fff5d00040564a2063
[ "ACTIONS_ALLOWED = ['publish', 'moderate', 'delete', 'undelete']\nif self.cleaned_data['action'] in ACTIONS_ALLOWED:\n return self.cleaned_data['action']\nraise forms.ValidationError(u'Improper comment action specified: %s' % self.cleaned_data['action'])", "try:\n FreeComment.objects.get(pk=self.cleaned_dat...
<|body_start_0|> ACTIONS_ALLOWED = ['publish', 'moderate', 'delete', 'undelete'] if self.cleaned_data['action'] in ACTIONS_ALLOWED: return self.cleaned_data['action'] raise forms.ValidationError(u'Improper comment action specified: %s' % self.cleaned_data['action']) <|end_body_0|> <...
SingleQuickActionForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleQuickActionForm: def clean_action(self): """Validates that the action is allowed by the system.""" <|body_0|> def clean_comment(self): """Validates that the comment exists.""" <|body_1|> def clean_url(self): """Validates that the relative U...
stack_v2_sparse_classes_36k_train_034738
1,364
no_license
[ { "docstring": "Validates that the action is allowed by the system.", "name": "clean_action", "signature": "def clean_action(self)" }, { "docstring": "Validates that the comment exists.", "name": "clean_comment", "signature": "def clean_comment(self)" }, { "docstring": "Validates...
3
stack_v2_sparse_classes_30k_val_000002
Implement the Python class `SingleQuickActionForm` described below. Class description: Implement the SingleQuickActionForm class. Method signatures and docstrings: - def clean_action(self): Validates that the action is allowed by the system. - def clean_comment(self): Validates that the comment exists. - def clean_ur...
Implement the Python class `SingleQuickActionForm` described below. Class description: Implement the SingleQuickActionForm class. Method signatures and docstrings: - def clean_action(self): Validates that the action is allowed by the system. - def clean_comment(self): Validates that the comment exists. - def clean_ur...
1d307854a452674fbce7bc50faf70d367b85f84e
<|skeleton|> class SingleQuickActionForm: def clean_action(self): """Validates that the action is allowed by the system.""" <|body_0|> def clean_comment(self): """Validates that the comment exists.""" <|body_1|> def clean_url(self): """Validates that the relative U...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleQuickActionForm: def clean_action(self): """Validates that the action is allowed by the system.""" ACTIONS_ALLOWED = ['publish', 'moderate', 'delete', 'undelete'] if self.cleaned_data['action'] in ACTIONS_ALLOWED: return self.cleaned_data['action'] raise forms...
the_stack_v2_python_sparse
apps/staff/commentmod/forms.py
queensjournal/queensjournal.ca
train
1
cdd9e9a6d1855c14ab825351587b8e12a2f14e76
[ "match = wrapperRE.match(branchInfo.GetTypeName())\nif match:\n self.type = match.group(1)\nelse:\n raise ValueError('Not edm::Wrapper')\nname = trailingDotRE.sub('', branchInfo.GetName())\npieces = underscoreRE.split(name)\nif len(pieces) != 4:\n raise ValueError('%s not formatted as expected' % name)\nse...
<|body_start_0|> match = wrapperRE.match(branchInfo.GetTypeName()) if match: self.type = match.group(1) else: raise ValueError('Not edm::Wrapper') name = trailingDotRE.sub('', branchInfo.GetName()) pieces = underscoreRE.split(name) if len(pieces) !...
Branch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Branch: def __init__(self, branchInfo, regexList=None): """Takes the needed information from Root's Branch Info""" <|body_0|> def __str__(self): """String representation""" <|body_1|> def _setForm(branchList): """Loop through lists and set widths...
stack_v2_sparse_classes_36k_train_034739
9,332
permissive
[ { "docstring": "Takes the needed information from Root's Branch Info", "name": "__init__", "signature": "def __init__(self, branchInfo, regexList=None)" }, { "docstring": "String representation", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Loop through ...
4
stack_v2_sparse_classes_30k_train_010494
Implement the Python class `Branch` described below. Class description: Implement the Branch class. Method signatures and docstrings: - def __init__(self, branchInfo, regexList=None): Takes the needed information from Root's Branch Info - def __str__(self): String representation - def _setForm(branchList): Loop throu...
Implement the Python class `Branch` described below. Class description: Implement the Branch class. Method signatures and docstrings: - def __init__(self, branchInfo, regexList=None): Takes the needed information from Root's Branch Info - def __str__(self): String representation - def _setForm(branchList): Loop throu...
19c178740257eb48367778593da55dcad08b7a4f
<|skeleton|> class Branch: def __init__(self, branchInfo, regexList=None): """Takes the needed information from Root's Branch Info""" <|body_0|> def __str__(self): """String representation""" <|body_1|> def _setForm(branchList): """Loop through lists and set widths...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Branch: def __init__(self, branchInfo, regexList=None): """Takes the needed information from Root's Branch Info""" match = wrapperRE.match(branchInfo.GetTypeName()) if match: self.type = match.group(1) else: raise ValueError('Not edm::Wrapper') n...
the_stack_v2_python_sparse
FWCore/PythonUtilities/scripts/edmDumpEventContent
cms-sw/cmssw
train
1,006
bd0abd8fbc0bbebdff3449441c30c40894361cae
[ "words.sort(key=len)\nwordset = set()\nres = []\n\ndef dfs(s, wset):\n if not wset:\n return False\n dp = {}\n\n def helper(s):\n if not s:\n return True\n if s in dp:\n return dp[s]\n for i in range(len(s)):\n if s[0:i + 1] in wset:\n ...
<|body_start_0|> words.sort(key=len) wordset = set() res = [] def dfs(s, wset): if not wset: return False dp = {} def helper(s): if not s: return True if s in dp: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findAllConcatenatedWordsInADict(self, words): """:type words: List[str] :rtype: List[str]""" <|body_0|> def findAllConcatenatedWordsInADictTLE(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> def findAllConcatenatedWo...
stack_v2_sparse_classes_36k_train_034740
3,879
no_license
[ { "docstring": ":type words: List[str] :rtype: List[str]", "name": "findAllConcatenatedWordsInADict", "signature": "def findAllConcatenatedWordsInADict(self, words)" }, { "docstring": ":type words: List[str] :rtype: List[str]", "name": "findAllConcatenatedWordsInADictTLE", "signature": "...
3
stack_v2_sparse_classes_30k_train_011432
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAllConcatenatedWordsInADict(self, words): :type words: List[str] :rtype: List[str] - def findAllConcatenatedWordsInADictTLE(self, words): :type words: List[str] :rtype: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAllConcatenatedWordsInADict(self, words): :type words: List[str] :rtype: List[str] - def findAllConcatenatedWordsInADictTLE(self, words): :type words: List[str] :rtype: L...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def findAllConcatenatedWordsInADict(self, words): """:type words: List[str] :rtype: List[str]""" <|body_0|> def findAllConcatenatedWordsInADictTLE(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> def findAllConcatenatedWo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findAllConcatenatedWordsInADict(self, words): """:type words: List[str] :rtype: List[str]""" words.sort(key=len) wordset = set() res = [] def dfs(s, wset): if not wset: return False dp = {} def helper(s...
the_stack_v2_python_sparse
C/ConcatenatedWords.py
bssrdf/pyleet
train
2
991476d0a5bbe16e3718fd2926ccf31de42cd983
[ "l = self.clone()\nl.from_segment = self.to_segment\nl.from_orient = gfapy.invert(self.to_orient)\nl.to_segment = self.from_segment\nl.to_orient = gfapy.invert(self.from_orient)\nl.overlap = self.overlap.complement()\nreturn l", "tmp = self.from_segment\nself.from_segment = self.to_segment\nself.to_segment = tmp\...
<|body_start_0|> l = self.clone() l.from_segment = self.to_segment l.from_orient = gfapy.invert(self.to_orient) l.to_segment = self.from_segment l.to_orient = gfapy.invert(self.from_orient) l.overlap = self.overlap.complement() return l <|end_body_0|> <|body_star...
Complement
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Complement: def complement(self): """Creates the equivalent link with from and to inverted. The CIGAR operations (order and type) are inverted as well. Tags are left unchanged. Note: The path references are not copied to the complement link. Note: This method shall be overridden if custo...
stack_v2_sparse_classes_36k_train_034741
1,585
permissive
[ { "docstring": "Creates the equivalent link with from and to inverted. The CIGAR operations (order and type) are inverted as well. Tags are left unchanged. Note: The path references are not copied to the complement link. Note: This method shall be overridden if custom tags are defined, which have a complementat...
2
null
Implement the Python class `Complement` described below. Class description: Implement the Complement class. Method signatures and docstrings: - def complement(self): Creates the equivalent link with from and to inverted. The CIGAR operations (order and type) are inverted as well. Tags are left unchanged. Note: The pa...
Implement the Python class `Complement` described below. Class description: Implement the Complement class. Method signatures and docstrings: - def complement(self): Creates the equivalent link with from and to inverted. The CIGAR operations (order and type) are inverted as well. Tags are left unchanged. Note: The pa...
12b31daac26ab137b6ee4a29b4f14554ba962dcb
<|skeleton|> class Complement: def complement(self): """Creates the equivalent link with from and to inverted. The CIGAR operations (order and type) are inverted as well. Tags are left unchanged. Note: The path references are not copied to the complement link. Note: This method shall be overridden if custo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Complement: def complement(self): """Creates the equivalent link with from and to inverted. The CIGAR operations (order and type) are inverted as well. Tags are left unchanged. Note: The path references are not copied to the complement link. Note: This method shall be overridden if custom tags are def...
the_stack_v2_python_sparse
gfapy/line/edge/link/complement.py
ggonnella/gfapy
train
63
3f590307c4e50d1541efba93db3325a8e347bd33
[ "default_sec_group = [group for group in self.os_conn.nova.security_groups.list() if group.name == 'default'][0]\nself.os_conn.nova.security_group_rules.create(default_sec_group.id, ip_protocol='tcp', from_port=22, to_port=22, cidr='0.0.0.0/0')\nself.os_conn.nova.security_group_rules.create(default_sec_group.id, ip...
<|body_start_0|> default_sec_group = [group for group in self.os_conn.nova.security_groups.list() if group.name == 'default'][0] self.os_conn.nova.security_group_rules.create(default_sec_group.id, ip_protocol='tcp', from_port=22, to_port=22, cidr='0.0.0.0/0') self.os_conn.nova.security_group_rul...
Common functions for ovs tests
OvsBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OvsBase: """Common functions for ovs tests""" def setup_rules_for_default_sec_group(self): """Add necessary rules to default security group.""" <|body_0|> def get_current_cookie(self, compute): """Get the value of the cookie parameter for br-int or br-tun bridge....
stack_v2_sparse_classes_36k_train_034742
41,546
no_license
[ { "docstring": "Add necessary rules to default security group.", "name": "setup_rules_for_default_sec_group", "signature": "def setup_rules_for_default_sec_group(self)" }, { "docstring": "Get the value of the cookie parameter for br-int or br-tun bridge. :param compute: Compute node where the se...
2
stack_v2_sparse_classes_30k_train_015985
Implement the Python class `OvsBase` described below. Class description: Common functions for ovs tests Method signatures and docstrings: - def setup_rules_for_default_sec_group(self): Add necessary rules to default security group. - def get_current_cookie(self, compute): Get the value of the cookie parameter for br-...
Implement the Python class `OvsBase` described below. Class description: Common functions for ovs tests Method signatures and docstrings: - def setup_rules_for_default_sec_group(self): Add necessary rules to default security group. - def get_current_cookie(self, compute): Get the value of the cookie parameter for br-...
8aced2855b78b5f123195d188c80e27b43888a2e
<|skeleton|> class OvsBase: """Common functions for ovs tests""" def setup_rules_for_default_sec_group(self): """Add necessary rules to default security group.""" <|body_0|> def get_current_cookie(self, compute): """Get the value of the cookie parameter for br-int or br-tun bridge....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OvsBase: """Common functions for ovs tests""" def setup_rules_for_default_sec_group(self): """Add necessary rules to default security group.""" default_sec_group = [group for group in self.os_conn.nova.security_groups.list() if group.name == 'default'][0] self.os_conn.nova.securit...
the_stack_v2_python_sparse
mos_tests/neutron/python_tests/test_ovs_restart.py
Mirantis/mos-integration-tests
train
16
17e8080849587459a5429ba9b74c62ce5eeb8083
[ "try:\n user = User.objects.get(email=username)\n if user.check_password(password):\n return user\n return None\nexcept User.DoesNotExist:\n return None", "try:\n user = User.objects.get(pk=user_id)\n if user.is_active:\n return user\n return None\nexcept User.DoesNotExist:\n ...
<|body_start_0|> try: user = User.objects.get(email=username) if user.check_password(password): return user return None except User.DoesNotExist: return None <|end_body_0|> <|body_start_1|> try: user = User.objects.get(...
to authenticate a user using their email address & password
EmailAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailAuth: """to authenticate a user using their email address & password""" def authenticate(self, username=None, password=None): """get an instance of a User using the email & verify the password""" <|body_0|> def get_user(self, user_id): """method used by the ...
stack_v2_sparse_classes_36k_train_034743
1,231
no_license
[ { "docstring": "get an instance of a User using the email & verify the password", "name": "authenticate", "signature": "def authenticate(self, username=None, password=None)" }, { "docstring": "method used by the Django authentication to get a user instance", "name": "get_user", "signatur...
2
stack_v2_sparse_classes_30k_train_010771
Implement the Python class `EmailAuth` described below. Class description: to authenticate a user using their email address & password Method signatures and docstrings: - def authenticate(self, username=None, password=None): get an instance of a User using the email & verify the password - def get_user(self, user_id)...
Implement the Python class `EmailAuth` described below. Class description: to authenticate a user using their email address & password Method signatures and docstrings: - def authenticate(self, username=None, password=None): get an instance of a User using the email & verify the password - def get_user(self, user_id)...
a80148cb642cb09dac57cff18483be14fed67dfd
<|skeleton|> class EmailAuth: """to authenticate a user using their email address & password""" def authenticate(self, username=None, password=None): """get an instance of a User using the email & verify the password""" <|body_0|> def get_user(self, user_id): """method used by the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailAuth: """to authenticate a user using their email address & password""" def authenticate(self, username=None, password=None): """get an instance of a User using the email & verify the password""" try: user = User.objects.get(email=username) if user.check_passw...
the_stack_v2_python_sparse
accounts/backends.py
sarahbarron/Stream-3-Project
train
1
07d2561068ee20c057b10c258d3bfb19d08fb391
[ "text_length = len(text)\namount_to_pad = self.block_size - text_length % self.block_size\nif amount_to_pad == 0:\n amount_to_pad = self.block_size\npad = chr(amount_to_pad)\nreturn text + pad * amount_to_pad", "pad = ord(decrypted[-1])\nif pad < 1 or pad > 32:\n pad = 0\nreturn decrypted[:-pad]" ]
<|body_start_0|> text_length = len(text) amount_to_pad = self.block_size - text_length % self.block_size if amount_to_pad == 0: amount_to_pad = self.block_size pad = chr(amount_to_pad) return text + pad * amount_to_pad <|end_body_0|> <|body_start_1|> pad = or...
PKCS7-based encryption and decryption algorithm
PKCS7Encoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PKCS7Encoder: """PKCS7-based encryption and decryption algorithm""" def encode(self, text): """@param text: orignial plaintext @return: remedium plaintext""" <|body_0|> def decode(self, decrypted): """Plaintext after you remove the decrypted @param decrypted: dec...
stack_v2_sparse_classes_36k_train_034744
8,425
permissive
[ { "docstring": "@param text: orignial plaintext @return: remedium plaintext", "name": "encode", "signature": "def encode(self, text)" }, { "docstring": "Plaintext after you remove the decrypted @param decrypted: decrypted remedium plaintext @return: plaintext before remedium", "name": "decod...
2
null
Implement the Python class `PKCS7Encoder` described below. Class description: PKCS7-based encryption and decryption algorithm Method signatures and docstrings: - def encode(self, text): @param text: orignial plaintext @return: remedium plaintext - def decode(self, decrypted): Plaintext after you remove the decrypted ...
Implement the Python class `PKCS7Encoder` described below. Class description: PKCS7-based encryption and decryption algorithm Method signatures and docstrings: - def encode(self, text): @param text: orignial plaintext @return: remedium plaintext - def decode(self, decrypted): Plaintext after you remove the decrypted ...
6be1af50496340ded9879a6450c8208ac9f97e72
<|skeleton|> class PKCS7Encoder: """PKCS7-based encryption and decryption algorithm""" def encode(self, text): """@param text: orignial plaintext @return: remedium plaintext""" <|body_0|> def decode(self, decrypted): """Plaintext after you remove the decrypted @param decrypted: dec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PKCS7Encoder: """PKCS7-based encryption and decryption algorithm""" def encode(self, text): """@param text: orignial plaintext @return: remedium plaintext""" text_length = len(text) amount_to_pad = self.block_size - text_length % self.block_size if amount_to_pad == 0: ...
the_stack_v2_python_sparse
server/services/wechat/assembly/WXBizMsgCrypt.py
Soopro/totoro
train
0
a1a56f8347f276262673a8c2a88cb9193f10f38e
[ "super().__init__(optimizer, initial_lambda, lambda_updater, logger, val_split)\nif not isinstance(p, int) or p < 1:\n raise ValueError('p must be a positive integer')\nself.p = p", "del loss\npenalty = 0\nfor group in self.optimizer.param_groups:\n for param in group['params']:\n penalty += th.linal...
<|body_start_0|> super().__init__(optimizer, initial_lambda, lambda_updater, logger, val_split) if not isinstance(p, int) or p < 1: raise ValueError('p must be a positive integer') self.p = p <|end_body_0|> <|body_start_1|> del loss penalty = 0 for group in s...
Applies Lp regularization to a loss function.
LpRegularizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LpRegularizer: """Applies Lp regularization to a loss function.""" def __init__(self, optimizer: optim.Optimizer, initial_lambda: float, lambda_updater: Optional[updaters.LambdaUpdater], logger: imit_logger.HierarchicalLogger, p: int, val_split: Optional[float]=None) -> None: """Init...
stack_v2_sparse_classes_36k_train_034745
11,139
permissive
[ { "docstring": "Initialize the regularizer.", "name": "__init__", "signature": "def __init__(self, optimizer: optim.Optimizer, initial_lambda: float, lambda_updater: Optional[updaters.LambdaUpdater], logger: imit_logger.HierarchicalLogger, p: int, val_split: Optional[float]=None) -> None" }, { "...
2
null
Implement the Python class `LpRegularizer` described below. Class description: Applies Lp regularization to a loss function. Method signatures and docstrings: - def __init__(self, optimizer: optim.Optimizer, initial_lambda: float, lambda_updater: Optional[updaters.LambdaUpdater], logger: imit_logger.HierarchicalLogge...
Implement the Python class `LpRegularizer` described below. Class description: Applies Lp regularization to a loss function. Method signatures and docstrings: - def __init__(self, optimizer: optim.Optimizer, initial_lambda: float, lambda_updater: Optional[updaters.LambdaUpdater], logger: imit_logger.HierarchicalLogge...
5b0b531bdf6fdfcaab93ff18f454aa1b54bb4355
<|skeleton|> class LpRegularizer: """Applies Lp regularization to a loss function.""" def __init__(self, optimizer: optim.Optimizer, initial_lambda: float, lambda_updater: Optional[updaters.LambdaUpdater], logger: imit_logger.HierarchicalLogger, p: int, val_split: Optional[float]=None) -> None: """Init...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LpRegularizer: """Applies Lp regularization to a loss function.""" def __init__(self, optimizer: optim.Optimizer, initial_lambda: float, lambda_updater: Optional[updaters.LambdaUpdater], logger: imit_logger.HierarchicalLogger, p: int, val_split: Optional[float]=None) -> None: """Initialize the re...
the_stack_v2_python_sparse
src/imitation/regularization/regularizers.py
HumanCompatibleAI/imitation
train
936
c75ea08d9c8e611a57b0da3eaa909c47d1db8450
[ "PointCloud.__init__(self)\nAPTMassSpec.__init__(self)\nself.pos = None\nself.identity = None\nself.rand_mass_label = None\nself._data_size = 0\nself._files = {'Data filename': None, 'RRNG filename': None}", "if data_fname.rsplit('.')[-1] == 'pos':\n self.pos = aptios.read_pos(data_fname)\nelif data_fname.rspl...
<|body_start_0|> PointCloud.__init__(self) APTMassSpec.__init__(self) self.pos = None self.identity = None self.rand_mass_label = None self._data_size = 0 self._files = {'Data filename': None, 'RRNG filename': None} <|end_body_0|> <|body_start_1|> if data...
A class that represent APT data. It inherits the PointCloud and APTMassSpec. More methods should be added to accomodate data analysis of APT point cloud in future.
APTPosData
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APTPosData: """A class that represent APT data. It inherits the PointCloud and APTMassSpec. More methods should be added to accomodate data analysis of APT point cloud in future.""" def __init__(self): """Initialize APTPosData class need APT pos data (format [[x0,y0,z0,Da0],...])""" ...
stack_v2_sparse_classes_36k_train_034746
5,559
permissive
[ { "docstring": "Initialize APTPosData class need APT pos data (format [[x0,y0,z0,Da0],...])", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Load pos file and associated range file.", "name": "load_data", "signature": "def load_data(self, data_fname, rrng_fname)...
4
stack_v2_sparse_classes_30k_train_001480
Implement the Python class `APTPosData` described below. Class description: A class that represent APT data. It inherits the PointCloud and APTMassSpec. More methods should be added to accomodate data analysis of APT point cloud in future. Method signatures and docstrings: - def __init__(self): Initialize APTPosData ...
Implement the Python class `APTPosData` described below. Class description: A class that represent APT data. It inherits the PointCloud and APTMassSpec. More methods should be added to accomodate data analysis of APT point cloud in future. Method signatures and docstrings: - def __init__(self): Initialize APTPosData ...
c3334d325c85ec8fc6741001d81865929c83beca
<|skeleton|> class APTPosData: """A class that represent APT data. It inherits the PointCloud and APTMassSpec. More methods should be added to accomodate data analysis of APT point cloud in future.""" def __init__(self): """Initialize APTPosData class need APT pos data (format [[x0,y0,z0,Da0],...])""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class APTPosData: """A class that represent APT data. It inherits the PointCloud and APTMassSpec. More methods should be added to accomodate data analysis of APT point cloud in future.""" def __init__(self): """Initialize APTPosData class need APT pos data (format [[x0,y0,z0,Da0],...])""" Point...
the_stack_v2_python_sparse
OPTICS-APT-GUI/APTPosData.py
pnnl/apt
train
2
f67c0577c557fb3dd5ddcc6e9dc71d18a92b13fc
[ "def rserialize(root, string):\n \"\"\" a recursive helper function for the serialize() function.\"\"\"\n if root is None:\n string += 'None,'\n else:\n string += str(root.val) + ','\n string = rserialize(root.left, string)\n string = rserialize(root.right, string)\n return s...
<|body_start_0|> def rserialize(root, string): """ a recursive helper function for the serialize() function.""" if root is None: string += 'None,' else: string += str(root.val) + ',' string = rserialize(root.left, string) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_034747
2,602
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserialize(se...
2
stack_v2_sparse_classes_30k_train_007542
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Tre...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Tre...
f831fd9603592ae5bee3679924f962a3ebce381c
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" def rserialize(root, string): """ a recursive helper function for the serialize() function.""" if root is None: string += 'None,' else: ...
the_stack_v2_python_sparse
topic13_tree/T297_Codec/interview.py
GongFuXiong/leetcode
train
0
f517f3483cd7241e67b53585992b73179c1c2fb9
[ "if self.task.children:\n current_task = self.task.children[0]\n print('current_task: ', current_task)\n stop_task = getattr(current_task, 'stop_task', None)\n if callable(stop_task):\n stop_task(current_task)\nself.task.clear_widgets()", "print('Game_Screen/start_task')\nself.remove_task()\nse...
<|body_start_0|> if self.task.children: current_task = self.task.children[0] print('current_task: ', current_task) stop_task = getattr(current_task, 'stop_task', None) if callable(stop_task): stop_task(current_task) self.task.clear_widgets(...
The screen that shows the current game widgets.
Game_Screen
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game_Screen: """The screen that shows the current game widgets.""" def remove_task(self): """Remove all task widgets from the Layout self.task.""" <|body_0|> def start_task(self, task_id: int): """Add task with id task_id. :param task_id: The identifier of the ta...
stack_v2_sparse_classes_36k_train_034748
17,786
permissive
[ { "docstring": "Remove all task widgets from the Layout self.task.", "name": "remove_task", "signature": "def remove_task(self)" }, { "docstring": "Add task with id task_id. :param task_id: The identifier of the task to initialize. :type task_id: int", "name": "start_task", "signature": ...
2
stack_v2_sparse_classes_30k_train_002928
Implement the Python class `Game_Screen` described below. Class description: The screen that shows the current game widgets. Method signatures and docstrings: - def remove_task(self): Remove all task widgets from the Layout self.task. - def start_task(self, task_id: int): Add task with id task_id. :param task_id: The...
Implement the Python class `Game_Screen` described below. Class description: The screen that shows the current game widgets. Method signatures and docstrings: - def remove_task(self): Remove all task widgets from the Layout self.task. - def start_task(self, task_id: int): Add task with id task_id. :param task_id: The...
8df61acf8074c80fc8aae950d779647287bff551
<|skeleton|> class Game_Screen: """The screen that shows the current game widgets.""" def remove_task(self): """Remove all task widgets from the Layout self.task.""" <|body_0|> def start_task(self, task_id: int): """Add task with id task_id. :param task_id: The identifier of the ta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Game_Screen: """The screen that shows the current game widgets.""" def remove_task(self): """Remove all task widgets from the Layout self.task.""" if self.task.children: current_task = self.task.children[0] print('current_task: ', current_task) stop_tas...
the_stack_v2_python_sparse
scripts/velvethat.py
gdies/Velvethat
train
0
8f67d59da3bc32ceb80cb28e394e6aca85cb7f3c
[ "args = [Ndisc.NDISC6_COMMAND_NAME, Ndisc.COUNT_OPTION, str(count), Ndisc.TIMEOUT_OPTION, str(int(timeout) * 1000)]\nif quiet is True:\n args.append(Ndisc.QUIET_OPTION)\nif firstReply is True:\n args.append(Ndisc.FIRST_REPLY_OPTION)\nargs.append(destination)\nargs.append(device)\nrc = Command.execute(logger, ...
<|body_start_0|> args = [Ndisc.NDISC6_COMMAND_NAME, Ndisc.COUNT_OPTION, str(count), Ndisc.TIMEOUT_OPTION, str(int(timeout) * 1000)] if quiet is True: args.append(Ndisc.QUIET_OPTION) if firstReply is True: args.append(Ndisc.FIRST_REPLY_OPTION) args.append(destinati...
Ndisc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ndisc: def sendNdiscRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True): """This function sends IPv6 neighbor discovery to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - dest...
stack_v2_sparse_classes_36k_train_034749
10,343
no_license
[ { "docstring": "This function sends IPv6 neighbor discovery to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - destination IP to ping count - send ICMPv6 Neighbor Discovery X times timeout - specify a timeout, in seconds, before ndisc exits quiet - q...
2
stack_v2_sparse_classes_30k_train_019678
Implement the Python class `Ndisc` described below. Class description: Implement the Ndisc class. Method signatures and docstrings: - def sendNdiscRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True): This function sends IPv6 neighbor discovery to a neighbour host Arg...
Implement the Python class `Ndisc` described below. Class description: Implement the Ndisc class. Method signatures and docstrings: - def sendNdiscRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True): This function sends IPv6 neighbor discovery to a neighbour host Arg...
81bcc74fe7c0ca036ec483f634d7be0bab19a6d0
<|skeleton|> class Ndisc: def sendNdiscRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True): """This function sends IPv6 neighbor discovery to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - dest...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ndisc: def sendNdiscRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True): """This function sends IPv6 neighbor discovery to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - destination IP to ...
the_stack_v2_python_sparse
oscar/a/sys/net/lnx/neighbour.py
afeset/miner2-tools
train
0
04196ffd985a957a79ac589bcef4b42d2e871035
[ "self._attr_name = f'{client_name} {sensor_type.name}'\nself.type = sensor_type.key\nself.api = api\nself.entity_description = sensor_type", "try:\n self.api.update()\nexcept requests.exceptions.ConnectionError:\n return\nif self.api.status is None:\n _LOGGER.debug('Update of %s requested, but no status ...
<|body_start_0|> self._attr_name = f'{client_name} {sensor_type.name}' self.type = sensor_type.key self.api = api self.entity_description = sensor_type <|end_body_0|> <|body_start_1|> try: self.api.update() except requests.exceptions.ConnectionError: ...
Representation of a pyLoad sensor.
PyLoadSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyLoadSensor: """Representation of a pyLoad sensor.""" def __init__(self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name) -> None: """Initialize a new pyLoad sensor.""" <|body_0|> def update(self) -> None: """Update state of sensor.""" ...
stack_v2_sparse_classes_36k_train_034750
5,310
permissive
[ { "docstring": "Initialize a new pyLoad sensor.", "name": "__init__", "signature": "def __init__(self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name) -> None" }, { "docstring": "Update state of sensor.", "name": "update", "signature": "def update(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_004402
Implement the Python class `PyLoadSensor` described below. Class description: Representation of a pyLoad sensor. Method signatures and docstrings: - def __init__(self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name) -> None: Initialize a new pyLoad sensor. - def update(self) -> None: Update state o...
Implement the Python class `PyLoadSensor` described below. Class description: Representation of a pyLoad sensor. Method signatures and docstrings: - def __init__(self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name) -> None: Initialize a new pyLoad sensor. - def update(self) -> None: Update state o...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PyLoadSensor: """Representation of a pyLoad sensor.""" def __init__(self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name) -> None: """Initialize a new pyLoad sensor.""" <|body_0|> def update(self) -> None: """Update state of sensor.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PyLoadSensor: """Representation of a pyLoad sensor.""" def __init__(self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name) -> None: """Initialize a new pyLoad sensor.""" self._attr_name = f'{client_name} {sensor_type.name}' self.type = sensor_type.key sel...
the_stack_v2_python_sparse
homeassistant/components/pyload/sensor.py
home-assistant/core
train
35,501
284d223fc8b651d190bd014dfcfafc922ef7c9b7
[ "hs = set()\nq = []\nq.append(root)\nwhile q:\n sz = len(q)\n for i in range(sz):\n cur = q.pop(0)\n if k - cur.val in hs:\n return True\n hs.add(cur.val)\n if cur.left:\n q.append(cur.left)\n if cur.right:\n q.append(cur.right)\nreturn False...
<|body_start_0|> hs = set() q = [] q.append(root) while q: sz = len(q) for i in range(sz): cur = q.pop(0) if k - cur.val in hs: return True hs.add(cur.val) if cur.left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool BFS+HashSet""" <|body_0|> def findTarget1(self, root, k): """:type root: TreeNode :type k: int :rtype: bool 先中序遍历,再双指针""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_034751
1,886
no_license
[ { "docstring": ":type root: TreeNode :type k: int :rtype: bool BFS+HashSet", "name": "findTarget", "signature": "def findTarget(self, root, k)" }, { "docstring": ":type root: TreeNode :type k: int :rtype: bool 先中序遍历,再双指针", "name": "findTarget1", "signature": "def findTarget1(self, root, ...
2
stack_v2_sparse_classes_30k_train_020900
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool BFS+HashSet - def findTarget1(self, root, k): :type root: TreeNode :type k: int :rtype: bool 先中序遍历,再...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool BFS+HashSet - def findTarget1(self, root, k): :type root: TreeNode :type k: int :rtype: bool 先中序遍历,再...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool BFS+HashSet""" <|body_0|> def findTarget1(self, root, k): """:type root: TreeNode :type k: int :rtype: bool 先中序遍历,再双指针""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool BFS+HashSet""" hs = set() q = [] q.append(root) while q: sz = len(q) for i in range(sz): cur = q.pop(0) if k - cur.val in h...
the_stack_v2_python_sparse
out/production/leetcode/653.两数之和-iv-输入-bst.py
yangyuxiang1996/leetcode
train
0
1771ed036f391c7282c3e12ab47daf6d6c1a3573
[ "belong = request.GET.get('belong', 'all')\norder_status = request.GET.get('order_status', '-1')\nmall_type = request.user_profile.webapp_type\nwoid = request.webapp_owner_id\nexport2data = {}\nif belong == 'audit':\n second_nav_name = export.ORDER_AUDIT\n has_order = util.is_has_order(request, True)\n pag...
<|body_start_0|> belong = request.GET.get('belong', 'all') order_status = request.GET.get('order_status', '-1') mall_type = request.user_profile.webapp_type woid = request.webapp_owner_id export2data = {} if belong == 'audit': second_nav_name = export.ORDER_AU...
订单列表资源
OrderList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderList: """订单列表资源""" def get(request): """显示订单列表""" <|body_0|> def api_get(request): """advanced table中订单列表""" <|body_1|> <|end_skeleton|> <|body_start_0|> belong = request.GET.get('belong', 'all') order_status = request.GET.get('orde...
stack_v2_sparse_classes_36k_train_034752
36,586
no_license
[ { "docstring": "显示订单列表", "name": "get", "signature": "def get(request)" }, { "docstring": "advanced table中订单列表", "name": "api_get", "signature": "def api_get(request)" } ]
2
null
Implement the Python class `OrderList` described below. Class description: 订单列表资源 Method signatures and docstrings: - def get(request): 显示订单列表 - def api_get(request): advanced table中订单列表
Implement the Python class `OrderList` described below. Class description: 订单列表资源 Method signatures and docstrings: - def get(request): 显示订单列表 - def api_get(request): advanced table中订单列表 <|skeleton|> class OrderList: """订单列表资源""" def get(request): """显示订单列表""" <|body_0|> def api_get(req...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class OrderList: """订单列表资源""" def get(request): """显示订单列表""" <|body_0|> def api_get(request): """advanced table中订单列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderList: """订单列表资源""" def get(request): """显示订单列表""" belong = request.GET.get('belong', 'all') order_status = request.GET.get('order_status', '-1') mall_type = request.user_profile.webapp_type woid = request.webapp_owner_id export2data = {} if bel...
the_stack_v2_python_sparse
weapp/mall/order/order.py
chengdg/weizoom
train
1
eb741835f9be1c52d54f8f1a0abe90e43b480d39
[ "tf.enable_eager_execution()\nif not isinstance(style_image, np.ndarray) or len(style_image.shape) != 3 or style_image.shape[2] != 3:\n raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)')\nif not isinstance(content_image, np.ndarray) or len(content_image.shape) != 3 or content_image.shape...
<|body_start_0|> tf.enable_eager_execution() if not isinstance(style_image, np.ndarray) or len(style_image.shape) != 3 or style_image.shape[2] != 3: raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)') if not isinstance(content_image, np.ndarray) or len(content...
A class including model designed to do style transfer between two images
NST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NST: """A class including model designed to do style transfer between two images""" def __init__(self, style_image, content_image, alpha=10000.0, beta=1): """Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: lear...
stack_v2_sparse_classes_36k_train_034753
2,225
no_license
[ { "docstring": "Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: learning rate for content @beta: learning rate for style", "name": "__init__", "signature": "def __init__(self, style_image, content_image, alpha=10000.0, beta=1)" ...
2
null
Implement the Python class `NST` described below. Class description: A class including model designed to do style transfer between two images Method signatures and docstrings: - def __init__(self, style_image, content_image, alpha=10000.0, beta=1): Initialize the class. @style_image: image for style to mimic @content...
Implement the Python class `NST` described below. Class description: A class including model designed to do style transfer between two images Method signatures and docstrings: - def __init__(self, style_image, content_image, alpha=10000.0, beta=1): Initialize the class. @style_image: image for style to mimic @content...
56356c56297d8391bad8a1607eb226489766bc63
<|skeleton|> class NST: """A class including model designed to do style transfer between two images""" def __init__(self, style_image, content_image, alpha=10000.0, beta=1): """Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: lear...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NST: """A class including model designed to do style transfer between two images""" def __init__(self, style_image, content_image, alpha=10000.0, beta=1): """Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: learning rate for...
the_stack_v2_python_sparse
supervised_learning/0x0C-neural_style_transfer/0-neural_style.py
sidneyriffic/holbertonschool-machine_learning
train
1
f0576a541c8b0f7223af88b7c2a251597800cec0
[ "signed_up = self.calc_signup(events)\nconsented, cohort = self.calc_consent(events)\nehr_consented = self.calc_ehr_consent(events)\ngror_received = self.calc_gror_received(events)\nbiobank_samples = self.calc_biobank_samples(events)\nphysical_measurements = self.calc_physical_measurements(events)\nthebasics_module...
<|body_start_0|> signed_up = self.calc_signup(events) consented, cohort = self.calc_consent(events) ehr_consented = self.calc_ehr_consent(events) gror_received = self.calc_gror_received(events) biobank_samples = self.calc_biobank_samples(events) physical_measurements = se...
Calculate participant enrollment status. Changes: * Implement Participant PM&B Eligible status * Never downgrade participant status * (v3.1 Feature) : If participant has "Ever" consented to EHR sharing, participant EHR sharing stays "Yes" even if there is a negative EHR consent later.
EnrollmentStatusCalculator_v3_0
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnrollmentStatusCalculator_v3_0: """Calculate participant enrollment status. Changes: * Implement Participant PM&B Eligible status * Never downgrade participant status * (v3.1 Feature) : If participant has "Ever" consented to EHR sharing, participant EHR sharing stays "Yes" even if there is a neg...
stack_v2_sparse_classes_36k_train_034754
6,672
permissive
[ { "docstring": "Use the events list to calculate the participant enrolment status and status timestamps. :param events: List of events to use in calculations", "name": "calculate_from_events", "signature": "def calculate_from_events(self, events)" }, { "docstring": "Save the status timestamp whe...
4
stack_v2_sparse_classes_30k_train_006397
Implement the Python class `EnrollmentStatusCalculator_v3_0` described below. Class description: Calculate participant enrollment status. Changes: * Implement Participant PM&B Eligible status * Never downgrade participant status * (v3.1 Feature) : If participant has "Ever" consented to EHR sharing, participant EHR sha...
Implement the Python class `EnrollmentStatusCalculator_v3_0` described below. Class description: Calculate participant enrollment status. Changes: * Implement Participant PM&B Eligible status * Never downgrade participant status * (v3.1 Feature) : If participant has "Ever" consented to EHR sharing, participant EHR sha...
461ae46aeda21d54de8a91aa5ef677676d5db541
<|skeleton|> class EnrollmentStatusCalculator_v3_0: """Calculate participant enrollment status. Changes: * Implement Participant PM&B Eligible status * Never downgrade participant status * (v3.1 Feature) : If participant has "Ever" consented to EHR sharing, participant EHR sharing stays "Yes" even if there is a neg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnrollmentStatusCalculator_v3_0: """Calculate participant enrollment status. Changes: * Implement Participant PM&B Eligible status * Never downgrade participant status * (v3.1 Feature) : If participant has "Ever" consented to EHR sharing, participant EHR sharing stays "Yes" even if there is a negative EHR con...
the_stack_v2_python_sparse
rdr_service/resource/calculators/participant_enrollment_status_v30.py
all-of-us/raw-data-repository
train
46
b58edda13912fa3f1944e8c2c3b1fb02f01b7afa
[ "cell_method = CellMethod('difference', coords=[coord_name], intervals='1 grid length')\ndiff_cube.add_cell_method(cell_method)\ndiff_cube.attributes['form_of_difference'] = 'forward_difference'\ndiff_cube.rename('difference_of_' + cube_name)", "points = cube.coord(coord_name).points\nmean_points = (points[1:] + ...
<|body_start_0|> cell_method = CellMethod('difference', coords=[coord_name], intervals='1 grid length') diff_cube.add_cell_method(cell_method) diff_cube.attributes['form_of_difference'] = 'forward_difference' diff_cube.rename('difference_of_' + cube_name) <|end_body_0|> <|body_start_1|>...
Calculate the difference between adjacent grid squares within a cube. The difference is calculated along the x and y axis individually.
DifferenceBetweenAdjacentGridSquares
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DifferenceBetweenAdjacentGridSquares: """Calculate the difference between adjacent grid squares within a cube. The difference is calculated along the x and y axis individually.""" def _update_metadata(diff_cube: Cube, coord_name: str, cube_name: str) -> None: """Rename cube, add attr...
stack_v2_sparse_classes_36k_train_034755
28,733
permissive
[ { "docstring": "Rename cube, add attribute and cell method to describe difference. Args: diff_cube coord_name cube_name", "name": "_update_metadata", "signature": "def _update_metadata(diff_cube: Cube, coord_name: str, cube_name: str) -> None" }, { "docstring": "Put the difference array into a c...
4
null
Implement the Python class `DifferenceBetweenAdjacentGridSquares` described below. Class description: Calculate the difference between adjacent grid squares within a cube. The difference is calculated along the x and y axis individually. Method signatures and docstrings: - def _update_metadata(diff_cube: Cube, coord_...
Implement the Python class `DifferenceBetweenAdjacentGridSquares` described below. Class description: Calculate the difference between adjacent grid squares within a cube. The difference is calculated along the x and y axis individually. Method signatures and docstrings: - def _update_metadata(diff_cube: Cube, coord_...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class DifferenceBetweenAdjacentGridSquares: """Calculate the difference between adjacent grid squares within a cube. The difference is calculated along the x and y axis individually.""" def _update_metadata(diff_cube: Cube, coord_name: str, cube_name: str) -> None: """Rename cube, add attr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DifferenceBetweenAdjacentGridSquares: """Calculate the difference between adjacent grid squares within a cube. The difference is calculated along the x and y axis individually.""" def _update_metadata(diff_cube: Cube, coord_name: str, cube_name: str) -> None: """Rename cube, add attribute and cel...
the_stack_v2_python_sparse
improver/utilities/spatial.py
metoppv/improver
train
101
3999c607a91b596888959cea48bf199fad229f02
[ "contents = super().proc_playlist(contents)\nsoup = BeautifulSoup(contents, self.html_parser)\ndata = soup.find('script', id='__NEXT_DATA__')\nreturn data.string", "log.debug(f'Parsing json for {playlist.rel_path}')\nwith open(playlist.file) as f:\n pl_info = json.load(f)\nif 'props' in pl_info:\n pl_info =...
<|body_start_0|> contents = super().proc_playlist(contents) soup = BeautifulSoup(contents, self.html_parser) data = soup.find('script', id='__NEXT_DATA__') return data.string <|end_body_0|> <|body_start_1|> log.debug(f'Parsing json for {playlist.rel_path}') with open(pla...
ParserC24C
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParserC24C: def proc_playlist(self, contents: str) -> str: """Process raw playlist contents downloaded from URL before saving to file. For the C24C/MPR3 implementation, we extract the json data from the html input.""" <|body_0|> def iter_program_plays(self, playlist: Playlis...
stack_v2_sparse_classes_36k_train_034756
6,114
permissive
[ { "docstring": "Process raw playlist contents downloaded from URL before saving to file. For the C24C/MPR3 implementation, we extract the json data from the html input.", "name": "proc_playlist", "signature": "def proc_playlist(self, contents: str) -> str" }, { "docstring": "This is the implemen...
5
stack_v2_sparse_classes_30k_val_001137
Implement the Python class `ParserC24C` described below. Class description: Implement the ParserC24C class. Method signatures and docstrings: - def proc_playlist(self, contents: str) -> str: Process raw playlist contents downloaded from URL before saving to file. For the C24C/MPR3 implementation, we extract the json ...
Implement the Python class `ParserC24C` described below. Class description: Implement the ParserC24C class. Method signatures and docstrings: - def proc_playlist(self, contents: str) -> str: Process raw playlist contents downloaded from URL before saving to file. For the C24C/MPR3 implementation, we extract the json ...
4f6eea197ce966c2118d534f5dce74109fe53244
<|skeleton|> class ParserC24C: def proc_playlist(self, contents: str) -> str: """Process raw playlist contents downloaded from URL before saving to file. For the C24C/MPR3 implementation, we extract the json data from the html input.""" <|body_0|> def iter_program_plays(self, playlist: Playlis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParserC24C: def proc_playlist(self, contents: str) -> str: """Process raw playlist contents downloaded from URL before saving to file. For the C24C/MPR3 implementation, we extract the json data from the html input.""" contents = super().proc_playlist(contents) soup = BeautifulSoup(cont...
the_stack_v2_python_sparse
cm/parser/c24c.py
crashka/cm
train
0
bed19f27d6f253501d358fdb00bec88092c7f937
[ "self.parent = None\nself.value = value\nself.left = left\nself.right = right\nif left:\n self.left.parent = self\nif right:\n self.right.parent = self", "if not self:\n return None\nlistNodes = [self]\nif self.left:\n listNodes = self.left.inorderList() + listNodes\nif self.right:\n listNodes = li...
<|body_start_0|> self.parent = None self.value = value self.left = left self.right = right if left: self.left.parent = self if right: self.right.parent = self <|end_body_0|> <|body_start_1|> if not self: return None lis...
Node class for a binary tree.
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: """Node class for a binary tree.""" def __init__(self, value, left=None, right=None): """Initialize the node.""" <|body_0|> def inorderList(self): """Return an ordered list of nodes.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.par...
stack_v2_sparse_classes_36k_train_034757
1,605
no_license
[ { "docstring": "Initialize the node.", "name": "__init__", "signature": "def __init__(self, value, left=None, right=None)" }, { "docstring": "Return an ordered list of nodes.", "name": "inorderList", "signature": "def inorderList(self)" } ]
2
null
Implement the Python class `Node` described below. Class description: Node class for a binary tree. Method signatures and docstrings: - def __init__(self, value, left=None, right=None): Initialize the node. - def inorderList(self): Return an ordered list of nodes.
Implement the Python class `Node` described below. Class description: Node class for a binary tree. Method signatures and docstrings: - def __init__(self, value, left=None, right=None): Initialize the node. - def inorderList(self): Return an ordered list of nodes. <|skeleton|> class Node: """Node class for a bin...
97eae3ee806756f4d646d600f434b1e68164ad34
<|skeleton|> class Node: """Node class for a binary tree.""" def __init__(self, value, left=None, right=None): """Initialize the node.""" <|body_0|> def inorderList(self): """Return an ordered list of nodes.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Node: """Node class for a binary tree.""" def __init__(self, value, left=None, right=None): """Initialize the node.""" self.parent = None self.value = value self.left = left self.right = right if left: self.left.parent = self if right: ...
the_stack_v2_python_sparse
Python/2019_05_28_Problem_133_Inorder_Successor.py
BaoCaiH/Daily_Coding_Problem
train
0
22683dfc9fcdc10d726fb3818c8b0266c0c75ff7
[ "Runtime.__blockchain = None\nRuntime.__crypto = {}\nRuntime.__keystore = {}\nRuntime.__prover = None", "if Runtime.__blockchain is None:\n Runtime.__blockchain = _blockchain_classes[cfg.blockchain_backend]()\n from zkay.transaction.types import AddressValue\n AddressValue.get_balance = Runtime.__blockch...
<|body_start_0|> Runtime.__blockchain = None Runtime.__crypto = {} Runtime.__keystore = {} Runtime.__prover = None <|end_body_0|> <|body_start_1|> if Runtime.__blockchain is None: Runtime.__blockchain = _blockchain_classes[cfg.blockchain_backend]() from z...
Provides global access to singleton runtime API backend instances. See interface.py for more information. The global configuration in config.py determines which backends are made available via the Runtime class.
Runtime
[ "LicenseRef-scancode-unknown-license-reference", "LGPL-3.0-only", "MIT", "LGPL-2.0-or-later", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Runtime: """Provides global access to singleton runtime API backend instances. See interface.py for more information. The global configuration in config.py determines which backends are made available via the Runtime class.""" def reset(): """Reboot the runtime. When a new backend is...
stack_v2_sparse_classes_36k_train_034758
3,662
permissive
[ { "docstring": "Reboot the runtime. When a new backend is selected in the configuration, it will only be loaded after a runtime reset.", "name": "reset", "signature": "def reset()" }, { "docstring": "Return singleton object which implements ZkayBlockchainInterface.", "name": "blockchain", ...
5
null
Implement the Python class `Runtime` described below. Class description: Provides global access to singleton runtime API backend instances. See interface.py for more information. The global configuration in config.py determines which backends are made available via the Runtime class. Method signatures and docstrings:...
Implement the Python class `Runtime` described below. Class description: Provides global access to singleton runtime API backend instances. See interface.py for more information. The global configuration in config.py determines which backends are made available via the Runtime class. Method signatures and docstrings:...
920e883c095f456770c03606021c728b34497f42
<|skeleton|> class Runtime: """Provides global access to singleton runtime API backend instances. See interface.py for more information. The global configuration in config.py determines which backends are made available via the Runtime class.""" def reset(): """Reboot the runtime. When a new backend is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Runtime: """Provides global access to singleton runtime API backend instances. See interface.py for more information. The global configuration in config.py determines which backends are made available via the Runtime class.""" def reset(): """Reboot the runtime. When a new backend is selected in ...
the_stack_v2_python_sparse
zkay/transaction/runtime.py
eth-sri/zkay
train
75
4215c5a4c071d593a57161b0c0d4abb4a615ec80
[ "left, right, area = (0, len(height) - 1, 0)\nwhile left < right:\n area = max(area, min(height[left], height[right]) * (right - left))\n if height[left] < height[right]:\n left += 1\n else:\n right -= 1\nreturn area", "left, right, area = (0, len(height) - 1, 0)\nwhile left < right:\n m...
<|body_start_0|> left, right, area = (0, len(height) - 1, 0) while left < right: area = max(area, min(height[left], height[right]) * (right - left)) if height[left] < height[right]: left += 1 else: right -= 1 return area <|end_b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea1(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left, right, area = (0, len(height) - 1, 0) ...
stack_v2_sparse_classes_36k_train_034759
955
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea1", "signature": "def maxArea1(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_013557
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea1(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea1(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def maxArea(se...
b8ec1350e904665f1375c29a53f443ecf262d723
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea1(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" left, right, area = (0, len(height) - 1, 0) while left < right: area = max(area, min(height[left], height[right]) * (right - left)) if height[left] < height[right]: le...
the_stack_v2_python_sparse
leetcode/011盛最多水的容器.py
ShawDa/Coding
train
0
459495c71c8b774814ea3d6f06304987de24bdb8
[ "type_mappings = [(Text, 'string'), (bytes, 'data'), (bool, 'boolean'), (int, 'integer'), (dict, 'dict'), (float, 'float')]\nif value is None:\n self.none = 'None'\nelif isinstance(value, rdfvalue.RDFValue):\n self.rdf_value.data = value.SerializeToBytes()\n self.rdf_value.name = value.__class__.__name__\n...
<|body_start_0|> type_mappings = [(Text, 'string'), (bytes, 'data'), (bool, 'boolean'), (int, 'integer'), (dict, 'dict'), (float, 'float')] if value is None: self.none = 'None' elif isinstance(value, rdfvalue.RDFValue): self.rdf_value.data = value.SerializeToBytes() ...
Wrapper class for DataBlob protobuf.
DataBlob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBlob: """Wrapper class for DataBlob protobuf.""" def SetValue(self, value, raise_on_error=True): """Receives a value and fills it into a DataBlob. Args: value: value to set raise_on_error: if True, raise if we can't serialize. If False, set the key to an error string. Returns: se...
stack_v2_sparse_classes_36k_train_034760
15,855
permissive
[ { "docstring": "Receives a value and fills it into a DataBlob. Args: value: value to set raise_on_error: if True, raise if we can't serialize. If False, set the key to an error string. Returns: self Raises: TypeError: if the value can't be serialized and raise_on_error is True", "name": "SetValue", "sig...
2
null
Implement the Python class `DataBlob` described below. Class description: Wrapper class for DataBlob protobuf. Method signatures and docstrings: - def SetValue(self, value, raise_on_error=True): Receives a value and fills it into a DataBlob. Args: value: value to set raise_on_error: if True, raise if we can't seriali...
Implement the Python class `DataBlob` described below. Class description: Wrapper class for DataBlob protobuf. Method signatures and docstrings: - def SetValue(self, value, raise_on_error=True): Receives a value and fills it into a DataBlob. Args: value: value to set raise_on_error: if True, raise if we can't seriali...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class DataBlob: """Wrapper class for DataBlob protobuf.""" def SetValue(self, value, raise_on_error=True): """Receives a value and fills it into a DataBlob. Args: value: value to set raise_on_error: if True, raise if we can't serialize. If False, set the key to an error string. Returns: se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataBlob: """Wrapper class for DataBlob protobuf.""" def SetValue(self, value, raise_on_error=True): """Receives a value and fills it into a DataBlob. Args: value: value to set raise_on_error: if True, raise if we can't serialize. If False, set the key to an error string. Returns: self Raises: Ty...
the_stack_v2_python_sparse
grr/core/grr_response_core/lib/rdfvalues/protodict.py
google/grr
train
4,683
752baf5385fe36e92276b92fec051107d7cb65a8
[ "if root is None:\n return '[]'\nqueue = [root]\nres = []\nwhile len(queue) != 0:\n current = queue[0]\n if isinstance(current, TreeNode):\n res.append(current.val)\n else:\n res.append(current)\n queue.pop(0)\n if current != None:\n queue.append(current.left)\n queue.a...
<|body_start_0|> if root is None: return '[]' queue = [root] res = [] while len(queue) != 0: current = queue[0] if isinstance(current, TreeNode): res.append(current.val) else: res.append(current) ...
Encode and decode a binary tree.
BinTreeCodec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinTreeCodec: """Encode and decode a binary tree.""" def serialize(cls, root: 'TreeNode'): """Encodes a tree to a single string. Args: root: Root node of the binary tree Returns: A serialized string of the input tree.""" <|body_0|> def deserialize(cls, data: str): ...
stack_v2_sparse_classes_36k_train_034761
7,998
permissive
[ { "docstring": "Encodes a tree to a single string. Args: root: Root node of the binary tree Returns: A serialized string of the input tree.", "name": "serialize", "signature": "def serialize(cls, root: 'TreeNode')" }, { "docstring": "Decodes your encoded data to tree. Args: data: A serialized st...
2
stack_v2_sparse_classes_30k_val_000794
Implement the Python class `BinTreeCodec` described below. Class description: Encode and decode a binary tree. Method signatures and docstrings: - def serialize(cls, root: 'TreeNode'): Encodes a tree to a single string. Args: root: Root node of the binary tree Returns: A serialized string of the input tree. - def des...
Implement the Python class `BinTreeCodec` described below. Class description: Encode and decode a binary tree. Method signatures and docstrings: - def serialize(cls, root: 'TreeNode'): Encodes a tree to a single string. Args: root: Root node of the binary tree Returns: A serialized string of the input tree. - def des...
9adbe5fc2bce71f4c09ccf83079c44699c27fce4
<|skeleton|> class BinTreeCodec: """Encode and decode a binary tree.""" def serialize(cls, root: 'TreeNode'): """Encodes a tree to a single string. Args: root: Root node of the binary tree Returns: A serialized string of the input tree.""" <|body_0|> def deserialize(cls, data: str): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinTreeCodec: """Encode and decode a binary tree.""" def serialize(cls, root: 'TreeNode'): """Encodes a tree to a single string. Args: root: Root node of the binary tree Returns: A serialized string of the input tree.""" if root is None: return '[]' queue = [root] ...
the_stack_v2_python_sparse
data_structures/binary_tree.py
1lch2/PythonExercise
train
1
2a64914a782066498ca488e831698892cbece572
[ "super().__init__()\nlogging_levels = {val: val for val in LEVELS.values()}\nlogging_levels.update(LEVELS)\nself._ignore_exceptions = []\nfor exc_name, exc_level in ignore_exceptions:\n try:\n self._ignore_exceptions.append((logging_levels[exc_level], exc_name))\n except KeyError as err:\n raise...
<|body_start_0|> super().__init__() logging_levels = {val: val for val in LEVELS.values()} logging_levels.update(LEVELS) self._ignore_exceptions = [] for exc_name, exc_level in ignore_exceptions: try: self._ignore_exceptions.append((logging_levels[exc_...
Filter out the specified exceptions with specified logging level.
ExceptionFilter
[ "BSD-2-Clause", "BSD-3-Clause", "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExceptionFilter: """Filter out the specified exceptions with specified logging level.""" def __init__(self, ignore_exceptions): """Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will...
stack_v2_sparse_classes_36k_train_034762
1,804
permissive
[ { "docstring": "Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will filter out all exceptions with that name. ignore_exceptions: a tuple of tuples ((exception name, loglevel)) example: ((\"ReadTimeout\", \"WARN...
2
stack_v2_sparse_classes_30k_train_020440
Implement the Python class `ExceptionFilter` described below. Class description: Filter out the specified exceptions with specified logging level. Method signatures and docstrings: - def __init__(self, ignore_exceptions): Configure filtering out of the specified exceptions with specified logging level. Note if there ...
Implement the Python class `ExceptionFilter` described below. Class description: Filter out the specified exceptions with specified logging level. Method signatures and docstrings: - def __init__(self, ignore_exceptions): Configure filtering out of the specified exceptions with specified logging level. Note if there ...
232446d776fdb906d2fb253cf0a409c6813a08d6
<|skeleton|> class ExceptionFilter: """Filter out the specified exceptions with specified logging level.""" def __init__(self, ignore_exceptions): """Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExceptionFilter: """Filter out the specified exceptions with specified logging level.""" def __init__(self, ignore_exceptions): """Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will filter out a...
the_stack_v2_python_sparse
h/util/logging_filters.py
hypothesis/h
train
2,558
ece465c4868815509ae5749ddab7226c9444c522
[ "n = 0\nt = head\nwhile t:\n n += 1\n t = t.next\nmid = n // 2\nphead = head\nfor _ in range(mid):\n phead = phead.next\np = phead\nq = phead.next\nphead.next = None\nwhile q:\n r = q.next\n q.next = p\n p = q\n q = r\nfor _ in range(mid):\n if head.val != p.val:\n return False\n h...
<|body_start_0|> n = 0 t = head while t: n += 1 t = t.next mid = n // 2 phead = head for _ in range(mid): phead = phead.next p = phead q = phead.next phead.next = None while q: r = q.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, head): """时间复杂度:O(n) 空间复杂度:O(1) :param head: :return:""" <|body_0|> def isPalindrome_3(self, head): """利用辅助空间 :type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = 0 t = head ...
stack_v2_sparse_classes_36k_train_034763
1,798
no_license
[ { "docstring": "时间复杂度:O(n) 空间复杂度:O(1) :param head: :return:", "name": "isPalindrome", "signature": "def isPalindrome(self, head)" }, { "docstring": "利用辅助空间 :type head: ListNode :rtype: bool", "name": "isPalindrome_3", "signature": "def isPalindrome_3(self, head)" } ]
2
stack_v2_sparse_classes_30k_val_001139
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head): 时间复杂度:O(n) 空间复杂度:O(1) :param head: :return: - def isPalindrome_3(self, head): 利用辅助空间 :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head): 时间复杂度:O(n) 空间复杂度:O(1) :param head: :return: - def isPalindrome_3(self, head): 利用辅助空间 :type head: ListNode :rtype: bool <|skeleton|> class Solution:...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def isPalindrome(self, head): """时间复杂度:O(n) 空间复杂度:O(1) :param head: :return:""" <|body_0|> def isPalindrome_3(self, head): """利用辅助空间 :type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, head): """时间复杂度:O(n) 空间复杂度:O(1) :param head: :return:""" n = 0 t = head while t: n += 1 t = t.next mid = n // 2 phead = head for _ in range(mid): phead = phead.next p = phead ...
the_stack_v2_python_sparse
234_回文链表.py
lovehhf/LeetCode
train
0
099cb67cd295cd3c425fc8aaac0ce577b8b72c80
[ "downsample_raito = H // SparseHelper._cur_active.shape[-1]\nactive_ex = SparseHelper._cur_active.repeat_interleave(downsample_raito, 2).repeat_interleave(downsample_raito, 3)\nreturn active_ex if returning_active_map else active_ex.squeeze(1).nonzero(as_tuple=True)", "x = super(type(self), self).forward(x)\nx *=...
<|body_start_0|> downsample_raito = H // SparseHelper._cur_active.shape[-1] active_ex = SparseHelper._cur_active.repeat_interleave(downsample_raito, 2).repeat_interleave(downsample_raito, 3) return active_ex if returning_active_map else active_ex.squeeze(1).nonzero(as_tuple=True) <|end_body_0|> ...
The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.
SparseHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseHelper: """The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.""" def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: """Get current active map with (B, 1, f, f) shape or index format.""" ...
stack_v2_sparse_classes_36k_train_034764
5,428
permissive
[ { "docstring": "Get current active map with (B, 1, f, f) shape or index format.", "name": "_get_active_map_or_index", "signature": "def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor" }, { "docstring": "Sparse convolution forward function.", "name": "sp_con...
3
stack_v2_sparse_classes_30k_train_009284
Implement the Python class `SparseHelper` described below. Class description: The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc. Method signatures and docstrings: - def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: Get current...
Implement the Python class `SparseHelper` described below. Class description: The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc. Method signatures and docstrings: - def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: Get current...
d2ccc44a2c8e5d49bb26187aff42f2abc90aee28
<|skeleton|> class SparseHelper: """The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.""" def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: """Get current active map with (B, 1, f, f) shape or index format.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseHelper: """The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.""" def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: """Get current active map with (B, 1, f, f) shape or index format.""" downsa...
the_stack_v2_python_sparse
mmpretrain/models/utils/sparse_modules.py
open-mmlab/mmpretrain
train
652
4ceb25d102a01d160b316ff965f95e2cbca8c3f5
[ "self.rate = self.DEFAULT_RATE\nif 'rate' in queue_info:\n self.rate = queue_info['rate']\nself.task_age_limit = self.DEFAULT_AGE_LIMIT\nself.min_backoff_seconds = self.DEFAULT_MIN_BACKOFF\nself.max_backoff_seconds = self.DEFAULT_MAX_BACKOFF\nself.max_doublings = self.DEFAULT_MAX_DOUBLINGS\nif 'retry_parameters'...
<|body_start_0|> self.rate = self.DEFAULT_RATE if 'rate' in queue_info: self.rate = queue_info['rate'] self.task_age_limit = self.DEFAULT_AGE_LIMIT self.min_backoff_seconds = self.DEFAULT_MIN_BACKOFF self.max_backoff_seconds = self.DEFAULT_MAX_BACKOFF self.max...
PushQueue
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushQueue: def __init__(self, queue_info, app): """Create a PushQueue object. Args: queue_info: A dictionary containing queue info. app: A string containing the application ID.""" <|body_0|> def __repr__(self): """Generates a string representation of the queue. Retur...
stack_v2_sparse_classes_36k_train_034765
29,716
permissive
[ { "docstring": "Create a PushQueue object. Args: queue_info: A dictionary containing queue info. app: A string containing the application ID.", "name": "__init__", "signature": "def __init__(self, queue_info, app)" }, { "docstring": "Generates a string representation of the queue. Returns: A str...
2
stack_v2_sparse_classes_30k_train_007606
Implement the Python class `PushQueue` described below. Class description: Implement the PushQueue class. Method signatures and docstrings: - def __init__(self, queue_info, app): Create a PushQueue object. Args: queue_info: A dictionary containing queue info. app: A string containing the application ID. - def __repr_...
Implement the Python class `PushQueue` described below. Class description: Implement the PushQueue class. Method signatures and docstrings: - def __init__(self, queue_info, app): Create a PushQueue object. Args: queue_info: A dictionary containing queue info. app: A string containing the application ID. - def __repr_...
c24ddfd987c8eed8ed8864cc839cc0556a8af3c7
<|skeleton|> class PushQueue: def __init__(self, queue_info, app): """Create a PushQueue object. Args: queue_info: A dictionary containing queue info. app: A string containing the application ID.""" <|body_0|> def __repr__(self): """Generates a string representation of the queue. Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PushQueue: def __init__(self, queue_info, app): """Create a PushQueue object. Args: queue_info: A dictionary containing queue info. app: A string containing the application ID.""" self.rate = self.DEFAULT_RATE if 'rate' in queue_info: self.rate = queue_info['rate'] ...
the_stack_v2_python_sparse
AppTaskQueue/appscale/taskqueue/queue.py
christianbaun/appscale
train
2
03a8dd03eacea4683ee3b2d017aaf8a5e64eab21
[ "security = getSecurityManager()\nwant_referer = REQUEST['URL1'] + '/manage_owner'\ngot_referer = '%s://%s%s' % parse.urlparse(REQUEST['HTTP_REFERER'])[:3]\n__traceback_info__ = (want_referer, got_referer)\nif want_referer != got_referer or security.calledByExecutable():\n raise Unauthorized('manage_takeOwnershi...
<|body_start_0|> security = getSecurityManager() want_referer = REQUEST['URL1'] + '/manage_owner' got_referer = '%s://%s%s' % parse.urlparse(REQUEST['HTTP_REFERER'])[:3] __traceback_info__ = (want_referer, got_referer) if want_referer != got_referer or security.calledByExecutable...
Owned
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Owned: def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): """Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.""" <|body_0|> def manage_changeOwnershipType(self, explicit=1, RESPONSE=None, REQUEST...
stack_v2_sparse_classes_36k_train_034766
3,508
permissive
[ { "docstring": "Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.", "name": "manage_takeOwnership", "signature": "def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0)" }, { "docstring": "Change the type (implicit or expl...
2
stack_v2_sparse_classes_30k_train_005626
Implement the Python class `Owned` described below. Class description: Implement the Owned class. Method signatures and docstrings: - def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects. - de...
Implement the Python class `Owned` described below. Class description: Implement the Owned class. Method signatures and docstrings: - def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects. - de...
c31b1c635e85a1766f2666cb0bd117337ae5fa67
<|skeleton|> class Owned: def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): """Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.""" <|body_0|> def manage_changeOwnershipType(self, explicit=1, RESPONSE=None, REQUEST...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Owned: def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): """Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.""" security = getSecurityManager() want_referer = REQUEST['URL1'] + '/manage_owner' got_...
the_stack_v2_python_sparse
src/OFS/owner.py
zopefoundation/Zope
train
335
08d94b72f5650e0e37321b6c4536d2359d4840f8
[ "h, v = SpatialSvdModuleSplitter.get_svd_matrices(layer, rank)\nconv_a_stride, conv_b_stride = get_strides_for_split_conv_ops(op=layer.module)\nwith layer.model.graph.as_default():\n last_slash_index = layer.module.name.rfind('/')\n data_format = layer.module.get_attr('data_format').decode('utf-8')\n if da...
<|body_start_0|> h, v = SpatialSvdModuleSplitter.get_svd_matrices(layer, rank) conv_a_stride, conv_b_stride = get_strides_for_split_conv_ops(op=layer.module) with layer.model.graph.as_default(): last_slash_index = layer.module.name.rfind('/') data_format = layer.module.ge...
Spatial SVD module splitter
SpatialSvdModuleSplitter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialSvdModuleSplitter: """Spatial SVD module splitter""" def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): """:param layer: Module to be split :param rank: rank for splitting :return: Two split modules""" <|body_0|> def get_svd_matrices(layer:...
stack_v2_sparse_classes_36k_train_034767
6,069
permissive
[ { "docstring": ":param layer: Module to be split :param rank: rank for splitting :return: Two split modules", "name": "split_module", "signature": "def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation)" }, { "docstring": ":param layer: Module to be split :param rank: rank for...
2
null
Implement the Python class `SpatialSvdModuleSplitter` described below. Class description: Spatial SVD module splitter Method signatures and docstrings: - def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): :param layer: Module to be split :param rank: rank for splitting :return: Two split modul...
Implement the Python class `SpatialSvdModuleSplitter` described below. Class description: Spatial SVD module splitter Method signatures and docstrings: - def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): :param layer: Module to be split :param rank: rank for splitting :return: Two split modul...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class SpatialSvdModuleSplitter: """Spatial SVD module splitter""" def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): """:param layer: Module to be split :param rank: rank for splitting :return: Two split modules""" <|body_0|> def get_svd_matrices(layer:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpatialSvdModuleSplitter: """Spatial SVD module splitter""" def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): """:param layer: Module to be split :param rank: rank for splitting :return: Two split modules""" h, v = SpatialSvdModuleSplitter.get_svd_matrices(layer, ...
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/svd_spiltter.py
quic/aimet
train
1,676
feca7da6c9d767b56d4471369542a0eab199548c
[ "BackPropagation.__init__(self, neural_network, learning_rate, max_error, max_iterations)\nself.momentum = momentum\nself.previous_weight_values = {}\n':type : dict[synapyse.base.connection.Connection, float]'", "for connection in neuron.input_connections.values():\n connection_input = connection.origin.output...
<|body_start_0|> BackPropagation.__init__(self, neural_network, learning_rate, max_error, max_iterations) self.momentum = momentum self.previous_weight_values = {} ':type : dict[synapyse.base.connection.Connection, float]' <|end_body_0|> <|body_start_1|> for connection in neuron...
MomentumBackPropagation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MomentumBackPropagation: def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): """:type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int""" ...
stack_v2_sparse_classes_36k_train_034768
1,483
permissive
[ { "docstring": ":type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int", "name": "__init__", "signature": "def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=Non...
2
stack_v2_sparse_classes_30k_train_019361
Implement the Python class `MomentumBackPropagation` described below. Class description: Implement the MomentumBackPropagation class. Method signatures and docstrings: - def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): :type neural_network: synapyse.base.neural_network.Neur...
Implement the Python class `MomentumBackPropagation` described below. Class description: Implement the MomentumBackPropagation class. Method signatures and docstrings: - def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): :type neural_network: synapyse.base.neural_network.Neur...
8c9ff53ede2d83af27ce771ce1b6ea6a32155b02
<|skeleton|> class MomentumBackPropagation: def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): """:type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MomentumBackPropagation: def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): """:type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int""" BackPro...
the_stack_v2_python_sparse
synapyse/impl/learning/momentum_back_propagation.py
dougefr/synapyse
train
4
9fe18658a43d2b99dd84819b1e9aa2b603f41a22
[ "super(CollaQMultiHeadAttention, self).__init__()\nself.act = nn.ReLU()\nself.n_head = n_head\nself.d_k = d_k\nself.d_v = d_v\nself.w_qs = nn.Linear(d_model_q, n_head * d_k)\nself.w_ks = nn.Linear(d_model_v, n_head * d_k)\nself.w_vs = nn.Linear(d_model_v, n_head * d_v)\nself.fc1 = fc_block(n_head * d_v, n_head * d_...
<|body_start_0|> super(CollaQMultiHeadAttention, self).__init__() self.act = nn.ReLU() self.n_head = n_head self.d_k = d_k self.d_v = d_v self.w_qs = nn.Linear(d_model_q, n_head * d_k) self.w_ks = nn.Linear(d_model_v, n_head * d_k) self.w_vs = nn.Linear(d_...
Overview: The head of collaq attention module. Interface: __init__, forward
CollaQMultiHeadAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollaQMultiHeadAttention: """Overview: The head of collaq attention module. Interface: __init__, forward""" def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0): """Overview: initialize the head of collaq attention module...
stack_v2_sparse_classes_36k_train_034769
27,383
permissive
[ { "docstring": "Overview: initialize the head of collaq attention module Arguments: - n_head (:obj:`int`): the num of head - d_model_q (:obj:`int`): the size of input q - d_model_v (:obj:`int`): the size of input v - d_k (:obj:`int`): the size of k, used by Scaled Dot Product Attention - d_v (:obj:`int`): the s...
2
stack_v2_sparse_classes_30k_train_006851
Implement the Python class `CollaQMultiHeadAttention` described below. Class description: Overview: The head of collaq attention module. Interface: __init__, forward Method signatures and docstrings: - def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0):...
Implement the Python class `CollaQMultiHeadAttention` described below. Class description: Overview: The head of collaq attention module. Interface: __init__, forward Method signatures and docstrings: - def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0):...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class CollaQMultiHeadAttention: """Overview: The head of collaq attention module. Interface: __init__, forward""" def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0): """Overview: initialize the head of collaq attention module...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollaQMultiHeadAttention: """Overview: The head of collaq attention module. Interface: __init__, forward""" def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0): """Overview: initialize the head of collaq attention module Arguments: -...
the_stack_v2_python_sparse
ding/model/template/qmix.py
shengxuesun/DI-engine
train
1
f0191ceb0448c8b6eacede545dd5863c69667797
[ "ret = []\n\ndef preorder(root):\n if root:\n ret.append(root.val)\n preorder(root.left)\n preorder(root.right)\npreorder(root)\nreturn ' '.join(map(str, ret))", "nums = collections.deque((int(n) for n in data.split()))\n\ndef build(mmin, mmax):\n if nums and mmin < nums[0] < mmax:\n ...
<|body_start_0|> ret = [] def preorder(root): if root: ret.append(root.val) preorder(root.left) preorder(root.right) preorder(root) return ' '.join(map(str, ret)) <|end_body_0|> <|body_start_1|> nums = collections.dequ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_034770
1,219
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:...
ef8c9422c481aa3c482933318c785ad28dd7703e
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" ret = [] def preorder(root): if root: ret.append(root.val) preorder(root.left) preorder(root.right) preorder(...
the_stack_v2_python_sparse
python/serialize_and_deserialize_BST.py
pzmrzy/LeetCode
train
2
453b128fad660bb8f062b0f67c54eef6f3480b65
[ "self.entity_domain = ENTITY_DOMAIN\nsuper().__init__(config_entry=config_entry, coordinator=coordinator, description=description)\nself._attr_entity_category = EntityCategory.DIAGNOSTIC", "if self.coordinator.data:\n if self.entity_description.state_value:\n if self.entity_description.key:\n ...
<|body_start_0|> self.entity_domain = ENTITY_DOMAIN super().__init__(config_entry=config_entry, coordinator=coordinator, description=description) self._attr_entity_category = EntityCategory.DIAGNOSTIC <|end_body_0|> <|body_start_1|> if self.coordinator.data: if self.entity_d...
Representation of an HDHomeRun sensor.
HDHomerunSensor
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HDHomerunSensor: """Representation of an HDHomeRun sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunSensorEntityDescription) -> None: """Initialise.""" <|body_0|> def native_value(self) -> StateType | date...
stack_v2_sparse_classes_36k_train_034771
13,715
permissive
[ { "docstring": "Initialise.", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunSensorEntityDescription) -> None" }, { "docstring": "Get the value of the sensor.", "name": "native_value", "signature":...
2
stack_v2_sparse_classes_30k_train_001609
Implement the Python class `HDHomerunSensor` described below. Class description: Representation of an HDHomeRun sensor. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunSensorEntityDescription) -> None: Initialise. - def native...
Implement the Python class `HDHomerunSensor` described below. Class description: Representation of an HDHomeRun sensor. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunSensorEntityDescription) -> None: Initialise. - def native...
8548d9999ddd54f13d6a307e013abcb8c897a74e
<|skeleton|> class HDHomerunSensor: """Representation of an HDHomeRun sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunSensorEntityDescription) -> None: """Initialise.""" <|body_0|> def native_value(self) -> StateType | date...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HDHomerunSensor: """Representation of an HDHomeRun sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunSensorEntityDescription) -> None: """Initialise.""" self.entity_domain = ENTITY_DOMAIN super().__init__(config_entr...
the_stack_v2_python_sparse
custom_components/hdhomerun/sensor.py
bacco007/HomeAssistantConfig
train
98
a5b597f4d7d110a78276f1430b3837a0e929fe0a
[ "np.random.seed(0)\nself.target_func = f\nself.noise = noise\nself.x_train = np.random.random(size=(train_num, 1)) - 0.5\nself.y_train = f(self.x_train) + np.random.normal(0.0, noise, size=self.x_train.shape)\nself.x_test = np.linspace(-0.7, 0.7, 10000).reshape(-1, 1)\nself.x_plot = np.linspace(-0.7, 0.7, 10000).re...
<|body_start_0|> np.random.seed(0) self.target_func = f self.noise = noise self.x_train = np.random.random(size=(train_num, 1)) - 0.5 self.y_train = f(self.x_train) + np.random.normal(0.0, noise, size=self.x_train.shape) self.x_test = np.linspace(-0.7, 0.7, 10000).reshape...
Collision_Problem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collision_Problem: def __init__(self, f, train_num=100, noise=0): """Init (1)training and testing data (2) form the network""" <|body_0|> def model(self, latent_dim: int=1): """Keras style layers + optimizers""" <|body_1|> def find_collision(self, iter_n...
stack_v2_sparse_classes_36k_train_034772
7,756
no_license
[ { "docstring": "Init (1)training and testing data (2) form the network", "name": "__init__", "signature": "def __init__(self, f, train_num=100, noise=0)" }, { "docstring": "Keras style layers + optimizers", "name": "model", "signature": "def model(self, latent_dim: int=1)" }, { "...
4
stack_v2_sparse_classes_30k_val_000918
Implement the Python class `Collision_Problem` described below. Class description: Implement the Collision_Problem class. Method signatures and docstrings: - def __init__(self, f, train_num=100, noise=0): Init (1)training and testing data (2) form the network - def model(self, latent_dim: int=1): Keras style layers +...
Implement the Python class `Collision_Problem` described below. Class description: Implement the Collision_Problem class. Method signatures and docstrings: - def __init__(self, f, train_num=100, noise=0): Init (1)training and testing data (2) form the network - def model(self, latent_dim: int=1): Keras style layers +...
92b44d8b8ce775bd558cc1a10c54158932cadc3d
<|skeleton|> class Collision_Problem: def __init__(self, f, train_num=100, noise=0): """Init (1)training and testing data (2) form the network""" <|body_0|> def model(self, latent_dim: int=1): """Keras style layers + optimizers""" <|body_1|> def find_collision(self, iter_n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collision_Problem: def __init__(self, f, train_num=100, noise=0): """Init (1)training and testing data (2) form the network""" np.random.seed(0) self.target_func = f self.noise = noise self.x_train = np.random.random(size=(train_num, 1)) - 0.5 self.y_train = f(s...
the_stack_v2_python_sparse
latent_problem/collision_problem.py
SchroDeCat/Deep-Kernel-GP
train
0
bebc859117356a1d4787864d3752dac4a7acd98c
[ "init_a[1].login_form(success_a_data['username'], success_a_data['password'], success_a_data['code'])\nsleep(1)\nassert HomePage(init_a[0]).button_is_exist() is True", "init_a[1].login_form(datas['username'], datas['password'], datas['code'])\nsleep(1)\nassert init_a[1].login_fail_msg() == datas['check']", "ini...
<|body_start_0|> init_a[1].login_form(success_a_data['username'], success_a_data['password'], success_a_data['code']) sleep(1) assert HomePage(init_a[0]).button_is_exist() is True <|end_body_0|> <|body_start_1|> init_a[1].login_form(datas['username'], datas['password'], datas['code']) ...
TestALogin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestALogin: def test_login_a_success(self, init_a): """A端登录页面,登录成功操作""" <|body_0|> def test_login_a_fail(self, init_a, datas): """A端登录,登录失败弹框提示""" <|body_1|> def test_login_a_fail_code_None(self, init_a): """A端登录,验证码错误提示""" <|body_2|> <|...
stack_v2_sparse_classes_36k_train_034773
1,648
no_license
[ { "docstring": "A端登录页面,登录成功操作", "name": "test_login_a_success", "signature": "def test_login_a_success(self, init_a)" }, { "docstring": "A端登录,登录失败弹框提示", "name": "test_login_a_fail", "signature": "def test_login_a_fail(self, init_a, datas)" }, { "docstring": "A端登录,验证码错误提示", "n...
3
stack_v2_sparse_classes_30k_train_009879
Implement the Python class `TestALogin` described below. Class description: Implement the TestALogin class. Method signatures and docstrings: - def test_login_a_success(self, init_a): A端登录页面,登录成功操作 - def test_login_a_fail(self, init_a, datas): A端登录,登录失败弹框提示 - def test_login_a_fail_code_None(self, init_a): A端登录,验证码错误提...
Implement the Python class `TestALogin` described below. Class description: Implement the TestALogin class. Method signatures and docstrings: - def test_login_a_success(self, init_a): A端登录页面,登录成功操作 - def test_login_a_fail(self, init_a, datas): A端登录,登录失败弹框提示 - def test_login_a_fail_code_None(self, init_a): A端登录,验证码错误提...
69e48844077d389f6afc37e12adc24683cd5cc2c
<|skeleton|> class TestALogin: def test_login_a_success(self, init_a): """A端登录页面,登录成功操作""" <|body_0|> def test_login_a_fail(self, init_a, datas): """A端登录,登录失败弹框提示""" <|body_1|> def test_login_a_fail_code_None(self, init_a): """A端登录,验证码错误提示""" <|body_2|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestALogin: def test_login_a_success(self, init_a): """A端登录页面,登录成功操作""" init_a[1].login_form(success_a_data['username'], success_a_data['password'], success_a_data['code']) sleep(1) assert HomePage(init_a[0]).button_is_exist() is True def test_login_a_fail(self, init_a, da...
the_stack_v2_python_sparse
TestCases/TestModuleA/test_a_login.py
Sissixi/web_sissi
train
0
0a872aa55536b7bc95fa58ed875bff3696ded1a2
[ "if index == 0:\n return 0\nuglyNum = [1]\nidx2, idx3, idx5 = (0, 0, 0)\nfor i in range(index - 1):\n n2, n3, n5 = (uglyNum[idx2] * 2, uglyNum[idx3] * 3, uglyNum[idx5] * 5)\n Min = min(n2, n3, n5)\n uglyNum.append(Min)\n idx2 += Min == n2\n idx3 += Min == n3\n idx5 += Min == n5\nreturn uglyNum[...
<|body_start_0|> if index == 0: return 0 uglyNum = [1] idx2, idx3, idx5 = (0, 0, 0) for i in range(index - 1): n2, n3, n5 = (uglyNum[idx2] * 2, uglyNum[idx3] * 3, uglyNum[idx5] * 5) Min = min(n2, n3, n5) uglyNum.append(Min) idx2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def GetUglyNumber_Solution(self, index): """返回第index个丑数""" <|body_0|> def isUgly(self, num): """判断num是否是丑数""" <|body_1|> def nthSuperUglyNumber(self, index, primes): """超级丑数 Args: index: n primes: 列表 当某个数的因子只有primes中的元素时,作为超级丑数,求出第n个超级丑...
stack_v2_sparse_classes_36k_train_034774
1,820
no_license
[ { "docstring": "返回第index个丑数", "name": "GetUglyNumber_Solution", "signature": "def GetUglyNumber_Solution(self, index)" }, { "docstring": "判断num是否是丑数", "name": "isUgly", "signature": "def isUgly(self, num)" }, { "docstring": "超级丑数 Args: index: n primes: 列表 当某个数的因子只有primes中的元素时,作为超...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def GetUglyNumber_Solution(self, index): 返回第index个丑数 - def isUgly(self, num): 判断num是否是丑数 - def nthSuperUglyNumber(self, index, primes): 超级丑数 Args: index: n primes: 列表 当某个数的因子只有pr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def GetUglyNumber_Solution(self, index): 返回第index个丑数 - def isUgly(self, num): 判断num是否是丑数 - def nthSuperUglyNumber(self, index, primes): 超级丑数 Args: index: n primes: 列表 当某个数的因子只有pr...
154f53d0eeeceb2f07f330ae407d4590840fe5ca
<|skeleton|> class Solution: def GetUglyNumber_Solution(self, index): """返回第index个丑数""" <|body_0|> def isUgly(self, num): """判断num是否是丑数""" <|body_1|> def nthSuperUglyNumber(self, index, primes): """超级丑数 Args: index: n primes: 列表 当某个数的因子只有primes中的元素时,作为超级丑数,求出第n个超级丑...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def GetUglyNumber_Solution(self, index): """返回第index个丑数""" if index == 0: return 0 uglyNum = [1] idx2, idx3, idx5 = (0, 0, 0) for i in range(index - 1): n2, n3, n5 = (uglyNum[idx2] * 2, uglyNum[idx3] * 3, uglyNum[idx5] * 5) ...
the_stack_v2_python_sparse
剑指offer/GetUglyNumber.py
EchoLLLiu/OtherCodes
train
0
1aa0ea9f50226b08f2697189cdf4be989d93d9c6
[ "self.X = X\nself.K = K\nself.centrX = []\nself.C = []\nself.U = []\nself.Z = []\nself.centrX = self._centralized()\nself.C = self._cov()\nself.U = self._U()\nself.Z = self._Z()", "print('样本矩阵X:\\n', self.X)\ncentrX = []\nmean = np.array([np.mean(attr) for attr in self.X.T])\nprint('样本集的特征均值:\\n', mean)\ncentrX =...
<|body_start_0|> self.X = X self.K = K self.centrX = [] self.C = [] self.U = [] self.Z = [] self.centrX = self._centralized() self.C = self._cov() self.U = self._U() self.Z = self._Z() <|end_body_0|> <|body_start_1|> print('样本矩阵X:\...
CPCA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CPCA: def __init__(self, X, K): """:param X,训练样本矩阵X :param K,X的降维矩阵的阶数,即X要特征降维成k阶""" <|body_0|> def _centralized(self): """矩阵X的中心化""" <|body_1|> def _cov(self): """求样本矩阵X的协方差矩阵C""" <|body_2|> def _U(self): """求X的降维转换矩阵U, shap...
stack_v2_sparse_classes_36k_train_034775
4,771
no_license
[ { "docstring": ":param X,训练样本矩阵X :param K,X的降维矩阵的阶数,即X要特征降维成k阶", "name": "__init__", "signature": "def __init__(self, X, K)" }, { "docstring": "矩阵X的中心化", "name": "_centralized", "signature": "def _centralized(self)" }, { "docstring": "求样本矩阵X的协方差矩阵C", "name": "_cov", "sign...
5
null
Implement the Python class `CPCA` described below. Class description: Implement the CPCA class. Method signatures and docstrings: - def __init__(self, X, K): :param X,训练样本矩阵X :param K,X的降维矩阵的阶数,即X要特征降维成k阶 - def _centralized(self): 矩阵X的中心化 - def _cov(self): 求样本矩阵X的协方差矩阵C - def _U(self): 求X的降维转换矩阵U, shape=(n,k), n是X的特征...
Implement the Python class `CPCA` described below. Class description: Implement the CPCA class. Method signatures and docstrings: - def __init__(self, X, K): :param X,训练样本矩阵X :param K,X的降维矩阵的阶数,即X要特征降维成k阶 - def _centralized(self): 矩阵X的中心化 - def _cov(self): 求样本矩阵X的协方差矩阵C - def _U(self): 求X的降维转换矩阵U, shape=(n,k), n是X的特征...
f2a1b2f8b6b292815d92a294d49954616d3624d5
<|skeleton|> class CPCA: def __init__(self, X, K): """:param X,训练样本矩阵X :param K,X的降维矩阵的阶数,即X要特征降维成k阶""" <|body_0|> def _centralized(self): """矩阵X的中心化""" <|body_1|> def _cov(self): """求样本矩阵X的协方差矩阵C""" <|body_2|> def _U(self): """求X的降维转换矩阵U, shap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CPCA: def __init__(self, X, K): """:param X,训练样本矩阵X :param K,X的降维矩阵的阶数,即X要特征降维成k阶""" self.X = X self.K = K self.centrX = [] self.C = [] self.U = [] self.Z = [] self.centrX = self._centralized() self.C = self._cov() self.U = self._...
the_stack_v2_python_sparse
85+张桂锋+深圳/week03/hw03.py
Yang-chen205/badou-Turing
train
1
f785fece0d947e0e1faf736b0d503ae87d28fbf1
[ "super().__init__()\nself.transformer_dim = transformer_dim\nself.transformer = transformer\nself.num_multimask_outputs = num_multimask_outputs\nself.iou_token = paddle.nn.Embedding(1, transformer_dim)\nself.num_mask_tokens = num_multimask_outputs + 1\nself.mask_tokens = paddle.nn.Embedding(self.num_mask_tokens, tr...
<|body_start_0|> super().__init__() self.transformer_dim = transformer_dim self.transformer = transformer self.num_multimask_outputs = num_multimask_outputs self.iou_token = paddle.nn.Embedding(1, transformer_dim) self.num_mask_tokens = num_multimask_outputs + 1 s...
MaskDecoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskDecoder: def __init__(self, *, transformer_dim: int, transformer: paddle.nn.Layer, num_multimask_outputs: int=3, activation: Type[paddle.nn.Layer]=paddle.nn.GELU, iou_head_depth: int=3, iou_head_hidden_dim: int=256) -> None: """Predicts masks given an image and prompt embeddings, usi...
stack_v2_sparse_classes_36k_train_034776
7,772
permissive
[ { "docstring": "Predicts masks given an image and prompt embeddings, using a tranformer architecture. Arguments: transformer_dim (int): the channel dimension of the transformer transformer (nn.Module): the transformer used to predict masks num_multimask_outputs (int): the number of masks to predict when disambi...
3
null
Implement the Python class `MaskDecoder` described below. Class description: Implement the MaskDecoder class. Method signatures and docstrings: - def __init__(self, *, transformer_dim: int, transformer: paddle.nn.Layer, num_multimask_outputs: int=3, activation: Type[paddle.nn.Layer]=paddle.nn.GELU, iou_head_depth: in...
Implement the Python class `MaskDecoder` described below. Class description: Implement the MaskDecoder class. Method signatures and docstrings: - def __init__(self, *, transformer_dim: int, transformer: paddle.nn.Layer, num_multimask_outputs: int=3, activation: Type[paddle.nn.Layer]=paddle.nn.GELU, iou_head_depth: in...
2c8c35a8949fef74599f5ec557d340a14415f20d
<|skeleton|> class MaskDecoder: def __init__(self, *, transformer_dim: int, transformer: paddle.nn.Layer, num_multimask_outputs: int=3, activation: Type[paddle.nn.Layer]=paddle.nn.GELU, iou_head_depth: int=3, iou_head_hidden_dim: int=256) -> None: """Predicts masks given an image and prompt embeddings, usi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskDecoder: def __init__(self, *, transformer_dim: int, transformer: paddle.nn.Layer, num_multimask_outputs: int=3, activation: Type[paddle.nn.Layer]=paddle.nn.GELU, iou_head_depth: int=3, iou_head_hidden_dim: int=256) -> None: """Predicts masks given an image and prompt embeddings, using a tranforme...
the_stack_v2_python_sparse
contrib/SegmentAnything/segment_anything/modeling/mask_decoder.py
PaddlePaddle/PaddleSeg
train
8,531
66cdc2a2068e50d249bf6ee937436a358d9b9dd3
[ "n, s = (1, 0)\nfor v in nums:\n if s + v > x:\n n += 1\n s = 0\n s += v\nreturn n", "n = len(nums)\nif m == 1:\n return sum(nums)\nif m >= n:\n return max(nums)\nl, r = (max(nums), sum(nums))\nwhile l < r:\n x = l + (r - l) // 2\n if self._numSplits(nums, x) > m:\n l = x + ...
<|body_start_0|> n, s = (1, 0) for v in nums: if s + v > x: n += 1 s = 0 s += v return n <|end_body_0|> <|body_start_1|> n = len(nums) if m == 1: return sum(nums) if m >= n: return max(nums) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _numSplits(self, nums, x): """min num of splits needed if any split/subarray has sum <= x.""" <|body_0|> def splitArray(self, nums: List[int], m: int) -> int: """binary search + brute force, O(N*log(sum(nums)))""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_034777
2,870
no_license
[ { "docstring": "min num of splits needed if any split/subarray has sum <= x.", "name": "_numSplits", "signature": "def _numSplits(self, nums, x)" }, { "docstring": "binary search + brute force, O(N*log(sum(nums)))", "name": "splitArray", "signature": "def splitArray(self, nums: List[int]...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _numSplits(self, nums, x): min num of splits needed if any split/subarray has sum <= x. - def splitArray(self, nums: List[int], m: int) -> int: binary search + brute force, O...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _numSplits(self, nums, x): min num of splits needed if any split/subarray has sum <= x. - def splitArray(self, nums: List[int], m: int) -> int: binary search + brute force, O...
6043134736452a6f4704b62857d0aed2e9571164
<|skeleton|> class Solution: def _numSplits(self, nums, x): """min num of splits needed if any split/subarray has sum <= x.""" <|body_0|> def splitArray(self, nums: List[int], m: int) -> int: """binary search + brute force, O(N*log(sum(nums)))""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _numSplits(self, nums, x): """min num of splits needed if any split/subarray has sum <= x.""" n, s = (1, 0) for v in nums: if s + v > x: n += 1 s = 0 s += v return n def splitArray(self, nums: List[int],...
the_stack_v2_python_sparse
src/0400-0499/0410.split.array.minimax.sum.py
gyang274/leetcode
train
1
148cb3a6d2caf569427fe09e5974594e7dfdc026
[ "super().__init__(model_dir, *args, **kwargs)\nfrom modelscope.trainers.nlp.space.trainer.gen_trainer import MultiWOZTrainer\nself.model_dir = model_dir\nself.config = kwargs.pop('config', Config.from_file(os.path.join(self.model_dir, ModelFile.CONFIGURATION)))\nimport torch\nself.config.use_gpu = True if ('device'...
<|body_start_0|> super().__init__(model_dir, *args, **kwargs) from modelscope.trainers.nlp.space.trainer.gen_trainer import MultiWOZTrainer self.model_dir = model_dir self.config = kwargs.pop('config', Config.from_file(os.path.join(self.model_dir, ModelFile.CONFIGURATION))) impor...
SpaceForDialogModeling
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpaceForDialogModeling: def __init__(self, model_dir: str, *args, **kwargs): """initialize the test generation model from the `model_dir` path. Args: model_dir (`str`): The model path. text_field (`BPETextField`, *optional*, defaults to `MultiWOZBPETextField`): The text field. config (`C...
stack_v2_sparse_classes_36k_train_034778
4,353
permissive
[ { "docstring": "initialize the test generation model from the `model_dir` path. Args: model_dir (`str`): The model path. text_field (`BPETextField`, *optional*, defaults to `MultiWOZBPETextField`): The text field. config (`Config`, *optional*, defaults to config in model hub): The config.", "name": "__init_...
2
null
Implement the Python class `SpaceForDialogModeling` described below. Class description: Implement the SpaceForDialogModeling class. Method signatures and docstrings: - def __init__(self, model_dir: str, *args, **kwargs): initialize the test generation model from the `model_dir` path. Args: model_dir (`str`): The mode...
Implement the Python class `SpaceForDialogModeling` described below. Class description: Implement the SpaceForDialogModeling class. Method signatures and docstrings: - def __init__(self, model_dir: str, *args, **kwargs): initialize the test generation model from the `model_dir` path. Args: model_dir (`str`): The mode...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class SpaceForDialogModeling: def __init__(self, model_dir: str, *args, **kwargs): """initialize the test generation model from the `model_dir` path. Args: model_dir (`str`): The model path. text_field (`BPETextField`, *optional*, defaults to `MultiWOZBPETextField`): The text field. config (`C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpaceForDialogModeling: def __init__(self, model_dir: str, *args, **kwargs): """initialize the test generation model from the `model_dir` path. Args: model_dir (`str`): The model path. text_field (`BPETextField`, *optional*, defaults to `MultiWOZBPETextField`): The text field. config (`Config`, *optio...
the_stack_v2_python_sparse
ai/modelscope/modelscope/models/nlp/space/dialog_modeling.py
alldatacenter/alldata
train
774
2c56abeb2396749edb0ac6a156b985fc6cf2b939
[ "self.instance = get_object_or_404(Instance, slug=self.kwargs['slug'])\ncanvas = self.instance.images().filter(short_id=self.kwargs['short_id']).first()\nif canvas and Instance.allow_canvas_detail(canvas):\n return canvas\nelse:\n raise Http404", "context = super(CanvasDetail, self).get_context_data(*args, ...
<|body_start_0|> self.instance = get_object_or_404(Instance, slug=self.kwargs['slug']) canvas = self.instance.images().filter(short_id=self.kwargs['short_id']).first() if canvas and Instance.allow_canvas_detail(canvas): return canvas else: raise Http404 <|end_body...
CanvasDetail
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CanvasDetail: def get_object(self, queryset=None): """Limit canvas detail view to those with :class:`derrida.interventions.models.Intervention` objects associated.""" <|body_0|> def get_context_data(self, *args, **kwargs): """Set extra context for :class:`CanvasDetai...
stack_v2_sparse_classes_36k_train_034779
37,410
permissive
[ { "docstring": "Limit canvas detail view to those with :class:`derrida.interventions.models.Intervention` objects associated.", "name": "get_object", "signature": "def get_object(self, queryset=None)" }, { "docstring": "Set extra context for :class:`CanvasDetail` view.", "name": "get_context...
2
stack_v2_sparse_classes_30k_train_014485
Implement the Python class `CanvasDetail` described below. Class description: Implement the CanvasDetail class. Method signatures and docstrings: - def get_object(self, queryset=None): Limit canvas detail view to those with :class:`derrida.interventions.models.Intervention` objects associated. - def get_context_data(...
Implement the Python class `CanvasDetail` described below. Class description: Implement the CanvasDetail class. Method signatures and docstrings: - def get_object(self, queryset=None): Limit canvas detail view to those with :class:`derrida.interventions.models.Intervention` objects associated. - def get_context_data(...
6371bb1266d7751af59aeaa3426ef7ac02a1fe17
<|skeleton|> class CanvasDetail: def get_object(self, queryset=None): """Limit canvas detail view to those with :class:`derrida.interventions.models.Intervention` objects associated.""" <|body_0|> def get_context_data(self, *args, **kwargs): """Set extra context for :class:`CanvasDetai...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CanvasDetail: def get_object(self, queryset=None): """Limit canvas detail view to those with :class:`derrida.interventions.models.Intervention` objects associated.""" self.instance = get_object_or_404(Instance, slug=self.kwargs['slug']) canvas = self.instance.images().filter(short_id=s...
the_stack_v2_python_sparse
derrida/books/views.py
Princeton-CDH/derrida-django
train
13
8731b3c4215318cce9256581c3ef88a63b190c3d
[ "self.bo.swithwindows(By.LINK_TEXT, '新闻')\ntime.sleep(2)\nself.assertIn('news', self.driver.current_url)", "self.bo.swithwindows(By.LINK_TEXT, 'hao123')\ntime.sleep(2)\nself.assertIn('hao', self.driver.current_url)", "self.bo.swithwindows(By.LINK_TEXT, '地图')\ntime.sleep(2)\nself.assertIn('map', self.driver.curr...
<|body_start_0|> self.bo.swithwindows(By.LINK_TEXT, '新闻') time.sleep(2) self.assertIn('news', self.driver.current_url) <|end_body_0|> <|body_start_1|> self.bo.swithwindows(By.LINK_TEXT, 'hao123') time.sleep(2) self.assertIn('hao', self.driver.current_url) <|end_body_1|> ...
百度搜索测试用例
TestLink
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLink: """百度搜索测试用例""" def test_news(self): """测试点击新闻""" <|body_0|> def test_hao123(self): """测试点击hao123""" <|body_1|> def test_map(self): """测试点击map""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.bo.swithwindows(By....
stack_v2_sparse_classes_36k_train_034780
1,265
no_license
[ { "docstring": "测试点击新闻", "name": "test_news", "signature": "def test_news(self)" }, { "docstring": "测试点击hao123", "name": "test_hao123", "signature": "def test_hao123(self)" }, { "docstring": "测试点击map", "name": "test_map", "signature": "def test_map(self)" } ]
3
null
Implement the Python class `TestLink` described below. Class description: 百度搜索测试用例 Method signatures and docstrings: - def test_news(self): 测试点击新闻 - def test_hao123(self): 测试点击hao123 - def test_map(self): 测试点击map
Implement the Python class `TestLink` described below. Class description: 百度搜索测试用例 Method signatures and docstrings: - def test_news(self): 测试点击新闻 - def test_hao123(self): 测试点击hao123 - def test_map(self): 测试点击map <|skeleton|> class TestLink: """百度搜索测试用例""" def test_news(self): """测试点击新闻""" <...
7b790f675419224bfdbe1542eddc5a638982e68a
<|skeleton|> class TestLink: """百度搜索测试用例""" def test_news(self): """测试点击新闻""" <|body_0|> def test_hao123(self): """测试点击hao123""" <|body_1|> def test_map(self): """测试点击map""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestLink: """百度搜索测试用例""" def test_news(self): """测试点击新闻""" self.bo.swithwindows(By.LINK_TEXT, '新闻') time.sleep(2) self.assertIn('news', self.driver.current_url) def test_hao123(self): """测试点击hao123""" self.bo.swithwindows(By.LINK_TEXT, 'hao123') ...
the_stack_v2_python_sparse
P9/day_13_integration/iwebshop_selenium/testcase/baidulink.py
liousAlready/NewDream_learning
train
0
04606f18c9417473b81fcfa715768d9a1a709382
[ "self.zoneType = zoneType\nself.effects = effects\nself.filter = filter", "zone, cards = self.findPossibleCards(context)\nfor card in cards:\n event = CardsEvent([card], zone, context)\n coroutine = PerformEffects(self.effects, event.context)\n try:\n response = (yield coroutine.next())\n w...
<|body_start_0|> self.zoneType = zoneType self.effects = effects self.filter = filter <|end_body_0|> <|body_start_1|> zone, cards = self.findPossibleCards(context) for card in cards: event = CardsEvent([card], zone, context) coroutine = PerformEffects(sel...
Represents an effect that applies for each matching card
PerMatch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerMatch: """Represents an effect that applies for each matching card""" def __init__(self, zoneType, effects, filter=None): """Initialize the Effect with the condition to evaluate and effect to perform""" <|body_0|> def perform(self, context): """Perform the Gam...
stack_v2_sparse_classes_36k_train_034781
1,261
no_license
[ { "docstring": "Initialize the Effect with the condition to evaluate and effect to perform", "name": "__init__", "signature": "def __init__(self, zoneType, effects, filter=None)" }, { "docstring": "Perform the Game Effect", "name": "perform", "signature": "def perform(self, context)" }...
3
null
Implement the Python class `PerMatch` described below. Class description: Represents an effect that applies for each matching card Method signatures and docstrings: - def __init__(self, zoneType, effects, filter=None): Initialize the Effect with the condition to evaluate and effect to perform - def perform(self, cont...
Implement the Python class `PerMatch` described below. Class description: Represents an effect that applies for each matching card Method signatures and docstrings: - def __init__(self, zoneType, effects, filter=None): Initialize the Effect with the condition to evaluate and effect to perform - def perform(self, cont...
0b5a7573a3cf33430fe61e4ff8a8a7a0ae20b258
<|skeleton|> class PerMatch: """Represents an effect that applies for each matching card""" def __init__(self, zoneType, effects, filter=None): """Initialize the Effect with the condition to evaluate and effect to perform""" <|body_0|> def perform(self, context): """Perform the Gam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerMatch: """Represents an effect that applies for each matching card""" def __init__(self, zoneType, effects, filter=None): """Initialize the Effect with the condition to evaluate and effect to perform""" self.zoneType = zoneType self.effects = effects self.filter = filte...
the_stack_v2_python_sparse
src/Game/Effects/per_match.py
dfwarden/DeckBuilding
train
0
761d059bc51ee29c9b235411e3002479972c7202
[ "adm = ProjectAdministration()\nproposal = Grading.from_dict(api.payload)\nif proposal is not None:\n 'Wir verwenden Grading_id und Grade des Proposals für die Erzeugung eines Grading-Objektes.'\n grad = adm.create_grading(proposal.get_grade(), proposal.get_participation_id())\n return (grad, 200)\nelse:\n...
<|body_start_0|> adm = ProjectAdministration() proposal = Grading.from_dict(api.payload) if proposal is not None: 'Wir verwenden Grading_id und Grade des Proposals für die Erzeugung eines Grading-Objektes.' grad = adm.create_grading(proposal.get_grade(), proposal.get_part...
GradingOperations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradingOperations: def post(self): """Anlegen eines neuen Grading-Objekts""" <|body_0|> def put(self): """Update eines bestimmten Grading-Objekts.""" <|body_1|> <|end_skeleton|> <|body_start_0|> adm = ProjectAdministration() proposal = Gradi...
stack_v2_sparse_classes_36k_train_034782
44,493
no_license
[ { "docstring": "Anlegen eines neuen Grading-Objekts", "name": "post", "signature": "def post(self)" }, { "docstring": "Update eines bestimmten Grading-Objekts.", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_014549
Implement the Python class `GradingOperations` described below. Class description: Implement the GradingOperations class. Method signatures and docstrings: - def post(self): Anlegen eines neuen Grading-Objekts - def put(self): Update eines bestimmten Grading-Objekts.
Implement the Python class `GradingOperations` described below. Class description: Implement the GradingOperations class. Method signatures and docstrings: - def post(self): Anlegen eines neuen Grading-Objekts - def put(self): Update eines bestimmten Grading-Objekts. <|skeleton|> class GradingOperations: def po...
4b2826225525ae855e15e1174f5cf90466097021
<|skeleton|> class GradingOperations: def post(self): """Anlegen eines neuen Grading-Objekts""" <|body_0|> def put(self): """Update eines bestimmten Grading-Objekts.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradingOperations: def post(self): """Anlegen eines neuen Grading-Objekts""" adm = ProjectAdministration() proposal = Grading.from_dict(api.payload) if proposal is not None: 'Wir verwenden Grading_id und Grade des Proposals für die Erzeugung eines Grading-Objektes.'...
the_stack_v2_python_sparse
src/main.py
KieserChristian/SW_Praktikum_Gruppe1
train
0
db71aa7681101c0f116efccac5c7f4eae056c81a
[ "self.camera = picamera.PiCamera()\nself.camera.resolution = (x, y)\nreturn", "if filename is None:\n return\ntime.sleep(2)\nself.camera.capture(filename)" ]
<|body_start_0|> self.camera = picamera.PiCamera() self.camera.resolution = (x, y) return <|end_body_0|> <|body_start_1|> if filename is None: return time.sleep(2) self.camera.capture(filename) <|end_body_1|>
Class for dealing with the camera on a Raspberry Pi
RaspiCamera
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RaspiCamera: """Class for dealing with the camera on a Raspberry Pi""" def __init__(self, x=1920, y=1280): """Constructor to make camera instance""" <|body_0|> def simple_picture(self, filename=None): """Take an immediate picture and save to filename""" <...
stack_v2_sparse_classes_36k_train_034783
1,574
no_license
[ { "docstring": "Constructor to make camera instance", "name": "__init__", "signature": "def __init__(self, x=1920, y=1280)" }, { "docstring": "Take an immediate picture and save to filename", "name": "simple_picture", "signature": "def simple_picture(self, filename=None)" } ]
2
stack_v2_sparse_classes_30k_train_016956
Implement the Python class `RaspiCamera` described below. Class description: Class for dealing with the camera on a Raspberry Pi Method signatures and docstrings: - def __init__(self, x=1920, y=1280): Constructor to make camera instance - def simple_picture(self, filename=None): Take an immediate picture and save to ...
Implement the Python class `RaspiCamera` described below. Class description: Class for dealing with the camera on a Raspberry Pi Method signatures and docstrings: - def __init__(self, x=1920, y=1280): Constructor to make camera instance - def simple_picture(self, filename=None): Take an immediate picture and save to ...
7d4a27126f7f2a93f7216b9ea4eed15789599bf3
<|skeleton|> class RaspiCamera: """Class for dealing with the camera on a Raspberry Pi""" def __init__(self, x=1920, y=1280): """Constructor to make camera instance""" <|body_0|> def simple_picture(self, filename=None): """Take an immediate picture and save to filename""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RaspiCamera: """Class for dealing with the camera on a Raspberry Pi""" def __init__(self, x=1920, y=1280): """Constructor to make camera instance""" self.camera = picamera.PiCamera() self.camera.resolution = (x, y) return def simple_picture(self, filename=None): ...
the_stack_v2_python_sparse
python3/cherrypy/raspberry_pi_class/RaspiCamera.py
ptracton/experimental
train
4
31f99576fc8c04ccfb1dcadc31b9077bc65457e5
[ "if not self.slug:\n self.slug = self.get_slug()\nsuper().clean()", "absolute_url = ''\nif self.slug:\n absolute_url = reverse(f'{self.get_meta().app_label}:detail_slug', args=[str(self.slug)])\nelse:\n absolute_url = reverse(f'{self.get_meta().app_label}:detail', args=[str(self.pk)])\nlogging.debug(f'De...
<|body_start_0|> if not self.slug: self.slug = self.get_slug() super().clean() <|end_body_0|> <|body_start_1|> absolute_url = '' if self.slug: absolute_url = reverse(f'{self.get_meta().app_label}:detail_slug', args=[str(self.slug)]) else: abso...
A model that shows up in ModularHistory's search results; e.g., a quote or occurrence. Ideally, this class would be a mixin, but due to Django's model magic, it must be defined as an abstract model class.
SearchableModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchableModel: """A model that shows up in ModularHistory's search results; e.g., a quote or occurrence. Ideally, this class would be a mixin, but due to Django's model magic, it must be defined as an abstract model class.""" def clean(self): """Prepare the model instance to be sav...
stack_v2_sparse_classes_36k_train_034784
2,832
no_license
[ { "docstring": "Prepare the model instance to be saved.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Return the URL for the model instance detail page.", "name": "get_absolute_url", "signature": "def get_absolute_url(self)" } ]
2
null
Implement the Python class `SearchableModel` described below. Class description: A model that shows up in ModularHistory's search results; e.g., a quote or occurrence. Ideally, this class would be a mixin, but due to Django's model magic, it must be defined as an abstract model class. Method signatures and docstrings...
Implement the Python class `SearchableModel` described below. Class description: A model that shows up in ModularHistory's search results; e.g., a quote or occurrence. Ideally, this class would be a mixin, but due to Django's model magic, it must be defined as an abstract model class. Method signatures and docstrings...
edea4e5b0c382c604db2c3fbb58dc73e57de8431
<|skeleton|> class SearchableModel: """A model that shows up in ModularHistory's search results; e.g., a quote or occurrence. Ideally, this class would be a mixin, but due to Django's model magic, it must be defined as an abstract model class.""" def clean(self): """Prepare the model instance to be sav...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchableModel: """A model that shows up in ModularHistory's search results; e.g., a quote or occurrence. Ideally, this class would be a mixin, but due to Django's model magic, it must be defined as an abstract model class.""" def clean(self): """Prepare the model instance to be saved.""" ...
the_stack_v2_python_sparse
apps/search/models/searchable_model.py
RealGuy69/modularhistory
train
0
764c1158423a22f47c9965a292fc5a74204a4512
[ "if type:\n self.design_type = type\nif status:\n self.region_status = status\nif metadata:\n self.metadata = metadata\nif rangerAgentVersion:\n self.ranger_agent_version = rangerAgentVersion\nif clli:\n self.clli = clli\nif regionname:\n self.name = regionname\nif osversion:\n self.open_stack_...
<|body_start_0|> if type: self.design_type = type if status: self.region_status = status if metadata: self.metadata = metadata if rangerAgentVersion: self.ranger_agent_version = rangerAgentVersion if clli: self.clli = cl...
class method.
UrlParms
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UrlParms: """class method.""" def __init__(self, type=None, status=None, metadata=None, rangerAgentVersion=None, clli=None, regionname=None, osversion=None, location_type=None, state=None, country=None, city=None, street=None, zip=None, vlcp_name=None): """init method. :param type: :...
stack_v2_sparse_classes_36k_train_034785
3,213
no_license
[ { "docstring": "init method. :param type: :param status: :param metadata: :param rangerAgentVersion: :param clli: :param regionname: :param osversion: :param location_type: :param state: :param country: :param city: :param street: :param zip: :param vlcp_name:", "name": "__init__", "signature": "def __i...
4
stack_v2_sparse_classes_30k_train_000691
Implement the Python class `UrlParms` described below. Class description: class method. Method signatures and docstrings: - def __init__(self, type=None, status=None, metadata=None, rangerAgentVersion=None, clli=None, regionname=None, osversion=None, location_type=None, state=None, country=None, city=None, street=Non...
Implement the Python class `UrlParms` described below. Class description: class method. Method signatures and docstrings: - def __init__(self, type=None, status=None, metadata=None, rangerAgentVersion=None, clli=None, regionname=None, osversion=None, location_type=None, state=None, country=None, city=None, street=Non...
3ea2dcb191d8e41498fe062a79349c9d055224c6
<|skeleton|> class UrlParms: """class method.""" def __init__(self, type=None, status=None, metadata=None, rangerAgentVersion=None, clli=None, regionname=None, osversion=None, location_type=None, state=None, country=None, city=None, street=None, zip=None, vlcp_name=None): """init method. :param type: :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UrlParms: """class method.""" def __init__(self, type=None, status=None, metadata=None, rangerAgentVersion=None, clli=None, regionname=None, osversion=None, location_type=None, state=None, country=None, city=None, street=None, zip=None, vlcp_name=None): """init method. :param type: :param status:...
the_stack_v2_python_sparse
orm/services/region_manager/rms/model/url_parm.py
jq1581/ranger
train
0
1c0620022b2b7864d4bff3526252bc6e5325886d
[ "if not nums or len(nums) <= 0:\n return\nres = 0\nfor i in nums:\n res = res ^ i\nindex = self.findFirstBit(res)\nres1 = 0\nres2 = 0\nfor j in nums:\n if j >> index & 1 == 1:\n res1 = res1 ^ j\n else:\n res2 = res2 ^ j\nreturn [res1, res2]", "indexBit = 0\nwhile num & 1 == 0 and indexBi...
<|body_start_0|> if not nums or len(nums) <= 0: return res = 0 for i in nums: res = res ^ i index = self.findFirstBit(res) res1 = 0 res2 = 0 for j in nums: if j >> index & 1 == 1: res1 = res1 ^ j else...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def findNumsAppearOnce(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findFirstBit(self, num): """找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums or len...
stack_v2_sparse_classes_36k_train_034786
3,672
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findNumsAppearOnce", "signature": "def findNumsAppearOnce(self, nums)" }, { "docstring": "找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:", "name": "findFirstBit", "signature": "def findFirstBit(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_006943
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def findNumsAppearOnce(self, nums): :type nums: List[int] :rtype: List[int] - def findFirstBit(self, num): 找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def findNumsAppearOnce(self, nums): :type nums: List[int] :rtype: List[int] - def findFirstBit(self, num): 找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return: <|skeleton|> class So...
1db60502acb208f22d2149a4824e1219d8938225
<|skeleton|> class Solution1: def findNumsAppearOnce(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findFirstBit(self, num): """找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution1: def findNumsAppearOnce(self, nums): """:type nums: List[int] :rtype: List[int]""" if not nums or len(nums) <= 0: return res = 0 for i in nums: res = res ^ i index = self.findFirstBit(res) res1 = 0 res2 = 0 for j...
the_stack_v2_python_sparse
code_with_name/test55_prob56_数组中只出现一次的两个数字.py
Binjer/jianzhi_offer
train
2
9ec14e2dd9e672e0fbd7e2475c9dff346d968361
[ "self.db.occupants = []\nself.db.max_spots = 6\nself.desc = 'A place for people to privately chat. Dropping it in a room will make it part of the room.'\nself.locks.add(self.PLACE_LOCKS)\nself.at_init()", "occupants = self.db.occupants or []\nif character in occupants:\n occupants.remove(character)\n self.d...
<|body_start_0|> self.db.occupants = [] self.db.max_spots = 6 self.desc = 'A place for people to privately chat. Dropping it in a room will make it part of the room.' self.locks.add(self.PLACE_LOCKS) self.at_init() <|end_body_0|> <|body_start_1|> occupants = self.db.occu...
Class for placed objects that allow the 'tabletalk' command.
Place
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Place: """Class for placed objects that allow the 'tabletalk' command.""" def at_object_creation(self): """Run at Place creation.""" <|body_0|> def leave(self, character): """Character leaving the table.""" <|body_1|> def join(self, character): ...
stack_v2_sparse_classes_36k_train_034787
3,619
permissive
[ { "docstring": "Run at Place creation.", "name": "at_object_creation", "signature": "def at_object_creation(self)" }, { "docstring": "Character leaving the table.", "name": "leave", "signature": "def leave(self, character)" }, { "docstring": "Character joins the table", "name...
5
null
Implement the Python class `Place` described below. Class description: Class for placed objects that allow the 'tabletalk' command. Method signatures and docstrings: - def at_object_creation(self): Run at Place creation. - def leave(self, character): Character leaving the table. - def join(self, character): Character...
Implement the Python class `Place` described below. Class description: Class for placed objects that allow the 'tabletalk' command. Method signatures and docstrings: - def at_object_creation(self): Run at Place creation. - def leave(self, character): Character leaving the table. - def join(self, character): Character...
e1a2006ee728f76ee0f1a7056d99d2fdfa8e4706
<|skeleton|> class Place: """Class for placed objects that allow the 'tabletalk' command.""" def at_object_creation(self): """Run at Place creation.""" <|body_0|> def leave(self, character): """Character leaving the table.""" <|body_1|> def join(self, character): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Place: """Class for placed objects that allow the 'tabletalk' command.""" def at_object_creation(self): """Run at Place creation.""" self.db.occupants = [] self.db.max_spots = 6 self.desc = 'A place for people to privately chat. Dropping it in a room will make it part of t...
the_stack_v2_python_sparse
typeclasses/places/places.py
Reilena/arxcode
train
5
aa048432e488aab88a7c267226a94c313e54dc3c
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('aoconno8_dmak1112', 'aoconno8_dmak1112')\nurl = 'https://data.boston.gov/api/3/action/datastore_search?resource_id=bd8dd4bb-867e-4ca2-b6c7-6c3bd9e6c290&limit=176'\nresponse = urllib.request.urlopen(url)....
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('aoconno8_dmak1112', 'aoconno8_dmak1112') url = 'https://data.boston.gov/api/3/action/datastore_search?resource_id=bd8dd4bb-867e-4ca2-b6c7-6c3bd9e6c290&lim...
yearlyEmissions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class yearlyEmissions: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythi...
stack_v2_sparse_classes_36k_train_034788
3,717
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_val_000042
Implement the Python class `yearlyEmissions` described below. Class description: Implement the yearlyEmissions class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=Non...
Implement the Python class `yearlyEmissions` described below. Class description: Implement the yearlyEmissions class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=Non...
b5ccaad97f6e35f9580e645ca764f36eb3406f43
<|skeleton|> class yearlyEmissions: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class yearlyEmissions: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('aoconno8_dmak1112', 'aoconno8_dmak1...
the_stack_v2_python_sparse
aoconno8_dmak1112/yearlyEmissions.py
dwang1995/course-2018-spr-proj
train
1
2cb8c3efc4625767b31f0375d8665c388903cd70
[ "domain_context = request.session.get('domain_context')\nfilters = rest_utils.parse_filters_kwargs(request, self.client_keywords)[0]\nif not filters:\n filters = None\nresult = api.keystone.user_list(request, project=request.GET.get('project_id'), domain=request.GET.get('domain_id', domain_context), group=reques...
<|body_start_0|> domain_context = request.session.get('domain_context') filters = rest_utils.parse_filters_kwargs(request, self.client_keywords)[0] if not filters: filters = None result = api.keystone.user_list(request, project=request.GET.get('project_id'), domain=request.GE...
API for keystone users.
Users
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Users: """API for keystone users.""" def get(self, request): """Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is a...
stack_v2_sparse_classes_36k_train_034789
22,644
permissive
[ { "docstring": "Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is an object with property \"items\".", "name": "get", "signature": "def...
3
null
Implement the Python class `Users` described below. Class description: API for keystone users. Method signatures and docstrings: - def get(self, request): Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id ...
Implement the Python class `Users` described below. Class description: API for keystone users. Method signatures and docstrings: - def get(self, request): Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id ...
7896fd8c77a6766a1156a520946efaf792b76ca5
<|skeleton|> class Users: """API for keystone users.""" def get(self, request): """Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Users: """API for keystone users.""" def get(self, request): """Get a list of users. By default, a listing of all users for the current domain are returned. You may specify GET parameters for project_id, domain_id and group_id to change that listing's context. The listing result is an object with...
the_stack_v2_python_sparse
openstack_dashboard/api/rest/keystone.py
openstack/horizon
train
1,060
e4a5f8fa097cc3d95c38414b8c178f727fa62aa9
[ "data_ID = request.args.get('id')\nif data_ID != None:\n app.logger.info(data_ID)\n case_data = testCase.query.filter_by(id=data_ID).all()\n data = [i.as_dict() for i in case_data]\n return {'error': 0, 'msg': {'data': data}}\nelse:\n case_data = testCase.query.all()\n print(type(case_data))\n ...
<|body_start_0|> data_ID = request.args.get('id') if data_ID != None: app.logger.info(data_ID) case_data = testCase.query.filter_by(id=data_ID).all() data = [i.as_dict() for i in case_data] return {'error': 0, 'msg': {'data': data}} else: ...
TestCaseService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCaseService: def get(self): """查询接口,查询用例数据信息""" <|body_0|> def post(self): """增加接口,增加用例数据""" <|body_1|> def put(self): """修改接口信息 :return:""" <|body_2|> def delete(self): """删除操作 :return:""" <|body_3|> <|end_skele...
stack_v2_sparse_classes_36k_train_034790
3,113
no_license
[ { "docstring": "查询接口,查询用例数据信息", "name": "get", "signature": "def get(self)" }, { "docstring": "增加接口,增加用例数据", "name": "post", "signature": "def post(self)" }, { "docstring": "修改接口信息 :return:", "name": "put", "signature": "def put(self)" }, { "docstring": "删除操作 :ret...
4
stack_v2_sparse_classes_30k_train_002903
Implement the Python class `TestCaseService` described below. Class description: Implement the TestCaseService class. Method signatures and docstrings: - def get(self): 查询接口,查询用例数据信息 - def post(self): 增加接口,增加用例数据 - def put(self): 修改接口信息 :return: - def delete(self): 删除操作 :return:
Implement the Python class `TestCaseService` described below. Class description: Implement the TestCaseService class. Method signatures and docstrings: - def get(self): 查询接口,查询用例数据信息 - def post(self): 增加接口,增加用例数据 - def put(self): 修改接口信息 :return: - def delete(self): 删除操作 :return: <|skeleton|> class TestCaseService: ...
8891c10e094b13d07cf4830855c37cebd07bd3d4
<|skeleton|> class TestCaseService: def get(self): """查询接口,查询用例数据信息""" <|body_0|> def post(self): """增加接口,增加用例数据""" <|body_1|> def put(self): """修改接口信息 :return:""" <|body_2|> def delete(self): """删除操作 :return:""" <|body_3|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCaseService: def get(self): """查询接口,查询用例数据信息""" data_ID = request.args.get('id') if data_ID != None: app.logger.info(data_ID) case_data = testCase.query.filter_by(id=data_ID).all() data = [i.as_dict() for i in case_data] return {'erro...
the_stack_v2_python_sparse
Backend_Service/apis/api_testcases.py
BlueZUJIUPUP/HogwartsSDE18
train
1
3f4d9f0cf8360445bad19e3d8cfb97f550be2594
[ "self._base_profile = base_profile\nself._shape = shape\nself.center_plev = center_plev\nself.width = width\nself.fixed_T = fixed_T\nself.center_T = None\nif intensity > 1:\n intensity /= 100\nself.intensity = float(intensity)", "plev = atmosphere['plev']\nT = atmosphere['T'][-1]\nif self.center_T == None:\n ...
<|body_start_0|> self._base_profile = base_profile self._shape = shape self.center_plev = center_plev self.width = width self.fixed_T = fixed_T self.center_T = None if intensity > 1: intensity /= 100 self.intensity = float(intensity) <|end_body...
Wrapper to add a perturbation to a Relative Humidity profile.
PerturbProfile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerturbProfile: """Wrapper to add a perturbation to a Relative Humidity profile.""" def __init__(self, base_profile=VerticallyUniform(), shape='square', center_plev=50000.0, width=5000.0, intensity=0.1, fixed_T=False): """Parameters: base_profile (konrad.relative_humidity model): ini...
stack_v2_sparse_classes_36k_train_034791
13,283
permissive
[ { "docstring": "Parameters: base_profile (konrad.relative_humidity model): initial profile on which we will add the perturbation. shape (str): name of the shape of the perturbation. Implemented : \"square\", \"gaussian\". For a Dirac use a square with width 0. center_plev (float): Pressure of the center of the ...
2
stack_v2_sparse_classes_30k_train_010901
Implement the Python class `PerturbProfile` described below. Class description: Wrapper to add a perturbation to a Relative Humidity profile. Method signatures and docstrings: - def __init__(self, base_profile=VerticallyUniform(), shape='square', center_plev=50000.0, width=5000.0, intensity=0.1, fixed_T=False): Param...
Implement the Python class `PerturbProfile` described below. Class description: Wrapper to add a perturbation to a Relative Humidity profile. Method signatures and docstrings: - def __init__(self, base_profile=VerticallyUniform(), shape='square', center_plev=50000.0, width=5000.0, intensity=0.1, fixed_T=False): Param...
2d9b5a78a1aab5d4dd2ccca99ddbce388de02738
<|skeleton|> class PerturbProfile: """Wrapper to add a perturbation to a Relative Humidity profile.""" def __init__(self, base_profile=VerticallyUniform(), shape='square', center_plev=50000.0, width=5000.0, intensity=0.1, fixed_T=False): """Parameters: base_profile (konrad.relative_humidity model): ini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerturbProfile: """Wrapper to add a perturbation to a Relative Humidity profile.""" def __init__(self, base_profile=VerticallyUniform(), shape='square', center_plev=50000.0, width=5000.0, intensity=0.1, fixed_T=False): """Parameters: base_profile (konrad.relative_humidity model): initial profile ...
the_stack_v2_python_sparse
konrad/humidity/relative_humidity.py
atmtools/konrad
train
17
ba9e6a60a395a9118514acefe21a1a677c0c9edd
[ "Message.__init__(self)\nself.transaction_id = transaction_id\nself.ack = ack\nself.passport = ''\nself.friendly_name = ''", "message = Message.__str__(self)\ncommand = 'MSG %u %s %u\\r\\n' % (self.transaction_id, self.ack, len(message))\nreturn command + message", "message = Message.__repr__(self)\nlength = le...
<|body_start_0|> Message.__init__(self) self.transaction_id = transaction_id self.ack = ack self.passport = '' self.friendly_name = '' <|end_body_0|> <|body_start_1|> message = Message.__str__(self) command = 'MSG %u %s %u\r\n' % (self.transaction_id, self.ack, l...
Build MSG commands destined to be sent.
OutgoingMessage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutgoingMessage: """Build MSG commands destined to be sent.""" def __init__(self, transaction_id, ack): """Initializer @param transaction_id: the transaction ID @type transaction_id: integer @param ack: Acknowledgment type @type ack: L{message.MessageAcknowledgement}""" <|bod...
stack_v2_sparse_classes_36k_train_034792
6,280
no_license
[ { "docstring": "Initializer @param transaction_id: the transaction ID @type transaction_id: integer @param ack: Acknowledgment type @type ack: L{message.MessageAcknowledgement}", "name": "__init__", "signature": "def __init__(self, transaction_id, ack)" }, { "docstring": "Represents the message ...
3
stack_v2_sparse_classes_30k_test_000371
Implement the Python class `OutgoingMessage` described below. Class description: Build MSG commands destined to be sent. Method signatures and docstrings: - def __init__(self, transaction_id, ack): Initializer @param transaction_id: the transaction ID @type transaction_id: integer @param ack: Acknowledgment type @typ...
Implement the Python class `OutgoingMessage` described below. Class description: Build MSG commands destined to be sent. Method signatures and docstrings: - def __init__(self, transaction_id, ack): Initializer @param transaction_id: the transaction ID @type transaction_id: integer @param ack: Acknowledgment type @typ...
16043edb5070b0755ed79b0aa02cba399d3d839d
<|skeleton|> class OutgoingMessage: """Build MSG commands destined to be sent.""" def __init__(self, transaction_id, ack): """Initializer @param transaction_id: the transaction ID @type transaction_id: integer @param ack: Acknowledgment type @type ack: L{message.MessageAcknowledgement}""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutgoingMessage: """Build MSG commands destined to be sent.""" def __init__(self, transaction_id, ack): """Initializer @param transaction_id: the transaction ID @type transaction_id: integer @param ack: Acknowledgment type @type ack: L{message.MessageAcknowledgement}""" Message.__init__(s...
the_stack_v2_python_sparse
pymsn.rewrite/pymsn.rewrite/pymsn/msnp/message.py
Zacchy/nickcheng-python
train
0
104aee12b4f796981cab80555fcb49d5772aa1c3
[ "dump_node = ListNode(0)\ncur_node = dump_node\nwhile l1 or l2:\n while l1 and (l2 == None or l1.val <= l2.val):\n cur_node.next = ListNode(l1.val)\n cur_node = cur_node.next\n l1 = l1.next\n while l2 and (l1 == None or l2.val < l1.val):\n cur_node.next = ListNode(l2.val)\n ...
<|body_start_0|> dump_node = ListNode(0) cur_node = dump_node while l1 or l2: while l1 and (l2 == None or l1.val <= l2.val): cur_node.next = ListNode(l1.val) cur_node = cur_node.next l1 = l1.next while l2 and (l1 == None or ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> dump_nod...
stack_v2_sparse_classes_36k_train_034793
1,499
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" } ]
2
stack_v2_sparse_classes_30k_train_016268
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode <|skeleton|>...
22f208400cd7e13fcf2ebf189e61ccad7e22b098
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" dump_node = ListNode(0) cur_node = dump_node while l1 or l2: while l1 and (l2 == None or l1.val <= l2.val): cur_node.next = ListNode(l1.val) ...
the_stack_v2_python_sparse
previously_completed/1-30/23-Merge_k_Sorted_Lists.py
learnerjiahao/leetcode-solve
train
0
f7c0618e8b1af213f6594ad1a6496f5de699e589
[ "self.ascending_height_points = np.array([5.0, 10.0, 20.0])\nself.ascending_cube = _set_up_height_cube(self.ascending_height_points)\nself.descending_height_points = np.array([20.0, 10.0, 5.0])\nself.descending_cube = _set_up_height_cube(self.descending_height_points, ascending=False)\nself.plugin_positive = Integr...
<|body_start_0|> self.ascending_height_points = np.array([5.0, 10.0, 20.0]) self.ascending_cube = _set_up_height_cube(self.ascending_height_points) self.descending_height_points = np.array([20.0, 10.0, 5.0]) self.descending_cube = _set_up_height_cube(self.descending_height_points, ascend...
Test the ensure_monotonic_increase_in_chosen_direction method.
Test_ensure_monotonic_increase_in_chosen_direction
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_ensure_monotonic_increase_in_chosen_direction: """Test the ensure_monotonic_increase_in_chosen_direction method.""" def setUp(self): """Set up the cube.""" <|body_0|> def test_ascending_coordinate_positive(self): """Test that for a monotonically ascending co...
stack_v2_sparse_classes_36k_train_034794
25,011
permissive
[ { "docstring": "Set up the cube.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that for a monotonically ascending coordinate, where the chosen direction is positive, the resulting coordinate still increases monotonically in the positive direction.", "name": "test_...
5
stack_v2_sparse_classes_30k_train_007167
Implement the Python class `Test_ensure_monotonic_increase_in_chosen_direction` described below. Class description: Test the ensure_monotonic_increase_in_chosen_direction method. Method signatures and docstrings: - def setUp(self): Set up the cube. - def test_ascending_coordinate_positive(self): Test that for a monot...
Implement the Python class `Test_ensure_monotonic_increase_in_chosen_direction` described below. Class description: Test the ensure_monotonic_increase_in_chosen_direction method. Method signatures and docstrings: - def setUp(self): Set up the cube. - def test_ascending_coordinate_positive(self): Test that for a monot...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_ensure_monotonic_increase_in_chosen_direction: """Test the ensure_monotonic_increase_in_chosen_direction method.""" def setUp(self): """Set up the cube.""" <|body_0|> def test_ascending_coordinate_positive(self): """Test that for a monotonically ascending co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_ensure_monotonic_increase_in_chosen_direction: """Test the ensure_monotonic_increase_in_chosen_direction method.""" def setUp(self): """Set up the cube.""" self.ascending_height_points = np.array([5.0, 10.0, 20.0]) self.ascending_cube = _set_up_height_cube(self.ascending_heig...
the_stack_v2_python_sparse
improver_tests/utilities/test_mathematical_operations.py
metoppv/improver
train
101
3f45929b6069a8d1ae963fbdeb073ad852b4d719
[ "if not s or s[0] == '0':\n return 0\ndp1, dp2 = (0, 1)\nfor i in range(len(s)):\n current = 0\n if s[i] != '0':\n current = dp2\n if i > 0 and 10 <= int(s[i - 1:i + 1]) <= 26:\n current += dp1\n dp1, dp2 = (dp2, current)\nreturn dp2", "def dp(index):\n if index in records:\n ...
<|body_start_0|> if not s or s[0] == '0': return 0 dp1, dp2 = (0, 1) for i in range(len(s)): current = 0 if s[i] != '0': current = dp2 if i > 0 and 10 <= int(s[i - 1:i + 1]) <= 26: current += dp1 dp1, dp2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numDecodings(self, s): """:type s: str :rtype: int""" <|body_0|> def numDecodings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s or s[0] == '0': return 0 dp1, dp2 = (0...
stack_v2_sparse_classes_36k_train_034795
2,067
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "numDecodings", "signature": "def numDecodings(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "numDecodings", "signature": "def numDecodings(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_005569
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDecodings(self, s): :type s: str :rtype: int - def numDecodings(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDecodings(self, s): :type s: str :rtype: int - def numDecodings(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def numDecodings(self, s): ""...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def numDecodings(self, s): """:type s: str :rtype: int""" <|body_0|> def numDecodings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numDecodings(self, s): """:type s: str :rtype: int""" if not s or s[0] == '0': return 0 dp1, dp2 = (0, 1) for i in range(len(s)): current = 0 if s[i] != '0': current = dp2 if i > 0 and 10 <= int(s[i -...
the_stack_v2_python_sparse
src/lt_91.py
oxhead/CodingYourWay
train
0
687c2a9ce6d6e85c7ec828cfd17ddaee1e8c5e94
[ "data = parser.parse_args()\nproject_type = data.get('type')\nif project_type == 'annotation':\n return project_dao.all(project_type=TASK_ANNOTATION)\nelif project_type == 'fusion':\n return project_dao.all(project_type=TASK_FUSION)\nreturn project_dao.all()", "req_dict = api.payload\nname = req_dict.get('n...
<|body_start_0|> data = parser.parse_args() project_type = data.get('type') if project_type == 'annotation': return project_dao.all(project_type=TASK_ANNOTATION) elif project_type == 'fusion': return project_dao.all(project_type=TASK_FUSION) return project...
Shows a list of all projects, and lets you to add new projects.
ProjectList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectList: """Shows a list of all projects, and lets you to add new projects.""" def get(self): """List all projects""" <|body_0|> def post(self): """Create new project""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = parser.parse_args()...
stack_v2_sparse_classes_36k_train_034796
5,767
permissive
[ { "docstring": "List all projects", "name": "get", "signature": "def get(self)" }, { "docstring": "Create new project", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_test_000668
Implement the Python class `ProjectList` described below. Class description: Shows a list of all projects, and lets you to add new projects. Method signatures and docstrings: - def get(self): List all projects - def post(self): Create new project
Implement the Python class `ProjectList` described below. Class description: Shows a list of all projects, and lets you to add new projects. Method signatures and docstrings: - def get(self): List all projects - def post(self): Create new project <|skeleton|> class ProjectList: """Shows a list of all projects, a...
953c2916c38906b0941c015136f80b2e64dd94f3
<|skeleton|> class ProjectList: """Shows a list of all projects, and lets you to add new projects.""" def get(self): """List all projects""" <|body_0|> def post(self): """Create new project""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectList: """Shows a list of all projects, and lets you to add new projects.""" def get(self): """List all projects""" data = parser.parse_args() project_type = data.get('type') if project_type == 'annotation': return project_dao.all(project_type=TASK_ANNOTA...
the_stack_v2_python_sparse
kgeditor/api_1_0/project.py
LaiXinyi823/KGEditor
train
0
6bcd9bd3098be2fb41bd5e9bef808c21e2e9f64a
[ "assert uid == SUPERUSER_ID, 'User to force discount value should be the administrator'\nproduct_ids = self.search(cr, uid, [], discount_id, context=context)\n_logger.debug('Dicount id force default : %d', discount_id)\nself.write(cr, uid, product_ids, {'discount_id': discount_id}, context=context)", "assert uid ...
<|body_start_0|> assert uid == SUPERUSER_ID, 'User to force discount value should be the administrator' product_ids = self.search(cr, uid, [], discount_id, context=context) _logger.debug('Dicount id force default : %d', discount_id) self.write(cr, uid, product_ids, {'discount_id': discou...
ProductTemplate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductTemplate: def force_default_discount(self, cr, uid, ids=[], discount_id=0, context=None): """Quick solution to avoid encoding the same discount manually for each product User should be admin""" <|body_0|> def force_default_taxes(self, cr, uid, ids=[], taxes_ids=[1], c...
stack_v2_sparse_classes_36k_train_034797
12,134
no_license
[ { "docstring": "Quick solution to avoid encoding the same discount manually for each product User should be admin", "name": "force_default_discount", "signature": "def force_default_discount(self, cr, uid, ids=[], discount_id=0, context=None)" }, { "docstring": "Quick solution to avoid encoding ...
2
stack_v2_sparse_classes_30k_train_002409
Implement the Python class `ProductTemplate` described below. Class description: Implement the ProductTemplate class. Method signatures and docstrings: - def force_default_discount(self, cr, uid, ids=[], discount_id=0, context=None): Quick solution to avoid encoding the same discount manually for each product User sh...
Implement the Python class `ProductTemplate` described below. Class description: Implement the ProductTemplate class. Method signatures and docstrings: - def force_default_discount(self, cr, uid, ids=[], discount_id=0, context=None): Quick solution to avoid encoding the same discount manually for each product User sh...
3681cbad05d5748198318fc1774be77b5f6b420e
<|skeleton|> class ProductTemplate: def force_default_discount(self, cr, uid, ids=[], discount_id=0, context=None): """Quick solution to avoid encoding the same discount manually for each product User should be admin""" <|body_0|> def force_default_taxes(self, cr, uid, ids=[], taxes_ids=[1], c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductTemplate: def force_default_discount(self, cr, uid, ids=[], discount_id=0, context=None): """Quick solution to avoid encoding the same discount manually for each product User should be admin""" assert uid == SUPERUSER_ID, 'User to force discount value should be the administrator' ...
the_stack_v2_python_sparse
account_grouped_invoice/grouped_invoice.py
dbertha/odoo-addons
train
1
348ad1bfbf42d03f884ebacec344b8dfa1293a8d
[ "N = len(arr)\nif x < arr[0]:\n return arr[:k]\nelif x > arr[-1]:\n return arr[N - k:]\nelse:\n index = bisect.bisect_left(arr, x)\n low = max(0, index - k - 1)\n high = min(N - 1, index + k - 1)\n while high - low > k - 1:\n if low < 0 or x - arr[low] <= arr[high] - x:\n high -=...
<|body_start_0|> N = len(arr) if x < arr[0]: return arr[:k] elif x > arr[-1]: return arr[N - k:] else: index = bisect.bisect_left(arr, x) low = max(0, index - k - 1) high = min(N - 1, index + k - 1) while high - low ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findClosestElements(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_0|> def findClosestElements_sort(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_...
stack_v2_sparse_classes_36k_train_034798
1,244
no_license
[ { "docstring": ":type arr: List[int] :type k: int :type x: int :rtype: List[int]", "name": "findClosestElements", "signature": "def findClosestElements(self, arr, k, x)" }, { "docstring": ":type arr: List[int] :type k: int :type x: int :rtype: List[int]", "name": "findClosestElements_sort", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr, k, x): :type arr: List[int] :type k: int :type x: int :rtype: List[int] - def findClosestElements_sort(self, arr, k, x): :type arr: List[int] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr, k, x): :type arr: List[int] :type k: int :type x: int :rtype: List[int] - def findClosestElements_sort(self, arr, k, x): :type arr: List[int] :...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def findClosestElements(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_0|> def findClosestElements_sort(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findClosestElements(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" N = len(arr) if x < arr[0]: return arr[:k] elif x > arr[-1]: return arr[N - k:] else: index = bisect.bisect_lef...
the_stack_v2_python_sparse
Algorithm/658_Find_K_Closest_Elements.py
Gi1ia/TechNoteBook
train
7
1e3dba93ae471f32ec8b1a9eac7aaeb154273b37
[ "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)\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)", "STE = tfds.deprecated.text.SubwordTex...
<|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) self.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train) <|end_bo...
loads and preps a dataset for machine translation
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """loads and preps a dataset for machine translation""" def __init__(self): """creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt t...
stack_v2_sparse_classes_36k_train_034799
3,158
no_license
[ { "docstring": "creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt to_en tf.data.Dataset validate split, loaded as_supervided tokenizer_pt is the Portuguese tokenizer c...
3
null
Implement the Python class `Dataset` described below. Class description: loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self): creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervid...
Implement the Python class `Dataset` described below. Class description: loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self): creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervid...
5114f884241b3406940b00450d8c71f55d5d6a70
<|skeleton|> class Dataset: """loads and preps a dataset for machine translation""" def __init__(self): """creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """loads and preps a dataset for machine translation""" def __init__(self): """creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt to_en tf.data....
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/1-dataset.py
icculp/holbertonschool-machine_learning
train
0